Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integration and cleanup of profiling work #61

Open
wants to merge 15 commits into
base: develop
Choose a base branch
from
5 changes: 3 additions & 2 deletions input/cql/HIVConcepts.cql
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ code "Prevention services offered and referrals - HIV.B.DE149": 'HIV.B.DE149' fr
code "Offer male and female condoms and condom-compatible lubricants - HIV.B.DE150": 'HIV.B.DE150' from "HIVConcepts" display 'Offer male and female condoms and condom-compatible lubricants'
code "Offer pre-exposure prophylaxis PrEP for people at elevated risk for HIV acquisition": 'HIV.B.DE151' from "HIVConcepts" display 'Offer pre-exposure prophylaxis PrEP for people at elevated risk for HIV acquisition'
code "Offer post-exposure prophylaxis PEP following suspected exposure": 'HIV.B.DE152' from "HIVConcepts" display 'Offer post-exposure prophylaxis PEP following suspected exposure'
code "Voluntary medical male circumcision VMMC": 'HIV.B.DE153' from "HIVConcepts" display 'Voluntary medical male circumcision VMMC'
code "Voluntary medical male circumcision VMMC referral": 'HIV.B.DE153' from "HIVConcepts" display 'Voluntary medical male circumcision VMMC referral offered'
code "Harm reduction for people who inject drugs - HIV.B.DE154": 'HIV.B.DE154' from "HIVConcepts" display 'Harm reduction for people who inject drugs'
code "Behavioural interventions to support risk reduction, particularly for people with HIV and members of key populations": 'HIV.B.DE155' from "HIVConcepts" display 'Behavioural interventions to support risk reduction, particularly for people with HIV and members of key populations'
code "HIV testing for partners and biological children - HIV.B.DE156": 'HIV.B.DE156' from "HIVConcepts" display 'HIV testing for partners and biological children'
Expand Down Expand Up @@ -417,6 +417,7 @@ code "Type of follow-up appointment - HIV.B.DE191": 'HIV.B.DE191' from "HIVConce
code "Retesting for HIV - HIV.B.DE192": 'HIV.B.DE192' from "HIVConcepts" display 'Retesting for HIV'
code "Other - HIV.B.DE193": 'HIV.B.DE193' from "HIVConcepts" display 'Other'
code "Date/time of follow-up appointment - HIV.B.DE195": 'HIV.B.DE195' from "HIVConcepts" display 'Date/time of follow-up appointment'
code "VMMC procedure": 'HIV.B.DE197' from "HIVConcepts" display 'VMMC procedure performed'
code "VMMC procedure date": 'HIV.B.DE198' from "HIVConcepts" display 'VMMC procedure date'
code "Adverse event severity": 'HIV.B.DE201' from "HIVConcepts" display 'Adverse event severity'
code "Moderate": 'HIV.B.DE202' from "HIVConcepts" display 'Moderate'
Expand Down Expand Up @@ -560,7 +561,7 @@ code "Follow-up appointment for PrEP": 'HIV.C.DE127' from "HIVConcepts" display
code "Other - HIV.C.DE128": 'HIV.C.DE128' from "HIVConcepts" display 'Other'
code "Prevention services offered and referrals - HIV.C.DE131": 'HIV.C.DE131' from "HIVConcepts" display 'Prevention services offered and referrals'
code "Male and female condoms and condom-compatible lubricants offered": 'HIV.C.DE132' from "HIVConcepts" display 'Male and female condoms and condom-compatible lubricants offered'
code "Voluntary medical male circumcision VMMC referral": 'HIV.C.DE133' from "HIVConcepts" display 'Voluntary medical male circumcision VMMC referral'
code "Voluntary medical male circumcision VMMC referral - HIV.C.DE133": 'HIV.C.DE133' from "HIVConcepts" display 'Voluntary medical male circumcision VMMC referral'
code "Harm reduction for people who inject drugs - HIV.C.DE134": 'HIV.C.DE134' from "HIVConcepts" display 'Harm reduction for people who inject drugs'
code "Behavioural interventions to support risk reduction - HIV.C.DE135": 'HIV.C.DE135' from "HIVConcepts" display 'Behavioural interventions to support risk reduction'
code "Condom type": 'HIV.C.DE138' from "HIVConcepts" display 'Condom type'
Expand Down
84 changes: 38 additions & 46 deletions input/cql/HIVElements.cql
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,10 @@ define "Viral load tests received after ART intitiation":
@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 A.DE3":
[Observation: Concepts."Visit date - HIV.A.DE3"] O
where O.status in { 'final', 'amended', 'corrected' }
define "Visit date A.DE3 Value":
"Visit date A.DE3" O
return O.value
[Encounter] E
where E.type.coding.code contains Concepts."HIV testing services visit".code

