Release 5 Ballot

This page is part of the FHIR Specification (v5.0.0-ballot: R5 Ballot - see ballot notes). The current version which supercedes this version is 5.0.0. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4

Example Library/opioidcds-recommendation-07 (Narrative)

Clinical Decision Support Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: Not linked to any defined compartments

This is the narrative for the resource. See also the XML, JSON or Turtle format. This example conforms to the profile Library.


Participants

AuthorKensaku Kawamoto, MD, PhD, MHS
AuthorBryn Rhodes
AuthorFloyd Eisenberg, MD, MPH
AuthorRobert McClure, MD, MPH

Related Artifacts

DocumentationCDC guideline for prescribing opioids for chronic pain

https://guidelines.gov/summaries/summary/50153/cdc-guideline-for-prescribing-opioids-for-chronic-pain---united-states-2016#420 ()

Depends Onhttp://example.org/fhir/Library/opioidcds-common

Data Requirements

Type: MedicationRequest
FilterValue
medicationCodeableConceptIn ValueSet http://example.org/fhir/ValueSet/opioids-indicating-end-of-life
Type: Procedure
FilterValue
codeOne of these codes:
Type: Procedure
FilterValue
codeOne of these codes:
Type: MedicationRequest
FilterValue
medicationCodeableConceptIn ValueSet http://example.org/fhir/ValueSet/opioids-abused-in-ambulatory-care
Type: Encounter

Contents

application/elm+xml

