From 187f8929ce5a87c4fb443981a07530d85074f3f5 Mon Sep 17 00:00:00 2001 From: Piotr Mankowski Date: Thu, 17 Oct 2024 06:21:07 -0700 Subject: [PATCH] Indicators 75-85 (#57) * 60-74 indicators done (#55) * Changed elements to match current understanding of TX_CURR --------- Co-authored-by: Pprado23 <141263871+Pprado23@users.noreply.github.com> Co-authored-by: Patric Prado --- input/cql/HIVConceptsCustom.cql | 3 + input/cql/HIVElements.cql | 80 ++++++------------- input/cql/HIVIND60Logic.cql | 6 +- input/cql/HIVIND61Logic.cql | 8 +- input/cql/HIVIND64Logic.cql | 38 ++++++++- input/cql/HIVIND65Logic.cql | 31 +++++++- input/cql/HIVIND66Logic.cql | 39 ++++++++- input/cql/HIVIND67Logic.cql | 36 ++++++++- input/cql/HIVIND68Logic.cql | 36 ++++++++- input/cql/HIVIND69Logic.cql | 34 +++++++- input/cql/HIVIND70Logic.cql | 38 ++++++++- input/cql/HIVIND71Logic.cql | 33 +++++++- input/cql/HIVIND72Logic.cql | 42 +++++++++- input/cql/HIVIND73Logic.cql | 35 +++++++- input/cql/HIVIND74Logic.cql | 33 +++++++- input/cql/HIVIndicatorElements.cql | 124 ++++++++++++++--------------- 16 files changed, 469 insertions(+), 147 deletions(-) diff --git a/input/cql/HIVConceptsCustom.cql b/input/cql/HIVConceptsCustom.cql index 78e2cbb2a2..2a158e00b8 100644 --- a/input/cql/HIVConceptsCustom.cql +++ b/input/cql/HIVConceptsCustom.cql @@ -73,6 +73,9 @@ code "tb treatment": 'tb treatment' from "missing concepts" code "ART medication": 'ART medication' from "missing concepts" code "DSD ART eligibility assessed" : 'DSD ART eligibility assessed' from "missing concepts" code "syphilis test" : 'syphilis test' from "missing concepts" +code "Gonorrhoea test" : 'Gonorrhoea test' from "missing concepts" +code "syphilis treatment" : 'syphilis treatment' from "missing concepts" +code "Gonorrhoea treatment" : 'Gonorrhoea treatment' from "missing concepts" valueset "Antenatal care contact": 'http://fhir.org/guides/who/anc-cds/ValueSet/antenatal-care-contact' \ No newline at end of file diff --git a/input/cql/HIVElements.cql b/input/cql/HIVElements.cql index 04ca6fccaa..fdbc05c041 100644 --- a/input/cql/HIVElements.cql +++ b/input/cql/HIVElements.cql @@ -552,13 +552,10 @@ define "Facility-level testing Observation": @activity: HIV.B6 Capture or update client history @description: Client is currently pregnant */ -// TODO: Replace placeholder with relevant CQL logic + define "Currently pregnant B.DE29": - exists "Currently pregnant B.DE29 Observation" -define "Currently pregnant B.DE29 Observation": - [Observation: Concepts."Currently pregnant - HIV.B.DE29"] O - where O.status in { 'final', 'amended', 'corrected' } - and O.value is true + [Condition: Concepts."Currently pregnant - HIV.B.DE29"] C + sort by start of prevalenceInterval() /* End of Currently pregnant B.DE29 */ /* @@ -2800,13 +2797,11 @@ define "Inconclusive B.DE253": @activity: HIV.B23 Offer sexual and reproductive health services @description: Date of initiation of syphilis treatment */ -// TODO: Replace placeholder with relevant CQL logic + define "Syphilis treatment start date B.DE254": - [Observation: Concepts."Syphilis treatment start date - HIV.B.DE254"] O - where O.status in { 'final', 'amended', 'corrected' } -define "Syphilis treatment start date B.DE254 Value": - "Syphilis treatment start date B.DE254" O - return O.value + [MedicationStatement] MS + where MS.status = 'completed' + and exists(MS.reasonCode C where C ~ ConceptsCustom."syphilis treatment") /* End of Syphilis treatment start date B.DE254 */ /* @@ -2814,13 +2809,11 @@ define "Syphilis treatment start date B.DE254 Value": @activity: HIV.B23 Offer sexual and reproductive health services @description: Date of Gonorrhoea test */ -// TODO: Replace placeholder with relevant CQL logic + define "Gonorrhoea test date B.DE255": - [Observation: Concepts."Gonorrhoea test date - HIV.B.DE255"] O - where O.status in { 'final', 'amended', 'corrected' } -define "Gonorrhoea test date B.DE255 Value": - "Gonorrhoea test date B.DE255" O - return O.value + [Procedure] P + where P.status = 'completed' + and P.code ~ ConceptsCustom."Gonorrhoea test" /* End of Gonorrhoea test date B.DE255 */ /* @@ -2828,10 +2821,8 @@ define "Gonorrhoea test date B.DE255 Value": @activity: HIV.B23 Offer sexual and reproductive health services @description: Result from Gonorrhoea test */ -// TODO: Replace placeholder with relevant CQL logic + define "Gonorrhoea test result B.DE256": - exists "Gonorrhoea test result B.DE256 Observation" -define "Gonorrhoea test result B.DE256 Observation": [Observation: Concepts."Gonorrhoea test result - HIV.B.DE256"] O where O.status in { 'final', 'amended', 'corrected' } /* End of Gonorrhoea test result B.DE256 */ @@ -2841,16 +2832,10 @@ define "Gonorrhoea test result B.DE256 Observation": @activity: HIV.B23 Offer sexual and reproductive health services @description: Test result is positive for Neisseria gonorrhoeae */ -// TODO: Replace placeholder with relevant CQL logic + define "Positive B.DE257": - exists "Positive B.DE257 Condition" - or exists "Positive B.DE257 Observation" -define "Positive B.DE257 Condition": - [Condition: Concepts."Positive - HIV.B.DE257"] -define "Positive B.DE257 Observation": - "Gonorrhoea test result B.DE256 Observation" O - where O.status in { 'final', 'amended', 'corrected' } - and O.value ~ Concepts."Positive - HIV.B.DE257" + "Gonorrhoea test result B.DE256" O + where O.value ~ Concepts."Positive - HIV.B.DE257" /* End of Positive B.DE257 */ /* @@ -2858,16 +2843,11 @@ define "Positive B.DE257 Observation": @activity: HIV.B23 Offer sexual and reproductive health services @description: Test result is negative for Neisseria gonorrhoeae */ -// TODO: Replace placeholder with relevant CQL logic + define "Negative B.DE258": - exists "Negative B.DE258 Condition" - or exists "Negative B.DE258 Observation" -define "Negative B.DE258 Condition": - [Condition: Concepts."Negative - HIV.B.DE258"] -define "Negative B.DE258 Observation": - "Gonorrhoea test result B.DE256 Observation" O - where O.status in { 'final', 'amended', 'corrected' } - and O.value ~ Concepts."Negative - HIV.B.DE258" + "Gonorrhoea test result B.DE256" O + where O.value ~ Concepts."Negative - HIV.B.DE258" + /* End of Negative B.DE258 */ /* @@ -2875,16 +2855,10 @@ define "Negative B.DE258 Observation": @activity: HIV.B23 Offer sexual and reproductive health services @description: Test result is inconclusive */ -// TODO: Replace placeholder with relevant CQL logic + define "Inconclusive B.DE259": - exists "Inconclusive B.DE259 Condition" - or exists "Inconclusive B.DE259 Observation" -define "Inconclusive B.DE259 Condition": - [Condition: Concepts."Inconclusive - HIV.B.DE259"] -define "Inconclusive B.DE259 Observation": - "Gonorrhoea test result B.DE256 Observation" O - where O.status in { 'final', 'amended', 'corrected' } - and O.value ~ Concepts."Inconclusive - HIV.B.DE259" + "Gonorrhoea test result B.DE256" O + where O.value ~ Concepts."Inconclusive - HIV.B.DE259" /* End of Inconclusive B.DE259 */ /* @@ -2892,13 +2866,11 @@ define "Inconclusive B.DE259 Observation": @activity: HIV.B23 Offer sexual and reproductive health services @description: Date of initiation of Gonorrhoea treatment */ -// TODO: Replace placeholder with relevant CQL logic + define "Gonorrhoea treatment start date B.DE260": - [Observation: Concepts."Gonorrhoea treatment start date - HIV.B.DE260"] O - where O.status in { 'final', 'amended', 'corrected' } -define "Gonorrhoea treatment start date B.DE260 Value": - "Gonorrhoea treatment start date B.DE260" O - return O.value + [MedicationStatement] MS + where MS.status = 'completed' + and exists(MS.reasonCode C where C ~ ConceptsCustom."Gonorrhoea treatment") /* End of Gonorrhoea treatment start date B.DE260 */ /* diff --git a/input/cql/HIVIND60Logic.cql b/input/cql/HIVIND60Logic.cql index fe1f25cdcc..ce19b1f1cf 100644 --- a/input/cql/HIVIND60Logic.cql +++ b/input/cql/HIVIND60Logic.cql @@ -85,9 +85,9 @@ define "Initial Population": */ define "Numerator": - First(HE."ANC contact date E.DE85") during "Measurement Period" + First(HIE."ANC within pregnancy").period.toInterval() during "Measurement Period" and exists(HE."Syphilis test date B.DE249" P - where start of P.performed.toInterval() = start of First(HE."ANC contact date E.DE85")) + where start of P.performed.toInterval() = start of First(HIE."ANC within pregnancy").period.toInterval()) /** @@ -98,7 +98,7 @@ define "Numerator": */ define "Denominator": - First(HE."ANC contact date E.DE85") during "Measurement Period" + First(HIE."ANC within pregnancy").period.toInterval() during "Measurement Period" /* end Populations */ diff --git a/input/cql/HIVIND61Logic.cql b/input/cql/HIVIND61Logic.cql index 587e929fe0..634495c9c8 100644 --- a/input/cql/HIVIND61Logic.cql +++ b/input/cql/HIVIND61Logic.cql @@ -79,13 +79,11 @@ define "Initial Population": * Calculation: COUNT of pregnant women with "ANC contact date" in reporting period AND "Syphilis test date" on ANY "ANC contact date" for this pregnancy */ -define "all anc dates": -flatten{HE."ANC contact date E.DE85"} define "Numerator": - HIE."ANC contact date E.DE85" + exists(HIE."ANC within pregnancy within measurement period") and exists(HE."Syphilis test date B.DE249" P - where exists("all anc dates" t where duration in days of (t intersect P.performed.toInterval()) > 0) + where exists(HIE."all anc dates" t where duration in days of (t intersect P.performed.toInterval()) > 0) ) @@ -100,7 +98,7 @@ define "Numerator": */ define "Denominator": - HIE."ANC contact date E.DE85" + exists(HIE."ANC within pregnancy within measurement period") /* end Populations */ diff --git a/input/cql/HIVIND64Logic.cql b/input/cql/HIVIND64Logic.cql index 703f3e94d0..7b91b6357c 100644 --- a/input/cql/HIVIND64Logic.cql +++ b/input/cql/HIVIND64Logic.cql @@ -68,6 +68,9 @@ include HIVCommon version '0.0.1' called HIC include FHIRHelpers version '4.0.1' include WHOCommon called WCom +include HIVElements called HE +include HIVIndicatorElements called HIE +include HIVConfig called Config // Indicator Definition parameter "Measurement Period" Interval default Interval[@2023-01-01, @2023-01-30] @@ -89,8 +92,17 @@ define "Initial Population": * Calculation: COUNT of pregnant women with first "ANC contact date" for this pregnancy in the reporting period AND with "Syphilis test date" on first "ANC contact date" AND "Syphilis test result"='Positive' */ + + + + define "Numerator": - true + First(HIE."ANC within pregnancy").period.toInterval() during "Measurement Period" + and exists(HE."Positive B.DE251" S + with HE."Syphilis test date B.DE249" P + such that S.partOf.references(P) and P.performed.toInterval() during "Measurement Period" + and start of P.performed.toInterval() = start of HIE."first anc date" + ) /** @@ -101,8 +113,30 @@ define "Numerator": */ define "Denominator": - true + First(HIE."ANC within pregnancy").period.toInterval() during "Measurement Period" + and exists(HE."Syphilis test date B.DE249" P + where P.performed.toInterval() during "Measurement Period" + and start of P.performed.toInterval() = start of HIE."first anc date" + ) /* end Populations */ +/* + * Disaggregators + */ + + +define "Age Stratifier": + HIE."By Age Stratifier 2" + +define "Geographic Region Stratifier": + HIE."By Geographic Region Stratifier" + +define "HIV Status": + HIE."HIV Status Stratifier" + +define "Stratification": +HIE."By Age Stratifier 2" ++ ':' + HIE."By Geographic Region Stratifier" ++ ':' + HIE."HIV Status Stratifier".code \ No newline at end of file diff --git a/input/cql/HIVIND65Logic.cql b/input/cql/HIVIND65Logic.cql index 8d53edd283..691bc846ad 100644 --- a/input/cql/HIVIND65Logic.cql +++ b/input/cql/HIVIND65Logic.cql @@ -68,6 +68,9 @@ include HIVCommon version '0.0.1' called HIC include FHIRHelpers version '4.0.1' include WHOCommon called WCom +include HIVElements called HE +include HIVIndicatorElements called HIE +include HIVConfig called Config // Indicator Definition parameter "Measurement Period" Interval default Interval[@2023-01-01, @2023-01-30] @@ -89,8 +92,12 @@ define "Initial Population": * Calculation: COUNT of pregnant women with "ANC contact date" in reporting period AND with "Syphilis test date" on ANY "ANC contact date" for this pregnancy AND "Syphilis test result"='Positive' */ + define "Numerator": - true + exists(HIE."ANC within pregnancy within measurement period") + and exists(HE."Positive B.DE251" S + with HE."Syphilis test date B.DE249" P + such that S.partOf.references(P) and exists(HIE."all anc dates" t where duration in days of (t intersect P.performed.toInterval()) > 0)) /** @@ -101,8 +108,28 @@ define "Numerator": */ define "Denominator": - true + exists(HIE."ANC within pregnancy within measurement period") + and exists(HE."Syphilis test date B.DE249" P + where exists(HIE."all anc dates" t where duration in days of (t intersect P.performed.toInterval()) > 0)) /* end Populations */ +/* + * Disaggregators + */ + + +define "Age Stratifier": + HIE."By Age Stratifier 2" + +define "Geographic Region Stratifier": + HIE."By Geographic Region Stratifier" + +define "HIV Status": + HIE."HIV Status Stratifier" + +define "Stratification": +HIE."By Age Stratifier 2" ++ ':' + HIE."By Geographic Region Stratifier" ++ ':' + HIE."HIV Status Stratifier".code diff --git a/input/cql/HIVIND66Logic.cql b/input/cql/HIVIND66Logic.cql index 75676469e6..d9702ad822 100644 --- a/input/cql/HIVIND66Logic.cql +++ b/input/cql/HIVIND66Logic.cql @@ -96,6 +96,9 @@ include HIVCommon version '0.0.1' called HIC include FHIRHelpers version '4.0.1' include WHOCommon called WCom +include HIVElements called HE +include HIVIndicatorElements called HIE +include HIVConfig called Config // Indicator Definition parameter "Measurement Period" Interval default Interval[@2023-01-01, @2023-01-30] @@ -118,7 +121,10 @@ define "Initial Population": */ define "Numerator": - true + exists(HE."Positive B.DE251" S + with HE."Syphilis test date B.DE249" P + such that S.partOf.references(P) and P.performed.toInterval() during "Measurement Period") + and HIE."Syphilis treatment start date B.DE254" /** @@ -129,8 +135,37 @@ define "Numerator": */ define "Denominator": - true + exists(HE."Positive B.DE251" S + with HE."Syphilis test date B.DE249" P + such that S.partOf.references(P) and P.performed.toInterval() during "Measurement Period" + and exists (HE."Date accessed HIV prevention intervention" t where t = start of P.performed.toInterval())) /* end Populations */ +/* + * Disaggregators + */ + +define "Administrative Gender Stratifier": + HIE."By Administrative Gender Stratifier" + +define "Age Stratifier": + HIE."By Age Stratifier 2" + +define "Geographic Region Stratifier": + HIE."By Geographic Region Stratifier" + +define "patientGroups Stratifier": + HIE."patientGroups" + +define "HIV Status": + HIE."HIV Status Stratifier" + +define "Stratification": + HIE."By Administrative Gender Stratifier".code + + ':' + HIE."By Age Stratifier 2" ++ ':' + HIE."By Geographic Region Stratifier" ++ Combine(HIE.patientGroups, ':') ++ ':' + HIE."HIV Status Stratifier".code + diff --git a/input/cql/HIVIND67Logic.cql b/input/cql/HIVIND67Logic.cql index 94cfd46f4b..f64b4e3d84 100644 --- a/input/cql/HIVIND67Logic.cql +++ b/input/cql/HIVIND67Logic.cql @@ -87,6 +87,10 @@ include HIVCommon version '0.0.1' called HIC include FHIRHelpers version '4.0.1' include WHOCommon called WCom +include HIVElements called HE +include HIVIndicatorElements called HIE +include HIVConfig called Config + // Indicator Definition parameter "Measurement Period" Interval default Interval[@2023-01-01, @2023-01-30] @@ -109,7 +113,11 @@ define "Initial Population": */ define "Numerator": - true + HIE."Has HIV-positive Status" + and exists(HE."Positive B.DE251" S + with HE."Syphilis test date B.DE249" P + such that S.partOf.references(P) and P.performed.toInterval() during "Measurement Period") + and HIE."Syphilis treatment start date B.DE254" /** @@ -120,8 +128,32 @@ define "Numerator": */ define "Denominator": - true + HIE."Has HIV-positive Status" + and exists(HE."Positive B.DE251" S + with HE."Syphilis test date B.DE249" P + such that S.partOf.references(P) and P.performed.toInterval() during "Measurement Period") /* end Populations */ +/* + * Disaggregators + */ + +define "Administrative Gender Stratifier": + HIE."By Administrative Gender Stratifier" + +define "Age Stratifier": + HIE."By Age Stratifier 2" + +define "Geographic Region Stratifier": + HIE."By Geographic Region Stratifier" + +define "patientGroups Stratifier": + HIE."patientGroups" + +define "Stratification": + HIE."By Administrative Gender Stratifier".code + + ':' + HIE."By Age Stratifier 2" ++ ':' + HIE."By Geographic Region Stratifier" ++ Combine(HIE.patientGroups, ':') \ No newline at end of file diff --git a/input/cql/HIVIND68Logic.cql b/input/cql/HIVIND68Logic.cql index cd128ab6b9..fd39694ee2 100644 --- a/input/cql/HIVIND68Logic.cql +++ b/input/cql/HIVIND68Logic.cql @@ -71,6 +71,9 @@ include HIVCommon version '0.0.1' called HIC include FHIRHelpers version '4.0.1' include WHOCommon called WCom +include HIVElements called HE +include HIVIndicatorElements called HIE +include HIVConfig called Config // Indicator Definition parameter "Measurement Period" Interval default Interval[@2023-01-01, @2023-01-30] @@ -93,7 +96,13 @@ define "Initial Population": */ define "Numerator": - true + First(HIE."ANC within pregnancy").period.toInterval() during "Measurement Period" + and exists(HE."Positive B.DE251" S + with HE."Syphilis test date B.DE249" P + such that S.partOf.references(P) and P.performed.toInterval() during "Measurement Period" + and start of P.performed.toInterval() = start of HIE."first anc date" + ) + and HIE."Syphilis treatment start date B.DE254" /** @@ -104,8 +113,31 @@ define "Numerator": */ define "Denominator": - true + First(HIE."ANC within pregnancy").period.toInterval() during "Measurement Period" + and exists(HE."Positive B.DE251" S + with HE."Syphilis test date B.DE249" P + such that S.partOf.references(P) and P.performed.toInterval() during "Measurement Period" + and start of P.performed.toInterval() = start of HIE."first anc date" + ) /* end Populations */ +/* + * Disaggregators + */ + + +define "Age Stratifier": + HIE."By Age Stratifier 2" + +define "Geographic Region Stratifier": + HIE."By Geographic Region Stratifier" + +define "HIV Status": + HIE."HIV Status Stratifier" + +define "Stratification": +HIE."By Age Stratifier 2" ++ ':' + HIE."By Geographic Region Stratifier" ++ ':' + HIE."HIV Status Stratifier".code \ No newline at end of file diff --git a/input/cql/HIVIND69Logic.cql b/input/cql/HIVIND69Logic.cql index bcbb45ecd1..25e3bd14f4 100644 --- a/input/cql/HIVIND69Logic.cql +++ b/input/cql/HIVIND69Logic.cql @@ -71,6 +71,10 @@ include HIVCommon version '0.0.1' called HIC include FHIRHelpers version '4.0.1' include WHOCommon called WCom +include HIVElements called HE +include HIVIndicatorElements called HIE +include HIVConfig called Config + // Indicator Definition parameter "Measurement Period" Interval default Interval[@2023-01-01, @2023-01-30] @@ -93,8 +97,11 @@ define "Initial Population": */ define "Numerator": - true - + exists(HIE."ANC within pregnancy within measurement period") + and exists(HE."Positive B.DE251" S + with HE."Syphilis test date B.DE249" P + such that S.partOf.references(P) and exists(HIE."all anc dates" t where duration in days of (t intersect P.performed.toInterval()) > 0)) + and HIE."Syphilis treatment start date B.DE254" /** * Denominator @@ -104,8 +111,29 @@ define "Numerator": */ define "Denominator": - true + exists(HIE."ANC within pregnancy within measurement period") + and exists(HE."Positive B.DE251" S + with HE."Syphilis test date B.DE249" P + such that S.partOf.references(P) and exists(HIE."all anc dates" t where duration in days of (t intersect P.performed.toInterval()) > 0)) /* end Populations */ +/* + * Disaggregators + */ + + +define "Age Stratifier": + HIE."By Age Stratifier 2" + +define "Geographic Region Stratifier": + HIE."By Geographic Region Stratifier" + +define "HIV Status": + HIE."HIV Status Stratifier" + +define "Stratification": +HIE."By Age Stratifier 2" ++ ':' + HIE."By Geographic Region Stratifier" ++ ':' + HIE."HIV Status Stratifier".code \ No newline at end of file diff --git a/input/cql/HIVIND70Logic.cql b/input/cql/HIVIND70Logic.cql index edf9bcea6d..c639f09174 100644 --- a/input/cql/HIVIND70Logic.cql +++ b/input/cql/HIVIND70Logic.cql @@ -107,6 +107,9 @@ include HIVCommon version '0.0.1' called HIC include FHIRHelpers version '4.0.1' include WHOCommon called WCom +include HIVElements called HE +include HIVIndicatorElements called HIE +include HIVConfig called Config // Indicator Definition parameter "Measurement Period" Interval default Interval[@2023-01-01, @2023-01-30] @@ -129,7 +132,7 @@ define "Initial Population": */ define "Numerator": - true + HIE."Gonorrhoea test date B.DE255" /** @@ -140,8 +143,39 @@ define "Numerator": */ define "Denominator": - true + HIE."Date accessed HIV prevention intervention" /* end Populations */ +/* + * Disaggregators + */ + +define "Administrative Gender Stratifier": + HIE."By Administrative Gender Stratifier" + +define "Age Stratifier": + HIE."By Age Stratifier 2" + +define "Geographic Region Stratifier": + HIE."By Geographic Region Stratifier" + +define "patientGroups Stratifier": + HIE."patientGroups" + +define "HIV prevention intervention": + HIE."HIV prevention intervention" + +define "HIV Status": + HIE."HIV Status Stratifier" + +define "Stratification": + HIE."By Administrative Gender Stratifier".code + + ':' + HIE."By Age Stratifier 2" ++ ':' + HIE."By Geographic Region Stratifier" ++ Combine(HIE.patientGroups, ':') ++ Combine(HIE."HIV prevention intervention", ':') ++ ':' + HIE."HIV Status Stratifier".code + +//need to add Diagnostic test used and anatomic site sampled \ No newline at end of file diff --git a/input/cql/HIVIND71Logic.cql b/input/cql/HIVIND71Logic.cql index 82e6ebe292..9961c6ab39 100644 --- a/input/cql/HIVIND71Logic.cql +++ b/input/cql/HIVIND71Logic.cql @@ -100,6 +100,9 @@ include HIVCommon version '0.0.1' called HIC include FHIRHelpers version '4.0.1' include WHOCommon called WCom +include HIVElements called HE +include HIVIndicatorElements called HIE +include HIVConfig called Config // Indicator Definition parameter "Measurement Period" Interval default Interval[@2023-01-01, @2023-01-30] @@ -122,7 +125,8 @@ define "Initial Population": */ define "Numerator": - true + HIE."Has HIV-positive Status" and + HIE."Gonorrhoea test date B.DE255" /** @@ -133,8 +137,33 @@ define "Numerator": */ define "Denominator": - true + HIE."Has HIV-positive Status" and + HIE."Visit date SRV.DE15" /* end Populations */ +/* + * Disaggregators + */ + +define "Administrative Gender Stratifier": + HIE."By Administrative Gender Stratifier" + +define "Age Stratifier": + HIE."By Age Stratifier 2" + +define "Geographic Region Stratifier": + HIE."By Geographic Region Stratifier" + +define "patientGroups Stratifier": + HIE."patientGroups" + +define "Stratification": + HIE."By Administrative Gender Stratifier".code + + ':' + HIE."By Age Stratifier 2" ++ ':' + HIE."By Geographic Region Stratifier" ++ Combine(HIE.patientGroups, ':') + + +//need to add Diagnostic test used and anatomic site sampled \ No newline at end of file diff --git a/input/cql/HIVIND72Logic.cql b/input/cql/HIVIND72Logic.cql index 66ae952aaf..ee4846daae 100644 --- a/input/cql/HIVIND72Logic.cql +++ b/input/cql/HIVIND72Logic.cql @@ -116,6 +116,9 @@ include HIVCommon version '0.0.1' called HIC include FHIRHelpers version '4.0.1' include WHOCommon called WCom +include HIVElements called HE +include HIVIndicatorElements called HIE +include HIVConfig called Config // Indicator Definition parameter "Measurement Period" Interval default Interval[@2023-01-01, @2023-01-30] @@ -138,7 +141,9 @@ define "Initial Population": */ define "Numerator": - true + exists(HE."Positive B.DE257" G + with HE."Gonorrhoea test date B.DE255" P + such that G.partOf.references(P) and P.performed.toInterval() during "Measurement Period") /** @@ -149,8 +154,41 @@ define "Numerator": */ define "Denominator": - true + exists(HE."Gonorrhoea test date B.DE255" P + where P.performed.toInterval() during "Measurement Period" + and exists (HE."Date accessed HIV prevention intervention" t where t = start of P.performed.toInterval())) /* end Populations */ +/* + * Disaggregators + */ + +define "Administrative Gender Stratifier": + HIE."By Administrative Gender Stratifier" + +define "Age Stratifier": + HIE."By Age Stratifier 2" + +define "Geographic Region Stratifier": + HIE."By Geographic Region Stratifier" + +define "patientGroups Stratifier": + HIE."patientGroups" + +define "HIV prevention intervention": + HIE."HIV prevention intervention" + +define "HIV Status": + HIE."HIV Status Stratifier" + +define "Stratification": + HIE."By Administrative Gender Stratifier".code + + ':' + HIE."By Age Stratifier 2" ++ ':' + HIE."By Geographic Region Stratifier" ++ Combine(HIE.patientGroups, ':') ++ Combine(HIE."HIV prevention intervention", ':') ++ ':' + HIE."HIV Status Stratifier".code + +//need to add Diagnostic test used and anatomic site sampled \ No newline at end of file diff --git a/input/cql/HIVIND73Logic.cql b/input/cql/HIVIND73Logic.cql index b9398aa015..6ecc63dfc8 100644 --- a/input/cql/HIVIND73Logic.cql +++ b/input/cql/HIVIND73Logic.cql @@ -106,6 +106,9 @@ include HIVCommon version '0.0.1' called HIC include FHIRHelpers version '4.0.1' include WHOCommon called WCom +include HIVElements called HE +include HIVIndicatorElements called HIE +include HIVConfig called Config // Indicator Definition parameter "Measurement Period" Interval default Interval[@2023-01-01, @2023-01-30] @@ -128,7 +131,10 @@ define "Initial Population": */ define "Numerator": - true + HIE."Has HIV-positive Status" and + exists(HE."Positive B.DE257" G + with HE."Gonorrhoea test date B.DE255" P + such that G.partOf.references(P) and P.performed.toInterval() during "Measurement Period") /** @@ -139,8 +145,33 @@ define "Numerator": */ define "Denominator": - true + HIE."Has HIV-positive Status" and + HIE."Gonorrhoea test date B.DE255" /* end Populations */ +/* + * Disaggregators + */ + +define "Administrative Gender Stratifier": + HIE."By Administrative Gender Stratifier" + +define "Age Stratifier": + HIE."By Age Stratifier 2" + +define "Geographic Region Stratifier": + HIE."By Geographic Region Stratifier" + +define "patientGroups Stratifier": + HIE."patientGroups" + +define "Stratification": + HIE."By Administrative Gender Stratifier".code + + ':' + HIE."By Age Stratifier 2" ++ ':' + HIE."By Geographic Region Stratifier" ++ Combine(HIE.patientGroups, ':') + + +//need to add Diagnostic test used and anatomic site sampled \ No newline at end of file diff --git a/input/cql/HIVIND74Logic.cql b/input/cql/HIVIND74Logic.cql index bdd84e42c3..165697d2b0 100644 --- a/input/cql/HIVIND74Logic.cql +++ b/input/cql/HIVIND74Logic.cql @@ -91,6 +91,9 @@ include HIVCommon version '0.0.1' called HIC include FHIRHelpers version '4.0.1' include WHOCommon called WCom +include HIVElements called HE +include HIVIndicatorElements called HIE +include HIVConfig called Config // Indicator Definition parameter "Measurement Period" Interval default Interval[@2023-01-01, @2023-01-30] @@ -113,7 +116,10 @@ define "Initial Population": */ define "Numerator": - true + exists(HE."Positive B.DE257" G + with HE."Gonorrhoea test date B.DE255" P + such that G.partOf.references(P) and P.performed.toInterval() during "Measurement Period") + and HIE."Gonorrhoea treatment start date B.DE260" /** @@ -124,8 +130,31 @@ define "Numerator": */ define "Denominator": - true + exists(HE."Positive B.DE257" G + with HE."Gonorrhoea test date B.DE255" P + such that G.partOf.references(P) and P.performed.toInterval() during "Measurement Period") /* end Populations */ +/* + * Disaggregators + */ + +define "Administrative Gender Stratifier": + HIE."By Administrative Gender Stratifier" + +define "Age Stratifier": + HIE."By Age Stratifier 2" + +define "Geographic Region Stratifier": + HIE."By Geographic Region Stratifier" + +define "patientGroups Stratifier": + HIE."patientGroups" + +define "Stratification": + HIE."By Administrative Gender Stratifier".code + + ':' + HIE."By Age Stratifier 2" ++ ':' + HIE."By Geographic Region Stratifier" ++ Combine(HIE.patientGroups, ':') \ No newline at end of file diff --git a/input/cql/HIVIndicatorElements.cql b/input/cql/HIVIndicatorElements.cql index 238a9acccb..46f8edc924 100644 --- a/input/cql/HIVIndicatorElements.cql +++ b/input/cql/HIVIndicatorElements.cql @@ -572,12 +572,10 @@ define "Facility-level testing Observation": @activity: HIV.B6 Capture or update client history @description: Client is currently pregnant */ -// TODO: Replace placeholder with relevant CQL logic + define "Currently pregnant B.DE29": - exists "Currently pregnant B.DE29 Observation" -define "Currently pregnant B.DE29 Observation": - Elements."Currently pregnant B.DE29 Observation" O - where O.effective.toInterval() during "Measurement Period" + Elements."Currently pregnant B.DE29" C + where C.prevalenceInterval() during "Measurement Period" /* End of Currently pregnant B.DE29 */ /* @@ -1774,13 +1772,11 @@ define "Inconclusive B.DE253": @activity: HIV.B23 Offer sexual and reproductive health services @description: Date of initiation of syphilis treatment */ -// TODO: Replace placeholder with relevant CQL logic + define "Syphilis treatment start date B.DE254": - Elements."Syphilis treatment start date B.DE254" O - where O.effective.toInterval() during "Measurement Period" -define "Syphilis treatment start date B.DE254 Value": - "Syphilis treatment start date B.DE254" O - return O.value + exists (Elements."Syphilis treatment start date B.DE254" MS + where MS.effective.toInterval() during "Measurement Period") + /* End of Syphilis treatment start date B.DE254 */ /* @@ -1788,13 +1784,10 @@ define "Syphilis treatment start date B.DE254 Value": @activity: HIV.B23 Offer sexual and reproductive health services @description: Date of Gonorrhoea test */ -// TODO: Replace placeholder with relevant CQL logic + define "Gonorrhoea test date B.DE255": - Elements."Gonorrhoea test date B.DE255" O - where O.effective.toInterval() during "Measurement Period" -define "Gonorrhoea test date B.DE255 Value": - "Gonorrhoea test date B.DE255" O - return O.value + exists(Elements."Gonorrhoea test date B.DE255" P + where P.performed.toInterval() during "Measurement Period") /* End of Gonorrhoea test date B.DE255 */ /* @@ -1802,12 +1795,10 @@ define "Gonorrhoea test date B.DE255 Value": @activity: HIV.B23 Offer sexual and reproductive health services @description: Result from Gonorrhoea test */ -// TODO: Replace placeholder with relevant CQL logic + define "Gonorrhoea test result B.DE256": - exists "Gonorrhoea test result B.DE256 Observation" -define "Gonorrhoea test result B.DE256 Observation": - Elements."Gonorrhoea test result B.DE256 Observation" O - where O.effective.toInterval() during "Measurement Period" + exists(Elements."Gonorrhoea test result B.DE256" O + where O.effective.toInterval() during "Measurement Period") /* End of Gonorrhoea test result B.DE256 */ /* @@ -1815,16 +1806,9 @@ define "Gonorrhoea test result B.DE256 Observation": @activity: HIV.B23 Offer sexual and reproductive health services @description: Test result is positive for Neisseria gonorrhoeae */ -// TODO: Replace placeholder with relevant CQL logic + define "Positive B.DE257": - exists "Positive B.DE257 Condition" - or exists "Positive B.DE257 Observation" -define "Positive B.DE257 Condition": - Elements."Positive B.DE257 Condition" C - where C.prevalenceInterval() overlaps before "Measurement Period" - or C.prevalenceInterval() overlaps after "Measurement Period" -define "Positive B.DE257 Observation": - Elements."Positive B.DE257 Observation" O + exists Elements."Positive B.DE257" O where O.effective.toInterval() during "Measurement Period" /* End of Positive B.DE257 */ @@ -1833,16 +1817,9 @@ define "Positive B.DE257 Observation": @activity: HIV.B23 Offer sexual and reproductive health services @description: Test result is negative for Neisseria gonorrhoeae */ -// TODO: Replace placeholder with relevant CQL logic + define "Negative B.DE258": - exists "Negative B.DE258 Condition" - or exists "Negative B.DE258 Observation" -define "Negative B.DE258 Condition": - Elements."Negative B.DE258 Condition" C - where C.prevalenceInterval() overlaps before "Measurement Period" - or C.prevalenceInterval() overlaps after "Measurement Period" -define "Negative B.DE258 Observation": - Elements."Negative B.DE258 Observation" O + exists Elements."Negative B.DE258" O where O.effective.toInterval() during "Measurement Period" /* End of Negative B.DE258 */ @@ -1851,16 +1828,9 @@ define "Negative B.DE258 Observation": @activity: HIV.B23 Offer sexual and reproductive health services @description: Test result is inconclusive */ -// TODO: Replace placeholder with relevant CQL logic + define "Inconclusive B.DE259": - exists "Inconclusive B.DE259 Condition" - or exists "Inconclusive B.DE259 Observation" -define "Inconclusive B.DE259 Condition": - Elements."Inconclusive B.DE259 Condition" C - where C.prevalenceInterval() overlaps before "Measurement Period" - or C.prevalenceInterval() overlaps after "Measurement Period" -define "Inconclusive B.DE259 Observation": - Elements."Inconclusive B.DE259 Observation" O + exists Elements."Inconclusive B.DE259" O where O.effective.toInterval() during "Measurement Period" /* End of Inconclusive B.DE259 */ @@ -1869,13 +1839,10 @@ define "Inconclusive B.DE259 Observation": @activity: HIV.B23 Offer sexual and reproductive health services @description: Date of initiation of Gonorrhoea treatment */ -// TODO: Replace placeholder with relevant CQL logic + define "Gonorrhoea treatment start date B.DE260": - Elements."Gonorrhoea treatment start date B.DE260" O - where O.effective.toInterval() during "Measurement Period" -define "Gonorrhoea treatment start date B.DE260 Value": - "Gonorrhoea treatment start date B.DE260" O - return O.value + exists (Elements."Gonorrhoea treatment start date B.DE260" MS + where MS.effective.toInterval() during "Measurement Period") /* End of Gonorrhoea treatment start date B.DE260 */ /* @@ -6311,15 +6278,14 @@ define "HIV treatment outcome": @activity: HIV.H3 Record outreach and result @description: Twenty-eight days or more since last missed appointment */ -define "Lost to follow-up": +define "Not Lost to follow-up": Elements."On ART H.DE47" H - where H.effective starts before end of "Measurement Period" - and H.effective ends after start of "Measurement Period" - and not (H.effective ends after (end of "Measurement Period" - Config."LTFU Days")) + where H.effective.toInterval() starts before end of "Measurement Period" + and H.effective ends after (end of "Measurement Period" - Config."LTFU Days") define "Is lost to follow-up": - exists("Lost to follow-up") + "On ART H.DE47" and not exists("Not Lost to follow-up") /* End of Lost to follow-up */ @@ -6329,8 +6295,22 @@ define "Is lost to follow-up": @description: The client transferred to another facility */ +define "Not Transferred Out": +Elements."On ART H.DE47" ART + with [EpisodeOfCare] EOC + such that ART.context.references(EOC) and + not exists ( + EOC.statusHistory H + where H.status = 'finished' and H.period overlaps "Measurement Period" + ) + and not ( + EOC.status = 'finished' and EOC.period overlaps "Measurement Period" + ) + where ART.effective.toInterval() starts before end of "Measurement Period" + and ART.effective.toInterval() ends after start of "Measurement Period" + define "Has transferred out": - exists(Elements."Transferred out" t where t ends during "Measurement Period") + "On ART H.DE47" and not exists("Not Transferred Out") /* End of Transferred out */ /* @@ -6980,4 +6960,24 @@ define "Reporting date Value": /* * Custom elements and logic for use DT and IND CQL Libraries - */ \ No newline at end of file + */ + + define "ANC within pregnancy": + Elements."Antenatal care contact" E + where E.period.toInterval() during First("Currently pregnant B.DE29").prevalenceInterval() + +define "ANC within pregnancy dates": + Elements."Antenatal care contact" E + where E.period.toInterval() during First("Currently pregnant B.DE29").prevalenceInterval() + return E.period.toInterval() + + define "ANC within pregnancy within measurement period": + Elements."Antenatal care contact" E + where E.period.toInterval() during First("Currently pregnant B.DE29").prevalenceInterval() + and E.period.toInterval() during "Measurement Period" + +define "all anc dates": + flatten{"ANC within pregnancy dates"} + +define "first anc date": + First("ANC within pregnancy dates") \ No newline at end of file