dQM QICore Content Implementation Guide
2026.0.0 - CI Build

dQM QICore Content Implementation Guide, published by cqframework. This guide is not an authorized publication; it is the continuous build for version 2026.0.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/dqm-content-qicore-2026/ and changes regularly. See the Directory of published versions

## Library: Stratification Encounter Example

Official URL: https://madie.cms.gov/Library/StratificationEncounterExample | Version: 2026.0.0
Standards status: Informative | Maturity Level: 1 | Computable Name: StratificationEncounterExample

StratificationEncounterExample logic.

Metadata
Title | Stratification Encounter Example
Version | 2026.0.0
Topic | FHIR
Topic | CQL
Description | StratificationEncounterExample logic.
Type | logic-library from http://terminology.hl7.org/CodeSystem/library-type
Parameter | Name: Measurement Period Use: In Min Cardinality: 0 Max Cardinality: 1 Type: Period
Parameter | Name: Patient Use: Out Min Cardinality: 0 Max Cardinality: 1 Type: Patient
Parameter | Name: Well-Visit Encounter Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter
Parameter | Name: Blood Pressure Observation Use: Out Min Cardinality: 0 Max Cardinality: * Type: Observation
Parameter | Name: Initial Population Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter
Parameter | Name: Denominator Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter
Parameter | Name: Numerator Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter
Parameter | Name: Stratifier P0Y--P21Y Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter
Parameter | Name: Stratifier P21Y--P41Y Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter
Parameter | Name: Stratifier P41Y--P9999Y Use: Out Min Cardinality: 0 Max Cardinality: * Type: Encounter
Data Requirement | Type: Encounter Profile(s): Encounter
Data Requirement | Type: Observation Profile(s): Observation
Library Content
CQL Content |
    library StratificationEncounterExample

    using FHIR version '4.0.1'

    include hl7.fhir.uv.cql.FHIRHelpers version '4.0.1'
    include hl7.fhir.uv.cql.FHIRCommon version '2.0.0'

    include PatientCommon

    parameter "Measurement Period" Interval<DateTime>
      default Interval[@2026-01-01T00:00:00.000Z, @2027-01-01T00:00:00.000Z)

    context Patient

    define "Well-Visit Encounter":
      [Encounter] E
        where E.status = 'finished'
          and E.period ends during day of "Measurement Period"

    define "Blood Pressure Observation":
      [Observation] O
        where O.status in { 'final', 'amended', 'corrected' }
          and O.issued during day of "Measurement Period"

    define "Initial Population":
      "Well-Visit Encounter"

    define "Denominator":
      "Well-Visit Encounter"

    define "Numerator":
      "Well-Visit Encounter" E
        with "Blood Pressure Observation" O
          such that O.issued during E.period

    /* Criteria-based Stratification */

    define "Stratifier P0Y--P21Y":
      "Well-Visit Encounter" E
        where Patient.ageInYearsAt(end of E.period) between 0 and 20

    define "Stratifier P21Y--P41Y":
      "Well-Visit Encounter" E
        where Patient.ageInYearsAt(end of E.period) between 21 and 40

    define "Stratifier P41Y--P9999Y":
      "Well-Visit Encounter" E
        where Patient.ageInYearsAt(end of E.period) >= 41

    /* Value-based Stratification */

    define function "Gender Stratifier"(encounter Encounter):
      Patient.gender

    define function "Age Range Stratifier"(encounter Encounter):
      case
        when Patient.ageInYearsAt(start of encounter.period) between 0 and 20 then 'P0Y--P21Y'
        when Patient.ageInYearsAt(start of encounter.period) between 21 and 40 then 'P21Y--P41Y'
        when Patient.ageInYearsAt(start of encounter.period) >= 41 then 'P41Y--P9999Y'
        else null
      end
ELM XML Content |
    Encoded data (70000 characters)
ELM JSON Content |
    Encoded data (137680 characters)
Generated using version 0.5.0 of the sample-content-ig Liquid templates