PATH MER Indicators
0.1.0 - STU1
PATH MER Indicators, published by PATH. This is not an authorized publication; it is the continuous build for version 0.1.0). This version is based on the current content of https://github.com/PATH-Global-Health/MERindicators and changes regularly. See the Directory of published versions
Official URL: https://path-global-health.github.io/MERindicators/Library/DAKDataElements | Version: 0.1.0 | |||
Draft as of 2023-10-19 | Computable Name: DAKDataElements |
DAKDataElements
depends-on | http://hl7.org/fhir/Library/FHIR-ModelInfo|4.0.1 |
depends-on | http://hl7.org/fhir/Library/FHIRHelpers|4.0.1 |
depends-on | FHIRCommon (version 4.0.1) |
depends-on | DAKConcepts |
Measurement Period | in | 0 | 1 | Period |
Patient | out | 0 | 1 | Patient |
debug name | out | 0 | 1 | string |
Deceased | out | 0 | 1 | boolean |
HIV Condition | out | 0 | * | Condition |
Is HIV Positive | out | 0 | 1 | boolean |
Is HIV Negative | out | 0 | 1 | boolean |
PLHIV | out | 0 | 1 | boolean |
Pregnant | out | 0 | 1 | boolean |
ART Therapy Observation | out | 0 | * | Observation |
ART Therapy Condition | out | 0 | * | Condition |
ART Therapy Medication | out | 0 | * | MedicationRequest |
ART Dates | out | 0 | * | dateTime |
Date of Last Evidence of ART | out | 0 | 1 | dateTime |
Date of First Evidence of ART | out | 0 | 1 | dateTime |
HIV Transfer Observation | out | 0 | * | Observation |
Date of Last HIV Transfer | out | 0 | 1 | dateTime |
Dispensed Observations | out | 0 | * | Observation |
Most Recent Dispensed Observation | out | 0 | 1 | Observation |
Most Recent Dispensed Observation Date | out | 0 | 1 | dateTime |
Most Recent Dispensed Observation Days | out | 0 | 1 | integer |
Dispensed in Days | out | 0 | 1 | Quantity |
Most Recent Dispensed Observation Finish Date | out | 0 | 1 | dateTime |
On ART | out | 0 | 1 | boolean |
Stopped ART Observation | out | 0 | * | Observation |
Date of Last Stopped ART | out | 0 | 1 | dateTime |
Stopped ART | out | 0 | 1 | boolean |
Newly enrolled on antiretroviral therapy (ART) during measurement period | out | 0 | 1 | boolean |
Requested ARTs | out | 0 | * | MedicationRequest |
Most Recent Requested ART | out | 0 | 1 | MedicationRequest |
Most Recent Requested ART Date | out | 0 | 1 | dateTime |
Patient with IIT | out | 0 | 1 | boolean |
text/cql
library DAKDataElements version '0.1.0'
using FHIR version '4.0.1'
include FHIRHelpers version '4.0.1'
include FHIRCommon version '4.0.1' called FC
include DAKConcepts called Cx
// include DAKStratifiers called Strat
// parameter "Measurement Period" Interval<DateTime>
parameter "Measurement Period" Interval<DateTime> default Interval[@2022-01-01T, @2022-12-31T]
context Patient
define "debug name":
First(Patient.name.text.value)
define "Deceased":
Patient.deceased is not null
and (Patient.deceased is true or Patient.deceased before end of "Measurement Period")
// and Patient.deceased.value.not()
// and Patient.deceased.not()
// // alternatively
// where P.deceased is false
// or P.deceased before Today()
define "HIV Condition":
[Condition] C
where C.code in Cx."DAK PLHIV"
and C.clinicalStatus in FC."Active Condition"
and C.verificationStatus ~ FC."confirmed"
define "Is HIV Positive":
exists( "HIV Condition" )
define "Is HIV Negative":
not exists( "HIV Condition" )
define "PLHIV":
"Is HIV Positive"
define "Pregnant":
exists ["Condition": Cx."Pregnancy (finding)"]
// Rest of HIVIndicators
// to review
// ART Therapy Observation=[]
// ART Therapy Condition=[]
define "ART Therapy Observation":
[Observation] O
where O.code in Cx."DAK On ART"
and O.status = 'final'
define "ART Therapy Condition":
[Condition] C
where C.code in Cx."DAK On ART"
and C.clinicalStatus in FC."Active Condition"
and C.verificationStatus ~ FC."confirmed"
define "ART Therapy Medication":
["MedicationRequest"] M
where M.status = 'active'
and M.medication in Cx."DAK ART Medications"
define "ART Dates":
("ART Therapy Observation" O return O.effective as dateTime)
union ("ART Therapy Condition" C return C.onset as dateTime)
union ("ART Therapy Medication" M return M.authoredOn)
// union ("ART Therapy Medication" M return M)
define "Date of Last Evidence of ART":
Max("ART Dates")
define "Date of First Evidence of ART":
Min("ART Dates")
define "On ART":
(
( exists ("ART Dates" D where D during "Measurement Period")
or exists (
"ART Therapy Condition" C
where Interval[FHIRHelpers.ToDateTime(C.onset as FHIR.dateTime), FHIRHelpers.ToDateTime(C.abatement as FHIR.dateTime)] overlaps "Measurement Period"
)
)
)
or
( if exists( "HIV Transfer Observation" )
then "Date of Last HIV Transfer" during "Measurement Period"
else false
)
or
(
"Most Recent Dispensed Observation Finish Date" after "Measurement Period"
)
define "Stopped ART":
if exists( "Stopped ART Observation" )
then "Date of Last Stopped ART" after
Max( { "Date of Last Evidence of ART", "Date of Last HIV Transfer", "Most Recent Dispensed Observation Finish Date" } )
else false
define "Dispensed Observations":
[Observation] O
where O.code in Cx."DAK MMD"
and O.status = 'final'
sort by date from (effective as FHIR.dateTime) desc
define "Most Recent Dispensed Observation":
First( "Dispensed Observations")
define "Most Recent Dispensed Observation Days":
("Most Recent Dispensed Observation".value as integer)
define "Dispensed in Days":
ToQuantity(ToString("Most Recent Dispensed Observation Days") + ' days')
define "Most Recent Dispensed Observation Date":
("Most Recent Dispensed Observation".effective as dateTime)
define "Most Recent Dispensed Observation Finish Date":
"Most Recent Dispensed Observation Date" + "Dispensed in Days"
define "Stopped ART Observation":
[Observation] O
where O.code in Cx."DAK ART Stopped"
and O.status = 'final'
define "HIV Transfer Observation":
[Observation] O
where O.code in Cx."DAK HIV Transferred"
and O.status = 'final'
define "Date of Last Stopped ART":
Max("Stopped ART Observation" O return O.effective as dateTime)
define "Date of Last HIV Transfer":
Max("HIV Transfer Observation" O return O.effective as dateTime)
define "Newly enrolled on antiretroviral therapy (ART) during measurement period":
"Date of First Evidence of ART" during "Measurement Period"
define "Requested ARTs":
"ART Therapy Medication" M
sort by date from (authoredOn as FHIR.dateTime) desc
define "Most Recent Requested ART":
First( "Requested ARTs" )
define "Most Recent Requested ART Date":
"Most Recent Requested ART".authoredOn as dateTime
define "Patient with IIT":
"Most Recent Requested ART Date" after now() + 28 days
/*
define "Is Pregnant":
exists ([Condition: Cx."Pregnancy status - Reported"] C
where C.verificationStatus ~ FC."confirmed"
and C.clinicalStatus ~ FC."active"
and C.onset during "Measurement Period"
)
define "Newly enrolled on antiretroviral therapy (ART) during measurement period (pregnant and breastfeeding)":
// "Is Pregnant" and "Is Breastfeeding" and "Date of First Evidence of ART" during "Measurement Period"
"Is Pregnant" and "Date of First Evidence of ART" during "Measurement Period"
define "Receiving antiretroviral therapy (ART) during measurement period":
exists ("ART Dates" D where D during "Measurement Period")
or exists (
"ART Therapy Condition" C
where Interval[C.onset, C.abatement] overlaps "Measurement Period"
)
define "Year Preceding the Measurement Period":
Interval[start of "Measurement Period" - 1 year, start of "Measurement Period")
define "Month Before the Year Preceding the Measurement Period":
Interval[start of "Year Preceding the Measurement Period" - 1 month, start of "Year Preceding the Measurement Period")
define "Receiving antiretroviral therapy (ART) at 12 months after initiating":
"Date of First Evidence of ART" during "Month Before the Year Preceding the Measurement Period"
and "Receiving antiretroviral therapy (ART) during measurement period"
define "Receiving antiretroviral therapy (ART) at 12 months after initiating (pregnant and breastfeeding)":
"Receiving antiretroviral therapy (ART) at 12 months after initiating"
and "Is Pregnant"
// and "Is Breastfeeding"
define "Initiated antiretroviral therapy (ART) in the 12 months prior to measurement period":
"Date of First Evidence of ART" during "Year Preceding the Measurement Period"
define "Pregnant and receiving antiretroviral therapy (ART) to reduce the risk of mother-to-child-transmission during pregnancy":
"Is Pregnant"
and "Receiving antiretroviral therapy (ART) during measurement period"
*/
Content not shown - (
application/elm+xml
, size = 122Kb)
Content not shown - (
application/elm+json
, size = 221Kb)