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 - Most Recent Viral Load Status (Experimental)

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

Checks for the most recent viral load and determines the suppression status.

Title: CQL - Most Recent Viral Load Status
Id: ViralLoadStatus
Version: 1.0.1
Url: CQL - Most Recent Viral Load Status
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:

Checks for the most recent viral load and determines the suppression status.

Jurisdiction: 001
Related Artifacts:

Dependencies

Parameters:
NameTypeMinMaxIn/Out
Measurement PeriodPeriod01In
PatientPatient01Out
Most Recent Viral Load DatedateTime01Out
Total Viral Load Observationsinteger01Out
Most Recent Viral Load ObservationObservation01Out
Most Recent Viral Load Indicationstring01Out
Content: text/cql
library ViralLoadStatus version '1.0.1'

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
//include fhir.cqf.common.FHIRCommon version '4.0.1'
include HIVCommon called HIVC
include LocalCommon called LOCALC

parameter "Measurement Period" Interval<DateTime>
default Interval[@2023-12-01, @2023-12-31] //For testing only

context Patient

define "Most Recent Viral Load Date":
  LOCALC.ObservationDate(LOCALC.MostRecent ( HIVC.ViralLoadResult ( "Measurement Period" ) ))

define "Total Viral Load Observations":
  Count ( HIVC.ViralLoadResult ( "Measurement Period" ) )

define "Most Recent Viral Load Observation":
  LOCALC.MostRecent ( HIVC.ViralLoadResult ( "Measurement Period" ) )

define "Most Recent Viral Load Indication":
  SuppressionStatus(LOCALC.MostRecent(HIVC.ViralLoadResult("Measurement Period")))

define function SuppressionStatus(obs FHIR.Observation):
  if ( obs.value as Quantity ).value > 1000 then 'Unsuppressed'
    else if ( obs.value as Quantity ).value <= 1000 then 'Suppressed' 
    else null
Content: application/elm+xml
Encoded data (31204 characters)
Content: application/elm+json
Encoded data (58624 characters)