eCQM QICore Content Implementation Guide
2023.0.0 - CI Build

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

## Measure: Kidney Health EvaluationFHIR

Official URL: http://ecqi.healthit.gov/ecqms/Measure/KidneyHealthEvaluationFHIR | Version: 0.0.005
Draft as of 2023-10-27 | ​ Responsible: National Kidney Foundation | Computable Name: KidneyHealthEvaluationFHIR
Other Identifiers: Short Name (use: usual, ), UUID:e66e345d-d892-4fe2-84a7-748433b6e0a6 (use: official, ), UUID:2c928085806c39a2018085f3251705e4 (use: official, ), Publisher (use: official, )
Copyright/Legal: Copyright 2022 National Kidney Foundation. All Rights Reserved.

Percentage of patients aged 18-75 years with a diagnosis of diabetes who received a kidney health evaluation defined by an Estimated Glomerular Filtration Rate (eGFR) AND Urine Albumin-Creatinine Ratio (uACR) within the measurement period

UNKNOWN

Title: | Kidney Health EvaluationFHIR
Id: | KidneyHealthEvaluationFHIR
Download cql: | KidneyHealthEvaluationFHIR.cql
Version: | 0.0.005
Url: | Kidney Health EvaluationFHIR
short-name identifier: | CMS951FHIR
version-independent identifier: | urn:uuid:e66e345d-d892-4fe2-84a7-748433b6e0a6
version-specific identifier: | urn:uuid:2c928085806c39a2018085f3251705e4
publisher (CMS) identifier: | 951FHIR
Effective Period: | 2024-01-01 ..2024-12-31
Status: | draft
Date: | 2023-10-27 08:12:32+0000
Approval Date: | 2023-08-14
Last Review Date: | 2023-08-14
Name: | KidneyHealthEvaluationFHIR
Publisher: | National Kidney Foundation
Author: | ​National Kidney Foundation: www.kidney.org
Description: | Percentage of patients aged 18-75 years with a diagnosis of diabetes who received a kidney health evaluation defined by an Estimated Glomerular Filtration Rate (eGFR) AND Urine Albumin-Creatinine Ratio (uACR) within the measurement period
Purpose: | UNKNOWN
Copyright: | Copyright 2022 National Kidney Foundation. All Rights Reserved.
Disclaimer: | Physician Performance Measures (Measures) and related data specifications developed by the National Kidney Foundation (NKF) are intended to facilitate quality improvement activities by health care professionals. These Measures are intended to assist health care professionals in enhancing quality of care. These Measures are not clinical guidelines and do not establish a standard of medical care and have not been tested for all potential applications. NKF encourages testing and evaluation of its Measures. Measures are subject to review and may be revised or rescinded at any time by NKF. The measures may not be altered without prior written approval from NKF. The measures, while copyrighted, can be reproduced and distributed, without modification, for noncommercial purposes. Commercial use is defined as the sale, license, or distribution of the measures for commercial gain, or incorporation of the measures into a product or service that is sold, licensed, or distributed for commercial gain. Commercial uses of the measures require a license agreement between the user and NKF. Neither NKF nor its members shall be responsible for any use of the measures. THESE MEASURES AND SPECIFICATIONS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. Limited proprietary coding is contained in the Measure specifications for convenience. Users of the proprietary code sets should obtain all necessary licenses from the owners of these code sets. CPT(R) contained in the Measure specifications is copyright 2004-2021 American Medical Association. LOINC(R) is copyright 2004-2021 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2021 International Health Terminology Standards Development Organisation. ICD-10 is copyright 2021 World Health Organization. All Rights Reserved. The PCPI’s and AMA’s significant past efforts and contributions to the development and updating of the measure are acknowledged. Due to technical limitations, registered trademarks are indicated by (R) or [R].
Rationale: | Chronic Kidney Disease (CKD) is a major driver of morbidity, mortality and high healthcare costs in the United States. Currently, 37 million American adults have CKD and millions of others are at increased risk (NKF, 2019), with an estimated population prevalence growing to nearly 17% among Americans aged 30 years and older by the year 2030 (Saran, 2019; Hoerger, 2015). Total Medicare spending in 2016 on both CKD and ESRD was over $114 billion, comprising 23% of total Medicare fee-for-service spending overall with costs increasing exponentially with advancing CKD (Saran, 2019; Nichols, 2020). In the US from 2002-2016, the burden of CKD, defined as years of life lost, years living with disability, disability-adjusted life years, and deaths, outpaced changes in the burden of disease for other conditions (Bowe, 2018). Patients with CKD are readmitted to the hospital more frequently than those without diagnosed CKD (Saran, 2019). CKD is the 9th leading cause of death in the US and is the fastest growing non-communicable disease in terms of in burden largely due to death (Hoerger, 2015; Bowe, 2018). This public health issue is driven largely by the impact of diabetes—the most common comorbid risk factor for CKD (Saran, 2019; Bowe, 2018). The intent of this process measure is to improve rates of guideline-concordant kidney health evaluation in patients with diabetes to more consistently identify and potentially treat or delay progression of CKD in this high-risk population. Annual kidney health evaluation in patients with diabetes to determine risk of CKD using estimated glomerular filtration rate (eGFR) and urine albumin creatinine ratio (uACR) is recommended by clinical practice guidelines (ADA, 2022; NKF, 2007; NKF, 2012) and has been a focus of various local and national health care quality improvement initiatives, including Healthy People 2020 (United States Renal Data System, 2018). However, performance of these tests in patients with diabetes remains low, with rates that vary across Medicare (41.8%) and private insurers (49.0%) (Saran, 2019; Alfego, 2021; Stempneiwicz, 2021). Low rates of detection of CKD in a population of patients with diabetes have been demonstrated to be associated with low patient awareness of their own kidney health status (Szczech, 2014). Indeed, 90% of individuals with CKD are unaware of their condition due to under-recognition and under-diagnosis (Saran, 2019; Centers for Disease Control and Prevention, 2019). Currently, an individual’s lifetime probability of developing CKD is relatively high, reaching 54% for someone currently aged 30-49 years (Hoerger, 2015). Regular kidney health evaluations, utilizing both eGFR and uACR, provide an opportunity to improve identification and potential reversal of worsening kidney function, particularly in high risk populations, such as those with diabetes.
Clinical recommendation statement: | The following evidence statements are quoted verbatim from the referenced clinical guidelines and other sources, where applicable: At least once a year, assess urinary albumin (e.g., spot urinary albumin-to-creatinine ratio) and estimated glomerular filtration rate in patients with type 1 diabetes with duration of >= 5 years, in all patients with type 2 diabetes, and in all patients with comorbid hypertension. B (American Diabetes Association Professional Practice Committee, 2019) Patients with diabetes should be screened annually for Diabetic Kidney Disease (DKD). Initial screening should commence: 5 years after the diagnosis of type 1 diabetes; (A) or From diagnosis of type 2 diabetes. (B) Screening should include: Measurements of urinary albumin-creatinine ratio (ACR) in a spot urine sample; (B) Measurement of serum creatinine and estimation of GFR. (B) (National Kidney Foundation [NKF], 2007; NKF, 2012)
Guidance (Usage): | This measure assesses performance of a comprehensive kidney evaluation in adults aged 18-75. This measure does not preclude or discourage the use of regular laboratory testing for CKD in patients outside of the age range (patients under 18 years and those over 75 years of age). This eCQM is a patient-based measure. This FHIR-based measure has been derived from the QDM-based measure: CMS951v1. Please refer to the HL7 QI-Core Implementation Guide (http://hl7.org/fhir/us/qicore/index.html) for more information on QI-Core and mapping recommendations from QDM to QI-Core 4.1.1 (http://hl7.org/fhir/us/qicore/qdm-to-qicore.html).
Population Criteria: |
638500824ba3d47c885c02a8
Initial Population: | All patients aged 18-75 years with a diagnosis of diabetes at the start of the measurement period with a visit during the measurement period
Denominator: | Equals Initial Population
Denominator Exclusion: | Patients with a diagnosis of End Stage Renal Disease (ESRD); Patients with a diagnosis of Chronic Kidney Disease (CKD) Stage 5; Patients who have an order for or are receiving hospice or palliative care
Denominator Exception: | None
Numerator: | Patients who received a kidney health evaluation defined by an Estimated Glomerular Filtration Rate (eGFR) AND Urine Albumin-Creatinine Ratio (uACR) within the measurement period
Numerator Exclusion: | None
Libraries: |
KidneyHealthEvaluationFHIR
Related Artifact Dependencies: | QICoreCommon version: 1.5.000 FHIRHelpers version: 4.3.000 Hospice version: 6.7.000 Status version: 1.6.000 PalliativeCare version: 1.7.000 Condition Clinical Status Codes ActCode SNOMED CT (all versions) Observation Category Codes LOINC Estimated Glomerular Filtration Rate Urine Albumin Creatinine Ratio Diabetes Annual Wellness Visit Home Healthcare Services Office Visit Outpatient Consultation Preventive Care Services - Established Office Visit, 18 and Up Preventive Care Services-Initial Office Visit, 18 and Up Telephone Visits Chronic Kidney Disease, Stage 5 End Stage Renal Disease Encounter Inpatient Hospice Encounter Hospice Care Ambulatory Hospice Diagnosis Palliative Care Diagnosis Palliative Care Encounter Palliative Care Intervention
Parameters: |
name | use | min | max | type
--- | --- | --- | --- | ---
Measurement Period | In | 0 | 1 | Period
Numerator | Out | 0 | 1 | boolean
Denominator | Out | 0 | 1 | boolean
Initial Population | Out | 0 | 1 | boolean
Denominator Exclusions | Out | 0 | 1 | boolean
DataRequirements: |
Type | Elements | Valueset Name | Valueset
--- | --- | --- | ---
Patient(QICorePatient) |  |  |
Observation(QICoreObservation) | code effective value status status.value category | Estimated Glomerular Filtration Rate | Estimated Glomerular Filtration Rate
Observation(QICoreObservation) | code effective value status status.value category | Urine Albumin Creatinine Ratio | Urine Albumin Creatinine Ratio
Observation(QICoreObservation) | code value effective status status.value category |  |
Observation(QICoreObservation) | code effective status status.value category |  |
Condition(QICoreCondition) | code clinicalStatus | Diabetes | Diabetes
Condition(QICoreCondition) | code clinicalStatus | Chronic Kidney Disease, Stage 5 | Chronic Kidney Disease, Stage 5
Condition(QICoreCondition) | code clinicalStatus | End Stage Renal Disease | End Stage Renal Disease
Condition(QICoreCondition) | code clinicalStatus | Hospice Diagnosis | Hospice Diagnosis
Condition(QICoreCondition) | code clinicalStatus | Palliative Care Diagnosis | Palliative Care Diagnosis
Encounter(QICoreEncounter) | type period class status status.value | Annual Wellness Visit | Annual Wellness Visit
Encounter(QICoreEncounter) | type period class status status.value | Home Healthcare Services | Home Healthcare Services
Encounter(QICoreEncounter) | type period class status status.value | Office Visit | Office Visit
Encounter(QICoreEncounter) | type period class status status.value | Outpatient Consultation | Outpatient Consultation
Encounter(QICoreEncounter) | type period class status status.value | Preventive Care Services Established Office Visit, 18 and Up | Preventive Care Services - Established Office Visit, 18 and Up
Encounter(QICoreEncounter) | type period class status status.value | Preventive Care Services Initial Office Visit, 18 and Up | Preventive Care Services-Initial Office Visit, 18 and Up
Encounter(QICoreEncounter) | type period class status status.value | Telephone Visits | Telephone Visits
Encounter(QICoreEncounter) | type hospitalization hospitalization.dischargeDisposition period class status status.value | Encounter Inpatient | Encounter Inpatient
Encounter(QICoreEncounter) | type period class status status.value | Hospice Encounter | Hospice Encounter
Encounter(QICoreEncounter) | type period class status status.value | Palliative Care Encounter | Palliative Care Encounter
ServiceRequest(QICoreServiceRequest) | code authoredOn authoredOn.value status status.value intent intent.value | Hospice Care Ambulatory | Hospice Care Ambulatory
Procedure(QICoreProcedure) | code performed status status.value | Hospice Care Ambulatory | Hospice Care Ambulatory
Procedure(QICoreProcedure) | code performed status status.value | Palliative Care Intervention | Palliative Care Intervention
Direct Reference Codes: |
display | code | system
--- | --- | ---
| active | http://terminology.hl7.org/CodeSystem/condition-clinical
Ambulatory | AMB | http://terminology.hl7.org/CodeSystem/v3-ActCode
Discharge to home for hospice care (procedure) | 428361000124107 | http://snomed.info/sct
Discharge to healthcare facility for hospice care (procedure) | 428371000124100 | http://snomed.info/sct
survey | survey | http://terminology.hl7.org/CodeSystem/observation-category
Hospice care [Minimum Data Set] | 45755-6 | http://loinc.org
Yes (qualifier value) | 373066001 | http://snomed.info/sct
Functional Assessment of Chronic Illness Therapy - Palliative Care Questionnaire (FACIT-Pal) | 71007-9 | http://loinc.org
Logic Definitions: |
Group | Scoring | Population Criteria | Expression
--- | --- | --- | ---
638500824ba3d47c885c02a8 | Group scoring: proportion
|  | Initial Population |
    define "Initial Population":
      AgeInYearsAt(date from start of "Measurement Period") in Interval[18, 75]
        and "Has Active Diabetes Overlaps Measurement Period"
        and "Has Outpatient Visit During Measurement Period"
|  | Denominator |
    define "Denominator":
      "Initial Population"
|  | Denominator Exclusion |
    define "Denominator Exclusions":
      exists "Has CKD Stage 5 or ESRD Diagnosis Overlaps Measurement Period"
        or Hospice."Has Hospice Services"
        or PalliativeCare."Has Palliative Care in the Measurement Period"
|  | Denominator Exception | None
|  | Numerator |
    define "Numerator":
      "Has Kidney Panel Performed During Measurement Period"
|  | Numerator Exclusion | None

Library Name | Name
--- | ---
KidneyHealthEvaluationFHIR | Has Kidney Panel Performed During Measurement Period
    define "Has Kidney Panel Performed During Measurement Period":
      exists ( ["Observation": "Estimated Glomerular Filtration Rate"] eGFRTest
          where QICoreCommon."ToInterval" ( eGFRTest.effective ) during "Measurement Period"
            and eGFRTest.value is not null
            and eGFRTest.status in { 'final', 'amended', 'corrected' }
      )
        and exists ( ["Observation": "Urine Albumin Creatinine Ratio"] uACRTest
            where QICoreCommon."ToInterval" ( uACRTest.effective ) during "Measurement Period"
              and uACRTest.value is not null
              and uACRTest.status in { 'final', 'amended', 'corrected' }
        )
Library Name | Name
KidneyHealthEvaluationFHIR | Numerator
    define "Numerator":
      "Has Kidney Panel Performed During Measurement Period"
Library Name | Name
KidneyHealthEvaluationFHIR | Has Active Diabetes Overlaps Measurement Period
    define "Has Active Diabetes Overlaps Measurement Period":
      exists ( ["Condition": "Diabetes"] Diabetes
          where QICoreCommon."ToPrevalenceInterval" ( Diabetes ) overlaps "Measurement Period"
            and Diabetes.clinicalStatus ~ "active"
      )
Library Name | Name
KidneyHealthEvaluationFHIR | Has Outpatient Visit During Measurement Period
    define "Has Outpatient Visit During Measurement Period":
      exists ( ( ["Encounter": "Annual Wellness Visit"]
          union ["Encounter": "Home Healthcare Services"]
          union ["Encounter": "Office Visit"]
          union ["Encounter": "Outpatient Consultation"]
          union ["Encounter": "Preventive Care Services Established Office Visit, 18 and Up"]
          union ["Encounter": "Preventive Care Services Initial Office Visit, 18 and Up"]
          union ["Encounter": "Telephone Visits"] ) ValidEncounter
          where ValidEncounter.period during "Measurement Period"
            and ValidEncounter.class ~ "AMB"
            and ValidEncounter.status = 'finished'
      )
Library Name | Name
KidneyHealthEvaluationFHIR | Initial Population
    define "Initial Population":
      AgeInYearsAt(date from start of "Measurement Period") in Interval[18, 75]
        and "Has Active Diabetes Overlaps Measurement Period"
        and "Has Outpatient Visit During Measurement Period"
Library Name | Name
KidneyHealthEvaluationFHIR | Denominator
    define "Denominator":
      "Initial Population"
Library Name | Name
KidneyHealthEvaluationFHIR | Has CKD Stage 5 or ESRD Diagnosis Overlaps Measurement Period
    define "Has CKD Stage 5 or ESRD Diagnosis Overlaps Measurement Period":
      ( ["Condition": "Chronic Kidney Disease, Stage 5"]
        union ["Condition": "End Stage Renal Disease"] ) CKDOrESRD
        where QICoreCommon."ToPrevalenceInterval" ( CKDOrESRD ) overlaps "Measurement Period"
          and CKDOrESRD.clinicalStatus ~ "active"
Library Name | Name
Hospice | Has Hospice Services
    define "Has Hospice Services":
      exists ((([Encounter: "Encounter Inpatient"]).isEncounterPerformed()) InpatientEncounter
          where (InpatientEncounter.hospitalization.dischargeDisposition ~ "Discharge to home for hospice care (procedure)"
              or InpatientEncounter.hospitalization.dischargeDisposition ~ "Discharge to healthcare facility for hospice care (procedure)"
          )
            and InpatientEncounter.period.toInterval() ends during day of "Measurement Period"
      )
        or exists ((([Encounter: "Hospice Encounter"]).isEncounterPerformed()) HospiceEncounter
            where HospiceEncounter.period.toInterval() overlaps day of "Measurement Period"
        )
        or exists ((([Observation: "Hospice care [Minimum Data Set]"]).isAssessmentPerformed()) HospiceAssessment
            where HospiceAssessment.value ~ "Yes (qualifier value)"
              and HospiceAssessment.effective.toInterval() overlaps day of "Measurement Period"
        )
        or exists ((([ServiceRequest: "Hospice Care Ambulatory"]).isInterventionOrder()) HospiceOrder
            where HospiceOrder.authoredOn.toInterval() during day of "Measurement Period"
        )
        or exists ((([Procedure: "Hospice Care Ambulatory"]).isInterventionPerformed()) HospicePerformed
            where HospicePerformed.performed.toInterval() overlaps day of "Measurement Period"
        )
        or exists (([Condition: "Hospice Diagnosis"]) HospiceCareDiagnosis
            where HospiceCareDiagnosis.prevalenceInterval() overlaps day of "Measurement Period"
        )
Library Name | Name
PalliativeCare | Has Palliative Care in the Measurement Period
    define "Has Palliative Care in the Measurement Period":
      exists ((([Observation: "Functional Assessment of Chronic Illness Therapy - Palliative Care Questionnaire (FACIT-Pal)"]).isAssessmentPerformed()) PalliativeAssessment
          where PalliativeAssessment.effective.toInterval() overlaps day of "Measurement Period"
      )
        or exists ([Condition: "Palliative Care Diagnosis"] PalliativeDiagnosis
            where PalliativeDiagnosis.prevalenceInterval() overlaps day of "Measurement Period"
        )
        or exists ((([Encounter: "Palliative Care Encounter"]).isEncounterPerformed()) PalliativeEncounter
            where PalliativeEncounter.period.toInterval() overlaps day of "Measurement Period"
        )
        or exists ((([Procedure: "Palliative Care Intervention"]).isInterventionPerformed()) PalliativeIntervention
            where PalliativeIntervention.performed.toInterval() overlaps day of "Measurement Period"
        )
Library Name | Name
KidneyHealthEvaluationFHIR | Denominator Exclusions
    define "Denominator Exclusions":
      exists "Has CKD Stage 5 or ESRD Diagnosis Overlaps Measurement Period"
        or Hospice."Has Hospice Services"
        or PalliativeCare."Has Palliative Care in the Measurement Period"
Library Name | Name
QICoreCommon | ToInterval
    /*
    @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval
    @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types
    to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible
    representations for timing-valued elements in QICore, allowing this function to be used across any resource.
    The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>.
    The intent of this function is to provide a clear and concise mechanism to treat single
    elements that have multiple possible representations as intervals so that logic doesn't have to account
    for the variability. More complex calculations (such as medication request period or dispense period
    calculation) need specific guidance and consideration. That guidance may make use of this function, but
    the focus of this function is on single element calculations where the semantics are unambiguous.
    If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime.
    If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age,
    and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.
    If the input is a DateTime Interval, the result is the input.
    If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result
    is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending
    immediately before one year later than the date the patient turned the age given as the end of the quantity interval.
    Any other input will reslt in a null DateTime Interval
    @deprecated: This function is deprecated. Use the fluent function `toInterval()` instead
    */
    define function ToInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>):
      case
    	  when choice is DateTime then
        	Interval[choice as DateTime, choice as DateTime]
    		when choice is Interval<DateTime> then
      		choice as Interval<DateTime>
    		when choice is Quantity then
    		  Interval[Patient.birthDate + (choice as Quantity),
    			  Patient.birthDate + (choice as Quantity) + 1 year)
    		when choice is Interval<Quantity> then
    		  Interval[Patient.birthDate + (choice.low as Quantity),
    			  Patient.birthDate + (choice.high as Quantity) + 1 year)
    		when choice is QICore.Timing then
                null as Interval<DateTime>
    		else
    			null as Interval<DateTime>
    	end
