WHO SMART Guidelines - HIV
0.4.4 - ci-build

WHO SMART Guidelines - HIV, published by WHO. This guide is not an authorized publication; it is the continuous build for version 0.4.4 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/WorldHealthOrganization/smart-hiv/tree/main and changes regularly. See the Directory of published versions

Measure: HIV.IND.78 Repeat diagnosis of STI syndrome, HIV prevention services (Experimental)

Official URL: http://smart.who.int/hiv/Measure/HIVIND78 Version: 0.4.4
Draft as of 2024-08-18 Computable Name: HIVIND78

% of people attending HIV prevention services diagnosed with a particular STI syndrome who were diagnosed with the same STI syndrome two or more times during the reporting period

Knowledge Artifact Metadata
Name (machine-readable) HIVIND78
Title (human-readable) HIV.IND.78 Repeat diagnosis of STI syndrome, HIV prevention services
Status Draft
Experimental true
Description

% of people attending HIV prevention services diagnosed with a particular STI syndrome who were diagnosed with the same STI syndrome two or more times during the reporting period

Measure Steward WHO
Steward Contact Details WHO: http://who.int
Measure Metadata
Version Number 0.4.4
Measure Scoring Proportion
Improvement Notation Decreased score indicates improvement
Population Basis boolean
Measure Population Criteria
Initial Population ID: HIV.IND.78.IP
Description:

Initial Population

Logic Definition: Initial Population
Denominator ID: HIV.IND.78.DEN
Description:

Number of people attending HIV prevention services diagnosed with a particular STI syndrome during the reporting period

Logic Definition: Denominator
Numerator ID: HIV.IND.78.NUM
Description:

Number of people attending HIV prevention services diagnosed with a particular STI syndrome two or more times during the reporting period

Logic Definition: Numerator
Measure Logic
Primary Library HIV.IND.78 Logic
Dependency 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
Dependency Description: Library HIE
Resource: HIVIndicatorElements
Canonical URL: http://smart.who.int/hiv/Library/HIVIndicatorElements
Dependency Description: Library Elements
Resource: HIVElements
Canonical URL: http://smart.who.int/hiv/Library/HIVElements
Dependency 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
Dependency 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
Dependency Description: Library WC
Resource: WHOCommon
Canonical URL: http://smart.who.int/hiv/Library/WHOCommon
Dependency Description: Code system ConditionClinicalStatusCodes
Resource: Condition Clinical Status Codes
Canonical URL: http://terminology.hl7.org/CodeSystem/condition-clinical
Dependency Description: Code system HIVConcepts
Resource: WHO SMART HIV Concepts CodeSystem
Canonical URL: http://smart.who.int/hiv/CodeSystem/HIVConcepts
Dependency Description: Value set Syndrome/STI diagnosed - HIV.B.DE226 Choices
Resource: Syndrome/STI diagnosed ValueSet
Canonical URL: http://smart.who.int/hiv/ValueSet/HIV.B.DE226
Direct Reference Code Code: active
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Code: recurrence
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Code: relapse
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Display: PrEP for HIV prevention
Code: HIV.C.DE76
System: http://smart.who.int/hiv/CodeSystem/HIVConcepts
Direct Reference Code Display: STI testing and treatment services
Code: HIV.B.DE164
System: http://smart.who.int/hiv/CodeSystem/HIVConcepts
Direct Reference Code Display: VMMC procedure performed
Code: HIV.B.DE197
System: http://smart.who.int/hiv/CodeSystem/HIVConcepts
Direct Reference Code Display: HIV prevention intervention
Code: HIV.PRV.DE2
System: http://smart.who.int/hiv/CodeSystem/HIVConcepts
Direct Reference Code Display: Other
Code: HIV.PRV.DE8
System: http://smart.who.int/hiv/CodeSystem/HIVConcepts
Direct Reference Code Display: OAMT
Code: HIV.PRV.DE4
System: http://smart.who.int/hiv/CodeSystem/HIVConcepts
Parameter Name: Measurement Period
Use: In
Min Cardinality: 0
Max Cardinality: 1
Type: Period
Parameter Name: Numerator
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Denominator
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Initial Population
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Measure Logic Data Requirements
Data Requirement Type: Condition
Profile(s): Condition
Must Support Elements: code, verificationStatus, verificationStatus.text
Data Requirement Type: Patient
Profile(s): Patient
Data Requirement Type: MedicationStatement
Profile(s): MedicationStatement
Must Support Elements: reasonCode, effective
Data Requirement Type: Procedure
Profile(s): Procedure
Must Support Elements: status, code, performed
Data Requirement Type: Observation
Profile(s): Observation
Must Support Elements: status, code, value, effective
Data Requirement Type: EpisodeOfCare
Profile(s): EpisodeOfCare
Must Support Elements: type, period
Measure Logic Definitions
Logic Definition Library Name: HIVElements
define "Syndrome/STI diagnosed B.DE226 Condition":
  [Condition] C
    where C.code in Concepts."Syndrome/STI diagnosed - HIV.B.DE226 Choices"
      and C.verificationStatus.text = 'confirmed'
Logic Definition Library Name: HIVIndicatorElements
define "Syndrome/STI diagnosed B.DE226 Condition":
  Elements."Syndrome/STI diagnosed B.DE226 Condition" C
    where C.prevalenceInterval() overlaps "Measurement Period"
Logic Definition Library Name: HIVElements
define "PrEP service date":
  [MedicationStatement] MS
    where exists(MS.reasonCode C where C ~ Concepts."PrEP for HIV prevention")
    return start of MS.effective.toInterval()