/* End of Visit date A.DE3 */

/*
Expand Down Expand Up @@ -289,17 +286,17 @@ define "Other A.DE23 Observation":
@activity: HIV.B1 Determine reason for visit
@description: Encounter for HIV testing services visit
*/
define "HTS Visit Encounter":
define "HTS Visit":
[Encounter] E
where E.type.coding.code contains ConceptsCustom."HTS Visit".code

/*
@dataElement: HIV.B.DE1 - Reason for visit
@activity: HIV.B1 Determine reason for visit
@description: Reason for HIV testing services visit
*/
define "Reason for visit B.DE1":
"HTS Visit Encounter" E
"HTS Visit" E
return E.reasonCode
/* End of Reason for visit B.DE1 */

Expand All @@ -309,7 +306,7 @@ define "Reason for visit B.DE1":
@description: First encounter for screening for human immunodeficiency virus
*/
define "First-time HIV test Encounter":
"HTS Visit Encounter" E
"HTS Visit" E
where E.reasonCode.coding.code contains Concepts."First-time HIV test".code
/* End of First-time HIV test */

Expand All @@ -320,7 +317,7 @@ define "First-time HIV test Encounter":
*/
// TODO: Replace placeholder with relevant CQL logic
define "Retesting for HIV B.DE3 Encounter":
"HTS Visit Encounter" E
"HTS Visit" E
where E.reasonCode.coding.code contains Concepts."Retesting for HIV - HIV.B.DE3".code
/* End of Retesting for HIV B.DE3 */

Expand All @@ -331,7 +328,7 @@ define "Retesting for HIV B.DE3 Encounter":
*/
// TODO: Replace placeholder with relevant CQL logic
define "HIV testing services visit Encounter":
"HTS Visit Encounter" E
"HTS Visit" E
where E.reasonCode.coding.code contains Concepts."HIV testing services visit".code
/* End of HIV testing services visit */

Expand Down Expand Up @@ -1720,11 +1717,11 @@ define "Voluntary medical male circumcision VMMC":
exists "Voluntary medical male circumcision VMMC Condition"
or exists "Voluntary medical male circumcision VMMC Observation"
define "Voluntary medical male circumcision VMMC Condition":
[Condition: Concepts."Voluntary medical male circumcision VMMC"]
[Condition: Concepts."Voluntary medical male circumcision VMMC referral"]
define "Voluntary medical male circumcision VMMC Observation":
"Prevention services offered and referrals B.DE149 Observation" O
where O.status in { 'final', 'amended', 'corrected' }
and O.value ~ Concepts."Voluntary medical male circumcision VMMC"
and O.value ~ Concepts."Voluntary medical male circumcision VMMC referral"
/* End of Voluntary medical male circumcision VMMC */

/*
Expand Down Expand Up @@ -6261,10 +6258,8 @@ define "HBV treatment TDF start date":
*/

define "HCV test date D.DE169":
[Procedure] P
where P.status = 'completed'
and P.code ~ ConceptsCustom."HCV test"

"HCV test result D.DE170" O
return O.effective.toInterval().low
/* End of HCV test date D.DE169 */


Expand Down Expand Up @@ -9511,8 +9506,8 @@ define "Other medications Observation":
*/

define "Date of cervical cancer screening test":
"Cervical cancer primary screening test type" P
sort by start of performed.toInterval()
"Cervical cancer primary screening test" O
return O.effective.toInterval().low
/* End of Date of cervical cancer screening test */

/*
Expand All @@ -9536,10 +9531,12 @@ define "Lifetime screening test number Value":
@description: Type of cervical cancer screening test used in primary screening
*/

define "Cervical cancer primary screening test type":
[Procedure] P
where P.status = 'completed'
and P.category ~ ConceptsCustom."cervical cancer screening test"
define "Cervical cancer primary screening test":
[Observation] O
where O.status in { 'final', 'amended', 'corrected' }
and O.code in Concepts."Cervical cancer primary screening test type Choices"

// and P.category ~ Concepts."Procedure" we could
/* End of Cervical cancer primary screening test type */

/*
Expand All @@ -9549,7 +9546,7 @@ define "Cervical cancer primary screening test type":
*/

define "HPV-DNA":
"Cervical cancer primary screening test type" P
"Cervical cancer primary screening test" P
where P.code ~ Concepts."HPV-DNA"
/* End of HPV-DNA */

