opioidcds-04-05
type: PlanDefinition
node role: treeRoot
resource.id:
  value: opioidcds-04-05
resource.meta:
  meta.profile:
    value: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-recommendationdefinition
    index: 0
    link: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-recommendationdefinition
  meta.profile:
    value: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-publishableplandefinition
    index: 1
    link: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-publishableplandefinition
domain resource.text:
  narrative.status:
    value: extensions
  narrative.div: Id: opioidcds-04-05 Url: Recommendations #4 and #5 - Lowest Effective Dose Version: 2022.1.0 Identifier: value: cdc-opioid-guidance Identifier: value: urn:oid:2.16.840.1.114222.34.4 Name: PlanDefinition_Recommendation_04_05_Order_Sign Title: Recommendations #4 and #5 - Lowest Effective Dose Status: active Experimental: false Type: system: http://terminology.hl7.org/CodeSystem/plan-definition-type code: eca-rule display: ECA Rule Date: 2025-08-06 Publisher: CDC / Security Risk Solutions, Inc. (SRS) Description: Recommendation 4: When opioids are initiated for opioid-naïve patients with acute, subacute, or chronic pain, clinicians should prescribe the lowest effective dosage. If opioids are continued for subacute or chronic pain, clinicians should use caution when prescribing opioids at any dosage, should carefully evaluate individual benefits and risks when considering increasing dosage, and should avoid increasing dosage above levels likely to yield diminishing returns in benefits relative to risks to patients. Recommendation 5: For patients already receiving opioid therapy, clinicians should carefully weigh benefits and risks and exercise care when changing opioid dosage. If benefits outweigh risks of continued opioid therapy, clinicians should work closely with patients to optimize nonopioid therapies while continuing opioid therapy. If benefits do not outweigh risks of continued opioid therapy, clinicians should optimize other therapies and work closely with patients to gradually taper to lower dosages or, if warranted based on the individual circumstances of the patient, appropriately taper and discontinue opioids. Unless there are indications of a life-threatening issue such as warning signs of impending overdose (e.g., confusion, sedation, or slurred speech), opioid therapy should not be discontinued abruptly, and clinicians should not rapidly reduce opioid dosages from higher dosages. Logic Definitions: Library Name Name sequence OpioidCDSREC04And05 Chronic P…
domain resource.contained: Library
  index: 0
  resource.id:
    value: effective-data-requirements
  library.name:
    value: EffectiveDataRequirements
  library.status:
    value: active
  library.type:
    codeable concept.coding:
      index: 0
      coding.system:
        value: http://terminology.hl7.org/CodeSystem/library-type
      coding.code:
        value: module-definition
  library.related artifact:
    index: 0
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Library Common
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSCommon|2022.1.0
      link: 2022.1
      link: .0
  library.related artifact:
    index: 1
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Library FHIRHelpers
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/Library/FHIRHelpers|4.0.1
      link: 4.0
      link: .1
  library.related artifact:
    index: 2
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Library Routines
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSRoutines|2022.1.0
      link: 2022.1
      link: .0
  library.related artifact:
    index: 3
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Library Config
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSCommonConfig|2022.1.0
      link: 2022.1
      link: .0
  library.related artifact:
    index: 4
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Library MMECalculator
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/Library/MMECalculator|3.0.0
      link: 3.0
      link: .0
  library.related artifact:
    index: 5
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Library OMTKLogic
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/Library/OMTKLogic|3.0.0
      link: 3.0
      link: .0
  library.related artifact:
    index: 6
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Library OMTKData
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/Library/OMTKData|3.0.0
      link: 3.0
      link: .0
  library.related artifact:
    index: 7
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Library ConversionFactors
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/Library/ConversionFactors|3.0.0
      link: 3.0
      link: .0
  library.related artifact:
    index: 8
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Library CDCMMEClinicalConversionFactors
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/Library/CDCMMEClinicalConversionFactors|3.0.0
      link: 3.0
      link: .0
  library.related artifact:
    index: 9
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Code system Usage Context Type
    related artifact.resource:
      value: http://terminology.hl7.org/CodeSystem/usage-context-type
      link: http://terminology.hl7.org/CodeSystem/usage-context-type
  library.related artifact:
    index: 10
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Code system CDC MME Usage Context Codes
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-mme-r4/CodeSystem/CDCMMEUsageContextCodes
      link: http://fhir.org/guides/cdc/opioid-mme-r4/CodeSystem/CDCMMEUsageContextCodes
  library.related artifact:
    index: 11
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Value set Opioid analgesics with ambulatory misuse potential
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/opioid-analgesics-with-ambulatory-misuse-potential
      link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/opioid-analgesics-with-ambulatory-misuse-potential
  library.related artifact:
    index: 12
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Value set Community
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/medicationrequest-category-community
      link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/medicationrequest-category-community
  library.related artifact:
    index: 13
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Value set Encounter Diagnosis Condition Category
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-encounter-diagnosis-category
      link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-encounter-diagnosis-category
  library.related artifact:
    index: 14
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Value set Problem List Condition Category
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-problem-list-category
      link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-problem-list-category
  library.related artifact:
    index: 15
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Value set US Core Health Concern Condition Category
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-us-core-health-concern-category
      link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-us-core-health-concern-category
  library.related artifact:
    index: 16
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Value set Sickle Cell Diseases
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/sickle-cell-diseases
      link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/sickle-cell-diseases
  library.related artifact:
    index: 17
    related artifact.type:
      value: depends-on
    related artifact.display:
      value: Value set Active Condition
    related artifact.resource:
      value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-clinical-status-active
      link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-clinical-status-active

index: 18
related artifact.type:
  value: depends-on
related artifact.display:
  value: Value set CDC malignant cancer conditions
related artifact.resource:
  value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/cdc-malignant-cancer-conditions
  link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/cdc-malignant-cancer-conditions

index: 19
related artifact.type:
  value: depends-on
related artifact.display:
  value: Value set Conditions likely terminal for opioid prescribing
related artifact.resource:
  value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/conditions-likely-terminal-for-opioid-prescribing
  link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/conditions-likely-terminal-for-opioid-prescribing

index: 20
related artifact.type:
  value: depends-on
related artifact.display:
  value: Value set Limited life expectancy conditions
related artifact.resource:
  value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/limited-life-expectancy-conditions
  link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/limited-life-expectancy-conditions

index: 21
related artifact.type:
  value: depends-on
related artifact.display:
  value: Value set Hospice Finding Codes
related artifact.resource:
  value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/hospice-finding
  link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/hospice-finding

index: 22
related artifact.type:
  value: depends-on
related artifact.display:
  value: Value set Hospice Disposition
related artifact.resource:
  value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/hospice-disposition
  link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/hospice-disposition

index: 0
parameter definition.name:
  value: ContextPrescriptions
parameter definition.use:
  value: in
parameter definition.min:
  value: 0
parameter definition.max:
  value: *
parameter definition.type:
  value: MedicationRequest

index: 1
parameter definition.name:
  value: ErrorLevel
parameter definition.use:
  value: in
parameter definition.min:
  value: 0
parameter definition.max:
  value: 1
parameter definition.type:
  value: string

index: 2
parameter definition.name:
  value: ConversionFactorSupplementName
