Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ind #20

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
32 changes: 32 additions & 0 deletions _refresh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
#DO NOT EDIT WITH WINDOWS
tooling_jar=tooling-cli-2.4.0.jar
input_cache_path=./input-cache
ig_ini_path=$PWD/ig.ini

set -e
echo Checking internet connection...
wget -q --spider tx.fhir.org

if [ $? -eq 0 ]; then
echo "Online"
fsoption=""
else
echo "Offline"
fsoption=""
fi

echo "$fsoption"

tooling=$input_cache_path/$tooling_jar
if test -f "$tooling"; then
java -jar $tooling -RefreshIG -ini="$ig_ini_path" -d -p -t $fsoption
else
tooling=../$tooling_jar
echo $tooling
if test -f "$tooling"; then
java -jar $tooling -RefreshIG -ini="$ig_ini_path" -d -p -t $fsoption
else
echo IG Refresh NOT FOUND in input-cache or parent folder. Please run _updateCQFTooling. Aborting...
fi
fi
23 changes: 17 additions & 6 deletions input/cql/IMMZCommon.cql
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
library IMMZCommon
library IMMZCommon version '4.0.1'

using FHIR version '4.0.1'

include WHOCommon called WCom
include WHOConcepts called Wcon
include FHIRHelpers version '4.0.1'
include FHIRCommon called FC
include FHIRCommon version '4.0.1' called FC
include IMMZConcepts called IMMZc


Expand Down Expand Up @@ -241,21 +241,32 @@ define function Only(protocols List<FHIR.Immunization.ProtocolApplied>):
*/
define function ToDate(choice Choice<FHIR.date, FHIR.string>):
case
when choice is null then null//should not happend
when choice is FHIR.date then
choice as FHIR.date
else
Message(null as FHIR.date, true, '1', 'Error', 'Cannot compute a date from a String value')
when choice is FHIR.string and ConvertsToDate(choice) then
FHIRHelpers.ToDate(choice)
when choice is FHIR.string then
Message(null as FHIR.date, true, '1', 'Error', 'Cannot compute a date from a the string' + choice)
else
Message(null as FHIR.date, true, '1', 'Error', 'Cannot compute a datetime from the source' )//should not happend
end

/**
* @description Takes the date choice of a date/string choice (for Immunization date)
*/
define function ToDateTime(choice Choice<FHIR.dateTime, FHIR.string>):
case
when choice is null then null//should not happend
when choice is FHIR.dateTime then
choice as FHIR.dateTime
else
Message(null as FHIR.dateTime, true, '1', 'Error', 'Cannot compute a date from a String value')
when choice is FHIR.string and ConvertsToDateTime(choice) then
FHIRHelpers.ToDateTime(choice)
when choice is FHIR.string then
Message(null as FHIR.dateTime, true, '1', 'Error', 'Cannot compute a datetime from a the string' + choice)
else
Message(null as FHIR.dateTime, true, '1', 'Error', 'Cannot compute a datetime from the source' )//should not happend

end


Expand Down
6 changes: 3 additions & 3 deletions input/cql/IMMZConcepts.cql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ codesystem "SNOMED-CT": 'http://snomed.info/sct'
codesystem "LOINC": 'http://loinc.org'
codesystem "RxNorm": 'http://www.nlm.nih.gov/research/umls/rxnorm'
codesystem "CIEL": 'http://hl7.org/fhir/sid/ciel'
codesystem "ICD-11": 'http://hl7.org/fhir/sid/icd-11'
codesystem "ICD-11": 'http://hl7.org/fhir/sid/icd-11/mms'
codesystem "ICHI": 'https://mitel.dimi.uniud.it/ichi/#http://id.who.int/ichi'
codesystem "ICF": 'http://hl7.org/fhir/sid/icf-nl'
codesystem "Extended Codes CodeSystem codes": 'http://fhir.org/guides/who/anc-cds/CodeSystem/anc-custom-codes'
Expand All @@ -25,7 +25,7 @@ valueset "Positive Result": 'http://smart.who.int/ig/smart-immunizations-measles
valueset "Immunocompromised": 'http://smart.who.int/ig/smart-immunizations-measles/ValueSet/Immunocompromised-values'
valueset "Patient birth weight observation value": 'http://smart.who.int/ig/smart-immunizations-measles/ValueSet/Birthweight-values'
valueset "PretermBirth": 'http://smart.who.int/ig/smart-immunizations-measles/ValueSet/Preterm-values'
valueset "Live Attenuated": 'http://smart.who.int/ig/smart-immunizations-measles/ValueSet/LiveAttenduatedVaccines'
valueset "Live Attenuated": 'http://smart.who.int/ig/smart-immunizations-measles/ValueSet/LiveAttenuatedVaccines'

