US Situational Awareness Framework for Reporting (US SAFR) Implementation Guide
1.0.0-ballot - STU 1 ballot United States of America flag

This page is part of the US Situational Awareness Framework for Reporting (US SAFR) Implementation Guide (v1.0.0-ballot: STU 1 Ballot 1) based on FHIR (HL7® FHIR® Standard) R4. No current official version has been published yet. For a full list of available versions, see the Directory of published versions

Library: Library - HRD Measure Example

Official URL: http://example.org/fhir/Library/HRDMeasureLibrary Version: 1.0.0-ballot
Standards status: Informative Computable Name: HRDMeasureLibrary
Other Identifiers: OID:2.16.840.1.113883.4.642.40.53.28.3

Usage:Clinical Focus: Disease

This library contains CQL logic for evaluating structural measures related to hospital respiratory disease reporting capabilities

Title: Library - HRD Measure Example
Id: HRDMeasureLibrary
Version: 1.0.0-ballot
Url: http://example.org/fhir/Library/HRDMeasureLibrary

urn:oid:2.16.840.1.113883.4.642.40.53.28.3

Type:

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

code: logic-library

Date: 2025-03-13
Publisher: HL7 International / Public Health
Description:

This library contains CQL logic for evaluating structural measures related to hospital respiratory disease reporting capabilities

Use Context:
code value
focus
Jurisdiction: US
Related Artifacts:

Dependencies

Parameters:
NameTypeMinMaxIn/Out
Measurement PeriodPeriod11In
Data Requirements:
TypeProfileMust SupportCode Filter
Device Device code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1146.1123
Device Device code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.102.12.1012
Device Device code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1146.1124|20240123
Device Device code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1146.1125
Device Device code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.5.1001
Location Location code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.87
Location Location code filter:
path: physicalType.coding.code

system: http://terminology.hl7.org/CodeSystem/location-physical-type

code: bd

DocumentReference DocumentReference code filter:
path: type.coding.code

system: http://loinc.org

code: 11516-2

Communication Communication code filter:
path: category.coding.code

system: http://terminology.hl7.org/CodeSystem/communication-category

code: notification

Content: text/cql
library HRDMeasureStructureLibrary version '1.0.0'

using FHIR version '4.0.1'

include FHIRHelpers version '4.0.1' called FHIRHelpers

// Terminology definitions
codesystem "LOINC": 'http://loinc.org'
codesystem "SNOMED CT": 'http://snomed.info/sct&
codesystem "ICD-10-CM": 'http://hl7.org/fhir/sid/icd-10-cm'

// Value sets
valueset "Respiratory Specimen Collection Devices": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1146.1125'
valueset "COVID-19 Tests": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1146.1123'
valueset "Influenza Tests": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.102.12.1012'
valueset "RSV Tests": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1146.1124'
valueset "ICU Location Types": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.87'
valueset "Ventilator Device Types": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.5.1001'

// Parameter for measurement period
parameter "Measurement Period" Interval<Date>
  default Interval[@2025-03-01, @2025-03-07]

context Patient

// STRUCTURE MEASURE COMPONENTS
// For a structure measure, we assess capabilities, resources and organizational structures

// 1. Test for the presence of respiratory testing capabilities
define "Has COVID-19 Testing Capability":
  exists (
    [Device] Device
      where Device.type.coding in "COVID-19 Tests"
        and Device.status = 'active'
  )

define "Has Influenza Testing Capability":
  exists (
    [Device] Device
      where Device.type.coding in "Influenza Tests"
        and Device.status = 'active'
  )

define "Has RSV Testing Capability":
  exists (
    [Device] Device
      where Device.type.coding in "RSV Tests"
        and Device.status = 'active'
  )

define "Has Specimen Collection Capabilities":
  exists (
    [Device] Device
      where Device.type.coding in "Respiratory Specimen Collection Devices"
        and Device.status = 'active'
  )

define "Has ICU Locations":
  exists (
    [Location] Location
      where Location.type.coding in "ICU Location Types"
        and Location.status = 'active'
  )

define "Has Ventilator Resources":
  exists (
    [Device] Device
      where Device.type.coding in "Ventilator Device Types"
        and Device.status = 'active'
  )

define "Has HRD Reporting Protocol":
  exists (
    [DocumentReference] D
      where D.type.coding.code in {'11516-2'} // LOINC for infection control protocol
        and D.status = 'current'
        and D.description contains 'NHSN'
        and D.description contains 'HRD'
  )

// CONTINUOUS VARIABLE CALCULATIONS

// Hospital capacity metrics
define "Total Bed Capacity":
  Sum(
    [Location] Location
      where Location.status = 'active'
        and Location.physicalType.coding.code = 'bd'
      return (
        Location.extension E
          where E.url = 'http://hl7.org/fhir/StructureDefinition/location-bed-count'
          return E.valueInteger
      ).valueInteger
  )

define "ICU Bed Capacity":
  Sum(
    [Location] Location
      where Location.status = 'active'
        and Location.type.coding in "ICU Location Types"
        and Location.physicalType.coding.code = 'bd'
      return (
        Location.extension E
          where E.url = 'http://hl7.org/fhir/StructureDefinition/location-bed-count'
          return E.valueInteger
      ).valueInteger
  )

define "Ventilator Count":
  Count(
    [Device] Device
      where Device.type.coding in "Ventilator Device Types"
        and Device.status = 'active'
  )

// Weekly reporting compliance and metrics
define "Reporting Weeks in Measurement Period":
  Count(
    expand{2025-03-01, @2025-03-07, week}
  )

define "HRD Reports Submitted During Period":
  Count(
    [Communication] C
      where C.category.coding.code in {'notification'}
        and C.topic.text contains 'NHSN'
        and C.topic.text contains 'HRD'
        and C.sent during "Measurement Period"
  )

define "Weekly Reporting Compliance":
  "HRD Reports Submitted During Period" / "Reporting Weeks in Measurement Period"

// Structural readiness scores
define "Has All Testing Capabilities":
  if ("Has COVID-19 Testing Capability" and "Has Influenza Testing Capability" and "Has RSV Testing Capability")
    then 1
    else 0

define "Has Required Reporting Structure":
  if ("Has HRD Reporting Protocol") 
    then 1
    else 0

// Continuous variable for structural measure assessment
define "Structural Readiness Score":
  ("Has COVID-19 Testing Capability" as Integer +
   "Has Influenza Testing Capability" as Integer +
   "Has RSV Testing Capability" as Integer +
   "Has Specimen Collection Capabilities" as Integer +
   "Has ICU Locations" as Integer +
   "Has Ventilator Resources" as Integer +
    "Has HRD Reporting Protocol" as Integer) / 7.0 * 100.0

// Main measure calculation - now focusing on structural components and their ratings
define "Measure Population":
  true

define "Measure Observation":
  "Structural Readiness Score"