parameter definition.use:
  value: in
parameter definition.min:
  value: 0
parameter definition.max:
  value: 1
parameter definition.type:
  value: string

index: 3
parameter definition.name:
  value: Is Recommendation Applicable?
parameter definition.use:
  value: out
parameter definition.min:
  value: 0
parameter definition.max:
  value: 1
parameter definition.type:
  value: boolean

index: 0
data requirement.type:
  value: Medication
data requirement.profile:
  value: http://hl7.org/fhir/StructureDefinition/Medication
  index: 0
  link: http://hl7.org/fhir/StructureDefinition/Medication
data requirement.must support:
  value: id
  index: 0
data requirement.must support:
  value: code
  index: 1

index: 1
data requirement.type:
  value: Patient
data requirement.profile:
  value: http://hl7.org/fhir/StructureDefinition/Patient
  index: 0
  link: http://hl7.org/fhir/StructureDefinition/Patient

index: 2
data requirement.type:
  value: Condition
data requirement.profile:
  value: http://hl7.org/fhir/StructureDefinition/Condition
  index: 0
  link: http://hl7.org/fhir/StructureDefinition/Condition
data requirement.must support:
  value: category
  index: 0
data requirement.must support:
  value: code
  index: 1
data requirement.must support:
  value: clinicalStatus
  index: 2
data requirement.code filter:
  index: 0
  data requirement.code filter.path:
    value: category
  data requirement.code filter.value set:
    value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-us-core-health-concern-category
    link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-us-core-health-concern-category

index: 3
data requirement.type:
  value: Condition
data requirement.profile:
  value: http://hl7.org/fhir/StructureDefinition/Condition
  index: 0
  link: http://hl7.org/fhir/StructureDefinition/Condition
data requirement.must support:
  value: category
  index: 0
data requirement.must support:
  value: code
  index: 1
data requirement.must support:
  value: clinicalStatus
  index: 2
data requirement.must support:
  value: encounter
  index: 3
data requirement.must support:
  value: encounter.reference
  index: 4
data requirement.code filter:
  index: 0
  data requirement.code filter.path:
    value: category
  data requirement.code filter.value set:
    value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-encounter-diagnosis-category
    link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-encounter-diagnosis-category

index: 4
data requirement.type:
  value: Condition
data requirement.profile:
  value: http://hl7.org/fhir/StructureDefinition/Condition
  index: 0
  link: http://hl7.org/fhir/StructureDefinition/Condition
data requirement.must support:
  value: category
  index: 0
data requirement.must support:
  value: code
  index: 1
data requirement.must support:
  value: clinicalStatus
  index: 2
data requirement.must support:
  value: clinicalStatus.coding
  index: 3
data requirement.code filter:
  index: 0
  data requirement.code filter.path:
    value: category
  data requirement.code filter.value set:
    value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-problem-list-category
    link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/condition-problem-list-category

index: 5
data requirement.type:
  value: Encounter
data requirement.profile:
  value: http://hl7.org/fhir/StructureDefinition/Encounter
  index: 0
  link: http://hl7.org/fhir/StructureDefinition/Encounter
data requirement.must support:
  value: period
  index: 0
data requirement.must support:
  value: period.start
  index: 1
data requirement.must support:
  value: id
  index: 2
data requirement.must support:
  value: hospitalization
  index: 3
data requirement.must support:
  value: hospitalization.dischargeDisposition
  index: 4
data requirement.must support:
  value: hospitalization.dischargeDisposition.coding
  index: 5
data requirement.must support:
  value: status
  index: 6
data requirement.must support:
  value: status.value
  index: 7

index: 6
data requirement.type:
  value: MedicationRequest
data requirement.profile:
  value: http://hl7.org/fhir/StructureDefinition/MedicationRequest
  index: 0
  link: http://hl7.org/fhir/StructureDefinition/MedicationRequest
data requirement.must support:
  value: authoredOn
  index: 0
data requirement.must support:
  value: medication
  index: 1
data requirement.must support:
  value: medication.reference
  index: 2
data requirement.must support:
  value: id
  index: 3
data requirement.must support:
  value: status
  index: 4
data requirement.must support:
  value: intent
  index: 5
data requirement.must support:
  value: category
  index: 6
data requirement.must support:
  value: subject
  index: 7
data requirement.must support:
  value: recorder
  index: 8
data requirement.must support:
  value: dosageInstruction
  index: 9
data requirement.must support:
  value: dispenseRequest
  index: 10
data requirement.must support:
  value: status.value
  index: 11
data requirement.must support:
  value: rxNormCode
  index: 12
data requirement.must support:
  value: dose
  index: 13
data requirement.must support:
  value: dosesPerDay
  index: 14
data requirement.must support:
  value: isDraft
  index: 15
data requirement.must support:
  value: isPRN
  index: 16
data requirement.must support:
  value: prescription
  index: 17
data requirement.must support:
  value: mme
  index: 18
data requirement.must support:
  value: mme.value
  index: 19

index: 7
data requirement.type:
  value: Observation
data requirement.profile:
  value: http://hl7.org/fhir/StructureDefinition/Observation
  index: 0
  link: http://hl7.org/fhir/StructureDefinition/Observation
data requirement.must support:
  value: code
  index: 0
data requirement.must support:
  value: status
  index: 1
data requirement.must support:
  value: status.value
  index: 2
data requirement.code filter:
  index: 0
  data requirement.code filter.path:
    value: code
  data requirement.code filter.value set:
    value: http://fhir.org/guides/cdc/opioid-cds/ValueSet/hospice-finding
    link: http://fhir.org/guides/cdc/opioid-cds/ValueSet/hospice-finding

index: 0
extension.url:
  value: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability
extension.value code:
  value: shareable

index: 1
extension.url:
  value: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability
extension.value code:
  value: computable

index: 2
extension.url:
  value: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability
extension.value code:
  value: executable

index: 3
extension.url:
  value: http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability
extension.value code:
  value: publishable

index: 4
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode
extension.value coding:
  coding.system:
    value: http://terminology.hl7.org/CodeSystem/usage-context-type
  coding.code:
    value: task

index: 5
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode
extension.value coding:
  coding.system:
    value: http://fhir.org/guides/cdc/opioid-mme-r4/CodeSystem/CDCMMEUsageContextCodes
  coding.code:
    value: mme-calculation

