eCQM QICore Content Implementation Guide
2023.0.0 - CI Build

eCQM QICore Content Implementation Guide, published by cqframework. This guide is not an authorized publication; it is the continuous build for version 2023.0.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/ecqm-content-qicore-2023/ and changes regularly. See the Directory of published versions

Library: SafeUseofOpioidsConcurrentPrescribingFHIR

Official URL: http://ecqi.healthit.gov/ecqms/Library/SafeUseofOpioidsConcurrentPrescribingFHIR Version: 0.1.000
Active as of 2023-08-18 Computable Name: SafeUseofOpioidsConcurrentPrescribingFHIR
Other Identifiers: https://madie.cms.gov/login#SafeUseofOpioidsConcurrentPrescribingFHIR (use: official, )

Usage:Program: EH/CAH

SafeUseofOpioidsConcurrentPrescribingFHIR

Id: SafeUseofOpioidsConcurrentPrescribingFHIR
Url: http://ecqi.healthit.gov/ecqms/Library/SafeUseofOpioidsConcurrentPrescribingFHIR
Version: 0.1.000
Identifier:

value: SafeUseofOpioidsConcurrentPrescribingFHIR

Name: SafeUseofOpioidsConcurrentPrescribingFHIR
Title: SafeUseofOpioidsConcurrentPrescribingFHIR
Status: active
Experimental: false
Type:

system: http://terminology.hl7.org/CodeSystem/library-type

code: logic-library

Date: 2023-08-18T15:25:34+00:00
Description: SafeUseofOpioidsConcurrentPrescribingFHIR
Use Context:
codevaluedisplay
program eh-cah EH/CAH
Related Artifacts:

Dependencies

Data Requirements:
TypeProfileMSCode Filter
Patient http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient
Patient http://hl7.org/fhir/Patient ;;;;
Encounter http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter ;;;; code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Patient http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient
Encounter http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter ;;;; code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest ; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.165
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest ; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.165
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest ; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1125.1
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest ;;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1125.1
Encounter http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter ;;;; code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest ;;;;;;; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1125.1
Encounter http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter ;;;; code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Encounter http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter ;;;; code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Coverage http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage ;; code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
uri http://hl7.org/fhir/uri ;
Patient http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient ;;
Patient http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient ;;
Condition http://hl7.org/fhir/Condition ;
Condition http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition ;;
ServiceRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest ; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1579
Procedure http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure ; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1579
Patient http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient
Encounter http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter ;;;; code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143
Encounter http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter ;;;; code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292
Encounter http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter ;;;; code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143
Encounter http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter ;;;; code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292
Condition http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition ; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.161
Patient http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient ;;
Patient http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient ;;
Coverage http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage ;; code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
Patient http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient ;;
Patient http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient ;;
Content: text/cql
library SafeUseofOpioidsConcurrentPrescribingFHIR version '0.1.000'

using QICore version '4.1.1'

include CQMCommon version '1.4.000' called CQMCommon
include FHIRHelpers version '4.3.000' called FHIRHelpers
include Hospice version '6.7.000' called Hospice
include QICoreCommon version '1.5.000' called QICoreCommon
include SupplementalDataElements version '3.4.000' called SDE

codesystem "LOINC": 'http://loinc.org'

valueset "All Primary and Secondary Cancer": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.161'
valueset "Discharge To Acute Care Facility": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.87'
valueset "Encounter Inpatient": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307'
valueset "Hospice Care Referral or Admission": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1116.365'
valueset "Palliative or Hospice Care": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1579'
valueset "Patient Expired": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.309'
valueset "Schedule II & III Opioid Medications": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.165'
valueset "Schedule IV Benzodiazepines": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1125.1'

code "Birth date": '21112-8' from "LOINC" display 'Birth date'

parameter "Measurement Period" Interval<DateTime>

context Patient

define "Initial Population":
  "Inpatient Encounters with an Opioid or Benzodiazepine at Discharge"

define "Denominator":
  "Initial Population"

