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 - JSON Representation

Page standards status: Informative Maturity Level: 1

Raw json | Download

{
  "resourceType" : "Library",
  "id" : "StratificationEncounterExample",
  "text" : {
    "status" : "extensions",
    "div" : "<div xmlns=\"http://www.w3.org/1999/xhtml\">\n  <table class=\"narrative-table\">\n    <tbody>\n<tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Metadata</th>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Title</th>\n\n\n\n<td class=\"content-container\">Stratification Encounter Example</td>\n\n\n</tr>\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Version</th>\n\n\n\n<td class=\"content-container\">2026.0.0</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Topic</th>\n\n\n\n<td class=\"content-container\">FHIR\n</td>\n\n\n</tr>\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Topic</th>\n\n\n\n<td class=\"content-container\">CQL\n</td>\n\n\n</tr>\n\n\n\n\n\n\n\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Description</th>\n\n\n\n<td class=\"content-container\"><div><p>StratificationEncounterExample logic.</p>\n</div></td>\n\n\n</tr>\n\n\n\n\n\n\n<tr>\n\n\n<th scope=\"row\" class=\"row-header\">Type</th>\n\n\n\n<td class=\"content-container\">\n    logic-library from <a href=\"http://terminology.hl7.org/7.0.1/CodeSystem-library-type.html\">http://terminology.hl7.org/CodeSystem/library-type</a> \n\n\n</td>\n\n\n</tr>\n\n\n\n\n  <tr>\n\n\n<th colspan=\"2\" scope=\"row\" class=\"row-header\">Library Content</th>\n\n\n</tr>\n  \n    \n    <tr>\n      <th scope=\"row\" class=\"row-header\">CQL Content</th>\n      <td>\n        <a name=\"cql-content\"> </a>\n        <pre style=\"border: none;\" class=\"content-container highlight language-cql\"><code class=\"language-cql\">library StratificationEncounterExample\n\nusing FHIR version '4.0.1'\n\ninclude hl7.fhir.uv.cql.FHIRHelpers version '4.0.1'\ninclude hl7.fhir.uv.cql.FHIRCommon version '2.0.0'\n\ninclude PatientCommon\n\nparameter &quot;Measurement Period&quot; Interval&lt;DateTime&gt;\n  default Interval[@2026-01-01T00:00:00.000Z, @2027-01-01T00:00:00.000Z)\n\ncontext Patient\n\ndefine &quot;Well-Visit Encounter&quot;:\n  [Encounter] E\n    where E.status = 'finished'\n      and E.period ends during day of &quot;Measurement Period&quot;\n\ndefine &quot;Blood Pressure Observation&quot;:\n  [Observation] O\n    where O.status in { 'final', 'amended', 'corrected' }\n      and O.issued during day of &quot;Measurement Period&quot;\n\ndefine &quot;Initial Population&quot;:\n  &quot;Well-Visit Encounter&quot;\n\ndefine &quot;Denominator&quot;:\n  &quot;Well-Visit Encounter&quot;\n\ndefine &quot;Numerator&quot;:\n  &quot;Well-Visit Encounter&quot; E\n    with &quot;Blood Pressure Observation&quot; O\n      such that O.issued during E.period\n\n/* Criteria-based Stratification */\n\ndefine &quot;Stratifier P0Y--P21Y&quot;:\n  &quot;Well-Visit Encounter&quot; E\n    where Patient.ageInYearsAt(end of E.period) between 0 and 20\n\ndefine &quot;Stratifier P21Y--P41Y&quot;:\n  &quot;Well-Visit Encounter&quot; E\n    where Patient.ageInYearsAt(end of E.period) between 21 and 40\n\ndefine &quot;Stratifier P41Y--P9999Y&quot;:\n  &quot;Well-Visit Encounter&quot; E\n    where Patient.ageInYearsAt(end of E.period) &gt;= 41\n\n/* \n  Value-based Stratification \n  \n  Note that for value-based stratification of a non-subject-based measure, \n  the expression may be a definition as &quot;Gender Stratifier&quot;, or a function \n  as &quot;Age Range Stratifier&quot;(Encounter)\n*/\n\ndefine function &quot;Gender Stratifier&quot;:\n  Patient.gender\n\ndefine function &quot;Age Range Stratifier&quot;(encounter Encounter):\n  case\n    when Patient.ageInYearsAt(start of encounter.period) between 0 and 20 then 'P0Y--P21Y'\n    when Patient.ageInYearsAt(start of encounter.period) between 21 and 40 then 'P21Y--P41Y'\n    when Patient.ageInYearsAt(start of encounter.period) &gt;= 41 then 'P41Y--P9999Y'\n    else null\n  end\n</code></pre>\n      </td>\n    </tr>\n    \n    \n    \n  \n\n<tr>\n  <th colspan=\"2\" scope=\"row\" class=\"row-header\">Generated using version 0.5.0 of the sample-content-ig Liquid templates</th>\n</tr>\n\n    </tbody>\n  </table>\n</div>"
  },
  "extension" : [
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fmm",
      "valueInteger" : 1
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-wg",
      "valueCode" : "cds"
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status",
      "valueCode" : "informative"
    }
  ],
  "url" : "https://madie.cms.gov/Library/StratificationEncounterExample",
  "version" : "2026.0.0",
  "name" : "StratificationEncounterExample",
  "title" : "Stratification Encounter Example",
  "status" : "active",
  "experimental" : false,
  "type" : {
    "coding" : [
      {
        "system" : "http://terminology.hl7.org/CodeSystem/library-type",
        "code" : "logic-library"
      }
    ]
  },
  "date" : "2026-02-05T16:14:32+00:00",
  "description" : "StratificationEncounterExample logic.",
  "topic" : [
    {
      "text" : "FHIR"
    },
    {
      "text" : "CQL"
    }
  ],
  "content" : [
    {
      "contentType" : "text/cql",
      "data" : "bGlicmFyeSBTdHJhdGlmaWNhdGlvbkVuY291bnRlckV4YW1wbGUKCnVzaW5nIEZISVIgdmVyc2lvbiAnNC4wLjEnCgppbmNsdWRlIGhsNy5maGlyLnV2LmNxbC5GSElSSGVscGVycyB2ZXJzaW9uICc0LjAuMScKaW5jbHVkZSBobDcuZmhpci51di5jcWwuRkhJU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