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

: Stratification Encounter Example - XML Representation

Page standards status: Informative Maturity Level: 1

Raw xml | Download


<Library xmlns="http://hl7.org/fhir">
  <id value="StratificationEncounterExample"/>
  <text>
    <status value="extensions"/>
    <div xmlns="http://www.w3.org/1999/xhtml">
  <table class="narrative-table">
    <tbody>
<tr>


<th colspan="2" scope="row" class="row-header">Metadata</th>


</tr>

<tr>


<th scope="row" class="row-header">Title</th>



<td class="content-container">Stratification Encounter Example</td>


</tr>



<tr>


<th scope="row" class="row-header">Version</th>



<td class="content-container">2026.0.0</td>


</tr>
















<tr>


<th scope="row" class="row-header">Topic</th>



<td class="content-container">FHIR
</td>


</tr>

<tr>


<th scope="row" class="row-header">Topic</th>



<td class="content-container">CQL
</td>


</tr>













<tr>


<th scope="row" class="row-header">Description</th>



<td class="content-container"><div><p>StratificationEncounterExample logic.</p>
</div></td>


</tr>






<tr>


<th scope="row" class="row-header">Type</th>



<td class="content-container">
    logic-library from <a href="http://terminology.hl7.org/7.0.1/CodeSystem-library-type.html">http://terminology.hl7.org/CodeSystem/library-type</a> 


</td>


</tr>




  <tr>


<th colspan="2" scope="row" class="row-header">Library Content</th>


</tr>
  
    
    <tr>
      <th scope="row" class="row-header">CQL Content</th>
      <td>
        <a name="cql-content"> </a>
        <pre style="border: none;" class="content-container highlight language-cql"><code class="language-cql">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 &quot;Measurement Period&quot; Interval&lt;DateTime&gt;
  default Interval[@2026-01-01T00:00:00.000Z, @2027-01-01T00:00:00.000Z)

context Patient

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

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

define &quot;Initial Population&quot;:
  &quot;Well-Visit Encounter&quot;

define &quot;Denominator&quot;:
  &quot;Well-Visit Encounter&quot;

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

/* Criteria-based Stratification */

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

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

define &quot;Stratifier P41Y--P9999Y&quot;:
  &quot;Well-Visit Encounter&quot; E
    where Patient.ageInYearsAt(end of E.period) &gt;= 41

/* 
  Value-based Stratification 
  
  Note that for value-based stratification of a non-subject-based measure, 
  the expression may be a definition as &quot;Gender Stratifier&quot;, or a function 
  as &quot;Age Range Stratifier&quot;(Encounter)
*/

define function &quot;Gender Stratifier&quot;:
  Patient.gender

define function &quot;Age Range Stratifier&quot;(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) &gt;= 41 then 'P41Y--P9999Y'
    else null
  end
</code></pre>
      </td>
    </tr>
    
    
    
  

<tr>
  <th colspan="2" scope="row" class="row-header">Generated using version 0.5.0 of the sample-content-ig Liquid templates</th>
</tr>

    </tbody>
  </table>
</div>
  </text>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm">
    <valueInteger value="1"/>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/structuredefinition-wg">
    <valueCode value="cds"/>
  </extension>
  <extension
             url="http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status">
    <valueCode value="informative"/>
  </extension>
  <url value="https://madie.cms.gov/Library/StratificationEncounterExample"/>
  <version value="2026.0.0"/>
  <name value="StratificationEncounterExample"/>
  <title value="Stratification Encounter Example"/>
  <status value="active"/>
  <experimental value="false"/>
  <type>
    <coding>
      <system value="http://terminology.hl7.org/CodeSystem/library-type"/>
      <code value="logic-library"/>
    </coding>
  </type>
  <date value="2026-02-05T16:14:32+00:00"/>
  <description value="StratificationEncounterExample logic."/>
  <topic>
    <text value="FHIR"/>
  </topic>
  <topic>
    <text value="CQL"/>
  </topic>
  <content>
    <contentType value="text/cql"/>
    <data
          value="bGlicmFyeSBTdHJhdGlmaWNhdGlvbkVuY291bnRlckV4YW1wbGUKCnVzaW5nIEZISVIgdmVyc2lvbiAnNC4wLjEnCgppbmNsdWRlIGhsNy5maGlyLnV2LmNxbC5GSElSSGVscGVycyB2ZXJzaW9uICc0LjAuMScKaW5jbHVkZSBobDcuZmhpci51di5jcWwuRkhJUkNvbW1vbiB2ZXJzaW9uICcyLjAuMCcKCmluY2x1ZGUgUGF0aWVudENvbW1vbgoKcGFyYW1ldGVyICJNZWFzdXJlbWVudCBQZXJpb2QiIEludGVydmFsPERhdGVUaW1lPgogIGRlZmF1bHQgSW50ZXJ2YWxbQDIwMjYtMDEtMDFUMDA6MDA6MDAuMDAwWiwgQDIwMjctMDEtMDFUMDA6MDA6MDAuMDAwWikKCmNvbnRleHQgUGF0aWVudAoKZGVmaW5lICJXZWxsLVZpc2l0IEVuY291bnRlciI6CiAgW0VuY291bnRlcl0gRQogICAgd2hlcmUgRS5zdGF0dXMgPSAnZmluaXNoZWQnCiAgICAgIGFuZCBFLnBlcmlvZCBlbmRzIGR1cmluZyBkYXkgb2YgIk1lYXN1cmVtZW50IFBlcmlvZCIKCmRlZmluZSAiQmxvb2QgUHJlc3N1cmUgT2JzZXJ2YXRpb24iOgogIFt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