Skip to content

Commit

Permalink
Indicators 46-61 (#51)
Browse files Browse the repository at this point in the history
* indicators 46-61

* 62-63

* ind 63

---------

Co-authored-by: Patric Prado <pprado@caa.columbia.edu>
  • Loading branch information
pmanko and Pprado23 authored Aug 18, 2024
1 parent 8f38792 commit 3bc797a
Show file tree
Hide file tree
Showing 22 changed files with 514 additions and 217 deletions.
6 changes: 5 additions & 1 deletion input/cql/HIVConceptsCustom.cql
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ 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"
code "DSD ART eligibility assessed" : 'DSD ART eligibility assessed' from "missing concepts"
code "syphilis test" : 'syphilis test' from "missing concepts"


valueset "Antenatal care contact": 'http://fhir.org/guides/who/anc-cds/ValueSet/antenatal-care-contact'
3 changes: 3 additions & 0 deletions input/cql/HIVConfig.cql
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ define "Intervention Interval":

define "LTFU Days":
28 days

define "DSD Retention Interval":
12 months
131 changes: 72 additions & 59 deletions input/cql/HIVElements.cql
Original file line number Diff line number Diff line change
Expand Up @@ -2741,24 +2741,20 @@ define "Any STI syndrome diagnosed B.DE235 Observation":
@activity: HIV.B23 Offer sexual and reproductive health services
@description: Date of syphilis test
*/
// TODO: Replace placeholder with relevant CQL logic

define "Syphilis test date B.DE249":
[Observation: Concepts."Syphilis test date - HIV.B.DE249"] O
where O.status in { 'final', 'amended', 'corrected' }
define "Syphilis test date B.DE249 Value":
"Syphilis test date B.DE249" O
return O.value
[Procedure] P
where P.status = 'completed'
and P.code ~ ConceptsCustom."syphilis test"
/* End of Syphilis test date B.DE249 */

/*
@dataElement: HIV.B.DE250 - Syphilis test result
@activity: HIV.B23 Offer sexual and reproductive health services
@description: Result from syphilis test
*/
// TODO: Replace placeholder with relevant CQL logic

define "Syphilis test result B.DE250":
exists "Syphilis test result B.DE250 Observation"
define "Syphilis test result B.DE250 Observation":
[Observation: Concepts."Syphilis test result - HIV.B.DE250"] O
where O.status in { 'final', 'amended', 'corrected' }
/* End of Syphilis test result B.DE250 */
Expand All @@ -2768,14 +2764,9 @@ define "Syphilis test result B.DE250 Observation":
@activity: HIV.B23 Offer sexual and reproductive health services
@description: Test result is positive for syphilis
*/
// TODO: Replace placeholder with relevant CQL logic

define "Positive B.DE251":
exists "Positive B.DE251 Condition"
or exists "Positive B.DE251 Observation"
define "Positive B.DE251 Condition":
[Condition: Concepts."Positive - HIV.B.DE251"]
define "Positive B.DE251 Observation":
"Syphilis test result B.DE250 Observation" O
"Syphilis test result B.DE250" O
where O.status in { 'final', 'amended', 'corrected' }
and O.value ~ Concepts."Positive - HIV.B.DE251"
/* End of Positive B.DE251 */
Expand All @@ -2785,14 +2776,9 @@ define "Positive B.DE251 Observation":
@activity: HIV.B23 Offer sexual and reproductive health services
@description: Test result is negative for syphilis
*/
// TODO: Replace placeholder with relevant CQL logic

define "Negative B.DE252":
exists "Negative B.DE252 Condition"
or exists "Negative B.DE252 Observation"
define "Negative B.DE252 Condition":
[Condition: Concepts."Negative - HIV.B.DE252"]
define "Negative B.DE252 Observation":
"Syphilis test result B.DE250 Observation" O
"Syphilis test result B.DE250" O
where O.status in { 'final', 'amended', 'corrected' }
and O.value ~ Concepts."Negative - HIV.B.DE252"
/* End of Negative B.DE252 */
Expand All @@ -2802,14 +2788,9 @@ define "Negative B.DE252 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.DE253":
exists "Inconclusive B.DE253 Condition"
or exists "Inconclusive B.DE253 Observation"
define "Inconclusive B.DE253 Condition":
[Condition: Concepts."Inconclusive - HIV.B.DE253"]
define "Inconclusive B.DE253 Observation":
"Syphilis test result B.DE250 Observation" O
"Syphilis test result B.DE250" O
where O.status in { 'final', 'amended', 'corrected' }
and O.value ~ Concepts."Inconclusive - HIV.B.DE253"
/* End of Inconclusive B.DE253 */
Expand Down Expand Up @@ -10273,7 +10254,7 @@ define "Eligible for DSD ART":
*/

define "Date DSD ART eligibility assessed":
[Procedure: CustomConcepts."DSD ART eligibility assessed"] P
[Procedure: ConceptsCustom."DSD ART eligibility assessed"] P
where P.status in { 'completed' }
return P.performed.toInterval()
/* End of Date DSD ART eligibility assessed */
Expand Down Expand Up @@ -12219,7 +12200,7 @@ define "TB diagnostic test date":

define "TB treatment start date":
[MedicationStatement] MS
where exists(MS.reasonCode C where C ~ CustomConcepts."tb treatment")
where exists(MS.reasonCode C where C ~ ConceptsCustom."tb treatment")
return (start of MS.effective.toInterval())
/* End of TB treatment start date */

Expand Down Expand Up @@ -12512,13 +12493,13 @@ define "Other E.DE70":
@activity: HIV.E1 Capture or update mother's history
@description: The date and time of the client's ANC contact (in the ANC DAK this is called 'Contact date')
*/
// TODO: Replace placeholder with relevant CQL logic

define "Antenatal care contact":
["Encounter": type in ConceptsCustom."Antenatal care contact"]

define "ANC contact date E.DE85":
[Observation: Concepts."ANC contact date - HIV.E.DE85"] O
where O.status in { 'final', 'amended', 'corrected' }
define "ANC contact date E.DE85 Value":
"ANC contact date E.DE85" O
return O.value
"Antenatal care contact" E
return E.period.toInterval()
/* End of ANC contact date E.DE85 */

/*
Expand Down Expand Up @@ -14405,12 +14386,9 @@ define "At elevated risk for HIV acquisition PRV.DE1":
@activity: HIV.B6 Capture or update client history
@description: HIV prevention intervention that client accessed
*/
// TODO: Replace placeholder with relevant CQL logic

define "HIV prevention intervention":
exists "HIV prevention intervention Observation"
define "HIV prevention intervention Observation":
[Observation: Concepts."HIV prevention intervention"] O
where O.status in { 'final', 'amended', 'corrected' }
exists ("PrEP service") or exists("OAMT") or exists("NSP") or exists("STI services") or exists("VMMC") or exists("Other PRV.DE8")
/* End of HIV prevention intervention */

/*
Expand All @@ -14423,6 +14401,11 @@ define "PrEP service":
[MedicationStatement] MS
where exists(MS.reasonCode C where C ~ Concepts."PrEP for HIV prevention")
sort by start of effective.toInterval()

define "PrEP service date":
[MedicationStatement] MS
where exists(MS.reasonCode C where C ~ Concepts."PrEP for HIV prevention")
return start of MS.effective.toInterval()
/* End of PrEP service */

/*
Expand All @@ -14446,8 +14429,19 @@ define "OAMT statusHistory":
EOC.statusHistory H
where H.period is not null))

define "OAMT status date":
[EpisodeOfCare] EOC
where exists(EOC.type T where T ~ Concepts."OAMT")
return start of EOC.period


define "OAMT statusHistory date":
[EpisodeOfCare] EOC
where exists(EOC.type T where T ~ Concepts."OAMT")
and (exists (
EOC.statusHistory H
where H.period is not null))
//return start of "OAMT statusHistory".statusHistory.period
//need to ask brynn

/* End of OAMT */

Expand All @@ -14463,6 +14457,14 @@ define "NSP":
such that DUS.reasonReference.references(D)
and D.status in { 'active' }
where DUS.status = 'completed'

define "NSP date":
[DeviceUseStatement] DUS
with [Device: ConceptsCustom."needle-syringe"] D
such that DUS.reasonReference.references(D)
and D.status in { 'active' }
where DUS.status = 'completed'
return start of DUS.timing.toInterval()
/* End of NSP */

/*
Expand All @@ -14475,6 +14477,12 @@ define "STI services":
[Procedure] P
where P.status = 'completed'
and P.code ~ Concepts."STI testing and treatment services"

define "STI services date":
[Procedure] P
where P.status = 'completed'
and P.code ~ Concepts."STI testing and treatment services"
return start of P.performed.toInterval()
/* End of STI services */

/*
Expand All @@ -14492,6 +14500,12 @@ define "VMMC":
[Procedure] P
where P.status = 'completed'
and P.code ~ Concepts."Voluntary medical male circumcision VMMC"

define "VMMC date":
[Procedure] P
where P.status = 'completed'
and P.code ~ Concepts."Voluntary medical male circumcision VMMC"
return start of P.performed.toInterval()
/* End of VMMC */

/*
Expand All @@ -14506,6 +14520,13 @@ define "Other PRV.DE8":
and O.code ~ Concepts."HIV prevention intervention"
and O.value ~ Concepts."Other - HIV.PRV.DE8"
sort by start of effective.toInterval()

define "Other PRV.DE8 date":
[Observation] O
where O.status in {'final', 'amended'}
and O.code ~ Concepts."HIV prevention intervention"
and O.value ~ Concepts."Other - HIV.PRV.DE8"
return start of O.effective.toInterval()

/* End of Other PRV.DE8 */

Expand All @@ -14514,13 +14535,11 @@ define "Other PRV.DE8":
@activity: HIV.B6 Capture or update client history
@description: Date the client accessed HIV prevention intervention
*/
// TODO: Replace placeholder with relevant CQL logic
define "Date accessed HIV prevention intervention":
[Observation: Concepts."Date accessed HIV prevention intervention"] O
where O.status in { 'final', 'amended', 'corrected' }
define "Date accessed HIV prevention intervention Value":
"Date accessed HIV prevention intervention" O
return O.value

define "Date accessed HIV prevention intervention":
flatten{"PrEP service date", "NSP date", "STI services date", "VMMC date", "Other PRV.DE8 date","OAMT status date"}

//, "OAMT","NSP".timing,"STI services".performed,"VMMC".performed,"Other PRV.DE8".effective}
/* End of Date accessed HIV prevention intervention */

/*
Expand Down Expand Up @@ -14825,13 +14844,9 @@ define "Viral load test result SRV.DE13 Value":
@activity: HIV.A2 Gather client details
@description: The date and time of the client's visit
*/
// TODO: Replace placeholder with relevant CQL logic

define "Visit date SRV.DE15":
[Observation: Concepts."Visit date - HIV.SRV.DE15"] O
where O.status in { 'final', 'amended', 'corrected' }
define "Visit date SRV.DE15 Value":
"Visit date SRV.DE15" O
return O.value
[Encounter] E
/* End of Visit date SRV.DE15 */

/*
Expand Down Expand Up @@ -15023,5 +15038,3 @@ define "Reporting date Value":
* Custom elements and logic for use DT and IND CQL Libraries
*/

define "First On ART":
(First("On ART D.DE38"))
20 changes: 10 additions & 10 deletions input/cql/HIVIND46Logic.cql
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ define "Initial Population":


define "Numerator":
HIE."HIV-positive B.DE116"
HIE."Has HIV-positive Status"
and
//I related the two because otherwise a positive observation could come from another test type and be counted.
exists(
Expand All @@ -130,7 +130,7 @@ define "Numerator":
*/

define "Denominator":
HIE."HIV-positive B.DE116"
HIE."Has HIV-positive Status"
and
exists(
HE."TB diagnostic test category" P
Expand All @@ -147,21 +147,21 @@ define "Denominator":
*/

define "Administrative Gender Stratifier":
HIC."By Administrative Gender Stratifier"
HIE."By Administrative Gender Stratifier"

define "Age Stratifier":
HIC."By Age Stratifier"
HIE."By Age Stratifier"

define "Geographic Region Stratifier":
HIC."By Geographic Region Stratifier"
HIE."By Geographic Region Stratifier"

define "patientGroups Stratifier":
HIC."patientGroups"
HIE."patientGroups"

define "Stratification":
HIC."By Administrative Gender Stratifier".code
+ ':' + HIC."By Age Stratifier"
+ ':' + HIC."By Geographic Region Stratifier"
+ Combine(HIC.patientGroups, ':')
HIE."By Administrative Gender Stratifier".code
+ ':' + HIE."By Age Stratifier"
+ ':' + HIE."By Geographic Region Stratifier"
+ Combine(HIE.patientGroups, ':')

//add Pregnant or breastfeeding women
22 changes: 11 additions & 11 deletions input/cql/HIVIND47Logic.cql
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ define "Initial Population":
*/

define "Numerator":
HIE."HIV-positive B.DE116"
HIE."Has HIV-positive Status"
and (start of HE."First On ART".effective.toInterval() during "Measurement Period")
and HIE."Date of TB diagnosis"

Expand All @@ -116,7 +116,7 @@ define "Numerator":
*/

define "Denominator":
HIE."HIV-positive B.DE116"
HIE."Has HIV-positive Status"
and (start of HE."First On ART".effective.toInterval() during "Measurement Period")


Expand All @@ -127,21 +127,21 @@ define "Denominator":
*/

define "Administrative Gender Stratifier":
HIC."By Administrative Gender Stratifier"
HIE."By Administrative Gender Stratifier"

define "Age Stratifier":
HIC."By Age Stratifier"
HIE."By Age Stratifier"

define "Geographic Region Stratifier":
HIC."By Geographic Region Stratifier"
HIE."By Geographic Region Stratifier"

define "patientGroups Stratifier":
HIC."patientGroups"
HIE."patientGroups"

//define "Stratification":
// HIC."By Administrative Gender Stratifier".code
// + ':' + HIC."By Age Stratifier"
//+ ':' + HIC."By Geographic Region Stratifier"
//+ Combine(HIC.patientGroups, ':')
define "Stratification":
HIE."By Administrative Gender Stratifier".code
+ ':' + HIE."By Age Stratifier"
+ ':' + HIE."By Geographic Region Stratifier"
+ Combine(HIE.patientGroups, ':')

//add Pregnant or breastfeeding women
Loading

0 comments on commit 3bc797a

Please sign in to comment.