Skip to content

Commit 495efea

Browse files
committed
Added in CQL for decision table for measles to test out the entire process. Updated tools based on SOPs. Updated sushi-config to load the CQL into the FSH library files.
1 parent 79c8aa0 commit 495efea

File tree

59 files changed

+2300
-6
lines changed

Some content is hidden

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

59 files changed

+2300
-6
lines changed

input/cql/IMMZCommon.cql

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
library IMMZCommon
2+
3+
using FHIR version '4.0.1'
4+
5+
include FHIRHelpers version '4.0.1'
6+
7+
/**
8+
* @description Fetches a singleton protocol applied from an immunization
9+
* @comment The protocol list from the immunization
10+
*/
11+
define function Only(protocols List<FHIR.Immunization.ProtocolApplied>):
12+
singleton from protocols
13+
14+
/**
15+
* @description Fetches a singleton protocol applied from an immunization
16+
* @comment The protocol list from the immunization
17+
*/
18+
define fluent function only(protocols List<FHIR.Immunization.ProtocolApplied>):
19+
singleton from protocols
20+
21+
/**
22+
* @description Takes the date choice of a date/string choice (for Immunization date)
23+
*/
24+
define function ToDate(choice Choice<FHIR.date, FHIR.string>):
25+
case
26+
when choice is FHIR.date then
27+
choice as FHIR.date
28+
else
29+
Message(null as FHIR.date, true, '1', 'Error', 'Cannot compute a date from a String value')
30+
end
31+
32+
/**
33+
* @description Takes the date choice of a date/string choice (for Immunization date)
34+
*/
35+
define function ToDateTime(choice Choice<FHIR.dateTime, FHIR.string>):
36+
case
37+
when choice is FHIR.dateTime then
38+
choice as FHIR.dateTime
39+
else
40+
Message(null as FHIR.dateTime, true, '1', 'Error', 'Cannot compute a date from a String value')
41+
end
42+
43+
44+
/**
45+
* @description Takes a choice of FHIR.string and FHIR.positiveInt and ensures the result is a FHIR.positiveInt
46+
*/
47+
define function ToPositiveInt(choice Choice<FHIR.positiveInt, FHIR.string>):
48+
case
49+
when choice is FHIR.positiveInt then
50+
choice as FHIR.positiveInt
51+
else
52+
Message(null as FHIR.positiveInt, true, '1', 'Error', 'Cannot compute a positive from a String value') // TODO: I'm sure that this is supported somehow?
53+
end
54+
55+
56+
/**
57+
* @description Takes a choice between a Medication and a CodeableConcept and returns just the code of the medication
58+
*/
59+
define function ExtractMedicationCode(choice Choice<FHIR.CodeableConcept, FHIR.Reference>):
60+
case
61+
when choice is FHIR.CodeableConcept then
62+
choice as FHIR.CodeableConcept
63+
when choice is FHIR.Reference then
64+
First([Medication] M
65+
where M.id = Last(Split(choice.reference, '/'))
66+
return M.code as FHIR.CodeableConcept)
67+
else
68+
Message(null as FHIR.CodeableConcept, true, '1', 'Error', 'Cannot compute a medication code') // TODO: I'm sure that this is supported somehow?
69+
end
70+
71+
72+
/**
73+
* @description Takes a choice between a Medication and a CodeableConcept and returns just the code of the medication
74+
*/
75+
define function ExtractMedicationInitiationDate(choice Choice<FHIR.dateTime, FHIR.Period>):
76+
case
77+
when choice is FHIR.Period then
78+
start of (choice as FHIR.Period)
79+
when choice is FHIR.dateTime then
80+
choice as FHIR.dateTime
81+
else
82+
Message(null as FHIR.dateTime, true, '1', 'Error', 'Cannot compute medication treatment initiation date') // TODO: I'm sure that this is supported somehow?
83+
end
84+

input/cql/IMMZConcepts.cql

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
library IMMZConcepts
2+
3+
codesystem "IMMZC": 'http://smart.who.int/immunizations/CodeSystem/IMMZ.C'
4+
codesystem "IMMZD": 'http://smart.who.int/immunizations/CodeSystem/IMMZ.D'
5+
codesystem "IMMZZ": 'http://smart.who.int/immunizations/CodeSystem/IMMZ.Z'
6+
7+
//WHO ATC IPS Valueset
8+
valueset "WHO ATC": 'http://hl7.org/fhir/uv/ips/ValueSet/whoatc-uv-ips'
9+
10+
// General use ValueSets
11+
12+
13+
// Vaccine Value Sets
14+
15+
valueset "Live Attenuated": 'http://smart.who.int/immunizations/ValueSet/IMMZ.Z.LiveAttenuated'
16+
valueset "MCV Vaccine": 'http://smart.who.int/immunizations/ValueSet/IMMZ.Z.DE9'
17+
18+
valueset "BCG Vaccine": 'http://smart.who.int/immunizations/ValueSet/IMMZ.Z.DE1'
19+
valueset "Cholera Vaccine": 'http://smart.who.int/immunizations/ValueSet/IMMZ.Z.DE2'