Library Name | Name
QICoreCommon | ToPrevalenceInterval
    /*
    @description: Returns an interval representing the normalized prevalence period of a given Condition.
    @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from
    onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have
    a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary.
    @deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead
    */
    define function ToPrevalenceInterval(condition Condition):
    if condition.clinicalStatus ~ "active"
      or condition.clinicalStatus ~ "recurrence"
      or condition.clinicalStatus ~ "relapse" then
      Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)]
    else
      Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition))
Library Name | Name
Status | isEncounterPerformed
    define fluent function isEncounterPerformed(Enc List<Encounter>):
      Enc E
        where E.status in {'finished', 'arrived', 'triaged', 'in-progress', 'onleave'}
Library Name | Name
QICoreCommon | toInterval
    /*
    @description: Normalizes a value that is a choice of timing-valued types to an equivalent interval
    @comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types
    to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible
    representations for timing-valued elements in QICore, allowing this function to be used across any resource.
    The input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>.
    The intent of this function is to provide a clear and concise mechanism to treat single
    elements that have multiple possible representations as intervals so that logic doesn't have to account
    for the variability. More complex calculations (such as medication request period or dispense period
    calculation) need specific guidance and consideration. That guidance may make use of this function, but
    the focus of this function is on single element calculations where the semantics are unambiguous.
    If the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime.
    If the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age,
    and the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.
    If the input is a DateTime Interval, the result is the input.
    If the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result
    is a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending
    immediately before one year later than the date the patient turned the age given as the end of the quantity interval.
    Any other input will reslt in a null DateTime Interval
    */
    define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>):
      case
    	  when choice is DateTime then
        	Interval[choice as DateTime, choice as DateTime]
    		when choice is Interval<DateTime> then
      		choice as Interval<DateTime>
    		when choice is Quantity then
    		  Interval[Patient.birthDate + (choice as Quantity),
    			  Patient.birthDate + (choice as Quantity) + 1 year)
    		when choice is Interval<Quantity> then
    		  Interval[Patient.birthDate + (choice.low as Quantity),
    			  Patient.birthDate + (choice.high as Quantity) + 1 year)
    		else
    			null as Interval<DateTime>
    	end
