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: 2025-09-26 07:23:41+0000 Publisher: Jembi Health Systems Description: Checks for the most recent viral load and determines the suppression status. Jurisdiction: 001 Related Artifacts: Dependencies CQL - HIV Common CQL - Local Common Parameters: Name Type Min Max In/Out Measurement Period Period 0 1 In Patient Patient 0 1 Out Most Recent Viral Load Date dateTime 0 1 Out Total Viral Load Observations integer 0 1 Out Most Recent Viral Load Observation Observation 0 1 Out Most Recent Viral Load Indication string 0 1 Out Content: text/cql library ViralLoadStatus 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 (33400 characters) Content: application/elm+json Encoded data (64536 characters)
Checks for the most recent viral load and determines the suppression status.