<?xml version="1.0" encoding="UTF-8"?>
<library xmlns="urn:hl7-org:elm:r1" xmlns:t="urn:hl7-org:elm-types:r1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:fhir="http://hl7.org/fhir" xmlns:qdm43="urn:healthit-gov:qdm:v4_3" xmlns:qdm53="urn:healthit-gov:qdm:v5_3" xmlns:a="urn:hl7-org:cql-annotations:r1">
   <annotation startLine="76" startChar="3" endLine="76" endChar="51" message="Could not resolve code path medicationCodeableConcept for the type of the retrieve FHIR.MedicationRequest." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation startLine="76" startChar="3" endLine="76" endChar="51" message="Could not resolve membership operator for terminology target of the retrieve." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation startLine="85" startChar="4" endLine="85" endChar="53" message="Could not resolve membership operator for terminology target of the retrieve." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation startLine="86" startChar="13" endLine="86" endChar="52" message="Could not resolve membership operator for terminology target of the retrieve." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation startLine="95" startChar="3" endLine="95" endChar="66" message="Could not resolve code path medicationCodeableConcept for the type of the retrieve FHIR.MedicationRequest." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation startLine="95" startChar="3" endLine="95" endChar="66" message="Could not resolve membership operator for terminology target of the retrieve." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation startLine="103" startChar="10" endLine="103" endChar="70" message="List-valued expression was demoted to a singleton." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation startLine="69" startChar="59" endLine="69" endChar="88" message="List-valued expression was demoted to a singleton." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation startLine="115" startChar="6" endLine="115" endChar="35" message="List-valued expression was demoted to a singleton." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <identifier id="OpioidCDS_STU4_REC_07" version="0.1.0"/>
   <schemaIdentifier id="urn:hl7-org:elm" version="r1"/>
   <usings>
      <def localIdentifier="System" uri="urn:hl7-org:elm-types:r1"/>
      <def localIdentifier="FHIR" uri="http://hl7.org/fhir" version="3.2.0"/>
   </usings>
   <includes>
      <def localIdentifier="Common" path="OpioidCDS_STU4_Common" version="0.1.0"/>
   </includes>
   <parameters>
      <def name="ContextPrescriptions" accessLevel="Public">
         <parameterTypeSpecifier xsi:type="ListTypeSpecifier">
            <elementType name="fhir:MedicationRequest" xsi:type="NamedTypeSpecifier"/>
         </parameterTypeSpecifier>
      </def>
   </parameters>
   <codeSystems>
      <def name="SNOMED" id="http://snomed.info/sct" accessLevel="Public"/>
   </codeSystems>
   <codes>
      <def name="Assessment of risk for opioid abuse" id="454281000124100" accessLevel="Public">
         <codeSystem name="SNOMED"/>
      </def>
      <def name="High risk drug monitoring" id="268525008" accessLevel="Public">
         <codeSystem name="SNOMED"/>
      </def>
   </codes>
   <statements>
      <def name="Patient" context="Patient">
         <expression xsi:type="SingletonFrom">
            <operand dataType="fhir:Patient" xsi:type="Retrieve"/>
         </expression>
      </def>
      <def name="Risk Assessment Interval" context="Patient" accessLevel="Public">
         <expression lowClosed="true" highClosed="true" xsi:type="Interval">
            <low xsi:type="Subtract">
               <operand xsi:type="Today"/>
               <operand value="91" unit="days" xsi:type="Quantity"/>
            </low>
            <high xsi:type="Subtract">
               <operand xsi:type="Today"/>
               <operand value="1" unit="day" xsi:type="Quantity"/>
            </high>
         </expression>
      </def>
      <def name="Encounter Interval" context="Patient" accessLevel="Public">
         <expression lowClosed="true" highClosed="true" xsi:type="Interval">
            <low xsi:type="Subtract">
               <operand xsi:type="Subtract">
                  <operand xsi:type="Today"/>
                  <operand value="12" unit="months" xsi:type="Quantity"/>
               </operand>
               <operand value="1" unit="days" xsi:type="Quantity"/>
            </low>
            <high xsi:type="Subtract">
               <operand xsi:type="Today"/>
               <operand value="1" unit="day" xsi:type="Quantity"/>
            </high>
         </expression>
      </def>
      <def name="Validate Trigger Event" context="Patient" accessLevel="Public">
         <expression xsi:type="Exists">
            <operand xsi:type="Query">
               <source alias="triggerScript">
                  <expression name="ContextPrescriptions" xsi:type="ParameterRef"/>
               </source>
               <where name="IsOpioidWithAmbulatoryAbusePotential" libraryName="Common" xsi:type="FunctionRef">
                  <operand name="ToCode" libraryName="Common" xsi:type="FunctionRef">
                     <operand xsi:type="Indexer">
                        <operand path="coding" xsi:type="Property">
                           <source path="medication" scope="triggerScript" xsi:type="Property"/>
                        </operand>
                        <operand valueType="t:Integer" value="0" xsi:type="Literal"/>
                     </operand>
                  </operand>
               </where>
            </operand>
         </expression>
      </def>
      <def name="Medications Indicating End Of Life" context="Patient" accessLevel="Public">
         <expression xsi:type="Query">
            <source alias="endOfLifeRx">
               <expression dataType="fhir:MedicationRequest" codeProperty="medicationCodeableConcept" xsi:type="Retrieve">
                  <codes name="End Of Life Opioids" libraryName="Common" xsi:type="ValueSetRef"/>
               </expression>
            </source>
            <where xsi:type="Equal">
               <operand path="value" xsi:type="Property">
                  <source path="status" scope="endOfLifeRx" xsi:type="Property"/>
               </operand>
               <operand valueType="t:String" value="active" xsi:type="Literal"/>
            </where>
         </expression>
      </def>
      <def name="Exclusion Criteria" context="Patient" accessLevel="Public">
         <expression xsi:type="Exists">
            <operand name="Medications Indicating End Of Life" xsi:type="ExpressionRef"/>
         </expression>
      </def>
      <def name="Opioid Risk Assessment in Past 90 Days" context="Patient" accessLevel="Public">
         <expression xsi:type="Query">
            <source alias="riskAssessment">
               <expression xsi:type="Union">
                  <operand dataType="fhir:Procedure" codeProperty="code" xsi:type="Retrieve">
                     <codes name="Assessment of risk for opioid abuse" xsi:type="CodeRef"/>
                  </operand>
                  <operand dataType="fhir:Procedure" codeProperty="code" xsi:type="Retrieve">
                     <codes name="High risk drug monitoring" xsi:type="CodeRef"/>
                  </operand>
               </expression>
            </source>
            <where xsi:type="In">
               <operand path="value" xsi:type="Property">
                  <source path="start" xsi:type="Property">
                     <source path="performed" scope="riskAssessment" xsi:type="Property"/>
                  </source>
               </operand>
               <operand name="Risk Assessment Interval" xsi:type="ExpressionRef"/>
            </where>
         </expression>
      </def>
      <def name="Get Active Ambulatory Opioid Rx" context="Patient" accessLevel="Public">
         <expression xsi:type="Query">
            <source alias="Rx">
               <expression dataType="fhir:MedicationRequest" codeProperty="medicationCodeableConcept" xsi:type="Retrieve">
                  <codes name="Ambulatory Abuse Potential Opioids" libraryName="Common" xsi:type="ValueSetRef"/>
               </expression>
            </source>
            <where xsi:type="And">
               <operand xsi:type="Equal">
                  <operand path="value" xsi:type="Property">
                     <source path="status" scope="Rx" xsi:type="Property"/>
                  </operand>
                  <operand valueType="t:String" value="active" xsi:type="Literal"/>
               </operand>
               <operand xsi:type="Equal">
                  <operand path="value" xsi:type="Property">
                     <source path="code" xsi:type="Property">
                        <source xsi:type="Indexer">
                           <operand xsi:type="Flatten">
                              <operand xsi:type="Query">
                                 <source alias="$this">
                                    <expression path="category" scope="Rx" xsi:type="Property"/>
                                 </source>
                                 <where xsi:type="Not">
                                    <operand xsi:type="IsNull">
                                       <operand path="coding" xsi:type="Property">
                                          <source name="$this" xsi:type="AliasRef"/>
                                       </operand>
                                    </operand>
                                 </where>
                                 <return>
                                    <expression path="coding" xsi:type="Property">
                                       <source name="$this" xsi:type="AliasRef"/>
                                    </expression>
                                 </return>
                              </operand>
                           </operand>
                           <operand valueType="t:Integer" value="0" xsi:type="Literal"/>
                        </source>
                     </source>
                  </operand>
                  <operand valueType="t:String" value="outpatient" xsi:type="Literal"/>
               </operand>
            </where>
         </expression>
      </def>
      <def name="Encounter in past 12 months" context="Patient" accessLevel="Public">
         <expression xsi:type="Query">
            <source alias="E">
               <expression dataType="fhir:Encounter" xsi:type="Retrieve"/>
            </source>
            <where xsi:type="In">
               <operand path="value" xsi:type="Property">
                  <source path="start" xsi:type="Property">
                     <source path="period" scope="E" xsi:type="Property"/>
                  </source>
               </operand>
               <operand name="Encounter Interval" xsi:type="ExpressionRef"/>
            </where>
         </expression>
      </def>
      <def name="Rx Active 7 of Past 10 Days With Encounter" context="Patient" accessLevel="Public">
         <expression xsi:type="And">
            <operand xsi:type="SingletonFrom">
               <operand name="ProbableDaysInRange" libraryName="Common" xsi:type="FunctionRef">
                  <operand name="Get Active Ambulatory Opioid Rx" xsi:type="ExpressionRef"/>
                  <operand valueType="t:Integer" value="10" xsi:type="Literal"/>
                  <operand valueType="t:Integer" value="7" xsi:type="Literal"/>
               </operand>
            </operand>
            <operand xsi:type="Exists">
               <operand name="Encounter in past 12 months" xsi:type="ExpressionRef"/>
            </operand>
         </expression>
      </def>
      <def name="Rx Active 63 of Past 90 Days" context="Patient" accessLevel="Public">
         <expression name="ProbableDaysInRange" libraryName="Common" xsi:type="FunctionRef">
            <operand name="Get Active Ambulatory Opioid Rx" xsi:type="ExpressionRef"/>
            <operand valueType="t:Integer" value="90" xsi:type="Literal"/>
            <operand valueType="t:Integer" value="63" xsi:type="Literal"/>
         </expression>
      </def>
      <def name="Inclusion Criteria" context="Patient" accessLevel="Public">
         <expression xsi:type="And">
            <operand xsi:type="And">
               <operand xsi:type="And">
                  <operand name="Validate Trigger Event" xsi:type="ExpressionRef"/>
                  <operand xsi:type="Not">
                     <operand name="Exclusion Criteria" xsi:type="ExpressionRef"/>
                  </operand>
               </operand>
               <operand xsi:type="Not">
                  <operand xsi:type="Exists">
                     <operand name="Opioid Risk Assessment in Past 90 Days" xsi:type="ExpressionRef"/>
                  </operand>
               </operand>
            </operand>
            <operand xsi:type="Or">
               <operand name="Rx Active 7 of Past 10 Days With Encounter" xsi:type="ExpressionRef"/>
               <operand xsi:type="SingletonFrom">
                  <operand name="Rx Active 63 of Past 90 Days" xsi:type="ExpressionRef"/>
               </operand>
            </operand>
         </expression>
      </def>
      <def name="Get Indicator" context="Patient" accessLevel="Public">
         <expression valueType="t:String" value="warning" xsi:type="Literal"/>
      </def>
      <def name="Get Summary" context="Patient" accessLevel="Public">
         <expression valueType="t:String" value="Patients on opioid therapy should be evaluated for benefits and harms within 1 to 4 weeks of starting opioid therapy and every 3 months or more subsequently." xsi:type="Literal"/>
      </def>
      <def name="Get Detail" context="Patient" accessLevel="Public">
         <expression xsi:type="If">
            <condition xsi:type="SingletonFrom">
               <operand name="Rx Active 63 of Past 90 Days" xsi:type="ExpressionRef"/>
            </condition>
            <then valueType="t:String" value="No evaluation for benefits and harms associated with opioid therapy has been performed for the patient in the past 3 months" xsi:type="Literal"/>
            <else valueType="t:String" value="No evaluation for benefits and harms has been performed for the patient starting opioid therapy" xsi:type="Literal"/>
         </expression>
      </def>
   </statements>
</library>

 

 

Usage note: every effort has been made to ensure that the examples are correct and useful, but they are not a normative part of the specification.