@prefix fhir: <http://hl7.org/fhir/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sct: <http://snomed.info/sct/> .

# - resource -------------------------------------------------------------------

[] a fhir:PlanDefinition;
  fhir:Resource.id [ fhir:value "opioidcds-06"], [ fhir:value "effective-data-requirements"];
  fhir:Resource.meta [
     fhir:Meta.profile [
       fhir:value "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-recommendationdefinition";
       fhir:index 0
     ], [
       fhir:value "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-publishableplandefinition";
       fhir:index 1
     ]
  ];
  fhir:DomainResource.extension [
     fhir:index 0;
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability" ];
     fhir:Extension.value [ fhir:value "shareable" ]
  ], [
     fhir:index 1;
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability" ];
     fhir:Extension.value [ fhir:value "computable" ]
  ], [
     fhir:index 2;
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability" ];
     fhir:Extension.value [ fhir:value "executable" ]
  ], [
     fhir:index 3;
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability" ];
     fhir:Extension.value [ fhir:value "publishable" ]
  ], [
     fhir:index 4;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSREC06" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Acute Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Acute Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions\":\n  ( Common.\"Is Opioid Analgesic with Ambulatory Misuse Potential?\"( ContextPrescriptions ) ) AmbulatoryOpioidPrescription\n    where Routines.\"Is Acute Pain Prescription?\"( AmbulatoryOpioidPrescription )\n      and Routines.\"Acute Pain Prescription Greater Than 7 Days?\"(AmbulatoryOpioidPrescription)" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "0" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 5;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSREC06" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential for Acute Pain" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential for Acute Pain\":\n  exists( \"Acute Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions\" )" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "1" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 6;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSCommonConfig" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Age Less than 18 Years Is Enabled" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "// CDC 2022 General Inclusion Criteria\ndefine \"Age Less than 18 Years Is Enabled\":\n  true" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "2" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 7;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSRoutines" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Patient Age Less Than 18" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Patient Age Less Than 18\":\n  if (Config.\"Age Less than 18 Years Is Enabled\") then\n    AgeInYearsAt(Today()) < 18\n  else false" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "3" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 8;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSCommonConfig" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Sickle Cell Check Enabled" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "// Sickle Cell\ndefine \"Sickle Cell Check Enabled\":\n  true" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "4" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 9;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSCommonConfig" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Sickle Cell Assumed Active" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Sickle Cell Assumed Active\":\n  true" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "5" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 10;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSCommon" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "US Core-Categorized Conditions" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "// 3. Medications indicating end of life\n    /* or exists (\n      \"Medications Indicating End of Life\"\n    ) */\n\ndefine \"US Core-Categorized Conditions\":\n  [Condition: category in \"Encounter Diagnosis Condition Category\"]\n    union [Condition: category in \"Problem List Condition Category\"]\n    union [Condition: category in \"US Core Health Concern Condition Category\"]" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "6" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 11;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSCommon" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Positive Sickle Cell Condition" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Positive Sickle Cell Condition\":\n  if Config.\"Sickle Cell Check Enabled\" and not Config.\"Sickle Cell Assumed Active\"\n    then (\n      \"US Core-Categorized Conditions\" C\n        where C.code in \"Sickle Cell Diseases\"\n          and C.clinicalStatus in \"Active Condition\"\n    ) else if Config.\"Sickle Cell Check Enabled\" and Config.\"Sickle Cell Assumed Active\"\n        then (\n          \"US Core-Categorized Conditions\" C\n            where C.code in \"Sickle Cell Diseases\"\n        )\n      else null" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "7" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 12;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSRoutines" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Condition Positive for Sickle Cell" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Condition Positive for Sickle Cell\":\n  if (Config.\"Sickle Cell Check Enabled\") then\n    exists(\n      Common.\"Positive Sickle Cell Condition\"\n    ) \n  else false" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "8" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 13;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSCommonConfig" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Active Cancer Treatment Encounters Condition Is Enabled" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "// Active Cancer Treatment\ndefine \"Active Cancer Treatment Encounters Condition Is Enabled\":\n  true" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "9" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 14;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSRoutines" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Encounter Period" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "// End of Opioid Naive Routine\n\n/*\n**  Routine #3\n**  Active Cancer Treatment Routine\n**\n**  Definition                    | Answer to Proceed   | Details                                    | Data (Terminology) Requirement\n**  ---------------------------------------------------------------------------------------------------------------------------------\n**  Two office visits within the  | No                  | Look for a minimum of two distinct         | Office Visit\n**  past 12 months                |                     | encounters within 12 months of the date    |\n**                                |                     | of the current visit for which each of the |\n**                                |                     | following is true:                         |\n**                                |                     |   - the encounter diagnosis (primary or    |\n**                                |                     |     secondary or co-morbidity diagnosis)   |\n**                                |                     |     is listed in the CDC Malignant Cancer  |\n**                                |                     |     Conditions value set                   |\n**  ---------------------------------------------------------------------------------------------------------------------------------\n**  Office visits with an         | No                  | The encounter is performed by an           | Oncology specialty\n**  oncology specialist           |                     | oncologist as defined in the oncology      | designations (NUCC)\n**  present                       |                     | specialty designations using the           |\n**                                |                     | National Uniform Claim Committee           |\n**                                |                     | (NUCC) classifications                     |\n**  ---------------------------------------------------------------------------------------------------------------------------------\n**  Office visits including CDC   | No                  | The encounter diagnosis (primary or        | CDC malignant cancer\n**  malignant cancer              |                     | secondary or co-morbidity diagnosis)       | conditions\n**  condition                     |                     | is listed in the CDC Malignant Cancer      |\n**                                |                     | Conditions value set                       |\n**  ----------------------------------------------------------------------------------------------------------------------------------\n**\n*/\n\ndefine \"Encounter Period\":\n  Interval[Today() - 12 months, Today())" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "10" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 15;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSCommon" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "USCore Encounter Cancer Diagnoses" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"USCore Encounter Cancer Diagnoses\":\n  [Condition: category in \"Encounter Diagnosis Condition Category\"] CancerDiagnoses\n    where CancerDiagnoses.code in \"CDC malignant cancer conditions\"" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "11" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 16;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSRoutines" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Encounters with Cancer Diagnosis During Encounter Period" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "// encounter-diagnosis, problem-list and health-concern Conditions\n// define \"US Core-Categorized Cancer Diagnoses\":\n//   Common.\"US Core-Categorized Conditions\" C\n//     where C.code in Common.\"CDC malignant cancer conditions\"\n\n// define \"Encounters with Cancer Diagnosis During Encounter Period\":\n//   [Encounter] Encounter\n//     with \"US Core-Categorized Cancer Diagnoses\" CancerDiagnosis\n//     such that date from Encounter.period.\"start\".value in day of \"Encounter Period\"\n//       and EndsWith(CancerDiagnosis.encounter.reference, Encounter.id)\n\ndefine \"Encounters with Cancer Diagnosis During Encounter Period\":\n  [Encounter] Encounters\n    where date from Encounters.period.\"start\" in day of \"Encounter Period\"\n      and exists (\n        Common.\"USCore Encounter Cancer Diagnoses\" CancerDiagnoses\n          where EndsWith(CancerDiagnoses.encounter.reference, Encounters.id)\n      )" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "12" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 17;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSRoutines" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Number of Encounters with Cancer Diagnosis During Encounter Period" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Number of Encounters with Cancer Diagnosis During Encounter Period\":\n  Count (\"Encounters with Cancer Diagnosis During Encounter Period\")" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "13" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 18;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSRoutines" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Has Two or More Encounters with Cancer Diagnosis During Encounter Period" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Has Two or More Encounters with Cancer Diagnosis During Encounter Period\":\n  \"Number of Encounters with Cancer Diagnosis During Encounter Period\" >= 2" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "14" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 19;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSCommon" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "USCore Problem List Cancer Diagnoses" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"USCore Problem List Cancer Diagnoses\":\n  [Condition: category in \"Problem List Condition Category\"] CancerDiagnoses\n    where CancerDiagnoses.code in \"CDC malignant cancer conditions\"" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "15" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 20;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSRoutines" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Has Active Cancer Diagnosis on Problem List" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Has Active Cancer Diagnosis on Problem List\":\n  exists (\n    Common.\"USCore Problem List Cancer Diagnoses\" CancerDiagnoses\n      where CancerDiagnoses.category in Common.\"Problem List Condition Category\"\n        and exists(\n          CancerDiagnoses.clinicalStatus.coding ClinicalStatus\n            where ClinicalStatus.code ~ 'active'\n        )\n  )" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "16" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 21;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSRoutines" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Is Active Cancer Treatment?" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Is Active Cancer Treatment?\":\n  if (Config.\"Active Cancer Treatment Encounters Condition Is Enabled\") \n    then \"Has Two or More Encounters with Cancer Diagnosis During Encounter Period\"\n      or \"Has Active Cancer Diagnosis on Problem List\"\n  else false" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "17" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 22;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSCommonConfig" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "End-Stage Disease Criteria Enabled" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "// CDC 2022 General Inclusion Criteria\ndefine \"End-Stage Disease Criteria Enabled\":\n  true" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "18" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 23;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSRoutines" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Conditions Likely Terminal for Opioid Prescribing" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Conditions Likely Terminal for Opioid Prescribing\":\n  if (Config.\"End-Stage Disease Criteria Enabled\") then\n    exists (\n      Common.\"US Core-Categorized Conditions\" EOLC\n        where EOLC.code in Common.\"Conditions likely terminal for opioid prescribing\"\n          // and EOLC.clinicalStatus in Common.\"Active Condition\"\n    )\n  else false" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "19" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 24;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSRoutines" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "CDC 2022 Guideline General Inclusion Criteria" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"CDC 2022 Guideline General Inclusion Criteria\":\n  not \"Patient Age Less Than 18\"\n    and not \"Condition Positive for Sickle Cell\"\n    and not \"Is Active Cancer Treatment?\"\n    and not \"Conditions Likely Terminal for Opioid Prescribing\"" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "20" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 25;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSREC06" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Order is for Long-Acting Opioid" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Order is for Long-Acting Opioid\":\n  exists (\n    \"Acute Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions\" AmbulatoryOpioidPrescription\n      where AmbulatoryOpioidPrescription.medication in Common.\"Extended release opioid with ambulatory misuse potential\"\n        or Common.GetDurationInDays( AmbulatoryOpioidPrescription.dispenseRequest.expectedSupplyDuration ) > 7 days\n  )" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "21" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 26;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSREC06" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Inclusion Criteria" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Inclusion Criteria\":\n  \"Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential for Acute Pain\"\n    and Routines.\"CDC 2022 Guideline General Inclusion Criteria\"\n    and \"Order is for Long-Acting Opioid\"" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "22" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 27;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSREC06" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Exclusion Criteria" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Exclusion Criteria\":\n  false" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "23" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 28;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSREC06" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Is Recommendation Applicable?" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define \"Is Recommendation Applicable?\":\n  \"Inclusion Criteria\"\n    and not \"Exclusion Criteria\"" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "24" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 29;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSCommon" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Is Opioid Analgesic with Ambulatory Misuse Potential?" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define function \"Is Opioid Analgesic with Ambulatory Misuse Potential?\"(value List<MedicationRequest>):\n  (\"Get MedicationRequest Medication as Code\"(value)) Rx\n    where Rx.medication in \"Opioid analgesics with ambulatory misuse potential\" \n      and Rx.category in \"Community\"" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "25" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 30;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSCommon" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Get MedicationRequest Medication as Code" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define function \"Get MedicationRequest Medication as Code\"(value List<MedicationRequest>):\n  value Rx\n    let Med: \n      if Rx.medication is Reference then singleton from (\n        [Medication] M\n          where M.id = (Last(Split((Rx.medication as FHIR.Reference).reference, '/')))\n      ) else null\n    return \n      MedicationRequest {\n        id: Rx.id,\n        status: Rx.status,\n        intent: Rx.intent,\n        category: Rx.category,\n        medication: if Rx.medication is Reference then Med.code else Rx.medication as CodeableConcept,\n        subject: Rx.subject,\n        authoredOn: Rx.authoredOn,\n        recorder: Rx.recorder,\n        dosageInstruction: Rx.dosageInstruction,\n        dispenseRequest: Rx.dispenseRequest\n      }" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "26" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 31;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "FHIRHelpers" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "ToString" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define function ToString(value string): value.value" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "27" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 32;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "FHIRHelpers" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "ToConcept" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define function ToConcept(concept FHIR.CodeableConcept):\n    if concept is null then\n        null\n    else\n        System.Concept {\n            codes: concept.coding C return ToCode(C),\n            display: concept.text.value\n        }" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "28" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 33;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "FHIRHelpers" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "ToCode" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define function ToCode(coding FHIR.Coding):\n    if coding is null then\n        null\n    else\n        System.Code {\n          code: coding.code.value,\n          system: coding.system.value,\n          version: coding.version.value,\n          display: coding.display.value\n        }" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "29" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 34;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSRoutines" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Is Acute Pain Prescription?" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "// End of For Subacute or Chronic Pain Routine\n\n/*\n**  Routine #5\n**  For Acute Pain Routine\n**\n**  Definition                  | Answer to Proceed   | Details                                        | Data (Terminology) Requirement\n**  -----------------------------------------------------------------------------------------------------------------------------------\n**  Order for opioid analgesics | Yes                 | Look for an existing prescription (order) for  | Opioid analgesics with\n**  with ambulatory misuse      |                     | opioid analgesics with ambulatory abuse        | ambulatory misuse potential\n**  potential of duration < 28  |                     | potential of duration < 28 days                |\n**  days                        |                     |                                                |\n**  -----------------------------------------------------------------------------------------------------------------------------------\n**\n*/\n\n// should allow DateTime precision, but not working in the Ruler specifically\ndefine function \"Is Acute Pain Prescription?\"(prescription FHIR.MedicationRequest):\n  prescription.dispenseRequest is not null\n    and prescription.dispenseRequest.expectedSupplyDuration is not null\n    and Common.GetDurationInDays( prescription.dispenseRequest.expectedSupplyDuration ) < 28 days" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "30" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 35;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSCommon" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "GetDurationInDays" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define function GetDurationInDays(value FHIR.Duration):\n  if value is null then null\n  else\n    case\n      when value.code.value ~ 'a' then System.Quantity{ value: value.value.value * 365.0, unit: 'days' }\n      when value.code.value ~ 'mo' then System.Quantity{ value: value.value.value * 30.0, unit: 'days' }\n      when value.code.value ~ 'wk' then System.Quantity{ value: value.value.value * 7.0, unit: 'days' }\n      when value.code.value ~ 'd' then System.Quantity{ value: value.value.value, unit: 'days' }\n      when value.code.value ~ 'h' then System.Quantity{ value: value.value.value / 24.0, unit: 'days' }\n      when value.code.value ~ 'min' then System.Quantity{ value: value.value.value / 60.0 / 24.0, unit: 'days' }\n      when value.code.value ~ 's' then System.Quantity{ value: value.value.value / 60.0 / 60.0 / 24.0, unit: 'days' }\n      when value.code.value ~ 'ms' then System.Quantity{ value: value.value.value / 60.0 / 60.0 / 24.0 / 1000.0, unit: 'days' }\n      when value.code.value is null then Message(1000, true, 'Undefined', 'Error', 'Duration unit code is null')\n      else Message(1000, true, 'Undefined', 'Error', 'Unsupported duration unit code: ' + value.code.value)\nend" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "31" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 36;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "OpioidCDSRoutines" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "Acute Pain Prescription Greater Than 7 Days?" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "// should allow DateTime precision, but not working in the Ruler specifically\ndefine function \"Acute Pain Prescription Greater Than 7 Days?\"(prescription FHIR.MedicationRequest):\n      prescription.dispenseRequest is not null\n    and prescription.dispenseRequest.expectedSupplyDuration is not null\n    and Common.GetDurationInDays( prescription.dispenseRequest.expectedSupplyDuration ) > 7 days\n    and Common.GetDurationInDays( prescription.dispenseRequest.expectedSupplyDuration ) < 28 days" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "32" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 37;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "libraryName" ];
       fhir:Extension.value [ fhir:value "FHIRHelpers" ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "name" ];
       fhir:Extension.value [ fhir:value "ToDateTime" ]
     ], [
       fhir:index 2;
       fhir:Extension.url [ fhir:value "statement" ];
       fhir:Extension.value [ fhir:value "define function ToDateTime(value dateTime): value.value" ]
     ], [
       fhir:index 3;
       fhir:Extension.url [ fhir:value "displaySequence" ];
       fhir:Extension.value [ fhir:value "33" ]
     ];
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition" ]
  ], [
     fhir:index 38;
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-softwaresystem" ];
     fhir:Extension.value [
       fhir:Reference.reference [ fhir:value "Device/cqf-tooling" ]
     ]
  ], [
     fhir:index 39;
     fhir:Extension.url [ fhir:value "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-effectiveDataRequirements" ];
     fhir:Extension.value [ fhir:value "#effective-data-requirements" ]
  ];
  fhir:PlanDefinition.url [ fhir:value "http://fhir.org/guides/cdc/opioid-cds/PlanDefinition/opioidcds-06"];
  fhir:PlanDefinition.identifier [
     fhir:index 0;
     fhir:Identifier.use [ fhir:value "official" ];
     fhir:Identifier.value [ fhir:value "cdc-opioid-guidance" ]
  ];
  fhir:PlanDefinition.version [ fhir:value "2022.1.0"];
  fhir:PlanDefinition.name [ fhir:value "PlanDefinition_Recommendation_06_Order_Sign"];
  fhir:PlanDefinition.title [ fhir:value "Recommendation #6 - Prescribe Lowest Effective Dose and Duration"];
  fhir:PlanDefinition.type [
     fhir:CodeableConcept.coding [
       fhir:index 0;
       fhir:Coding.system [ fhir:value "http://terminology.hl7.org/CodeSystem/plan-definition-type" ];
       fhir:Coding.code [ fhir:value "eca-rule" ];
       fhir:Coding.display [ fhir:value "ECA Rule" ]
     ]
  ];
  fhir:PlanDefinition.status [ fhir:value "draft"];
  fhir:PlanDefinition.experimental [ fhir:value "true"];
  fhir:PlanDefinition.date [ fhir:value "2025-08-06"];
  fhir:PlanDefinition.publisher [ fhir:value "Centers for Disease Control and Prevention (CDC)"];
  fhir:PlanDefinition.contact [
     fhir:index 0;
     fhir:ContactDetail.telecom [
       fhir:index 0;
       fhir:ContactPoint.system [ fhir:value "url" ];
       fhir:ContactPoint.value [ fhir:value "https://www.cdc.gov" ]
     ]
  ];
  fhir:PlanDefinition.description [ fhir:value "When opioids are needed for acute pain, clinicians should prescribe no greater quantity than needed for the expected duration of pain severe enough to require opioids."];
  fhir:PlanDefinition.useContext [
     fhir:index 0;
     fhir:UsageContext.code [
       fhir:Coding.system [ fhir:value "http://terminology.hl7.org/CodeSystem/usage-context-type" ];
       fhir:Coding.code [ fhir:value "focus" ];
       fhir:Coding.display [ fhir:value "Clinical Focus" ]
     ];
     fhir:UsageContext.value [
       a sct:182888003;
       fhir:CodeableConcept.coding [
         fhir:index 0;
         a sct:182888003;
         fhir:Coding.system [ fhir:value "http://snomed.info/sct" ];
         fhir:Coding.code [ fhir:value "182888003" ];
         fhir:Coding.display [ fhir:value "Medication requested (situation)" ]
       ]
     ]
  ], [
     fhir:index 1;
     fhir:UsageContext.code [
       fhir:Coding.system [ fhir:value "http://terminology.hl7.org/CodeSystem/usage-context-type" ];
       fhir:Coding.code [ fhir:value "focus" ];
       fhir:Coding.display [ fhir:value "Clinical Focus" ]
     ];
     fhir:UsageContext.value [
       a sct:274663001;
       fhir:CodeableConcept.coding [
         fhir:index 0;
         a sct:274663001;
         fhir:Coding.system [ fhir:value "http://snomed.info/sct" ];
         fhir:Coding.code [ fhir:value "274663001" ];
         fhir:Coding.display [ fhir:value "Acute pain (finding)" ]
       ]
     ]
  ];
  fhir:PlanDefinition.jurisdiction [
     fhir:index 0;
     fhir:CodeableConcept.coding [ fhir:index 0 ]
  ];
  fhir:PlanDefinition.purpose [ fhir: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."];
  fhir:PlanDefinition.usage [ fhir:value "When the diagnosis and severity of acute pain warrant use of opioids, clinicians should prescribe no greater quantity than needed for the expected duration of pain severe enough to require opioids. For many common causes of nontraumatic, nonsurgical pain, when opioids are needed, a few days or less are often sufficient, and shorter courses can minimize the need to taper opioids to prevent withdrawal symptoms at the end of a course of opioids. However, durations should be individualized to the patient's clinical circumstances."];
  fhir:PlanDefinition.copyright [ fhir:value "© CDC 2016+."];
  fhir:PlanDefinition.topic [
     fhir:index 0;
     fhir:CodeableConcept.text [ fhir:value "Opioid Prescribing" ]
  ];
  fhir:PlanDefinition.author [
     fhir:index 0;
     fhir:ContactDetail.name [ fhir:value "Kensaku Kawamoto, MD, PhD, MHS" ]
  ], [
     fhir:index 1;
     fhir:ContactDetail.name [ fhir:value "Bryn Rhodes" ]
  ], [
     fhir:index 2;
     fhir:ContactDetail.name [ fhir:value "Floyd Eisenberg, MD, MPH" ]
  ], [
     fhir:index 3;
     fhir:ContactDetail.name [ fhir:value "Robert McClure, MD, MPH" ]
  ];
  fhir:PlanDefinition.relatedArtifact [
     fhir:index 0;
     fhir:RelatedArtifact.type [ fhir:value "documentation" ];
     fhir:RelatedArtifact.display [ fhir:value "2022 CDC Clinical Practice Guideline for Prescribing Opioids for Pain" ];
     fhir:RelatedArtifact.url [ fhir:value "https://www.cdc.gov/mmwr/volumes/71/rr/rr7103a1.htm" ];
     fhir:RelatedArtifact.document [
       fhir:Attachment.url [ fhir:value "https://www.cdc.gov/mmwr/volumes/71/rr/rr7103a1.htm" ]
     ]
  ];
  fhir:PlanDefinition.library [
     fhir:value "http://fhir.org/guides/cdc/opioid-cds/Library/OpioidCDSREC06";
     fhir:index 0
  ];
  fhir:PlanDefinition.action [
     fhir:index 0;
     fhir:Element.extension [
       fhir:index 0;
       fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-strengthOfRecommendation" ];
       fhir:Extension.value [
         fhir:CodeableConcept.coding [
           fhir:index 0;
           fhir:Coding.system [ fhir:value "http://terminology.hl7.org/CodeSystem/recommendation-strength" ];
           fhir:Coding.code [ fhir:value "strong" ];
           fhir:Coding.display [ fhir:value "Strong" ]
         ]
       ]
     ], [
       fhir:index 1;
       fhir:Extension.url [ fhir:value "http://hl7.org/fhir/StructureDefinition/cqf-qualityOfEvidence" ];
       fhir:Extension.value [
         fhir:CodeableConcept.coding [
           fhir:index 0;
           fhir:Coding.system [ fhir:value "http://terminology.hl7.org/CodeSystem/evidence-quality" ];
           fhir:Coding.code [ fhir:value "very-low" ];
           fhir:Coding.display [ fhir:value "Very low quality" ]
         ]
       ]
     ];
     fhir:PlanDefinition.title [ fhir:value "When Treating Acute Pain, Prescribe No More Opioids Than Needed" ];
     fhir:PlanDefinition.description [ fhir:value "Please verify that the opioid order quantity and duration are no more than needed for the expected duration of pain severe enough to require opioids.\r\n\r\nFor guidance regarding prescribing opioids for acute pain, see [Recommendation 6 of the 2022 CDC Clinical Practice Guideline](https://www.cdc.gov/mmwr/volumes/71/rr/rr7103a1.htm#Recommendation6)." ];
     fhir:PlanDefinition.priority [ fhir:value "urgent" ];
     fhir:PlanDefinition.trigger [
       fhir:index 0;
       fhir:TriggerDefinition.type [ fhir:value "named-event" ];
       fhir:TriggerDefinition.name [ fhir:value "order-sign" ]
     ];
     fhir:PlanDefinition.condition [
       fhir:index 0;
       fhir:PlanDefinition.kind [ fhir:value "applicability" ];
       fhir:PlanDefinition.expression [
         fhir:Expression.description [ fhir:value "Check whether the current order is for an opioid with ambulatory misuse potential for acute pain with an intended duration of more than 7 days and if the 2022 CDC guideline general inclusion criteria is met" ];
         fhir:Expression.language [ fhir:value "text/cql.identifier" ];
         fhir:Expression.expression [ fhir:value "Is Recommendation Applicable?" ]
       ]
     ];
     fhir:PlanDefinition.groupingBehavior [ fhir:value "visual-group" ];
     fhir:PlanDefinition.selectionBehavior [ fhir:value "any" ];
     fhir:PlanDefinition.action [
       fhir:index 0;
       fhir:PlanDefinition.description [ fhir:value "Document - Will adjust opioid order" ]
     ], [
       fhir:index 1;
       fhir:PlanDefinition.description [ fhir:value "Snooze* - Benefits of opioid therapy duration outweigh risks, snooze 3 months" ]
     ], [
       fhir:index 2;
       fhir:PlanDefinition.description [ fhir:value "Snooze* - N/A see comment, snooze 3 months" ]
     ]
  ] .

# -------------------------------------------------------------------------------------