input/cql/IMMZD2DTMeaslesElements.cql

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/*
2+
* Library: IMMZD2DTMeaslesElements
3+
*/
4+
library IMMZD2DTMeaslesElements
5+
6+
using FHIR version '4.0.1'
7+
include FHIRHelpers version '4.0.1'
8+
9+
include WHOConcepts
10+
include WHOCommon called WC
11+
include WHOElements called WE
12+
13+
include IMMZCommon called Common
14+
include IMMZConcepts called Concepts
15+
include IMMZElements called Elements
16+
17+
context Patient
18+
19+
20+
/*
21+
@internal: MCV containing Doses Administered to Patient
22+
*/
23+
define "MCV Doses Administered to Patient":
24+
Elements."Doses Administered to Patient" I
25+
where
26+
I.vaccineCode in Concepts."MCV Vaccine"
27+
and I.isSubpotent is not true
28+
29+
/*
30+
@internal: MCV containing Doses Administered to Patient that are in the Primary series
31+
*/
32+
define "MCV Primary Series Doses Administered to Patient":
33+
"MCV Doses Administered to Patient" I
34+
where
35+
exists( I.protocolApplied pa where pa.series = 'Primary series' )
36+
37+
/*
38+
@internal: Number of MCV Primary Series doses
39+
*/
40+
define "Number of MCV Primary Series Doses Administered":
41+
Count("MCV Primary Series Doses Administered to Patient")
42+
43+
/*
44+
@input: No measles primary series doses were administered
45+
@pseudocode: Count of vaccines administered (where "Vaccine type" = "Measles-containing vaccines" and "Type of dose" = "Primary series") = 0
46+
*/
47+
define "No measles primary series doses were administered":
48+
"Number of MCV Primary Series Doses Administered" = 0
49+
50+
/*
51+
@input: MCV1 was administered
52+
@pseudocode: Count of vaccines administered (where "Vaccine type" = "Measles-containing vaccines" and "Type of dose" = "Primary series") = 1
53+
*/
54+
define "MCV1 was administered":
55+
"Number of MCV Primary Series Doses Administered" = 1
56+
57+
/*
58+
@input: MCV2 was administered
59+
@pseudocode: Count of vaccines administered (where "Vaccine type" = "Measles-containing vaccines" and "Type of dose" = "Primary series") = 2
60+
*/
61+
define "MCV2 was administered":
62+
"Number of MCV Primary Series Doses Administered" = 2
63+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
2+
/*
3+
* Library: IMMZD2DTMeaslesEncounterElements
4+
*/
5+
library IMMZD2DTMeaslesEncounterElements
6+
7+
using FHIR version '4.0.1'
8+
include FHIRHelpers version '4.0.1'
9+
10+
include WHOConcepts
11+
include WHOCommon called WC
12+
include WHOElements called WE
13+
14+
include IMMZCommon called Common
15+
include IMMZConcepts called Concepts
16+
17+
include IMMZEncounterElements called Encounter
18+
19+
include IMMZD2DTMeaslesElements called MeaslesElements
20+
21+
parameter Today Date default Today()
22+
parameter EncounterId String
23+
24+
context Patient
25+
26+
/*
27+
@internal: MCV containing Doses Administered to Patient
28+
*/
29+
define "MCV Doses Administered to Patient":
30+
Encounter."Doses Administered to Patient" I
31+
where
32+
I.occurrence.toInterval() on or before Today
33+
34+
/*
35+
@internal: MCV containing Doses Administered to Patient that are in the Primary series
36+
*/
37+
define "MCV Primary Series Doses Administered to Patient":
38+
MeaslesElements."MCV Primary Series Doses Administered to Patient" I
39+
where
40+
I.occurrence.toInterval() on or before Today
41+
42+
/*
43+
@internal: Number of MCV Primary Series doses
44+
*/
45+
define "Number of MCV Primary Series Doses Administered":
46+
Count("MCV Primary Series Doses Administered to Patient")
47+
48+
/*
49+
@input: No measles primary series doses were administered
50+
@pseudocode: Count of vaccines administered (where "Vaccine type" = "Measles-containing vaccines" and "Type of dose" = "Primary series") = 0
51+
*/
52+
define "No measles primary series doses were administered":
53+
"Number of MCV Primary Series Doses Administered" = 0
54+
55+
/*
56+
@input: MCV1 was administered
57+
@pseudocode: Count of vaccines administered (where "Vaccine type" = "Measles-containing vaccines" and "Type of dose" = "Primary series") = 1
58+
*/
59+
define "MCV1 was administered":
60+
"Number of MCV Primary Series Doses Administered" = 1
61+
62+
/*
63+
@input: MCV2 was administered
64+
@pseudocode: Count of vaccines administered (where "Vaccine type" = "Measles-containing vaccines" and "Type of dose" = "Primary series") = 2
65+
*/
66+
define "MCV2 was administered":
67+
"Number of MCV Primary Series Doses Administered" = 2
68+

0 commit comments

Comments
 (0)