Skip to content

Commit 14cf98d

Browse files
committed
Added in CQL/plandef for Yellow Fever decision tables and contraindications. Added examples/tests for these. Added MedicationRequest to all Measles contraindication examples.
1 parent 20d4904 commit 14cf98d

File tree

45 files changed

+1296
-9
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1296
-9
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ temp
55
template
66
bundles
77
*.jar
8-
.DS_Store
8+
.DS_Store
9+
**/tests-*-bundle.json

input/cql/IMMZCommon.cql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ define "Severe Allergic Reactions Condition":
149149
define "Symptomatic HIV Infection Condition":
150150
[Condition: IMMZc."Symptomatic HIV infection"]
151151

152+
define "Severely immunocompromised Condition":
153+
[Condition: IMMZc."Severely immunocompromised"]
154+
155+
define "Breastfeeding Condition":
156+
[Condition: IMMZc."Breastfeeding"]
152157

153158
/******************************
154159
* Test Results

input/cql/IMMZConcepts.cql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ valueset "HIV status - HIV negative Choices": 'http://fhir.org/guides/who/anc-cd
3535

3636
valueset "ARV Drugs": 'http://smart.who.int/ig/smart-immunizations/ValueSet/ARVDrugs-values'
3737

38-
// Vaccine Value Sets
38+
// Vaccine Value Sets
3939

4040
valueset "MCV Vaccine": 'http://smart.who.int/ig/smart-immunizations/ValueSet/IMMZ.Z.DE9'
41+
valueset "Yellow Fever Vaccine": 'http://smart.who.int/ig/smart-immunizations/ValueSet/IMMZ.Z.DE23'
4142

4243
// Plugin is complaining about not finding these so that should be resolved, but here until it can be fixed
4344
valueset "BCG Vaccine": 'http://smart.who.int/ig/smart-immunizations/ValueSet/IMMZ.A1.DE1'
@@ -53,3 +54,5 @@ code "Severely immunosuppressed": 'DE165' from "IMMZ.D" display 'Severely immuno
5354
code "History of anaphylactic reactions": 'DE166' from "IMMZ.D" display 'History of anaphylactic reactions'
5455
code "Severe allergic reactions": 'DE167' from "IMMZ.D" display 'Severe allergic reactions'
5556
code "Symptomatic HIV infection": 'DE168' from "IMMZ.D" display 'Symptomatic HIV infection'
57+
code "Severely immunocompromised": 'DE200' from "IMMZ.D" display 'Severely immunocompromised'
58+
code "Breastfeeding": 'DE191' from "IMMZ.D" display 'Breastfeeding'

input/cql/IMMZD2DTYellowFever.cql

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/*
2+
* Library: IMMZD2DTYellowFever (IMMZ.D2.DT.YellowFever)
3+
* Rule: Determine if the client is due for a yellow fever vaccination according to the national immunization protocol
4+
* Trigger: IMMZ.D2 Determine required vaccination(s) if any
5+
*/
6+
library IMMZD2DTYellowFever
7+
// Start Skeleton CQL
8+
using FHIR version '4.0.1'
9+
include FHIRHelpers version '4.0.1'
10+
include IMMZCommon called IMMZCom
11+
include IMMZConcepts called IMMZc
12+
include IMMZConfig called IMMZCon
13+
include IMMZVaccineLibrary called IMMZvl
14+
include FHIRCommon called FC
15+
include IMMZD2DTYellowFeverInput called input
16+
17+
// End Skeleton CQL
18+
context Patient
19+
20+
/*
21+
@dynamicValue: Due date of the dose
22+
*/
23+
define "Due date of the dose":
24+
Now()
25+
26+
/*
27+
@dynamicValue: Guidance
28+
*/
29+
define "Guidance":
30+
case
31+
when "Yellow fever immunization schedule is complete" then "Yellow fever immunization schedule is complete Guidance"
32+
when "Client is due for yellow fever vaccination" then "Client is due for yellow fever vaccination Guidance"
33+
when "Client is not due for yellow fever vaccination" then "Client is not due for yellow fever vaccination Guidance"
34+
else null
35+
end
36+
37+
/*
38+
@output: Client is not due for yellow fever vaccination
39+
@pseudocode: "Immunization recommendation status" = 'Not due'
40+
*/
41+
define "Client is not due for yellow fever vaccination":
42+
"Client is not due for yellow fever vaccination Case 1" or "Client is not due for yellow fever vaccination Case 2"
43+
44+
/*
45+
@output: Client is not due for yellow fever vaccination Guidance
46+
@guidance: Should not vaccinate client for yellow fever dose as client's age is less than 9 months. Check for any vaccines due, and inform the caregiver of when to come back for the next dose.
47+
@guidance: Should not vaccinate client for yellow fever dose as live vaccine was administered in the last 4 weeks. Check for any vaccines due, and inform the caregiver of when to come back for the first dose.
48+
*/
49+
define "Client is not due for yellow fever vaccination Guidance":
50+
case
51+
when "Client is not due for yellow fever vaccination Case 1" then 'Should not vaccinate client for yellow fever dose as client\'s age is less than 9 months. Check for any vaccines due, and inform the caregiver of when to come back for the next dose.'
52+
when "Client is not due for yellow fever vaccination Case 2" then 'Should not vaccinate client for yellow fever dose as live vaccine was administered in the last 4 weeks. Check for any vaccines due, and inform the caregiver of when to come back for the first dose.'
53+
else ''
54+
end
55+
56+
/*
57+
@output: Client is not due for yellow fever vaccination Case 1
58+
@pseudocode: "Immunization recommendation status" = 'Not due'
59+
*/
60+
define "Client is not due for yellow fever vaccination Case 1":
61+
input."No yellow fever primary series doses were administered"
62+
and input."Client's age is less than 9 months"
63+
64+
/*
65+
@output: Client is not due for yellow fever vaccination Case 2
66+
@pseudocode: "Immunization recommendation status" = 'Not due'
67+
*/
68+
define "Client is not due for yellow fever vaccination Case 2":
69+
input."No yellow fever primary series doses were administered"
70+
and input."Client's age is more than or equal to 9 months"
71+
and input."Live vaccine was administered in the last 4 weeks"
72+
73+
/*
74+
@output: Client is due for yellow fever vaccination
75+
@pseudocode: "Immunization recommendation status" = "Due"
76+
*/
77+
define "Client is due for yellow fever vaccination":
78+
input."No yellow fever primary series doses were administered"
79+
and input."Client's age is more than or equal to 9 months"
80+
and input."No live vaccine was administered in the last 4 weeks"
81+
82+
/*
83+
@output: Client is due for yellow fever vaccination Guidance
84+
@guidance: Should vaccinate client for yellow fever dose as no yellow fever dose was administered, client is within appropriate age range and no live vaccine was administered in the last 4 weeks. Check for contraindications.
85+
*/
86+
define "Client is due for yellow fever vaccination Guidance":
87+
if "Client is due for yellow fever vaccination" then 'Should vaccinate client for yellow fever dose as no yellow fever dose was administered, client is within appropriate age range and no live vaccine was administered in the last 4 weeks. Check for contraindications.'
88+
else ''
89+
90+
/*
91+
@output: Yellow fever immunization schedule is complete
92+
@pseudocode: "Immunization recommendation status"" = 'Complete'
93+
@pseudocode: "Completed the primary vaccination series" = TRUE (where "Vaccine type" = "Yellow fever containing vaccines")
94+
*/
95+
define "Yellow fever immunization schedule is complete":
96+
input."One yellow fever primary series dose was administered"
97+
98+
/*
99+
@output: Yellow fever immunization schedule is complete Guidance
100+
@guidance: Yellow fever immunization schedule is complete. One yellow fever primary series dose was administered. Check for any other vaccines due.
101+
*/
102+
define "Yellow fever immunization schedule is complete Guidance":
103+
if "Yellow fever immunization schedule is complete" then 'Yellow fever immunization schedule is complete. One yellow fever primary series dose was administered. Check for any other vaccines due.'
104+
else ''
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
/*
2+
* Library: IMMZD2DTYellowFeverInput (IMMZ.D2.DT.YellowFeverInput)
3+
* Rule: Determine if the client is due for a yellow fever vaccination according to the national immunization protocol
4+
* Trigger: IMMZ.D2 Determine required vaccination(s) in any
5+
*/
6+
library IMMZD2DTYellowFeverInput
7+
// Start Skeleton CQL
8+
using FHIR version '4.0.1'
9+
include FHIRHelpers version '4.0.1'
10+
include IMMZCommon called IMMZCom
11+
include IMMZConcepts called IMMZc
12+
include IMMZConfig called IMMZCon
13+
include IMMZVaccineLibrary called IMMZvl
14+
include FHIRCommon called FC
15+
16+
// End Skeleton CQL
17+
context Patient
18+
19+
/*
20+
@internal: Yellow Fever containing Doses Administered to Patient
21+
*/
22+
define "Yellow Fever Doses Administered to Patient":
23+
IMMZCom."Doses Administered to Patient" I
24+
where
25+
I.vaccineCode in IMMZc."Yellow Fever Vaccine"
26+
27+
/*
28+
@input: No yellow fever primary series doses were administered
29+
@pseudocode: Count of vaccines administered (where "Vaccine type" = "Yellow fever containing vaccines" and "Type of dose" = "Primary series" ) = 0
30+
*/
31+
define "No yellow fever primary series doses were administered":
32+
not exists("Yellow Fever Doses Administered to Patient" I where I.occurrence after Patient.birthDate + 9 months)
33+
34+
/*
35+
@input: One yellow fever primary series dose was administered
36+
@pseudocode: Count of vaccines administered (where "Vaccine type" = "Yellow fever containing vaccines" and "Type of dose" = "Primary series" ) = 1
37+
*/
38+
define "One yellow fever primary series dose was administered":
39+
Count("Yellow Fever Doses Administered to Patient" I where I.occurrence after Patient.birthDate + 9 months) >= 1
40+
41+
/*
42+
@input: Client's age is less than 6 months
43+
@pseudocode: Today's date - "Date of birth" < 6 'month'
44+
*/
45+
define "Client's age is less than 6 months":
46+
IMMZCom."Current Patient Age In Months" < 6
47+
48+
/*
49+
@input: Client's age is between 6 to 9 months
50+
@pseudocode: 6 'month' ≤ Today's date - "Date of birth" < 9 'month'
51+
*/
52+
define "Client's age is between 6 to 9 months":
53+
not("Client's age is less than 6 months") and "Client's age is less than 9 months"
54+
55+
/*
56+
@input: Client's age is less than 9 months
57+
@pseudocode: Today's date - "Date of birth" < 9 'month'"
58+
*/
59+
define "Client's age is less than 9 months":
60+
IMMZCom."Current Patient Age In Months" < 9
61+
62+
/*
63+
@input: Client's age is more than or equal to 9 months
64+
@pseudocode: Today's date - "Date of birth" ≥ 9 'month'
65+
*/
66+
define "Client's age is more than or equal to 9 months":
67+
not ("Client's age is less than 9 months")
68+
69+
/*
70+
@input: Client's age is more than or equal to 60 years
71+
@pseudocode: 'Today's date - ""Date of birth"" ≥ 60 'year'
72+
*/
73+
define "Client's age is more than or equal to 60 years":
74+
IMMZCom."Current Patient Age In Years" >= 60
75+
76+
/*
77+
@input: Live vaccine was administered in the last 4 weeks
78+
@pseudocode: Today's date - latest "Date and time of vaccination" (where "Live vaccine" = TRUE) < 4 'week'
79+
*/
80+
define "Live vaccine was administered in the last 4 weeks":
81+
IMMZCom."Date of Latest Live Attenuated Vaccine" is not null and IMMZCom."Date of Latest Live Attenuated Vaccine" + 4 weeks > Now()
82+
83+
/*
84+
@input: No live vaccine was administered in the last 4 weeks
85+
@pseudocode: Today's date - latest "Date and time of vaccination" (where "Live vaccine" = TRUE) ≥ 4 'week'
86+
*/
87+
define "No live vaccine was administered in the last 4 weeks":
88+
not("Live vaccine was administered in the last 4 weeks")
89+
90+
/*
91+
@input: The client is currently pregnant
92+
@pseudocode: "Potential contraindications" = 'Currently pregnant'
93+
*/
94+
define "The client is currently pregnant":
95+
IMMZCom."Pregnant"
96+
97+
/*
98+
@input: The client has a history of severe allergic reactions
99+
@pseudocode: "Potential contraindications" = 'Severe allergic reactions'
100+
*/
101+
define "The client has a history of severe allergic reactions":
102+
exists(IMMZCom."Severe Allergic Reactions Condition")
103+
104+
/*
105+
@input: The client is severely immunocompromised
106+
@psuedocode: "Potential contraindications" = "Severely immunocompromised"
107+
*/
108+
define "The client is severely immunocompromised":
109+
exists(IMMZCom."Severely immunocompromised Condition")
110+
111+
/*
112+
@input: The client has a symptomatic HIV infection
113+
@pseudocode: "Potential contraindications" = 'Symptomatic HIV infection'
114+
*/
115+
define "The client has a symptomatic HIV infection":
116+
exists(IMMZCom."Symptomatic HIV Infection Condition")
117+
118+
/*
119+
@input: The client is lactating
120+
@psuedocode: "Potential contraindications" = "Breastfeeding"
121+
*/
122+
define "The client is lactating":
123+
exists(IMMZCom."Breastfeeding Condition")

input/cql/IMMZD5DTMeaslesCI.cql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ context Patient
2121
@internal: Draft Medication Request for MCV dose
2222
*/
2323
define "Draft Medication Request for MCV dose":
24-
[MedicationRequest] MR where MR.status = 'draft' and MR.intent = 'proposal'
24+
[MedicationRequest: IMMZc."MCV Vaccine"] MR where MR.status = 'draft' and MR.intent = 'proposal'
2525
sort by date from (authoredOn as FHIR.dateTime) desc
2626

2727
/*

0 commit comments

Comments
 (0)