index: 6
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSREC04And05
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define "Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions": ( Common."Is Opioid Analgesic with Ambulatory Misuse Potential?"( ContextPrescriptions ) ) AmbulatoryOpioidPrescription where Routines."Is Subacute or Chronic Pain Prescription?"( AmbulatoryOpioidPrescription )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 0
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 7
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSREC04And05
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define "Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential": exists( "Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions" )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 1
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 8
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommonConfig
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Age Less than 18 Years Is Enabled
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: // CDC 2022 General Inclusion Criteria define "Age Less than 18 Years Is Enabled": true
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 2
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 9
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSRoutines
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Patient Age Less Than 18
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define "Patient Age Less Than 18": if (Config."Age Less than 18 Years Is Enabled") then AgeInYearsAt(Today()) < 18 else false
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 3
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 10
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommonConfig
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Sickle Cell Check Enabled
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: // Sickle Cell define "Sickle Cell Check Enabled": true
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 4
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 11
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommonConfig
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Sickle Cell Assumed Active
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define "Sickle Cell Assumed Active": true
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 5
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 12
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommon
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: US Core-Categorized Conditions
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: // 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"]
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 6
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 13
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommon
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Positive Sickle Cell Condition
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 7
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 14
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSRoutines
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Condition Positive for Sickle Cell
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define "Condition Positive for Sickle Cell": if (Config."Sickle Cell Check Enabled") then exists( Common."Positive Sickle Cell Condition" ) else false
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 8
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 15
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommonConfig
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Active Cancer Treatment Encounters Condition Is Enabled
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: // Active Cancer Treatment define "Active Cancer Treatment Encounters Condition Is Enabled": true
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 9
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 16
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSRoutines
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Encounter Period
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: // 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())
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 10
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 17
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommon
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: USCore Encounter Cancer Diagnoses
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define "USCore Encounter Cancer Diagnoses": [Condition: category in "Encounter Diagnosis Condition Category"] CancerDiagnoses where CancerDiagnoses.code in "CDC malignant cancer conditions"
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 11
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 18
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSRoutines
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Encounters with Cancer Diagnosis During Encounter Period
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: // 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) )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 12
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 19
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSRoutines
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Number of Encounters with Cancer Diagnosis During Encounter Period
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define "Number of Encounters with Cancer Diagnosis During Encounter Period": Count ("Encounters with Cancer Diagnosis During Encounter Period")
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 13
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 20
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSRoutines
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Has Two or More Encounters with Cancer Diagnosis During Encounter Period
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define "Has Two or More Encounters with Cancer Diagnosis During Encounter Period": "Number of Encounters with Cancer Diagnosis During Encounter Period" >= 2
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 14
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 21
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommon
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: USCore Problem List Cancer Diagnoses
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define "USCore Problem List Cancer Diagnoses": [Condition: category in "Problem List Condition Category"] CancerDiagnoses where CancerDiagnoses.code in "CDC malignant cancer conditions"
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 15
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 22
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSRoutines
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Has Active Cancer Diagnosis on Problem List
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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' ) )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 16
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 23
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSRoutines
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Is Active Cancer Treatment?
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 17
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 24
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommonConfig
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: End-Stage Disease Criteria Enabled
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: // CDC 2022 General Inclusion Criteria define "End-Stage Disease Criteria Enabled": true
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 18
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 25
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSRoutines
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Conditions Likely Terminal for Opioid Prescribing
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 19
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 26
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSRoutines
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: CDC 2022 Guideline General Inclusion Criteria
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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"
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 20
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 27
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OMTKData
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: DrugIngredients
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* This library contains drug ingredient data for opioid ingredients of combinations drugs as determined using the [RxNav](https://rxnav.nlm.nih.gov/) API. The content was produced using the process described [here](http://fhir.org/guides/cdc/opioid-cds/service-documentation.html#solution-component-1-medication-and-terminology-knowledge-base). This version of the content was generated on 2020-10-20 This product uses publicly available data courtesy of the U.S. National Library of Medicine (NLM), National Institutes of Health, Department of Health and Human Services; NLM is not responsible for the product and does not endorse or recommend this or any other product. Nelson SJ, Zeng K, Kilbourne J, Powell T, Moore R. Normalized names for clinical drugs: RxNorm at 6 years. J Am Med Inform Assoc. 2011 Jul-Aug;18(4)441-8. doi: 10.1136/amiajnl-2011-000116. Epub 2011 Apr 21. PubMed PMID: 21515544; PubMed Central PMCID: PMC3128404. [Full text](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3128404/) */ /* DrugIngredients: List<{ drugCode Integer, drugName String, doseFormCode Integer, doseFormName String, ingredientCode Integer, ingredientName String, strength String, strengthValue Decimal, strengthUnit String }> */ // Generated from LocalDataStore_RxNav_OpioidCds-2020-10-20.sqlite define DrugIngredients: { { drugCode: 197696, drugName: '72 HR fentanyl 0.075 MG/HR Transdermal System', doseFormCode: 316987, doseFormName: 'Transdermal System', ingredientCode: 4337, ingredientName: 'Fentanyl', strength: '0.075 MG/HR', strengthValue: 0.075, strengthUnit: 'MG/HR' }, { drugCode: 197873, drugName: 'levorphanol tartrate 2 MG Oral Tablet', doseFormCode: 317541, doseFormName: 'Oral Tablet', ingredientCode: 6378, ingredientName: 'Levorphanol', strength: '2 MG', strengthValue: 2.0, strengthUnit: 'MG' }, { drugCode: 205533, drugName: '1 ML buprenorphine 0.3 MG/ML Injection [Buprenex]', doseFormCode: 1649574, doseFormName: 'Injection', ingredientCode: 1819, ingredientName: 'Buprenorphine', …
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 21
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 28
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: CDCMMEClinicalConversionFactors
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: CDCMMEClinicalConversionFactorsCodeSystem
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define CDCMMEClinicalConversionFactorsCodeSystem: CodeSystem { name: string { value: 'CDCMMEClinicalConversionFactors' }, supplements: canonical { value: 'http://www.nlm.nih.gov/research/umls/rxnorm' }, concept: List<FHIR.CodeSystem.Concept> { FHIR.CodeSystem.Concept { code: code { value: '2670' }, display: string { value: 'Codeine' }, property: List<FHIR.CodeSystem."Concept"."Property"> { FHIR.CodeSystem."Concept"."Property" { code: code { value: 'conversion-factor' }, value: decimal { value: 0.15 } } } }, FHIR.CodeSystem.Concept { code: code { value: '4337' }, display: string { value: 'Fentanyl' }, property: List<FHIR.CodeSystem."Concept"."Property"> { FHIR.CodeSystem."Concept"."Property" { code: code { value: 'dose-form-conversion-factor' }, value: string { value: '316987:7200@0.33333333' } } } }, FHIR.CodeSystem.Concept { code: code { value: '3423' }, display: string { value: 'Hydromorphone' }, property: List<FHIR.CodeSystem."Concept"."Property"> { FHIR.CodeSystem."Concept"."Property" { code: code { value: 'conversion-factor' }, value: decimal { value: 4 } } } }, FHIR.CodeSystem.Concept { code: code { value: '5489' }, display: string { value: 'Hydrocodone' }, property: List<FHIR.CodeSystem."Concept"."Property"> { FHIR.CodeSystem."Concept"."Property" { code: code { value: 'conversion-factor' }, value: decimal { value: 1 } } } }, FHIR.CodeSystem.Concept { code: code { value: '6813' }, display: string { value: 'Methadone' }, property: List<FHIR.CodeSystem."Concept"."Property"> { FHIR.CodeSystem."Concept"."Property" { code: code { value: 'dose-range-conversion-factor' }, value: string { value: '1-20:4' } }, FHIR.CodeSystem."Concept"."Property" { code: code { value: 'dose-range-conversion-factor' }, value: string { value: '21-40:8' } }, FHIR.CodeSystem."Concept"."Property" { code: code { value: 'dose-range-conversion-factor' }, value: string { value: '41-60:10' } }, FHIR.CodeSystem."Concept"."Property" { code: code { value: 'dose-range-conversion-factor' }, value: st…
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 22
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 29
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: ConversionFactors
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ConversionFactorSupplement
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* The use of the CDCMMEClinicalConversionFactors is a workaround for the fact that we can't retrieve the formally defined CodeSystem resource (https://fhir.org/guides/cdc/opioid-mme-r4/CodeSystem-CDCMMEClinicalConversionFactors.html) from the FHIR server */ define ConversionFactorSupplement: CDCMMEClinicalConversionFactors."CDCMMEClinicalConversionFactorsCodeSystem" C where C.supplements.value = 'http://www.nlm.nih.gov/research/umls/rxnorm' and ( C.name.value = ConversionFactorSupplementName or exists ( C.useContext UC where UC.code ~ "Task Usage Context" and UC.value ~ "MME Calculation" ) )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 23
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 30
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommonConfig
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Can the implementing EHR support queries for past medications by date range?
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: // Subroutine 2 - Past Medications define "Can the implementing EHR support queries for past medications by date range?": true
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 24
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 31
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommon
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Active Ambulatory Opioid Rx
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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>{}
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 25
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 32
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSREC04And05
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Total MME
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define "Total MME": MMECalculator.TotalMME( ( "Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions" union Common."Active Ambulatory Opioid Rx" ) AmbulatoryOpioidPrescription where Routines."Is Subacute or Chronic Pain Prescription?"( AmbulatoryOpioidPrescription ) )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 26
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 33
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSREC04And05
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Inclusion Criteria
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define "Inclusion Criteria": "Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential" and Routines."CDC 2022 Guideline General Inclusion Criteria" and "Total MME" >= 50 '{MME}/d'
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 27
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 34
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommon
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Conditions Indicating End of Life or With Limited Life Expectancy
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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" )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 28
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 35
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommonConfig
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Hospice Findings Exclusion Enabled
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: // OpioidCDSCommon define "Hospice Findings Exclusion Enabled": false
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 29
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 36
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommon
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Admitted/Referred/Discharged to Hospice Care
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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' } )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 30
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 37
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommon
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: End of Life Assessment
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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" )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 31
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 38
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSREC04And05
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Exclusion Criteria
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define "Exclusion Criteria": Common."End of Life Assessment"
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 32
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 39
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSREC04And05
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Is Recommendation Applicable?
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define "Is Recommendation Applicable?": "Inclusion Criteria" and not "Exclusion Criteria"
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 33
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 40
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommon
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Is Opioid Analgesic with Ambulatory Misuse Potential?
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define function "Is Opioid Analgesic with Ambulatory Misuse Potential?"(value List<MedicationRequest>): ("Get MedicationRequest Medication as Code"(value)) Rx where Rx.medication in "Opioid analgesics with ambulatory misuse potential" and Rx.category in "Community"
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 34
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 41
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommon
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Get MedicationRequest Medication as Code
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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 }
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 35
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 42
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: FHIRHelpers
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToString
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define function ToString(value string): value.value
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 36
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 43
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: FHIRHelpers
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToConcept
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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 }
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 37
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 44
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: FHIRHelpers
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToCode
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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 }
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 38
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 45
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSRoutines
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Is Subacute or Chronic Pain Prescription?
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: // 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)
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 39
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 46
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSRoutines
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Is Subacute or Chronic Pain Using Expected Supply Duration
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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 ) )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 40
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 47
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommon
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: GetDurationInDays
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 41
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 48
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSRoutines
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Is Subacute or Chronic Pain Using Validity Period
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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 ) )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 42
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 49
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: FHIRHelpers
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToDateTime
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define function ToDateTime(value dateTime): value.value
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 43
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 50
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: MMECalculator
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: TotalMME
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Calculates total Morphine Milligram Equivalent (MME) for the given list of medications. The calculation assumes the most aggressive dosing, and is performed for all medications in the given list (i.e. no additional filtering for status is performed). */ define function TotalMME(prescriptions List<MedicationRequest>): OMTKLogic.Quantity( Sum((MME(prescriptions)) M return M.mme.value), '{MME}/d' )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 44
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 51
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OMTKLogic
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Quantity
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define function Quantity(value Decimal, unit String): if value is not null then Quantity { value: value, unit: unit } else null
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 45
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 52
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: MMECalculator
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: MME
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Calculates Morphine Milligram Equivalent (MME) for each medication in the given list. The calculation assumes the most aggresive dosing, and is performed for all medications in the given list (i.e. no additional filtering for status is performed). */ define function MME(prescriptions List<MedicationRequest>): (Prescriptions(prescriptions)) P let mmePerIngredient: OMTKLogic.CalculateMMEs({ { rxNormCode: P.rxNormCode, doseQuantity: P.dose, dosesPerDay: P.dosesPerDay } }) return { rxNormCode: P.rxNormCode, isDraft: P.isDraft, isPRN: P.isPRN, prescription: P.prescription, dailyDose: Combine(mmePerIngredient X return X.dailyDoseDescription, '\r\n'), mme: Sum(mmePerIngredient X return X.mme) }
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 46
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 53
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: MMECalculator
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Prescriptions
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Extracts the relevant information for prescription calculation from a list of FHIR MedicationRequest resources. This assumes a MedicationRequest that conforms to the MMEMedicationRequest profile, specifically: * 1 and only 1 dosageInstruction * 1 and only 1 doseAndRate * 1 timing with 1 repeat * frequency, frequencyMax, defaulting to 1 * period, periodUnit, defaulting to 1 'd' * doseQuantity or doseRange * timeOfDay Note that if timeOfDay is specified in addition to frequency and period, it is ignored (i.e. assumed to be consistent with the specified frequency and period). TimeOfDay is only used to determine timesPerDay if frequency and period are not specified. */ define function Prescriptions(Orders List<MedicationRequest>): Orders O let rxNormCode: OMTKLogic.GetMedicationCode(O.medication), medicationName: OMTKLogic.GetMedicationName(rxNormCode), // NOTE: Assuming a single dosage instruction element dosageInstruction: singleton from O.dosageInstruction, // NOTE: Some systems return multiple doseAndRate entries, with system-specific codes for the types. In those cases, // this logic should select the most appropriate dose and rate, but standardization on doseAndRate type codes is // needed to make this logic shareable doseAndRate: singleton from (dosageInstruction.doseAndRate DR where DR.type is null or DR.type.text = 'ordered'), repeat: dosageInstruction.timing.repeat, frequency: Coalesce(repeat.frequencyMax.value, repeat.frequency.value), period: OMTKLogic.Quantity(repeat.period.value, repeat.periodUnit.value), doseRange: ToFHIRRange(doseAndRate.dose), doseQuantity: ToFHIRQuantity(doseAndRate.dose), doseHigh: ToQuantity(doseRange.high as FHIR.SimpleQuantity), timesPerDay: Count(repeat.timeOfDay), doseDescription: Coalesce( ToString(ToQuantity(doseQuantity)), ToString(doseRange.low.value.value) + '-' + ToString(doseRange.high.value.value) + ' ' + doseRange.high.unit.value ), frequencyDescription: ToString(dosageInstruction.timing.repeat.frequency.value) + Coal…
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 47
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 54
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OMTKLogic
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: GetMedicationCode
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Returns the first RxNorm code in the given concept that matches a drug code specified in OMTKData. */ define function GetMedicationCode(concept Concept): First( ((concept.codes) C where C.system = 'http://www.nlm.nih.gov/research/umls/rxnorm' return singleton from ( OMTKData.DrugIngredients DI where DI.drugCode = ToInteger(C.code) return Code { code: ToString(DI.drugCode), system: 'http://www.nlm.nih.gov/research/umls/rxnorm', display: DI.drugName } ) ) X where X is not null )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 48
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 55
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OMTKLogic
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: GetMedicationName
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Returns the display of the given code, if present, otherwise looks it up from the OMTK data */ define function GetMedicationName(rxNormCode Code): if rxNormCode.display is null then singleton from ( OMTKData.DrugIngredients DI where DI.drugCode = ToInteger(rxNormCode.code) return DI.drugName ) else rxNormCode.display
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 49
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 56
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: MMECalculator
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToFHIRRange
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Helper function to force the choice of the FHIR.Range value. This avoids the need for the _is_ and _as_ operators on choices, which is not implemented in the JavaScript CQL engine. */ define function ToFHIRRange(range FHIR.Range): range
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 50
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 57
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: MMECalculator
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToFHIRQuantity
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Helper function to force the choice of the FHIR.SimpleQuantity value. This avoids the need for the _is_ and _as_ operators on choices, which is not implemented in the JavaScript CQL engine. */ define function ToFHIRQuantity(quantity FHIR.SimpleQuantity): quantity
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 51
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 58
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: MMECalculator
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToQuantity
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* FHIRHelpers ToQuantity logic incorrectly uses the unit element of the FHIR Quantity, when it should be using the code element as the actual coded unit. https://github.com/cqframework/clinical_quality_language/issues/557 Until the above issue is addressed, this function provides ToQuantity functionality for this library */ define function ToQuantity(quantity FHIR.SimpleQuantity): case when quantity is null then null when quantity.value is null then null when quantity.system is null or quantity.system = 'http://unitsofmeasure.org' then System.Quantity { value: quantity.value.value, unit: quantity.code.value } when quantity.system.value = 'http://terminology.hl7.org/CodeSystem/v3-orderableDrugForm' then System.Quantity { value: quantity.value.value, unit: Coalesce(quantity.code.value, quantity.unit.value)} else Message(null, true, 'MMECalculator.ToQuantity.InvalidFHIRQuantity', ErrorLevel, 'Invalid FHIR Quantity code: ' & quantity.code.value) end
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 52
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 59
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: FHIRHelpers
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToString
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define function ToString(value uri): value.value
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 53
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 60
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: FHIRHelpers
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToBoolean
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: define function ToBoolean(value boolean): value.value
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 54
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 61
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OMTKLogic
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToDaily
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Calculates daily frequency given frequency within a period */ define function ToDaily(frequency Integer, period Quantity): case period.unit when 'h' then frequency * (24.0 / period.value) when 'min' then frequency * (24.0 / period.value) * 60 when 's' then frequency * (24.0 / period.value) * 60 * 60 when 'd' then frequency * (24.0 / period.value) / 24 when 'wk' then frequency * (24.0 / period.value) / (24 * 7) when 'mo' then frequency * (24.0 / period.value) / (24 * 30) /* assuming 30 days in month */ when 'a' then frequency * (24.0 / period.value) / (24 * 365) /* assuming 365 days in year */ when 'hour' then frequency * (24.0 / period.value) when 'minute' then frequency * (24.0 / period.value) * 60 when 'second' then frequency * (24.0 / period.value) * 60 * 60 when 'day' then frequency * (24.0 / period.value) / 24 when 'week' then frequency * (24.0 / period.value) / (24 * 7) when 'month' then frequency * (24.0 / period.value) / (24 * 30) /* assuming 30 days in month */ when 'year' then frequency * (24.0 / period.value) / (24 * 365) /* assuming 365 days in year */ when 'hours' then frequency * (24.0 / period.value) when 'minutes' then frequency * (24.0 / period.value) * 60 when 'seconds' then frequency * (24.0 / period.value) * 60 * 60 when 'days' then frequency * (24.0 / period.value) / 24 when 'weeks' then frequency * (24.0 / period.value) / (24 * 7) when 'months' then frequency * (24.0 / period.value) / (24 * 30) /* assuming 30 days in month */ when 'years' then frequency * (24.0 / period.value) / (24 * 365) /* assuming 365 days in year */ else Message(null, true, 'OMTKLogic.ToDaily.UnknownUnit', ErrorLevel, 'Unknown unit ' & period.unit) end
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 55
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 62
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OMTKLogic
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: CalculateMMEs
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Calculates MMEs for the given input prescription information and returns it as a list of tuples: List<Tuple { rxNormCode Code, doseFormCode Code, doseQuantity Quantity, dosesPerDay Decimal, ingredientCode Code, strength Quantity, dailyDose Quantity, dailyDoseDescription String, conversionFactor Decimal, mme Quantity }> */ define function CalculateMMEs(medications List<Tuple { rxNormCode Code, doseQuantity Quantity, dosesPerDay Decimal }>): Flatten( medications M let Ingredients: GetIngredients(M.rxNormCode) return Ingredients I let adjustedDoseQuantity: M.doseQuantity, dailyDose: GetDailyDose(I.ingredientCode, I.strength, I.doseFormCode, adjustedDoseQuantity, M.dosesPerDay), factor: ConversionFactors.GetConversionFactor(I.ingredientCode, dailyDose.result, I.doseFormCode, M.dosesPerDay) return { rxNormCode: M.rxNormCode, doseFormCode: I.doseFormCode, doseQuantity: adjustedDoseQuantity, dosesPerDay: M.dosesPerDay, ingredientCode: I.ingredientCode, strength: I.strength, dailyDose: dailyDose.result, dailyDoseDescription: dailyDose.description & (' * factor: ' + Coalesce(ToString(factor), 'No conversion factor available')), conversionFactor: factor, mme: Quantity( Round(dailyDose.result.value * factor, 1), '{MME}/d' ) } )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 56
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 63
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OMTKLogic
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: GetIngredients
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Returns the opioid ingredients and their strengths that make up the drug identified by the given rxNormCode as a list of tuples: List<Tuple { rxNormCode Code, doseFormCode Code, doseFormName String, ingredientCode Code, ingredientName String, strength Quantity }> */ /* GetIngredients: List<{ rxNormCode Code, doseFormCode Code, ingredientCode code, strength Quantity }> */ define function GetIngredients(rxNormCode Code): OMTKData.DrugIngredients DI where DI.drugCode = ToInteger(rxNormCode.code) return { rxNormCode: Code { code: ToString(DI.drugCode), system: 'http://www.nlm.nih.gov/research/umls/rxnorm', display: DI.drugName }, doseFormCode: Code { code: ToString(DI.doseFormCode), system: 'http://www.nlm.nih.gov/research/umls/rxnorm', display: DI.doseFormName }, ingredientCode: Code { code: ToString(DI.ingredientCode), system: 'http://www.nlm.nih.gov/research/umls/rxnorm', display: DI.ingredientName }, strength: Quantity { value: DI.strengthValue, unit: ToUCUM(DI.strengthUnit) } }
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 57
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 64
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OMTKLogic
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToUCUM
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Normalizes the input units to UCUM units The values listed here are the only ones currently present in the OMTK data Based on the HL7 UCUM subset here: http://download.hl7.de/documents/ucum/ucumdata.html */ define function ToUCUM(unit String): case unit when 'MG' then 'mg' when 'MG/ACTUAT' then 'mg/{actuat}' when 'MG/HR' then 'mg/h' when 'MG/ML' then 'mg/mL' else Message(null, true, 'OMTKLogic.ToUCUM.UnknownUnit', ErrorLevel, 'Unknown unit ' & unit) end
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 58
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 65
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OMTKLogic
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: GetDailyDose
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* define function StripPer(unit String): if LastPositionOf('/', unit) >= 0 then Substring(unit, 0, LastPositionOf('/', unit)) else unit */ /* Calculates daily dose for a specific ingredient based on the ingredient strength, dose form, dose quantity, and daily frequency. In addition, returns a textual description of the daily dose. Tuple { result: Quantity, description: String } */ define function GetDailyDose(ingredientCode Code, strength Quantity, doseFormCode Code, doseQuantity Quantity, dosesPerDay Decimal): case when dosesPerDay is null or doseQuantity is null or strength is null or strength.value is null or strength.unit is null then { result: null as Quantity, description: 'Missing doses per day, dose quantity, and/or strength' } /* if patch --> daily dose = dose value (e.g, number patches with doseQuantity unit = "patch") * per-hour strength */ when ToInteger(doseFormCode.code) = 316987 then /* buprenorphine or fentanyl patch */ if ToInteger(ingredientCode.code) in { 1819, 4337 } then (Quantity { value: dosesPerDay * doseQuantity.value * strength.value, unit: strength.unit }) dailyDose return { result: dailyDose, description: GetIngredientName(ingredientCode) & ' patch: ' & ToString(doseQuantity.value) & ' * ' & ToString(dosesPerDay) & '/d * ' & ToString(strength) & ' = ' + ToString(dailyDose) } else { result: null as Quantity, description: 'Unknown patch ingredient: ' & ingredientCode.code & ':' & ingredientCode.display } /* if dose unit in actual mass units (mg or ug -- when it's a single med) --> daily dose = numTimesPerDay * dose */ when doseQuantity.unit in { 'mg', 'ug' } then (Quantity { value: dosesPerDay * doseQuantity.value, unit: doseQuantity.unit }) dailyDose return { result: dailyDose, description: GetIngredientName(ingredientCode) + ' ' + GetDoseFormName(doseFormCode) + ': ' + ToString(dosesPerDay) + '/d * ' + ToString(doseQuantity) + ' = ' + ToString(dailyDose) } /* if doseQuantity is in actual volume units (mL) --> daily dose = numTimesPerDay …
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 59
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 66
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OMTKLogic
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: GetIngredientName
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Returns the display of the given ingredient, if present, otherwise looks it up from the OMTK data */ define function GetIngredientName(ingredientCode Code): if ingredientCode.display is null then singleton from ( OMTKData.DrugIngredients DI where DI.ingredientCode = ToInteger(ingredientCode.code) return DI.ingredientName ) else ingredientCode.display
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 60
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 67
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OMTKLogic
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: GetDoseFormName
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Returns the display of the given dose form, if present, otherwise looks it up from the OMTK data */ define function GetDoseFormName(doseFormCode Code): if doseFormCode.display is null then singleton from ( OMTKData.DrugIngredients DI where DI.doseFormCode = ToInteger(doseFormCode.code) return DI.doseFormName ) else doseFormCode.display
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 61
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 68
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OMTKLogic
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: StripPer
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Removes the last per argument from a unit NOTE: Rewrote to not use LastPositionOf, since that function is not implemented in the JS engine https://github.com/cqframework/cql-execution/issues/147 */ define function StripPer(unit String): unit X let split: Split(unit, '/'), splitCount: Count(split) return if splitCount > 1 then Substring(unit, 0, Length(unit) - Length(split[splitCount - 1]) - 1) else unit
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 62
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 69
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: ConversionFactors
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: GetConversionFactor
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Returns the conversion factor for the given ingredient CDC Guidance: https://www.cdc.gov/drugoverdose/pdf/calculating_total_daily_dose-a.pdf |Opioid (strength in mg except where noted) |MME Conversion Factor*| |-----------------------------------------------|----------------------| |Codeine | 0.15 | |Fentanyl, transdermal patch (MCG/HR) | 2.4 | |Hydrocodone | 1 | |Hydromorphone | 4 | |Methadone | | | 1-20 mg/d | 4 | | 21-40 mg/d | 8 | | 41-60 mg/d | 10 | | 61-80+ mg/d | 12 | | Morphine | 1 | | Oxycodone | 1.5 | | Oxymorphone | 3 | */ define function GetConversionFactor(ingredientCode System.Code, dailyDose System.Quantity, doseFormCode System.Code, dosesPerDay System.Decimal): Coalesce( LookupConversionFactor(ingredientCode, dailyDose, doseFormCode, dosesPerDay), case ToInteger(ingredientCode.code) when 2670 then 0.15 /* Codeine */ when 4337 then ( /* Fentanyl */ case when ToInteger(doseFormCode.code) = 316987 then (0.33333333 / dosesPerDay) * 7200 /* Transdermal system */ else Message(null, true, 'OMTKLogic.GetConversionFactor.UnknownDoseForm', ErrorLevel, 'Unknown dose form code ' & doseFormCode.code) end ) when 5489 then 1 /* Hydrocodone */ when 3423 then 4 /* Hydromorphone */ when 6813 then ( /* Methadone */ case when dailyDose.value between 1 and 20 then 4 when dailyDose.value between 21 and 40 then 8 when dailyDose.value between 41 and 60 then 10 when dailyDose.value >= 61 then 12 when dailyDose is null or dailyDose.value is null then Message(null, true, 'OMTKLogic.GetConversionFactor.DailyDoseNull', ErrorLevel, 'Daily dose is required to determine methadone conversion factor') else Message(null, dailyDose.value < 1, 'OMTKLogic.GetConversionFactor.DailyDoseLessThanOne', ErrorLevel, 'Daily dose less than 1') end ) when 7052 then 1 /* Morphine */ when 7804 then 1.5 /* Oxycodone */ when 7814 then 3 /* Oxymorphone */ else Message(null, true, 'OMTKLogic.GetConversionFactor.UnknownIngredientCode', ErrorLevel, 'Unknown ingredient code: ' & ingredientCode.code) end…
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 63
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 70
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: ConversionFactors
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: LookupConversionFactor
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Looks up the conversion factor for the given ingredient, daily dose, and dose form from the configured conversion factor supplement, if available. If no conversion factor supplement is configured, returns null */ define function LookupConversionFactor(ingredientCode System.Code, dailyDose System.Quantity, doseFormCode System.Code, dosesPerDay System.Decimal): ConversionFactorSupplement CFS let ingredientConcept: singleton from (CFS."concept" C where C.code.value = ingredientCode.code), conversionFactor: singleton from (ingredientConcept.property P where P.code.value = 'conversion-factor'), doseFormConversionFactors: (ingredientConcept.property P where P.code.value = 'dose-form-conversion-factor'), doseRangeConversionFactors: (ingredientConcept.property P where P.code.value = 'dose-range-conversion-factor') return Coalesce ( case when exists (doseRangeConversionFactors) then singleton from ( doseRangeConversionFactors DRCF where dailyDose.value in ToDoseRange(DRCF.value) return ToDoseRangeConversionFactor(DRCF.value) ) when exists (doseFormConversionFactors) then singleton from ( doseFormConversionFactors DFCF where doseFormCode.code = ToDoseForm(DFCF.value) return ToDoseFormConversionFactor(DFCF.value, dosesPerDay) ) else null end, ToConversionFactor(conversionFactor.value) )
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 64
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 71
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: ConversionFactors
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToDoseRange
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Converts the property value of a dose-range-conversion-factor property to the dose range <low-value>-<high-value>:<conversion-factor> Note that low-value and/or high-value may be wildcards '*' */ define function ToDoseRange(propertyValue FHIR.string): ({ : }) X let rangeValues: Split(Split(propertyValue.value, ':')[0], '-') return Interval[ToRangeValue(rangeValues[0]), ToRangeValue(rangeValues[1])]
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 65
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 72
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: ConversionFactors
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToRangeValue
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Converts a range value boundary to a Decimal (or null for a wildcard) */ define function ToRangeValue(value System.String): if value = '*' then null else ToDecimal(value)
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 66
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 73
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: ConversionFactors
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToDoseRangeConversionFactor
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Converts the property value of a dose-range-conversion-factor property to the conversion factor <low-value>-<high-value>:<conversion-factor> */ define function ToDoseRangeConversionFactor(propertyValue FHIR.string): ToDecimal(Split(propertyValue.value, ':')[1])
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 67
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 74
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: ConversionFactors
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToDoseForm
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Converts the property value of a dose-form-conversion-factor property to the dose form <dose-form-code>:<conversion-factor> */ define function ToDoseForm(propertyValue FHIR.string): Split(propertyValue.value, ':')[0]
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 68
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 75
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: ConversionFactors
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToDoseFormConversionFactor
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Converts the property value of a dose-form-conversion-factor property to the conversion factor <dose-form-code>:<conversion-factor>[@doses-per-day] */ define function ToDoseFormConversionFactor(propertyValue FHIR.string, dosesPerDay System.Decimal): if PositionOf('@', propertyValue.value) > 0 then ToDoseFormDosesPerDayConversionFactor(propertyValue, dosesPerDay) else ToDecimal(Split(propertyValue.value, ':')[1])
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 69
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 76
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: ConversionFactors
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToDoseFormDosesPerDayConversionFactor
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Converts the property value of a dose-form-conversion-factor property to the conversion factor if the property includes a doses-per-day value */ define function ToDoseFormDosesPerDayConversionFactor(propertyValue FHIR.string, dosesPerDay System.Decimal): propertyValue P let components: Split(P.value, '@') return (ToDecimal(components[1]) / dosesPerDay) * ToDecimal(Split(components[0], ':')[1])
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 70
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 77
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: ConversionFactors
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: ToConversionFactor
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: /* Returns the conversion factor for a conversion-factor property NOTE: These functions are used to avoid use of _is_ and _as_ */ define function ToConversionFactor(propertyValue FHIR.decimal): propertyValue.value
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 71
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 78
element.extension:
  index: 0
  extension.url:
    value: libraryName
  extension.value string:
    value: OpioidCDSCommon
