Skip to content

Commit

Permalink
Added references and rationale throughout plan definitions. Added fhi…
Browse files Browse the repository at this point in the history
…r.cqf.common dependency to remove FHIRCommon and FHIRHelpers libraries
  • Loading branch information
brynrhodes committed May 25, 2024
1 parent 70b77f2 commit b41c749
Show file tree
Hide file tree
Showing 17 changed files with 783 additions and 732 deletions.
562 changes: 281 additions & 281 deletions input/cql/FHIRCommon.cql → _unused/FHIRCommon.cql

Large diffs are not rendered by default.

File renamed without changes.
814 changes: 407 additions & 407 deletions input/cql/FHIRHelpers.cql → _unused/FHIRHelpers.cql

Large diffs are not rendered by default.

File renamed without changes.
7 changes: 7 additions & 0 deletions input/cql/IMMZCommon.cql
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ include FHIRHelpers version '4.0.1'
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 fluent function only(protocols List<FHIR.Immunization.ProtocolApplied>):
singleton from protocols

/**
* @description Takes the date choice of a date/string choice (for Immunization date)
*/
Expand Down
2 changes: 1 addition & 1 deletion input/cql/IMMZElements.cql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ library IMMZElements
using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
include FHIRCommon called FC
include fhir.cqf.common.FHIRCommon called FC

include WHOConcepts
include WHOCommon called WC
Expand Down
57 changes: 28 additions & 29 deletions input/cql/IMMZEncounterElements.cql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ library IMMZEncounterElements
using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
include FHIRCommon called FC

include WHOConcepts
include WHOCommon called WC
Expand All @@ -13,7 +12,7 @@ include IMMZConcepts called Concepts
include IMMZCommon called Common
include IMMZElements called Elements

parameter AsOf Date default Today()
parameter Today Date default Today()
parameter EncounterId String

context Patient
Expand All @@ -23,19 +22,19 @@ context Patient
*/
define "MCV Dose":
Elements."MCV Dose" MCV
where MCV.occurrence.toInterval() on or before AsOf
where MCV.occurrence.toInterval() on or before Today

define "MCV Primary Series Dose":
Elements."MCV Primary Series Dose" MCV
where MCV.occurrence.toInterval() on or before AsOf
where MCV.occurrence.toInterval() on or before Today

define "MCV Supplementary Dose":
Elements."MCV Supplementary Dose" MCV
where MCV.occurrence.toInterval() on or before AsOf
where MCV.occurrence.toInterval() on or before Today

define "MCV Dose 0 Dose":
Elements."MCV Dose 0 Dose" MCV
where MCV.occurrence.toInterval() on or before AsOf
where MCV.occurrence.toInterval() on or before Today

