WHO SMART Guidelines - HIV
0.3.0 - ci-build

WHO SMART Guidelines - HIV - Local Development build (v0.3.0) built by the FHIR (HL7® FHIR® Standard) Build Tools. See the Directory of published versions

Library: HIV.B7.DT Logic (Experimental)

Official URL: http://smart.who.int/hiv/Library/HIVB7DTLogic Version: 0.3.0
Draft as of 2024-12-06 Computable Name: HIVB7DTLogic

Description not yet available for HIV.B7.DT Logic.

Title: HIV.B7.DT Logic
Id: HIVB7DTLogic
Version: 0.3.0
Url: HIV.B7.DT Logic
Status: draft
Experimental: true
Type:

system: http://terminology.hl7.org/CodeSystem/library-type

code: logic-library

Date: 2024-12-06 22:28:12+0000
Publisher: WHO
Description:

Description not yet available for HIV.B7.DT Logic.

Related Artifacts:

Dependencies

  • WHOCommon
  • http://fhir.org/guides/who/hiv-dak/CodeSystem/HIV-DAKConcepts
  • http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de95
  • http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de90
  • http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de91
  • http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-e-de205
  • http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-e-de206
  • http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de92
  • http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de93
  • http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de82
  • http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de103
  • http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de104
Parameters:
NameTypeMinMaxIn/Out
PatientPatient01Out
Age_greater_than_18_monthsboolean01Out
Report as HIV-negativeObservation0*Out
Should Continue with Performing HIV Assay 2Observation0*Out
Should Continue with Performing HIV Assay 1 repeatedObservation0*Out
Should Continue with Performing HIV Assay 3Observation0*Out
Report as HIV-negative after assay 1 repeatedObservation0*Out
Report as HIV-inconclusive after assay 1 repeatedObservation0*Out
Report as HIV-inconclusive after assay 3Observation0*Out
Report as HIV-positiveObservation0*Out
Data Requirements:
TypeProfileMSCode Filter
Observation http://hl7.org/fhir/StructureDefinition/Observation
ServiceRequest http://hl7.org/fhir/StructureDefinition/ServiceRequest
Observation http://hl7.org/fhir/StructureDefinition/Observation
ServiceRequest http://hl7.org/fhir/StructureDefinition/ServiceRequest
Observation http://hl7.org/fhir/StructureDefinition/Observation
ServiceRequest http://hl7.org/fhir/StructureDefinition/ServiceRequest
Observation http://hl7.org/fhir/StructureDefinition/Observation
ServiceRequest http://hl7.org/fhir/StructureDefinition/ServiceRequest
Observation http://hl7.org/fhir/StructureDefinition/Observation
ServiceRequest http://hl7.org/fhir/StructureDefinition/ServiceRequest
Observation http://hl7.org/fhir/StructureDefinition/Observation
ServiceRequest http://hl7.org/fhir/StructureDefinition/ServiceRequest
Observation http://hl7.org/fhir/StructureDefinition/Observation
ServiceRequest http://hl7.org/fhir/StructureDefinition/ServiceRequest
Observation http://hl7.org/fhir/StructureDefinition/Observation
ServiceRequest http://hl7.org/fhir/StructureDefinition/ServiceRequest
Content: text/cql
/**
Library: HIV.B7.DT Logic

@DecisionID: HIV.B7.DT
@BusinessRule:
@Trigger: 
@Description: 

Test Using Algorithm

WHO standard testing strategy for HIV-1 diagnosis (among people ≥18 months of age)
HIV.B7 Test for HIV using testing algorithm, HIV.C4 Test for HIV using testing algorithm, HIV.D.11 Retest using HIV strategy
*/

library HIVB7DTLogic

using FHIR version '4.0.1'

//codesystem "Custom_Codes": 'http://fhir.org/guides/who/hiv-dak/CodeSystem/HIV-DAKConcepts'
codesystem "HIV_DAK_Codes": 'http://fhir.org/guides/who/hiv-dak/CodeSystem/HIV-DAKConcepts'
//valueset "TestresultofHIVassay1Codes": 'http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de95'
valueset "Assay 1 reactive": 'http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de95'
valueset "Assay 1": 'http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de90'
valueset "Assay 2": 'http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de91'
valueset "Assay 2 reactive": 'http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-e-de205'
valueset "Assay 2 non-reactive": 'http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-e-de206'
valueset "Assay 3": 'http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de92'
valueset "Assay 1 repeated": 'http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de93'
valueset "HIVtesttypeCodes": 'http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de82'
valueset "Reactive": 'http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de103'
valueset "Non-reactive": 'http://fhir.org/guides/who/hiv-dak/ValueSet/hiv-b-de104'

include FHIRHelpers version '4.0.1'
include WHOCommon called WCom


//code "Assay 1 Reactive": 'HIV.B.DE95' from "TestresultofHIVassay1Codes" display 'Assay 1 reactive'
//code "Reactive": 'HIV.B.DE103' from "HIV_DAK_Codes" display 'Reactive'
//code "Non-reactive": 'HIV.B.DE104' from "HIV_DAK_Codes" display 'Non-reactive'
code "Rapid diagnostic test for HIV": 'HIV.B.DE82' from "HIV_DAK_Codes" display 'Rapid diagnostic test for HIV'
code "Enzyme immunoassay for HIV": 'HIV.B.DE83' from "HIV_DAK_Codes" display 'Enzyme immunoassay for HIV'
//code "Assay 1": 'HIV.B.DE90' from "HIV_DAK_Codes" display 'Assay 1'
//code "Assay 2": 'HIV.B.DE91' from "HIV_DAK_Codes" display 'Assay 2'
//code "Assay 3": 'HIV.B.DE92' from "HIV_DAK_Codes" display 'Assay 3'
//code "Assay 1 repeated": 'HIV.B.DE93' from "HIV_DAK_Codes" display 'Assay 1 repeated'
//code "Assay 2 reactive": 'HIV.E.DE205' from "HIV_DAK_Codes" display 'Assay 2 reactive'
//code "Assay 2 non-reactive": 'HIV.E.DE206' from "HIV_DAK_Codes" display 'Assay 2 non-reactive'
//code "Assay 1 reactive": 'HIV.B.DE95' from "HIV_DAK_Codes" display 'Assay 2 non-reactive'

 /*valueset "Assay 2 reactive": 'HIV.E.DE205'*/
  
