| HIVIND11 |
| HIV.IND.11 OAMT coverage |
| Draft |
| true |
% of opioid dependent people receiving opioid agonist maintenance treatment (OAMT) at a specified date
|
| WHO |
| WHO: http://who.int |
| 0.4.4 |
| Proportion |
| Increased score indicates improvement |
| boolean |
ID: HIV.IND.11.IP
Description:
Initial Population
Logic Definition: Initial Population
|
ID: HIV.IND.11.DEN
Description:
a) Programme/service provider level: number of opioid dependent people accessing service | b) Population level: population size estimate of opioid dependent people in relevant geographic area
Logic Definition: Denominator
|
ID: HIV.IND.11.NUM
Description:
Number of people on OAMT at specified census date
Logic Definition: Numerator
|
| HIV.IND.11 Logic |
Description: FHIR model information
Resource: http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1
Canonical URL: http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1
|
Description: Library HIE
Resource: HIVIndicatorElements
Canonical URL: http://smart.who.int/hiv/Library/HIVIndicatorElements
|
Description: Library Elements
Resource: HIVElements
Canonical URL: http://smart.who.int/hiv/Library/HIVElements
|
Description: Library Concepts
Resource: http://smart.who.int/hiv/Library/HIVConcepts|0.0.2
Canonical URL: http://smart.who.int/hiv/Library/HIVConcepts|0.0.2
|
Description: Library FHIRHelpers
Resource: http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1
Canonical URL: http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1
|
Description: Library ConceptsCustom
Resource: http://smart.who.int/hiv/Library/HIVConceptsCustom|0.0.1
Canonical URL: http://smart.who.int/hiv/Library/HIVConceptsCustom|0.0.1
|
Description: Library WC
Resource: WHOCommon
Canonical URL: http://smart.who.int/hiv/Library/WHOCommon
|
Description: Code system HIVConcepts
Resource: WHO SMART HIV Concepts CodeSystem
Canonical URL: http://smart.who.int/hiv/CodeSystem/HIVConcepts
|
Description: Code system ObservationCategoryCodes
Resource: Observation Category Codes
Canonical URL: http://terminology.hl7.org/CodeSystem/observation-category
|
Display: Key population member*
Code: HIV.B.DE49
System: http://smart.who.int/hiv/CodeSystem/HIVConcepts
|
Display: Social History
Code: social-history
System: http://terminology.hl7.org/CodeSystem/observation-category
|
Display: People who inject drugs
Code: HIV.B.DE54
System: http://smart.who.int/hiv/CodeSystem/HIVConcepts
|
Display: OAMT
Code: HIV.PRV.DE4
System: http://smart.who.int/hiv/CodeSystem/HIVConcepts
|
Display: PrEP for HIV prevention
Code: HIV.C.DE76
System: http://smart.who.int/hiv/CodeSystem/HIVConcepts
|
Display: STI testing and treatment services
Code: HIV.B.DE164
System: http://smart.who.int/hiv/CodeSystem/HIVConcepts
|
Display: VMMC procedure performed
Code: HIV.B.DE197
System: http://smart.who.int/hiv/CodeSystem/HIVConcepts
|
Display: HIV prevention intervention
Code: HIV.PRV.DE2
System: http://smart.who.int/hiv/CodeSystem/HIVConcepts
|
Display: Other
Code: HIV.PRV.DE8
System: http://smart.who.int/hiv/CodeSystem/HIVConcepts
|
Name: Measurement Period
Use: In
Min Cardinality: 0
Max Cardinality: 1
Type: Period
|
Name: Numerator
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
|
Name: Denominator
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
|
Name: Initial Population
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
|
Type: Observation
Profile(s):
Observation
Must Support Elements: status, code, value
|
Type: Observation
Profile(s):
Observation
Must Support Elements: code, status, category, effective, issued, value
Code Filter(s):
Path: code
Code:
|
Type: EpisodeOfCare
Profile(s):
EpisodeOfCare
Must Support Elements: type, period, statusHistory
|
Type: Patient
Profile(s):
Patient
|
Type: MedicationStatement
Profile(s):
MedicationStatement
Must Support Elements: reasonCode
|
Type: Procedure
Profile(s):
Procedure
Must Support Elements: status, code
|
| Library Name: HIVElements |
/* End of Key population member B.DE49 */
/*
@dataElement: HIV.B.DE50 - Key population member type
@activity: HIV.B6 Capture or update client history
@description: The type of key population that the client is included in
*/
define "Key population member type Observation":
[Observation: Concepts."Key population member - HIV.B.DE49"] O
where O.status in { 'final', 'amended', 'corrected' }
and exists(O.category OC where OC ~ ConceptsCustom."social-history")
|
| Library Name: HIVIndicatorElements |
define "Key population member type Observation":
Elements."Key population member type Observation" O
where O.effective.toInterval() before end of "Measurement Period"
or O.issued before end of "Measurement Period"
|
| Library Name: HIVIndicatorElements |
/* End of Trans and gender-diverse people B.DE53 */
/*
@dataElement: HIV.B.DE54 - People who inject drugs
@activity: HIV.B6 Capture or update client history
@description: Client is a person who injects drugs
*/
define "People who inject drugs":
exists("Key population member type Observation" O
where O.value ~ Concepts."People who inject drugs - HIV.B.DE54"
and O.effective.toInterval() during "Measurement Period")
|
| Library Name: HIVElements |
define "OAMT status":
[EpisodeOfCare] EOC
where exists(EOC.type T where T ~ Concepts."OAMT")
return EOC.period
|
| Library Name: HIVIndicatorElements |
// TODO: doesn't compile DeviceUseStatement causes translation error
// exists(Elements."Date injecting equipment provided" DUS
// where DUS.timing.toInterval() during "Measurement Period")
/* End of Date injecting equipment provided */
/*
@dataElement: HIV.PRV.DE17 - Date OAMT initiated
@activity: HIV.B21 Offer prevention options
@description: Date client initiated opioid agonist maintenance treatment (OAMT)
*/
// TODO: Replace placeholder with relevant CQL logic
/* End of Date OAMT initiated */
/*
@dataElement: HIV.PRV.DE20 - Currently on OAMT
@activity: HIV.B6 Capture or update client history
@description: Client is currently on opioid agonist maintenance treatment (OAMT) at reporting date, defined according to country/program to account for medication dispensed and LTFU criterion
*/
define "Currently on OAMT":
exists(Elements."OAMT status" p
where p.toInterval() overlaps "Measurement Period")
|
| Library Name: HIVIND11Logic |
/**
* Numerator
*
* Definition: Number of people on OAMT at specified census date
* Calculation: Number of clients with "Key population member type"='People who inject drugs' AND "Currently on OAMT"=True for a specific "Reporting date"
*/
define "Numerator":
HIE."People who inject drugs" and HIE."Currently on OAMT"
|
| Library Name: HIVElements |
/* End of HIV prevention intervention */
/*
@dataElement: HIV.PRV.DE3 - PrEP service
@activity: HIV.B6 Capture or update client history
@description: Client accessed PrEP services
*/
define "PrEP service":
[MedicationStatement] MS
where exists(MS.reasonCode C where C ~ Concepts."PrEP for HIV prevention")
sort by start of effective.toInterval()
|
| Library Name: HIVElements |
define "OAMT statusHistory":
[EpisodeOfCare] EOC
where exists(EOC.type T where T ~ Concepts."OAMT")
and (exists (
EOC.statusHistory H
where H.period is not null))
|
| Library Name: HIVElements |
/* End of PrEP service */
/*
@dataElement: HIV.PRV.DE4 - OAMT
@activity: HIV.B6 Capture or update client history
@description: Client accessed opioid agonist maintenance treatment (OAMT) services
*/
define "OAMT":
flatten{"OAMT status","OAMT statusHistory".statusHistory.period}
|
| Library Name: HIVElements |
//return start of "OAMT statusHistory".statusHistory.period
//need to ask brynn
/* End of OAMT */
/*
@dataElement: HIV.PRV.DE5 - NSP
@activity: HIV.B6 Capture or update client history
@description: Client accessed needle-syringe programme (NSP) services
*/
define "NSP":
false
|
| Library Name: HIVElements |
// TODO: fix device use statement
// [DeviceUseStatement] DUS
// with [Device: ConceptsCustom."needle-syringe"] D
// 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 */
/*
@dataElement: HIV.PRV.DE6 - STI services
@activity: HIV.B6 Capture or update client history
@description: Client accessed sexually transmitted infection (STI) services
*/
define "STI services":
[Procedure] P
where P.status = 'completed'
and P.code ~ Concepts."STI testing and treatment services"
|
| Library Name: HIVElements |
/* End of STI services */
/*
@dataElement: HIV.PRV.DE7 - VMMC
@activity: HIV.B6 Capture or update client history
@description: Client accessed voluntary medical male circumcision (VMMC) services
*/
// define "VMMC_done":
// [Procedure] P
// where P.status = 'completed'
// and P.code ~ Concepts."Voluntary medical male circumcision VMMC"
define "VMMC":
[Procedure] P
where P.status = 'completed'
and P.code ~ Concepts."VMMC procedure"
|
| Library Name: HIVElements |
/* End of VMMC */
/*
@dataElement: HIV.PRV.DE8 - Other
@activity: HIV.B6 Capture or update client history
@description: Client accessed other HIV prevention services
*/
define "Other PRV.DE8":
[Observation] O
where O.status in {'final', 'amended'}
and O.code ~ Concepts."HIV prevention intervention"
and O.value ~ Concepts."Other - HIV.PRV.DE8"
sort by start of effective.toInterval()
|
| Library Name: HIVElements |
/* End of At elevated risk for HIV acquisition PRV.DE1 */
/*
@dataElement: HIV.PRV.DE2 - HIV prevention intervention
@activity: HIV.B6 Capture or update client history
@description: HIV prevention intervention that client accessed
*/
define "HIV prevention intervention":
exists ("PrEP service") or exists("OAMT") or "NSP" or exists("STI services") or exists("VMMC") or exists("Other PRV.DE8")
|
| Library Name: HIVIND11Logic |
/**
* Denominator
*
* Definition: a) Programme/service provider level: number of opioid dependent people accessing service | b) Population level: population size estimate of opioid dependent people in relevant geographic area
* Calculation: Programme/service provider level: | COUNT of opioid dependent people accessing service | | Population level: | *Estimated population size of opioid dependent people in relevant geographic area
*/
define "Denominator":
HE."HIV prevention intervention" and HIE."People who inject drugs"
|
| Library Name: HIVIND11Logic |
/* Populations */
/*
*Initial Population
*/
define "Initial Population":
true
|
| Library Name: FHIRHelpers |
define function ToString(value ObservationStatus): value.value
|
| Library Name: FHIRHelpers |
define function ToConcept(concept FHIR.CodeableConcept):
if concept is null then
null
else
System.Concept {
codes: concept.coding C return ToCode(C),
display: concept.text.value
}
|
| Library Name: FHIRHelpers |
define function ToCode(coding FHIR.Coding):
if coding is null then
null
else
System.Code {
code: coding.code.value,
system: coding.system.value,
version: coding.version.value,
display: coding.display.value
}
|
| Library Name: FHIRHelpers |
define function ToDateTime(value instant): value.value
|
| Library Name: WHOCommon |
/*
From FHIRCommon 4.1.0:
*/
/*
@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval
@comment: Normalizes a choice type of FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instance, FHIR.string, FHIR.Age, or FHIR.Range types
to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible
representations for timing-valued elements in FHIR, allowing this function to be used across any resource.
The input can be provided as a dateTime, Period, Timing, instant, string, Age, or Range.
The intent of this function is to provide a clear and concise mechanism to treat single
elements that have multiple possible representations as intervals so that logic doesn't have to account
for the variability. More complex calculations (such as medication request period or dispense period
calculation) need specific guidance and consideration. That guidance may make use of this function, but
the focus of this function is on single element calculations where the semantics are unambiguous.
If the input is a dateTime, the result a DateTime Interval beginning and ending on that dateTime.
If the input is a Period, the result is a DateTime Interval.
If the input is a Timing, an error is raised indicating a single interval cannot be computed from a Timing.
If the input is an instant, the result is a DateTime Interval beginning and ending on that instant.
If the input is a string, an error is raised indicating a single interval cannot be computed from a string.
If the input is an Age, the result is a DateTime Interval beginning when the patient was the given Age,
and ending immediately prior to when the patient was the given Age plus one year.
If the input is a Range, the result is a DateTime Interval beginning when the patient was the Age given
by the low end of the Range, and ending immediately prior to when the patient was the Age given by the
high end of the Range plus one year.
NOTE: Due to the
complexity of determining a single interval from a Timing or String type, this function will throw a run-time exception if it is used
with a Timing or String.
*/
define fluent function toInterval(choice Choice<FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range>):
case
when choice is FHIR.dateTime then
Interval[FHIRHelpers.ToDateTime(choice as FHIR.dateTime), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)]
when choice is FHIR.Period then
FHIRHelpers.ToInterval(choice as FHIR.Period)
when choice is FHIR.instant then
Interval[FHIRHelpers.ToDateTime(choice as FHIR.instant), FHIRHelpers.ToDateTime(choice as FHIR.instant)]
when choice is FHIR.Age then
Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age),
FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age) + 1 year)
when choice is FHIR.Range then
Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).low),
FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).high) + 1 year)
when choice is FHIR.Timing then
Message(null as Interval<DateTime>, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported')
when choice is FHIR.string then
Message(null as Interval<DateTime>, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a String value is not supported')
else
null as Interval<DateTime>
end
|
| Library Name: FHIRHelpers |
define function ToDateTime(value dateTime): value.value
|
| Library Name: FHIRHelpers |
define function ToInterval(period FHIR.Period):
if period is null then
null
else
if period."start" is null then
Interval(period."start".value, period."end".value]
else
Interval[period."start".value, period."end".value]
|
| Library Name: FHIRHelpers |
define function ToDate(value date): value.value
|
| Library Name: FHIRHelpers |
define function ToQuantity(quantity FHIR.Quantity):
case
when quantity is null then null
when quantity.value is null then null
when quantity.comparator is not null then
Message(null, true, 'FHIRHelpers.ToQuantity.ComparatorQuantityNotSupported', 'Error', 'FHIR Quantity value has a comparator and cannot be converted to a System.Quantity value.')
when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org'
or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then
System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) }
else
Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' & quantity.unit.value & ' (' & quantity.system.value & '|' & quantity.code.value & ')')
end
|
| Library Name: FHIRHelpers |
define function ToCalendarUnit(unit System.String):
case unit
when 'ms' then 'millisecond'
when 's' then 'second'
when 'min' then 'minute'
when 'h' then 'hour'
when 'd' then 'day'
when 'wk' then 'week'
when 'mo' then 'month'
when 'a' then 'year'
else unit
end
|
| Library Name: FHIRHelpers |
define function ToString(value ProcedureStatus): value.value
|