element.extension:
  index: 1
  extension.url:
    value: name
  extension.value string:
    value: Get Active Ambulatory Medication Requests
element.extension:
  index: 2
  extension.url:
    value: statement
  extension.value string:
    value: 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"
element.extension:
  index: 3
  extension.url:
    value: displaySequence
  extension.value integer:
    value: 72
extension.url:
  value: http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition

index: 79
element.id:
  value: effective-data-requirements
extension.url:
  value: http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-effectiveDataRequirements
extension.value canonical:
  value: #effective-data-requirements

index: 80
extension.url:
  value: http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-softwaresystem
extension.value reference:
  link: http://fhir.org/guides/cdc/opioid-cds/Device/cqf-tooling
  reference.reference:
    value: Device/cqf-tooling

index: 0
identifier.use:
  value: official
identifier.value:
  value: cdc-opioid-guidance

index: 1
identifier.system:
  value: urn:ietf:rfc:3986
identifier.value:
  value: urn:oid:2.16.840.1.114222.34.4

value: 2022.1.0

value: PlanDefinition_Recommendation_04_05_Order_Sign

value: Recommendations #4 and #5 - Lowest Effective Dose

codeable concept.coding:
  index: 0
  coding.system:
    value: http://terminology.hl7.org/CodeSystem/plan-definition-type
  coding.code:
    value: eca-rule
  coding.display:
    value: ECA Rule

