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/ViralLoadStatusLibrary Version: 1.0.1
Draft as of 2024-11-17 Computable Name: ViralLoadStatusLibrary

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

Generated Narrative: Library ViralLoadStatusLibrary

Related Artifacts

Depends OnLibrary FHIRHelpershttp://jembi.org/fhir/Library/FHIRHelpers|4.0.1
Depends OnLibrary FHIRCommonhttp://jembi.org/fhir/Library/FHIRCommon|4.0.1
Depends OnLibrary HIVChttp://jembi.org/fhir/Library/HIVCommon
Depends OnLibrary LOCALChttp://jembi.org/fhir/Library/LocalCommon

Parameters

Measurement Periodin01Period
Patientout01Patient
Most Recent Viral Load Dateout01dateTime
Total Viral Load Observationsout01integer
Most Recent Viral Load Observationout01Observation
Most Recent Viral Load Indicationout01string

Contents

text/cql

library ViralLoadStatus version '0.1.0'

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1'
include 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 not shown - (application/elm+xml, size = 23Kb )

Content not shown - (application/elm+json, size = 43Kb )