//valueset "Target Disease": 'http://hl7.org/fhir/ValueSet/immunization-target-disease'

Expand All @@ -37,7 +37,7 @@ valueset "ARV Drugs": 'http://smart.who.int/ig/smart-immunizations-measles/Value

// Vaccine Value Sets

valueset "MCV Vaccine": 'http://smart.who.int/ig/smart-immunizations-measles/ValueSet/IMMZ.A1.DE9'
valueset "MCV Vaccine": 'http://smart.who.int/ig/smart-immunizations-measles/ValueSet/IMMZ.Z.DE9'

// Plugin is complaining about not finding these so that should be resolved, but here until it can be fixed
valueset "BCG Vaccine": 'http://smart.who.int/ig/smart-immunizations-measles/ValueSet/IMMZ.A1.DE1'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
/*
* Library: IMMZD2DTMeasles (IMMZ.D2.DT.Measles)
* Library: IMMZD2DTMeaslesLogic (IMMZ.D2.DT.Measles)
* Rule: If the child or patient has not been given MCV1 (at 9 months) and MCV2 (between 15-18 months) vaccination
* Trigger: Patient has never received measles vaccination
*/
library IMMZD2DTMeasles
library IMMZD2DTMeaslesLogic
// Start Skeleton CQL
using FHIR version '4.0.1'
include FHIRHelpers version '4.0.1'
include IMMZCommon called IMMZCom
include IMMZConcepts called IMMZc
include IMMZConfig called IMMZCon
include IMMZVaccineLibrary called IMMZvl
include FHIRCommon called FC

parameter "Individual is at high risk of contracting measles" Boolean default false
parameter "Individual is travelling to a country experiencing measles outbreaks" Boolean default false
Expand Down
1 change: 0 additions & 1 deletion input/cql/IMMZDT08.cql
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ include IMMZCommon called IMMZCom
include IMMZConcepts called IMMZc
include IMMZConfig called IMMZCon
include IMMZVaccineLibrary called IMMZvl
include FHIRCommon called FC

parameter "Individual is at high risk of contracting measles" Boolean default false
parameter "Individual is travelling to a country experiencing measles outbreaks" Boolean default false
Expand Down
1 change: 0 additions & 1 deletion input/cql/IMMZIND08.cql
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ include IMMZConcepts called IMMZc
include IMMZConfig called IMMZCon
include IMMZIndicatorCommon called IMMZIndCom
include IMMZVaccineLibrary called IMMZvl
include FHIRCommon called FC
// End Skeleton CQL
parameter "Measurement Period" Interval<Date>

Expand Down
45 changes: 26 additions & 19 deletions input/cql/IMMZINDMeasles.cql
Original file line number Diff line number Diff line change
Expand Up @@ -26,52 +26,59 @@ include IMMZCommon called IMMZCom
include IMMZConcepts called IMMZc
include IMMZConfig called IMMZCon
include IMMZIndicatorCommon called IMMZIndCom
include IMMZVaccineLibrary called IMMZvl
include FHIRCommon called FC
include IMMZD2DTMeasles called Measles
// End Skeleton CQL
parameter "Measurement Period" Interval<Date>
parameter "Measurement Period" Interval<DateTime> default Interval[@2019-03-01T00:00:00.0, @2019-04-01T00:00:00.0 )

context Patient

/*
define "MCV Doses Administered to Patient During Measurement Period":
Measles."MCV Doses Administered to Patient" I
where IMMZCom.ToDate(I.occurrence) during "Measurement Period"
*/
define getPatientImmunisationMeasles:
[Immunization] I
where I.status = 'completed'
and I.vaccineCode in IMMZc."MCV Vaccine"
sort by date from (occurrence as FHIR.dateTime) desc

define getFirstDose:
getPatientImmunisationMeasles I
where Coalesce(First(I.protocolApplied pa where pa.doseNumber is not null).doseNumber.value as Integer,1) = 1
sort by date from (occurrence as FHIR.dateTime) desc

define getSecondDose:

