Starter FHIR Implementation Guide
1.0.1 - draft International flag

Starter FHIR Implementation Guide, published by Jembi Health Systems. This guide is not an authorized publication; it is the continuous build for version 1.0.1 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/jembi/Starter-FHIR-IG/ and changes regularly. See the Directory of published versions

Library: CQL - HIV Common (Experimental)

Official URL: http://jembi.org/fhir/Library/HIVCommon Version: 1.0.1
Active as of 2024-12-11 Computable Name: HIVCommon

Common CQL for HIV calculations.

Title: CQL - HIV Common
Id: HIVCommon
Version: 1.0.1
Url: CQL - HIV Common
Experimental: true
Type:

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

code: logic-library

Date: 2024-12-11 06:22:36+0000
Publisher: Jembi Health Systems
Description:

Common CQL for HIV calculations.

Jurisdiction: 001
Related Artifacts:

Dependencies

Parameters:
NameTypeMinMaxIn/Out
PatientPatient01Out
Data Requirements:
TypeProfileMSCode Filter
Observation http://hl7.org/fhir/StructureDefinition/Observation code filter:
path: code

system: http://snomed.info/sct

code: 315124004

Observation http://hl7.org/fhir/StructureDefinition/Observation code filter:
path: code
value set: http://jembi.org/fhir/ValueSet/hiv-test-type-value-set
Observation http://hl7.org/fhir/StructureDefinition/Observation code filter:
path: code

system: http://loinc.org

code: 47248-0

Content: text/cql
library HIVCommon version '1.0.1'

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
//include fhir.cqf.common.FHIRCommon


valueset "HIV Test Types": 'http://jembi.org/fhir/ValueSet/hiv-test-type-value-set'
valueset "ARV Drugs": 'http://jembi.org/fhir/ValueSet/arv-treatment-value-set'

codesystem "Observation Category Codes": 'http://terminology.hl7.org/CodeSystem/observation-category'
codesystem "SNOMED CT Codes": 'http://snomed.info/sct'
codesystem "LOINC Codes": 'http://loinc.org'

code "Laboratory Observation Category": 'laboratory' from "Observation Category Codes"
code "HIV Viral Load Observation Code": '315124004' from "SNOMED CT Codes"
code "HIV+ Code": 'LA24955-9' from "LOINC Codes"
code "Initiated ART Code": '63936-9' from "LOINC Codes"
code "ART Status Code": '47248-0' from "LOINC Codes"

context Patient

define function ViralLoadResult(period Interval<DateTime>):
  [Observation: "HIV Viral Load Observation Code"] O
    where exists ( O.category C
        where C = "Laboratory Observation Category"
    )
      and O.status = 'final'
      and ( O.value as Quantity ).value is not null
      and ( ( O.effective as dateTime ).value during period
          or ( O.effective as Period ) starts during period
      )

define function HIVPostivePatients(period Interval<Date>):
  [Observation: code in "HIV Test Types"] O
    where ( O.value as CodeableConcept ) = "HIV+ Code"
      and ( ( O.effective as dateTime ).value during period
          or ( O.effective as Period ) starts during period
      )

define function InitiatedART(period Interval<Date>):
  [Observation: "ART Status Code"] O
    where ( O.value as CodeableConcept ) = "Initiated ART Code"
      and ( ( O.effective as dateTime ).value during period
          or ( O.effective as Period ) starts during period
      )
Content: application/elm+xml
Encoded data (66240 characters)
Content: application/elm+json
Encoded data (123144 characters)