You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: input/cql/IMMZD2DTDTPInput.cql
+109-15
Original file line number
Diff line number
Diff line change
@@ -30,61 +30,77 @@ define "Date of latest DTP Vaccine":
30
30
First("DTP Doses Administered to Patient").occurrence as dateTime
31
31
32
32
/*
33
-
@internal: DTP Primary Series Doses Administered to Patient
33
+
@internal: Tetanus and Diphtheria containing Doses Administered to Patient
34
34
*/
35
-
define "DTP Primary Series Doses Administered to Patient":
36
-
"DTP Doses Administered to Patient" I wherenot exists(I.protocolApplied.doseNumber) or ((singleton fromI.protocolApplied).doseNumber as string) !='booster'
35
+
define "Tetanus and Diphtheria containing Doses Administered to Patient":
36
+
IMMZCom."Doses Administered to Patient" I whereI.vaccineCodein IMMZc."Tetanus and Diphtheria Vaccine"
37
37
38
38
/*
39
-
@internal: Tetanus and Diphtheria containing Doses Administered to Patient
39
+
@internal: Tetanus and Diphtheria containing Booster Doses Administered to Patient
40
40
*/
41
41
define "Tetanus and Diphtheria Booster Doses Administered to Patient":
42
-
IMMZCom."Doses Administered to Patient" I
43
-
where
44
-
I.vaccineCodein IMMZc."Tetanus and Diphtheria Vaccine"and ((singleton fromI.protocolApplied).doseNumber as string) ='booster'
42
+
Take( "Tetanus and Diphtheria containing Doses Administered to Patient", Count("Tetanus and Diphtheria containing Doses Administered to Patient") -3 )
43
+
44
+
/*
45
+
@internal: Date of latest Tetanus and Diphtheria Vaccine
46
+
*/
47
+
define "Date of latest Tetanus and Diphtheria Vaccine":
48
+
First("Tetanus and Diphtheria containing Doses Administered to Patient").occurrence as dateTime
45
49
46
50
/*
47
51
@internal: Pertussis containing Doses Administered to Patient
48
52
*/
53
+
define "Pertussis Doses Administered to Patient":
54
+
IMMZCom."Doses Administered to Patient" I whereI.vaccineCodein IMMZc."Pertussis Vaccine"
55
+
56
+
/*
57
+
@internal: Pertussis containing Booster Doses Administered to Patient
58
+
*/
49
59
define "Pertussis Booster Doses Administered to Patient":
50
-
IMMZCom."Doses Administered to Patient" I
51
-
where
52
-
I.vaccineCodein IMMZc."Pertussis Vaccine"and ((singleton fromI.protocolApplied).doseNumber as string) ='booster'
60
+
Take( "Pertussis Doses Administered to Patient", Count("Pertussis Doses Administered to Patient") -3 )
53
61
54
62
/*
55
63
@input: No DTP primary series doses were administered
56
64
@pseudocode: Count of vaccines administered (where "Vaccine type" = "'Diphtheria-tetanus-pertussis containing vaccines" and "Type of dose" = "Primary series") = 0
57
65
*/
58
66
define "No DTP primary series doses were administered":
59
-
not exists("DTP Primary Series Doses Administered to Patient")
67
+
not exists("DTP Doses Administered to Patient")
60
68
61
69
/*
62
70
@input: One DTP primary series dose was administered
63
71
@pseudocode: Count of vaccines administered (where "Vaccine type" = "'Diphtheria-tetanus-pertussis containing vaccines" and "Type of dose" = "Primary series") = 1
64
72
*/
65
73
define "One DTP primary series dose was administered":
66
-
Count("DTP Primary Series Doses Administered to Patient") =1
74
+
Count("DTP Doses Administered to Patient") =1
67
75
68
76
/*
69
77
@input: Two DTP primary series doses were administered
70
78
@pseudocode: Count of vaccines administered (where "Vaccine type" = 'Diphtheria-tetanus-pertussis containing vaccines' and "Type of dose" = 'Primary series') = 2
71
79
*/
72
80
define "Two DTP primary series doses were administered":
73
-
Count("DTP Primary Series Doses Administered to Patient") =2
81
+
Count("DTP Doses Administered to Patient") =2
74
82
75
83
/*
76
84
@input: Three DTP primary series doses were administered
77
85
@pseudocode: Count of vaccines administered (where "Vaccine type" = 'Diphtheria-tetanus-pertussis containing vaccines' and "Type of dose" = 'Primary series') = 3
78
86
*/
79
87
define "Three DTP primary series doses were administered":
80
-
Count("DTP Primary Series Doses Administered to Patient") =3
88
+
Count("DTP Doses Administered to Patient") >=3
81
89
82
90
/*
83
91
@input: No tetanus and diphtheria booster doses were administered
84
92
@pseudocode: Count of vaccines administered (where "Vaccine type" = "Tetanus and diphtheria containing vaccines" and "Type of dose" = "Booster dose") = 0
85
93
*/
86
94
define "No tetanus and diphtheria booster doses were administered":
87
95
not exists( "Tetanus and Diphtheria Booster Doses Administered to Patient" )
96
+
97
+
/*
98
+
@input: No tetanus and diphtheria booster dose was administered
99
+
@pseudocode: Count of vaccines administered (where "Vaccine type" = "Tetanus and diphtheria containing vaccines" and "Type of dose" = "Booster dose") = 0
100
+
*/
101
+
define "No tetanus and diphtheria booster dose was administered":
102
+
"No tetanus and diphtheria booster doses were administered"
103
+
88
104
/*
89
105
@input: One tetanus and diphtheria booster dose was administered
90
106
@pseudocode: Count of vaccines administered where "Vaccine type" = "Tetanus and diphtheria containing vaccines" and "Type of dose" = "Booster dose" ) = 1
@@ -104,7 +120,7 @@ define "Two tetanus and diphtheria booster doses were administered":
104
120
@pseudocode: Count of vaccines administered where "Vaccine type" = "Tetanus and diphtheria containing vaccines" and "Type of dose" = "Booster dose" ) = 3
105
121
*/
106
122
define "Three tetanus and diphtheria booster doses were administered":
107
-
Count("Tetanus and Diphtheria Booster Doses Administered to Patient") =3
123
+
Count("Tetanus and Diphtheria Booster Doses Administered to Patient") >=3
108
124
109
125
/*
110
126
@input: No pertussis booster doses were administered
@@ -183,12 +199,27 @@ define "Client's age is more than or equal to 9 years":
183
199
define "Client's age is less than 1 year":
184
200
IMMZCom."Current Patient Age In Years"<1
185
201
202
+
/*
203
+
@input: Client's age is more than 1 year
204
+
@pseudocode: Today's date - "Date of birth" > 1 year
205
+
*/
206
+
define "Client's age is more than 1 year":
207
+
not( "Client's age is less than 1 year" )
208
+
186
209
/*
187
210
@input: Client's age is between 1 year and 6 years
188
211
@pseudocode: 1 'year' ≤ Today's date - "Date of birth" ≤ 6 'year'
189
212
*/
190
213
define "Client's age is between 1 year and 6 years":
191
214
not("Client's age is less than 1 year") and not("Client's age is more than 6 years")
215
+
216
+
/*
217
+
@input: Client's age is between 1 year and 6 years old
218
+
@pseudocode: 1 year ≤ Today's date - "Date of birth" ≤ 6 years
219
+
*/
220
+
define "Client's age is between 1 year and 6 years old":
221
+
"Client's age is between 1 year and 6 years"
222
+
192
223
/*
193
224
@input: Client's age is more than 6 years
194
225
@pseudocode: Today's date - "Date of birth" > 6 'year'
@@ -222,3 +253,66 @@ define "The latest DTP dose was administered less than 6 months ago":
222
253
*/
223
254
define "The latest DTP dose was administered more than 6 months ago":
224
255
not("The latest DTP dose was administered less than 6 months ago")
256
+
257
+
/*
258
+
@input: The latest DTP dose was administered less than 1 year ago
259
+
@pseudocode: Today's date - latest "Date and time of vaccination" (where "Vaccine type" = "Diphtheria-tetanus-pertussis containing vaccines") < 1 year
260
+
*/
261
+
define "The latest DTP dose was administered less than 1 year ago":
262
+
"Date of latest DTP Vaccine"is not nulland duration in years between "Date of latest DTP Vaccine"and Now() <1
263
+
264
+
/*
265
+
@input: The latest DTP dose was administered more than 1 year ago
266
+
@pseudocode: Today's date - latest "Date and time of vaccination" (where "Vaccine type" = "Diphtheria-tetanus-pertussis containing vaccines") ≥ 1 year
267
+
*/
268
+
define "The latest DTP dose was administered more than 1 year ago":
269
+
not("The latest DTP dose was administered less than 1 year ago")
270
+
271
+
/*
272
+
@input: The latest tetanus and diphtheria dose was administered less than 4 weeks ago
273
+
@pseudocode: Today's date - Latest "Date and time of vaccination" (where "Vaccine type" = "Tetanus and diphtheria containing vaccines") < 4 weeks
274
+
*/
275
+
define "The latest tetanus and diphtheria dose was administered less than 4 weeks ago":
276
+
"Date of latest Tetanus and Diphtheria Vaccine"is not nulland duration in weeks between "Date of latest Tetanus and Diphtheria Vaccine"and Now() <4
277
+
278
+
/*
279
+
@input: The latest tetanus and diphtheria dose was administered more than 4 weeks ago
280
+
@pseudocode: Today's date - Latest "Date and time of vaccination" (where "Vaccine type" = "Tetanus and diphtheria containing vaccines") > 4 weeks
281
+
*/
282
+
define "The latest tetanus and diphtheria dose was administered more than 4 weeks ago":
283
+
not("The latest tetanus and diphtheria dose was administered less than 4 weeks ago")
284
+
285
+
/*
286
+
@input: The latest tetanus and diphtheria dose was administered less than 1 year ago
287
+
@pseudocode: Today's date - Latest "Date and time of vaccination" (where "Vaccine type" = "Tetanus and diphtheria containing vaccines") < 1 year
288
+
*/
289
+
define "The latest tetanus and diphtheria dose was administered less than 1 year ago":
290
+
"Date of latest Tetanus and Diphtheria Vaccine"is not nulland duration in years between "Date of latest Tetanus and Diphtheria Vaccine"and Now() <1
291
+
292
+
/*
293
+
@input: The latest tetanus and diphtheria dose was administered more than 1 year ago
294
+
@pseudocode: Today's date - Latest "Date and time of vaccination" (where "Vaccine type" = "Tetanus and diphtheria containing vaccines") ≥ 1 year
295
+
*/
296
+
define "The latest tetanus and diphtheria dose was administered more than 1 year ago":
297
+
not("The latest tetanus and diphtheria dose was administered less than 1 year ago")
298
+
299
+
/*
300
+
@input: Client is currently pregnant
301
+
@pseudocode: "Currently pregnant" = TRUE
302
+
*/
303
+
define "Client is currently pregnant":
304
+
IMMZCom."Pregnant"
305
+
306
+
/*
307
+
@input: The client has a history of anaphylactic reactions
308
+
@pseudocode: "Potential contraindications" = "History of anaphylactic reactions"
309
+
*/
310
+
define "The client has a history of anaphylactic reactions":
311
+
exists(IMMZCom."History of Anaphylactic Reactions Condition")
312
+
313
+
/*
314
+
@input: The client currently has a severe acute illness
0 commit comments