Skip to content

Commit

Permalink
logic 29-32
Browse files Browse the repository at this point in the history
  • Loading branch information
Pprado23 committed Jul 31, 2024
1 parent c38a829 commit 5125145
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 48 deletions.
21 changes: 7 additions & 14 deletions input/cql/HIVElements.cql
Original file line number Diff line number Diff line change
Expand Up @@ -6547,13 +6547,9 @@ define "WHO HIV clinical stage 4 Observation":
@activity: HIV.D10 Counsel returning client
@description: The date on which the client received results from viral load test
*/
// TODO: Replace placeholder with relevant CQL logic

define "Date viral load test results received by client D.DE193":
[Observation: Concepts."Date viral load test results received by client - HIV.D.DE193"] O
where O.status in { 'final', 'amended', 'corrected' }
define "Date viral load test results received by client D.DE193 Value":
"Date viral load test results received by client D.DE193" O
return O.value
"Viral load test result D.DE387"
/* End of Date viral load test results received by client D.DE193 */

/*
Expand Down Expand Up @@ -8071,7 +8067,7 @@ define "Within 90 days of HIV diagnosis Observation":
@activity: HIV.D20 Diagnostics
@description: Result from the viral load test in number of copies/mL
*/
// TODO: Replace placeholder with relevant CQL logic

define "Viral load test result D.DE387":
[Observation: Concepts."Viral load test result - HIV.D.DE387"] O
where O.status in { 'final', 'amended', 'corrected' }
Expand Down Expand Up @@ -14772,7 +14768,7 @@ define "HIV test result SRV.DE2 Observation":
@activity: HIV.D20 Diagnostics
@description: CD4 count performed at HIV diagnosis
*/
// TODO: Replace placeholder with relevant CQL logic

define "Baseline CD4 count SRV.DE3":
[Observation: Concepts."Baseline CD4 count - HIV.SRV.DE3"] O
where O.status in { 'final', 'amended', 'corrected' }
Expand All @@ -14786,13 +14782,10 @@ define "Baseline CD4 count SRV.DE3 Value":
@activity: HIV.D20 Diagnostics
@description: Date and time when baseline CD4 count test was conducted
*/
// TODO: Replace placeholder with relevant CQL logic

define "Date of baseline CD4 count test SRV.DE4":
[Observation: Concepts."Date of baseline CD4 count test - HIV.SRV.DE4"] O
where O.status in { 'final', 'amended', 'corrected' }
define "Date of baseline CD4 count test SRV.DE4 Value":
"Date of baseline CD4 count test SRV.DE4" O
return O.value
"Baseline CD4 count SRV.DE3" O
return O.effective.toInterval()
/* End of Date of baseline CD4 count test SRV.DE4 */

/*
Expand Down
41 changes: 39 additions & 2 deletions input/cql/HIVIND29Logic.cql
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,13 @@ define "Numerator":
and HIE."On ART H.DE47"
and
(months between (end of "Measurement Period") and (date from start of HIC."First On ART".effective.toInterval()) > 6 months)
and exists(HIC."viral load sample collection" P where P.performed.toInterval() during "Measurement Period")
and
exists(
HIE."Viral load test result D.DE387" VL
with HIC."viral load sample collection" P
such that VL.partOf.references(P) and P.performed.toInterval() during "Measurement Period"
where VL.value < 1000 'copies/ml'
)


/**
Expand All @@ -126,8 +132,39 @@ define "Numerator":
*/

define "Denominator":
true
HIE."HIV-positive B.DE116"
and HIE."On ART H.DE47"
and
(months between (end of "Measurement Period") and (date from start of HIC."First On ART".effective.toInterval()) > 6 months)
and
exists(
HIE."Viral load test result D.DE387" VL
with HIC."viral load sample collection" P
such that VL.partOf.references(P) and P.performed.toInterval() during "Measurement Period"
)


/* 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, ':')
17 changes: 7 additions & 10 deletions input/cql/HIVIND30Logic.cql
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,16 @@ 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<Date> default Interval[@2023-01-01, @2023-01-30]

context Patient
define "Measure Population":
(exists(HIC."HIV Positive Condition" C
where C.onset before end of "Measurement Period")
or
exists(HIC."HIV Positive Observation" O
where (O.issued before end of "Measurement Period")
)) and
exists(HE."On ART H.DE47" H
where H.effective starts during "Measurement Period")

define "Measure Population":
HIE."HIV-positive B.DE116"
and (date from start of HIC."First On ART".effective.toInterval() during "Measurement Period")

/*
* As defined by Member States
Expand Down Expand Up @@ -124,4 +120,5 @@ define "patientGroups Stratifier":
define "Stratification":
HIC."By Administrative Gender Stratifier".code
+ ':' + HIC."By Age Stratifier"
+ ':' + HIC."By Geographic Region Stratifier"
+ ':' + HIC."By Geographic Region Stratifier"
+ Combine(HIC.patientGroups, ':')
36 changes: 33 additions & 3 deletions input/cql/HIVIND31Logic.cql
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ using FHIR version '4.0.1'

include HIVCommon version '0.0.1' called HIC
include FHIRHelpers version '4.0.1'
include FHIRCommon called FC
include WHOCommon called WCom
include HIVElements called HE
include HIVIndicatorElements called HIE

// Indicator Definition
parameter "Measurement Period" Interval<Date> default Interval[@2023-01-01, @2023-01-30]
Expand All @@ -102,7 +103,11 @@ define "Initial Population":
*/