value: active

value: false

value: 2025-08-06

value: CDC / Security Risk Solutions, Inc. (SRS)

index: 0
contact detail.telecom:
  index: 0
  contact point.system:
    value: url
  contact point.value:
    value: https://www.securityrisksolutions.com

value: Recommendation 4: When opioids are initiated for opioid-naïve patients with acute, subacute, or chronic pain, clinicians should prescribe the lowest effective dosage. If opioids are continued for subacute or chronic pain, clinicians should use caution when prescribing opioids at any dosage, should carefully evaluate individual benefits and risks when considering increasing dosage, and should avoid increasing dosage above levels likely to yield diminishing returns in benefits relative to risks to patients. Recommendation 5: For patients already receiving opioid therapy, clinicians should carefully weigh benefits and risks and exercise care when changing opioid dosage. If benefits outweigh risks of continued opioid therapy, clinicians should work closely with patients to optimize nonopioid therapies while continuing opioid therapy. If benefits do not outweigh risks of continued opioid therapy, clinicians should optimize other therapies and work closely with patients to gradually taper to lower dosages or, if warranted based on the individual circumstances of the patient, appropriately taper and discontinue opioids. Unless there are indications of a life-threatening issue such as warning signs of impending overdose (e.g., confusion, sedation, or slurred speech), opioid therapy should not be discontinued abruptly, and clinicians should not rapidly reduce opioid dosages from higher dosages.