getPatientImmunisationMeasles I
where Coalesce(First(I.protocolApplied pa where pa.doseNumber is not null).doseNumber.value as Integer,1) = 2
or ( I.occurrence after (First(getFirstDose).occurrence + 4 weeks ))
sort by date from (occurrence as FHIR.dateTime) desc

define function "Measure Observation" (Patient "Patient"):
1

/*
* Target population for first dose: Any one over 9 (in high transmission area) or 12 (in low transmission area) months old
*/
define "Initial Population 05":
Measles."First MCV Dose Administered to Patient" I where IMMZCom.ToDate(I.occurrence) during "Measurement Period"
define "Measure Population 05":
(getFirstDose I where I.occurrence during "Measurement Period")


/*
* Numerator for first dose: Anyone having received the first dose
*/
define "Measure Population 05":
"Initial Population 05"
define "Initial Population 05":
(getFirstDose)

/*
* Target population for second dose: Any one over 15 months
*/
define "Initial Population 40":
Measles."Second MCV Dose Administered to Patient" I where IMMZCom.ToDate(I.occurrence) during "Measurement Period"
(getSecondDose)

/*
* Numerator for second dose: Anyone having received the first dose
*/
define "Measure Population 40":
"Initial Population 40"
(getSecondDose I where ( I.occurrence) during "Measurement Period")


/*
* Combined stratifiers
*/
define "Stratification":
IMMZIndCom."By Administrative Gender Stratifier".code + ':' + IMMZIndCom."Toddler By Age Stratifier".code + ':' + IMMZIndCom."By Geographic Region Stratifier"

Patient.gender.value

2 changes: 1 addition & 1 deletion input/cql/IMMZIndicatorCommon.cql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ library IMMZIndicatorCommon
using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
include FHIRCommon called FC
include FHIRCommon version '4.0.1' called FC
include IMMZCommon called IMMZCom
include IMMZConcepts called IMMZc
include WHOCommon called WCom
Expand Down
1 change: 0 additions & 1 deletion input/cql/IMMZVaccineLibrary.cql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ using FHIR version '4.0.1'
include WHOCommon called WCom
include WHOConcepts called Wcon
include FHIRHelpers version '4.0.1'
include FHIRCommon called FC
include IMMZConcepts called IMMZc
include IMMZCommon called IMMZcom

Expand Down
2 changes: 1 addition & 1 deletion input/cql/WHOCommon.cql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'

include FHIRCommon called FC
include FHIRCommon version '4.0.1' called FC

context Patient

Expand Down
2 changes: 1 addition & 1 deletion input/cql/WHOConcepts.cql
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ codesystem "SNOMED-CT": 'http://snomed.info/sct'
codesystem "LOINC": 'http://loinc.org'
codesystem "RxNorm": 'http://www.nlm.nih.gov/research/umls/rxnorm'
codesystem "CIEL": 'http://hl7.org/fhir/sid/ciel'
codesystem "ICD-11": 'http://id.who.int/icd11/mms'
codesystem "ICD-11": 'http://hl7.org/fhir/sid/icd-11/mms'
codesystem "ICHI": 'https://mitel.dimi.uniud.it/ichi/#http://id.who.int/ichi'
codesystem "ICF": 'http://hl7.org/fhir/sid/icf-nl'
codesystem "Extended Codes CodeSystem codes": 'http://fhir.org/guides/who/anc-cds/CodeSystem/anc-custom-codes'
Expand Down
3 changes: 2 additions & 1 deletion input/fsh/Aliases.fsh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Alias: $SCT = http://snomed.info/sct
Alias: $LNC = http://loinc.org
Alias: $ICD11 = http://id.who.int/icd11/mms
Alias: $ICD11 = http://hl7.org/fhir/sid/icd-11/mms
Alias: $ICD10 = http://hl7.org/fhir/sid/icd-10
Alias: $CVX = http://hl7.org/fhir/sid/cvx
Alias: $GENDER = http://hl7.org/fhir/administrative-gender

