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

Updated dependencies #32

Merged
merged 11 commits into from
Jun 6, 2024
562 changes: 281 additions & 281 deletions input/cql/FHIRCommon.cql → _unused/FHIRCommon.cql

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions input/fsh/libraries/FHIRCommon.fsh → _unused/FHIRCommon.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ 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/immunizations-measles/Library/FHIRCommon"
* url = "http://fhir.org/guides/cqf/common/Library/FHIRCommon"
* extension[+]
* url = "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability"
* url = "http://hl7.org/fhir/StructureDefinition/cqf-knowledgeCapability"
* valueCode = #computable
* version = "0.1.0"
* version = "4.0.1"
* name = "FHIRCommon"
* status = #draft
* experimental = false
* experimental = true
* publisher = "World Health Organization (WHO)"
* type = $library-type#logic-library
* content.id = "ig-loader-FHIRCommon.cql"
814 changes: 407 additions & 407 deletions input/cql/FHIRHelpers.cql → _unused/FHIRHelpers.cql

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ 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/immunizations-measles/Library/FHIRHelpers"
* url = "http://fhir.org/guides/cqf/common/Library/FHIRHelpers"
* extension[+]
* url = "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-knowledgeCapability"
* url = "http://hl7.org/fhir/StructureDefinition/cqf-knowledgeCapability"
* valueCode = #computable
* version = "0.1.0"
* version = "4.0.1"
* name = "FHIRHelpers"
* status = #draft
* experimental = false
* experimental = true
* publisher = "World Health Organization (WHO)"
* type = $library-type#logic-library
* content.id = "ig-loader-FHIRHelpers.cql"
8 changes: 8 additions & 0 deletions input/_resources/exp-params.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"resourceType" : "Parameters",
"id" : "exp-params",
"parameter" : [{
"name" : "system-version",
"valueUri" : "http://snomed.info/sct|http://snomed.info/sct/900000000000207008"
}]
}
228 changes: 5 additions & 223 deletions input/cql/IMMZCommon.cql
Original file line number Diff line number Diff line change
Expand Up @@ -2,238 +2,20 @@ library IMMZCommon

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


code "[#] Births total": '11640-0' from IMMZc."LOINC" display 'Pregnancy outcome'
code "[#] Births.preterm": '11637-6' from IMMZc."LOINC" display 'Preterm'
context Patient

//TODO: Check patient is alive

//Get patient immunizations
define "Get Immunization":
[Immunization]

// check vaccine status
define "Immunization Status":
[Immunization] I
return I.status

//check Immunization.status for not-done
define "Immunization Completed":
[Immunization] I
where I.status in {'completed'}

//check Immunization.status for not-done
define "Immunization Not Done":
[Immunization] I
where I.status in {'not-done'}

//how do we handle entered-in-error? It seems like it should be different from not-done in how it should be handled? These should be ignored so we likely don't need to check for them. We should maybe set these to check for statuses like complete, or amended

//check vaccine status reason - e.g. if vaccine was not given
define "Immunization StatusReason":
[Immunization] I
return I.statusReason

//define statusReason Immunizations for when it was not given

//Procedure for vaccine administration

//Get patient observations. Do we need this statement to get all Observations?
define "Get Observations":
[Observation]

//Check if patient is pregnant
//not sure if pregnancy is an Observation
define "Pregnant Observation":
[Observation] O
//IPS Uses Observation - https://hl7.org/fhir/uv/ips/StructureDefinition-observation-pregnancy-status-uv-ips.html
where (O.value as CodeableConcept) in Wcon."Pregnancy Status Pregnant"
/*
Need to figure out how to add the OR Condition in case pregnancy is stored in a condition instead of an Observation
or [Condition] C
where (C.code as CodeableConcept) in Wcon."Pregnancy Status Pregnant"
*/

/*
define "Patient Has Active Sickle-cell disease":
exists([Condition: code = IMMZc."Sickle-cell Disease Condition"] C
where C.clinicalStatus in FC."Active Condition"
and C.abatement is null)
*/

define "Pregnant Condition":
[Condition] C
where (C.code as CodeableConcept) in Wcon."Pregnancy Status Pregnant" or (C.code as CodeableConcept) ~ IMMZc."Currently Pregnant"

define "Pregnant":
exists
( "Pregnant Observation")
or exists ("Pregnant Condition")

//Seronegative. Relevant for Dengue
/*
define "Individual is Seronegative for Dengue":
[Observation] O
where (O.value as CodeableConcept) in IMMZc.Seronegative
*/

//Total number of births including abortions, stillbirths and live births.
define "Patient mother's pregnancy outcome observation":
[Observation: code = "[#] Births total"] O
return O.value

// Total number of children whose birth occurred through the end of the last day of the 37th week (259th day)
// following onset of the last menstrual period
define "Preterm":
[Observation: code = "[#] Births.preterm"] O
return O.value

