opioidcds-10-patient-view
type: PlanDefinition
node role: treeRoot
id:
  v: opioidcds-10-patient-view
meta:
  profile:
    v: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-recommendationdefinition
    l: cpg-recommendationdefinition
  profile:
    v: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-publishableplandefinition
    l: cpg-publishableplandefinition
text:
  status:
    v: extensions
  div:
    v: Id: opioidcds-10-patient-view Url: Recommendation #10 - Urine Drug Testing (patient-view) Version: 2022.1.0 Identifier: value: cdc-opioid-guidance Name: PlanDefinition_Recommendation_10_Patient_View Title: Recommendation #10 - Urine Drug Testing (patient-view) Status: draft Experimental: true Type: system: http://terminology.hl7.org/CodeSystem/plan-definition-type code: eca-rule display: ECA Rule Date: 2025-08-06 Publisher: HL7 FHIR Community Process (FCP) / Security Risk Solutions, Inc. (SRS) Description: When prescribing opioids for subacute or chronic pain, clinicians should consider the benefits and risks of toxicology testing to assess for prescribed medications as well as other prescribed and nonprescribed controlled substances. Logic Definitions: Library Name Name sequence OpioidCDSCommonConfig Can the implementing EHR support queries for past medications by date range? 0 // Subroutine 2 - Past Medications define "Can the implementing EHR support queries for past medications by date range?": true Library Name Name sequence OpioidCDSCommon Active Ambulatory Opioid Rx 1 define "Active Ambulatory Opioid Rx": if Config."Can the implementing EHR support queries for past medications by date range?" then ( "Get MedicationRequest Medication as Code"("Get Active Ambulatory Medication Requests"([MedicationRequest])) ) Rx where date from Rx.authoredOn 2 years or less on or before Today() and Rx.medication in "Opioid analgesics with ambulatory misuse potential" else List<FHIR.MedicationRequest>{} Library Name Name sequence OpioidCDSREC10PatientView Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions 2 define "Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions": Common."Active Ambulatory Opioid Rx" AmbulatoryOpioidPrescription where Routines."Is Subacute or Chronic Pain Prescription?"(AmbulatoryOpioidPrescription) Library Name Name sequence OpioidCDSREC10PatientView Patient Is Being Prescribed Opioid Analgesic with Ambula…
contained: Library
  id:
    v: effective-data-requirements
  extension:
    extension:
      url:
        v: libraryName
        l: libraryName
      value: String
        v: OpioidCDSCommonConfig
    extension:
      url:
        v: name
        l: name
      value: String
        v: Can the implementing EHR support queries for past medications by date range?
    extension:
      url:
        v: statement
        l: statement
      value: String
        v: // Subroutine 2 - Past Medications define "Can the implementing EHR support queries for past medications by date range?": true
    extension:
      url:
        v: displaySequence
        l: displaySequence
      value: Integer
        v: 0
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
      l: cqf-logicDefinition
  extension:
    extension:
      url:
        v: libraryName
        l: libraryName
      value: String
        v: OpioidCDSCommon
    extension:
      url:
        v: name
        l: name
      value: String
        v: Active Ambulatory Opioid Rx
    extension:
      url:
        v: statement
        l: statement
      value: String
        v: define "Active Ambulatory Opioid Rx": if Config."Can the implementing EHR support queries for past medications by date range?" then ( "Get MedicationRequest Medication as Code"("Get Active Ambulatory Medication Requests"([MedicationRequest])) ) Rx where date from Rx.authoredOn 2 years or less on or before Today() and Rx.medication in "Opioid analgesics with ambulatory misuse potential" else List<FHIR.MedicationRequest>{}
    extension:
      url:
        v: displaySequence
        l: displaySequence
      value: Integer
        v: 1
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
      l: cqf-logicDefinition
  extension:
    extension:
      url:
        v: libraryName
        l: libraryName
      value: String
        v: OpioidCDSREC10PatientView
    extension:
      url:
        v: name
        l: name
      value: String
        v: Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions
    extension:
      url:
        v: statement
        l: statement
      value: String
        v: define "Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions": Common."Active Ambulatory Opioid Rx" AmbulatoryOpioidPrescription where Routines."Is Subacute or Chronic Pain Prescription?"(AmbulatoryOpioidPrescription)
    extension:
      url:
        v: displaySequence
        l: displaySequence
      value: Integer
        v: 2
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
      l: cqf-logicDefinition
  extension:
    extension:
      url:
        v: libraryName
        l: libraryName
      value: String
        v: OpioidCDSREC10PatientView
    extension:
      url:
        v: name
        l: name
      value: String
        v: Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential
    extension:
      url:
        v: statement
        l: statement
      value: String
        v: define "Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential": exists ("Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions")
    extension:
      url:
        v: displaySequence
        l: displaySequence
      value: Integer
        v: 3
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
      l: cqf-logicDefinition
  extension:
    extension:
      url:
        v: libraryName
        l: libraryName
      value: String
        v: OpioidCDSCommonConfig
    extension:
      url:
        v: name
        l: name
      value: String
        v: Age Less than 18 Years Is Enabled
    extension:
      url:
        v: statement
        l: statement
      value: String
        v: // CDC 2022 General Inclusion Criteria define "Age Less than 18 Years Is Enabled": true
    extension:
      url:
        v: displaySequence
        l: displaySequence
      value: Integer
        v: 4
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
      l: cqf-logicDefinition
  extension:
    extension:
      url:
        v: libraryName
        l: libraryName
      value: String
        v: OpioidCDSRoutines
    extension:
      url:
        v: name
        l: name
      value: String
        v: Patient Age Less Than 18
    extension:
      url:
        v: statement
        l: statement
      value: String
        v: define "Patient Age Less Than 18": if (Config."Age Less than 18 Years Is Enabled") then AgeInYearsAt(Today()) < 18 else false
    extension:
      url:
        v: displaySequence
        l: displaySequence
      value: Integer
        v: 5
    url:
      v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
      l: cqf-logicDefinition
  extension:
    extension:
      url:
        v: libraryName
        l: libraryName
      value: String
        v: OpioidCDSCommonConfig
    extension:
      url:
        v: name
        l: name
      value: String
        v: Sickle Cell Check Enabled
    extension:
      url:
        v: statement
        l: statement
      value: String

String
v: // Sickle Cell define "Sickle Cell Check Enabled": true

url:
  v: displaySequence
  l: displaySequence
