Skip to content

Commit

Permalink
Updates to naming
Browse files Browse the repository at this point in the history
  • Loading branch information
pmanko committed Jul 24, 2024
1 parent b3be247 commit 369d93c
Show file tree
Hide file tree
Showing 11 changed files with 167 additions and 422 deletions.
131 changes: 15 additions & 116 deletions input/cql/HIVCommon.cql
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ include HIVConceptsCustom called HCC

parameter "Measurement Period" Interval<Date> default Interval[@2020-01-01, @2020-12-31]
parameter "Measurement Date" Date default @2020-01-01
parameter "Testing Interval" System.Quantity default 3 months
parameter "Intervention Interval" System.Quantity default 7 days

context Patient

Expand Down Expand Up @@ -54,15 +52,13 @@ define "HIV test resulted":

define "HIV Treatment Active":
[MedicationStatement] MS
Sort by MS.effective
where MS.status = 'completed'
where MS.status = 'recorded'
and exists(MS.reasonCode C where C ~ HC."On ART - HIV.H.DE47")



define "HIV PREP Active":
[MedicationStatement] MS
where MS.status = 'completed'
where MS.status = 'recorded'
and exists(MS.reasonCode C where C ~ HC."PrEP for HIV prevention")

define "Client is at elevated risk for HIV acquisition":
Expand Down Expand Up @@ -90,7 +86,7 @@ define "PEP Prescribed before start of Measurement Period and Completed":
and MR.intent = 'order'
and MR.medication ~ HC."PEP for HIV prevention"
and MR.authoredOn before end of "Measurement Period"
where (MS.status = 'completed'
where (MS.status = 'recorded'
and exists(MS.reasonCode C where C ~ HC."PrEP for HIV prevention")
)

Expand All @@ -102,7 +98,7 @@ define "PEP Prescribed during Measurement Period and Completed":
and MR.medication ~ HC."PEP for HIV prevention"
and MR.authoredOn after start of "Measurement Period"
and MR.authoredOn before end of "Measurement Period"
where (MS.status = 'completed'
where (MS.status = 'recorded'
and exists(MS.reasonCode C where C ~ HC."PrEP for HIV prevention")
)

Expand Down Expand Up @@ -428,7 +424,7 @@ exists(

define "PREP Product Oral":
exists([MedicationStatement] MS
where MS.status = 'completed'
where MS.status = 'recorded'
and exists(MS.reasonCode C where C ~ HC."Currently on PrEP")
and (MS.medication ~ HC."TDF + FTC - HIV.C.DE18" or
MS.medication ~ HC."TDF - HIV.C.DE19" or
Expand All @@ -438,56 +434,56 @@ exists(

define "PREP Product long-acting device":
exists([MedicationStatement] MS
where MS.status = 'completed'
where MS.status = 'recorded'
and exists(MS.reasonCode C where C ~ HC."Currently on PrEP")
and MS.medication ~ HC."Dapivirine vaginal ring DVR - HIV.C.DE22"
)

define "PREP Product long-acting injectable":
exists([MedicationStatement] MS
where MS.status = 'completed'
where MS.status = 'recorded'
and exists(MS.reasonCode C where C ~ HC."Currently on PrEP")
and MS.medication ~ HC."CAB-LA - HIV.C.DE23"
)

define "PREP first time":
exists([MedicationStatement] MS
where MS.status = 'completed'
where MS.status = 'recorded'
and exists(MS.reasonCode C where C ~ HC."Currently on PrEP")
and exists(MS.statusReason SR where SR ~ HC."First-time user - HIV.C.DE25")
)

define "PREP Continuing user":
exists([MedicationStatement] MS
where MS.status = 'completed'
where MS.status = 'recorded'
and exists(MS.reasonCode C where C ~ HC."Currently on PrEP")
and exists(MS.statusReason SR where SR ~ HC."Continuing user")
)

define "PREP Restarting":
exists([MedicationStatement] MS
where MS.status = 'completed'
where MS.status = 'recorded'
and exists(MS.reasonCode C where C ~ HC."Currently on PrEP")
and exists(MS.statusReason SR where SR ~ HC."Restarting following a period of not taking PrEP")
)

define "Daily_oral_PrEP":
exists([MedicationStatement] MS
where MS.status = 'completed'
where MS.status = 'recorded'
and exists(MS.reasonCode C where C ~ HC."Currently on PrEP")
and exists(MS.dosage.additionalInstruction AI where AI ~ HC."Daily oral PrEP")
)

define "Event_driven_PrEP":
exists([MedicationStatement] MS
where MS.status = 'completed'
where MS.status = 'recorded'
and exists(MS.reasonCode C where C ~ HC."Currently on PrEP")
and exists(MS.dosage.additionalInstruction AI where AI ~ HC."Event-driven PrEP 2+1+1")
)

define "other_dosing_PrEP":
exists([MedicationStatement] MS
where MS.status = 'completed'
where MS.status = 'recorded'
and exists(MS.reasonCode C where C ~ HC."Currently on PrEP")
and exists(MS.dosage.additionalInstruction AI where AI ~ HC."Other PrEP dosing type")
)
Expand Down Expand Up @@ -787,7 +783,7 @@ define "VMMC_adverse_event_Intraoperative":
and AE.date = P.performed
where AE.actuality = 'actual'

define "VMMC_adverse_event_Postoperative":
define "VMMC_adverse_event_Postoperative":
[AdverseEvent] AE
with [Procedure] P
such that AE.suspectEntity.instance.references(P) and P.status = 'completed'
Expand All @@ -803,101 +799,4 @@ define "VMMC_adverse_event_Postoperative":
when exists(VMMC_adverse_event_Intraoperative) then HC."Intraoperative"
when exists(VMMC_adverse_event_Postoperative) then HC."Postoperative"
else null
end


define "Partner or contact of an index case":
[Observation: HC."Referred through partner services"] O
where O.status in { 'final', 'amended', 'corrected' }
and exists(O.category OC where OC ~ HCC."social-history")
and O.code ~ HC."Partner or contact of an index case"

define "Drug-injecting partner":
[Observation: HC."Type of contact or partner for partner services"] O
where O.status in { 'final', 'amended', 'corrected' }
and exists(O.category OC where OC ~ HCC."social-history")
and O.code ~ HC."Drug-injecting partner - HIV.B.DE10"

define "Sexual partner":
[Observation: HC."Type of contact or partner for partner services"] O
where O.status in { 'final', 'amended', 'corrected' }
and exists(O.category OC where OC ~ HCC."social-history")
and O.code ~ HC."Sexual partner - HIV.B.DE11"


define "First HIV Treatment":
First("HIV Treatment Active")


define "Time to start ART":
case
when difference in days between "First HIV Treatment".effective and "HIV Positive Condition".onset <= 7 then HC."Within 7 days of HIV diagnosis"
when difference in days between "First HIV Treatment".effective and "HIV Positive Condition".onset <= 30 then HC."Within 30 days of HIV diagnosis"
when difference in days between "First HIV Treatment".effective and "HIV Positive Condition".onset <= 90 then HC."Within 90 days of HIV diagnosis"
else null
end

//HIV status of partner or contact (already known positive, newly diagnosed positive, negative)

define "already known positive":
[Observation: HC."HIV status of partner or contact"] O
where O.status in { 'final', 'amended', 'corrected' }
and exists(O.category OC where OC ~ HCC."social-history")
and O.code ~ HC."Already knew positive"

define "Newly diagnosed":
[Observation: HC."HIV status of partner or contact"] O
where O.status in { 'final', 'amended', 'corrected' }
and exists(O.category OC where OC ~ HCC."social-history")
and O.code ~ HC."Newly diagnosed"

define "Negative - HIV.H.DE37":
[Observation: HC."HIV status of partner or contact"] O
where O.status in { 'final', 'amended', 'corrected' }
and exists(O.category OC where OC ~ HCC."social-history")
and O.code ~ HC."Negative - HIV.H.DE37"

define "HIV status of partner or contact":
case
when exists("already known positive") then HC."Already knew positive"
when exists("Newly diagnosed") then HC."Newly diagnosed"
when exists("Negative - HIV.H.DE37") then HC."Negative - HIV.H.DE37"
else null
end


//need to define
define STI_testing:
[Procedure] P
where P.status = 'completed'
and P.code ~ HC."STI testing and treatment services"


//(including PrEP, OAMT, NSP, STI services, VMMC)
define "HIV prevention intervention":
List<String>{
if "HIV PREP Active" then 'PrEP' else null,
if OAMT_initiated then 'OAMT' else null,
if "Needle Syringe Dispensed" then 'NSP' else null,
if STI_testing then 'STI services' else null,
if VMMC_done then 'VMMC' else null
}

define "Negative Tests within Measurement Period":
HIC."HIV Negative Observation" O
with HIC."Client is at elevated risk for HIV acquisition" HIV
such that O.hasMember.references(HIV)
and O.issued after start of "Measurement Period"
and O.issued before end of "Measurement Period"
Sort by O.issued

define "First Negative Test within Measurement Period":
( First("Negative Tests within Measurement Period"))

define "Negative Tests after First Negative Test":
HIC."HIV Negative Observation" O
with HIC."Client is at elevated risk for HIV acquisition" HIV
such that O.hasMember.references(HIV)
and O.issued after "First Negative Test within Measurement Period"
and O.issued before ("First Negative Test within Measurement Period" + "Testing Interval")
Sort by O.issued
end
24 changes: 12 additions & 12 deletions input/cql/HIVConcepts.cql
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
library HIVConcepts
codesystem "HIVConcepts": 'http://smart.who.int/hiv/CodeSystem/HIVConcepts'

valueset "Gender* Choices": 'http://smart.who.int/hiv/ValueSet/HIV.A.DE18'
valueset "Gender Choices": 'http://smart.who.int/hiv/ValueSet/HIV.A.DE18'
valueset "Reason for visit - HIV.B.DE1 Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE1'
valueset "Referred through partner services Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE5'
valueset "Type of contact or partner for partner services Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE8'
valueset "Testing entry point Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE15'
valueset "Partner HIV status reported Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE33'
valueset "Key population member type* - HIV.B.DE50 Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE50'
valueset "HIV exposure type* Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE61'
valueset "Key population member type - HIV.B.DE50 Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE50'
valueset "HIV exposure type Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE61'
valueset "HIV test type - HIV.B.DE81 Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE81'
valueset "Assay number in testing strategy - HIV.B.DE88 Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE88'
valueset "Test result of HIV assay 1 - HIV.B.DE94 Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE94'
Expand All @@ -26,7 +26,7 @@ valueset "Test result of HIV assay 3 - HIV.B.DE102 Choices": 'http://smart.who.i
valueset "Test result of HIV assay 1 repeated - HIV.B.DE106 Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE106'
valueset "HIV test result - HIV.B.DE111 Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE111'
valueset "HIV status Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE115'
valueset "Probable route of transmission* Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE121'
valueset "Probable route of transmission Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE121'
valueset "Counselling provided Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE142'
valueset "Prevention services offered and referrals - HIV.B.DE149 Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE149'
valueset "Sexual and reproductive health integrated services - HIV.B.DE158 Choices": 'http://smart.who.int/hiv/ValueSet/HIV.B.DE158'
Expand Down Expand Up @@ -117,7 +117,7 @@ valueset "TPT regimen type Choices": 'http://smart.who.int/hiv/ValueSet/HIV.D.DE
valueset "TB preventive treatment TPT status Choices": 'http://smart.who.int/hiv/ValueSet/HIV.D.DE1034'
valueset "Timing of ART initiation Choices": 'http://smart.who.int/hiv/ValueSet/HIV.E.DE41'
valueset "Place of delivery Choices": 'http://smart.who.int/hiv/ValueSet/HIV.E.DE67'
valueset "Key population member type* - HIV.E.DE114 Choices": 'http://smart.who.int/hiv/ValueSet/HIV.E.DE114'
valueset "Key population member type - HIV.E.DE114 Choices": 'http://smart.who.int/hiv/ValueSet/HIV.E.DE114'
valueset "Signs of substantial risk of HIV infection - HIV.E.DE155 Choices": 'http://smart.who.int/hiv/ValueSet/HIV.E.DE155'
valueset "HIV test type - HIV.E.DE168 Choices": 'http://smart.who.int/hiv/ValueSet/HIV.E.DE168'
valueset "Maternal and child health service visit Choices": 'http://smart.who.int/hiv/ValueSet/HIV.E.DE173'
Expand Down Expand Up @@ -153,7 +153,7 @@ valueset "Other priority populations Choices": 'http://smart.who.int/hiv/ValueSe
code "Visit date - HIV.A.DE3": 'HIV.A.DE3' from "HIVConcepts" display 'Visit date'
code "Estimated age": 'HIV.A.DE16' from "HIVConcepts" display 'Estimated age'
code "Age": 'HIV.A.DE17' from "HIVConcepts" display 'Age'
code "Gender*": 'HIV.A.DE18' from "HIVConcepts" display 'Gender*'
code "Gender": 'HIV.A.DE18' from "HIVConcepts" display 'Gender*'
code "Female": 'HIV.A.DE19' from "HIVConcepts" display 'Female'
code "Male": 'HIV.A.DE20' from "HIVConcepts" display 'Male'
code "Transgender male": 'HIV.A.DE21' from "HIVConcepts" display 'Transgender male'
Expand Down Expand Up @@ -181,15 +181,15 @@ code "Partner HIV status reported": 'HIV.B.DE33' from "HIVConcepts" display 'Par
code "HIV-positive - HIV.B.DE34": 'HIV.B.DE34' from "HIVConcepts" display 'HIV-positive'
code "HIV-negative - HIV.B.DE35": 'HIV.B.DE35' from "HIVConcepts" display 'HIV-negative'
code "Unknown - HIV.B.DE36": 'HIV.B.DE36' from "HIVConcepts" display 'Unknown'
code "Key population member* - HIV.B.DE49": 'HIV.B.DE49' from "HIVConcepts" display 'Key population member*'
code "Key population member type* - HIV.B.DE50": 'HIV.B.DE50' from "HIVConcepts" display 'Key population member type*'
code "Key population member - HIV.B.DE49": 'HIV.B.DE49' from "HIVConcepts" display 'Key population member*'
code "Key population member type - HIV.B.DE50": 'HIV.B.DE50' from "HIVConcepts" display 'Key population member type*'
code "Sex worker - HIV.B.DE51": 'HIV.B.DE51' from "HIVConcepts" display 'Sex worker'
code "Men who have sex with men": 'HIV.B.DE52' from "HIVConcepts" display 'Men who have sex with men'
code "Trans and gender-diverse people - HIV.B.DE53": 'HIV.B.DE53' from "HIVConcepts" display 'Trans and gender-diverse people'
code "People who inject drugs - HIV.B.DE54": 'HIV.B.DE54' from "HIVConcepts" display 'People who inject drugs'
code "People living in prisons and other closed settings": 'HIV.B.DE55' from "HIVConcepts" display 'People living in prisons and other closed settings'
code "Date HIV test results returned": 'HIV.B.DE60' from "HIVConcepts" display 'Date HIV test results returned'
code "HIV exposure type*": 'HIV.B.DE61' from "HIVConcepts" display 'HIV exposure type*'
code "HIV exposure type": 'HIV.B.DE61' from "HIVConcepts" display 'HIV exposure type*'
code "Occupational": 'HIV.B.DE62' from "HIVConcepts" display 'Occupational'
code "Non-occupational violent": 'HIV.B.DE63' from "HIVConcepts" display 'Non-occupational violent'
code "Non-occupational consensual sex": 'HIV.B.DE64' from "HIVConcepts" display 'Non-occupational consensual sex'
Expand Down Expand Up @@ -234,7 +234,7 @@ code "HIV status": 'HIV.B.DE115' from "HIVConcepts" display 'HIV status'
code "HIV-positive - HIV.B.DE116": 'HIV.B.DE116' from "HIVConcepts" display 'HIV-positive'
code "HIV-negative - HIV.B.DE117": 'HIV.B.DE117' from "HIVConcepts" display 'HIV-negative'
code "Unknown - HIV.B.DE118": 'HIV.B.DE118' from "HIVConcepts" display 'Unknown'
code "Probable route of transmission*": 'HIV.B.DE121' from "HIVConcepts" display 'Probable route of transmission*'
code "Probable route of transmission": 'HIV.B.DE121' from "HIVConcepts" display 'Probable route of transmission*'
code "Heterosexual sex": 'HIV.B.DE122' from "HIVConcepts" display 'Heterosexual sex'
code "Sex between men": 'HIV.B.DE123' from "HIVConcepts" display 'Sex between men'
code "Unprotected intercourse during sex work": 'HIV.B.DE124' from "HIVConcepts" display 'Unprotected intercourse during sex work'
Expand Down Expand Up @@ -935,8 +935,8 @@ code "ANC contact date - HIV.E.DE85": 'HIV.E.DE85' from "HIVConcepts" display 'A
code "Infant date of birth": 'HIV.E.DE87' from "HIVConcepts" display 'Infant date of birth'
code "Age of infant": 'HIV.E.DE90' from "HIVConcepts" display 'Age of infant'
code "HIV-exposed infant or child - HIV.E.DE112": 'HIV.E.DE112' from "HIVConcepts" display 'HIV-exposed infant or child'
code "Key population member* - HIV.E.DE113": 'HIV.E.DE113' from "HIVConcepts" display 'Key population member*'
code "Key population member type* - HIV.E.DE114": 'HIV.E.DE114' from "HIVConcepts" display 'Key population member type*'
code "Key population member - HIV.E.DE113": 'HIV.E.DE113' from "HIVConcepts" display 'Key population member*'
code "Key population member type - HIV.E.DE114": 'HIV.E.DE114' from "HIVConcepts" display 'Key population member type*'
code "Sex worker - HIV.E.DE115": 'HIV.E.DE115' from "HIVConcepts" display 'Sex worker'
code "People who inject drugs - HIV.E.DE116": 'HIV.E.DE116' from "HIVConcepts" display 'People who inject drugs'
code "Trans and gender-diverse people - HIV.E.DE117": 'HIV.E.DE117' from "HIVConcepts" display 'Trans and gender-diverse people'
Expand Down
Loading

0 comments on commit 369d93c

Please sign in to comment.