define "Numerator":
true
HIE."HIV-positive B.DE116"
and (date from start of HIC."First On ART".effective.toInterval() during "Measurement Period")
and exists(HE."Baseline CD4 count SRV.DE3" O
where O.effective.toInterval() during "Measurement Period"
and O.value < 200 'cells/mm^3')


/**
Expand All @@ -113,8 +118,33 @@ define "Numerator":
*/

define "Denominator":
true
HIE."HIV-positive B.DE116"
and (date from start of HIC."First On ART".effective.toInterval() during "Measurement Period")
and exists(HE."Baseline CD4 count SRV.DE3" O
where O.effective.toInterval() during "Measurement Period")


/* 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, ':')
28 changes: 23 additions & 5 deletions input/cql/HIVIND32Logic.cql
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ using FHIR version '4.0.1'

include HIVCommon version '0.0.1' called HIC
include FHIRHelpers version '4.0.1'
include FHIRCommon called FC
include WHOCommon called WCom
include HIVElements called HE
include HIVIndicatorElements called HIE

// Indicator Definition
parameter "Measurement Period" Interval<Date> default Interval[@2023-01-01, @2023-01-30]
Expand All @@ -107,7 +108,17 @@ define "Initial Population":
*/

define "Numerator":
true
HIE."HIV-positive B.DE116"
and HIE."On ART H.DE47"
and
(months between (end of "Measurement Period") and (date from start of HIC."First On ART".effective.toInterval()) > 6 months)
and
exists(
HE."Date viral load test results received by client D.DE193" VL
with HIC."viral load sample collection" P
such that VL.partOf.references(P)
where VL.issued.toInterval() during "Measurement Period"
)

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

define "Numerator Exclusions":
false
HIE."Death documented"
and HIE."Transferred out"
and HIE."Lost to follow-up"

/**
* Denominator
Expand All @@ -126,7 +139,10 @@ define "Numerator Exclusions":
*/

define "Denominator":
true
HIE."HIV-positive B.DE116"
and HIE."On ART H.DE47"
and
(months between (end of "Measurement Period") and (date from start of HIC."First On ART".effective.toInterval()) > 6 months)

/**
* Denominator Exclusions
Expand All @@ -135,7 +151,9 @@ define "Denominator":
*/

define "Denominator Exclusions":
false
HIE."Death documented"
and HIE."Transferred out"
and HIE."Lost to follow-up"

/* end Populations */

22 changes: 8 additions & 14 deletions input/cql/HIVIndicatorElements.cql
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ library HIVIndicatorElements

using FHIR version '4.0.1'

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

include WHOConcepts
Expand Down Expand Up @@ -2927,13 +2927,11 @@ define "Currently on TDF-based ART Observation":
@activity: HIV.D10 Counsel returning client
@description: The date on which the client received results from viral load test
*/
// TODO: Replace placeholder with relevant CQL logic

define "Date viral load test results received by client D.DE193":
Elements."Date viral load test results received by client D.DE193" O
where O.effective.toInterval() during "Measurement Period"
define "Date viral load test results received by client D.DE193 Value":
"Date viral load test results received by client D.DE193" O
return O.value
where O.issued.toInterval() during "Measurement Period"

/* End of Date viral load test results received by client D.DE193 */

/*
Expand Down Expand Up @@ -3199,7 +3197,7 @@ define "Within 90 days of HIV diagnosis Observation":
@activity: HIV.D20 Diagnostics
@description: Result from the viral load test in number of copies/mL
*/
// TODO: Replace placeholder with relevant CQL logic

define "Viral load test result D.DE387":
Elements."Viral load test result D.DE387" O
where O.effective.toInterval() during "Measurement Period"
Expand Down Expand Up @@ -6928,7 +6926,7 @@ define "HIV test result SRV.DE2 Observation":
@activity: HIV.D20 Diagnostics
@description: CD4 count performed at HIV diagnosis
*/
// TODO: Replace placeholder with relevant CQL logic

define "Baseline CD4 count SRV.DE3":
Elements."Baseline CD4 count SRV.DE3" O
where O.effective.toInterval() during "Measurement Period"
Expand All @@ -6942,13 +6940,9 @@ define "Baseline CD4 count SRV.DE3 Value":
@activity: HIV.D20 Diagnostics
@description: Date and time when baseline CD4 count test was conducted
*/
// TODO: Replace placeholder with relevant CQL logic

define "Date of baseline CD4 count test SRV.DE4":
Elements."Date of baseline CD4 count test SRV.DE4" O
where O.effective.toInterval() during "Measurement Period"
define "Date of baseline CD4 count test SRV.DE4 Value":
"Date of baseline CD4 count test SRV.DE4" O
return O.value
exists(Elements."Date of baseline CD4 count test SRV.DE4" O where O starts during "Measurement Period")
/* End of Date of baseline CD4 count test SRV.DE4 */

/*
Expand Down

0 comments on commit 5125145

Please sign in to comment.