value: Integer
  v: 6

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Sickle Cell Assumed Active
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Sickle Cell Assumed Active": true
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 7
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: US Core-Categorized Conditions
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // 3. Medications indicating end of life /* or exists ( "Medications Indicating End of Life" ) */ define "US Core-Categorized Conditions": [Condition: category in "Encounter Diagnosis Condition Category"] union [Condition: category in "Problem List Condition Category"] union [Condition: category in "US Core Health Concern Condition Category"]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 8
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Sickle Cell Condition
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Sickle Cell Condition": if Config."Sickle Cell Check Enabled" and not Config."Sickle Cell Assumed Active" then ( "US Core-Categorized Conditions" C where C.code in "Sickle Cell Diseases" and C.clinicalStatus in "Active Condition" ) else if Config."Sickle Cell Check Enabled" and Config."Sickle Cell Assumed Active" then ( "US Core-Categorized Conditions" C where C.code in "Sickle Cell Diseases" ) else null
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 9
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Condition Positive for Sickle Cell
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Condition Positive for Sickle Cell": if (Config."Sickle Cell Check Enabled") then exists( Common."Positive Sickle Cell Condition" ) else false
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 10
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Active Cancer Treatment Encounters Condition Is Enabled
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Active Cancer Treatment define "Active Cancer Treatment Encounters Condition Is Enabled": true
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 11
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Encounter Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // End of Opioid Naive Routine /* ** Routine #3 ** Active Cancer Treatment Routine ** ** Definition | Answer to Proceed | Details | Data (Terminology) Requirement ** --------------------------------------------------------------------------------------------------------------------------------- ** Two office visits within the | No | Look for a minimum of two distinct | Office Visit ** past 12 months | | encounters within 12 months of the date | ** | | of the current visit for which each of the | ** | | following is true: | ** | | - the encounter diagnosis (primary or | ** | | secondary or co-morbidity diagnosis) | ** | | is listed in the CDC Malignant Cancer | ** | | Conditions value set | ** --------------------------------------------------------------------------------------------------------------------------------- ** Office visits with an | No | The encounter is performed by an | Oncology specialty ** oncology specialist | | oncologist as defined in the oncology | designations (NUCC) ** present | | specialty designations using the | ** | | National Uniform Claim Committee | ** | | (NUCC) classifications | ** --------------------------------------------------------------------------------------------------------------------------------- ** Office visits including CDC | No | The encounter diagnosis (primary or | CDC malignant cancer ** malignant cancer | | secondary or co-morbidity diagnosis) | conditions ** condition | | is listed in the CDC Malignant Cancer | ** | | Conditions value set | ** ---------------------------------------------------------------------------------------------------------------------------------- ** */ define "Encounter Period": Interval[Today() - 12 months, Today())
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 12
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: USCore Encounter Cancer Diagnoses
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "USCore Encounter Cancer Diagnoses": [Condition: category in "Encounter Diagnosis Condition Category"] CancerDiagnoses where CancerDiagnoses.code in "CDC malignant cancer conditions"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 13
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Encounters with Cancer Diagnosis During Encounter Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // encounter-diagnosis, problem-list and health-concern Conditions // define "US Core-Categorized Cancer Diagnoses": // Common."US Core-Categorized Conditions" C // where C.code in Common."CDC malignant cancer conditions" // define "Encounters with Cancer Diagnosis During Encounter Period": // [Encounter] Encounter // with "US Core-Categorized Cancer Diagnoses" CancerDiagnosis // such that date from Encounter.period."start".value in day of "Encounter Period" // and EndsWith(CancerDiagnosis.encounter.reference, Encounter.id) define "Encounters with Cancer Diagnosis During Encounter Period": [Encounter] Encounters where date from Encounters.period."start" in day of "Encounter Period" and exists ( Common."USCore Encounter Cancer Diagnoses" CancerDiagnoses where EndsWith(CancerDiagnoses.encounter.reference, Encounters.id) )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 14
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Number of Encounters with Cancer Diagnosis During Encounter Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Number of Encounters with Cancer Diagnosis During Encounter Period": Count ("Encounters with Cancer Diagnosis During Encounter Period")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 15
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Has Two or More Encounters with Cancer Diagnosis During Encounter Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Has Two or More Encounters with Cancer Diagnosis During Encounter Period": "Number of Encounters with Cancer Diagnosis During Encounter Period" >= 2
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 16
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: USCore Problem List Cancer Diagnoses
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "USCore Problem List Cancer Diagnoses": [Condition: category in "Problem List Condition Category"] CancerDiagnoses where CancerDiagnoses.code in "CDC malignant cancer conditions"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 17
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Has Active Cancer Diagnosis on Problem List
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Has Active Cancer Diagnosis on Problem List": exists ( Common."USCore Problem List Cancer Diagnoses" CancerDiagnoses where CancerDiagnoses.category in Common."Problem List Condition Category" and exists( CancerDiagnoses.clinicalStatus.coding ClinicalStatus where ClinicalStatus.code ~ 'active' ) )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 18
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Is Active Cancer Treatment?
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Is Active Cancer Treatment?": if (Config."Active Cancer Treatment Encounters Condition Is Enabled") then "Has Two or More Encounters with Cancer Diagnosis During Encounter Period" or "Has Active Cancer Diagnosis on Problem List" else false
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 19
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: End-Stage Disease Criteria Enabled
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // CDC 2022 General Inclusion Criteria define "End-Stage Disease Criteria Enabled": true
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 20
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Conditions Likely Terminal for Opioid Prescribing
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Conditions Likely Terminal for Opioid Prescribing": if (Config."End-Stage Disease Criteria Enabled") then exists ( Common."US Core-Categorized Conditions" EOLC where EOLC.code in Common."Conditions likely terminal for opioid prescribing" // and EOLC.clinicalStatus in Common."Active Condition" ) else false
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 21
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: CDC 2022 Guideline General Inclusion Criteria
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "CDC 2022 Guideline General Inclusion Criteria": not "Patient Age Less Than 18" and not "Condition Positive for Sickle Cell" and not "Is Active Cancer Treatment?" and not "Conditions Likely Terminal for Opioid Prescribing"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 22
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Recommendation 10 UDS Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Recommendation 10 UDS Lookback Period": Interval[Today() - 12 months - 1 days, Today()]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 23
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: All Opioid or Non-opioid UDS in Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "All Opioid or Non-opioid UDS in Lookback Period": ( [Observation: Common."All Drug Urine Screening"] Lab where date from Lab.effective in day of Config."Recommendation 10 UDS Lookback Period" and not ( Lab.status in { 'unknown', 'entered-in-error', 'cancelled' } ) ) X sort by date from effective desc
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 24
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Inclusion Criteria For UDS Recommendation
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @description: Determines whether an opioid review is appropriate for the patient and whether they had a UDS performed in the specified lookback period */ define "Inclusion Criteria For UDS Recommendation": Routines."CDC 2022 Guideline General Inclusion Criteria" and not exists ( "All Opioid or Non-opioid UDS in Lookback Period" )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 25
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: Conditions Indicating End of Life or With Limited Life Expectancy
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Conditions Indicating End of Life or With Limited Life Expectancy": ( "US Core-Categorized Conditions" C where C.code in "Conditions likely terminal for opioid prescribing" and C.clinicalStatus in "Active Condition" ) union ( "US Core-Categorized Conditions" C where C.code in "Limited life expectancy conditions" and C.clinicalStatus in "Active Condition" )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 26
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Hospice Findings Exclusion Enabled
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // OpioidCDSCommon define "Hospice Findings Exclusion Enabled": false
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 27
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: Admitted/Referred/Discharged to Hospice Care
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Admitted/Referred/Discharged to Hospice Care": ( if (Config."Hospice Findings Exclusion Enabled") then [Observation: code in "Hospice Finding Codes"] O where not (O.status.value in { 'unknown', 'entered-in-error', 'cancelled' }) else {} ) union ( [Encounter] E where date from E.period.start 1 year or less on or before Today() and ( if E.hospitalization.dischargeDisposition.coding is null or not exists (E.hospitalization.dischargeDisposition.coding) then false else E.hospitalization.dischargeDisposition in "Hospice Disposition" ) and E.status.value in { 'planned', 'arrived', 'in-progress', 'finished', 'onleave' } )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 28
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: End of Life Assessment
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "End of Life Assessment": // 1. Conditions indicating end of life or with limited life expectancy exists ( "Conditions Indicating End of Life or With Limited Life Expectancy" ) // 2. Admitted/referred/discharged to hospice care or exists ( "Admitted/Referred/Discharged to Hospice Care" )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 29
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Exclusion Criteria
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Exclusion Criteria": Common."End of Life Assessment"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 30
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10PatientView
extension:
  url:
    v: name
    l: name
  value: String
    v: Is Perform Drug Screen Recommendation Applicable?
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Is Perform Drug Screen Recommendation Applicable?": "Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential" and Rec10Common."Inclusion Criteria For UDS Recommendation" and not Rec10Common."Exclusion Criteria"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 31
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Amphetamine Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Amphetamine Simple Identifier": 'Amphetamine'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 32
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Amphetamine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Amphetamines define "Amphetamine Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Amphetamine Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 33
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Amphetamine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Amphetamine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Amphetamine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 34
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Amphetamine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Amphetamine Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Amphetamine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 35
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Recommendation 10 Rx Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Recommendation 10 Rx Lookback Period": Interval[Today() - 12 months - 31 days, Today()]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 36
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Normalize Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Normalize Rx In Lookback Period": Common."Get MedicationRequest Medication as Code"( [MedicationRequest: category in Common."Community"] Rx where Rx.status in { 'active', 'completed', 'stopped' } and Rx.intent = 'order' and Common."GetDateFromMedicationRequest"(Rx) in day of Config."Recommendation 10 Rx Lookback Period" )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 37
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Amphetamine Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Amphetamine Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Amphetamine Medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 38
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Barbiturate Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Barbiturate Simple Identifier": 'Barbiturate'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 39
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Barbiturate Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Barbiturates define "Barbiturate Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Barbiturate Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 40
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Barbiturate Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Barbiturate Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Barbiturate Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 41
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Barbiturate Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Barbiturate Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Barbiturate Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 42
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Barbiturate Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Barbiturate Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Barbiturate Medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 43
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Benzodiazepine Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Benzodiazepine Simple Identifier": 'Benzodiazepine'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 44
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Benzodiazepine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Benzodiazepines define "Benzodiazepine Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Benzodiazepine Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 45
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Benzodiazepine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Benzodiazepine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Benzodiazepine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 46
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Benzodiazepine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Benzodiazepine Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Benzodiazepine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 47
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Benzodiazepine Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Benzodiazepine Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Benzodiazepine medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 48
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Buprenorphine Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Buprenorphine Simple Identifier": 'Buprenorphine'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 49
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Buprenorphine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Buprenorphine define "Buprenorphine Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Buprenorphine Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 50
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Buprenorphine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Buprenorphine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Buprenorphine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 51
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Buprenorphine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Buprenorphine Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Buprenorphine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 52
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Buprenorphine Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Buprenorphine Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Buprenorphine Medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 53
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Cannabinoid Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Cannabinoid Simple Identifier": 'Cannabinoid'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 54
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Cannabinoid Urine Screening Check Enabled
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Cannabinoid Urine Screening Check Enabled": false
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 55
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Cannabinoid Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Cannabinoids define "Cannabinoid Screenings In Lookback Period": if Config."Cannabinoid Urine Screening Check Enabled" then ( "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Cannabinoid Urine Tests" ) else null
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 56
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Cannabinoid Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Cannabinoid Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Cannabinoid Screenings In Lookback Period", Config."Cannabinoid Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 57
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Cannabinoid Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Cannabinoid Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Cannabinoid Screenings In Lookback Period", Config."Cannabinoid Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 58
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Cocaine Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Cocaine Simple Identifier": 'Cocaine'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 59
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Cocaine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Cocaine define "Cocaine Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Cocaine Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 60
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Cocaine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Cocaine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Cocaine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 61
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Cocaine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Cocaine Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Cocaine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 62
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Fentanyl Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Fentanyl Simple Identifier": 'Fentanyl'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 63
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Opiate Urine Screening Check Enabled
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Recommendation 10 define "Opiate Urine Screening Check Enabled": true
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 64
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Fentanyl Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Fentanyl define "Fentanyl Screenings In Lookback Period": if Config."Opiate Urine Screening Check Enabled" then ( "All Opioid or Non-opioid UDS in Lookback Period" AllLabs where AllLabs.code in Common."Fentanyl Urine Tests" ) else null
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 65
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Fentanyl Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Fentanyl Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Fentanyl Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 66
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Fentanyl Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Fentanyl Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Fentanyl Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 67
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Fentanyl Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Fentanyl Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Fentanyl Medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 68
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Heroin Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Heroin Simple Identifier": 'Heroin (6-AM)'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 69
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Heroin Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Heroin define "Heroin Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Heroin Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 70
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Heroin Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Heroin Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Heroin Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 71
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Heroin Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Heroin Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Heroin Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 72
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Methadone Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Methadone Simple Identifier": 'Methadone'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 73
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Methadone Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Methadone define "Methadone Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Methadone Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 74
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Methadone Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Methadone Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Methadone Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 75
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Methadone Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Methadone Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Methadone Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 76
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Methadone Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Methadone Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Methadone Medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 77
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Opiate Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Opiate Simple Identifier": 'Opiate'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 78
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Opiate Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Opiates define "Opiate Screenings In Lookback Period": if Config."Opiate Urine Screening Check Enabled" then ( "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."General Opiate Urine Tests" ) else null
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 79
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Opiate Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Opiate Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Opiate Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 80
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Opiate Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Opiate Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Opiate Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 81
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Opiate Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Opiate Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Opiate Medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 82
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Oxycodone Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Oxycodone Simple Identifier": 'Oxycodone'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 83
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Oxycodone Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Oxycodone define "Oxycodone Screenings In Lookback Period": if Config."Opiate Urine Screening Check Enabled" then ( "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Oxycodone Urine Tests" ) else null
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 84
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Oxycodone Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Oxycodone Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Oxycodone Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 85
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Oxycodone Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Oxycodone Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Oxycodone Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 86
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Oxycodone Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Oxycodone Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Oxycodone Medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 87
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: PCP Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "PCP Simple Identifier": 'Phencyclidine (PCP)'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 88
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: PCP Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // PCP define "PCP Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" AllLabs where AllLabs.code in Common."PCP Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 89
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive PCP Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive PCP Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("PCP Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 90
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative PCP Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative PCP Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("PCP Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 91
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Unexpected Details
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Details Logic define "Unexpected Details": { CreateDetailWithPossibleUnexpectedNegative( "Amphetamine Simple Identifier", "Positive Amphetamine Screenings In Lookback Period", "Negative Amphetamine Screenings In Lookback Period", "Amphetamine Rx In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Barbiturate Simple Identifier", "Positive Barbiturate Screenings In Lookback Period", "Negative Barbiturate Screenings In Lookback Period", "Barbiturate Rx In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Benzodiazepine Simple Identifier", "Positive Benzodiazepine Screenings In Lookback Period", "Negative Benzodiazepine Screenings In Lookback Period", "Benzodiazepine Rx In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Buprenorphine Simple Identifier", "Positive Buprenorphine Screenings In Lookback Period", "Negative Buprenorphine Screenings In Lookback Period", "Buprenorphine Rx In Lookback Period" ), CreateDetailWithoutPossibleUnexpectedNegative( "Cannabinoid Simple Identifier", "Positive Cannabinoid Screenings In Lookback Period", "Negative Cannabinoid Screenings In Lookback Period" ), CreateDetailWithoutPossibleUnexpectedNegative( "Cocaine Simple Identifier", "Positive Cocaine Screenings In Lookback Period", "Negative Cocaine Screenings In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Fentanyl Simple Identifier", "Positive Fentanyl Screenings In Lookback Period", "Negative Fentanyl Screenings In Lookback Period", "Fentanyl Rx In Lookback Period" ), CreateDetailWithoutPossibleUnexpectedNegative( "Heroin Simple Identifier", "Positive Heroin Screenings In Lookback Period", "Negative Heroin Screenings In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Methadone Simple Identifier", "Positive Methadone Screenings In Lookback Period", "Negative Methadone Screenings In Lookback Period", "Methadone Rx In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Opiate Simple Identi…
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 92
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Remove Substances Without Positive or Negative Results
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Remove Substances Without Positive or Negative Results": "Unexpected Details" Details where (Details.posDates is not null and Length(Details.posDates) != 0) or (Details.negDates is not null and Length(Details.negDates) != 0)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 93
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Inclusion Criteria For Unexpected Results
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Inclusion Criteria For Unexpected Results": Routines."CDC 2022 Guideline General Inclusion Criteria" and AnyTrue( "Remove Substances Without Positive or Negative Results" Details return (exists Details.unexpectedPosDetails) or (exists Details.unexpectedNegDetails) )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 94
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10PatientView
extension:
  url:
    v: name
    l: name
  value: String
    v: Applicable Because of Unexpected Results
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Applicable Because of Unexpected Results": "Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential" and Rec10Common."Inclusion Criteria For Unexpected Results" and not Rec10Common."Exclusion Criteria"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 95
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: Style Header
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Style Header": ' \r\n .alert-body {\r\n width: 670px;\r\n font-family: segoe-ui, sans-serif;\r\n background-color: #FEFFF1;\r\n }\r\n\r\n .details-table {\r\n border-collapse:collapse;\r\n border-style: ridge;\r\n background-color: #FEFFF1;\r\n padding: 2px;\r\n }\r\n\r\n .details-caption {\r\n border-style: ridge;\r\n border-bottom: none;\r\n background-color: #FEFFF1;\r\n padding: 2px;\r\n }\r\n\r\n .details-table-header {\r\n border-style: ridge;\r\n padding: 5px;\r\n }\r\n\r\n .details-table-cell {\r\n border-style: ridge;\r\n padding: 5px;\r\n }\r\n\r\n .details-table-footer-cell {\r\n border-style: ridge;\r\n padding: 5px;\r\n font-size: small;\r\n }\r\n\r\n .details-table-cell-unexpected {\r\n border-style: ridge;\r\n padding: 5px;\r\n color: red;\r\n font-weight: bold;\r\n }\r\n\r\n .more-text {\r\n position: relative;\r\n margin-bottom: 2em;\r\n }\r\n \r\n .more {\r\n display:none;\r\n }\r\n\r\n .show-more:checked + .more {\r\n display:block;\r\n }\r\n<\/style>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 96
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: UDS Lookback String
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "UDS Lookback String": ToString(months between start of Config."Recommendation 10 UDS Lookback Period" and Today()) & ' months'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 97
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Unexpected Div Start
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Unexpected Div Start": ' Patient may have unexpected urine toxicology test results<\/strong> in the past ' & "UDS Lookback String" & '.<\/p><\/div>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 98
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Table Start
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Table Start": ' Urine Toxicology Results<\/caption> Substance<\/th>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 99
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: All Lab Dates in Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Helpers define "All Lab Dates in Lookback Period": ( "All Opioid or Non-opioid UDS in Lookback Period" Lab return date from Lab.effective ) X sort desc
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 100
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Table Headers
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Table Headers": "All Lab Dates in Lookback Period" LabDate return ' ' & ToString(LabDate) & '<\/th>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 101
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Generate Table Rows
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Generate Table Rows": "Remove Substances Without Positive or Negative Results" BOT let row: ToString(IndexOf("Remove Substances Without Positive or Negative Results", BOT) + 1) return ' ' + GetExpectedColumn(BOT.ingredient) + Combine( "All Lab Dates in Lookback Period" LabDate let col: ToString(IndexOf("All Lab Dates in Lookback Period", LabDate) + 2) return all ( if BOT.unexpectedPosDetails.date contains LabDate then GetUnexpectedColumn('pos', row & ':' & col) else if BOT.unexpectedNegDetails.udsDate contains LabDate then GetUnexpectedColumn('neg', row & ':' & col) else if BOT.posDates contains LabDate then GetExpectedColumn('pos*') else if BOT.negDates contains LabDate then GetExpectedColumn('neg*') else GetExpectedColumn('n/a') ) ) + '<\/tr>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 102
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Generate Footer Rows
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Generate Footer Rows": "Remove Substances Without Positive or Negative Results" BOT let row: ToString(IndexOf("Remove Substances Without Positive or Negative Results", BOT) + 1), colspan: Length("All Lab Dates in Lookback Period") + 1 return Combine( "All Lab Dates in Lookback Period" LabDate let col: ToString(IndexOf("All Lab Dates in Lookback Period", LabDate) + 2) return all ( if BOT.unexpectedPosDetails.date contains LabDate then Coalesce( BOT.unexpectedPosDetails PosDetail where PosDetail.date same day as LabDate return ' ' & GetFooterColumn(colspan, row & ':' & col & ' - Possible unexpected substance found: ' & PosDetail.udsDetail) & '<\/tr>' ) else if BOT.unexpectedNegDetails.udsDate contains LabDate then Coalesce( BOT.unexpectedNegDetails NegDetail where NegDetail.udsDate same day as LabDate return ' ' & GetFooterColumn(colspan, row + ':' & col & ' - Possible unexpected negative result found: prescribed ' & NegDetail.rxDetail & ' on ' & ToString(NegDetail.rxDate)) & '<\/tr>' ) else '' ) )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 103
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Table End
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Table End": '<\/table><\/div>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 104
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Details Table
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Details Table": "Table Start" & Combine("Table Headers") & ' ' & Combine("Generate Table Rows") & ' ' & ' ' & Combine("Generate Footer Rows") & '<\/tfoot>' & "Table End"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 105
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Expected Result Footnote
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Expected Result Footnote": ' * - These are expected results based on an analysis of the patient\'s medication list 30 days prior to the corresponding lab results.<\/div>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 106
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Details More Info
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Details More Info": ' \r\n Note on false positives and unexpected negative results...<\/p>\r\n Show more\r\n \r\n An unexpectedly negative test may be due to time since last dose, diversion, intermittent use, aberrant drug use behavior, or other factors, including a false negative result. Clinicians should interpret this result in the context of the overall treatment plan.<\/p>\r\n\r\n Positive results may be a false positives or could represent occasional use or possible substance use disorder.<br\/><br\/>For a review regarding interpreting possible false positive urine toxicology results, see http:\/\/pubmed.ncbi.nlm.nih.gov\/24986836<\/a>. It is unknown if the findings reported in this article can be extrapolated to other laboratory analyzers that were not used in the referenced studies.<br\/><br\/>For guidance regarding evaluating and addressing unexpected toxicology tests results, see Recommendation 10 of the 22 CDC Clinical Practice Guideiline<\/a>.<\/p><\/div>\r\n<\/div>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 107
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Div End
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Div End": '<\/div>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 108
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Get HTML Details
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // HTML Generation define "Get HTML Details": Common."Style Header" & "Unexpected Div Start" & "Details Table" & "Expected Result Footnote" & "Details More Info" & "Div End"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 109
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10PatientView
extension:
  url:
    v: name
    l: name
  value: String
    v: Detail
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Detail": Rec10Common."Get HTML Details"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 110
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: Get MedicationRequest Medication as Code
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function "Get MedicationRequest Medication as Code"(value List<MedicationRequest>): value Rx let Med: if Rx.medication is Reference then singleton from ( [Medication] M where M.id = (Last(Split((Rx.medication as FHIR.Reference).reference, '/'))) ) else null return MedicationRequest { id: Rx.id, status: Rx.status, intent: Rx.intent, category: Rx.category, medication: if Rx.medication is Reference then Med.code else Rx.medication as CodeableConcept, subject: Rx.subject, authoredOn: Rx.authoredOn, recorder: Rx.recorder, dosageInstruction: Rx.dosageInstruction, dispenseRequest: Rx.dispenseRequest }
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 111
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToString
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToString(value string): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 112
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: Get Active Ambulatory Medication Requests
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function "Get Active Ambulatory Medication Requests" (value List<MedicationRequest>) returns List<MedicationRequest>: value Rx where Rx.status.value = 'active' and Rx.category in "Community"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 113
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToConcept
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToConcept(concept FHIR.CodeableConcept): if concept is null then null else System.Concept { codes: concept.coding C return ToCode(C), display: concept.text.value }
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 114
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToCode
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToCode(coding FHIR.Coding): if coding is null then null else System.Code { code: coding.code.value, system: coding.system.value, version: coding.version.value, display: coding.display.value }
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 115
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToDateTime
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToDateTime(value dateTime): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 116
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Is Subacute or Chronic Pain Prescription?
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // End of Active Cancer Treatment Routine /* ** Routine #4 ** For Subacute or Chronic Pain Routine ** ** Definition | Answer to Proceed | Details | Data (Terminology) Requirement ** ----------------------------------------------------------------------------------------------------------------------------------- ** Order for opioid analgesic | Yes | Order for opioid analgesics with ambulatory | Opioid analgesics with ** with expected supply | | misuse potential with a supply duration of >= | ambulatory misuse potential ** duration >= 28 days | | 28 days | ** | | | ** | | - Subacute definition = order for opioid | ** | | analgesics with ambulatory misuse | ** | | potential with a supply duration of one to | ** | | two months. | ** | | - Chronic pain definition = order for opioid | ** | | analgesics with ambulatory misuse | ** | | potential with a supply duration of >= two | ** | | months. | ** ----------------------------------------------------------------------------------------------------------------------------------- ** */ define function "Is Subacute or Chronic Pain Prescription?"(prescription FHIR.MedicationRequest): "Is Subacute or Chronic Pain Using Expected Supply Duration"(prescription) or "Is Subacute or Chronic Pain Using Validity Period"(prescription)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 117
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Is Subacute or Chronic Pain Using Expected Supply Duration
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function "Is Subacute or Chronic Pain Using Expected Supply Duration"(prescription FHIR.MedicationRequest): ( prescription.dispenseRequest is not null and prescription.dispenseRequest.expectedSupplyDuration is not null and ( Common.GetDurationInDays(prescription.dispenseRequest.expectedSupplyDuration) >= 28 days ) )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 118
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: GetDurationInDays
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function GetDurationInDays(value FHIR.Duration): if value is null then null else case when value.code.value ~ 'a' then System.Quantity{ value: value.value.value * 365.0, unit: 'days' } when value.code.value ~ 'mo' then System.Quantity{ value: value.value.value * 30.0, unit: 'days' } when value.code.value ~ 'wk' then System.Quantity{ value: value.value.value * 7.0, unit: 'days' } when value.code.value ~ 'd' then System.Quantity{ value: value.value.value, unit: 'days' } when value.code.value ~ 'h' then System.Quantity{ value: value.value.value / 24.0, unit: 'days' } when value.code.value ~ 'min' then System.Quantity{ value: value.value.value / 60.0 / 24.0, unit: 'days' } when value.code.value ~ 's' then System.Quantity{ value: value.value.value / 60.0 / 60.0 / 24.0, unit: 'days' } when value.code.value ~ 'ms' then System.Quantity{ value: value.value.value / 60.0 / 60.0 / 24.0 / 1000.0, unit: 'days' } when value.code.value is null then Message(1000, true, 'Undefined', 'Error', 'Duration unit code is null') else Message(1000, true, 'Undefined', 'Error', 'Unsupported duration unit code: ' + value.code.value) end
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 119
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Is Subacute or Chronic Pain Using Validity Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function "Is Subacute or Chronic Pain Using Validity Period"(prescription FHIR.MedicationRequest): ( prescription.dispenseRequest is not null and prescription.dispenseRequest.validityPeriod is not null and ( days between prescription.dispenseRequest.validityPeriod.start and prescription.dispenseRequest.validityPeriod.end >= 28 ) )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 120
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToDateTime
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToDateTime(value instant): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 121
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToString
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToString(value ObservationStatus): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 122
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: CreateDetailWithPossibleUnexpectedNegative
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function CreateDetailWithPossibleUnexpectedNegative(TheSubstance String, ThePosLabs List<Observation>, TheNegLabs List<Observation>, TheMeds List<MedicationRequest>): { ingredient: TheSubstance, posDates: ( ThePosLabs PosLab return date from PosLab.effective ), negDates: ( TheNegLabs NegLab return date from NegLab.effective ), unexpectedPosDetails: ( ThePosLabs PosLab where not exists ( TheMeds Rx where Common.GetDateFromMedicationRequest(Rx) in day of Interval[ date from PosLab.effective - 31 days, date from PosLab.effective - 1 days ] ) return { date: date from PosLab.effective, udsDetail: if exists(PosLab.code.coding) then PosLab.code.coding[0].display else 'Unable to determine a detailed identifier' } ), unexpectedNegDetails: ( from TheNegLabs NegLab, ( if exists(TheMeds) then TheMeds else { null as MedicationRequest } ) Rx let medDate: Common.GetDateFromMedicationRequest(Rx) where medDate in day of Interval[date from NegLab.effective - 31 days, date from NegLab.effective - 1 days] return { udsDate: date from NegLab.effective, udsDetail: if exists (NegLab.code.coding) then NegLab.code.coding[0].display else 'Unable to determine a detailed identifier', rxDate: medDate, rxDetail: if Rx.medication.text is not null then Rx.medication.text else if exists (Rx.medication.coding) and Rx.medication.coding[0].display is not null then Rx.medication.coding[0].display else 'Unable to determine a detailed identifier' } ) }
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 123
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: GetDateFromMedicationRequest
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function "GetDateFromMedicationRequest"(med FHIR.MedicationRequest): if med is null then null else if med.authoredOn is not null then date from med.authoredOn else Max( med.dosageInstruction DI return Coalesce( // If there are timing events, take the latest. Max(DI.timing.event E return date from E), // Otherwise, if there's a Period, use its start. if DI.timing.repeat is not null and DI.timing.repeat.bounds is FHIR.Period then date from start of FHIRHelpers.ToInterval(DI.timing.repeat.bounds as FHIR.Period) else null ) )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 124
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToInterval
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToInterval(period FHIR.Period): if period is null then null else if period."start" is null then Interval(period."start".value, period."end".value] else Interval[period."start".value, period."end".value]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 125
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: GetPositiveLabsInLookbackPeriod
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function GetPositiveLabsInLookbackPeriod(Labs List<FHIR.Observation>, Enabled Boolean): if Enabled then Labs Lab where StartsWith(Lower(Lab.value as FHIR.string), 'pos') else {}
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 126
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: GetNegativeLabsInLookbackPeriod
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function GetNegativeLabsInLookbackPeriod(Labs List<FHIR.Observation>, Enabled Boolean): if Enabled then Labs Lab where StartsWith(Lower(Lab.value as FHIR.string), 'neg') else {}
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 127
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToString
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToString(value MedicationRequestStatus): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 128
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToString
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToString(value MedicationRequestIntent): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 129
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: CreateDetailWithoutPossibleUnexpectedNegative
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function CreateDetailWithoutPossibleUnexpectedNegative(TheSubstance String, ThePosLabs List<Observation>, TheNegLabs List<Observation>): { ingredient: TheSubstance, posDates: ( ThePosLabs PosLab return date from PosLab.effective ), negDates: ( TheNegLabs NegLab return date from NegLab.effective ), unexpectedPosDetails: ( ThePosLabs PosLab return { date: date from PosLab.effective, udsDetail: if exists (PosLab.code.coding) then PosLab.code.coding[0].display else 'Unable to determine a detailed identifier' } ), unexpectedNegDetails: { null as Tuple{ udsDate System.Date, udsDetail System.String, rxDate System.Date, rxDetail System.String } } }
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 130
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: GetExpectedColumn
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function GetExpectedColumn(Content String): ' ' & Content & '<\/td>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 131
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: GetUnexpectedColumn
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Functions define function GetUnexpectedColumn(Result String, Superscript String): ' ' & Result & '' & Superscript & '<\/sup><\/td>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 132
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: GetFooterColumn
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function GetFooterColumn(colspan Integer, message String): ' ' & message & '<\/td>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 133
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

v: EffectiveDataRequirements

v: active

coding:
  system:
    v: http://terminology.hl7.org/CodeSystem/library-type
    l: library-type
  code:
    v: module-definition

type:
  v: depends-on
display:
  v: FHIR model information
resource:
  v: http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1
  l: http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo

type:
  v: depends-on
display:
  v: Library Common
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSCommon|2022.1.0
  l: http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSCommon

type:
  v: depends-on
display:
  v: Library Config
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSCommonConfig|2022.1.0
  l: http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSCommonConfig

type:
  v: depends-on
display:
  v: Library FHIRHelpers
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/Library/FHIRHelpers|4.0.1
  l: http://fhir.org/guides/cdc/opioid-cds/Library/FHIRHelpers

type:
  v: depends-on
display:
  v: Library Routines
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSRoutines|2022.1.0
  l: http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSRoutines

type:
  v: depends-on
display:
  v: Library Rec10Common
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSREC10Common|2022.1.0
  l: http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSREC10Common

type:
  v: depends-on
display:
  v: Value set Community
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/medicationrequest-category-community
  l: medicationrequest-category-community

type:
  v: depends-on
display:
  v: Value set Opioid analgesics with ambulatory misuse potential
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/opioid-analgesics-with-ambulatory-misuse-potential
  l: opioid-analgesics-with-ambulatory-misuse-potential

type:
  v: depends-on
display:
  v: Value set Encounter Diagnosis Condition Category
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-encounter-diagnosis-category
  l: condition-encounter-diagnosis-category

type:
  v: depends-on
display:
  v: Value set Problem List Condition Category
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-problem-list-category
  l: condition-problem-list-category

type:
  v: depends-on
display:
  v: Value set US Core Health Concern Condition Category
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-us-core-health-concern-category
  l: condition-us-core-health-concern-category

type:
  v: depends-on
display:
  v: Value set Sickle Cell Diseases
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/sickle-cell-diseases
  l: sickle-cell-diseases

type:
  v: depends-on
display:
  v: Value set Active Condition
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-clinical-status-active
  l: condition-clinical-status-active

type:
  v: depends-on
display:
  v: Value set CDC malignant cancer conditions
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/cdc-malignant-cancer-conditions
  l: cdc-malignant-cancer-conditions

type:
  v: depends-on
display:
  v: Value set Conditions likely terminal for opioid prescribing
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/conditions-likely-terminal-for-opioid-prescribing
  l: conditions-likely-terminal-for-opioid-prescribing

type:
  v: depends-on
display:
  v: Value set All Drug Urine Screening
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/all-urine-drug-screening-tests
  l: all-urine-drug-screening-tests

type:
  v: depends-on
display:
  v: Value set Limited life expectancy conditions
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/limited-life-expectancy-conditions
  l: limited-life-expectancy-conditions

type:
  v: depends-on
display:
  v: Value set Hospice Finding Codes
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/hospice-finding
  l: hospice-finding

type:
  v: depends-on
display:
  v: Value set Hospice Disposition
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/hospice-disposition
  l: hospice-disposition

type:
  v: depends-on
display:
  v: Value set Amphetamine Urine Tests
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/amphetamine-urine-drug-screening-tests
  l: amphetamine-urine-drug-screening-tests

type:
  v: depends-on
display:
  v: Value set Amphetamine Medications
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/amphetamines-class-medications
  l: amphetamines-class-medications

type:
  v: depends-on
display:
  v: Value set Barbiturate Urine Tests
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/barbiturate-urine-drug-screening-tests
  l: barbiturate-urine-drug-screening-tests

type:
  v: depends-on
display:
  v: Value set Barbiturate Medications
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/barbiturate-medications
  l: barbiturate-medications

type:
  v: depends-on
display:
  v: Value set Benzodiazepine Urine Tests
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/benzodiazepine-urine-drug-screening-tests
  l: benzodiazepine-urine-drug-screening-tests

type:
  v: depends-on
display:
  v: Value set Benzodiazepine medications
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/benzodiazepine-medications
  l: benzodiazepine-medications

type:
  v: depends-on
display:
  v: Value set Buprenorphine Urine Tests
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/buprenorphine-urine-drug-screening-tests
  l: buprenorphine-urine-drug-screening-tests

type:
  v: depends-on
display:
  v: Value set Buprenorphine Medications
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/buprenorphine-medications
  l: buprenorphine-medications

type:
  v: depends-on
display:
  v: Value set Cannabinoid Urine Tests
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/cannabinoid-urine-drug-screening-tests
  l: cannabinoid-urine-drug-screening-tests

type:
  v: depends-on
display:
  v: Value set Cocaine Urine Tests
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/cocaine-urine-drug-screening-tests
  l: cocaine-urine-drug-screening-tests

type:
  v: depends-on
display:
  v: Value set Fentanyl Urine Tests
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/fentanyl-type-urine-drug-screening-tests
  l: fentanyl-type-urine-drug-screening-tests

type:
  v: depends-on
display:
  v: Value set Fentanyl Medications
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/fentanyl-type-medications
  l: fentanyl-type-medications

type:
  v: depends-on
display:
  v: Value set Heroin Urine Tests
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/heroin-urine-drug-screening-tests
  l: heroin-urine-drug-screening-tests

type:
  v: depends-on
display:
  v: Value set Methadone Urine Tests
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/methadone-urine-drug-screening-tests
  l: methadone-urine-drug-screening-tests

type:
  v: depends-on
display:
  v: Value set Methadone Medications
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/methadone-medications
  l: methadone-medications

type:
  v: depends-on
display:
  v: Value set General Opiate Urine Tests
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/general-opiate-urine-drug-screening-tests
  l: general-opiate-urine-drug-screening-tests

type:
  v: depends-on
display:
  v: Value set Opiate Medications
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/non-synthetic-opioid-medications
  l: non-synthetic-opioid-medications

type:
  v: depends-on
display:
  v: Value set Oxycodone Urine Tests
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/oxycodone-urine-drug-screening-tests
  l: oxycodone-urine-drug-screening-tests

type:
  v: depends-on
display:
  v: Value set Oxycodone Medications
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/oxycodone-medications
  l: oxycodone-medications

type:
  v: depends-on
display:
  v: Value set PCP Urine Tests
resource:
  v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/phencyclidine-urine-drug-screening-tests
  l: phencyclidine-urine-drug-screening-tests

name:
  v: Is Perform Drug Screen Recommendation Applicable?
use:
  v: out
min:
  v: 0
max:
  v: 1
type:
  v: boolean

name:
  v: Applicable Because of Unexpected Results
use:
  v: out
min:
  v: 0
max:
  v: 1
type:
  v: boolean

name:
  v: Detail
use:
  v: out
min:
  v: 0
max:
  v: 1
type:
  v: string

type:
  v: Medication
profile:
  v: http://hl7.org/fhir/StructureDefinition/Medication
  l: Medication
must support:
  v: id
must support:
  v: code

type:
  v: MedicationRequest
profile:
  v: http://hl7.org/fhir/StructureDefinition/MedicationRequest
  l: MedicationRequest
must support:
  v: authoredOn
must support:
  v: medication
must support:
  v: medication.reference
must support:
  v: id
must support:
  v: status
must support:
  v: intent
must support:
  v: category
must support:
  v: subject
must support:
  v: recorder
must support:
  v: dosageInstruction
must support:
  v: dispenseRequest
must support:
  v: status.value
must support:
  v: timing
must support:
  v: timing.event
must support:
  v: timing.repeat
must support:
  v: timing.repeat.bounds
must support:
  v: medication.text
must support:
  v: medication.coding

type:
  v: MedicationRequest
profile:
  v: http://hl7.org/fhir/StructureDefinition/MedicationRequest
  l: MedicationRequest
must support:
  v: category
must support:
  v: status
must support:
  v: intent
must support:
  v: medication
must support:
  v: medication.reference
must support:
  v: id
must support:
  v: subject
must support:
  v: authoredOn
must support:
  v: recorder
must support:
  v: dosageInstruction
must support:
  v: dispenseRequest
must support:
  v: status.value
must support:
  v: timing
must support:
  v: timing.event
must support:
  v: timing.repeat
must support:
  v: timing.repeat.bounds
must support:
  v: medication.text
must support:
  v: medication.coding
code filter:
  path:
    v: category
  value set:
    v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/medicationrequest-category-community
    l: medicationrequest-category-community

type:
  v: Patient
profile:
  v: http://hl7.org/fhir/StructureDefinition/Patient
  l: Patient

type:
  v: Condition
profile:
  v: http://hl7.org/fhir/StructureDefinition/Condition
  l: Condition
must support:
  v: category
must support:
  v: code
must support:
  v: clinicalStatus
code filter:
  path:
    v: category
  value set:
    v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-us-core-health-concern-category
    l: condition-us-core-health-concern-category

type:
  v: Condition
profile:
  v: http://hl7.org/fhir/StructureDefinition/Condition
  l: Condition
must support:
  v: category
must support:
  v: code
must support:
  v: clinicalStatus
must support:
  v: encounter
must support:
  v: encounter.reference
code filter:
  path:
    v: category
  value set:
    v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-encounter-diagnosis-category
    l: condition-encounter-diagnosis-category

type:
  v: Condition
profile:
  v: http://hl7.org/fhir/StructureDefinition/Condition
  l: Condition
must support:
  v: category
must support:
  v: code
must support:
  v: clinicalStatus
must support:
  v: clinicalStatus.coding
code filter:
  path:
    v: category
  value set:
    v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-problem-list-category
    l: condition-problem-list-category

type:
  v: Encounter
profile:
  v: http://hl7.org/fhir/StructureDefinition/Encounter
  l: Encounter
must support:
  v: period
must support:
  v: period.start
must support:
  v: id
must support:
  v: hospitalization
must support:
  v: hospitalization.dischargeDisposition
must support:
  v: hospitalization.dischargeDisposition.coding
must support:
  v: status
must support:
  v: status.value

type:
  v: Observation
profile:
  v: http://hl7.org/fhir/StructureDefinition/Observation
  l: Observation
must support:
  v: code
must support:
  v: status
must support:
  v: status.value
must support:
  v: effective
must support:
  v: code.coding
must support:
  v: value
code filter:
  path:
    v: code
  value set:
    v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/hospice-finding
    l: hospice-finding

type:
  v: Observation
profile:
  v: http://hl7.org/fhir/StructureDefinition/Observation
  l: Observation
must support:
  v: code
must support:
  v: effective
must support:
  v: status
must support:
  v: code.coding
must support:
  v: value
code filter:
  path:
    v: code
  value set:
    v: http://fhir.org/guides/cdc/opioid-cds/ValueSet/all-urine-drug-screening-tests
    l: all-urine-drug-screening-tests

url:
  v: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability
  l: cpg-knowledgeCapability
value: Code
  v: shareable

url:
  v: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability
  l: cpg-knowledgeCapability
value: Code
  v: computable

url:
  v: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability
  l: cpg-knowledgeCapability
value: Code
  v: executable

url:
  v: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability
  l: cpg-knowledgeCapability
value: Code
  v: publishable

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Can the implementing EHR support queries for past medications by date range?
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Subroutine 2 - Past Medications define "Can the implementing EHR support queries for past medications by date range?": true
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 0
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: Active Ambulatory Opioid Rx
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Active Ambulatory Opioid Rx": if Config."Can the implementing EHR support queries for past medications by date range?" then ( "Get MedicationRequest Medication as Code"("Get Active Ambulatory Medication Requests"([MedicationRequest])) ) Rx where date from Rx.authoredOn 2 years or less on or before Today() and Rx.medication in "Opioid analgesics with ambulatory misuse potential" else List<FHIR.MedicationRequest>{}
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 1
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10PatientView
extension:
  url:
    v: name
    l: name
  value: String
    v: Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions": Common."Active Ambulatory Opioid Rx" AmbulatoryOpioidPrescription where Routines."Is Subacute or Chronic Pain Prescription?"(AmbulatoryOpioidPrescription)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 2
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10PatientView
extension:
  url:
    v: name
    l: name
  value: String
    v: Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential": exists ("Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 3
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Age Less than 18 Years Is Enabled
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // CDC 2022 General Inclusion Criteria define "Age Less than 18 Years Is Enabled": true
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 4
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Patient Age Less Than 18
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Patient Age Less Than 18": if (Config."Age Less than 18 Years Is Enabled") then AgeInYearsAt(Today()) < 18 else false
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 5
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Sickle Cell Check Enabled
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Sickle Cell define "Sickle Cell Check Enabled": true
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 6
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Sickle Cell Assumed Active
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Sickle Cell Assumed Active": true
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 7
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: US Core-Categorized Conditions
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // 3. Medications indicating end of life /* or exists ( "Medications Indicating End of Life" ) */ define "US Core-Categorized Conditions": [Condition: category in "Encounter Diagnosis Condition Category"] union [Condition: category in "Problem List Condition Category"] union [Condition: category in "US Core Health Concern Condition Category"]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 8
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Sickle Cell Condition
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Sickle Cell Condition": if Config."Sickle Cell Check Enabled" and not Config."Sickle Cell Assumed Active" then ( "US Core-Categorized Conditions" C where C.code in "Sickle Cell Diseases" and C.clinicalStatus in "Active Condition" ) else if Config."Sickle Cell Check Enabled" and Config."Sickle Cell Assumed Active" then ( "US Core-Categorized Conditions" C where C.code in "Sickle Cell Diseases" ) else null
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 9
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Condition Positive for Sickle Cell
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Condition Positive for Sickle Cell": if (Config."Sickle Cell Check Enabled") then exists( Common."Positive Sickle Cell Condition" ) else false
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 10
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Active Cancer Treatment Encounters Condition Is Enabled
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Active Cancer Treatment define "Active Cancer Treatment Encounters Condition Is Enabled": true
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 11
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Encounter Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // End of Opioid Naive Routine /* ** Routine #3 ** Active Cancer Treatment Routine ** ** Definition | Answer to Proceed | Details | Data (Terminology) Requirement ** --------------------------------------------------------------------------------------------------------------------------------- ** Two office visits within the | No | Look for a minimum of two distinct | Office Visit ** past 12 months | | encounters within 12 months of the date | ** | | of the current visit for which each of the | ** | | following is true: | ** | | - the encounter diagnosis (primary or | ** | | secondary or co-morbidity diagnosis) | ** | | is listed in the CDC Malignant Cancer | ** | | Conditions value set | ** --------------------------------------------------------------------------------------------------------------------------------- ** Office visits with an | No | The encounter is performed by an | Oncology specialty ** oncology specialist | | oncologist as defined in the oncology | designations (NUCC) ** present | | specialty designations using the | ** | | National Uniform Claim Committee | ** | | (NUCC) classifications | ** --------------------------------------------------------------------------------------------------------------------------------- ** Office visits including CDC | No | The encounter diagnosis (primary or | CDC malignant cancer ** malignant cancer | | secondary or co-morbidity diagnosis) | conditions ** condition | | is listed in the CDC Malignant Cancer | ** | | Conditions value set | ** ---------------------------------------------------------------------------------------------------------------------------------- ** */ define "Encounter Period": Interval[Today() - 12 months, Today())
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 12
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: USCore Encounter Cancer Diagnoses
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "USCore Encounter Cancer Diagnoses": [Condition: category in "Encounter Diagnosis Condition Category"] CancerDiagnoses where CancerDiagnoses.code in "CDC malignant cancer conditions"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 13
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Encounters with Cancer Diagnosis During Encounter Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // encounter-diagnosis, problem-list and health-concern Conditions // define "US Core-Categorized Cancer Diagnoses": // Common."US Core-Categorized Conditions" C // where C.code in Common."CDC malignant cancer conditions" // define "Encounters with Cancer Diagnosis During Encounter Period": // [Encounter] Encounter // with "US Core-Categorized Cancer Diagnoses" CancerDiagnosis // such that date from Encounter.period."start".value in day of "Encounter Period" // and EndsWith(CancerDiagnosis.encounter.reference, Encounter.id) define "Encounters with Cancer Diagnosis During Encounter Period": [Encounter] Encounters where date from Encounters.period."start" in day of "Encounter Period" and exists ( Common."USCore Encounter Cancer Diagnoses" CancerDiagnoses where EndsWith(CancerDiagnoses.encounter.reference, Encounters.id) )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 14
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Number of Encounters with Cancer Diagnosis During Encounter Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Number of Encounters with Cancer Diagnosis During Encounter Period": Count ("Encounters with Cancer Diagnosis During Encounter Period")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 15
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Has Two or More Encounters with Cancer Diagnosis During Encounter Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Has Two or More Encounters with Cancer Diagnosis During Encounter Period": "Number of Encounters with Cancer Diagnosis During Encounter Period" >= 2
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 16
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: USCore Problem List Cancer Diagnoses
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "USCore Problem List Cancer Diagnoses": [Condition: category in "Problem List Condition Category"] CancerDiagnoses where CancerDiagnoses.code in "CDC malignant cancer conditions"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 17
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Has Active Cancer Diagnosis on Problem List
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Has Active Cancer Diagnosis on Problem List": exists ( Common."USCore Problem List Cancer Diagnoses" CancerDiagnoses where CancerDiagnoses.category in Common."Problem List Condition Category" and exists( CancerDiagnoses.clinicalStatus.coding ClinicalStatus where ClinicalStatus.code ~ 'active' ) )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 18
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Is Active Cancer Treatment?
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Is Active Cancer Treatment?": if (Config."Active Cancer Treatment Encounters Condition Is Enabled") then "Has Two or More Encounters with Cancer Diagnosis During Encounter Period" or "Has Active Cancer Diagnosis on Problem List" else false
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 19
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: End-Stage Disease Criteria Enabled
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // CDC 2022 General Inclusion Criteria define "End-Stage Disease Criteria Enabled": true
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 20
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Conditions Likely Terminal for Opioid Prescribing
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Conditions Likely Terminal for Opioid Prescribing": if (Config."End-Stage Disease Criteria Enabled") then exists ( Common."US Core-Categorized Conditions" EOLC where EOLC.code in Common."Conditions likely terminal for opioid prescribing" // and EOLC.clinicalStatus in Common."Active Condition" ) else false
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 21
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: CDC 2022 Guideline General Inclusion Criteria
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "CDC 2022 Guideline General Inclusion Criteria": not "Patient Age Less Than 18" and not "Condition Positive for Sickle Cell" and not "Is Active Cancer Treatment?" and not "Conditions Likely Terminal for Opioid Prescribing"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 22
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Use Alternative UDS Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Use Alternative UDS Lookback Period": false
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 23
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Alternative UDS Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Alternative UDS Lookback Period": Interval[Today() - 6 months - 1 days, Today()]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 24
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: All Opioid or Non-opioid UDS in Alternative Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "All Opioid or Non-opioid UDS in Alternative Lookback Period": ( [Observation: Common."All Drug Urine Screening"] Lab where date from Lab.effective in day of Config."Alternative UDS Lookback Period" and not ( Lab.status in { 'unknown', 'entered-in-error', 'cancelled' } ) ) X sort by date from effective desc
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 25
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: UDS Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Constants define "UDS Lookback Period": Interval[Today() - 12 months - 1 days, Today()]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 26
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: All Opioid or Non-opioid UDS in Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "All Opioid or Non-opioid UDS in Lookback Period": ( [Observation: Common."All Drug Urine Screening"] Lab where date from Lab.effective in day of "UDS Lookback Period" and not ( Lab.status in { 'unknown', 'entered-in-error', 'cancelled' } ) ) X sort by date from effective desc
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 27
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Inclusion Criteria For UDS Recommendation
extension:
  url:
    v: statement
    l: statement
  value: String
    v: /* @description: Determines whether the general inclusion criteria is met for the patient and whether they had a UDS performed in the past year */ define "Inclusion Criteria For UDS Recommendation": Routines."CDC 2022 Guideline General Inclusion Criteria" and not exists ( if Config."Use Alternative UDS Lookback Period" then "All Opioid or Non-opioid UDS in Alternative Lookback Period" else "All Opioid or Non-opioid UDS in Lookback Period" )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 28
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: Conditions Indicating End of Life or With Limited Life Expectancy
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Conditions Indicating End of Life or With Limited Life Expectancy": ( "US Core-Categorized Conditions" C where C.code in "Conditions likely terminal for opioid prescribing" and C.clinicalStatus in "Active Condition" ) union ( "US Core-Categorized Conditions" C where C.code in "Limited life expectancy conditions" and C.clinicalStatus in "Active Condition" )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 29
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Hospice Findings Exclusion Enabled
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // OpioidCDSCommon define "Hospice Findings Exclusion Enabled": false
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 30
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: Admitted/Referred/Discharged to Hospice Care
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Admitted/Referred/Discharged to Hospice Care": ( if (Config."Hospice Findings Exclusion Enabled") then [Observation: code in "Hospice Finding Codes"] O where not (O.status.value in { 'unknown', 'entered-in-error', 'cancelled' }) else {} ) union ( [Encounter] E where date from E.period.start 1 year or less on or before Today() and ( if E.hospitalization.dischargeDisposition.coding is null or not exists (E.hospitalization.dischargeDisposition.coding) then false else E.hospitalization.dischargeDisposition in "Hospice Disposition" ) and E.status.value in { 'planned', 'arrived', 'in-progress', 'finished', 'onleave' } )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 31
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: End of Life Assessment
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "End of Life Assessment": // 1. Conditions indicating end of life or with limited life expectancy exists ( "Conditions Indicating End of Life or With Limited Life Expectancy" ) // 2. Admitted/referred/discharged to hospice care or exists ( "Admitted/Referred/Discharged to Hospice Care" )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 32
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Exclusion Criteria
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Exclusion Criteria": Common."End of Life Assessment"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 33
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10PatientView
extension:
  url:
    v: name
    l: name
  value: String
    v: Is Perform Drug Screen Recommendation Applicable?
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Is Perform Drug Screen Recommendation Applicable?": "Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential" and Rec10Common."Inclusion Criteria For UDS Recommendation" and not Rec10Common."Exclusion Criteria"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 34
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Amphetamine Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Amphetamine Simple Identifier": 'Amphetamine'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 35
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Amphetamine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Amphetamines define "Amphetamine Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Amphetamine Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 36
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Amphetamine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Amphetamine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Amphetamine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 37
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Amphetamine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Amphetamine Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Amphetamine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 38
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Rx Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Rx Lookback Period": Interval[Today() - 12 months - 31 days, Today()]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 39
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Normalize Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Normalize Rx In Lookback Period": Common."Get MedicationRequest Medication as Code"( [MedicationRequest: category in Common."Community"] Rx where Rx.status in { 'active', 'completed', 'stopped' } and Rx.intent = 'order' and Common."GetDateFromMedicationRequest"(Rx) in day of "Rx Lookback Period" )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 40
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Amphetamine Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Amphetamine Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Amphetamine Medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 41
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Barbiturate Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Barbiturate Simple Identifier": 'Barbiturate'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 42
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Barbiturate Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Barbiturates define "Barbiturate Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Barbiturate Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 43
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Barbiturate Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Barbiturate Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Barbiturate Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 44
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Barbiturate Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Barbiturate Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Barbiturate Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 45
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Barbiturate Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Barbiturate Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Barbiturate Medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 46
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Benzodiazepine Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Benzodiazepine Simple Identifier": 'Benzodiazepine'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 47
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Benzodiazepine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Benzodiazepines define "Benzodiazepine Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Benzodiazepine Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 48
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Benzodiazepine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Benzodiazepine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Benzodiazepine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 49
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Benzodiazepine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Benzodiazepine Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Benzodiazepine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 50
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Benzodiazepine Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Benzodiazepine Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Benzodiazepine medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 51
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Buprenorphine Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Buprenorphine Simple Identifier": 'Buprenorphine'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 52
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Buprenorphine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Buprenorphine define "Buprenorphine Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Buprenorphine Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 53
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Buprenorphine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Buprenorphine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Buprenorphine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 54
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Buprenorphine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Buprenorphine Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Buprenorphine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 55
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Buprenorphine Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Buprenorphine Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Buprenorphine Medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 56
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Cannabinoid Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Cannabinoid Simple Identifier": 'Cannabinoid'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 57
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Cannabinoid Urine Screening Check Enabled
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Cannabinoid Urine Screening Check Enabled": false
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 58
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Cannabinoid Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Cannabinoids define "Cannabinoid Screenings In Lookback Period": if Config."Cannabinoid Urine Screening Check Enabled" then ( "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Cannabinoid Urine Tests" ) else null
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 59
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Cannabinoid Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Cannabinoid Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Cannabinoid Screenings In Lookback Period", Config."Cannabinoid Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 60
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Cannabinoid Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Cannabinoid Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Cannabinoid Screenings In Lookback Period", Config."Cannabinoid Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 61
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Cocaine Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Cocaine Simple Identifier": 'Cocaine'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 62
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Cocaine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Cocaine define "Cocaine Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Cocaine Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 63
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Cocaine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Cocaine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Cocaine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 64
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Cocaine Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Cocaine Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Cocaine Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 65
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Fentanyl Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Fentanyl Simple Identifier": 'Fentanyl'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 66
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommonConfig
extension:
  url:
    v: name
    l: name
  value: String
    v: Opiate Urine Screening Check Enabled
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Recommendation 10 define "Opiate Urine Screening Check Enabled": true
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 67
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Fentanyl Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Fentanyl define "Fentanyl Screenings In Lookback Period": if Config."Opiate Urine Screening Check Enabled" then ( "All Opioid or Non-opioid UDS in Lookback Period" AllLabs where AllLabs.code in Common."Fentanyl Urine Tests" ) else null
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 68
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Fentanyl Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Fentanyl Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Fentanyl Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 69
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Fentanyl Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Fentanyl Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Fentanyl Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 70
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Fentanyl Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Fentanyl Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Fentanyl Medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 71
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Heroin Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Heroin Simple Identifier": 'Heroin (6-AM)'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 72
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Heroin Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Heroin define "Heroin Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Heroin Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 73
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Heroin Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Heroin Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Heroin Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 74
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Heroin Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Heroin Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Heroin Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 75
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Methadone Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Methadone Simple Identifier": 'Methadone'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 76
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Methadone Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Methadone define "Methadone Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Methadone Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 77
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Methadone Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Methadone Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Methadone Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 78
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Methadone Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Methadone Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Methadone Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 79
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Methadone Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Methadone Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Methadone Medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 80
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Opiate Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Opiate Simple Identifier": 'Opiate'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 81
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Opiate Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Opiates define "Opiate Screenings In Lookback Period": if Config."Opiate Urine Screening Check Enabled" then ( "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."General Opiate Urine Tests" ) else null
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 82
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Opiate Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Opiate Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Opiate Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 83
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Opiate Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Opiate Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Opiate Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 84
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Opiate Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Opiate Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Opiate Medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 85
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Oxycodone Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Oxycodone Simple Identifier": 'Oxycodone'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 86
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Oxycodone Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Oxycodone define "Oxycodone Screenings In Lookback Period": if Config."Opiate Urine Screening Check Enabled" then ( "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Oxycodone Urine Tests" ) else null
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 87
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive Oxycodone Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive Oxycodone Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Oxycodone Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 88
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative Oxycodone Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative Oxycodone Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Oxycodone Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 89
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Oxycodone Rx In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Oxycodone Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Oxycodone Medications"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 90
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: PCP Simple Identifier
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "PCP Simple Identifier": 'Phencyclidine (PCP)'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 91
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: PCP Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // PCP define "PCP Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" AllLabs where AllLabs.code in Common."PCP Urine Tests"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 92
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Positive PCP Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Positive PCP Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("PCP Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 93
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Negative PCP Screenings In Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Negative PCP Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("PCP Screenings In Lookback Period", true)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 94
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Unexpected Details
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Details Logic define "Unexpected Details": { CreateDetailWithPossibleUnexpectedNegative( "Amphetamine Simple Identifier", "Positive Amphetamine Screenings In Lookback Period", "Negative Amphetamine Screenings In Lookback Period", "Amphetamine Rx In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Barbiturate Simple Identifier", "Positive Barbiturate Screenings In Lookback Period", "Negative Barbiturate Screenings In Lookback Period", "Barbiturate Rx In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Benzodiazepine Simple Identifier", "Positive Benzodiazepine Screenings In Lookback Period", "Negative Benzodiazepine Screenings In Lookback Period", "Benzodiazepine Rx In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Buprenorphine Simple Identifier", "Positive Buprenorphine Screenings In Lookback Period", "Negative Buprenorphine Screenings In Lookback Period", "Buprenorphine Rx In Lookback Period" ), CreateDetailWithoutPossibleUnexpectedNegative( "Cannabinoid Simple Identifier", "Positive Cannabinoid Screenings In Lookback Period", "Negative Cannabinoid Screenings In Lookback Period" ), CreateDetailWithoutPossibleUnexpectedNegative( "Cocaine Simple Identifier", "Positive Cocaine Screenings In Lookback Period", "Negative Cocaine Screenings In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Fentanyl Simple Identifier", "Positive Fentanyl Screenings In Lookback Period", "Negative Fentanyl Screenings In Lookback Period", "Fentanyl Rx In Lookback Period" ), CreateDetailWithoutPossibleUnexpectedNegative( "Heroin Simple Identifier", "Positive Heroin Screenings In Lookback Period", "Negative Heroin Screenings In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Methadone Simple Identifier", "Positive Methadone Screenings In Lookback Period", "Negative Methadone Screenings In Lookback Period", "Methadone Rx In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Opiate Simple Identi…
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 95
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Remove Substances Without Positive or Negative Results
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Remove Substances Without Positive or Negative Results": "Unexpected Details" Details where (Details.posDates is not null and Length(Details.posDates) != 0) or (Details.negDates is not null and Length(Details.negDates) != 0)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 96
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Inclusion Criteria For Unexpected Results
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Inclusion Criteria For Unexpected Results": Routines."CDC 2022 Guideline General Inclusion Criteria" and AnyTrue( "Remove Substances Without Positive or Negative Results" Details return (exists Details.unexpectedPosDetails) or (exists Details.unexpectedNegDetails) )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 97
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10PatientView
extension:
  url:
    v: name
    l: name
  value: String
    v: Applicable Because of Unexpected Results
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Applicable Because of Unexpected Results": "Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential" and Rec10Common."Inclusion Criteria For Unexpected Results" and not Rec10Common."Exclusion Criteria"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 98
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: Style Header
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Style Header": ' \r\n .alert-body {\r\n width: 670px;\r\n font-family: segoe-ui, sans-serif;\r\n background-color: #FEFFF1;\r\n }\r\n\r\n .details-table {\r\n border-collapse:collapse;\r\n border-style: ridge;\r\n background-color: #FEFFF1;\r\n padding: 2px;\r\n }\r\n\r\n .details-caption {\r\n border-style: ridge;\r\n border-bottom: none;\r\n background-color: #FEFFF1;\r\n padding: 2px;\r\n }\r\n\r\n .details-table-header {\r\n border-style: ridge;\r\n padding: 5px;\r\n }\r\n\r\n .details-table-cell {\r\n border-style: ridge;\r\n padding: 5px;\r\n }\r\n\r\n .details-table-footer-cell {\r\n border-style: ridge;\r\n padding: 5px;\r\n font-size: small;\r\n }\r\n\r\n .details-table-cell-unexpected {\r\n border-style: ridge;\r\n padding: 5px;\r\n color: red;\r\n font-weight: bold;\r\n }\r\n\r\n .more-text {\r\n position: relative;\r\n margin-bottom: 2em;\r\n }\r\n \r\n .more {\r\n display:none;\r\n }\r\n\r\n .show-more:checked + .more {\r\n display:block;\r\n }\r\n<\/style>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 99
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Unexpected Div Start
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Unexpected Div Start": ' Patient may have unexpected urine toxicology test results<\/strong> in the past year.<\/p><\/div>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 100
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Table Start
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Table Start": ' Urine Toxicology Results<\/caption> Substance<\/th>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 101
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: All Lab Dates in Lookback Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Helpers define "All Lab Dates in Lookback Period": ( "All Opioid or Non-opioid UDS in Lookback Period" Lab return date from Lab.effective ) X sort desc
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 102
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Table Headers
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Table Headers": "All Lab Dates in Lookback Period" LabDate return ' ' & ToString(LabDate) & '<\/th>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 103
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Generate Table Rows
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Generate Table Rows": "Remove Substances Without Positive or Negative Results" BOT let row: ToString(IndexOf("Remove Substances Without Positive or Negative Results", BOT) + 1) return ' ' + GetExpectedColumn(BOT.ingredient) + Combine( "All Lab Dates in Lookback Period" LabDate let col: ToString(IndexOf("All Lab Dates in Lookback Period", LabDate) + 2) return all ( if BOT.unexpectedPosDetails.date contains LabDate then GetUnexpectedColumn('pos', row & ':' & col) else if BOT.unexpectedNegDetails.udsDate contains LabDate then GetUnexpectedColumn('neg', row & ':' & col) else if BOT.posDates contains LabDate then GetExpectedColumn('pos*') else if BOT.negDates contains LabDate then GetExpectedColumn('neg*') else GetExpectedColumn('n/a') ) ) + '<\/tr>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 104
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Generate Footer Rows
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Generate Footer Rows": "Remove Substances Without Positive or Negative Results" BOT let row: ToString(IndexOf("Remove Substances Without Positive or Negative Results", BOT) + 1), colspan: Length("All Lab Dates in Lookback Period") + 1 return Combine( "All Lab Dates in Lookback Period" LabDate let col: ToString(IndexOf("All Lab Dates in Lookback Period", LabDate) + 2) return all ( if BOT.unexpectedPosDetails.date contains LabDate then Coalesce( BOT.unexpectedPosDetails PosDetail where PosDetail.date same day as LabDate return ' ' & GetFooterColumn(colspan, row & ':' & col & ' - Possible unexpected substance found: ' & PosDetail.udsDetail) & '<\/tr>' ) else if BOT.unexpectedNegDetails.udsDate contains LabDate then Coalesce( BOT.unexpectedNegDetails NegDetail where NegDetail.udsDate same day as LabDate return ' ' & GetFooterColumn(colspan, row + ':' & col & ' - Possible unexpected negative result found: prescribed ' & NegDetail.rxDetail & ' on ' & ToString(NegDetail.rxDate)) & '<\/tr>' ) else '' ) )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 105
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Table End
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Table End": '<\/table><\/div>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 106
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Details Table
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Details Table": "Table Start" & Combine("Table Headers") & ' ' & Combine("Generate Table Rows") & ' ' & ' ' & Combine("Generate Footer Rows") & '<\/tfoot>' & "Table End"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 107
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Expected Result Footnote
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Expected Result Footnote": ' * - These are expected results based on an analysis of the patient\'s medication list 30 days prior to the corresponding lab results.<\/div>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 108
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Details More Info
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Details More Info": ' \r\n Note on false positives and unexpected negative results...<\/p>\r\n Show more\r\n \r\n An unexpectedly negative test may be due to time since last dose, diversion, intermittent use, aberrant drug use behavior, or other factors, including a false negative result. Clinicians should interpret this result in the context of the overall treatment plan.<\/p>\r\n\r\n Positive results may be a false positives or could represent occasional use or possible substance use disorder.<br\/><br\/>For a review regarding interpreting possible false positive urine toxicology results, see http:\/\/pubmed.ncbi.nlm.nih.gov\/24986836<\/a>. It is unknown if the findings reported in this article can be extrapolated to other laboratory analyzers that were not used in the referenced studies.<br\/><br\/>For guidance regarding evaluating and addressing unexpected toxicology tests results, see Recommendation 10 of the 22 CDC Clinical Practice Guideiline<\/a>.<\/p><\/div>\r\n<\/div>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 109
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Div End
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Div End": '<\/div>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 110
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: Get HTML Details
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // HTML Generation define "Get HTML Details": Common."Style Header" & "Unexpected Div Start" & "Details Table" & "Expected Result Footnote" & "Details More Info" & "Div End"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 111
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10PatientView
extension:
  url:
    v: name
    l: name
  value: String
    v: Detail
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define "Detail": Rec10Common."Get HTML Details"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 112
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: Get MedicationRequest Medication as Code
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function "Get MedicationRequest Medication as Code"(value List<MedicationRequest>): value Rx let Med: if Rx.medication is Reference then singleton from ( [Medication] M where M.id = (Last(Split((Rx.medication as FHIR.Reference).reference, '/'))) ) else null return MedicationRequest { id: Rx.id, status: Rx.status, intent: Rx.intent, category: Rx.category, medication: if Rx.medication is Reference then Med.code else Rx.medication as CodeableConcept, subject: Rx.subject, authoredOn: Rx.authoredOn, recorder: Rx.recorder, dosageInstruction: Rx.dosageInstruction, dispenseRequest: Rx.dispenseRequest }
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 113
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToString
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToString(value string): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 114
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: Get Active Ambulatory Medication Requests
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function "Get Active Ambulatory Medication Requests" (value List<MedicationRequest>) returns List<MedicationRequest>: value Rx where Rx.status.value = 'active' and Rx.category in "Community"
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 115
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToConcept
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToConcept(concept FHIR.CodeableConcept): if concept is null then null else System.Concept { codes: concept.coding C return ToCode(C), display: concept.text.value }
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 116
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToCode
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToCode(coding FHIR.Coding): if coding is null then null else System.Code { code: coding.code.value, system: coding.system.value, version: coding.version.value, display: coding.display.value }
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 117
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToDateTime
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToDateTime(value dateTime): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 118
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Is Subacute or Chronic Pain Prescription?
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // End of Active Cancer Treatment Routine /* ** Routine #4 ** For Subacute or Chronic Pain Routine ** ** Definition | Answer to Proceed | Details | Data (Terminology) Requirement ** ----------------------------------------------------------------------------------------------------------------------------------- ** Order for opioid analgesic | Yes | Order for opioid analgesics with ambulatory | Opioid analgesics with ** with expected supply | | misuse potential with a supply duration of >= | ambulatory misuse potential ** duration >= 28 days | | 28 days | ** | | | ** | | - Subacute definition = order for opioid | ** | | analgesics with ambulatory misuse | ** | | potential with a supply duration of one to | ** | | two months. | ** | | - Chronic pain definition = order for opioid | ** | | analgesics with ambulatory misuse | ** | | potential with a supply duration of >= two | ** | | months. | ** ----------------------------------------------------------------------------------------------------------------------------------- ** */ define function "Is Subacute or Chronic Pain Prescription?"(prescription FHIR.MedicationRequest): "Is Subacute or Chronic Pain Using Expected Supply Duration"(prescription) or "Is Subacute or Chronic Pain Using Validity Period"(prescription)
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 119
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Is Subacute or Chronic Pain Using Expected Supply Duration
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function "Is Subacute or Chronic Pain Using Expected Supply Duration"(prescription FHIR.MedicationRequest): ( prescription.dispenseRequest is not null and prescription.dispenseRequest.expectedSupplyDuration is not null and ( Common.GetDurationInDays(prescription.dispenseRequest.expectedSupplyDuration) >= 28 days ) )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 120
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: GetDurationInDays
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function GetDurationInDays(value FHIR.Duration): if value is null then null else case when value.code.value ~ 'a' then System.Quantity{ value: value.value.value * 365.0, unit: 'days' } when value.code.value ~ 'mo' then System.Quantity{ value: value.value.value * 30.0, unit: 'days' } when value.code.value ~ 'wk' then System.Quantity{ value: value.value.value * 7.0, unit: 'days' } when value.code.value ~ 'd' then System.Quantity{ value: value.value.value, unit: 'days' } when value.code.value ~ 'h' then System.Quantity{ value: value.value.value / 24.0, unit: 'days' } when value.code.value ~ 'min' then System.Quantity{ value: value.value.value / 60.0 / 24.0, unit: 'days' } when value.code.value ~ 's' then System.Quantity{ value: value.value.value / 60.0 / 60.0 / 24.0, unit: 'days' } when value.code.value ~ 'ms' then System.Quantity{ value: value.value.value / 60.0 / 60.0 / 24.0 / 1000.0, unit: 'days' } when value.code.value is null then Message(1000, true, 'Undefined', 'Error', 'Duration unit code is null') else Message(1000, true, 'Undefined', 'Error', 'Unsupported duration unit code: ' + value.code.value) end
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 121
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSRoutines
extension:
  url:
    v: name
    l: name
  value: String
    v: Is Subacute or Chronic Pain Using Validity Period
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function "Is Subacute or Chronic Pain Using Validity Period"(prescription FHIR.MedicationRequest): ( prescription.dispenseRequest is not null and prescription.dispenseRequest.validityPeriod is not null and ( days between prescription.dispenseRequest.validityPeriod.start and prescription.dispenseRequest.validityPeriod.end >= 28 ) )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 122
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToDateTime
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToDateTime(value instant): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 123
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToString
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToString(value ObservationStatus): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 124
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: CreateDetailWithPossibleUnexpectedNegative
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function CreateDetailWithPossibleUnexpectedNegative(TheSubstance String, ThePosLabs List<Observation>, TheNegLabs List<Observation>, TheMeds List<MedicationRequest>): { ingredient: TheSubstance, posDates: ( ThePosLabs PosLab return date from PosLab.effective ), negDates: ( TheNegLabs NegLab return date from NegLab.effective ), unexpectedPosDetails: ( ThePosLabs PosLab where not exists ( TheMeds Rx where Common.GetDateFromMedicationRequest(Rx) in day of Interval[ date from PosLab.effective - 31 days, date from PosLab.effective - 1 days ] ) return { date: date from PosLab.effective, udsDetail: if exists(PosLab.code.coding) then PosLab.code.coding[0].display else 'Unable to determine a detailed identifier' } ), unexpectedNegDetails: ( from TheNegLabs NegLab, ( if exists(TheMeds) then TheMeds else { null as MedicationRequest } ) Rx let medDate: Common.GetDateFromMedicationRequest(Rx) where medDate in day of Interval[date from NegLab.effective - 31 days, date from NegLab.effective - 1 days] return { udsDate: date from NegLab.effective, udsDetail: if exists (NegLab.code.coding) then NegLab.code.coding[0].display else 'Unable to determine a detailed identifier', rxDate: medDate, rxDetail: if Rx.medication.text is not null then Rx.medication.text else if exists (Rx.medication.coding) and Rx.medication.coding[0].display is not null then Rx.medication.coding[0].display else 'Unable to determine a detailed identifier' } ) }
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 125
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSCommon
extension:
  url:
    v: name
    l: name
  value: String
    v: GetDateFromMedicationRequest
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function "GetDateFromMedicationRequest"(med FHIR.MedicationRequest): if med is null then null else if med.authoredOn is not null then date from med.authoredOn else Max( med.dosageInstruction DI return Coalesce( // If there are timing events, take the latest. Max(DI.timing.event E return date from E), // Otherwise, if there's a Period, use its start. if DI.timing.repeat is not null and DI.timing.repeat.bounds is FHIR.Period then date from start of FHIRHelpers.ToInterval(DI.timing.repeat.bounds as FHIR.Period) else null ) )
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 126
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToInterval
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToInterval(period FHIR.Period): if period is null then null else if period."start" is null then Interval(period."start".value, period."end".value] else Interval[period."start".value, period."end".value]
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 127
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: GetPositiveLabsInLookbackPeriod
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function GetPositiveLabsInLookbackPeriod(Labs List<FHIR.Observation>, Enabled Boolean): if Enabled then Labs Lab where StartsWith(Lower(Lab.value as FHIR.string), 'pos') else {}
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 128
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: GetNegativeLabsInLookbackPeriod
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function GetNegativeLabsInLookbackPeriod(Labs List<FHIR.Observation>, Enabled Boolean): if Enabled then Labs Lab where StartsWith(Lower(Lab.value as FHIR.string), 'neg') else {}
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 129
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToString
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToString(value MedicationRequestStatus): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 130
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: FHIRHelpers
extension:
  url:
    v: name
    l: name
  value: String
    v: ToString
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function ToString(value MedicationRequestIntent): value.value
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 131
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: CreateDetailWithoutPossibleUnexpectedNegative
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function CreateDetailWithoutPossibleUnexpectedNegative(TheSubstance String, ThePosLabs List<Observation>, TheNegLabs List<Observation>): { ingredient: TheSubstance, posDates: ( ThePosLabs PosLab return date from PosLab.effective ), negDates: ( TheNegLabs NegLab return date from NegLab.effective ), unexpectedPosDetails: ( ThePosLabs PosLab return { date: date from PosLab.effective, udsDetail: if exists (PosLab.code.coding) then PosLab.code.coding[0].display else 'Unable to determine a detailed identifier' } ), unexpectedNegDetails: { null as Tuple{ udsDate System.Date, udsDetail System.String, rxDate System.Date, rxDetail System.String } } }
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 132
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: GetExpectedColumn
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function GetExpectedColumn(Content String): ' ' & Content & '<\/td>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 133
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: GetUnexpectedColumn
extension:
  url:
    v: statement
    l: statement
  value: String
    v: // Functions define function GetUnexpectedColumn(Result String, Superscript String): ' ' & Result & '' & Superscript & '<\/sup><\/td>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 134
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

extension:
  url:
    v: libraryName
    l: libraryName
  value: String
    v: OpioidCDSREC10Common
extension:
  url:
    v: name
    l: name
  value: String
    v: GetFooterColumn
extension:
  url:
    v: statement
    l: statement
  value: String
    v: define function GetFooterColumn(colspan Integer, message String): ' ' & message & '<\/td>'
extension:
  url:
    v: displaySequence
    l: displaySequence
  value: Integer
    v: 135
url:
  v: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition
  l: cqf-logicDefinition

url:
  v: http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-softwaresystem
  l: crmi-softwaresystem
value: Reference
  l: cqf-tooling
  reference:
    v: Device/cqf-tooling

url:
  v: http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-effectiveDataRequirements
  l: crmi-effectiveDataRequirements
value: Canonical
  v: #effective-data-requirements
  l: effective-data-requirements

use:
  v: official
value:
  v: cdc-opioid-guidance

v: 2022.1.0

v: PlanDefinition_Recommendation_10_Patient_View

v: Recommendation #10 - Urine Drug Testing (patient-view)

coding:
  system:
    v: http://terminology.hl7.org/CodeSystem/plan-definition-type
    l: plan-definition-type
  code:
    v: eca-rule
  display:
    v: ECA Rule

v: draft

v: true

v: 2025-08-06

v: HL7 FHIR Community Process (FCP) / Security Risk Solutions, Inc. (SRS)

telecom:
  system:
    v: url
  value:
    v: https://www.cdc.gov

v: When prescribing opioids for subacute or chronic pain, clinicians should consider the benefits and risks of toxicology testing to assess for prescribed medications as well as other prescribed and nonprescribed controlled substances.

code:
  system:
    v: http://terminology.hl7.org/CodeSystem/usage-context-type
    l: usage-context-type
  code:
    v: focus
  display:
    v: Clinical Focus
value: CodeableConcept
  coding: http://snomed.info/id/82423001
    system:
      v: http://snomed.info/sct
      l: sct
    code:
      v: 82423001
    display:
      v: Chronic pain (finding)

code:
  system:
    v: http://terminology.hl7.org/CodeSystem/usage-context-type
    l: usage-context-type
  code:
    v: focus
  display:
    v: Clinical Focus
value: CodeableConcept
  text:
    v: Subacute pain

v: The 2022 CDC Clinical Practice Guideline for Prescribing Opioids for Pain is intended to improve communication between clinicians and patients about the benefits and risks of pain treatments, including opioid therapy; improve the effectiveness and safety of pain treatment; mitigate pain; improve function and quality of life for patients with pain; and reduce risks associated with opioid pain therapy, including opioid use disorder, overdose, and death. The recommendations do not apply to pain related to sickle cell disease or cancer or to patients receiving palliative or end-of-life care.

v: Before starting opioids and periodically (at least annually) during opioid therapy, clinicians should consider the benefits and risks of toxicology testing to assess for prescribed opioids and other prescription and nonprescription controlled substances that increase risk for overdose when combined with opioids, including nonprescribed and illicit opioids and benzodiazepines.

v: © CDC 2016+.

text:
  v: Opioid Prescribing

name:
  v: Kensaku Kawamoto, MD, PhD, MHS

name:
  v: Bryn Rhodes

name:
  v: Floyd Eisenberg, MD, MPH

name:
  v: Robert McClure, MD, MPH

type:
  v: documentation
display:
  v: 2022 CDC Clinical Practice Guideline for Prescribing Opioids for Pain
url:
  v: https://www.cdc.gov/mmwr/volumes/71/rr/pdfs/rr7103a1-H.pdf
  l: rr7103a1-H.pdf
document:
  content type:
    v: application/pdf
  language:
    v: en-US
  url:
    v: https://www.cdc.gov/mmwr/volumes/71/rr/pdfs/rr7103a1-H.pdf
    l: rr7103a1-H.pdf

extension:
  url:
    v: http://hl7.org/fhir/StructureDefinition/cqf-strengthOfRecommendation
    l: cqf-strengthOfRecommendation
  value: CodeableConcept
    coding:
      system:
        v: http://terminology.hl7.org/CodeSystem/recommendation-strength
        l: recommendation-strength
      code:
        v: weak
      display:
        v: Weak
extension:
  url:
    v: http://hl7.org/fhir/StructureDefinition/cqf-qualityOfEvidence
    l: cqf-qualityOfEvidence
  value: CodeableConcept
    coding:
      system:
        v: http://terminology.hl7.org/CodeSystem/evidence-quality
        l: evidence-quality
      code:
        v: very-low
      display:
        v: Very Low quality
prefix:
  v: 1.
title:
  v: Consider the Benefits and Risks of Conducting a Urine Toxicology Screen
description:
  v: Consider the benefits and risks of toxicology testing to assess for prescribed medications as well as other prescribed and nonprescribed controlled substances. For guidance regarding utilizing toxicology tests when prescribing opioids, see [Recommendation 10 of the 2022 CDC Clinical Practice Guideline](https://www.cdc.gov/mmwr/volumes/71/rr/rr7103a1.htm#:~:text=evidence%20type%3A%204).-,Implementation%20Considerations,-Toxicology%20testing%20should).
priority:
  v: urgent
trigger:
  type:
    v: named-event
  name:
    v: patient-view
condition:
  kind:
    v: applicability
  expression:
    description:
      v: Patient has not had a urine screening in the past 12 months
    language:
      v: text/cql.identifier
    expression:
      v: Is Perform Drug Screen Recommendation Applicable?
type:
  coding:
    system:
      v: http://terminology.hl7.org/CodeSystem/action-type
      l: action-type
    code:
      v: create
    display:
      v: Create
definition: Canonical
  v: http://fhir.org/guides/cdc/opioid-cds/ActivityDefinition/opioidcds-urine-screening-request
  l: opioidcds-urine-screening-request
action:
  description:
    v: Document - Ordered toxicology screen
action:
  description:
    v: Document - Risks outweigh benefits
action:
  description:
    v: Snooze* - N/A see comment, snooze 3 months

extension:
  url:
    v: http://hl7.org/fhir/StructureDefinition/cqf-strengthOfRecommendation
    l: cqf-strengthOfRecommendation
  value: CodeableConcept
    coding:
      system:
        v: http://terminology.hl7.org/CodeSystem/recommendation-strength
        l: recommendation-strength
      code:
        v: weak
      display:
        v: Weak
extension:
  url:
    v: http://hl7.org/fhir/StructureDefinition/cqf-qualityOfEvidence
    l: cqf-qualityOfEvidence
  value: CodeableConcept
    coding:
      system:
        v: http://terminology.hl7.org/CodeSystem/evidence-quality
        l: evidence-quality
      code:
        v: very-low
      display:
        v: Very Low quality
prefix:
  v: 2.
title:
  v: Patient May Have Unexpected Toxicology Test Results
description:
  v: Patient may have unexpected urine toxicology test results in the past year
priority:
  v: urgent
trigger:
  type:
    v: named-event
  name:
    v: patient-view
condition:
  kind:
    v: applicability
  expression:
    description:
      v: Urine screening tested positive for cocaine, opiates or PCP
    language:
      v: text/cql.identifier
    expression:
      v: Applicable Because of Unexpected Results
dynamic value:
  path:
    v: action.description
  expression:
    language:
      v: text/cql.identifier
    expression:
      v: Detail
action:
  description:
    v: Document - Will repeat urine drug screen more frequently
action:
  description:
    v: Will consult with patient regarding possible unexpected test results
action:
  description:
    v: Document - Will assess patient for substance use disorder
action:
  description:
    v: Snooze* - Patient's test results were expected, snooze for 3 months
action:
  description:
    v: Snooze* - N/A snooze for 3 months