Alias: $library-type = http://terminology.hl7.org/CodeSystem/library-type
Alias: $measure-scoring = http://terminology.hl7.org/CodeSystem/measure-scoring
Alias: $measure-population = http://terminology.hl7.org/CodeSystem/measure-population
2 changes: 1 addition & 1 deletion input/fsh/activitydefinitions/IMMZD2DTMeaslesEval.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ Usage: #definition
* expression
* description = "Measles Code"
* language = #text/cql
* expression = "Code { system: 'http://hl7.org/fhir/sid/icd-11', code: 'XM28X5' }"
* expression = "Code { system: 'http://hl7.org/fhir/sid/icd-11/mms', code: 'XM28X5' }"
16 changes: 16 additions & 0 deletions input/fsh/libraries/FHIRCommon.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Instance: FHIRCommon
InstanceOf: Library
Title: "FHIRCommon"
Description: "This library defines terminologies and functions commonly used in FHIR-based CQL artifacts"
Usage: #definition
* url = "http://smart.who.int/ig/smart-immunizations-measles/Library/FHIRCommon"
* extension[+]
* url = "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability"
* valueCode = #computable
* version = "0.1.0"
* name = "FHIRCommon"
* status = #draft
* experimental = false
* publisher = "World Health Organization (WHO)"
* type = $library-type#logic-library
* content.id = "ig-loader-FHIRCommon.cql"
17 changes: 17 additions & 0 deletions input/fsh/libraries/FHIRHelpers.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Instance: FHIRHelpers
InstanceOf: Library
Title: "FHIRHelpers"
Description: "
This library defines functions to convert between FHIR data types and CQL system-defined types, as well as functions to support FHIRPath implementation. For more information, the FHIRHelpers wiki page: https://github.com/cqframework/clinical_quality_language/wiki/FHIRHelpers"
Usage: #definition
* url = "http://smart.who.int/ig/smart-immunizations-measles/Library/FHIRHelpers"
* extension[+]
* url = "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability"
* valueCode = #computable
* version = "0.1.0"
* name = "FHIRHelpers"
* status = #draft
* experimental = false
* publisher = "World Health Organization (WHO)"
* type = $library-type#logic-library
* content.id = "ig-loader-FHIRHelpers.cql"
16 changes: 16 additions & 0 deletions input/fsh/libraries/IMMZCommon.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Instance: IMMZCommon
InstanceOf: Library
Title: "IMMZCommon"
Description: "This library defines common terminologies and functions used throughout the Immunization CPG"
Usage: #definition
* url = "http://smart.who.int/ig/smart-immunizations-measles/Library/IMMZCommon"
* extension[+]
* url = "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability"
* valueCode = #computable
* version = "0.1.0"
* name = "IMMZCommon"
* status = #draft
* experimental = false
* publisher = "World Health Organization (WHO)"
* type = $library-type#logic-library
* content.id = "ig-loader-IMMZCommon.cql"
16 changes: 16 additions & 0 deletions input/fsh/libraries/IMMZCommonIzDataElements.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Instance: IMMZCommonIzDataElements
InstanceOf: Library
Title: "IMMZCommonIzDataElements"
Description: "This library defines common terminologies and functions used throughout the Immunization CPG"
Usage: #definition
* url = "http://smart.who.int/ig/smart-immunizations-measles/Library/IMMZCommonIzDataElements"
* extension[+]
* url = "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability"
* valueCode = #computable
* version = "0.1.0"
* name = "IMMZCommonIzDataElements"
* status = #draft
* experimental = false
* publisher = "World Health Organization (WHO)"
* type = $library-type#logic-library
* content.id = "ig-loader-IMMZCommonIzDataElements.cql"
16 changes: 16 additions & 0 deletions input/fsh/libraries/IMMZConcepts.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Instance: IMMZConcepts
InstanceOf: Library
Title: "IMMZConcepts"
Description: "This library defines concepts used throughout the Immunization CPG"
Usage: #definition
* url = "http://smart.who.int/ig/smart-immunizations-measles/Library/IMMZConcepts"
* extension[+]
* url = "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability"
* valueCode = #computable
* version = "0.1.0"
* name = "IMMZConcepts"
* status = #draft
* experimental = false
* publisher = "World Health Organization (WHO)"
* type = $library-type#logic-library
* content.id = "ig-loader-IMMZConcepts.cql"
16 changes: 16 additions & 0 deletions input/fsh/libraries/IMMZConfig.fsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Instance: IMMZConfig
InstanceOf: Library
Title: "IMMZConfig"
Description: "This library defines configuration points for the Immunization CPG"
Usage: #definition
* url = "http://smart.who.int/ig/smart-immunizations-measles/Library/IMMZConfig"
* extension[+]
* url = "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability"
* valueCode = #computable
* version = "0.1.0"
* name = "IMMZConfig"
* status = #draft
* experimental = false
* publisher = "World Health Organization (WHO)"
* type = $library-type#logic-library
* content.id = "ig-loader-IMMZConfig.cql"
Loading
Loading