define "Denominator Exclusion":
  /*Excludes encounters of patients with cancer or who are receiving palliative or hospice care at the time of the encounter*/
  
  "Inpatient Encounters with an Opioid or Benzodiazepine at Discharge" InpatientEncounter
    where exists ( [Condition: "All Primary and Secondary Cancer"] Cancer
        where ( Cancer.isProblemListItem ( )
            or Cancer.isHealthConcern ( )
        )
          and Cancer.isActive ( )
          and Cancer.prevalenceInterval ( ) overlaps InpatientEncounter.period
    )
      or exists ( ( InpatientEncounter.encounterDiagnosis ( ) ) InpatientEncounterDiagnosis
          where InpatientEncounterDiagnosis.code in "All Primary and Secondary Cancer"
      )
      or exists ( "Intervention Palliative or Hospice Care" PalliativeOrHospiceCare
          where Coalesce(PalliativeOrHospiceCare.performed.toInterval(), PalliativeOrHospiceCare.authoredOn.toInterval()) during day of CQMCommon."HospitalizationWithObservation" ( InpatientEncounter )
      )
      or ( InpatientEncounter.hospitalization.dischargeDisposition in "Discharge To Acute Care Facility"
          or InpatientEncounter.hospitalization.dischargeDisposition in "Hospice Care Referral or Admission"
          or InpatientEncounter.hospitalization.dischargeDisposition in "Patient Expired"
      )

define "Numerator":
  /*Encounters of patients prescribed two or more opioids or an opioid and benzodiazepine at discharge.*/
  
  ( "Inpatient Encounter with Age Greater than or Equal to 18" InpatientEncounter
      where ( Count("Opioid at Discharge" Opioids
            return distinct Opioids.medication
        ) >= 2
      )
  )
    union ( "Inpatient Encounter with Age Greater than or Equal to 18" InpatientEncounter
        with "Opioid at Discharge" OpioidsDischarge
          such that OpioidsDischarge.authoredOn during InpatientEncounter.period
        with "Benzodiazepine at Discharge" BenzodiazepinesDischarge
          such that BenzodiazepinesDischarge.authoredOn during day of InpatientEncounter.period
    )

define "Benzodiazepine at Discharge":
  ( [MedicationRequest: medication in "Schedule IV Benzodiazepines"] BenzoMedications
    where ( BenzoMedications.isCommunity ( )
        or BenzoMedications.isDischarge ( )
    ) ) BenzodiazepineDischargeMedication
    where BenzodiazepineDischargeMedication.status in { 'active', 'completed' }
      and BenzodiazepineDischargeMedication.intent = 'order'

define "Inpatient Encounter with Age Greater than or Equal to 18":
  CQMCommon."Inpatient Encounter" InpatientHospitalEncounter
    where AgeInYearsAt(date from start of InpatientHospitalEncounter.period) >= 18

define "Inpatient Encounters with an Opioid or Benzodiazepine at Discharge":
  "Inpatient Encounter with Age Greater than or Equal to 18" InpatientEncounter
    with ( "Opioid at Discharge"
      union "Benzodiazepine at Discharge" ) OpioidOrBenzodiazepineAtDischarge
      such that OpioidOrBenzodiazepineAtDischarge.authoredOn during day of InpatientEncounter.period

define "Intervention Palliative or Hospice Care":
  [ServiceRequest: "Palliative or Hospice Care"]
    union [Procedure: "Palliative or Hospice Care"]

define "Opioid at Discharge":
  ( [MedicationRequest: "Schedule II & III Opioid Medications"] OpioidMedications
    where ( OpioidMedications.isCommunity ( )
        or OpioidMedications.isDischarge ( )
    ) ) OpioidDischargeMedication
    where OpioidDischargeMedication.status in { 'active', 'completed' }
      and OpioidDischargeMedication.intent = 'order'

define "SDE Ethnicity":
  SDE."SDE Ethnicity"

define "SDE Payer":
  SDE."SDE Payer"

define "SDE Race":
  SDE."SDE Race"

define "SDE Sex":
  SDE."SDE Sex"
Content: application/elm+xml
Encoded data (136148 characters)
Content: application/elm+json
Encoded data (190988 characters)