Id: opioidcds-10-order-sign Url: Recommendation #10 - Urine Drug Testing (order-sign) Version: 2022.1.0 Identifier: value: cdc-opioid-guidance Name: PlanDefinition_Recommendation_10_Order_Sign Title: Recommendation #10 - Urine Drug Testing (order-sign) Status: draft Experimental: true Type: system: http://terminology.hl7.org/CodeSystem/plan-definition-type code: eca-rule display: ECA Rule Date: 2024-11-19 Publisher: Centers for Disease Control and Prevention (CDC) Description: When prescribing opioids for subacute or chronic pain, clinicians should consider the benefits and risks of toxicology testing to assess for prescribed medications as well as other prescribed and nonprescribed controlled substances. Logic Definitions: Library Name Name sequence OpioidCDSREC10OrderSign Subacute or Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions 0 define &quot;Subacute or Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions&quot;: ( Common.&quot;Is Opioid Analgesic with Ambulatory Misuse Potential?&quot;( ContextPrescriptions ) ) AmbulatoryOpioidPrescription where Routines.&quot;Is Subacute or Chronic Pain Prescription?&quot;( AmbulatoryOpioidPrescription ) Library Name Name sequence OpioidCDSREC10OrderSign Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential 1 define &quot;Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential&quot;: exists( &quot;Subacute or Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions&quot; ) Library Name Name sequence OpioidCDSRoutines Patient Age Less Than 18 2 define &quot;Patient Age Less Than 18&quot;: if (Config.&quot;Age Less than 18 Years Is Enabled&quot;) then AgeInYearsAt(Today()) &lt; 18 else false Library Name Name sequence OpioidCDSRoutines Condition Positive for Sickle Cell 3 define &quot;Condition Positive for Sickle Cell&quot;: if (Config.&quot;Sickle Cell Check Enabled&quot;) then exists( Common.&quot;Positive Sickle Cell Condition&quot; ) else false Library Name Name sequence OpioidCDSCommon US Core-Categorized Conditions 4 // 3. Medications indicating end of life /* or exists ( &quot;Medications Indicating End of Life&quot; ) */ define &quot;US Core-Categorized Conditions&quot;: [Condition: category in &quot;Encounter Diagnosis Condition Category&quot;] union [Condition: category in &quot;Problem List Condition Category&quot;] union [Condition: category in &quot;US Core Health Concern Condition Category&quot;] Library Name Name sequence OpioidCDSRoutines Conditions Indicating End Of Life Present 5 define &quot;Conditions Indicating End Of Life Present&quot;: exists ( Common.&quot;US Core-Categorized Conditions&quot; LLEC where LLEC.code in Common.&quot;Limited life expectancy conditions&quot; and LLEC.clinicalStatus in Common.&quot;Active Condition&quot; ) Library Name Name sequence OpioidCDSRoutines Is Active Cancer Treatment? 6 define &quot;Is Active Cancer Treatment?&quot;: if (Config.&quot;Active Cancer Treatment Encounters Condition Is Enabled&quot;) then &quot;Has Two or More Encounters with Cancer Diagnosis During Encounter Period&quot; else false Library Name Name sequence OpioidCDSRoutines Conditions Including Cancer To Exclude Opioid Management Indicating End-Stage Disease Present 7 define &quot;Conditions Including Cancer To Exclude Opioid Management Indicating End-Stage Disease Present&quot;: if (Config.&quot;End-Stage Disease Criteria Enabled&quot;) then exists ( Common.&quot;US Core-Categorized Conditions&quot; EOLC where EOLC.code in Common.&quot;Conditions likely terminal for opioid prescribing&quot; and EOLC.clinicalStatus in Common.&quot;Active Condition&quot; ) else false Library Name Name sequence OpioidCDSRoutines Is Opioid Review Useful? 8 define &quot;Is Opioid Review Useful?&quot;: not &quot;Patient Age Less Than 18&quot; and not &quot;Condition Positive for Sickle Cell&quot; and not &quot;Conditions Indicating End Of Life Present&quot; and not &quot;Is Active Cancer Treatment?&quot; and not &quot;Conditions Including Cancer To Exclude Opioid Management Indicating End-Stage Disease Present&quot; Library Name Name sequence OpioidCDSREC10Common Inclusion Criteria For UDS Recommendation 9 /* @description: Determines whether an opioid review is appropriate for the patient and whether they had a UDS performed in the past year */ define &quot;Inclusion Criteria For UDS Recommendation&quot;: Routines.&quot;Is Opioid Review Useful?&quot; and not exists ( if Config.&quot;Use Alternative UDS Lookback Period&quot; then &quot;All Opioid or Non-opioid UDS in Alternative Lookback Period&quot; else &quot;All Opioid or Non-opioid UDS in Lookback Period&quot; ) Library Name Name sequence OpioidCDSCommon Conditions Indicating End of Life or With Limited Life Expectancy 10 define &quot;Conditions Indicating End of Life or With Limited Life Expectancy&quot;: ( &quot;US Core-Categorized Conditions&quot; C where C.code in &quot;Conditions likely terminal for opioid prescribing&quot; and C.clinicalStatus in &quot;Active Condition&quot; ) union ( &quot;US Core-Categorized Conditions&quot; C where C.code in &quot;Limited life expectancy conditions&quot; and C.clinicalStatus in &quot;Active Condition&quot; ) Library Name Name sequence OpioidCDSCommon Admitted/Referred/Discharged to Hospice Care 11 define &quot;Admitted/Referred/Discharged to Hospice Care&quot;: ( if (Config.&quot;Hospice Findings Exclusion Enabled&quot;) then [Observation: code in &quot;Hospice Finding Codes&quot;] 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 &quot;Hospice Disposition&quot; ) and E.status.value in { 'planned', 'arrived', 'in-progress', 'finished', 'onleave' } ) Library Name Name sequence OpioidCDSCommon End of Life Assessment 12 define &quot;End of Life Assessment&quot;: // 1. Conditions indicating end of life or with limited life expectancy exists ( &quot;Conditions Indicating End of Life or With Limited Life Expectancy&quot; ) // 2. Admitted/referred/discharged to hospice care or exists ( &quot;Admitted/Referred/Discharged to Hospice Care&quot; ) Library Name Name sequence OpioidCDSREC10Common Exclusion Criteria 13 define &quot;Exclusion Criteria&quot;: Common.&quot;End of Life Assessment&quot; Library Name Name sequence OpioidCDSREC10OrderSign Is Perform Drug Screen Recommendation Applicable? 14 define &quot;Is Perform Drug Screen Recommendation Applicable?&quot;: &quot;Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential&quot; and Rec10Common.&quot;Inclusion Criteria For UDS Recommendation&quot; and not Rec10Common.&quot;Exclusion Criteria&quot; Library Name Name sequence OpioidCDSREC10Common Amphetamine Simple Identifier 15 define &quot;Amphetamine Simple Identifier&quot;: 'Amphetamine' Library Name Name sequence OpioidCDSREC10Common UDS Lookback Period 16 // Constants define &quot;UDS Lookback Period&quot;: Interval[Today() - 12 months - 1 days, Today()] Library Name Name sequence OpioidCDSREC10Common All Opioid or Non-opioid UDS in Lookback Period 17 define &quot;All Opioid or Non-opioid UDS in Lookback Period&quot;: ( [Observation: Common.&quot;All Drug Urine Screening&quot;] Lab where date from Lab.effective in day of &quot;UDS Lookback Period&quot; and not ( Lab.status in { 'unknown', 'entered-in-error', 'cancelled' } ) ) X sort by date from effective desc Library Name Name sequence OpioidCDSREC10Common Amphetamine Screenings In Lookback Period 18 // Amphetamines define &quot;Amphetamine Screenings In Lookback Period&quot;: &quot;All Opioid or Non-opioid UDS in Lookback Period&quot; Lab where Lab.code in Common.&quot;Amphetamine Urine Tests&quot; Library Name Name sequence OpioidCDSREC10Common Positive Amphetamine Screenings In Lookback Period 19 define &quot;Positive Amphetamine Screenings In Lookback Period&quot;: GetPositiveLabsInLookbackPeriod(&quot;Amphetamine Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Negative Amphetamine Screenings In Lookback Period 20 define &quot;Negative Amphetamine Screenings In Lookback Period&quot;: GetNegativeLabsInLookbackPeriod(&quot;Amphetamine Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Rx Lookback Period 21 define &quot;Rx Lookback Period&quot;: Interval[Today() - 12 months - 31 days, Today()] Library Name Name sequence OpioidCDSREC10Common Normalize Rx In Lookback Period 22 define &quot;Normalize Rx In Lookback Period&quot;: Common.&quot;Get MedicationRequest Medication as Code&quot;( [MedicationRequest: category in Common.&quot;Community&quot;] Rx where Rx.status in { 'active', 'completed', 'stopped' } and Rx.intent = 'order' and date from Rx.authoredOn in day of &quot;Rx Lookback Period&quot; ) Library Name Name sequence OpioidCDSREC10Common Amphetamine Rx In Lookback Period 23 define &quot;Amphetamine Rx In Lookback Period&quot;: &quot;Normalize Rx In Lookback Period&quot; Rx where Rx.medication in Common.&quot;Amphetamine Medications&quot; Library Name Name sequence OpioidCDSREC10Common Barbiturate Simple Identifier 24 define &quot;Barbiturate Simple Identifier&quot;: 'Barbiturate' Library Name Name sequence OpioidCDSREC10Common Barbiturate Screenings In Lookback Period 25 // Barbiturates define &quot;Barbiturate Screenings In Lookback Period&quot;: &quot;All Opioid or Non-opioid UDS in Lookback Period&quot; Lab where Lab.code in Common.&quot;Barbiturate Urine Tests&quot; Library Name Name sequence OpioidCDSREC10Common Positive Barbiturate Screenings In Lookback Period 26 define &quot;Positive Barbiturate Screenings In Lookback Period&quot;: GetPositiveLabsInLookbackPeriod(&quot;Barbiturate Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Negative Barbiturate Screenings In Lookback Period 27 define &quot;Negative Barbiturate Screenings In Lookback Period&quot;: GetNegativeLabsInLookbackPeriod(&quot;Barbiturate Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Barbiturate Rx In Lookback Period 28 define &quot;Barbiturate Rx In Lookback Period&quot;: &quot;Normalize Rx In Lookback Period&quot; Rx where Rx.medication in Common.&quot;Barbiturate Medications&quot; Library Name Name sequence OpioidCDSREC10Common Benzodiazepine Simple Identifier 29 define &quot;Benzodiazepine Simple Identifier&quot;: 'Benzodiazepine' Library Name Name sequence OpioidCDSREC10Common Benzodiazepine Screenings In Lookback Period 30 // Benzodiazepines define &quot;Benzodiazepine Screenings In Lookback Period&quot;: &quot;All Opioid or Non-opioid UDS in Lookback Period&quot; Lab where Lab.code in Common.&quot;Benzodiazepine Urine Tests&quot; Library Name Name sequence OpioidCDSREC10Common Positive Benzodiazepine Screenings In Lookback Period 31 define &quot;Positive Benzodiazepine Screenings In Lookback Period&quot;: GetPositiveLabsInLookbackPeriod(&quot;Benzodiazepine Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Negative Benzodiazepine Screenings In Lookback Period 32 define &quot;Negative Benzodiazepine Screenings In Lookback Period&quot;: GetNegativeLabsInLookbackPeriod(&quot;Benzodiazepine Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Benzodiazepine Rx In Lookback Period 33 define &quot;Benzodiazepine Rx In Lookback Period&quot;: &quot;Normalize Rx In Lookback Period&quot; Rx where Rx.medication in Common.&quot;Benzodiazepine medications&quot; Library Name Name sequence OpioidCDSREC10Common Buprenorphine Simple Identifier 34 define &quot;Buprenorphine Simple Identifier&quot;: 'Buprenorphine' Library Name Name sequence OpioidCDSREC10Common Buprenorphine Screenings In Lookback Period 35 // Buprenorphine define &quot;Buprenorphine Screenings In Lookback Period&quot;: &quot;All Opioid or Non-opioid UDS in Lookback Period&quot; Lab where Lab.code in Common.&quot;Buprenorphine Urine Tests&quot; Library Name Name sequence OpioidCDSREC10Common Positive Buprenorphine Screenings In Lookback Period 36 define &quot;Positive Buprenorphine Screenings In Lookback Period&quot;: GetPositiveLabsInLookbackPeriod(&quot;Buprenorphine Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Negative Buprenorphine Screenings In Lookback Period 37 define &quot;Negative Buprenorphine Screenings In Lookback Period&quot;: GetNegativeLabsInLookbackPeriod(&quot;Buprenorphine Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Buprenorphine Rx In Lookback Period 38 define &quot;Buprenorphine Rx In Lookback Period&quot;: &quot;Normalize Rx In Lookback Period&quot; Rx where Rx.medication in Common.&quot;Buprenorphine Medications&quot; Library Name Name sequence OpioidCDSREC10Common Cannabinoid Simple Identifier 39 define &quot;Cannabinoid Simple Identifier&quot;: 'Cannabinoid' Library Name Name sequence OpioidCDSREC10Common Cannabinoid Screenings In Lookback Period 40 // Cannabinoids define &quot;Cannabinoid Screenings In Lookback Period&quot;: if Config.&quot;Cannabinoid Urine Screening Check Enabled&quot; then ( &quot;All Opioid or Non-opioid UDS in Lookback Period&quot; Lab where Lab.code in Common.&quot;Cannabinoid Urine Tests&quot; ) else null Library Name Name sequence OpioidCDSCommonConfig Cannabinoid Urine Screening Check Enabled 41 define &quot;Cannabinoid Urine Screening Check Enabled&quot;: false Library Name Name sequence OpioidCDSREC10Common Positive Cannabinoid Screenings In Lookback Period 42 define &quot;Positive Cannabinoid Screenings In Lookback Period&quot;: GetPositiveLabsInLookbackPeriod(&quot;Cannabinoid Screenings In Lookback Period&quot;, Config.&quot;Cannabinoid Urine Screening Check Enabled&quot;) Library Name Name sequence OpioidCDSREC10Common Negative Cannabinoid Screenings In Lookback Period 43 define &quot;Negative Cannabinoid Screenings In Lookback Period&quot;: GetNegativeLabsInLookbackPeriod(&quot;Cannabinoid Screenings In Lookback Period&quot;, Config.&quot;Cannabinoid Urine Screening Check Enabled&quot;) Library Name Name sequence OpioidCDSREC10Common Cocaine Simple Identifier 44 define &quot;Cocaine Simple Identifier&quot;: 'Cocaine' Library Name Name sequence OpioidCDSREC10Common Cocaine Screenings In Lookback Period 45 // Cocaine define &quot;Cocaine Screenings In Lookback Period&quot;: &quot;All Opioid or Non-opioid UDS in Lookback Period&quot; Lab where Lab.code in Common.&quot;Cocaine Urine Tests&quot; Library Name Name sequence OpioidCDSREC10Common Positive Cocaine Screenings In Lookback Period 46 define &quot;Positive Cocaine Screenings In Lookback Period&quot;: GetPositiveLabsInLookbackPeriod(&quot;Cocaine Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Negative Cocaine Screenings In Lookback Period 47 define &quot;Negative Cocaine Screenings In Lookback Period&quot;: GetNegativeLabsInLookbackPeriod(&quot;Cocaine Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Fentanyl Simple Identifier 48 define &quot;Fentanyl Simple Identifier&quot;: 'Fentanyl' Library Name Name sequence OpioidCDSREC10Common Fentanyl Screenings In Lookback Period 49 // Fentanyl define &quot;Fentanyl Screenings In Lookback Period&quot;: if Config.&quot;Opiate Urine Screening Check Enabled&quot; then ( &quot;All Opioid or Non-opioid UDS in Lookback Period&quot; AllLabs where AllLabs.code in Common.&quot;Fentanyl Urine Tests&quot; ) else null Library Name Name sequence OpioidCDSCommonConfig Opiate Urine Screening Check Enabled 50 // Recommendation 10 define &quot;Opiate Urine Screening Check Enabled&quot;: true Library Name Name sequence OpioidCDSREC10Common Positive Fentanyl Screenings In Lookback Period 51 define &quot;Positive Fentanyl Screenings In Lookback Period&quot;: GetPositiveLabsInLookbackPeriod(&quot;Fentanyl Screenings In Lookback Period&quot;, Config.&quot;Opiate Urine Screening Check Enabled&quot;) Library Name Name sequence OpioidCDSREC10Common Negative Fentanyl Screenings In Lookback Period 52 define &quot;Negative Fentanyl Screenings In Lookback Period&quot;: GetNegativeLabsInLookbackPeriod(&quot;Fentanyl Screenings In Lookback Period&quot;, Config.&quot;Opiate Urine Screening Check Enabled&quot;) Library Name Name sequence OpioidCDSREC10Common Fentanyl Rx In Lookback Period 53 define &quot;Fentanyl Rx In Lookback Period&quot;: &quot;Normalize Rx In Lookback Period&quot; Rx where Rx.medication in Common.&quot;Fentanyl Medications&quot; Library Name Name sequence OpioidCDSREC10Common Heroin Simple Identifier 54 define &quot;Heroin Simple Identifier&quot;: 'Heroin (6-AM)' Library Name Name sequence OpioidCDSREC10Common Heroin Screenings In Lookback Period 55 // Heroin define &quot;Heroin Screenings In Lookback Period&quot;: &quot;All Opioid or Non-opioid UDS in Lookback Period&quot; Lab where Lab.code in Common.&quot;Heroin Urine Tests&quot; Library Name Name sequence OpioidCDSREC10Common Positive Heroin Screenings In Lookback Period 56 define &quot;Positive Heroin Screenings In Lookback Period&quot;: GetPositiveLabsInLookbackPeriod(&quot;Heroin Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Negative Heroin Screenings In Lookback Period 57 define &quot;Negative Heroin Screenings In Lookback Period&quot;: GetNegativeLabsInLookbackPeriod(&quot;Heroin Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Methadone Simple Identifier 58 define &quot;Methadone Simple Identifier&quot;: 'Methadone' Library Name Name sequence OpioidCDSREC10Common Methadone Screenings In Lookback Period 59 // Methadone define &quot;Methadone Screenings In Lookback Period&quot;: &quot;All Opioid or Non-opioid UDS in Lookback Period&quot; Lab where Lab.code in Common.&quot;Methadone Urine Tests&quot; Library Name Name sequence OpioidCDSREC10Common Positive Methadone Screenings In Lookback Period 60 define &quot;Positive Methadone Screenings In Lookback Period&quot;: GetPositiveLabsInLookbackPeriod(&quot;Methadone Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Negative Methadone Screenings In Lookback Period 61 define &quot;Negative Methadone Screenings In Lookback Period&quot;: GetNegativeLabsInLookbackPeriod(&quot;Methadone Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Methadone Rx In Lookback Period 62 define &quot;Methadone Rx In Lookback Period&quot;: &quot;Normalize Rx In Lookback Period&quot; Rx where Rx.medication in Common.&quot;Methadone Medications&quot; Library Name Name sequence OpioidCDSREC10Common Opiate Simple Identifier 63 define &quot;Opiate Simple Identifier&quot;: 'Opiate' Library Name Name sequence OpioidCDSREC10Common Opiate Screenings In Lookback Period 64 // Opiates define &quot;Opiate Screenings In Lookback Period&quot;: if Config.&quot;Opiate Urine Screening Check Enabled&quot; then ( &quot;All Opioid or Non-opioid UDS in Lookback Period&quot; Lab where Lab.code in Common.&quot;General Opiate Urine Tests&quot; ) else null Library Name Name sequence OpioidCDSREC10Common Positive Opiate Screenings In Lookback Period 65 define &quot;Positive Opiate Screenings In Lookback Period&quot;: GetPositiveLabsInLookbackPeriod(&quot;Opiate Screenings In Lookback Period&quot;, Config.&quot;Opiate Urine Screening Check Enabled&quot;) Library Name Name sequence OpioidCDSREC10Common Negative Opiate Screenings In Lookback Period 66 define &quot;Negative Opiate Screenings In Lookback Period&quot;: GetNegativeLabsInLookbackPeriod(&quot;Opiate Screenings In Lookback Period&quot;, Config.&quot;Opiate Urine Screening Check Enabled&quot;) Library Name Name sequence OpioidCDSREC10Common Opiate Rx In Lookback Period 67 define &quot;Opiate Rx In Lookback Period&quot;: &quot;Normalize Rx In Lookback Period&quot; Rx where Rx.medication in Common.&quot;Opiate Medications&quot; Library Name Name sequence OpioidCDSREC10Common Oxycodone Simple Identifier 68 define &quot;Oxycodone Simple Identifier&quot;: 'Oxycodone' Library Name Name sequence OpioidCDSREC10Common Oxycodone Screenings In Lookback Period 69 // Oxycodone define &quot;Oxycodone Screenings In Lookback Period&quot;: if Config.&quot;Opiate Urine Screening Check Enabled&quot; then ( &quot;All Opioid or Non-opioid UDS in Lookback Period&quot; Lab where Lab.code in Common.&quot;Oxycodone Urine Tests&quot; ) else null Library Name Name sequence OpioidCDSREC10Common Positive Oxycodone Screenings In Lookback Period 70 define &quot;Positive Oxycodone Screenings In Lookback Period&quot;: GetPositiveLabsInLookbackPeriod(&quot;Oxycodone Screenings In Lookback Period&quot;, Config.&quot;Opiate Urine Screening Check Enabled&quot;) Library Name Name sequence OpioidCDSREC10Common Negative Oxycodone Screenings In Lookback Period 71 define &quot;Negative Oxycodone Screenings In Lookback Period&quot;: GetNegativeLabsInLookbackPeriod(&quot;Oxycodone Screenings In Lookback Period&quot;, Config.&quot;Opiate Urine Screening Check Enabled&quot;) Library Name Name sequence OpioidCDSREC10Common Oxycodone Rx In Lookback Period 72 define &quot;Oxycodone Rx In Lookback Period&quot;: &quot;Normalize Rx In Lookback Period&quot; Rx where Rx.medication in Common.&quot;Oxycodone Medications&quot; Library Name Name sequence OpioidCDSREC10Common PCP Simple Identifier 73 define &quot;PCP Simple Identifier&quot;: 'Phencyclidine (PCP)' Library Name Name sequence OpioidCDSREC10Common PCP Screenings In Lookback Period 74 // PCP define &quot;PCP Screenings In Lookback Period&quot;: &quot;All Opioid or Non-opioid UDS in Lookback Period&quot; AllLabs where AllLabs.code in Common.&quot;PCP Urine Tests&quot; Library Name Name sequence OpioidCDSREC10Common Positive PCP Screenings In Lookback Period 75 define &quot;Positive PCP Screenings In Lookback Period&quot;: GetPositiveLabsInLookbackPeriod(&quot;PCP Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Negative PCP Screenings In Lookback Period 76 define &quot;Negative PCP Screenings In Lookback Period&quot;: GetNegativeLabsInLookbackPeriod(&quot;PCP Screenings In Lookback Period&quot;, true) Library Name Name sequence OpioidCDSREC10Common Unexpected Details 77 // Details Logic define &quot;Unexpected Details&quot;: { CreateDetailWithPossibleUnexpectedNegative( &quot;Amphetamine Simple Identifier&quot;, &quot;Positive Amphetamine Screenings In Lookback Period&quot;, &quot;Negative Amphetamine Screenings In Lookback Period&quot;, &quot;Amphetamine Rx In Lookback Period&quot; ), CreateDetailWithPossibleUnexpectedNegative( &quot;Barbiturate Simple Identifier&quot;, &quot;Positive Barbiturate Screenings In Lookback Period&quot;, &quot;Negative Barbiturate Screenings In Lookback Period&quot;, &quot;Barbiturate Rx In Lookback Period&quot; ), CreateDetailWithPossibleUnexpectedNegative( &quot;Benzodiazepine Simple Identifier&quot;, &quot;Positive Benzodiazepine Screenings In Lookback Period&quot;, &quot;Negative Benzodiazepine Screenings In Lookback Period&quot;, &quot;Benzodiazepine Rx In Lookback Period&quot; ), CreateDetailWithPossibleUnexpectedNegative( &quot;Buprenorphine Simple Identifier&quot;, &quot;Positive Buprenorphine Screenings In Lookback Period&quot;, &quot;Negative Buprenorphine Screenings In Lookback Period&quot;, &quot;Buprenorphine Rx In Lookback Period&quot; ), CreateDetailWithoutPossibleUnexpectedNegative( &quot;Cannabinoid Simple Identifier&quot;, &quot;Positive Cannabinoid Screenings In Lookback Period&quot;, &quot;Negative Cannabinoid Screenings In Lookback Period&quot; ), CreateDetailWithoutPossibleUnexpectedNegative( &quot;Cocaine Simple Identifier&quot;, &quot;Positive Cocaine Screenings In Lookback Period&quot;, &quot;Negative Cocaine Screenings In Lookback Period&quot; ), CreateDetailWithPossibleUnexpectedNegative( &quot;Fentanyl Simple Identifier&quot;, &quot;Positive Fentanyl Screenings In Lookback Period&quot;, &quot;Negative Fentanyl Screenings In Lookback Period&quot;, &quot;Fentanyl Rx In Lookback Period&quot; ), CreateDetailWithoutPossibleUnexpectedNegative( &quot;Heroin Simple Identifier&quot;, &quot;Positive Heroin Screenings In Lookback Period&quot;, &quot;Negative Heroin Screenings In Lookback Period&quot; ), CreateDetailWithPossibleUnexpectedNegative( &quot;Methadone Simple Identifier&quot;, &quot;Positive Methadone Screenings In Lookback Period&quot;, &quot;Negative Methadone Screenings In Lookback Period&quot;, &quot;Methadone Rx In Lookback Period&quot; ), CreateDetailWithPossibleUnexpectedNegative( &quot;Opiate Simple Identifier&quot;, &quot;Positive Opiate Screenings In Lookback Period&quot;, &quot;Negative Opiate Screenings In Lookback Period&quot;, &quot;Opiate Rx In Lookback Period&quot; ), CreateDetailWithPossibleUnexpectedNegative( &quot;Oxycodone Simple Identifier&quot;, &quot;Positive Oxycodone Screenings In Lookback Period&quot;, &quot;Negative Oxycodone Screenings In Lookback Period&quot;, &quot;Oxycodone Rx In Lookback Period&quot; ), CreateDetailWithoutPossibleUnexpectedNegative( &quot;PCP Simple Identifier&quot;, &quot;Positive PCP Screenings In Lookback Period&quot;, &quot;Negative PCP Screenings In Lookback Period&quot; ) } Library Name Name sequence OpioidCDSREC10Common Remove Substances Without Positive or Negative Results 78 define &quot;Remove Substances Without Positive or Negative Results&quot;: &quot;Unexpected Details&quot; Details where (Details.posDates is not null and Length(Details.posDates) != 0) or (Details.negDates is not null and Length(Details.negDates) != 0) Library Name Name sequence OpioidCDSREC10Common Inclusion Criteria For Unexpected Results 79 define &quot;Inclusion Criteria For Unexpected Results&quot;: AnyTrue( &quot;Remove Substances Without Positive or Negative Results&quot; Details return (exists Details.unexpectedPosDetails) or (exists Details.unexpectedNegDetails) ) Library Name Name sequence OpioidCDSREC10OrderSign Applicable Because of Unexpected Results 80 define &quot;Applicable Because of Unexpected Results&quot;: &quot;Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential&quot; and Rec10Common.&quot;Inclusion Criteria For Unexpected Results&quot; and not Rec10Common.&quot;Exclusion Criteria&quot; Library Name Name sequence OpioidCDSCommon Style Header 81 define &quot;Style Header&quot;: '&lt;style&gt;\r\n .alert-body {\r\n width: 670px;\r\n font-family: segoe-ui, sans-serif;\r\n background-color: #FEFFF1;\r\n }\r\n\r\n .details-table {\r\n border-collapse:collapse;\r\n border-style: ridge;\r\n background-color: #FEFFF1;\r\n padding: 2px;\r\n }\r\n\r\n .details-caption {\r\n border-style: ridge;\r\n border-bottom: none;\r\n background-color: #FEFFF1;\r\n padding: 2px;\r\n }\r\n\r\n .details-table-header {\r\n border-style: ridge;\r\n padding: 5px;\r\n }\r\n\r\n .details-table-cell {\r\n border-style: ridge;\r\n padding: 5px;\r\n }\r\n\r\n .details-table-footer-cell {\r\n border-style: ridge;\r\n padding: 5px;\r\n font-size: small;\r\n }\r\n\r\n .details-table-cell-unexpected {\r\n border-style: ridge;\r\n padding: 5px;\r\n color: red;\r\n font-weight: bold;\r\n }\r\n\r\n .more-text {\r\n position: relative;\r\n margin-bottom: 2em;\r\n }\r\n \r\n .more {\r\n display:none;\r\n }\r\n\r\n .show-more:checked + .more {\r\n display:block;\r\n }\r\n&lt;\/style&gt;' Library Name Name sequence OpioidCDSREC10Common Unexpected Div Start 82 define &quot;Unexpected Div Start&quot;: '&lt;div class=\&quot;alert-body\&quot;&gt;&lt;div&gt;&lt;p&gt;Patient may have &lt;strong&gt;unexpected urine toxicology test results&lt;\/strong&gt; in the past year.&lt;\/p&gt;&lt;\/div&gt;' Library Name Name sequence OpioidCDSREC10Common Table Start 83 define &quot;Table Start&quot;: '&lt;div&gt;&lt;table class=\&quot;details-table\&quot;&gt;&lt;caption class=\&quot;details-caption\&quot;&gt;Urine Toxicology Results&lt;\/caption&gt;&lt;tr&gt;&lt;th class=\&quot;details-table-header\&quot;&gt;Substance&lt;\/th&gt;' Library Name Name sequence OpioidCDSREC10Common All Lab Dates in Lookback Period 84 // Helpers define &quot;All Lab Dates in Lookback Period&quot;: ( &quot;All Opioid or Non-opioid UDS in Lookback Period&quot; Lab return date from Lab.effective ) X sort desc Library Name Name sequence OpioidCDSREC10Common Table Headers 85 define &quot;Table Headers&quot;: &quot;All Lab Dates in Lookback Period&quot; LabDate return '&lt;th class=\&quot;details-table-header\&quot;&gt;' &amp; ToString(LabDate) &amp; '&lt;\/th&gt;' Library Name Name sequence OpioidCDSREC10Common Generate Table Rows 86 define &quot;Generate Table Rows&quot;: &quot;Remove Substances Without Positive or Negative Results&quot; BOT let row: ToString(IndexOf(&quot;Remove Substances Without Positive or Negative Results&quot;, BOT) + 1) return '&lt;tr&gt;' + GetExpectedColumn(BOT.ingredient) + Combine( &quot;All Lab Dates in Lookback Period&quot; LabDate let col: ToString(IndexOf(&quot;All Lab Dates in Lookback Period&quot;, LabDate) + 2) return all ( if BOT.unexpectedPosDetails.date contains LabDate then GetUnexpectedColumn('pos', row &amp; ':' &amp; col) else if BOT.unexpectedNegDetails.udsDate contains LabDate then GetUnexpectedColumn('neg', row &amp; ':' &amp; col) else if BOT.posDates contains LabDate then GetExpectedColumn('pos*') else if BOT.negDates contains LabDate then GetExpectedColumn('neg*') else GetExpectedColumn('n/a') ) ) + '&lt;\/tr&gt;' Library Name Name sequence OpioidCDSREC10Common Generate Footer Rows 87 define &quot;Generate Footer Rows&quot;: &quot;Remove Substances Without Positive or Negative Results&quot; BOT let row: ToString(IndexOf(&quot;Remove Substances Without Positive or Negative Results&quot;, BOT) + 1), colspan: Length(&quot;All Lab Dates in Lookback Period&quot;) + 1 return Combine( &quot;All Lab Dates in Lookback Period&quot; LabDate let col: ToString(IndexOf(&quot;All Lab Dates in Lookback Period&quot;, LabDate) + 2) return all ( if BOT.unexpectedPosDetails.date contains LabDate then Coalesce( BOT.unexpectedPosDetails PosDetail where PosDetail.date same day as LabDate return '&lt;tr&gt;' &amp; GetFooterColumn(colspan, row &amp; ':' &amp; col &amp; ' - Possible unexpected substance found: ' &amp; PosDetail.udsDetail) &amp; '&lt;\/tr&gt;' ) else if BOT.unexpectedNegDetails.udsDate contains LabDate then Coalesce( BOT.unexpectedNegDetails NegDetail where NegDetail.udsDate same day as LabDate return '&lt;tr&gt;' &amp; GetFooterColumn(colspan, row + ':' &amp; col &amp; ' - Possible unexpected negative result found: prescribed ' &amp; NegDetail.rxDetail &amp; ' on ' &amp; ToString(NegDetail.rxDate)) &amp; '&lt;\/tr&gt;' ) else '' ) ) Library Name Name sequence OpioidCDSREC10Common Table End 88 define &quot;Table End&quot;: '&lt;\/table&gt;&lt;\/div&gt;' Library Name Name sequence OpioidCDSREC10Common Details Table 89 define &quot;Details Table&quot;: &quot;Table Start&quot; &amp; Combine(&quot;Table Headers&quot;) &amp; '&lt;tbody&gt;' &amp; Combine(&quot;Generate Table Rows&quot;) &amp; '&lt;/tbody&gt;' &amp; '&lt;tfoot&gt;' &amp; Combine(&quot;Generate Footer Rows&quot;) &amp; '&lt;\/tfoot&gt;' &amp; &quot;Table End&quot; Library Name Name sequence OpioidCDSREC10Common Expected Result Footnote 90 define &quot;Expected Result Footnote&quot;: '&lt;div&gt;* - These are expected results based on an analysis of the patient\'s medication list 30 days prior to the corresponding lab results.&lt;\/div&gt;' Library Name Name sequence OpioidCDSREC10Common Details More Info 91 define &quot;Details More Info&quot;: '&lt;div id=\&quot;box\&quot;&gt;\r\n &lt;p&gt;Note on false positives and unexpected negative results...&lt;\/p&gt;\r\n &lt;input type=\&quot;checkbox\&quot; class=\&quot;show-more\&quot;&gt; Show more\r\n &lt;div class=\&quot;more\&quot;&gt;\r\n &lt;p&gt;An unexpectedly negative test may be due to time since last dose, diversion, intermittent use, aberrant drug use behavior, or other factors, including a false negative result. Clinicians should interpret this result in the context of the overall treatment plan.&lt;\/p&gt;\r\n\r\n &lt;p&gt;Positive results may be a false positives or could represent occasional use or possible substance use disorder.&lt;br\/&gt;&lt;br\/&gt;For a review regarding interpreting possible false positive urine toxicology results, see &lt;a target=\&quot;_blank\&quot; href=\&quot;https:\/\/pubmed.ncbi.nlm.nih.gov\/24986836\&quot;&gt;http:\/\/pubmed.ncbi.nlm.nih.gov\/24986836&lt;\/a&gt;. It is unknown if the findings reported in this article can be extrapolated to other laboratory analyzers that were not used in the referenced studies.&lt;br\/&gt;&lt;br\/&gt;For guidance regarding evaluating and addressing unexpected toxicology tests results, see &lt;a target=\&quot;_blank\&quot; href=\&quot;https:\/\/www.cdc.gov\/mmwr\/volumes\/71\/rr\/rr7103a1.htm#Recommendation10\&quot;&gt;Recommendation 10 of the 22 CDC Clinical Practice Guideiline&lt;\/a&gt;.&lt;\/p&gt;&lt;\/div&gt;\r\n&lt;\/div&gt;' Library Name Name sequence OpioidCDSREC10Common Div End 92 define &quot;Div End&quot;: '&lt;\/div&gt;' Library Name Name sequence OpioidCDSREC10Common Get HTML Details 93 // HTML Generation define &quot;Get HTML Details&quot;: Common.&quot;Style Header&quot; &amp; &quot;Unexpected Div Start&quot; &amp; &quot;Details Table&quot; &amp; &quot;Expected Result Footnote&quot; &amp; &quot;Details More Info&quot; &amp; &quot;Div End&quot; Library Name Name sequence OpioidCDSREC10OrderSign Detail 94 define &quot;Detail&quot;: Rec10Common.&quot;Get HTML Details&quot; Knowledge Capability: shareable computable executable publishable Use Context: code value display focus 182888003 Medication requested (situation) focus 82423001 Chronic pain (finding) focus Purpose: 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. Usage: Before starting opioids and periodically (at least annually) during opioid therapy, clinicians should consider the benefits and risks of toxicology testing to assess for prescribed opioids and other prescription and nonprescription controlled substances that increase risk for overdose when combined with opioids, including nonprescribed and illicit opioids and benzodiazepines. Copyright: © CDC 2016+. Related Artifacts: Documentation 2022 CDC Clinical Practice Guideline for Prescribing Opioids for Pain Libraries: Library - Recommendation #10 - Urine Drug Testing Actions: Consider the Benefits and Risks of Conducting a Urine Toxicology Screen: Consider the benefits and risks of toxicology testing to assess for prescribed medications as well as other prescribed and nonprescribed controlled substances.#xD; #xD; For guidance regarding utilizing toxicology tests when prescribing opioids, see [Recommendation 10 of the 2022 CDC Clinical Practice Guideline](https://www.cdc.gov/mmwr/volumes/71/rr/rr7103a1.htm#Recommendation10). When: Named Event: order-sign If: Applicability: Patient has not had a urine screening in the past 12 months (Is Perform Drug Screen Recommendation Applicable?) Then: UDS 1 : Then: Definition: ActivityDefinition[http://fhir.org/guides/cdc/opioid-cds/ActivityDefinition/opioidcds-urine-screening-request-1|2022.1.0] UDS 2 : Then: Definition: ActivityDefinition[http://fhir.org/guides/cdc/opioid-cds/ActivityDefinition/opioidcds-urine-screening-request-2|2022.1.0] Patient May Have Unexpected Toxicology Test Results: Patient may have unexpected urine toxicology test results in the past year When: Named Event: order-sign If: Applicability: Patient may have unexpected urine toxicology test results in the past year (Applicable Because of Unexpected Results) Then: Dynamic Values: action.description: (Detail)
Value set Opioid analgesics with ambulatory misuse potential
Value set Encounter Diagnosis Condition Category
Value set Problem List Condition Category
Value set US Core Health Concern Condition Category
Value set Limited life expectancy conditions
Value set Conditions likely terminal for opioid prescribing
Is Perform Drug Screen Recommendation Applicable?
Applicable Because of Unexpected Results
Subacute or Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions
define "Subacute or 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 )
Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential
define "Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential": exists( "Subacute or Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions" )
define "Patient Age Less Than 18": if (Config."Age Less than 18 Years Is Enabled") then AgeInYearsAt(Today()) < 18 else false
define "Condition Positive for Sickle Cell": if (Config."Sickle Cell Check Enabled") then exists( Common."Positive Sickle Cell Condition" ) else false
// 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"]
Conditions Indicating End Of Life Present
define "Conditions Indicating End Of Life Present": exists ( Common."US Core-Categorized Conditions" LLEC where LLEC.code in Common."Limited life expectancy conditions" and LLEC.clinicalStatus in Common."Active Condition" )
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" else false
Conditions Including Cancer To Exclude Opioid Management Indicating End-Stage Disease Present
define "Conditions Including Cancer To Exclude Opioid Management Indicating End-Stage Disease Present": 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
define "Is Opioid Review Useful?": not "Patient Age Less Than 18" and not "Condition Positive for Sickle Cell" and not "Conditions Indicating End Of Life Present" and not "Is Active Cancer Treatment?" and not "Conditions Including Cancer To Exclude Opioid Management Indicating End-Stage Disease Present"
Inclusion Criteria For UDS Recommendation
/* @description: Determines whether an opioid review is appropriate for the patient and whether they had a UDS performed in the past year */ define "Inclusion Criteria For UDS Recommendation": Routines."Is Opioid Review Useful?" and not exists ( if Config."Use Alternative UDS Lookback Period" then "All Opioid or Non-opioid UDS in Alternative Lookback Period" else "All Opioid or Non-opioid UDS in Lookback Period" )
Conditions Indicating End of Life or With Limited Life Expectancy
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" )
Admitted/Referred/Discharged to Hospice Care
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' } )
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" )
define "Exclusion Criteria": Common."End of Life Assessment"
define "Is Perform Drug Screen Recommendation Applicable?": "Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential" and Rec10Common."Inclusion Criteria For UDS Recommendation" and not Rec10Common."Exclusion Criteria"
define "Amphetamine Simple Identifier": 'Amphetamine'
// Constants define "UDS Lookback Period": Interval[Today() - 12 months - 1 days, Today()]
All Opioid or Non-opioid UDS in Lookback Period
define "All Opioid or Non-opioid UDS in Lookback Period": ( [Observation: Common."All Drug Urine Screening"] Lab where date from Lab.effective in day of "UDS Lookback Period" and not ( Lab.status in { 'unknown', 'entered-in-error', 'cancelled' } ) ) X sort by date from effective desc
Amphetamine Screenings In Lookback Period
// Amphetamines define "Amphetamine Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Amphetamine Urine Tests"
Positive Amphetamine Screenings In Lookback Period
define "Positive Amphetamine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Amphetamine Screenings In Lookback Period", true)
Negative Amphetamine Screenings In Lookback Period
define "Negative Amphetamine Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Amphetamine Screenings In Lookback Period", true)
define "Rx Lookback Period": Interval[Today() - 12 months - 31 days, Today()]
define "Normalize Rx In Lookback Period": Common."Get MedicationRequest Medication as Code"( [MedicationRequest: category in Common."Community"] Rx where Rx.status in { 'active', 'completed', 'stopped' } and Rx.intent = 'order' and date from Rx.authoredOn in day of "Rx Lookback Period" )
define "Amphetamine Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Amphetamine Medications"
define "Barbiturate Simple Identifier": 'Barbiturate'
Barbiturate Screenings In Lookback Period
// Barbiturates define "Barbiturate Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Barbiturate Urine Tests"
Positive Barbiturate Screenings In Lookback Period
define "Positive Barbiturate Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Barbiturate Screenings In Lookback Period", true)
Negative Barbiturate Screenings In Lookback Period
define "Negative Barbiturate Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Barbiturate Screenings In Lookback Period", true)
define "Barbiturate Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Barbiturate Medications"
define "Benzodiazepine Simple Identifier": 'Benzodiazepine'
Benzodiazepine Screenings In Lookback Period
// Benzodiazepines define "Benzodiazepine Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Benzodiazepine Urine Tests"
Positive Benzodiazepine Screenings In Lookback Period
define "Positive Benzodiazepine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Benzodiazepine Screenings In Lookback Period", true)
Negative Benzodiazepine Screenings In Lookback Period
define "Negative Benzodiazepine Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Benzodiazepine Screenings In Lookback Period", true)
define "Benzodiazepine Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Benzodiazepine medications"
define "Buprenorphine Simple Identifier": 'Buprenorphine'
Buprenorphine Screenings In Lookback Period
// Buprenorphine define "Buprenorphine Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Buprenorphine Urine Tests"
Positive Buprenorphine Screenings In Lookback Period
define "Positive Buprenorphine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Buprenorphine Screenings In Lookback Period", true)
Negative Buprenorphine Screenings In Lookback Period
define "Negative Buprenorphine Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Buprenorphine Screenings In Lookback Period", true)
define "Buprenorphine Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Buprenorphine Medications"
define "Cannabinoid Simple Identifier": 'Cannabinoid'
Cannabinoid Screenings In Lookback Period
// Cannabinoids define "Cannabinoid Screenings In Lookback Period": if Config."Cannabinoid Urine Screening Check Enabled" then ( "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Cannabinoid Urine Tests" ) else null
Cannabinoid Urine Screening Check Enabled
define "Cannabinoid Urine Screening Check Enabled": false
Positive Cannabinoid Screenings In Lookback Period
define "Positive Cannabinoid Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Cannabinoid Screenings In Lookback Period", Config."Cannabinoid Urine Screening Check Enabled")
Negative Cannabinoid Screenings In Lookback Period
define "Negative Cannabinoid Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Cannabinoid Screenings In Lookback Period", Config."Cannabinoid Urine Screening Check Enabled")
define "Cocaine Simple Identifier": 'Cocaine'
// Cocaine define "Cocaine Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Cocaine Urine Tests"
Positive Cocaine Screenings In Lookback Period
define "Positive Cocaine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Cocaine Screenings In Lookback Period", true)
Negative Cocaine Screenings In Lookback Period
define "Negative Cocaine Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Cocaine Screenings In Lookback Period", true)
define "Fentanyl Simple Identifier": 'Fentanyl'
// Fentanyl define "Fentanyl Screenings In Lookback Period": if Config."Opiate Urine Screening Check Enabled" then ( "All Opioid or Non-opioid UDS in Lookback Period" AllLabs where AllLabs.code in Common."Fentanyl Urine Tests" ) else null
// Recommendation 10 define "Opiate Urine Screening Check Enabled": true
Positive Fentanyl Screenings In Lookback Period
define "Positive Fentanyl Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Fentanyl Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
Negative Fentanyl Screenings In Lookback Period
define "Negative Fentanyl Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Fentanyl Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
define "Fentanyl Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Fentanyl Medications"
define "Heroin Simple Identifier": 'Heroin (6-AM)'
// Heroin define "Heroin Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Heroin Urine Tests"
Positive Heroin Screenings In Lookback Period
define "Positive Heroin Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Heroin Screenings In Lookback Period", true)
Negative Heroin Screenings In Lookback Period
define "Negative Heroin Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Heroin Screenings In Lookback Period", true)
define "Methadone Simple Identifier": 'Methadone'
// Methadone define "Methadone Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Methadone Urine Tests"
Positive Methadone Screenings In Lookback Period
define "Positive Methadone Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Methadone Screenings In Lookback Period", true)
Negative Methadone Screenings In Lookback Period
define "Negative Methadone Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Methadone Screenings In Lookback Period", true)
define "Methadone Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Methadone Medications"
define "Opiate Simple Identifier": 'Opiate'
// Opiates define "Opiate Screenings In Lookback Period": if Config."Opiate Urine Screening Check Enabled" then ( "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."General Opiate Urine Tests" ) else null
Positive Opiate Screenings In Lookback Period
define "Positive Opiate Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Opiate Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
Negative Opiate Screenings In Lookback Period
define "Negative Opiate Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Opiate Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
define "Opiate Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Opiate Medications"
define "Oxycodone Simple Identifier": 'Oxycodone'
// Oxycodone define "Oxycodone Screenings In Lookback Period": if Config."Opiate Urine Screening Check Enabled" then ( "All Opioid or Non-opioid UDS in Lookback Period" Lab where Lab.code in Common."Oxycodone Urine Tests" ) else null
Positive Oxycodone Screenings In Lookback Period
define "Positive Oxycodone Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Oxycodone Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
Negative Oxycodone Screenings In Lookback Period
define "Negative Oxycodone Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Oxycodone Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
define "Oxycodone Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Oxycodone Medications"
define "PCP Simple Identifier": 'Phencyclidine (PCP)'
// PCP define "PCP Screenings In Lookback Period": "All Opioid or Non-opioid UDS in Lookback Period" AllLabs where AllLabs.code in Common."PCP Urine Tests"
Positive PCP Screenings In Lookback Period
define "Positive PCP Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("PCP Screenings In Lookback Period", true)
Negative PCP Screenings In Lookback Period
define "Negative PCP Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("PCP Screenings In Lookback Period", true)
// Details Logic define "Unexpected Details": { CreateDetailWithPossibleUnexpectedNegative( "Amphetamine Simple Identifier", "Positive Amphetamine Screenings In Lookback Period", "Negative Amphetamine Screenings In Lookback Period", "Amphetamine Rx In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Barbiturate Simple Identifier", "Positive Barbiturate Screenings In Lookback Period", "Negative Barbiturate Screenings In Lookback Period", "Barbiturate Rx In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Benzodiazepine Simple Identifier", "Positive Benzodiazepine Screenings In Lookback Period", "Negative Benzodiazepine Screenings In Lookback Period", "Benzodiazepine Rx In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Buprenorphine Simple Identifier", "Positive Buprenorphine Screenings In Lookback Period", "Negative Buprenorphine Screenings In Lookback Period", "Buprenorphine Rx In Lookback Period" ), CreateDetailWithoutPossibleUnexpectedNegative( "Cannabinoid Simple Identifier", "Positive Cannabinoid Screenings In Lookback Period", "Negative Cannabinoid Screenings In Lookback Period" ), CreateDetailWithoutPossibleUnexpectedNegative( "Cocaine Simple Identifier", "Positive Cocaine Screenings In Lookback Period", "Negative Cocaine Screenings In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Fentanyl Simple Identifier", "Positive Fentanyl Screenings In Lookback Period", "Negative Fentanyl Screenings In Lookback Period", "Fentanyl Rx In Lookback Period" ), CreateDetailWithoutPossibleUnexpectedNegative( "Heroin Simple Identifier", "Positive Heroin Screenings In Lookback Period", "Negative Heroin Screenings In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Methadone Simple Identifier", "Positive Methadone Screenings In Lookback Period", "Negative Methadone Screenings In Lookback Period", "Methadone Rx In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Opiate Simple Identifier", "Positive Opiate Screenings In Lookback Period", "Negative Opiate Screenings In Lookback Period", "Opiate Rx In Lookback Period" ), CreateDetailWithPossibleUnexpectedNegative( "Oxycodone Simple Identifier", "Positive Oxycodone Screenings In Lookback Period", "Negative Oxycodone Screenings In Lookback Period", "Oxycodone Rx In Lookback Period" ), CreateDetailWithoutPossibleUnexpectedNegative( "PCP Simple Identifier", "Positive PCP Screenings In Lookback Period", "Negative PCP Screenings In Lookback Period" ) }
Remove Substances Without Positive or Negative Results
define "Remove Substances Without Positive or Negative Results": "Unexpected Details" Details where (Details.posDates is not null and Length(Details.posDates) != 0) or (Details.negDates is not null and Length(Details.negDates) != 0)
Inclusion Criteria For Unexpected Results
define "Inclusion Criteria For Unexpected Results": AnyTrue( "Remove Substances Without Positive or Negative Results" Details return (exists Details.unexpectedPosDetails) or (exists Details.unexpectedNegDetails) )
define "Applicable Because of Unexpected Results": "Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential" and Rec10Common."Inclusion Criteria For Unexpected Results" and not Rec10Common."Exclusion Criteria"
define "Style Header": ' \r\n .alert-body {\r\n width: 670px;\r\n font-family: segoe-ui, sans-serif;\r\n background-color: #FEFFF1;\r\n }\r\n\r\n .details-table {\r\n border-collapse:collapse;\r\n border-style: ridge;\r\n background-color: #FEFFF1;\r\n padding: 2px;\r\n }\r\n\r\n .details-caption {\r\n border-style: ridge;\r\n border-bottom: none;\r\n background-color: #FEFFF1;\r\n padding: 2px;\r\n }\r\n\r\n .details-table-header {\r\n border-style: ridge;\r\n padding: 5px;\r\n }\r\n\r\n .details-table-cell {\r\n border-style: ridge;\r\n padding: 5px;\r\n }\r\n\r\n .details-table-footer-cell {\r\n border-style: ridge;\r\n padding: 5px;\r\n font-size: small;\r\n }\r\n\r\n .details-table-cell-unexpected {\r\n border-style: ridge;\r\n padding: 5px;\r\n color: red;\r\n font-weight: bold;\r\n }\r\n\r\n .more-text {\r\n position: relative;\r\n margin-bottom: 2em;\r\n }\r\n \r\n .more {\r\n display:none;\r\n }\r\n\r\n .show-more:checked + .more {\r\n display:block;\r\n }\r\n<\/style>'
define "Unexpected Div Start": ' Patient may have unexpected urine toxicology test results<\/strong> in the past year.<\/p><\/div>'
define "Table Start": ' Urine Toxicology Results<\/caption> Substance<\/th>'
// Helpers define "All Lab Dates in Lookback Period": ( "All Opioid or Non-opioid UDS in Lookback Period" Lab return date from Lab.effective ) X sort desc
define "Table Headers": "All Lab Dates in Lookback Period" LabDate return ' ' & ToString(LabDate) & '<\/th>'
define "Generate Table Rows": "Remove Substances Without Positive or Negative Results" BOT let row: ToString(IndexOf("Remove Substances Without Positive or Negative Results", BOT) + 1) return ' ' + GetExpectedColumn(BOT.ingredient) + Combine( "All Lab Dates in Lookback Period" LabDate let col: ToString(IndexOf("All Lab Dates in Lookback Period", LabDate) + 2) return all ( if BOT.unexpectedPosDetails.date contains LabDate then GetUnexpectedColumn('pos', row & ':' & col) else if BOT.unexpectedNegDetails.udsDate contains LabDate then GetUnexpectedColumn('neg', row & ':' & col) else if BOT.posDates contains LabDate then GetExpectedColumn('pos*') else if BOT.negDates contains LabDate then GetExpectedColumn('neg*') else GetExpectedColumn('n/a') ) ) + '<\/tr>'
define "Generate Footer Rows": "Remove Substances Without Positive or Negative Results" BOT let row: ToString(IndexOf("Remove Substances Without Positive or Negative Results", BOT) + 1), colspan: Length("All Lab Dates in Lookback Period") + 1 return Combine( "All Lab Dates in Lookback Period" LabDate let col: ToString(IndexOf("All Lab Dates in Lookback Period", LabDate) + 2) return all ( if BOT.unexpectedPosDetails.date contains LabDate then Coalesce( BOT.unexpectedPosDetails PosDetail where PosDetail.date same day as LabDate return ' ' & GetFooterColumn(colspan, row & ':' & col & ' - Possible unexpected substance found: ' & PosDetail.udsDetail) & '<\/tr>' ) else if BOT.unexpectedNegDetails.udsDate contains LabDate then Coalesce( BOT.unexpectedNegDetails NegDetail where NegDetail.udsDate same day as LabDate return ' ' & GetFooterColumn(colspan, row + ':' & col & ' - Possible unexpected negative result found: prescribed ' & NegDetail.rxDetail & ' on ' & ToString(NegDetail.rxDate)) & '<\/tr>' ) else '' ) )
define "Table End": '<\/table><\/div>'
define "Details Table": "Table Start" & Combine("Table Headers") & ' ' & Combine("Generate Table Rows") & ' ' & ' ' & Combine("Generate Footer Rows") & '<\/tfoot>' & "Table End"
define "Expected Result Footnote": ' * - These are expected results based on an analysis of the patient\'s medication list 30 days prior to the corresponding lab results.<\/div>'
define "Details More Info": ' \r\n Note on false positives and unexpected negative results...<\/p>\r\n Show more\r\n \r\n An unexpectedly negative test may be due to time since last dose, diversion, intermittent use, aberrant drug use behavior, or other factors, including a false negative result. Clinicians should interpret this result in the context of the overall treatment plan.<\/p>\r\n\r\n Positive results may be a false positives or could represent occasional use or possible substance use disorder.<br\/><br\/>For a review regarding interpreting possible false positive urine toxicology results, see http:\/\/pubmed.ncbi.nlm.nih.gov\/24986836<\/a>. It is unknown if the findings reported in this article can be extrapolated to other laboratory analyzers that were not used in the referenced studies.<br\/><br\/>For guidance regarding evaluating and addressing unexpected toxicology tests results, see Recommendation 10 of the 22 CDC Clinical Practice Guideiline<\/a>.<\/p><\/div>\r\n<\/div>'
// HTML Generation define "Get HTML Details": Common."Style Header" & "Unexpected Div Start" & "Details Table" & "Expected Result Footnote" & "Details More Info" & "Div End"
define "Detail": Rec10Common."Get HTML Details"
Recommendation #10 - Urine Drug Testing (order-sign)
Centers for Disease Control and Prevention (CDC)
When prescribing opioids for subacute or chronic pain, clinicians should consider the benefits and risks of toxicology testing to assess for prescribed medications as well as other prescribed and nonprescribed controlled substances.
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.
Before starting opioids and periodically (at least annually) during opioid therapy, clinicians should consider the benefits and risks of toxicology testing to assess for prescribed opioids and other prescription and nonprescription controlled substances that increase risk for overdose when combined with opioids, including nonprescribed and illicit opioids and benzodiazepines.
2022 CDC Clinical Practice Guideline for Prescribing Opioids for Pain
Consider the Benefits and Risks of Conducting a Urine Toxicology Screen
Consider the benefits and risks of toxicology testing to assess for prescribed medications as well as other prescribed and nonprescribed controlled substances. For guidance regarding utilizing toxicology tests when prescribing opioids, see [Recommendation 10 of the 2022 CDC Clinical Practice Guideline](https://www.cdc.gov/mmwr/volumes/71/rr/rr7103a1.htm#Recommendation10).
Patient has not had a urine screening in the past 12 months
Patient May Have Unexpected Toxicology Test Results
Patient may have unexpected urine toxicology test results in the past year