forked from cqframework/ecqm-content-r4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DischargedonAntithromboticTherapyFHIR.cql
90 lines (71 loc) · 4.96 KB
/
DischargedonAntithromboticTherapyFHIR.cql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
library DischargedonAntithromboticTherapyFHIR version '1.0.001'
using FHIR version '4.0.1'
include FHIRHelpers version '4.0.001' called FHIRHelpers
include SupplementalDataElementsFHIR4 version '2.0.000' called SDE
include MATGlobalCommonFunctionsFHIR4 version '6.0.000' called Global
include TJCOverallFHIR version '1.1.000' called TJC
valueset "Antithrombotic Therapy": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.201'
valueset "Comfort Measures": 'http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45'
valueset "Discharge To Acute Care Facility": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.87'
valueset "Discharged to Health Care Facility for Hospice Care": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.207'
valueset "Discharged to Home for Hospice Care": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.209'
valueset "Emergency Department Visit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292'
valueset "Hemorrhagic Stroke": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.212'
valueset "Ischemic Stroke": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.247'
valueset "Left Against Medical Advice": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.308'
valueset "Medical Reason": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.473'
valueset "Non-Elective Inpatient Encounter": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.424'
valueset "Patient Expired": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.309'
valueset "Patient Refusal": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.93'
valueset "Pharmacological Contraindications For Antithrombotic Therapy": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.52'
parameter "Measurement Period" Interval<DateTime>
default Interval[@2019-01-01T00:00:00.0, @2020-01-01T00:00:00.0)
context Patient
define "SDE Ethnicity":
SDE."SDE Ethnicity"
define "SDE Payer":
SDE."SDE Payer"
define "SDE Race":
SDE."SDE Race"
define "SDE Sex":
SDE."SDE Sex"
define "Denominator":
TJC."Ischemic Stroke Encounter"
define "Initial Population":
TJC."Encounter with Principal Diagnosis and Age"
define "Denominator Exclusions":
TJC."Ischemic Stroke Encounters with Discharge Disposition"
union TJC."Comfort Measures during Hospitalization"
define "Numerator":
TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
with "Antithrombotic Therapy at Discharge" DischargeAntithrombotic
such that DischargeAntithrombotic.authoredOn during Global."Normalize Interval"(IschemicStrokeEncounter.period)
define "Antithrombotic Therapy at Discharge":
["MedicationRequest": medication in "Antithrombotic Therapy"] Antithrombotic
where exists (Antithrombotic.category C where FHIRHelpers.ToConcept(C) ~ Global."Community" or FHIRHelpers.ToConcept(C) ~ Global."Discharge")
and Antithrombotic.status in { 'active', 'completed' }
and Antithrombotic.intent.value = 'order'
define "Denominator Exceptions":
"Encounter With No Antithrombotic At Discharge"
union "Encounter With Pharmacological Contraindications for Antithrombotic Therapy at Discharge"
define "Encounter With No Antithrombotic At Discharge":
TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
with "Antithrombotic Not Given at Discharge" NoDischargeAntithrombotic
such that NoDischargeAntithrombotic.authoredOn during IschemicStrokeEncounter.period
define "Antithrombotic Not Given at Discharge":
["MedicationRequest": medication in "Antithrombotic Therapy"] NoAntithromboticDischarge
where NoAntithromboticDischarge.doNotPerform is true
and (NoAntithromboticDischarge.reasonCode in "Medical Reason"
or NoAntithromboticDischarge.reasonCode in "Patient Refusal")
and exists (NoAntithromboticDischarge.category C where FHIRHelpers.ToConcept(C) ~ Global."Community" or FHIRHelpers.ToConcept(C) ~ Global."Discharge")
and NoAntithromboticDischarge.status = 'completed'
and NoAntithromboticDischarge.intent = 'order'
define "Encounter With Pharmacological Contraindications for Antithrombotic Therapy at Discharge":
TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
with "Pharmacological Contraindications for Antithrombotic Therapy at Discharge" DischargePharmacological
such that DischargePharmacological.authoredOn during IschemicStrokeEncounter.period
define "Pharmacological Contraindications for Antithrombotic Therapy at Discharge":
["MedicationRequest": medication in "Pharmacological Contraindications For Antithrombotic Therapy"] Pharmacological
where exists (Pharmacological.category C where FHIRHelpers.ToConcept(C) ~ Global."Community" or FHIRHelpers.ToConcept(C) ~ Global."Discharge")
and Pharmacological.status in { 'active', 'completed' }
and Pharmacological.intent = 'order'