Expand All @@ -9560,7 +9557,7 @@ define "HPV-DNA":
*/

define "VIA":
"Cervical cancer primary screening test type" P
"Cervical cancer primary screening test" P
where P.code ~ Concepts."VIA"
/* End of VIA */

Expand All @@ -9571,7 +9568,7 @@ define "VIA":
*/

define "Cervical cytology":
"Cervical cancer primary screening test type" P
"Cervical cancer primary screening test" P
where P.code ~ Concepts."Cervical cytology"
/* End of Cervical cytology */

Expand All @@ -9582,7 +9579,7 @@ define "Cervical cytology":
*/

define "Other D.DE662":
"Cervical cancer primary screening test type" P
"Cervical cancer primary screening test" P
where P.code ~ Concepts."Other - HIV.D.DE662"
/* End of Other D.DE662 */

Expand All @@ -9591,13 +9588,7 @@ define "Other D.DE662":
@activity: HIV.D28 Offer other services
@description: Date of diagnosis of cervical precancer lesions or invasive cervical cancer
*/
// TODO: Replace placeholder with relevant CQL logic
define "Date of diagnosis of cervical precancer lesions or invasive cervical cancer":
[Observation: Concepts."Date of diagnosis of cervical precancer lesions or invasive cervical cancer"] O
where O.status in { 'final', 'amended', 'corrected' }
define "Date of diagnosis of cervical precancer lesions or invasive cervical cancer Value":
"Date of diagnosis of cervical precancer lesions or invasive cervical cancer" O
return O.value

/* End of Date of diagnosis of cervical precancer lesions or invasive cervical cancer */

/*
Expand Down Expand Up @@ -9673,7 +9664,8 @@ define "Cervical precancer lesions":
*/

define "Invasive cervical cancer":
[Condition: Concepts."Invasive cervical cancer"]
[Condition: Concepts."Invasive cervical cancer"] C
where exists (C.clinicalStatus.coding CStatus where CStatus.code in { 'active', 'recurrence', 'relapse' })

/* End of Invasive cervical cancer */

Expand Down Expand Up @@ -9752,7 +9744,7 @@ define "Stage IV":
define "Date of treatment for cervical precancer lesions":
[Procedure] P
where P.status = 'completed'
and P.category ~ ConceptsCustom."cervical precancer lesion treatment"
and P.code in Concepts."Invasive cervical cancer treatment method Choices"
/* End of Date of treatment for cervical precancer lesions */

/*
Expand All @@ -9778,8 +9770,8 @@ define "Invasive cervical cancer treatment episode Value":

define "Invasive cervical cancer treatment method":
[Procedure] P
where P.status = 'completed'
and P.category ~ ConceptsCustom."Invasive cervical cancer treatment"
where P.status in { 'completed', 'in-progress' }
and P.code in Concepts."Invasive cervical cancer treatment method Choices"

/* End of Invasive cervical cancer treatment method */

Expand Down Expand Up @@ -14275,12 +14267,10 @@ define "STI services date":
define "VMMC":
[Procedure] P
where P.status = 'completed'
and P.code ~ Concepts."Voluntary medical male circumcision VMMC"
and P.code ~ Concepts."VMMC procedure"

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

Expand Down Expand Up @@ -14344,8 +14334,7 @@ define "HIV-positive PRV.DE12 Condition":
[Condition: Concepts."HIV-positive - HIV.PRV.DE12"]
define "HIV-positive PRV.DE12 Observation":
"HIV status of contact Observation" O
where O.status in { 'final', 'amended', 'corrected' }
and O.value ~ Concepts."HIV-positive - HIV.PRV.DE12"
where O.value ~ Concepts."HIV-positive - HIV.PRV.DE12"
/* End of HIV-positive PRV.DE12 */

/*
Expand Down Expand Up @@ -14374,8 +14363,10 @@ define "HIV-negative PRV.DE13 Observation":
define "Unknown PRV.DE14":
exists "Unknown PRV.DE14 Condition"
or exists "Unknown PRV.DE14 Observation"

define "Unknown PRV.DE14 Condition":
[Condition: Concepts."Unknown - HIV.PRV.DE14"]

define "Unknown PRV.DE14 Observation":
"HIV status of contact Observation" O
where O.status in { 'final', 'amended', 'corrected' }
Expand Down Expand Up @@ -14618,9 +14609,10 @@ 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: MARK as visit?
define "Visit date SRV.DE15":
[Encounter] E
return E.period
/* End of Visit date SRV.DE15 */

/*
Expand Down
Loading
Loading