Library Name | Name
Status | isAssessmentPerformed
    //Similar but different from QICoreCommon.isSurvey, which does not have status constraints
    define fluent function isAssessmentPerformed(Obs List<Observation>):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }
              and exists ( O.category ObservationCategory
              where ( ObservationCategory ) ~ "survey"
          )
Library Name | Name
FHIRHelpers | ToConcept
    /*
    @description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.
    */
    define function ToConcept(concept FHIR.CodeableConcept):
        if concept is null then
            null
        else
            System.Concept {
                codes: concept.coding C return ToCode(C),
                display: concept.text.value
            }
Library Name | Name
Status | isInterventionOrder
    define fluent function isInterventionOrder(ServiceRequest List<ServiceRequest>):
      ServiceRequest S
        where S.status in { 'active', 'completed' }
          and S.intent = 'order'
Library Name | Name
Status | isInterventionPerformed
    define fluent function isInterventionPerformed(Proc List<Procedure>):
      Proc P
        where P.status ~ 'completed'
Library Name | Name
QICoreCommon | prevalenceInterval
    /*
    @description: Returns an interval representing the normalized prevalence period of a given Condition.
    @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from
    onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have
    a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary.
    */
    define fluent function prevalenceInterval(condition Condition):
    if condition.clinicalStatus ~ "active"
      or condition.clinicalStatus ~ "recurrence"
      or condition.clinicalStatus ~ "relapse" then
      Interval[start of condition.onset.toInterval(), end of condition.abatementInterval()]
    else
      Interval[start of condition.onset.toInterval(), end of condition.abatementInterval())