Library Name | Name | sequence |
OpioidCDSREC10OrderSign |
Subacute or Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions |
0 |
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 )
Library Name | Name | sequence |
OpioidCDSREC10OrderSign |
Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential |
1 |
define "Patient Is Being Prescribed Opioid Analgesic with Ambulatory Misuse Potential":
exists( "Subacute or Chronic Pain Opioid Analgesic with Ambulatory Misuse Potential Prescriptions" )
Library Name | Name | sequence |
OpioidCDSRoutines |
Patient Age Less Than 18 |
2 |
define "Patient Age Less Than 18":
if (Config."Age Less than 18 Years Is Enabled") then
AgeInYearsAt(Today()) < 18
else
false
Library Name | Name | sequence |
OpioidCDSRoutines |
Condition Positive for Sickle Cell |
3 |
define "Condition Positive for Sickle Cell":
if (Config."Sickle Cell Check Enabled") then
exists(
Common."Positive Sickle Cell Condition"
) else
false
Library Name | Name | sequence |
OpioidCDSCommon |
US Core-Categorized Conditions |
4 |
// 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"]
Library Name | Name | sequence |
OpioidCDSRoutines |
Conditions Indicating End Of Life Present |
5 |
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"
)
Library Name | Name | sequence |
OpioidCDSRoutines |
Is Active Cancer Treatment? |
6 |
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
Library Name | Name | sequence |
OpioidCDSRoutines |
Conditions Including Cancer To Exclude Opioid Management Indicating End-Stage Disease Present |
7 |
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
Library Name | Name | sequence |
OpioidCDSRoutines |
Is Opioid Review Useful? |
8 |
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"
Library Name | Name | sequence |
OpioidCDSREC10Common |
UDS Lookback Period |
9 |
// Constants
define "UDS Lookback Period":
Interval[Today() - 12 months - 1 days, Today()]
Library Name | Name | sequence |
OpioidCDSREC10Common |
All Opioid or Non-opioid UDS in Lookback Period |
10 |
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.value in { 'unknown', 'entered-in-error', 'cancelled' })
) X sort by date from FHIRHelpers.ToDateTime(effective as FHIR.dateTime) desc
Library Name | Name | sequence |
OpioidCDSREC10Common |
Inclusion Criteria For UDS Recommendation |
11 |
/*
@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 ("All Opioid or Non-opioid UDS in Lookback Period")
Library Name | Name | sequence |
OpioidCDSCommon |
Conditions Indicating End of Life or With Limited Life Expectancy |
12 |
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"
)
Library Name | Name | sequence |
OpioidCDSCommon |
Admitted/Referred/Discharged to Hospice Care |
13 |
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' }
)
Library Name | Name | sequence |
OpioidCDSCommon |
End of Life Assessment |
14 |
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"
)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Exclusion Criteria |
15 |
define "Exclusion Criteria":
Common."End of Life Assessment"
Library Name | Name | sequence |
OpioidCDSREC10OrderSign |
Is Perform Drug Screen Recommendation Applicable? |
16 |
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"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Amphetamine Simple Identifier |
17 |
define "Amphetamine Simple Identifier": 'Amphetamine'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Amphetamine Screenings In Lookback Period |
18 |
// 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"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Positive Amphetamine Screenings In Lookback Period |
19 |
define "Positive Amphetamine Screenings In Lookback Period":
GetPositiveLabsInLookbackPeriod("Amphetamine Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Negative Amphetamine Screenings In Lookback Period |
20 |
define "Negative Amphetamine Screenings In Lookback Period":
GetNegativeLabsInLookbackPeriod("Amphetamine Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Rx Lookback Period |
21 |
define "Rx Lookback Period":
Interval[Today() - 12 months - 31 days, Today()]
Library Name | Name | sequence |
OpioidCDSREC10Common |
Normalize Rx In Lookback Period |
22 |
define "Normalize Rx In Lookback Period":
Common."Get MedicationRequest Medication as Code"(
[MedicationRequest: status in { 'active', 'completed', 'stopped' }] Rx
where Rx.category in Common."Community"
and Rx.intent = 'order'
and Rx.authoredOn.value in day of "Rx Lookback Period"
)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Amphetamine Rx In Lookback Period |
23 |
define "Amphetamine Rx In Lookback Period":
"Normalize Rx In Lookback Period" Rx
where Rx.medication in Common."Amphetamine Medications"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Barbiturate Simple Identifier |
24 |
define "Barbiturate Simple Identifier": 'Barbiturate'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Barbiturate Screenings In Lookback Period |
25 |
// 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"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Positive Barbiturate Screenings In Lookback Period |
26 |
define "Positive Barbiturate Screenings In Lookback Period":
GetPositiveLabsInLookbackPeriod("Barbiturate Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Negative Barbiturate Screenings In Lookback Period |
27 |
define "Negative Barbiturate Screenings In Lookback Period":
GetNegativeLabsInLookbackPeriod("Barbiturate Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Barbiturate Rx In Lookback Period |
28 |
define "Barbiturate Rx In Lookback Period":
"Normalize Rx In Lookback Period" Rx
where Rx.medication in Common."Barbiturate Medications"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Benzodiazepine Simple Identifier |
29 |
define "Benzodiazepine Simple Identifier": 'Benzodiazepine'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Benzodiazepine Screenings In Lookback Period |
30 |
// 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"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Positive Benzodiazepine Screenings In Lookback Period |
31 |
define "Positive Benzodiazepine Screenings In Lookback Period":
GetPositiveLabsInLookbackPeriod("Benzodiazepine Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Negative Benzodiazepine Screenings In Lookback Period |
32 |
define "Negative Benzodiazepine Screenings In Lookback Period":
GetNegativeLabsInLookbackPeriod("Benzodiazepine Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Benzodiazepine Rx In Lookback Period |
33 |
define "Benzodiazepine Rx In Lookback Period":
"Normalize Rx In Lookback Period" Rx
where Rx.medication in Common."Benzodiazepine medications"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Buprenorphine Simple Identifier |
34 |
define "Buprenorphine Simple Identifier": 'Buprenorphine'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Buprenorphine Screenings In Lookback Period |
35 |
// 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"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Positive Buprenorphine Screenings In Lookback Period |
36 |
define "Positive Buprenorphine Screenings In Lookback Period":
GetPositiveLabsInLookbackPeriod("Buprenorphine Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Negative Buprenorphine Screenings In Lookback Period |
37 |
define "Negative Buprenorphine Screenings In Lookback Period":
GetNegativeLabsInLookbackPeriod("Buprenorphine Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Buprenorphine Rx In Lookback Period |
38 |
define "Buprenorphine Rx In Lookback Period":
"Normalize Rx In Lookback Period" Rx
where Rx.medication in Common."Buprenorphine Medications"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Cannabinoid Simple Identifier |
39 |
define "Cannabinoid Simple Identifier": 'Cannabinoid'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Cannabinoid Screenings In Lookback Period |
40 |
// 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
Library Name | Name | sequence |
OpioidCDSCommonConfig |
Cannabinoid Urine Screening Check Enabled |
41 |
define "Cannabinoid Urine Screening Check Enabled":
false
Library Name | Name | sequence |
OpioidCDSREC10Common |
Positive Cannabinoid Screenings In Lookback Period |
42 |
define "Positive Cannabinoid Screenings In Lookback Period":
GetPositiveLabsInLookbackPeriod("Cannabinoid Screenings In Lookback Period", Config."Cannabinoid Urine Screening Check Enabled")
Library Name | Name | sequence |
OpioidCDSREC10Common |
Negative Cannabinoid Screenings In Lookback Period |
43 |
define "Negative Cannabinoid Screenings In Lookback Period":
GetNegativeLabsInLookbackPeriod("Cannabinoid Screenings In Lookback Period", Config."Cannabinoid Urine Screening Check Enabled")
Library Name | Name | sequence |
OpioidCDSREC10Common |
Cocaine Simple Identifier |
44 |
define "Cocaine Simple Identifier": 'Cocaine'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Cocaine Screenings In Lookback Period |
45 |
// 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"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Positive Cocaine Screenings In Lookback Period |
46 |
define "Positive Cocaine Screenings In Lookback Period":
GetPositiveLabsInLookbackPeriod("Cocaine Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Negative Cocaine Screenings In Lookback Period |
47 |
define "Negative Cocaine Screenings In Lookback Period":
GetNegativeLabsInLookbackPeriod("Cocaine Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Fentanyl Simple Identifier |
48 |
define "Fentanyl Simple Identifier": 'Fentanyl'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Fentanyl Screenings In Lookback Period |
49 |
// 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
Library Name | Name | sequence |
OpioidCDSCommonConfig |
Opiate Urine Screening Check Enabled |
50 |
// Recommendation 10
define "Opiate Urine Screening Check Enabled":
true
Library Name | Name | sequence |
OpioidCDSREC10Common |
Positive Fentanyl Screenings In Lookback Period |
51 |
define "Positive Fentanyl Screenings In Lookback Period":
GetPositiveLabsInLookbackPeriod("Fentanyl Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
Library Name | Name | sequence |
OpioidCDSREC10Common |
Negative Fentanyl Screenings In Lookback Period |
52 |
define "Negative Fentanyl Screenings In Lookback Period":
GetNegativeLabsInLookbackPeriod("Fentanyl Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
Library Name | Name | sequence |
OpioidCDSREC10Common |
Fentanyl Rx In Lookback Period |
53 |
define "Fentanyl Rx In Lookback Period":
"Normalize Rx In Lookback Period" Rx
where Rx.medication in Common."Fentanyl Medications"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Heroin Simple Identifier |
54 |
define "Heroin Simple Identifier": 'Heroin (6-AM)'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Heroin Screenings In Lookback Period |
55 |
// 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"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Positive Heroin Screenings In Lookback Period |
56 |
define "Positive Heroin Screenings In Lookback Period":
GetPositiveLabsInLookbackPeriod("Heroin Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Negative Heroin Screenings In Lookback Period |
57 |
define "Negative Heroin Screenings In Lookback Period":
GetNegativeLabsInLookbackPeriod("Heroin Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Methadone Simple Identifier |
58 |
define "Methadone Simple Identifier": 'Methadone'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Methadone Screenings In Lookback Period |
59 |
// 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"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Positive Methadone Screenings In Lookback Period |
60 |
define "Positive Methadone Screenings In Lookback Period":
GetPositiveLabsInLookbackPeriod("Methadone Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Negative Methadone Screenings In Lookback Period |
61 |
define "Negative Methadone Screenings In Lookback Period":
GetNegativeLabsInLookbackPeriod("Methadone Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Methadone Rx In Lookback Period |
62 |
define "Methadone Rx In Lookback Period":
"Normalize Rx In Lookback Period" Rx
where Rx.medication in Common."Methadone Medications"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Opiate Simple Identifier |
63 |
define "Opiate Simple Identifier": 'Opiate'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Opiate Screenings In Lookback Period |
64 |
// 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
Library Name | Name | sequence |
OpioidCDSREC10Common |
Positive Opiate Screenings In Lookback Period |
65 |
define "Positive Opiate Screenings In Lookback Period":
GetPositiveLabsInLookbackPeriod("Opiate Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
Library Name | Name | sequence |
OpioidCDSREC10Common |
Negative Opiate Screenings In Lookback Period |
66 |
define "Negative Opiate Screenings In Lookback Period":
GetNegativeLabsInLookbackPeriod("Opiate Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
Library Name | Name | sequence |
OpioidCDSREC10Common |
Opiate Rx In Lookback Period |
67 |
define "Opiate Rx In Lookback Period":
"Normalize Rx In Lookback Period" Rx
where Rx.medication in Common."Opiate Medications"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Oxycodone Simple Identifier |
68 |
define "Oxycodone Simple Identifier": 'Oxycodone'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Oxycodone Screenings In Lookback Period |
69 |
// 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
Library Name | Name | sequence |
OpioidCDSREC10Common |
Positive Oxycodone Screenings In Lookback Period |
70 |
define "Positive Oxycodone Screenings In Lookback Period":
GetPositiveLabsInLookbackPeriod("Oxycodone Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
Library Name | Name | sequence |
OpioidCDSREC10Common |
Negative Oxycodone Screenings In Lookback Period |
71 |
define "Negative Oxycodone Screenings In Lookback Period":
GetNegativeLabsInLookbackPeriod("Oxycodone Screenings In Lookback Period", Config."Opiate Urine Screening Check Enabled")
Library Name | Name | sequence |
OpioidCDSREC10Common |
Oxycodone Rx In Lookback Period |
72 |
define "Oxycodone Rx In Lookback Period":
"Normalize Rx In Lookback Period" Rx
where Rx.medication in Common."Oxycodone Medications"
Library Name | Name | sequence |
OpioidCDSREC10Common |
PCP Simple Identifier |
73 |
define "PCP Simple Identifier": 'Phencyclidine (PCP)'
Library Name | Name | sequence |
OpioidCDSREC10Common |
PCP Screenings In Lookback Period |
74 |
// 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"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Positive PCP Screenings In Lookback Period |
75 |
define "Positive PCP Screenings In Lookback Period":
GetPositiveLabsInLookbackPeriod("PCP Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Negative PCP Screenings In Lookback Period |
76 |
define "Negative PCP Screenings In Lookback Period":
GetNegativeLabsInLookbackPeriod("PCP Screenings In Lookback Period", true)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Unexpected Details |
77 |
// 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"
)
}
Library Name | Name | sequence |
OpioidCDSREC10Common |
Inclusion Criteria For Unexpected Results |
78 |
define "Inclusion Criteria For Unexpected Results":
AnyTrue(
"Unexpected Details" Details
return (exists Details.unexpectedPosDetails) or (exists Details.unexpectedNegDetails)
)
Library Name | Name | sequence |
OpioidCDSREC10OrderSign |
Applicable Because of Unexpected Results |
79 |
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"
Library Name | Name | sequence |
OpioidCDSCommon |
Style Header |
80 |
define "Style Header":
'<style>\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 #box .show-more:checked + .more {\r\n display:block;\r\n }\r\n<\/style>'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Unexpected Div Start |
81 |
define "Unexpected Div Start":
'<div class=\"alert-body\"><div><p>Patient may have <strong>unexpected urine toxicology test results<\/strong> in the past year.<\/p><\/div>'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Table Start |
82 |
define "Table Start":
'<div><table class=\"details-table\"><caption class=\"details-caption\">Urine Toxicology Results<\/caption><tr><th class=\"details-table-header\">Substance<\/th>'
Library Name | Name | sequence |
OpioidCDSREC10Common |
All Lab Dates in Lookback Period |
83 |
define "All Lab Dates in Lookback Period":
(
"All Opioid or Non-opioid UDS in Lookback Period" Lab
return date from FHIRHelpers.ToDateTime(Lab.effective as FHIR.dateTime)
) X sort desc
Library Name | Name | sequence |
OpioidCDSREC10Common |
Table Headers |
84 |
define "Table Headers":
"All Lab Dates in Lookback Period" LabDate
return '<th class=\"details-table-header\">' + ToString(LabDate) + '<\/th>'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Generate Table Rows |
85 |
define "Generate Table Rows":
"Unexpected Details" BOT
let row: ToString(IndexOf("Unexpected Details", BOT) + 1)
return '<tr>' + 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>'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Generate Footer Rows |
86 |
define "Generate Footer Rows":
"Unexpected Details" BOT
let row: ToString(IndexOf("Unexpected Details", 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 singleton from (
BOT.unexpectedPosDetails PosDetail
where PosDetail.date = LabDate
return '<tr>' + GetFooterColumn(colspan, row + ':' + col + ' - Possible unprescribed substance found: ' + PosDetail.udsDetail) + '<\/tr>'
)
else if BOT.unexpectedNegDetails.udsDate contains LabDate
then singleton from (
BOT.unexpectedNegDetails NegDetail
where NegDetail.udsDate = LabDate
return '<tr>' + GetFooterColumn(colspan, row + ':' + col + ' - Possible unexpected negative result found: prescribed ' + NegDetail.rxDetail + ' on ' + ToString(NegDetail.rxDate)) + '<\/tr>'
)
else ''
)
)
Library Name | Name | sequence |
OpioidCDSREC10Common |
Table End |
87 |
define "Table End":
'<\/table><\/div>'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Details Table |
88 |
define "Details Table":
"Table Start" + Combine("Table Headers")
+ '<tbody>' + Combine("Generate Table Rows") + '</tbody>'
+ '<tfoot>' + Combine("Generate Footer Rows") + '<\/tfoot>'
+ "Table End"
Library Name | Name | sequence |
OpioidCDSREC10Common |
Details More Info |
89 |
define "Details More Info":
'<div id=\"box\">\r\n <p>Note on false positives and unexpected negative results...<\/p>\r\n <input type=\"checkbox\" class=\"show-more\"> Show more\r\n <div class=\"more\">\r\n <p>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 <a target=\"_blank\" href=\"https:\/\/pubmed.ncbi.nlm.nih.gov\/24986836\">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 <a target=\"_blank\" href=\"https:\/\/www.cdc.gov\/mmwr\/volumes\/71\/rr\/rr7103a1.htm#Recommendation10\">Recommendation 10 of the 22 CDC Clinical Practice Guideiline<\/a>.<\/p>\r\n <p>An unexpectedly negative test may be due to 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 <\/div>\r\n<\/div>'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Div End |
90 |
define "Div End": '<\/div>'
Library Name | Name | sequence |
OpioidCDSREC10Common |
Get HTML Details |
91 |
// HTML Generation
define "Get HTML Details":
Common."Style Header" + "Unexpected Div Start" + "Details Table" + "Details More Info" + "Div End"
Library Name | Name | sequence |
OpioidCDSREC10OrderSign |
Detail |
92 |
define "Detail":
Rec10Common."Get HTML Details"
|