index: 0
usage context.code:
  coding.system:
    value: http://terminology.hl7.org/CodeSystem/usage-context-type
  coding.code:
    value: focus
  coding.display:
    value: Clinical Focus
usage context.value codeable concept:
  codeable concept.coding: http://snomed.info/id/182888003
    index: 0
    coding.system:
      value: http://snomed.info/sct
    coding.code:
      value: 182888003
    coding.display:
      value: Medication requested (situation)

index: 1
usage context.code:
  coding.system:
    value: http://terminology.hl7.org/CodeSystem/usage-context-type
  coding.code:
    value: focus
  coding.display:
    value: Clinical Focus
usage context.value codeable concept:
  codeable concept.coding: http://snomed.info/id/82423001
    index: 0
    coding.system:
      value: http://snomed.info/sct
    coding.code:
      value: 82423001
    coding.display:
      value: Chronic pain (finding)

index: 2
usage context.code:
  coding.system:
    value: http://terminology.hl7.org/CodeSystem/usage-context-type
  coding.code:
    value: focus
  coding.display:
    value: Clinical Focus
usage context.value codeable concept:
  codeable concept.coding: http://snomed.info/id/274663001
    index: 0
    coding.system:
      value: http://snomed.info/sct
    coding.code:
      value: 274663001
    coding.display:
      value: Acute pain (finding)