//Observed Preterm birth
define "Preterm Birth":
[Observation] O
where (O.value as CodeableConcept) in IMMZc.PretermBirth

//@dataElement Adverse Event:
define "Adverse Event":
from [Immunization] I, [Observation] O
where O.id in (I.reaction R return Last(Split(R.detail.reference, '/')))
return O

/*
* @dataElement Allergy = True
*/
define "Allergy = True":
[AllergyIntolerance] A
where
A.clinicalStatus ~ FC."allergy-active"
and
A.verificationStatus ~ FC."allergy-confirmed"

/*
* @dataElement Immunocompromised = True
*/
define "Immunocompromised = True":
exists([Condition] C
where C.code in IMMZc."Immunocompromised"
and
C.clinicalStatus in FC."Active Condition"
and
C.verificationStatus ~ FC."confirmed")

/**
* @dataElement All Doses Administered to Patient to patient ordered newest to oldest
*/
define "Doses Administered to Patient":
[Immunization] I
where I.status = 'completed'
sort by date from (occurrence as FHIR.dateTime) desc
/**
* Contraindications
*/
define "Severely Immunosuppressed Condition":
[Condition: IMMZc."Severely immunosuppressed"]

define "History of Anaphylactic Reactions Condition":
[Condition: IMMZc."History of anaphylactic reactions"]

define "Severe Allergic Reactions Condition":
[Condition: IMMZc."Severe allergic reactions"]

define "Symptomatic HIV Infection Condition":
[Condition: IMMZc."Symptomatic HIV infection"]


/******************************
* Test Results
*/


define "Patient birth weight observation value":
[Observation: code in IMMZc."Patient birth weight observation value"] O
return O.value as FHIR.Quantity

/**
* @dataElement Patient age in years
*/
define "Current Patient Age In Years":
AgeInYearsAt(Today())
//Today() - (Patient.birthDate as System.Date)

/**
* @dataElement Patient age in weeks
*/
define "Current Patient Age In Weeks":
AgeInWeeksAt(Today())

/**
* @dataElement Patient age in months
*/
define "Current Patient Age In Months":
AgeInMonthsAt(Today())

/**
* @dataElement Patient biological sex used for deciding vaccine eligibility
* TODO: "Gender" of patient in FHIR is the administrative gender - or can we expect that this will be biological sex and administrative
* gender identity will be captured using the gender identity extension?
*/
define "Patient Biological Sex":
Patient.gender

define "Patient HAART Treatment Start Date":
Last([MedicationAdministration] A
where
ExtractMedicationCode(A.medication) in IMMZc."ARV Drugs"
and A.status in { 'active', 'complete' }
and ExtractMedicationInitiationDate(A.effective) less than 12 'month' before Today()
return ExtractMedicationInitiationDate(A.effective))

define "Patient HAART Treatment Started 6 to 12 Months Ago":
"Patient HAART Treatment Start Date" between Now() - 12 months and Now() - 6 months

/**
* @dataElement The patient has a medication record which indicates that they are receiving ARV
*/
define "Patient is receiving HAART":
//exists([MedicationStatement] S where ExtractMedicationCode(S.medication) in IMMZc."ARV Drugs" and S.status = 'active')
//or
exists([MedicationAdministration] A where ExtractMedicationCode(A.medication) in IMMZc."ARV Drugs" and A.status = 'in-progress')
//union
//

/*
@dataElement HIV Status observations of the patient most recent first
*/
define "HIV Status":
[Observation: IMMZc."HIV status"] O
where O.status in { 'final', 'amended', 'corrected' }
and Coalesce(WCom.ModifierExtension(O, 'who-notDone').value, false) is false
return O.value as FHIR.CodeableConcept

/*
@dataElement Date and time of last live attenuated vaccine
*/
define "Live Attenuated Vaccines":
"Doses Administered to Patient" I where I.vaccineCode in IMMZc."Live Attenuated"

define "Date of Latest Live Attenuated Vaccine":
First("Live Attenuated Vaccines").occurrence as dateTime

/******************************
* CQL Helper Functions
* @description Fetches a singleton protocol applied from an immunization
* @comment The protocol list from the immunization
*/
define function Only(protocols List<FHIR.Immunization.ProtocolApplied>):
singleton from protocols

/**
* @description Fetches a singleton protocol applied from an immunization
* @comment The protocol list from the immunization
*/
define function Only(protocols List<FHIR.Immunization.ProtocolApplied>):
define fluent function only(protocols List<FHIR.Immunization.ProtocolApplied>):
singleton from protocols