/*
* Contraindications
Expand All @@ -55,11 +54,11 @@ define "Currently Pregnant":
define "Currently Pregnant Observation":
Elements."Currently Pregnant Observation" O
where O.encounter.references(EncounterId)
or O.effective.toInterval() starts 9 months on or before day of AsOf
or O.effective.toInterval() starts 9 months on or before day of Today

define "Currently Pregnant Condition":
Elements."Currently Pregnant Condition" C
where C.prevalenceInterval() includes AsOf
where C.prevalenceInterval() includes Today

// TODO: Should this be related to the mother's record?
//Total number of births including abortions, stillbirths and live births.
Expand All @@ -79,7 +78,7 @@ define "Patient Mother's Pregnancy Outcome Observation Value":
define "Preterm Births Observation":
Elements."Preterm Births Observation" O
where O.encounter.references(EncounterId)
or O.effective.toInterval() on or before AsOf
or O.effective.toInterval() on or before Today
define "Preterm":
Last(
Expand All @@ -92,7 +91,7 @@ define "Preterm":
define "Preterm Birth":
Elements."Preterm Birth" O
where O.encounter.references(EncounterId)
or O.effective.toInterval() on or before AsOf
or O.effective.toInterval() on or before Today
// TODO: How does/should this relate to the encounter?
//@dataElement Adverse Event:
Expand All @@ -109,7 +108,7 @@ define "Allergy = True":
define "Active Confirmed Allergy":
Elements."Active Confirmed Allergy" A
where A.onset.toInterval() starts on or before AsOf
where A.onset.toInterval() starts on or before Today
/*
* @dataElement Immunocompromised = True
Expand All @@ -119,7 +118,7 @@ define "Immunocompromised = True":
define "Immunocompromised Condition":
Elements."Immunocompromised Condition" C
where C.prevalenceInterval() starts on or before AsOf
where C.prevalenceInterval() starts on or before Today
/**
* @dataElement All Doses Administered to Patient to patient ordered newest to oldest
Expand All @@ -137,23 +136,23 @@ define "Severely Immunosuppressed":
define "Severely Immunosuppressed Observation":
Elements."Severely Immunosuppressed Observation" O
where O.encounter.references(EncounterId)
or O.effective.toInterval() starts on or before AsOf
or O.effective.toInterval() starts on or before Today
define "Severely Immunosuppressed Condition":
Elements."Severely Immunosuppressed Condition" C
where C.prevalenceInterval() starts on or before AsOf
where C.prevalenceInterval() starts on or before Today
define "History Of Anaphylactic Reactions":
exists "History Of Anaphylactic Reactions Condition"
define "History Of Anaphylactic Reactions Observation":
Elements."History Of Anaphylactic Reactions Observation" O
where O.encounter.references(EncounterId)
or O.effective.toInterval() starts on or before AsOf
or O.effective.toInterval() starts on or before Today
define "History Of Anaphylactic Reactions Condition":
Elements."History Of Anaphylactic Reactions Condition" C
where C.prevalenceInterval() starts on or before AsOf
where C.prevalenceInterval() starts on or before Today
define "Severe Allergic Reactions":
exists "Severe Allergic Reactions Observation"
Expand All @@ -162,11 +161,11 @@ define "Severe Allergic Reactions":
define "Severe Allergic Reactions Observation":
Elements."Severe Allergic Reactions Observation" O
where O.encounter.references(EncounterId)
or O.effective.toInterval() starts on or before AsOf
or O.effective.toInterval() starts on or before Today
define "Severe Allergic Reactions Condition":
Elements."Severe Allergic Reactions Condition" C
where C.prevalenceInterval() starts on or before AsOf
where C.prevalenceInterval() starts on or before Today
define "Symptomatic HIV Infection":
exists "Symptomatic HIV Infection Observation"
Expand All @@ -175,11 +174,11 @@ define "Symptomatic HIV Infection":
define "Symptomatic HIV Infection Observation":
Elements."Symptomatic HIV Infection Observation" O
where O.encounter.references(EncounterId)
or O.effective.toInterval() starts on or before AsOf
or O.effective.toInterval() starts on or before Today
define "Symptomatic HIV Infection Condition":
Elements."Symptomatic HIV Infection Condition" C
where C.prevalenceInterval() starts on or before AsOf
where C.prevalenceInterval() starts on or before Today
/******************************
* Test Results
Expand All @@ -188,7 +187,7 @@ define "Symptomatic HIV Infection Condition":
define "Patient Birth Weight Observation":
Elements."Patient Birth Weight Observation" O
where O.encounter.references(EncounterId)
or O.effective.toInterval() on or before AsOf
or O.effective.toInterval() on or before Today
define "Patient Birth Weight Observation Value":
Last(
Expand All @@ -200,19 +199,19 @@ define "Patient Birth Weight Observation Value":
* @dataElement Patient age in years
*/
define "Current Patient Age In Years":
AgeInYearsAt(AsOf)
AgeInYearsAt(Today)
/**
* @dataElement Patient age in weeks
*/
define "Current Patient Age In Weeks":
AgeInWeeksAt(AsOf)
AgeInWeeksAt(Today)
/**
* @dataElement Patient age in months
*/
define "Current Patient Age In Months":
AgeInMonthsAt(AsOf)
AgeInMonthsAt(Today)
/**
* @dataElement Patient biological sex used for deciding vaccine eligibility
Expand All @@ -224,7 +223,7 @@ define "Patient Biological Sex":
define "HAART Medication Administration":
Elements."HAART Medication Administration" A
where A.effective.toInterval() starts less than 12 months before AsOf
where A.effective.toInterval() starts less than 12 months before Today
define "Patient HAART Treatment Start Date":
Last(
Expand All @@ -233,7 +232,7 @@ define "Patient HAART Treatment Start Date":
).effective.toInterval().low
define "Patient HAART Treatment Started 6 to 12 Months Ago":
"Patient HAART Treatment Start Date" between AsOf - 12 months and AsOf - 6 months
"Patient HAART Treatment Start Date" between Today - 12 months and Today - 6 months
/**
* @dataElement The patient has a medication record which indicates that they are receiving ARV
Expand All @@ -253,11 +252,11 @@ define "HIV Status":
define "HIV Status Observation":
Elements."HIV Status Observation" O
where O.encounter.references(EncounterId)
or O.effective.toInterval() starts on or before AsOf
or O.effective.toInterval() starts on or before Today
define "Live vaccine dose":
Elements."Live vaccine dose" V
where V.occurrence.toInterval() starts on or before AsOf
where V.occurrence.toInterval() starts on or before Today
/*
@dataElement Date and time of last live attenuated vaccine
Expand All @@ -268,7 +267,7 @@ define "Live Attenuated Vaccines":
define "Date of Latest Live Attenuated Vaccine":
Last(
"Live Attenuated Vaccines" V
where V.occurrence.toInterval() starts on or before AsOf
where V.occurrence.toInterval() starts on or before Today
sort by start of occurrence.toInterval()
).occurrence as FHIR.dateTime
1 change: 0 additions & 1 deletion input/cql/IMMZIND08Logic.cql
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ For this reason, this measure is modeled as a continuous variable measure where
using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
include FHIRCommon called FC

include IMMZCommon called Common
include IMMZConcepts called Concepts
Expand Down
3 changes: 1 addition & 2 deletions input/cql/IMMZIND12Logic.cql
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* References: WHO Immunization facility analysis guide;WHO Handbook on immunization data
*/
library IMMZIND08Logic
library IMMZIND12Logic