index: 3
usage context.code:
  coding.system:
    value: http://terminology.hl7.org/CodeSystem/usage-context-type
  coding.code:
    value: focus
  coding.display:
    value: Clinical Focus
usage context.value codeable concept:
  codeable concept.text:
    value: Subacute pain

value: 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.

value: The recommendations related to opioid dosages are not intended to be used as an inflexible, rigid standard of care; rather, they are intended to be guideposts to help inform clinician-patient decision-making. Risks of opioid use, including risk for overdose and overdose death, increase continuously with dosage, and there is no single dosage threshold below which risks are eliminated. Therefore, the recommendation language emphasizes that clinicians should avoid increasing dosage above levels likely to yield diminishing returns in benefits relative to risks to patients rather than emphasizing a single specific numeric threshold. Further, these recommendations apply specifically to starting opioids or to increasing opioid dosages, and a different set of benefits and risks applies to reducing opioid dosages.

value: © CDC 2016+.

index: 0
codeable concept.text:
  value: Opioid Prescribing

index: 0
contact detail.name:
  value: Kensaku Kawamoto, MD, PhD, MHS

index: 1
contact detail.name:
  value: Bryn Rhodes

index: 2
contact detail.name:
  value: Floyd Eisenberg, MD, MPH

index: 3
contact detail.name:
  value: Robert McClure, MD, MPH