Logic Definition Library Name: HIVElements
define "STI services date":
  [Procedure] P
  where P.status = 'completed'
  and P.code ~ Concepts."STI testing and treatment services"
  return start of P.performed.toInterval()
Logic Definition 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"
Logic Definition Library Name: HIVElements
define "VMMC date":
  "VMMC" P
  return start of P.performed.toInterval()
Logic Definition Library Name: HIVElements
define "Other PRV.DE8 date":
  [Observation] O
    where O.status in {'final', 'amended'}
    and O.code ~ Concepts."HIV prevention intervention"
    and O.value ~ Concepts."Other - HIV.PRV.DE8"
  return start of O.effective.toInterval()
Logic Definition Library Name: HIVElements
define "OAMT status date":
  [EpisodeOfCare] EOC
    where exists(EOC.type T where T ~ Concepts."OAMT")
    return start of EOC.period
Logic Definition Library Name: HIVElements
/* End of Other PRV.DE8 */

/*
@dataElement: HIV.PRV.DE10 - Date accessed HIV prevention intervention
@activity: HIV.B6 Capture or update client history
@description: Date the client accessed HIV prevention intervention
*/
// TODO: NSP date requires fix to DeviceUseStatement support
define "Date accessed HIV prevention intervention": 
  flatten{"PrEP service date", /*"NSP date",*/ "STI services date", "VMMC date", "Other PRV.DE8 date","OAMT status date"}
Logic Definition Library Name: HIVIND78Logic
/**
 * Numerator
 * 
 * Definition: Number of people attending HIV prevention services diagnosed with a particular STI syndrome two or more times during the reporting period
 * Calculation: COUNT of clients with "Any STI syndrome diagnosed"=True on multiple values of "Date accessed HIV prevention intervention" in reporting period
 */

define "Numerator":
  Count(
    (HIE."Syndrome/STI diagnosed B.DE226 Condition" C
    where exists (
      HE."Date accessed HIV prevention intervention" t
      where t = start of C.prevalenceInterval()
    ))
  ) > 1
Logic Definition Library Name: HIVIndicatorElements
/* End of Other PRV.DE8 */

/*
@dataElement: HIV.PRV.DE10 - Date accessed HIV prevention intervention
@activity: HIV.B6 Capture or update client history
@description: Date the client accessed HIV prevention intervention
*/

define "Date accessed HIV prevention intervention":
  Elements."Date accessed HIV prevention intervention" t where t included in "Measurement Period"
Logic Definition Library Name: HIVIND78Logic
/**
 * Denominator
 *
 * Definition: Number of people attending HIV prevention services diagnosed with a particular STI syndrome during the reporting period
 * Calculation: COUNT of clients with "Date accessed HIV prevention intervention" in the reporting period
 */

define "Denominator":
  exists(HIE."Date accessed HIV prevention intervention")
Logic Definition Library Name: HIVIND78Logic
/* Populations */

/*
 *Initial Population
 */

define "Initial Population":
  true
Logic Definition 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
        }
Logic Definition 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
        }
Logic Definition Library Name: FHIRHelpers
define function ToString(value string): value.value
Logic Definition Library Name: WHOCommon
/*
@description: Returns an interval representing the normalized prevalence period of a given Condition resource.
@comment: Uses the toInterval and toAbatementInterval functions to determine the widest potential interval from
onset to abatement as specified in the given Condition.
*/
define fluent function prevalenceInterval(condition Condition):
if condition.clinicalStatus ~ "active"
  or condition.clinicalStatus ~ "recurrence"
  or condition.clinicalStatus ~ "relapse" then
  Interval[start of condition.onset.toInterval(), end of condition.abatementInterval()]
else
  (end of condition.abatementInterval()) abatementDate
    return 
	  if abatementDate is null then
        Interval[start of condition.onset.toInterval(), abatementDate)
      else
        Interval[start of condition.onset.toInterval(), abatementDate]
Logic Definition Library Name: WHOCommon
/*
@description: Returns an interval representing the normalized Abatement of a given Condition resource.
@comment: NOTE: Due to the complexity of determining an interval from a String, this function will throw
a run-time exception if used with a Condition instance that has a String as the abatement value.
*/
define fluent function abatementInterval(condition Condition):
  if condition.abatement is FHIR.dateTime then
    Interval[FHIRHelpers.ToDateTime(condition.abatement as FHIR.dateTime), FHIRHelpers.ToDateTime(condition.abatement as FHIR.dateTime)]
  else if condition.abatement is FHIR.Period then
    FHIRHelpers.ToInterval(condition.abatement as FHIR.Period)
  else if condition.abatement 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 if condition.abatement is FHIR.Age then
    Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(condition.abatement as FHIR.Age),
      FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(condition.abatement as FHIR.Age) + 1 year)
  else if condition.abatement is FHIR.Range then
    Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((condition.abatement as FHIR.Range).low),
      FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((condition.abatement as FHIR.Range).high) + 1 year)
  else if condition.abatement is FHIR.boolean then
    Interval[end of condition.onset.toInterval(), condition.recordedDate)
  else 
    null
Logic Definition Library Name: FHIRHelpers
define function ToDateTime(value dateTime): value.value
Logic Definition 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]
Logic Definition Library Name: FHIRHelpers
define function ToDate(value date): value.value
Logic Definition 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
Logic Definition 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
Logic Definition Library Name: FHIRHelpers
define function ToString(value ProcedureStatus): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value ObservationStatus): value.value
Generated using version 0.4.6 of the sample-content-ig Liquid templates