/**
Expand Down
31 changes: 0 additions & 31 deletions input/cql/IMMZCommonIzDataElements.cql

This file was deleted.

43 changes: 22 additions & 21 deletions input/cql/IMMZConcepts.cql
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,45 @@ 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'

codesystem "IMMZ.C": 'http://smart.who.int/smart-immunizations-measles/CodeSystem/IMMZ.C'
codesystem "IMMZ.D1": 'http://smart.who.int/smart-immunizations-measles/CodeSystem/IMMZ.D1'
codesystem "IMMZ.D4": 'http://smart.who.int/smart-immunizations-measles/CodeSystem/IMMZ.D4'
codesystem "IMMZConcepts": 'http://smart.who.int/immunizations-measles/CodeSystem/IMMZConcepts'

//WHO ATC IPS Valueset
valueset "WHO ATC": 'http://hl7.org/fhir/uv/ips/ValueSet/whoatc-uv-ips'

// General use ValueSets
valueset "Negative Result": 'http://smart.who.int/smart-immunizations-measles/ValueSet/Negativetestresult-values'
valueset "Positive Result": 'http://smart.who.int/smart-immunizations-measles/ValueSet/PositiveTestResult-values'
valueset "Immunocompromised": 'http://smart.who.int/smart-immunizations-measles/ValueSet/Immunocompromised-values'
valueset "Patient birth weight observation value": 'http://smart.who.int/smart-immunizations-measles/ValueSet/Birthweight-values'
valueset "PretermBirth": 'http://smart.who.int/smart-immunizations-measles/ValueSet/Preterm-values'
valueset "Live Attenuated": 'http://smart.who.int/smart-immunizations-measles/ValueSet/LiveAttenduatedVaccines'
valueset "Negative Result": 'http://smart.who.int/immunizations-measles/ValueSet/Negativetestresult-values'
valueset "Positive Result": 'http://smart.who.int/immunizations-measles/ValueSet/PositiveTestResult-values'
valueset "Immunocompromised": 'http://smart.who.int/immunizations-measles/ValueSet/Immunocompromised-values'
valueset "Patient birth weight observation": 'http://smart.who.int/immunizations-measles/ValueSet/Birthweight-values'
valueset "PretermBirth": 'http://smart.who.int/immunizations-measles/ValueSet/Preterm-values'
valueset "Live Attenuated": 'http://smart.who.int/immunizations-measles/ValueSet/LiveAttenduatedVaccines'

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

valueset "HIV status": 'http://smart.who.int/smart-immunizations-measles/ValueSet/HIVstatus-values'
valueset "HIV status": 'http://smart.who.int/immunizations-measles/ValueSet/HIVstatus-values'
valueset "HIV status - HIV positive Choices": 'http://fhir.org/guides/who/anc-cds/ValueSet/anc-b9-de46'
valueset "HIV status - HIV negative Choices": 'http://fhir.org/guides/who/anc-cds/ValueSet/anc-b9-de47'

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

// Vaccine Value Sets

valueset "MCV Vaccine": 'http://smart.who.int/smart-immunizations-measles/ValueSet/IMMZ.Z.DE9'
valueset "MCV Vaccine": 'http://smart.who.int/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/smart-immunizations-measles/ValueSet/IMMZ.Z.DE1'
valueset "Cholera Vaccine": 'http://smart.who.int/smart-immunizations-measles/ValueSet/IMMZ.Z.DE2'


valueset "BCG Vaccine": 'http://smart.who.int/immunizations-measles/ValueSet/IMMZ.Z.DE1'
valueset "Cholera Vaccine": 'http://smart.who.int/immunizations-measles/ValueSet/IMMZ.Z.DE2'

code "Adverse Event Severity": '246112005' from "SNOMED-CT" display 'Severity (attribute)'
code "Adverse Event Manifestation": '246112005' from "SNOMED-CT" display 'Severity (attribute)'

code "Currently Pregnant": 'DE161' from "IMMZ.D4" display 'Currently Pregnant'
code "Severely immunosuppressed": 'DE165' from "IMMZ.D4" display 'Severely immunosuppressed'
code "History of anaphylactic reactions": 'DE166' from "IMMZ.D4" display 'History of anaphylactic reactions'
code "Severe allergic reactions": 'DE167' from "IMMZ.D4" display 'Severe allergic reactions'
code "Symptomatic HIV infection": 'DE168' from "IMMZ.D4" display 'Symptomatic HIV infection'
code "Potential contraindications": 'D4.DE161' from "IMMZConcepts" display 'Potential contraindications'
code "Currently pregnant": 'D4.DE162' from "IMMZConcepts" display 'Currently pregnant'
code "Severely immunosuppressed": 'D4.DE165' from "IMMZConcepts" display 'Severely immunosuppressed'
code "History of anaphylactic reactions": 'D4.DE166' from "IMMZConcepts" display 'History of anaphylactic reactions'
code "Severe allergic reactions": 'D4.DE167' from "IMMZConcepts" display 'Severe allergic reactions'
code "Symptomatic HIV infection": 'D4.DE168' from "IMMZConcepts" display 'Symptomatic HIV infection'

code "[#] Births total": '11640-0' from "LOINC" display 'Pregnancy outcome'
code "[#] Births.preterm": '11637-6' from "LOINC" display 'Preterm'

Loading
Loading