Release 5

This page is part of the FHIR Specification (v5.0.0: R5 - STU). This is the current published version. For a full list of available versions, see the Directory of published versions . Page versions: R5 R4B R4

Example Library/opioidcds-recommendation-08 (Narrative)

Clinical Decision Support Work GroupMaturity Level: N/AStandards Status: InformativeCompartments: No 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
DocumentationMME Conversion Tables

https://www.cdc.gov/drugoverdose/pdf/calculating_total_daily_dose-a.pdf ()

Data Requirements

Type: MedicationRequest
FilterValue
medicationCodeableConceptIn ValueSet http://example.org/fhir/ValueSet/naloxone
Type: MedicationRequest
FilterValue
medicationCodeableConceptIn ValueSet http://example.org/fhir/ValueSet/opioids-abused-in-ambulatory-care
Type: MedicationRequest
FilterValue
medicationCodeableConceptIn ValueSet http://example.org/fhir/ValueSet/benzodiazepines
Type: Condition
FilterValue
codeIn ValueSet http://example.org/fhir/ValueSet/substance-abuse

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="63" startChar="11" endLine="63" endChar="48" 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="63" startChar="11" endLine="63" endChar="48" message="Could not resolve membership operator for terminology target of the retrieve." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation startLine="81" startChar="5" endLine="81" endChar="68" 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="81" startChar="5" endLine="81" endChar="68" message="Could not resolve membership operator for terminology target of the retrieve." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation startLine="74" startChar="11" endLine="74" endChar="55" 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="74" startChar="11" endLine="74" endChar="55" message="Could not resolve membership operator for terminology target of the retrieve." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation startLine="77" startChar="12" endLine="77" endChar="41" message="Could not resolve membership operator for terminology target of the retrieve." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <identifier id="OpioidCDS_STU4_REC_08" 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>
   <valueSets>
      <def name="Substance Abuse" id="TODO" accessLevel="Public"/>
   </valueSets>
   <statements>
      <def name="Patient" context="Patient">
         <expression xsi:type="SingletonFrom">
            <operand dataType="fhir:Patient" xsi:type="Retrieve"/>
         </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="Exclusion Criteria" context="Patient" accessLevel="Public">
         <expression xsi:type="Exists">
            <operand dataType="fhir:MedicationRequest" codeProperty="medicationCodeableConcept" xsi:type="Retrieve">
               <codes name="Naloxone" libraryName="Common" xsi:type="ValueSetRef"/>
            </operand>
         </expression>
      </def>
      <def name="Get Active Ambulatory Opioid Rx" context="Patient" accessLevel="Public">
         <expression xsi:type="Union">
            <operand 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>
            </operand>
            <operand name="ContextPrescriptions" xsi:type="ParameterRef"/>
         </expression>
      </def>
      <def name="Average MME" context="Patient" accessLevel="Public">
         <expression name="TotalMME" libraryName="Common" xsi:type="FunctionRef">
            <operand name="Get Active Ambulatory Opioid Rx" xsi:type="ExpressionRef"/>
         </expression>
      </def>
      <def name="MME >= 50 mg/d?" context="Patient" accessLevel="Public">
         <expression xsi:type="If">
            <condition asType="t:Boolean" xsi:type="As">
               <operand xsi:type="IsNull">
                  <operand name="Average MME" xsi:type="ExpressionRef"/>
               </operand>
            </condition>
            <then valueType="t:Boolean" value="false" xsi:type="Literal"/>
            <else xsi:type="GreaterOrEqual">
               <operand name="Average MME" xsi:type="ExpressionRef"/>
               <operand value="50" unit="mg/d" xsi:type="Quantity"/>
            </else>
         </expression>
      </def>
      <def name="On Benzodiazepine" context="Patient" accessLevel="Public">
         <expression xsi:type="Exists">
            <operand dataType="fhir:MedicationRequest" codeProperty="medicationCodeableConcept" xsi:type="Retrieve">
               <codes name="Benzodiazepines" libraryName="Common" xsi:type="ValueSetRef"/>
            </operand>
         </expression>
      </def>
      <def name="Inclusion Criteria" context="Patient" accessLevel="Public">
         <expression 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="Or">
               <operand name="MME >= 50 mg/d?" xsi:type="ExpressionRef"/>
               <operand name="On Benzodiazepine" xsi:type="ExpressionRef"/>
            </operand>
         </expression>
      </def>
      <def name="Has Substance Abuse History" context="Patient" accessLevel="Public">
         <expression xsi:type="Exists">
            <operand dataType="fhir:Condition" codeProperty="code" xsi:type="Retrieve">
               <codes name="Substance Abuse" xsi:type="ValueSetRef"/>
            </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="Incorporate into the management plan strategies to mitigate risk; including considering offering naloxone when factors that increase risk for opioid overdose are present" xsi:type="Literal"/>
      </def>
      <def name="Get Notification" context="Patient" accessLevel="Public">
         <expression xsi:type="Concatenate">
            <operand valueType="t:String" value="Consider offering naloxone given following risk factor(s) for opioid overdose: " xsi:type="Literal"/>
            <operand xsi:type="If">
               <condition asType="t:Boolean" xsi:type="As">
                  <operand name="MME >= 50 mg/d?" xsi:type="ExpressionRef"/>
               </condition>
               <then xsi:type="Concatenate">
                  <operand xsi:type="Concatenate">
                     <operand valueType="t:String" value="Average MME (" xsi:type="Literal"/>
                     <operand xsi:type="ToString">
                        <operand name="Average MME" xsi:type="ExpressionRef"/>
                     </operand>
                  </operand>
                  <operand valueType="t:String" value=") >= 50 mg/day, " xsi:type="Literal"/>
               </then>
               <else xsi:type="Concatenate">
                  <operand valueType="t:String" value="" xsi:type="Literal"/>
                  <operand xsi:type="If">
                     <condition asType="t:Boolean" xsi:type="As">
                        <operand name="On Benzodiazepine" xsi:type="ExpressionRef"/>
                     </condition>
                     <then valueType="t:String" value="concurrent use of benzodiazepine, " xsi:type="Literal"/>
                     <else valueType="t:String" value="" xsi:type="Literal"/>
                  </operand>
               </else>
            </operand>
         </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.