# Age Stratified Example - Quality Measure Implementation Guide v2.0.0-ballot

## Measure: Age Stratified Example (Experimental) 

 
A sample measure demonstrating age stratification using age ranges represented as ISO-8601-Derived periods. 

* Metadata: Title
  * ?: Measure Age Stratified Example
* Metadata: Version
  * ?: 2.0.0-ballot
* Metadata: Identifier
  * ?: urn:oid:2.16.840.1.113883.4.642.40.61.29.20
* Metadata: Experimental
  * ?: true
* Metadata: Jurisdiction
  * ?: 001 from[http://unstats.un.org/unsd/methods/m49/m49.htm](http://unstats.un.org/unsd/methods/m49/m49.htm)
* Metadata: Steward (Publisher)
  * ?: HL7 International / Clinical Quality Information
* Metadata: Description
  * ?: A sample measure demonstrating age stratification using age ranges represented as ISO-8601-Derived periods.
* Metadata: Measure Basis
  * ?: boolean
* Metadata: Measure Scoring
  * ?: cohort from[http://terminology.hl7.org/CodeSystem/measure-scoring](http://terminology.hl7.org/7.1.0/CodeSystem-measure-scoring.html)
* Metadata: Measure Group (Rate) (ID: primary)
* Metadata: Stratifier
  * ?: **Code**:Age Group**Description**: Stratification by age groups represented as ISO-8601-Derived periods.
* Metadata: Measure Logic
* Metadata: Primary Library
  * ?: [Age Stratification Example](Library-AgeStratificationExample.md)
* Metadata: Contents
  * ?: **[Population Criteria](#population-criteria)****[Logic Definitions](#definitions)****[Terminology](#terminology)****[Dependencies](#dependencies)****[Data Requirements](#data-requirements)****[Parameters](#parameters)**
* Metadata:  Population Criteria
* Metadata: Measure Group (Rate) (ID: primary)
* Metadata: Stratifier
* Metadata: ````/* By Patient Age as of the start of the Measurement Period Age (10-14, 15-19, 20+) */ define "By Age": case when AgeInYearsAt(start of "Measurement Period") in Interval[10, 14] then "P10Y--P15Y" when AgeInYearsAt(start of "Measurement Period") in Interval[15, 19] then "P15Y--P20Y" when AgeInYearsAt(start of "Measurement Period") >= 20 then "P20Y--P9999Y" else null end````[**Definition**](#agestratificationexample-by-age)
* Metadata:  Logic Definitions
* Metadata: Logic Definition
  * ?: **Library Name:**AgeStratificationExample
* Metadata:  ````define "Initial Population": exists ( [Encounter] E where E.period during "Measurement Period" )````
* Metadata: Logic Definition
  * ?: **Library Name:**AgeStratificationExample
* Metadata:  ````/* By Patient Age as of the start of the Measurement Period Age (10-14, 15-19, 20+) */ define "By Age": case when AgeInYearsAt(start of "Measurement Period") in Interval[10, 14] then "P10Y--P15Y" when AgeInYearsAt(start of "Measurement Period") in Interval[15, 19] then "P15Y--P20Y" when AgeInYearsAt(start of "Measurement Period") >= 20 then "P20Y--P9999Y" else null end````
* Metadata: Logic Definition
  * ?: **Library Name:**FHIRHelpers
* Metadata:  ````/* @description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period) value to a CQL DateTime Interval @comment: If the start value of the given period is unspecified, the starting boundary of the resulting interval will be open (meaning the start of the interval is unknown, as opposed to interpreted as the beginning of time). */ define function ToInterval(period FHIR.Period): if period is null then null else if period."start" is null then Interval(period."start".value, period."end".value] else Interval[period."start".value, period."end".value]````
* Metadata:  Terminology
* Metadata: Code System
  * ?: **Description**: Code system Time Period Ranges**Resource**:[Time Period Ranges](http://terminology.hl7.org/7.1.0/CodeSystem-time-period-ranges.html)**Canonical URL**:http://terminology.hl7.org/CodeSystem/time-period-ranges
* Metadata: Direct Reference Code
  * ?: **Display**: 10-14 years**Code**: P10Y--P15Y**System**:http://terminology.hl7.org/CodeSystem/time-period-ranges
* Metadata: Direct Reference Code
  * ?: **Display**: 15-19 years**Code**: P15Y--P20Y**System**:http://terminology.hl7.org/CodeSystem/time-period-ranges
* Metadata: Direct Reference Code
  * ?: **Display**: 20+ years**Code**: P20Y--P9999Y**System**:http://terminology.hl7.org/CodeSystem/time-period-ranges
* Metadata:  Dependencies
* Metadata: Dependency
  * ?: **Description**: FHIR model information**Resource**:[http://hl7.org/fhir/uv/cql/Library/FHIR-ModelInfo|4.0.1](http://hl7.org/fhir/uv/cql/STU2/Library-FHIR-ModelInfo.html)**Canonical URL**:http://hl7.org/fhir/uv/cql/Library/FHIR-ModelInfo|4.0.1
* Metadata: Dependency
  * ?: **Description**: Library FHIRHelpers**Resource**:[http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1](http://hl7.org/fhir/uv/cql/STU2/Library-FHIRHelpers.html)**Canonical URL**:http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1
* Metadata:  Data Requirements
* Metadata: Data Requirement
  * ?: **Type**: Encounter**Profile(s)**:[Encounter](http://hl7.org/fhir/R4/encounter.html)**Must Support Elements**: period
* Metadata: Data Requirement
  * ?: **Type**: Patient**Profile(s)**:[Patient](http://hl7.org/fhir/R4/patient.html)
* Metadata:  Parameters
* Metadata: 
  * ?: 
| | | | | |
| :--- | :--- | :--- | :--- | :--- |
| **Name** | **Use** | **Card.** | **Type** | **Documentation** |
| Measurement Period | In | 0..1 | Period |  |
| Initial Population | Out | 0..1 | boolean |  |
| By Age | Out | 0..1 | Coding |  |

* Metadata: Generated using version 0.5.4 of the sample-content-ig Liquid templates



## Resource Content

```json
{
  "resourceType" : "Measure",
  "id" : "age-stratified-example",
  "meta" : {
    "profile" : ["http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-computablemeasure"]
  },
  "contained" : [{
    "resourceType" : "Library",
    "id" : "effective-data-requirements",
    "extension" : [{
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
      "valueCoding" : {
        "system" : "http://terminology.hl7.org/CodeSystem/time-period-ranges",
        "code" : "P10Y--P15Y",
        "display" : "10-14 years"
      }
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
      "valueCoding" : {
        "system" : "http://terminology.hl7.org/CodeSystem/time-period-ranges",
        "code" : "P15Y--P20Y",
        "display" : "15-19 years"
      }
    },
    {
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-directReferenceCode",
      "valueCoding" : {
        "system" : "http://terminology.hl7.org/CodeSystem/time-period-ranges",
        "code" : "P20Y--P9999Y",
        "display" : "20+ years"
      }
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "AgeStratificationExample"
      },
      {
        "url" : "name",
        "valueString" : "Initial Population"
      },
      {
        "url" : "statement",
        "valueString" : "define \"Initial Population\":\n  exists (\n    [Encounter] E\n      where E.period during \"Measurement Period\"\n  )"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 0
      }],
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "AgeStratificationExample"
      },
      {
        "url" : "name",
        "valueString" : "By Age"
      },
      {
        "url" : "statement",
        "valueString" : "/*\nBy Patient Age as of the start of the Measurement Period\nAge (10-14, 15-19, 20+)\n*/\ndefine \"By Age\":\n  case\n    when AgeInYearsAt(start of \"Measurement Period\") in Interval[10, 14] then \"P10Y--P15Y\"\n    when AgeInYearsAt(start of \"Measurement Period\") in Interval[15, 19] then \"P15Y--P20Y\"\n    when AgeInYearsAt(start of \"Measurement Period\") >= 20 then \"P20Y--P9999Y\"\n    else null\n  end"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 1
      }],
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "FHIRHelpers"
      },
      {
        "url" : "name",
        "valueString" : "ToInterval"
      },
      {
        "url" : "statement",
        "valueString" : "/*\n@description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period)\nvalue to a CQL DateTime Interval\n@comment: If the start value of the given period is unspecified, the starting\nboundary of the resulting interval will be open (meaning the start of the interval\nis unknown, as opposed to interpreted as the beginning of time).\n*/\ndefine function ToInterval(period FHIR.Period):\n    if period is null then\n        null\n    else\n        if period.\"start\" is null then\n            Interval(period.\"start\".value, period.\"end\".value]\n        else\n            Interval[period.\"start\".value, period.\"end\".value]"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 2
      }],
      "url" : "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
    }],
    "name" : "EffectiveDataRequirements",
    "status" : "active",
    "type" : {
      "coding" : [{
        "system" : "http://terminology.hl7.org/CodeSystem/library-type",
        "code" : "module-definition"
      }]
    },
    "relatedArtifact" : [{
      "type" : "depends-on",
      "display" : "FHIR model information",
      "resource" : "http://hl7.org/fhir/uv/cql/Library/FHIR-ModelInfo|4.0.1"
    },
    {
      "type" : "depends-on",
      "display" : "Library FHIRHelpers",
      "resource" : "http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1"
    },
    {
      "type" : "depends-on",
      "display" : "Code system Time Period Ranges",
      "resource" : "http://terminology.hl7.org/CodeSystem/time-period-ranges"
    }],
    "parameter" : [{
      "name" : "Measurement Period",
      "use" : "in",
      "min" : 0,
      "max" : "1",
      "type" : "Period"
    },
    {
      "name" : "Initial Population",
      "use" : "out",
      "min" : 0,
      "max" : "1",
      "type" : "boolean"
    },
    {
      "name" : "By Age",
      "use" : "out",
      "min" : 0,
      "max" : "1",
      "type" : "Coding"
    }],
    "dataRequirement" : [{
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/StructureDefinition/Encounter"],
      "mustSupport" : ["period"]
    },
    {
      "type" : "Patient",
      "profile" : ["http://hl7.org/fhir/StructureDefinition/Patient"]
    }]
  }],
  "extension" : [{
    "url" : "http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-populationBasis",
    "valueCode" : "boolean"
  },
  {
    "url" : "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-effectiveDataRequirements",
    "valueCanonical" : "#effective-data-requirements"
  }],
  "url" : "http://hl7.org/fhir/uv/cqm/Measure/age-stratified-example",
  "identifier" : [{
    "system" : "urn:ietf:rfc:3986",
    "value" : "urn:oid:2.16.840.1.113883.4.642.40.61.29.20"
  }],
  "version" : "2.0.0-ballot",
  "name" : "MeasureAgeStratifiedExample",
  "title" : "Measure Age Stratified Example",
  "status" : "active",
  "experimental" : true,
  "date" : "2025-08-13",
  "publisher" : "HL7 International / Clinical Quality Information",
  "contact" : [{
    "telecom" : [{
      "system" : "url",
      "value" : "http://www.hl7.org/Special/committees/cqi"
    }]
  }],
  "description" : "A sample measure demonstrating age stratification using  age ranges represented as ISO-8601-Derived periods.",
  "jurisdiction" : [{
    "coding" : [{
      "system" : "http://unstats.un.org/unsd/methods/m49/m49.htm",
      "code" : "001"
    }]
  }],
  "library" : ["http://hl7.org/fhir/uv/cqm/Library/AgeStratificationExample"],
  "scoring" : {
    "coding" : [{
      "system" : "http://terminology.hl7.org/CodeSystem/measure-scoring",
      "code" : "cohort"
    }]
  },
  "group" : [{
    "extension" : [{
      "url" : "http://hl7.org/fhir/5.0/StructureDefinition/extension-Measure.group.linkId",
      "valueString" : "primary"
    }],
    "population" : [{
      "extension" : [{
        "url" : "http://hl7.org/fhir/5.0/StructureDefinition/extension-Measure.group.population.linkId",
        "valueString" : "primary-age-stratified-example-initial-population"
      }],
      "code" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-population",
          "code" : "initial-population"
        }]
      },
      "criteria" : {
        "language" : "text/cql-identifier",
        "expression" : "Initial Population"
      }
    }],
    "stratifier" : [{
      "extension" : [{
        "url" : "http://hl7.org/fhir/5.0/StructureDefinition/extension-Measure.group.stratifier.linkId",
        "valueString" : "primary-age-stratified-example-stratification-1"
      },
      {
        "url" : "http://hl7.org/fhir/uv/cqm/StructureDefinition/cqm-valueSet",
        "valueCanonical" : "http://hl7.org/fhir/uv/cqm/ValueSet/age-stratified-example"
      }],
      "code" : {
        "text" : "Age Group"
      },
      "description" : "Stratification by age groups represented as ISO-8601-Derived periods.",
      "criteria" : {
        "language" : "text/cql-identifier",
        "expression" : "By Age"
      }
    }]
  }]
}

```