index: 0
related artifact.type:
  value: documentation
related artifact.display:
  value: 2022 CDC Clinical Practice Guideline for Prescribing Opioids for Pain
related artifact.url:
  value: https://www.cdc.gov/mmwr/volumes/71/rr/rr7103a1.htm
related artifact.document:
  attachment.url:
    value: https://www.cdc.gov/mmwr/volumes/71/rr/rr7103a1.htm

value: http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSREC04And05
index: 0
link: http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSREC04And05

index: 0
element.extension:
  index: 0
  extension.url:
    value: http://hl7.org/fhir/StructureDefinition/cqf-strengthOfRecommendation
  extension.value codeable concept:
    codeable concept.coding:
      index: 0
      element.id:
        value: recommendation-4-strength-of-recommendation
      coding.system:
        value: http://terminology.hl7.org/CodeSystem/recommendation-strength
      coding.code:
        value: strong
      coding.display:
        value: Strong
    codeable concept.coding:
      index: 1
      element.id:
        value: recommendation-5-strength-of-recommendation
      coding.system:
        value: http://terminology.hl7.org/CodeSystem/recommendation-strength
      coding.code:
        value: weak
      coding.display:
        value: Weak
element.extension:
  index: 1
  extension.url:
    value: http://hl7.org/fhir/StructureDefinition/cqf-qualityOfEvidence
  extension.value codeable concept:
    codeable concept.coding:
      index: 0
      element.id:
        value: recommendation-4-evidence-quality
      coding.system:
        value: http://terminology.hl7.org/CodeSystem/evidence-quality
      coding.code:
        value: low
      coding.display:
        value: Low quality
    codeable concept.coding:
      index: 1
      element.id:
        value: recommendation-5-evidence-quality
      coding.system:
        value: http://terminology.hl7.org/CodeSystem/evidence-quality
      coding.code:
        value: very-low
      coding.display:
        value: Very low quality
plan definition.action.title:
  value: Calibrate to Lowest Opioid Dose Needed for Expected Results and Exercise Care When Changing Opioid Dosages
plan definition.action.description:
  value: When opioid therapy is considered appropriate, calibrate opioid dosages to lowest dose needed to achieve expected effects. For patients already receiving opioid therapy, clinicians should carefully weigh benefits and risks and exercise care when changing opioid dosage. [For guidance in determining the lowest effective opioid dosage, see Recommendation 4 of the 2022 CDC Clinical Practice Guideline](https://www.cdc.gov/mmwr/volumes/71/rr/rr7103a1.htm#Recommendation4) [For patients who have received opioid therapy for longer durations of time, if tapering, consider working closely with the patient to gradually taper dosages (no more than 10% per month)](https://www.cdc.gov/mmwr/volumes/71/rr/rr7103a1.htm#:~:text=When%20patients%20have%20been%20taking%20opioids%20for%20longer%20durations%20(e.g.%2C%20for%20%E2%89%A51%20year)%2C%20tapers%20of%2010%25%20per%20month%20or%20slower%20are%20likely%20to%20be%20better%20tolerated%20than%20more%20rapid%20tapers.) For a tapering calculator, go to [https://agencymeddirectors.wa.gov/Calculator/TaperDoseCalculator.html](https://www.agencymeddirectors.wa.gov/Calculator/TaperDoseCalculator.html) [For more guidance regarding tapering, please see Recommendation 5 of the 2022 CDC Clinical Practice Guideline for Prescribing Opioids for Pain](https://www.cdc.gov/mmwr/volumes/71/rr/rr7103a1.htm#Recommendation5).) **MME Calculator Cautions** 1) All doses are in mg/day except for fentanyl, which is mcg/hr. 2) Equianalgesic dose conversions are only estimates and cannot account for individual variability in genetics and pharmacokinetics. 3) Do not use the calculated dose in MMEs to determine the doses to use when converting one opioid to another; when converting opioids, the new opioid is typically dosed at a substantially lower dose than the calculated MME dose to avoid overdose because of incomplete cross-tolerance and individual variability in opioid pharmacokinetics. Consult the FDA approved product labeling for specific guidance on medica…
plan definition.action.priority:
  value: urgent
plan definition.action.trigger:
  index: 0
  trigger definition.type:
    value: named-event
  trigger definition.name:
    value: order-sign
plan definition.action.condition:
  index: 0
  plan definition.action.condition.kind:
    value: applicability
  plan definition.action.condition.expression:
    expression.description:
      value: Check whether the current order is for an opioid with ambulatory misuse potential, the calculated MME result for the order and other active opioid medications for the patient is greater than or equal to 50 and if the 2022 CDC guideline general inclusion criteria is met
    expression.language:
      value: text/cql.identifier
    expression.expression:
      value: Is Recommendation Applicable?
plan definition.action.grouping behavior:
  value: visual-group
plan definition.action.selection behavior:
  value: any
plan definition.action.action:
  index: 0
  plan definition.action.description:
    value: Document - Will prescribe a lower dose
plan definition.action.action:
  index: 1
  plan definition.action.description:
    value: Document - Will calibrate a gradual change in dosage
plan definition.action.action:
  index: 2
  plan definition.action.description:
    value: Snooze* - Benefits outweigh risks, snooze 3 months
plan definition.action.action:
  index: 3
  plan definition.action.description:
    value: Snooze* - Short term benefits outweigh risks, snooze 1 month
plan definition.action.action:
  index: 4
  plan definition.action.description:
    value: Snooze* - N/A add comment, snooze 3 months