Quality Measure Implementation Guide
2.0.0-ballot - STU 2 Ballot

Quality Measure Implementation Guide - Downloaded Version null See the Directory of published versions

## Library: Supporting Evidence Example

Official URL: http://hl7.org/fhir/uv/cqm/Library/SupportingEvidenceExample | Version: 2.0.0-ballot | Highlight text changes?
Standards status: Informative Active as of 2026-04-07 | Maturity Level: 1 | Computable Name: SupportingEvidenceExample
Other Identifiers: OID:2.16.840.1.113883.4.642.40.61.28.42

SupportingEvidenceExample logic.

Metadata
Title | Supporting Evidence Example
Version | 2.0.0-ballot
Identifier | urn:oid:2.16.840.1.113883.4.642.40.61.28.42
Jurisdiction | 001 from http://unstats.un.org/unsd/methods/m49/m49.htm
Topic | FHIR
Topic | CQL
Steward (Publisher) | HL7 International / Clinical Quality Information
Description | SupportingEvidenceExample logic.
Type | logic-library from http://terminology.hl7.org/CodeSystem/library-type
Dependency | Description: Library FHIRHelpers Resource: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1 Canonical URL: `http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1`
Data Requirement | Type: Patient Profile(s): Patient
Data Requirement | Type: Encounter Profile(s): Encounter
Parameters
Name | Use | Card. | Type | Documentation
Measurement Period | In | 0..1 | Period |
practitionerParam | In | 0..1 | string |
Patient | Out | 0..1 | Patient |
All Encounters | Out | 0..* | Encounter |
Initial Population Boolean | Out | 0..1 | boolean |
Denominator Boolean | Out | 0..1 | boolean |
Encounter Cancelled | Out | 0..* | Encounter |
Denominator Exclusion Boolean | Out | 0..1 | boolean |
Encounter InProgress | Out | 0..* | Encounter |
Denominator Exception Boolean | Out | 0..1 | boolean |
Encounter Arrived | Out | 0..* | Encounter |
Numerator Exclusion Boolean | Out | 0..1 | boolean |
Encounters in Period | Out | 0..* | Encounter |
Numerator Boolean | Out | 0..1 | boolean |
Measure Population Exclusions Boolean | Out | 0..1 | boolean |
Measure Population Boolean | Out | 0..1 | boolean |
Initial Population Resource | Out | 0..* | Encounter |
Denominator Resource | Out | 0..* | Encounter |
Denominator Exclusion Resource | Out | 0..* | Encounter |
Denominator Exception Resource | Out | 0..* | Encounter |
Numerator Exclusion Resource | Out | 0..* | Encounter |
Numerator Resource | Out | 0..* | Encounter |
Measure Population Exclusions Resource | Out | 0..* | Encounter |
Measure Population Resource | Out | 0..* | Encounter |
date of compliance | Out | 0..1 | Period |
always false | Out | 0..1 | boolean |
always true | Out | 0..1 | boolean |
list of boolean | Out | 0..* | boolean |
list of dates | Out | 0..* | date |
PatientRes | Out | 0..* | Patient |
list of string | Out | 0..* | string |
interval | Out | 0..1 | Period |
TestIntervalList | Out | 0..* | Period |
TestDecimalList | Out | 0..* | decimal |
TestFloatValue | Out | 0..1 | decimal |
list of numbers | Out | 0..* | integer |
string | Out | 0..1 | string |
date | Out | 0..1 | date |
datetime | Out | 0..1 | dateTime |
NullExample | Out | 0..1 | Resource |
EmptyListExample | Out | 0..* | Resource |
number | Out | 0..1 | integer |
decimal | Out | 0..1 | decimal |
test tuple | Out | 0..1 | Resource |
list test tuple | Out | 0..* | Resource |
SDE Sex | Out | 0..1 | Coding |
test code | Out | 0..1 | Coding |
SDE Encounters | Out | 0..* | Encounter |
Gender Stratification | Out | 0..1 | Coding |
Encounter Not Finished | Out | 0..* | Encounter |
boolean strat not finished | Out | 0..1 | boolean |
resource strat not finished | Out | 0..* | Encounter |
Age | Out | 0..1 | integer |
Date | Out | 0..1 | Period |
ip date | Out | 0..1 | Period |
den date | Out | 0..1 | Period |
num date | Out | 0..1 | Period |
exc date | Out | 0..1 | Period |
Library Content
CQL Content |
    library SupportingEvidenceExample

    using FHIR version '4.0.1'

    include hl7.fhir.uv.cql.FHIRHelpers version '4.0.1' called FHIRHelpers

    parameter "Measurement Period" Interval<DateTime> default Interval[@2024-01-01T00:00:00, @2024-12-31T23:59:59]

    // cql parameter that can pass in fhir id of an encounter
    parameter practitionerParam String

    context Patient

    // boolean population results
    // has matching encounter

    define "Initial Population Boolean":
      exists "All Encounters"

    define "Denominator Boolean":
        "Initial Population Boolean"

    define "Denominator Exclusion Boolean":
      exists "Encounter Cancelled"

    define "Denominator Exception Boolean":
      exists "Encounter InProgress"

    define "Numerator Exclusion Boolean":
      exists "Encounter Arrived"

    define "Numerator Boolean":
      exists "Encounters in Period"

    define "Measure Population Exclusions Boolean":
        "Denominator Exclusion Boolean"

    define "Measure Population Boolean":
        "Denominator Boolean"

    // resource population results
    // qty of matching encounters

    define "Initial Population Resource":
        "All Encounters"

    define "Denominator Resource":
        "Initial Population Resource"

    define "Denominator Exclusion Resource":
        "Encounter Cancelled"

    define "Denominator Exception Resource":
        "Encounter InProgress"

    define "Numerator Exclusion Resource":
        "Encounter Arrived"

    define "Numerator Resource":
        "Encounters in Period"

    define "Measure Population Exclusions Resource":
        "Denominator Exclusion Resource"

    define "Measure Population Resource":
        "Denominator Resource"

    // for prospective gap calculations
    define "date of compliance":
        "Measurement Period"

    // cql to force results
    define "always false":
        false

    define "always true":
        true

    define "list of boolean":
        {true, false, true}

    define "list of dates":
      { @2024-01-01, @2024-01-02, @2024-01-03 }

    define "PatientRes":
        [Patient] P

    define "list of string":
        {'test1', 'test2', 'test3'}

    define "interval":
        Interval[@2024-01-01T00:00:00, @2024-12-31T23:59:59]

    define "TestIntervalList":
      {
        Interval[@2024-01-01T00:00:00, @2024-01-31T23:59:59],
        Interval[@2024-02-01T00:00:00, @2024-02-29T23:59:59]
      }

    define "TestDecimalList":
      { 1.5, 2.75, 1.0 / 3.0 }

    define "TestFloatValue":
      1.0 / 3.0

    define "list of numbers":
      {31, 88, 11}

    define "string":
      'string test'

    define "date":
      @2026-01-01

    define "datetime":
      @2026-12-30T23:59:59

    define "NullExample":
             null

    define "EmptyListExample":
      { }

    define "number":
      31

    define "decimal":
      31.31

    define "test tuple":
      {
        number: "number",
        dates: "list of dates",
        birthYear: "string"
      }

    define "list test tuple":
      {
        {
          number: "number",
          dates: "list of dates",
          birthYear: "string"
        }, {
          number: "number",
          dates: "list of dates",
          birthYear: "string"
        }
      }

    define "test code":
        "SDE Sex"

    // sde single value

    define "SDE Sex":
      case
          when Patient.gender = 'male' then Code { code: 'M', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Male' }
          when Patient.gender = 'female' then Code { code: 'F', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Female' }
          else null
        end

    // sde list of values

     define "SDE Encounters":
        "All Encounters"

    // Continuous Variable
    // number of hours for encounter

    define function "MeasureObservation"(encounter Encounter):
        duration in minutes of encounter.period

    // Cont Variable
    // boolean basis age in years to end of measurementPeriod

    define function "MeasureObservationBoolean"():
             AgeInYearsAt(end of "Measurement Period")
    // component stratifier

    define "Gender Stratification":
      "SDE Sex"

    // boolean criteria stratifier

    define "boolean strat not finished":
      exists "Encounter Not Finished"

    // cql parameter boolean criteria stratifier

    // resource criteria stratifier

    define "resource strat not finished":
        "Encounter Not Finished"

    // main criteria logic

    define "All Encounters":
         [Encounter] E

    define "Encounters in Period":
         [Encounter] E
           where E.period during "Measurement Period" and E.status='finished'

    define "Encounter Cancelled":
        [Encounter] E
           where E.status = 'cancelled'

    define "Encounter InProgress":
        [Encounter] E
           where E.status = 'in-progress'

    define "Encounter Arrived":
        [Encounter] E
           where E.status = 'arrived'

    define "Encounter Not Finished":
        [Encounter] E
            where E.status != 'finished'

    define "Age":
        AgeInYearsAt(start of "Measurement Period")

    define "Date":
        Interval[@2024-02-01T00:00:00, @2024-10-31T23:59:59]

    define "ip date":
        "Date"

    define "den date":
        "Date"

    define "num date":
        "Date"

    define "exc date":
        "Date"
ELM XML Content |
    Encoded data
ELM JSON Content |
    Encoded data
Generated using version 0.5.4 of the sample-content-ig Liquid templates