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-04 (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

Data Requirements

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="67" startChar="5" endLine="67" 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="67" startChar="5" endLine="67" endChar="68" message="Could not resolve membership operator for terminology target of the retrieve." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <annotation startLine="78" startChar="83" endLine="78" endChar="126" message="List-valued expression was demoted to a singleton." errorType="semantic" errorSeverity="warning" xsi:type="a:CqlToElmError"/>
   <identifier id="OpioidCDS_STU4_REC_04" 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>
   <statements>
      <def name="Patient" context="Patient">
         <expression xsi:type="SingletonFrom">
            <operand dataType="fhir:Patient" xsi:type="Retrieve"/>
         </expression>
      </def>
      <def name="Inclusion Period" 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="days" xsi:type="Quantity"/>
            </high>
         </expression>
      </def>
      <def name="Encounter Period" 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="days" xsi:type="Quantity"/>
            </high>
         </expression>
      </def>
      <def name="Get Trigger Event Prescriptions" context="Patient" accessLevel="Public">
         <expression xsi:type="Query">
            <source alias="triggerScripts">
               <expression name="ContextPrescriptions" xsi:type="ParameterRef"/>
            </source>
            <let identifier="rxNormCode">
               <expression name="ToCode" libraryName="Common" xsi:type="FunctionRef">
                  <operand xsi:type="Indexer">
                     <operand path="coding" xsi:type="Property">
                        <source path="medication" scope="triggerScripts" xsi:type="Property"/>
                     </operand>
                     <operand valueType="t:Integer" value="0" xsi:type="Literal"/>
                  </operand>
               </expression>
            </let>
            <where xsi:type="And">
               <operand name="IsOpioidWithAmbulatoryAbusePotential" libraryName="Common" xsi:type="FunctionRef">
                  <operand name="rxNormCode" xsi:type="QueryLetRef"/>
               </operand>
               <operand name="IsLongActingOpioid" libraryName="Common" xsi:type="FunctionRef">
                  <operand name="rxNormCode" xsi:type="QueryLetRef"/>
               </operand>
            </where>
         </expression>
      </def>
      <def name="Get Trigger Trigger Event Prescription Ids" context="Patient" accessLevel="Public">
         <expression xsi:type="Query">
            <source alias="triggerScripts">
               <expression name="Get Trigger Event Prescriptions" xsi:type="ExpressionRef"/>
            </source>
            <let identifier="codeString">
               <expression valueType="t:String" value="" xsi:type="Literal"/>
            </let>
            <return>
               <expression xsi:type="Concatenate">
                  <operand xsi:type="Concatenate">
                     <operand name="codeString" xsi:type="QueryLetRef"/>
                     <operand path="value" xsi:type="Property">
                        <source path="id" scope="triggerScripts" xsi:type="Property"/>
                     </operand>
                  </operand>
                  <operand valueType="t:String" value=" " xsi:type="Literal"/>
               </expression>
            </return>
         </expression>
      </def>
      <def name="Validate Trigger Event" context="Patient" accessLevel="Public">
         <expression xsi:type="Exists">
            <operand name="Get Trigger Event Prescriptions" xsi:type="ExpressionRef"/>
         </expression>
      </def>
      <def name="Opioid with Ambulatory Care Abuse Potential in Past 90 Days" context="Patient" accessLevel="Public">
         <expression xsi:type="Exists">
            <operand xsi:type="Query">
               <source alias="orders">
                  <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="In">
                  <operand xsi:type="DateFrom">
                     <operand path="value" xsi:type="Property">
                        <source path="authoredOn" scope="orders" xsi:type="Property"/>
                     </operand>
                  </operand>
                  <operand name="Inclusion Period" xsi:type="ExpressionRef"/>
               </where>
            </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="Opioid with Ambulatory Care Abuse Potential in Past 90 Days" xsi:type="ExpressionRef"/>
               </operand>
            </operand>
            <operand xsi:type="Exists">
               <operand xsi:type="Query">
                  <source alias="encounters">
                     <expression dataType="fhir:Encounter" xsi:type="Retrieve"/>
                  </source>
                  <where xsi:type="In">
                     <operand xsi:type="DateFrom">
                        <operand path="value" xsi:type="Property">
                           <source path="start" xsi:type="Property">
                              <source path="period" scope="encounters" xsi:type="Property"/>
                           </source>
                        </operand>
                     </operand>
                     <operand name="Encounter Period" xsi:type="ExpressionRef"/>
                  </where>
               </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="Recommend use of immediate-release opioids instead of extended release/long acting opioids when starting patient on opioids." xsi:type="Literal"/>
      </def>
      <def name="Get Detail" context="Patient" accessLevel="Public">
         <expression xsi:type="Concatenate">
            <operand valueType="t:String" value="The following medication requests(s) release rates should be re-evaluated: " xsi:type="Literal"/>
            <operand xsi:type="SingletonFrom">
               <operand name="Get Trigger Trigger Event Prescription Ids" xsi:type="ExpressionRef"/>
            </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.