-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathExamples_Working.cql
596 lines (510 loc) · 24.2 KB
/
Examples_Working.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
/*
Describing Initial Populations
Begin with a review of some of the age-related constructs presented last time.
*/
/*
Example 01
IP: Age and encounter (CMS117) (Patient-based Proportion Measure)
Initial Population =
AND: "Birthdate : Patient Characteristic Birthdate" >= 1 year(s) starts before start of "Measurement Period"
AND: "Birthdate : Patient Characteristic Birthdate" = 2 year(s) starts before end of "Measurement Period"
AND: Union of:
"Encounter, Performed: Office Visit"
"Encounter, Performed: Face-to-Face Interaction"
"Encounter, Performed: Home Healthcare Services"
"Encounter, Performed: Preventive Care - Established Office Visit, 0 to 17"
"Encounter, Performed: Preventive Care- Initial Office Visit, 0 to 17"
during "Measurement Period"
*/
define "Birthdate":
["Birthdate": "Patient Characteristic Birthdate"]
define "Encounter During Measurement Period":
(
["Encounter, Performed": "Office Visit"]
union ["Encounter, Performed": "Face-to-Face Interaction"]
union ["Encounter, Performed": "Home Healthcare Service"]
union ["Encounter, Performed": "Preventive Care - Established Office Visit, 0 to 17"]
union ["Encounter, Performed": "Preventive Care- Initial Office Visit, 0 to 17"]
) Encounter
where Interval[Encounter.admissionDateTime, Encounter.dischargeDateTime] during "Measurement Period"
define "Initial Population":
CalculateAgeInYearsAt("Birthdate", start of "Measurement Period") >= 1
and CalculateAgeInYearsAt("Birthdate", end of "Measurement Period") = 2
and exists ("Encounter During Measurement Period")
/*
Example 02
IP: Age, sex, and encounter (CMS125) (Patient-based Proportion Measure)
Initial Population =
AND: Age>= 51 year(s) at: "Measurement Period"
AND: Age< 74 year(s) at: "Measurement Period"
AND: "Patient Characteristic Sex: Female"
AND: Union of:
"Encounter, Performed: Office Visit"
"Encounter, Performed: Face-to-Face Interaction"
"Encounter, Performed: Preventive Care Services - Established Office Visit, 18 and Up"
"Encounter, Performed: Preventive Care Services-Initial Office Visit, 18 and Up"
"Encounter, Performed: Home Healthcare Services"
"Encounter, Performed: Annual Wellness Visit"
during "Measurement Period"
*/
define "Encounter During Measurement Period":
(
["Encounter, Performed": "Office Visit"]
union ["Encounter, Performed": "Face-to-Face Interaction"]
union ["Encounter, Performed": "Preventive Care Services - Established Office Visit, 18 and Up"]
union ["Encounter, Performed": "Preventive Care Services-Initial Office Visit, 18 and Up"]
union ["Encounter, Performed": "Home Healthcare Service"]
union ["Encounter, Performed": "Annual Wellness Visit"]
) Encounter
where Interval[Encounter.admissionDateTime, Encounter.dischargeDateTime] during "Measurement Period"
define "Initial Population":
AgeInYearsAt(start of "Measurement Period") >= 51
and AgeInYearsAt(start of "Measurement Period") < 74
and exists (["Patient Characteristic Sex": "Female"])
and exists ("Encounter During Measurement Period")
/*
Example 03:
IP: Diagnosis overlaps MP and sex (CMS129) (Patient-based Proportion Measure)
Initial Population =
AND: "Occurrence A of Diagnosis: Prostate Cancer" overlaps "Measurement Period"
AND: "Patient Characteristic Sex: Male"
*/
define "Prostate Cancer Diagnosis":
["Diagnosis": "Prostate Cancer"] Diagnosis
where Interval[Diagnosis.onsetDateTime, Diagnosis.abatementDateTime] overlaps "Measurement Period"
define "Initial Population":
exists ("Prostate Cancer Diagnosis")
and exists (["Patient Characteristic Sex": "Male"])
/*
Example 04:
IP: Diagnosis overlaps encounter (CMS53) (Episode-of-care Proportion Measure)
Initial Population =
AND: Age>= 18 year(s) at: Occurrence A of $EncounterInpatient
AND: Intersection of:
Occurrence A of $EncounterInpatient
"Encounter, Performed: Encounter Inpatient (principal diagnosis: Acute Myocardial Infarction (AMI))"
$EncounterInpatient =
"Encounter, Performed: Encounter Inpatient" satisfies all:
(length of stay <= 120 day(s))
ends during "Measurement Period"
*/
define "Inpatient Encounter":
["Encounter, Performed": "Encounter Inpatient"] Encounter
where Encounter.lengthOfStay <= 120 days
and Encounter.dischargeDateTime during "Measurement Period"
define "Encounter with Principal Diagnosis of AMI":
"Inpatient Encounter" Encounter
where Encounter.principalDiagnosis in "Acute Myocardial Infarction (AMI)"
and AgeInYearsAt(Encounter.admissionDateTime) >= 18
define "Initial Population":
"Encounter with Principal Diagnosis of AMI"
/*
Example 05:
IP: Encounter relative to another encounter (CMS55) (Episode-of-care Continuous Variable Measure)
Initial Population =
AND: "Occurrence A of Encounter, Performed: Emergency Department Visit" <= 1 hour(s) ends before or concurrent with start of Occurrence A of $EncounterInpatient
$EncounterInpatient =
"Encounter, Performed: Encounter Inpatient" satisfies all:
(length of stay <= 120 day(s))
ends during "Measurement Period"
*/
define "Inpatient Encounter":
["Encounter, Performed": "Encounter Inpatient"] Encounter
where Encounter.lengthOfStay <= 120 days
and Encounter.dischargeDateTime during "Measurement Period"
define "Emergency Encounter":
["Encounter, Performed": "Emergency Department Visit"] EmergencyEncounter
with "Inpatient Encounter" InpatientEncounter
such that EmergencyEncounter.dischargeDateTime 1 hour or less before InpatientEncounter.admissionDateTime
define "Initial Population":
"Emergency Encounter"
/*
Example 06:
IP: Encounter relative to another encounter (CMS111) (Episode-of-care Continuous Variable Measure)
Initial Population =
AND: "Occurrence A of Encounter, Performed: Emergency Department Visit" <= 1 hour(s) ends before or concurrent with start of Occurrence A of $EncounterInpatient
AND: "Occurrence A of Encounter, Order: Decision to Admit to Hospital Inpatient" starts during "Occurrence A of Encounter, Performed: Emergency Department Visit"
$EncounterInpatient =
"Encounter, Performed: Encounter Inpatient" satisfies all:
(length of stay <= 120 day(s))
ends during "Measurement Period"
*/
define "Inpatient Encounter":
["Encounter, Performed": "Encounter Inpatient"] Encounter
where Encounter.lengthOfStay <= 120 days
and Encounter.dischargeDateTime during "Measurement Period"
define "Emergency Encounter":
["Encounter, Performed": "Emergency Department Visit"] EmergencyEncounter
with "Inpatient Encounter" InpatientEncounter
such that EmergencyEncounter.dischargeDateTime 1 hour or less before InpatientEncounter.admissionDateTime
define "Initial Population":
"Emergency Encounter" EmergencyEncounter
with ["Encounter, Order": "Decision to Admit to Hospital Inpatient"] AdmissionOrder
such that AdmissionOrder.startDateTime during Interval[EmergencyEncounter.admissionDateTime, EmergencyEncounter.dischargeDateTime]
/*
Example 07:
IP: Procedure during encounter (CMS113) (Episode-of-care Proportion Measure)
Initial Population =
AND: Age>= 8 year(s) at: Occurrence A of $EncounterInpatient
AND: Age< 65 year(s) at: Occurrence A of $EncounterInpatient
AND: "Procedure, Performed: Delivery Procedures" starts during Occurrence A of $EncounterInpatient
$EncounterInpatient =
"Encounter, Performed: Encounter Inpatient" satisfies all:
(length of stay <= 120 day(s))
ends during "Measurement Period"
*/
define "Inpatient Encounter":
["Encounter, Performed": "Encounter Inpatient"] Encounter
where Encounter.lengthOfStay <= 120 days
and Encounter.dischargeDateTime during "Measurement Period"
define "Initial Population":
"Inpatient Encounter" Encounter
with ["Procedure, Performed": "Delivery Procedures"] Procedure
such that Procedure.startDateTime during Interval[Encounter.admissionDateTime, Encounter.dischargeDateTime]
where AgeInYearsAt(Encounter.admissionDateTime) >= 8
and AgeInYearsAt(Encounter.admissionDateTime) < 65
/*
Example 08:
IP: Procedure relative to MP end (CMS133) (Procedure-based Proportion Measure)
Initial Population =
AND: Age>= 18 year(s) at: "Measurement Period"
AND: "Occurrence A of Procedure, Performed: Cataract Surgery" during "Measurement Period"
AND: "Occurrence A of Procedure, Performed: Cataract Surgery" > 92 day(s) starts before end of "Measurement Period"
*/
define "Initial Population":
["Procedure, Performed": "Cataract Surgery"] Procedure
where AgeInYearsAt(start of "Measurement Period") >= 18
and Interval[Procedure.startDateTime, Procedure.stopDateTime] during "Measurement Period"
and Procedure.startDateTime 92 days or more before end of "Measurement Period"
/*
Example 09:
IP: Count of encounters (CMS138) (Patient-based Proportion Measure)
Initial Population =
AND: Age>= 18 year(s) at: "Measurement Period"
AND:
OR: Count>= 2 : Union of:
"Encounter, Performed: Psych Visit - Diagnostic Evaluation"
"Encounter, Performed: Health and Behavioral Assessment - Initial"
"Encounter, Performed: Health and Behavioral Assessment, Reassessment"
"Encounter, Performed: Health & Behavioral Assessment - Individual"
"Encounter, Performed: Occupational Therapy Evaluation"
"Encounter, Performed: Office Visit"
"Encounter, Performed: Psych Visit - Psychotherapy"
"Encounter, Performed: Psychoanalysis"
"Encounter, Performed: Ophthalmological Services"
"Encounter, Performed: Home Healthcare Services"
during "Measurement Period"
OR: Count>= 1 : Union of:
"Encounter, Performed: Preventive Care Services - Group Counseling"
"Encounter, Performed: Preventive Care Services - Other"
"Encounter, Performed: Preventive Care Services-Initial Office Visit, 18 and Up"
"Encounter, Performed: Preventive Care Services - Established Office Visit, 18 and Up"
"Encounter, Performed: Preventive Care Services-Individual Counseling"
"Encounter, Performed: Face-to-Face Interaction"
"Encounter, Performed: Annual Wellness Visit"
"Encounter, Performed: Speech and Hearing Evaluation"
during "Measurement Period"
*/
define "Behavioral Visits":
distinct
(
["Encounter, Performed": "Psych Visit - Diagnostic Evaluation"]
union ["Encounter, Performed": "Health and Behavioral Assessment - Initial"]
union ["Encounter, Performed": "Health and Behavioral Assessment, Reassessment"]
union ["Encounter, Performed": "Health & Behavioral Assessment - Individual"]
union ["Encounter, Performed": "Occupational Therapy Evaluation"]
union ["Encounter, Performed": "Office Visit"]
union ["Encounter, Performed": "Psych Visit - Psychotherapy"]
union ["Encounter, Performed": "Psychoanalysis"]
union ["Encounter, Performed": "Ophthalmological Services"]
union ["Encounter, Performed": "Home Healthcare Services"]
) Visit
where Interval[Visit.admissionDateTime, Visit.dischargeDateTime] during "Measurement Period"
define "Counseling Visits":
distinct
(
["Encounter, Performed": "Preventive Care Services - Group Counseling"]
union ["Encounter, Performed": "Preventive Care Services - Other"]
union ["Encounter, Performed": "Preventive Care Services-Initial Office Visit, 18 and Up"]
union ["Encounter, Performed": "Preventive Care Services - Established Office Visit, 18 and Up"]
union ["Encounter, Performed": "Preventive Care Services-Individual Counseling"]
union ["Encounter, Performed": "Face-to-Face Interaction"]
union ["Encounter, Performed": "Annual Wellness Visit"]
union ["Encounter, Performed": "Speech and Hearing Evaluation"]
) Visit
where Interval[Visit.admissionDateTime, Visit.dischargeDateTime] during "Measurement Period"
define "Initial Population":
AgeInYearsAt(start of "Measurement Period") >= 18
and (
Count("Behavioral Visits") >= 2
or Count("Counseling Visits") >= 1
)
/*
Example 10:
IP: Count of encounters with diagnosis (CMS135) (Patient-based Proportion)
Initial Population =
AND: Age>= 18 year(s) at: "Measurement Period"
AND:
OR: Count>= 2 : Union of:
"Encounter, Performed: Care Services in Long-Term Residential Facility"
"Encounter, Performed: Home Healthcare Services"
"Encounter, Performed: Nursing Facility Visit"
"Encounter, Performed: Office Visit"
"Encounter, Performed: Outpatient Consultation"
"Encounter, Performed: Patient Provider Interaction"
during "Measurement Period"
OR: "Encounter, Performed: Discharge Services - Hospital Inpatient" during "Measurement Period"
AND: "Diagnosis: Heart Failure" overlaps Occurrence A of $HFEncounters135
$HFEncounters135 =
Union of:
"Encounter, Performed: Care Services in Long-Term Residential Facility"
"Encounter, Performed: Home Healthcare Services"
"Encounter, Performed: Nursing Facility Visit"
"Encounter, Performed: Office Visit"
"Encounter, Performed: Outpatient Consultation"
"Encounter, Performed: Face-to-Face Interaction"
"Encounter, Performed: Discharge Services - Hospital Inpatient"
during "Measurement Period"
*/
define "HF Encounters":
distinct
(
["Encounter, Performed": "Care Services in Long-Term Residential Facility"]
union ["Encounter, Performed": "Home Healthcare Services"]
union ["Encounter, Performed": "Nursing Facility Visit"]
union ["Encounter, Performed": "Office Visit"]
union ["Encounter, Performed": "Outpatient Consultation"]
union ["Encounter, Performed": "Face-to-Face Interaction"]
union ["Encounter, Performed": "Discharge Services - Hospital Inpatient"]
) Encounter
where Interval[Encounter.admissionDateTime, Encounter.dischargeDateTime] during "Measurement Period"
define "HF Encounters Without Discharge":
distinct
(
["Encounter, Performed": "Care Services in Long-Term Residential Facility"]
union ["Encounter, Performed": "Home Healthcare Services"]
union ["Encounter, Performed": "Nursing Facility Visit"]
union ["Encounter, Performed": "Office Visit"]
union ["Encounter, Performed": "Outpatient Consultation"]
union ["Encounter, Performed": "Patient Provider Interaction"]
) Encounter
where Interval[Encounter.admissionDateTime, Encounter.dischargeDateTime] during "Measurement Period"
define "Discharge Services":
["Encounter, Performed": "Discharge Services - Hospital Inpatient"] Encounter
where Interval[Encounter.admissionDateTime, Encounter.dischargeDateTime] during "Measurement Period"
define "Heart Failure Diagnosis":
["Diagnosis": "Heart Failure"] Diagnosis
with "HF Encounters" Encounter
such that Interval[Diagnosis.onsetDateTime, Diagnosis.abatementDateTime]
overlaps Interval[Encounter.admissionDateTime, Encounter.dischargeDateTime]
define "Initial Population":
AgeInYearsAt(start of "Measurement Period") >= 18
and (
Count("HF Encounters") >= 2
or exists ("Discharge Services")
)
and exists ("Heart Failure Diagnosis")
/*
Example 11:
IP: Cumulative medication (CMS136) (Patient-based Proportion)
Initial Population =
AND: $InitialADHDMedication
AND: Sum>= 210 day(s): "Medication, Active: ADHD Medications (cumulative medication duration)" <= 300 day(s) starts after or concurrent with start of $InitialADHDMedication
AND: Age>= 6 year(s) at: "Measurement Period"
AND: Age< 12 year(s) at: "Measurement Period"
AND: $Encounter
$InitialADHDMedication =
First: Union of:
"Medication, Dispensed: ADHD Medications" <= 60 day(s) starts after start of "Measurement Period"
"Medication, Dispensed: ADHD Medications" <= 90 day(s) starts before or concurrent with start of "Measurement Period"
$Encounter =
Union of:
"Encounter, Performed: Office Visit"
"Encounter, Performed: Face-to-Face Interaction"
"Encounter, Performed: Home Healthcare Services"
"Encounter, Performed: Preventive Care - Established Office Visit, 0 to 17"
"Encounter, Performed: Preventive Care- Initial Office Visit, 0 to 17"
during "Measurement Period"
*/
define "Encounter":
distinct
(
["Encounter, Performed": "Office Visit"]
union ["Encounter, Performed": "Face-to-Face Interaction"]
union ["Encounter, Performed": "Home Healthcare Services"]
union ["Encounter, Performed": "Preventive Care - Established Office Visit, 0 to 17"]
union ["Encounter, Performed": "Preventive Care- Initial Office Visit, 0 to 17"]
) Encounter
where Interval[Encounter.admissionDateTime, Encounter.dischargeDateTime] during "Measurement Period"
define "Initial ADHD Medication":
First(
["Medication, Dispensed": "ADHD Medications"] Medication
where Medication.startDateTime
during Interval[start of "Measurement Period" - 90 days, start of "Measurement Period" + 60 days]
)
define "ADHD Medication Intervals":
collapse (
["Medication, Dispensed": "ADHD Medications"] Medication
with "Initial ADHD Medication" InitialMedication
such that Medication.startDateTime 300 days or less after start of InitialMedication.startDateTime
return Interval[Medication.startDateTime, Medication.stopDateTime]
)
define "ADHD Medication Days":
"ADHD Medication Intervals" I return duration in days of I
define "Initial Population":
AgeInYearsAt(start of "Measurement Period") >= 6
and AgeInYearsAt(start of "Measurement Period") < 12
and exists ("Encounter")
and exists ("Initial ADHD Medication")
and Sum("ADHD Medication Days") >= 210
/*
Example 12:
IP: First occurrence (CMS140) (Patient-based Proportion Measure)
Initial Population =
AND: (First: "Occurrence A of Diagnosis: Breast Cancer" ) <= 5 year(s) starts before end of Occurrence A of $OVorF2FEncounter
AND: Age>= 18 year(s) at: "Measurement Period"
AND: Count>= 2 : Union of:
"Encounter, Performed: Office Visit"
"Encounter, Performed: Patient Provider Interaction"
during "Measurement Period"
AND: "Patient Characteristic Sex: Female"
$OVorF2FEncounter =
Union of:
"Encounter, Performed: Office Visit"
"Encounter, Performed: Face-to-Face Interaction"
during "Measurement Period"
*/
define "Office Visit or Face-to-Face Encounter":
distinct
(
["Encounter, Performed": "Office Visit"]
union ["Encounter, Performed": "Face-to-Face Interaction"]
) Encounter
where Interval[Encounter.admissionDateTime, Encounter.dischargeDateTime] during "Measurement Period"
define "First Breast Cancer Diagnosis":
First(
["Diagnosis": "Breast Cancer"] Diagnosis
sort by onsetDateTime
)
define "Initial Population":
exists (
"First Breast Cancer Diagnosis" Diagnosis
with "Office Visit or Face-to-Face Encounter" Encounter
such that Diagnosis.onsetDateTime 5 years or less before Encounter.dischargeDateTime
)
and AgeInYearsAt(start of "Measurement Period") >= 18
and Count("Office Visit or Face-to-Face Encounter") >= 2
and exists (["Patient Characteristic Sex": "Female"])
/*
Example 13:
IP: Satisfies any with satisfies all (CMS154) (Patient-based Proportion Measure)
Initial Population =
AND: Age>= 3 month(s) at: "Measurement Period"
AND: Age< 18 year(s) at: "Measurement Period"
AND: "Occurrence A of Diagnosis: Upper Respiratory Infection" satisfies any:
starts during Occurrence A of $URIEncounter
satisfies all:
starts before or concurrent with start of Occurrence A of $URIEncounter
ends after or concurrent with end of Occurrence A of $URIEncounter
$URIEncounter =
Union of:
"Encounter, Performed: Office Visit"
"Encounter, Performed: Emergency Department Visit"
"Encounter, Performed: Preventive Care- Initial Office Visit, 0 to 17"
"Encounter, Performed: Preventive Care - Established Office Visit, 0 to 17"
"Encounter, Performed: Hospital Observation Care - Initial"
"Encounter, Performed: Face-to-Face Interaction"
during "Measurement Period"
*/
define "URI Encounter":
distinct
(
["Encounter, Performed": "Office Visit"]
union ["Encounter, Performed": "Emergency Department Visit"]
union ["Encounter, Performed": "Preventive Care- Initial Office Visit, 0 to 17"]
union ["Encounter, Performed": "Preventive Care - Established Office Visit, 0 to 17"]
union ["Encounter, Performed": "Hospital Observation Care - Initial"]
union ["Encounter, Performed": "Face-to-Face Interaction"]
) Encounter
where Interval[Encounter.admissionDateTime, Encounter.dischargeDateTime] during "Measurement Period"
define "URI Diagnosis During Encounter":
["Diagnosis": "Upper Respiratory Infection"] Diagnosis
with "URI Encounter" Encounter
such that Diagnosis.onsetDateTime during Interval[Encounter.admissionDateTime, Encounter.dischargeDateTime]
define "URI Diagnosis Before Or After Encounter":
["Diagnosis": "Upper Respiratory Infection"] Diagnosis
with "URI Encounter" Encounter
such that Diagnosis.onsetDateTime same or before Encounter.admissionDateTime
and Diagnosis.abatementDateTime same or after Encounter.dischargeDateTime
define "Initial Population":
AgeInMonthsAt(start of "Measurement Period") >= 3
and AgeInYearsAt(start of "Measurement Period") < 18 years
and (
exists ("URI Diagnosis During Encounter")
or exists ("URI Diagnosis Before Or After Encounter")
)
/*
Example 14:
IP: Timing, diagnoses, satisfies – oh my! (CMS159)
Initial Population =
AND: Age>= 18 year(s) at: $DepressionIndex
$DepressionEncounter =
"Encounter, Performed: Office Visit" satisfies all:
< 12 month(s) ends before start of "Measurement Period"
> 0 month(s) ends before start of "Measurement Period"
satisfies any:
overlaps "Diagnosis: Major Depression Including Remission"
overlaps "Diagnosis: Dysthymia"
$DepressionEncounterBH =
"Encounter, Performed: Psych Visit" satisfies all:
< 12 month(s) ends before start of "Measurement Period"
> 0 month(s) ends before start of "Measurement Period"
satisfies any:
(principal diagnosis: Major Depression Including Remission)
(principal diagnosis: Dysthymia)
$DepressionF2FSnomed =
"Encounter, Performed: Face to Face Interaction - No ED" satisfies all:
< 12 month(s) ends before start of "Measurement Period"
> 0 month(s) ends before start of "Measurement Period"
satisfies any:
overlaps "Diagnosis: Major Depression Including Remission"
overlaps "Diagnosis: Dysthymia"
$DepressionIndex =
"Risk Category Assessment: PHQ-9 Tool (result > 9 )" during Union of:
$DepressionEncounter
$DepressionEncounterBH
$DepressionF2FSnomed
*/
define "Major Depression or Dysthymia Diagnosis":
["Diagnosis": "Major Depression Including Remission"]
union ["Diagnosis": "Dysthymia"]
define "Depression Encounter":
["Encounter, Performed": "Office Visit"] Encounter
with "Major Depression or Dysthymia Diagnosis" Diagnosis
such that Interval[Encounter.admissionDateTime, Encounter.dischargeDateTime]
overlaps Interval[Diagnosis.onsetDateTime, Diagnosis.abatementDateTime]
where Encounter.dischargeDateTime in Interval[start of "Measurement Period" - 12 months, start of "Measurement Period"]
define "Depression Encounter BH":
["Encounter, Performed": "Psych Visit"] Encounter
where Encounter.dischargeDateTime in Interval[start of "Measurement Period" - 12 months, start of "Measurement Period"]
and (
Encounter.principalDiagnosis in "Major Depression Including Remission"
or Encounter.principalDiagnosis in "Dysthymia"
)
define "Depression Face-to-Face":
["Encounter, Performed": "Face to Face Interaction - No ED"] Encounter
with "Major Depression or Dysthymia Diagnosis" Diagnosis
such that Interval[Encounter.admissionDateTime, Encounter.dischargeDateTime]
overlaps Interval[Diagnosis.onsetDateTime, Diagnosis.abatementDateTime]
where Encounter.dischargeDateTime in Interval[start of "Measurement Period" - 12 months, start of "Measurement Period"]
define "Depression Index":
["Risk Category Assessment": "PHQ-9 Tool"] Assessment
with ("Depression Encounter" union "Depression Encounter BH" union "Depression Face-to-Face") Encounter
such that Interval[Assessment.startDateTime, Assessment.stopDateTime]
during Interval[Encounter.admissionDateTime, Encounter.dischargeDateTime]
where Assessment.result > 9
define "Initial Population":
exists (
"Depression Index" Index
where AgeInYearsAt(Index.startDateTime) >= 18
)