/*
NOTE: This is an estimated denominator measure, meaning that all we are contributing from the site perspective is a count
Expand All @@ -29,7 +29,6 @@ a measles containing vaccine.
using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
include FHIRCommon called FC

include IMMZCommon called Common
include IMMZConcepts called Concepts
Expand Down
4 changes: 2 additions & 2 deletions input/cql/IMMZIND13Logic.cql
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* References: WHO Immunization facility analysis guide;WHO Handbook on immunization data
*/
library IMMZIND08Logic
library IMMZIND13Logic

/*
NOTE: This is an estimated denominator measure, meaning that all we are contributing from the site perspective is a count
Expand All @@ -29,8 +29,8 @@ a measles containing vaccine.
using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
include FHIRCommon called FC

include WHOCommon called WC
include IMMZCommon called Common
include IMMZConcepts called Concepts
include IMMZConfig called Config
Expand Down
1 change: 0 additions & 1 deletion input/cql/IMMZIndicatorElements.cql
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ library IMMZIndicatorElements
using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
include FHIRCommon called FC

include WHOConcepts
include WHOCommon called WC
Expand Down
8 changes: 7 additions & 1 deletion input/fsh/plandefinitions/IMMZD2DTMeaslesDose0.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Usage: #definition
* status = #draft
* experimental = false
* publisher = "World Health Organization (WHO)"
* relatedArtifact[+]
* type = #citation
* citation = "WHO recommendations for routine immunization - summary tables (March 2023)"
* action[+]
* title = "Immunize patient for Measles"
* condition[+]
Expand All @@ -21,7 +24,10 @@ Usage: #definition
* language = #text/cql-identifier
* expression = "Measles Routine Immunization Schedule Incomplete"
* action[+]
* title = "No MCV0 Doses Administered"
* extension[+]
* url = "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-rationale"
* valueMarkdown = "Note: The countries should apply the national immunization policy for MCV0 dose and adjust this logic accordingly.<br/>A supplementary dose of MCV (recorded as MCV0) should be considered for infants known to be exposed (i.e. born to an HIV-infected woman) or soon after diagnosis of HIV infection in children older than 6 months who are not receiving HAART and for whom the risk of measles is high, with the aim of providing partial protection until they are revaccinated after immune reconstitution with HAART.<br/>In the following situations, a supplementary dose of MCV should be given to infants from 6 months of age:<br/>* (1) during a measles outbreak as part of intensified service delivery;<br/>* (2) during campaigns in settings where the risk of measles among infants < 9 months of age remains high (e.g. in endemic countries experiencing regular outbreaks);<br/>* (3) for internally displaced populations and refugees, and populations in conflict zones;<br/>* (4) for individual infants at high risk of contracting measles (e.g. contacts of known measles cases or in settings with increased risk of exposure during outbreaks such as day-care facilities);<br/>* (5)for infants travelling to countries experiencing measles outbreaks;<br/>* (6) infants known to be HIV-infected or exposed (i.e. born to an HIV-infected woman).<br/>In areas where there is a high incidence of both HIV infection and measles, an initial dose of MCV may be offered as early as age 6 months (recorded as MCV0). The 2 routine doses of MCV (MCV1 and MCV2) should then be administered to these children according to the national immunization schedule.<br/>As a general rule, live vaccines should be given either simultaneously or at intervals of 4 weeks. An exception to this rule is OPV, which can be given at any time before or after measles vaccination without interference in the response to either vaccine."
* title = "Consider MCV0 Dose"
* condition[+]
* kind = #applicability
* expression
Expand Down
18 changes: 15 additions & 3 deletions input/fsh/plandefinitions/IMMZD2DTMeaslesLT.fsh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Usage: #definition
* status = #draft
* experimental = false
* publisher = "World Health Organization (WHO)"
* relatedArtifact[+]
* type = #citation
* citation = "WHO recommendations for routine immunization - summary tables (March 2023)"
* action[+]
* title = "Immunize patient for Measles"
* condition[+]
Expand All @@ -21,7 +24,10 @@ Usage: #definition
* language = #text/cql-identifier
* expression = "Measles Routine Immunization Schedule Incomplete"
* action[+]
* title = "No Primary Series Doses Administered"
* extension[+]
* url = "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-rationale"
* valueMarkdown = "In countries with low levels of measles transmission MCV1 may be administered at 12 months of age.<br/>As a general rule, live vaccines should be given either simultaneously or at intervals of 4 weeks. An exception to this rule is OPV, which can be given at any time before or after measles vaccination without interference in the response to either vaccine."
* title = "Provide primary series measles vaccination (MCV1)"
* condition[+]
* kind = #applicability
* expression
Expand Down Expand Up @@ -53,7 +59,10 @@ Usage: #definition
* expression = "Client Is Due For MCV1"
* definitionCanonical = Canonical(IMMZD2DTMeaslesMR)
* action[+]
* title = "Number Of Primary Series Doses Administered = 1"
* extension[+]
* url = "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-rationale"
* valueMarkdown = "In countries with low levels of measles transmission, administration of MCV2 at 15-18 months of age ensures early protection of the individual.<br/>The minimum interval between MCV1 and MCV2 is 4 weeks.<br/>As a general rule, live vaccines should be given either simultaneously or at intervals of 4 weeks. An exception to this rule is OPV, which can be given at any time before or after measles vaccination without interference in the response to either vaccine."
* title = "Provide primary series measles vaccination (MCV2)"
* condition[+]
* kind = #applicability
* expression
Expand Down Expand Up @@ -85,7 +94,10 @@ Usage: #definition
* expression = "Client Is Due For MCV2"
* definitionCanonical = Canonical(IMMZD2DTMeaslesMR)
* action[+]
* title = "Number Of Primary Series Doses Administered = 2"
* extension[+]
* url = "http://hl7.org/fhir/uv/cpg/StructureDefinition/cpg-rationale"
* valueMarkdown = "An additional dose of MCV should be administered to HIV-infected children receiving HAART following immune reconstitution. If CD4+ T lymphocyte counts are monitored, an additional dose of MCV should be administered when immune reconstitution has been achieved, e.g. when the CD4+ T lymphocyte count reaches 2025%. Where CD4+ T lymphocyte monitoring is not available, children should receive an additional dose of MCV 612 months after initiation of HAART."
* title = "Measles primary series is complete."
* description = "Measles primary series is complete. Two measles primary series doses were administered. Check if a measles supplementary dose is appropriate for the client."
* condition[+]
* kind = #applicability
Expand Down
Loading

0 comments on commit b41c749

Please sign in to comment.