From 9121d805625ce357b305cfd8f6c545b7230962aa Mon Sep 17 00:00:00 2001 From: Patric Prado Date: Mon, 12 Aug 2024 23:18:31 -0700 Subject: [PATCH] indicators 46-55 --- input/cql/HIVCommon.cql | 2 - input/cql/HIVConceptsCustom.cql | 2 + input/cql/HIVElements.cql | 65 +++++++++++++++++------------- input/cql/HIVIND47Logic.cql | 14 +++---- input/cql/HIVIND48Logic.cql | 12 +++--- input/cql/HIVIND49Logic.cql | 14 +++---- input/cql/HIVIND50Logic.cql | 14 +++---- input/cql/HIVIND51Logic.cql | 14 +++---- input/cql/HIVIND52Logic.cql | 14 +++---- input/cql/HIVIND53Logic.cql | 40 +++++++++++++++++- input/cql/HIVIND54Logic.cql | 11 ++++- input/cql/HIVIND55Logic.cql | 11 ++++- input/cql/HIVIndicatorElements.cql | 43 ++++++++++---------- 13 files changed, 154 insertions(+), 102 deletions(-) diff --git a/input/cql/HIVCommon.cql b/input/cql/HIVCommon.cql index 47110153f3f..0efa5678f4e 100644 --- a/input/cql/HIVCommon.cql +++ b/input/cql/HIVCommon.cql @@ -15,8 +15,6 @@ context Patient //DRAFT - - //need to add Time to start ART (within 7, 30 or 90 days of diagnosis, as per country guidelines) //need to add Disaggregation by time since diagnosis diff --git a/input/cql/HIVConceptsCustom.cql b/input/cql/HIVConceptsCustom.cql index f31e3fdf7b0..d3db50471c2 100644 --- a/input/cql/HIVConceptsCustom.cql +++ b/input/cql/HIVConceptsCustom.cql @@ -69,3 +69,5 @@ code "buprenorphine": 'buprenorphine' from "missing concepts" code "viral load test": 'viral load test' from "missing concepts" code "delivery": 'delivery' from "missing concepts" 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" \ No newline at end of file diff --git a/input/cql/HIVElements.cql b/input/cql/HIVElements.cql index 5bded3c7844..e7ddef1336b 100644 --- a/input/cql/HIVElements.cql +++ b/input/cql/HIVElements.cql @@ -5546,8 +5546,9 @@ define "Established on ART Observation": */ define "ART start type": - [Observation: Concepts."ART start type"] O - where O.status in { 'final', 'amended', 'corrected' } + [MedicationStatement] MS + where exists(MS.reasonCode C where C ~ Concepts."On ART - HIV.D.DE38") + sort by start of effective.toInterval() /* End of ART start type */ /* @@ -5557,8 +5558,8 @@ define "ART start type": */ define "First-time user of ART": - "ART start type" O - where O.value ~ Concepts."First-time user of ART" + "ART start type" MS + where exists(MS.reasonCode C where C ~ Concepts."First-time user of ART") /* End of First-time user of ART */ /* @@ -5568,8 +5569,9 @@ define "First-time user of ART": */ define "Restarting ART": - "ART start type" O - where O.value ~ Concepts."Restarting ART" + "ART start type" MS + where exists(MS.reasonCode C where C ~ Concepts."Restarting ART") + /* End of Restarting ART */ /* @@ -10253,10 +10255,8 @@ define "Malaria prevention such as bed nets and prophylaxis, depending on epidem @activity: HIV.D21 Determine regimen and treatment options @description: Client is eligible for differentiated service delivery (DSD) for ART */ -// TODO: Replace placeholder with relevant CQL logic + define "Eligible for DSD ART": - exists "Eligible for DSD ART Observation" -define "Eligible for DSD ART Observation": [Observation: Concepts."Eligible for DSD ART"] O where O.status in { 'final', 'amended', 'corrected' } and O.value is true @@ -10267,13 +10267,11 @@ define "Eligible for DSD ART Observation": @activity: HIV.D21 Determine regimen and treatment options @description: Date client was assessed for eligibility for differentiated service delivery (DSD) for ART */ -// TODO: Replace placeholder with relevant CQL logic + define "Date DSD ART eligibility assessed": - [Observation: Concepts."Date DSD ART eligibility assessed"] O - where O.status in { 'final', 'amended', 'corrected' } -define "Date DSD ART eligibility assessed Value": - "Date DSD ART eligibility assessed" O - return O.value + [Procedure: CustomConcepts."DSD ART eligibility assessed"] P + where P.status in { 'completed' } + return P.performed.toInterval() /* End of Date DSD ART eligibility assessed */ /* @@ -10281,13 +10279,11 @@ define "Date DSD ART eligibility assessed Value": @activity: HIV.D21 Determine regimen and treatment options @description: Client currently enrolled in differentiated service delivery (DSD) ART model */ -// TODO: Replace placeholder with relevant CQL logic + define "Currently enrolled in DSD ART model": - exists "Currently enrolled in DSD ART model Observation" -define "Currently enrolled in DSD ART model Observation": - [Observation: Concepts."Currently enrolled in DSD ART model"] O - where O.status in { 'final', 'amended', 'corrected' } - and O.value is true + [EpisodeOfCare] EOC + where exists(EOC.type T where T ~ Concepts."Currently enrolled in DSD ART model") + /* End of Currently enrolled in DSD ART model */ /* @@ -10295,13 +10291,23 @@ define "Currently enrolled in DSD ART model Observation": @activity: HIV.D21 Determine regimen and treatment options @description: Date client started on differentiated service delivery (DSD) for ART */ -// TODO: Replace placeholder with relevant CQL logic + define "DSD ART start date": - [Observation: Concepts."DSD ART start date"] O - where O.status in { 'final', 'amended', 'corrected' } -define "DSD ART start date Value": - "DSD ART start date" O - return O.value + flatten{"DSD ART status","DSD ART statusHistory".statusHistory.period} + +define "DSD ART status": + [EpisodeOfCare] EOC + where exists(EOC.type T where T ~ Concepts."Currently enrolled in DSD ART model") + and EOC.status = 'finished' + return EOC.period + +define "DSD ART statusHistory": + [EpisodeOfCare] EOC + where exists(EOC.type T where T ~ Concepts."Currently enrolled in DSD ART model") + and (exists ( + EOC.statusHistory H + where H.status = 'finished' + and H.period is not null)) /* End of DSD ART start date */ /* @@ -15011,4 +15017,7 @@ define "Reporting date Value": /* * Custom elements and logic for use DT and IND CQL Libraries - */ \ No newline at end of file + */ + +define "First On ART": + (First("On ART D.DE38")) \ No newline at end of file diff --git a/input/cql/HIVIND47Logic.cql b/input/cql/HIVIND47Logic.cql index 8f11a1472fd..12f0dedc80a 100644 --- a/input/cql/HIVIND47Logic.cql +++ b/input/cql/HIVIND47Logic.cql @@ -104,7 +104,7 @@ define "Initial Population": define "Numerator": HIE."HIV-positive B.DE116" - and (start of HIC."First On ART".effective.toInterval() during "Measurement Period") + and (start of HE."First On ART".effective.toInterval() during "Measurement Period") and HIE."Date of TB diagnosis" @@ -117,7 +117,7 @@ define "Numerator": define "Denominator": HIE."HIV-positive B.DE116" - and (start of HIC."First On ART".effective.toInterval() during "Measurement Period") + and (start of HE."First On ART".effective.toInterval() during "Measurement Period") /* end Populations */ @@ -138,10 +138,10 @@ define "Geographic Region Stratifier": define "patientGroups Stratifier": HIC."patientGroups" -define "Stratification": - HIC."By Administrative Gender Stratifier".code - + ':' + HIC."By Age Stratifier" -+ ':' + HIC."By Geographic Region Stratifier" -+ Combine(HIC.patientGroups, ':') +//define "Stratification": +// HIC."By Administrative Gender Stratifier".code +// + ':' + HIC."By Age Stratifier" +//+ ':' + HIC."By Geographic Region Stratifier" +//+ Combine(HIC.patientGroups, ':') //add Pregnant or breastfeeding women \ No newline at end of file diff --git a/input/cql/HIVIND48Logic.cql b/input/cql/HIVIND48Logic.cql index 97b560c7112..7efe26dd63b 100644 --- a/input/cql/HIVIND48Logic.cql +++ b/input/cql/HIVIND48Logic.cql @@ -90,7 +90,7 @@ define "Initial Population": define "Numerator": HIE."HIV-positive B.DE116" - and (start of HIC."First On ART".effective.toInterval() during "Measurement Period") + and (start of HE."First On ART".effective.toInterval() during "Measurement Period") and HIE."First-time user of ART" and HIE."TB screening date" @@ -104,7 +104,7 @@ define "Numerator": define "Denominator": HIE."HIV-positive B.DE116" - and (start of HIC."First On ART".effective.toInterval() during "Measurement Period") + and (start of HE."First On ART".effective.toInterval() during "Measurement Period") and HIE."First-time user of ART" @@ -123,9 +123,9 @@ define "Age Stratifier": define "Geographic Region Stratifier": HIC."By Geographic Region Stratifier" -define "Stratification": - HIC."By Administrative Gender Stratifier".code - + ':' + HIC."By Age Stratifier" -+ ':' + HIC."By Geographic Region Stratifier" +//define "Stratification": + //HIC."By Administrative Gender Stratifier".code + // + ':' + HIC."By Age Stratifier" +//+ ':' + HIC."By Geographic Region Stratifier" diff --git a/input/cql/HIVIND49Logic.cql b/input/cql/HIVIND49Logic.cql index 42d79741e05..71a44892d83 100644 --- a/input/cql/HIVIND49Logic.cql +++ b/input/cql/HIVIND49Logic.cql @@ -95,8 +95,7 @@ define "Initial Population": define "Numerator": HIE."HIV-positive B.DE116" - and (start of HIC."First On ART".effective.toInterval() during "Measurement Period") - and HIE."First-time user of ART" + and (start of First(HE."First-time user of ART").effective.toInterval() during "Measurement Period") and HIE."Screen positive for TB" @@ -109,8 +108,7 @@ define "Numerator": define "Denominator": HIE."HIV-positive B.DE116" - and (start of HIC."First On ART".effective.toInterval() during "Measurement Period") - and HIE."First-time user of ART" + and (start of First(HE."First-time user of ART").effective.toInterval() during "Measurement Period") and HIE."TB screening date" @@ -129,7 +127,7 @@ define "Age Stratifier": define "Geographic Region Stratifier": HIC."By Geographic Region Stratifier" -define "Stratification": - HIC."By Administrative Gender Stratifier".code - + ':' + HIC."By Age Stratifier" -+ ':' + HIC."By Geographic Region Stratifier" \ No newline at end of file +//define "Stratification": + //HIC."By Administrative Gender Stratifier".code + // + ':' + HIC."By Age Stratifier" +//+ ':' + HIC."By Geographic Region Stratifier" \ No newline at end of file diff --git a/input/cql/HIVIND50Logic.cql b/input/cql/HIVIND50Logic.cql index ce2c0227244..d11396d8470 100644 --- a/input/cql/HIVIND50Logic.cql +++ b/input/cql/HIVIND50Logic.cql @@ -106,8 +106,7 @@ define "Initial Population": define "Numerator": HIE."HIV-positive B.DE116" - and (start of HIC."First On ART".effective.toInterval() during "Measurement Period") - and HIE."First-time user of ART" + and (start of First(HE."First-time user of ART").effective.toInterval() during "Measurement Period") //related the two since we want a positive observation from a specific diagnostic test. and exists( HE."TB diagnostic test category" P @@ -126,8 +125,7 @@ define "Numerator": define "Denominator": HIE."HIV-positive B.DE116" - and (start of HIC."First On ART".effective.toInterval() during "Measurement Period") - and HIE."First-time user of ART" + and (start of First(HE."First-time user of ART").effective.toInterval() during "Measurement Period") and HIE."Screen positive for TB" @@ -146,7 +144,7 @@ define "Age Stratifier": define "Geographic Region Stratifier": HIC."By Geographic Region Stratifier" -define "Stratification": - HIC."By Administrative Gender Stratifier".code - + ':' + HIC."By Age Stratifier" -+ ':' + HIC."By Geographic Region Stratifier" +//define "Stratification": +// HIC."By Administrative Gender Stratifier".code +// + ':' + HIC."By Age Stratifier" +//+ ':' + HIC."By Geographic Region Stratifier" diff --git a/input/cql/HIVIND51Logic.cql b/input/cql/HIVIND51Logic.cql index 3f0a2d6b487..0077913214e 100644 --- a/input/cql/HIVIND51Logic.cql +++ b/input/cql/HIVIND51Logic.cql @@ -107,8 +107,7 @@ define "Initial Population": define "Numerator": HIE."HIV-positive B.DE116" - and (start of HIC."First On ART".effective.toInterval() during "Measurement Period") - and HIE."First-time user of ART" + and (start of First(HE."First-time user of ART").effective.toInterval() during "Measurement Period") //related the two since we want a positive observation from a specific diagnostic test. and exists( HE."TB diagnostic test category" P @@ -128,8 +127,7 @@ define "Numerator": define "Denominator": HIE."HIV-positive B.DE116" - and (start of HIC."First On ART".effective.toInterval() during "Measurement Period") - and HIE."First-time user of ART" + and (start of First(HE."First-time user of ART").effective.toInterval() during "Measurement Period") //related the two since we want a positive observation from a specific diagnostic test. and exists( HE."TB diagnostic test category" P @@ -154,7 +152,7 @@ define "Age Stratifier": define "Geographic Region Stratifier": HIC."By Geographic Region Stratifier" -define "Stratification": - HIC."By Administrative Gender Stratifier".code - + ':' + HIC."By Age Stratifier" -+ ':' + HIC."By Geographic Region Stratifier" \ No newline at end of file +//define "Stratification": +// HIC."By Administrative Gender Stratifier".code +// + ':' + HIC."By Age Stratifier" +//+ ':' + HIC."By Geographic Region Stratifier" \ No newline at end of file diff --git a/input/cql/HIVIND52Logic.cql b/input/cql/HIVIND52Logic.cql index f2a6315e394..26a5eed0a34 100644 --- a/input/cql/HIVIND52Logic.cql +++ b/input/cql/HIVIND52Logic.cql @@ -107,8 +107,7 @@ define "Initial Population": define "Numerator": HIE."HIV-positive B.DE116" - and (start of HIC."First On ART".effective.toInterval() during "Measurement Period") - and HIE."First-time user of ART" + and (start of First(HE."First-time user of ART").effective.toInterval() during "Measurement Period") //related the two since we want a positive observation from a specific diagnostic test. and exists( HE."TB diagnostic test category" P @@ -130,8 +129,7 @@ define "Numerator": define "Denominator": HIE."HIV-positive B.DE116" - and (start of HIC."First On ART".effective.toInterval() during "Measurement Period") - and HIE."First-time user of ART" + and (start of First(HE."First-time user of ART").effective.toInterval() during "Measurement Period") //related the two since we want a positive observation from a specific diagnostic test. and exists( HE."TB diagnostic test category" P @@ -158,7 +156,7 @@ define "Age Stratifier": define "Geographic Region Stratifier": HIC."By Geographic Region Stratifier" -define "Stratification": - HIC."By Administrative Gender Stratifier".code - + ':' + HIC."By Age Stratifier" -+ ':' + HIC."By Geographic Region Stratifier" \ No newline at end of file +//define "Stratification": +// HIC."By Administrative Gender Stratifier".code +// + ':' + HIC."By Age Stratifier" +//+ ':' + HIC."By Geographic Region Stratifier" \ No newline at end of file diff --git a/input/cql/HIVIND53Logic.cql b/input/cql/HIVIND53Logic.cql index cb1067423bf..bdcfb3e487c 100644 --- a/input/cql/HIVIND53Logic.cql +++ b/input/cql/HIVIND53Logic.cql @@ -72,6 +72,11 @@ include HIVCommon version '0.0.1' called HIC include FHIRHelpers version '4.0.1' include WHOCommon called WCom +include HIVConcepts called HC +include HIVConceptsCustom called HCC +include HIVCommon called Common +include HIVElements called HE +include HIVIndicatorElements called HIE // Indicator Definition parameter "Measurement Period" Interval default Interval[@2023-01-01, @2023-01-30] @@ -79,6 +84,13 @@ parameter "Measurement Period" Interval default Interval[@2023-01-01, @202 context Patient /* Populations */ +define "Last ART prescribed before end of measurement period": + Last([MedicationRequest: HCC."ART medication"] MR + where (MR.authoredOn.toInterval() before end of "Measurement Period") + and Common.MedicationRequestPeriod(MR) overlaps "Measurement Period" + sort by start of authoredOn.toInterval()) + + /* *Initial Population */ @@ -94,7 +106,9 @@ define "Initial Population": */ define "Numerator": - true + HIE."HIV-positive B.DE116" + and HIE."On ART H.DE47" + and (duration in months of Common.MedicationRequestPeriod("Last ART prescribed before end of measurement period") >= 3 months) /** @@ -105,8 +119,30 @@ define "Numerator": */ define "Denominator": - true + HIE."HIV-positive B.DE116" + and HIE."On ART H.DE47" /* end Populations */ +/* + * Disaggregators + */ + +define "Administrative Gender Stratifier": + HIC."By Administrative Gender Stratifier" + +define "Age Stratifier": + HIC."By Age Stratifier" + +define "Geographic Region Stratifier": + HIC."By Geographic Region Stratifier" + +define "patientGroups Stratifier": + HIC."patientGroups" + +define "Stratification": + HIC."By Administrative Gender Stratifier".code + + ':' + HIC."By Age Stratifier" ++ ':' + HIC."By Geographic Region Stratifier" ++ Combine(HIC.patientGroups, ':') \ No newline at end of file diff --git a/input/cql/HIVIND54Logic.cql b/input/cql/HIVIND54Logic.cql index d3592196034..cc36736af91 100644 --- a/input/cql/HIVIND54Logic.cql +++ b/input/cql/HIVIND54Logic.cql @@ -84,6 +84,8 @@ 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 // Indicator Definition parameter "Measurement Period" Interval default Interval[@2023-01-01, @2023-01-30] @@ -106,7 +108,9 @@ define "Initial Population": */ define "Numerator": - true + HIE."HIV-positive B.DE116" + and HIE."On ART H.DE47" + and HIE."DSD ART start date" /** @@ -117,7 +121,10 @@ define "Numerator": */ define "Denominator": - true +HIE."HIV-positive B.DE116" + and HIE."On ART H.DE47" + and HIE."Date DSD ART eligibility assessed" + and HIE."Eligible for DSD ART" /* end Populations */ diff --git a/input/cql/HIVIND55Logic.cql b/input/cql/HIVIND55Logic.cql index cab322ac98d..d3a884ba249 100644 --- a/input/cql/HIVIND55Logic.cql +++ b/input/cql/HIVIND55Logic.cql @@ -84,6 +84,8 @@ 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 // Indicator Definition parameter "Measurement Period" Interval default Interval[@2023-01-01, @2023-01-30] @@ -106,7 +108,9 @@ define "Initial Population": */ define "Numerator": - true + HIE."HIV-positive B.DE116" + and HIE."On ART H.DE47" + and HIE."Currently enrolled in DSD ART model" /** @@ -117,7 +121,10 @@ define "Numerator": */ define "Denominator": - true + HIE."HIV-positive B.DE116" + and HIE."On ART H.DE47" + and HIE."Date DSD ART eligibility assessed" + and HIE."Eligible for DSD ART" /* end Populations */ diff --git a/input/cql/HIVIndicatorElements.cql b/input/cql/HIVIndicatorElements.cql index fc88a7f970a..8d53be26135 100644 --- a/input/cql/HIVIndicatorElements.cql +++ b/input/cql/HIVIndicatorElements.cql @@ -4311,11 +4311,9 @@ define "Other D.DE739 Observation": @activity: HIV.D21 Determine regimen and treatment options @description: Client is eligible for differentiated service delivery (DSD) for ART */ -// TODO: Replace placeholder with relevant CQL logic + define "Eligible for DSD ART": - exists "Eligible for DSD ART Observation" -define "Eligible for DSD ART Observation": - Elements."Eligible for DSD ART Observation" O + exists Elements."Eligible for DSD ART" O where O.effective.toInterval() during "Measurement Period" /* End of Eligible for DSD ART */ @@ -4324,13 +4322,10 @@ define "Eligible for DSD ART Observation": @activity: HIV.D21 Determine regimen and treatment options @description: Date client was assessed for eligibility for differentiated service delivery (DSD) for ART */ -// TODO: Replace placeholder with relevant CQL logic + define "Date DSD ART eligibility assessed": - Elements."Date DSD ART eligibility assessed" O - where O.effective.toInterval() during "Measurement Period" -define "Date DSD ART eligibility assessed Value": - "Date DSD ART eligibility assessed" O - return O.value + exists(Elements."Date DSD ART eligibility assessed" P where P during "Measurement Period") + /* End of Date DSD ART eligibility assessed */ /* @@ -4338,12 +4333,22 @@ define "Date DSD ART eligibility assessed Value": @activity: HIV.D21 Determine regimen and treatment options @description: Client currently enrolled in differentiated service delivery (DSD) ART model */ -// TODO: Replace placeholder with relevant CQL logic + define "Currently enrolled in DSD ART model": - exists "Currently enrolled in DSD ART model Observation" -define "Currently enrolled in DSD ART model Observation": - Elements."Currently enrolled in DSD ART model Observation" O - where O.effective.toInterval() during "Measurement Period" + exists( + [EpisodeOfCare] EOC + where exists(EOC.type T where T ~ Concepts."Currently enrolled in DSD ART model") + and (exists ( + EOC.statusHistory H + where H.period starts after start of "Measurement Period" + and H.period starts before end of "Measurement Period" + ) + or ( + EOC.period starts after start of "Measurement Period" + and EOC.period starts before end of "Measurement Period" + ) + ) + ) /* End of Currently enrolled in DSD ART model */ /* @@ -4351,13 +4356,9 @@ define "Currently enrolled in DSD ART model Observation": @activity: HIV.D21 Determine regimen and treatment options @description: Date client started on differentiated service delivery (DSD) for ART */ -// TODO: Replace placeholder with relevant CQL logic + define "DSD ART start date": - Elements."DSD ART start date" O - where O.effective.toInterval() during "Measurement Period" -define "DSD ART start date Value": - "DSD ART start date" O - return O.value + exists(Elements."DSD ART start date" t where t starts during "Measurement Period") /* End of DSD ART start date */ /*