Id: OpioidCDSREC10Common Url: OpioidCDSREC10Common Version: 2022.1.0 Name: OpioidCDSREC10Common Status: draft Type: system: http://terminology.hl7.org/CodeSystem/library-type code: logic-library Date: 2026-01-27 18:30:23+0000 Publisher: Centers for Disease Control and Prevention (CDC) Related Artifacts: Dependencies http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1 FHIR Helpersversion: null4.0.1) Library - OpioidCDS Commonversion: null2022.1.0) Library - OpioidCDS Routinesversion: null2022.1.0) Library - OpioidCDS Common Configurationversion: null2022.1.0) Parameters: Name Type Min Max In/Out Patient Patient 0 1 Out UDS Lookback Period Period 0 1 Out Rx Lookback Period Period 0 1 Out Amphetamine Simple Identifier string 0 1 Out Barbiturate Simple Identifier string 0 1 Out Benzodiazepine Simple Identifier string 0 1 Out Buprenorphine Simple Identifier string 0 1 Out Cannabinoid Simple Identifier string 0 1 Out Cocaine Simple Identifier string 0 1 Out Fentanyl Simple Identifier string 0 1 Out Heroin Simple Identifier string 0 1 Out Methadone Simple Identifier string 0 1 Out Opiate Simple Identifier string 0 1 Out Oxycodone Simple Identifier string 0 1 Out PCP Simple Identifier string 0 1 Out All Opioid or Non-opioid UDS in Alternative Lookback Period Observation 0 * Out All Opioid or Non-opioid UDS in Lookback Period Observation 0 * Out Inclusion Criteria For UDS Recommendation boolean 0 1 Out Amphetamine Screenings In Lookback Period Observation 0 * Out Positive Amphetamine Screenings In Lookback Period Resource 0 * Out Negative Amphetamine Screenings In Lookback Period Resource 0 * Out Normalize Rx In Lookback Period MedicationRequest 0 * Out Amphetamine Rx In Lookback Period MedicationRequest 0 * Out Barbiturate Screenings In Lookback Period Observation 0 * Out Positive Barbiturate Screenings In Lookback Period Resource 0 * Out Negative Barbiturate Screenings In Lookback Period Resource 0 * Out Barbiturate Rx In Lookback Period MedicationRequest 0 * Out Benzodiazepine Screenings In Lookback Period Observation 0 * Out Positive Benzodiazepine Screenings In Lookback Period Resource 0 * Out Negative Benzodiazepine Screenings In Lookback Period Resource 0 * Out Benzodiazepine Rx In Lookback Period MedicationRequest 0 * Out Buprenorphine Screenings In Lookback Period Observation 0 * Out Positive Buprenorphine Screenings In Lookback Period Resource 0 * Out Negative Buprenorphine Screenings In Lookback Period Resource 0 * Out Buprenorphine Rx In Lookback Period MedicationRequest 0 * Out Cannabinoid Screenings In Lookback Period Observation 0 * Out Positive Cannabinoid Screenings In Lookback Period Resource 0 * Out Negative Cannabinoid Screenings In Lookback Period Resource 0 * Out Cocaine Screenings In Lookback Period Observation 0 * Out Positive Cocaine Screenings In Lookback Period Resource 0 * Out Negative Cocaine Screenings In Lookback Period Resource 0 * Out Fentanyl Screenings In Lookback Period Observation 0 * Out Positive Fentanyl Screenings In Lookback Period Resource 0 * Out Negative Fentanyl Screenings In Lookback Period Resource 0 * Out Fentanyl Rx In Lookback Period MedicationRequest 0 * Out Heroin Screenings In Lookback Period Observation 0 * Out Positive Heroin Screenings In Lookback Period Resource 0 * Out Negative Heroin Screenings In Lookback Period Resource 0 * Out Methadone Screenings In Lookback Period Observation 0 * Out Positive Methadone Screenings In Lookback Period Resource 0 * Out Negative Methadone Screenings In Lookback Period Resource 0 * Out Methadone Rx In Lookback Period MedicationRequest 0 * Out Opiate Screenings In Lookback Period Observation 0 * Out Positive Opiate Screenings In Lookback Period Resource 0 * Out Negative Opiate Screenings In Lookback Period Resource 0 * Out Opiate Rx In Lookback Period MedicationRequest 0 * Out Oxycodone Screenings In Lookback Period Observation 0 * Out Positive Oxycodone Screenings In Lookback Period Resource 0 * Out Negative Oxycodone Screenings In Lookback Period Resource 0 * Out Oxycodone Rx In Lookback Period MedicationRequest 0 * Out PCP Screenings In Lookback Period Observation 0 * Out Positive PCP Screenings In Lookback Period Resource 0 * Out Negative PCP Screenings In Lookback Period Resource 0 * Out Unexpected Details Resource 0 * Out Remove Substances Without Positive or Negative Results Resource 0 * Out Inclusion Criteria For Unexpected Results boolean 0 1 Out Exclusion Criteria boolean 0 1 Out All Lab Dates in Lookback Period date 0 * Out Unexpected Div Start string 0 1 Out Table Start string 0 1 Out Table Headers string 0 * Out Generate Table Rows string 0 * Out Generate Footer Rows string 0 * Out Table End string 0 1 Out Details Table string 0 1 Out Expected Result Footnote string 0 1 Out Details More Info string 0 1 Out Div End string 0 1 Out Get HTML Details string 0 1 Out Data Requirements: Type Profile MS Code Filter Patient http://hl7.org/fhir/StructureDefinition/Patient Observation http://hl7.org/fhir/StructureDefinition/Observation ;;;;; code filter: path: code value set: http://fhir.org/guides/cdc/opioid-cds/ValueSet/all-urine-drug-screening-tests MedicationRequest http://hl7.org/fhir/StructureDefinition/MedicationRequest ;;;;;; code filter: path: category value set: http://fhir.org/guides/cdc/opioid-cds/ValueSet/medicationrequest-category-community Content: text/cql library OpioidCDSREC10Common version '2022.1.0' using FHIR version '4.0.1' include FHIRHelpers version '4.0.1' called FHIRHelpers include OpioidCDSCommon version '2022.1.0' called Common include OpioidCDSRoutines version '2022.1.0' called Routines include OpioidCDSCommonConfig version '2022.1.0' called Config context Patient // Constants define "UDS Lookback Period": Interval[Today() - 12 months - 1 days, Today()] define "Rx Lookback Period": Interval[Today() - 12 months - 31 days, Today()] define "Amphetamine Simple Identifier": 'Amphetamine' define "Barbiturate Simple Identifier": 'Barbiturate' define "Benzodiazepine Simple Identifier": 'Benzodiazepine' define "Buprenorphine Simple Identifier": 'Buprenorphine' define "Cannabinoid Simple Identifier": 'Cannabinoid' define "Cocaine Simple Identifier": 'Cocaine' define "Fentanyl Simple Identifier": 'Fentanyl' define "Heroin Simple Identifier": 'Heroin (6-AM)' define "Methadone Simple Identifier": 'Methadone' define "Opiate Simple Identifier": 'Opiate' define "Oxycodone Simple Identifier": 'Oxycodone' define "PCP Simple Identifier": 'Phencyclidine (PCP)' /* @description: Determines whether the general inclusion criteria is met for the patient and whether they had a UDS performed in the past year */ define "Inclusion Criteria For UDS Recommendation": Routines."CDC 2022 Guideline General Inclusion Criteria" and not exists ( if Config."Use Alternative UDS Lookback Period" then "All Opioid or Non-opioid UDS in Alternative Lookback Period" else "All Opioid or Non-opioid UDS in Lookback Period" ) define "Inclusion Criteria For Unexpected Results": Routines."CDC 2022 Guideline General Inclusion Criteria" and AnyTrue( "Remove Substances Without Positive or Negative Results" Details return (exists Details.unexpectedPosDetails) or (exists Details.unexpectedNegDetails) ) define "Exclusion Criteria": Common."End of Life Assessment" define "All Opioid or Non-opioid UDS in Alternative Lookback Period": ( [Observation: Common."All Drug Urine Screening"] Lab where date from Lab.effective in day of Config."Alternative UDS Lookback Period" and not ( Lab.status in { 'unknown', 'entered-in-error', 'cancelled' } ) ) X sort by date from effective desc 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 // 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" define "Positive Amphetamine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Amphetamine Screenings In Lookback Period", true) define "Negative Amphetamine Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Amphetamine Screenings In Lookback Period", true) define "Amphetamine Rx In Lookback Period": "Normalize Rx In Lookback Period" Rx where Rx.medication in Common."Amphetamine Medications" // 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" define "Positive Barbiturate Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Barbiturate Screenings In Lookback Period", true) 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" // 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" define "Positive Benzodiazepine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Benzodiazepine Screenings In Lookback Period", true) 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" // 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" define "Positive Buprenorphine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Buprenorphine Screenings In Lookback Period", true) 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" // 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 define "Positive Cannabinoid Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Cannabinoid Screenings In Lookback Period", Config."Cannabinoid Urine Screening Check Enabled") define "Negative Cannabinoid Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Cannabinoid Screenings In Lookback Period", Config."Cannabinoid Urine Screening Check Enabled") // 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" define "Positive Cocaine Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Cocaine Screenings In Lookback Period", true) define "Negative Cocaine Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Cocaine Screenings In Lookback Period", true) // 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 define "Positive Fentanyl Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Fentanyl Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled") 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" // 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" define "Positive Heroin Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Heroin Screenings In Lookback Period", true) define "Negative Heroin Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("Heroin Screenings In Lookback Period", true) // 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" define "Positive Methadone Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Methadone Screenings In Lookback Period", true) 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" // 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 define "Positive Opiate Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Opiate Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled") 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" // 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 define "Positive Oxycodone Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("Oxycodone Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled") 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" // 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" define "Positive PCP Screenings In Lookback Period": GetPositiveLabsInLookbackPeriod("PCP Screenings In Lookback Period", true) define "Negative PCP Screenings In Lookback Period": GetNegativeLabsInLookbackPeriod("PCP Screenings In Lookback Period", true) // 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 "Normalize Rx In Lookback Period": Common."Get MedicationRequest Medication as Code"( [MedicationRequest: category in Common."Community"] Rx where Rx.status in { 'active', 'completed', 'stopped' } and Rx.intent = 'order' and Common."GetDateFromMedicationRequest"(Rx) in day of "Rx Lookback Period" ) 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) // 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" ) } // HTML Generation define "Get HTML Details": Common."Style Header" & "Unexpected Div Start" & "Details Table" & "Expected Result Footnote" & "Details More Info" & "Div End" define "Unexpected Div Start": ' Patient may have unexpected urine toxicology test results<\/strong> in the past year.<\/p><\/div>' define "Details Table": "Table Start" & Combine("Table Headers") & ' ' & Combine("Generate Table Rows") & ' ' & ' ' & Combine("Generate Footer Rows") & '<\/tfoot>' & "Table End" define "Table Start": ' Urine Toxicology Results<\/caption> Substance<\/th>' 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 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>' 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 "Div End": '<\/div>' // Functions define function GetUnexpectedColumn(Result String, Superscript String): ' ' & Result & '' & Superscript & '<\/sup><\/td>' define function GetExpectedColumn(Content String): ' ' & Content & '<\/td>' define function GetFooterColumn(colspan Integer, message String): ' ' & message & '<\/td>' define function CreateDetailWithPossibleUnexpectedNegative(TheSubstance String, ThePosLabs List<Observation>, TheNegLabs List<Observation>, TheMeds List<MedicationRequest>): { ingredient: TheSubstance, posDates: ( ThePosLabs PosLab return date from PosLab.effective ), negDates: ( TheNegLabs NegLab return date from NegLab.effective ), unexpectedPosDetails: ( ThePosLabs PosLab where not exists ( TheMeds Rx where Common.GetDateFromMedicationRequest(Rx) in day of Interval[ date from PosLab.effective - 31 days, date from PosLab.effective - 1 days ] ) return { date: date from PosLab.effective, udsDetail: if exists(PosLab.code.coding) then PosLab.code.coding[0].display else 'Unable to determine a detailed identifier' } ), unexpectedNegDetails: ( from TheNegLabs NegLab, ( if exists(TheMeds) then TheMeds else { null as MedicationRequest } ) Rx let medDate: Common.GetDateFromMedicationRequest(Rx) where medDate in day of Interval[date from NegLab.effective - 31 days, date from NegLab.effective - 1 days] return { udsDate: date from NegLab.effective, udsDetail: if exists (NegLab.code.coding) then NegLab.code.coding[0].display else 'Unable to determine a detailed identifier', rxDate: medDate, rxDetail: if Rx.medication.text is not null then Rx.medication.text else if exists (Rx.medication.coding) and Rx.medication.coding[0].display is not null then Rx.medication.coding[0].display else 'Unable to determine a detailed identifier' } ) } define function CreateDetailWithoutPossibleUnexpectedNegative(TheSubstance String, ThePosLabs List<Observation>, TheNegLabs List<Observation>): { ingredient: TheSubstance, posDates: ( ThePosLabs PosLab return date from PosLab.effective ), negDates: ( TheNegLabs NegLab return date from NegLab.effective ), unexpectedPosDetails: ( ThePosLabs PosLab return { date: date from PosLab.effective, udsDetail: if exists (PosLab.code.coding) then PosLab.code.coding[0].display else 'Unable to determine a detailed identifier' } ), unexpectedNegDetails: { null as Tuple{ udsDate System.Date, udsDetail System.String, rxDate System.Date, rxDetail System.String } } } define function GetPositiveLabsInLookbackPeriod(Labs List<FHIR.Observation>, Enabled Boolean): if Enabled then Labs Lab where StartsWith(Lower(Lab.value as FHIR.string), 'pos') else {} define function GetNegativeLabsInLookbackPeriod(Labs List<FHIR.Observation>, Enabled Boolean): if Enabled then Labs Lab where StartsWith(Lower(Lab.value as FHIR.string), 'neg') else {} Content: application/elm+xml Encoded data (567688 characters) Content: application/elm+json Encoded data (1114016 characters)
Centers for Disease Control and Prevention (CDC)
All Opioid or Non-opioid UDS in Alternative Lookback Period
All Opioid or Non-opioid UDS in Lookback Period
Inclusion Criteria For UDS Recommendation
Amphetamine Screenings In Lookback Period
Positive Amphetamine Screenings In Lookback Period
Negative Amphetamine Screenings In Lookback Period
Barbiturate Screenings In Lookback Period
Positive Barbiturate Screenings In Lookback Period
Negative Barbiturate Screenings In Lookback Period
Benzodiazepine Screenings In Lookback Period
Positive Benzodiazepine Screenings In Lookback Period
Negative Benzodiazepine Screenings In Lookback Period
Buprenorphine Screenings In Lookback Period
Positive Buprenorphine Screenings In Lookback Period
Negative Buprenorphine Screenings In Lookback Period
Cannabinoid Screenings In Lookback Period
Positive Cannabinoid Screenings In Lookback Period
Negative Cannabinoid Screenings In Lookback Period
Positive Cocaine Screenings In Lookback Period
Negative Cocaine Screenings In Lookback Period
Positive Fentanyl Screenings In Lookback Period
Negative Fentanyl Screenings In Lookback Period
Positive Heroin Screenings In Lookback Period
Negative Heroin Screenings In Lookback Period
Positive Methadone Screenings In Lookback Period
Negative Methadone Screenings In Lookback Period
Positive Opiate Screenings In Lookback Period
Negative Opiate Screenings In Lookback Period
Positive Oxycodone Screenings In Lookback Period
Negative Oxycodone Screenings In Lookback Period
Positive PCP Screenings In Lookback Period
Negative PCP Screenings In Lookback Period
Remove Substances Without Positive or Negative Results
Inclusion Criteria For Unexpected Results