context Patient

define "Age_greater_than_18_months":
  AgeInMonthsAt(Today()) >= 18


define "Report as HIV-negative":
  [Observation] O
  //@triggeredBy order for Assay 1
  with [ServiceRequest] SR
      such that O.basedOn.references(SR) and SR.code in "Assay 1"
  where (O.status in { 'final', 'amended' }
  and O.code in "HIVtesttypeCodes"
  and O.value in "Non-reactive"
  and "Age_greater_than_18_months")

/* Output observation as HIV negative */
/*@triggeredBy Assay 1 */

define "Should Continue with Performing HIV Assay 2":
  [Observation] O
  //@triggeredBy  ~ order for Assay 1
 with [ServiceRequest] SR
      such that O.basedOn.references(SR) and SR.code in "Assay 1"
  where (O.status in { 'final', 'amended' }
  and O.code in "HIVtesttypeCodes"
  and O.value in  "Reactive" 
  and "Age_greater_than_18_months")

/* Output Service Request for Assay 2 */

define "Should Continue with Performing HIV Assay 1 repeated":
  [Observation] O
  //@triggeredBy  ~ "Continue with performing HIV 'Assay 2'"
  with [ServiceRequest] SR
      such that O.basedOn.references(SR) and SR.reasonCode in "Assay 1 reactive" and SR.code in "Assay 2"
  where (O.status in { 'final', 'amended' }
  and O.code in "HIVtesttypeCodes"
  and O.value in "Non-reactive"
  and "Age_greater_than_18_months")

/* Output Service Request for Continue with performing HIV 'Assay 1 repeated' */

  define "Should Continue with Performing HIV Assay 3":
  [Observation] O
  //@triggeredBy  ~ "Continue with performing HIV 'Assay 2'"
  with [ServiceRequest] SR
      such that O.basedOn.references(SR) and SR.reasonCode in "Assay 1 reactive" and SR.code in "Assay 2"
  where (O.status in { 'final', 'amended' }
  and O.code in "HIVtesttypeCodes" 
  and O.value in "Reactive"
  and "Age_greater_than_18_months")

  /* Output Service Request for Continue with performing Assay 3 */

define "Report as HIV-negative after assay 1 repeated":
  [Observation] O
  //@triggeredBy  ~ "Continue with performing HIV 'Assay 1 repeated'"
    with [ServiceRequest] SR
      such that O.basedOn.references(SR) and SR.reasonCode in "Assay 2 non-reactive" and SR.code in "Assay 1 repeated"
  where (O.status in { 'final', 'amended' }
  and O.code in "HIVtesttypeCodes" 
  and O.value in "Non-reactive"
  and "Age_greater_than_18_months")

/* Output observation as HIV negative */

define "Report as HIV-inconclusive after assay 1 repeated":
  [Observation] O
  //@triggeredBy  ~ "Continue with performing HIV 'Assay 1 repeated'"
    with [ServiceRequest] SR
      such that O.basedOn.references(SR) and SR.reasonCode in "Assay 2 non-reactive" and SR.code in "Assay 1 repeated"
  where (O.status in { 'final', 'amended' }
  and O.code in "HIVtesttypeCodes"
  and O.value in "Reactive"
  and "Age_greater_than_18_months")

/* Output observation as 'HIV-inconclusive' */
/* Output PlanDefinition as Schedule retest date on "Visit date" + 14 days */

define "Report as HIV-inconclusive after assay 3":
  [Observation] O
  //@triggeredBy  ~ "Continue with performing HIV 'Assay 3'"
      with [ServiceRequest] SR
      such that O.basedOn.references(SR) and SR.reasonCode in "Assay 2 reactive" and SR.code in "Assay 3"
  where (O.status in { 'final', 'amended' }
  and O.code in "HIVtesttypeCodes"
  and O.value in "Non-reactive"
  and "Age_greater_than_18_months")

/* Output observation as 'HIV-inconclusive' */
/* Output PlanDefinition as Schedule retest date on "Visit date" + 14 days */

define "Report as HIV-positive":
  [Observation] O
  //@triggeredBy  ~ "Continue with performing HIV 'Assay 3'"
        with [ServiceRequest] SR
      such that O.basedOn.references(SR) and SR.reasonCode in "Assay 2 reactive" and SR.code in "Assay 3"
  where (O.status in { 'final', 'amended' }
  and O.code in "HIVtesttypeCodes"
  and O.value in "Reactive"
  and "Age_greater_than_18_months")
  

/* Output observation as 'HIV-positive' */

/*
[Observation] needs to have the following codes and elements
    where O.status ~ {'final', 'amended'}
    and O.value ~ HIC."HIV-positive"
    */
Content: application/elm+xml
Encoded data (146464 characters)
Content: application/elm+json
Encoded data (270612 characters)