FHIR © HL7.org  |  Server Home  |  XIG Home  |  XIG Stats  |  Server Source  |  FHIR  

FHIR IG Statistics: Measure/CMS871HHHyperFHIR

Packagegov.healthit.ecqi.ecqms
Resource TypeMeasure
IdCMS871HHHyperFHIR
FHIR VersionR4
Sourcehttp://ecqi.healthit.gov/ecqms/https://build.fhir.org/ig/cqframework/ecqm-content-qicore-2025/Measure-CMS871HHHyperFHIR.html
URLhttps://madie.cms.gov/Measure/CMS871HHHyperFHIR
Version0.3.000
Statusactive
Date2025-05-23T20:52:29+00:00
NameCMS871HHHyperFHIR
TitleHospital Harm - Severe HyperglycemiaFHIR
DescriptionThis measure assesses the number of inpatient hospital days for patients age 18 and older with a hyperglycemic event (harm) per the total qualifying inpatient hospital days for that encounter
CopyrightLimited proprietary coding is contained in the Measure specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets. American Institutes for Research(R), formerly IMPAQ International, disclaims all liability for use or accuracy of any third party codes contained in the specifications. LOINC(R) copyright 2004-2024 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2024 International Health Terminology Standards Development Organisation. ICD-10 copyright 2024 World Health Organization. All Rights Reserved.

Resources that use this resource

No resources found


Resources that this resource uses

No resources found


Narrative

Note: links and images are rebased to the (stated) source

Metadata
Title Hospital Harm - Severe HyperglycemiaFHIR
Version 0.3.000
Short Name CMS871FHIR
GUID (Version Independent) urn:uuid:c44ca609-d795-4715-a8fc-1b0b30e46048
GUID (Version Specific) urn:uuid:b85cda48-6920-482f-aa2f-16efa09efe3f
CMS Identifier 871FHIR
CMS Consensus Based Entity Identifier 3533e
Effective Period 2026-01-01 through 2026-12-31
Steward (Publisher) Centers for Medicare & Medicaid Services (CMS)
Developer Mathematica
Description

This measure assesses the number of inpatient hospital days for patients age 18 and older with a hyperglycemic event (harm) per the total qualifying inpatient hospital days for that encounter

Copyright

Limited proprietary coding is contained in the Measure specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets. American Institutes for Research(R), formerly IMPAQ International, disclaims all liability for use or accuracy of any third party codes contained in the specifications.

LOINC(R) copyright 2004-2024 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2024 International Health Terminology Standards Development Organisation. ICD-10 copyright 2024 World Health Organization. All Rights Reserved.

Disclaimer

This performance measure is not a clinical guideline and does not establish a standard of medical care, and has not been tested for all potential applications.

THE MEASURES AND SPECIFICATIONS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.

Due to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].

Rationale

Hyperglycemia, i.e., elevated glucose level, is common among hospitalized patients, especially those with preexisting diabetes (Umpierrez et al., 2012) and accounts for over 30% of noncritically ill hospitalized patients (Korytkowski, 2022). Hyperglycemia can also affect individuals with no prior history of diabetes and may be induced by medications such as steroids or by parenteral (intravenous) or enteral (tube) feeding.

Severe hyperglycemia, i.e., an extremely elevated glucose level, is significantly associated with a range of harms, including increased in-hospital mortality, infection rates, and hospital length of stay (Pasquel, et al., 2021; Umpierrez et al., 2012, 2015). Lower rates of inpatient severe hyperglycemia may not only improve care for patients but also may reduce costs for healthcare payers (Krinsley et al., 2016). The rate of hyperglycemia varies across hospitals, suggesting opportunities for improvement in inpatient glycemic management (Bersoux et al., 2013; Seisa et al., 2022). The rate of inpatient hyperglycemia can be considered a marker for quality of hospital care, since inpatient hyperglycemia is largely avoidable with proper glycemic management. The use of evidence-based standardized protocols and insulin management protocols have been shown to improve glycemic control and safety (Leroy et al., 2020; Maynard et al., 2015).

It should be noted that this measure does not aim to measure overall glucose control in hospitalized patients; rather, its goal is to assess the occurrence and extent of severe hyperglycemia. This measure is also intended to be used in combination with its companion measure of hypoglycemia (Hospital Harm – Hypoglycemia) to reduce unintended consequences of measurement.

Clinical Recommendation Statement

Multiple guidelines address recommended levels of glycemic control, though these do not define severe hyperglycemia:

From Section 16, Diabetes Care in the Hospital, in the Standards of Care in Diabetes by the American Diabetes Association (American Diabetes Association Professional Practice Committee, 2024):

16.4 Insulin and/or other therapies should be initiated or intensified for treatment of persistent hyperglycemia starting at a threshold of ≥180 mg/dL (10.0 mmol/L) (confirmed on two occasions within 24 hours) for noncritically ill (non-ICU) individuals.

16.5a Once therapy is initiated, a glycemic goal of 140–180 mg/dL (7.8–10.0 mmol/L) is recommended for most critically ill (ICU) individuals with hyperglycemia.

16.5 More stringent glycemic goals, such as 110–140 mg/dL (6.1–7.8 mmol/L), may be appropriate for selected critically ill individuals and are acceptable if they can be achieved without significant hypoglycemia.

From Management of Hyperglycemia in Hospitalized Adult Patients in Non-Critical Care Settings: An Endocrine Society Clinical Practice Guideline (Korytkowski et al., 2022):

Recommendation 1.1 In adults with insulin-treated diabetes hospitalized for noncritical illness who are at high risk of hypoglycemia, we suggest the use of real-time continuous glucose monitoring (CGM) with confirmatory bedside point-of-care blood glucose (POC-BG) monitoring for adjustments in insulin dosing rather than point-of-care blood glucose (POC-BG) testing alone in hospital settings where resources and training are available.

Recommendation 10.1 In adults with no prior history of diabetes hospitalized for noncritical illness with hyperglycemia [defined as blood glucose (BG) > 140 mg/dL (7.8 mmol/L)] during hospitalization, we suggest initial therapy with correctional insulin over scheduled insulin therapy (defined as basal or basal/bolus insulin) to maintain glucose targets in the range of 100 to 180 mg/dL (5.6 to 10.0 mmol/L). For patients with persistent hyperglycemia [≥2 point-of-care blood glucose (POC-BG) measurements ≥ 180 mg/dL (≥10.0 mmol/L) in a 24-hour period on correctional insulin alone], we suggest the addition of scheduled insulin therapy.

Recommendation 10.2 In adults with diabetes treated with diet or noninsulin diabetes medications prior to admission, we suggest initial therapy with correctional insulin or scheduled insulin therapy to maintain glucose targets in the range of 100 to 180 mg/dL (5.6 to 10.0 mmol/L). For hospitalized adults started on correctional insulin alone and with persistent hyperglycemia [≥2 point-of-care blood glucose (POC-BG) measurements ≥ 180 mg/dL in a 24-hour period (≥10.0 mmol/L)], we suggest addition of scheduled insulin therapy. We suggest initiation of scheduled insulin therapy for patients with confirmed admission blood glucose (BG) ≥ 180 mg/dL (≥10.0 mmol/L).

Recommendation 10.3 In adults with insulin-treated diabetes prior to admission who are hospitalized for noncritical illness, we recommend continuation of the scheduled insulin regimen modified for nutritional status and severity of illness to maintain glucose targets in the range of 100 to 180 mg/dL (5.6 to 10.0 mmol/L).

Remarks Reductions in the dose of basal insulin (by 10% to 20%) at time of hospitalization may be required for patients on basal heavy insulin regimens (defined as doses of basal insulin ≥ 0.6 to 1.0 units/kg/day), in which basal insulin is being used inappropriately to cover meal-related excursions in BG.

There is no clinically accepted cutoff for severe hyperglycemia. Studies have used thresholds of >140, >180, >300, >350 and >400 mg/dL, among other values (American Diabetes Association Professional Practice Committee, 2024; Umpierrez et al, 2012, 2015; Jamesen et al., 2015; Donihi et al., 2011; Mendez et al, 2015; Seisa et al., 2022). Blood glucose level <180 mg/dL is associated with lower rates of mortality and stroke compared with a target glucose <200 mg/dL (Sathya et al., 2013). Glycemic goals may also differ among hospitalized patients. For inpatient management of hyperglycemia in noncritical care, the expert consensus recommends a target range of 100–180 mg/dL (5.6–10.0 mmol/L) for noncritically ill patients with “new” hyperglycemia as well as people with known diabetes prior to admission. Glycemic levels up to 250 mg/dL (13.9 mmol/L) may be acceptable in terminally ill patients with short life expectancy, patients with advanced kidney failure and/or on dialysis, patients at high risk for hypoglycemia, and/or patients with labile glycemic excursions. In these individuals, less aggressive treatment goals that would help avoid symptomatic hypoglycemia and/or hyperglycemia are often more appropriate (American Diabetes Association Professional Practice Committee, 2024). In an older patient with a prior history of severe hypoglycemia, some degree of hyperglycemia may be tolerated to maximize safety. Intensive insulin therapy to target glucose of 100 and 140mg/dL in the ICU did not significantly reduce perioperative complications compared with target glucose of 141 and 180mg/dL after coronary artery bypass surgery (Umpierrez et al., 2015). The current recommendation is to maintain a blood glucose level between 140-180 mg/dL (7.8-10.0 mmol/L) in both cardiac and non-cardiac ICU patients (Sreedharan et al., 2022).

For patients who present with hyperglycemic crises, neurologic status must be monitored closely, with frequent re-examination. Care should be taken to prevent over-correction of hyperglycemia and hyperosmolarity following initial fluid resuscitation of these patients to prevent cerebral edema, which carries a high mortality rate (Gosmanov et al., 2021).

Citation

CITATION - American Diabetes Association Professional Practice Committee; 16. (2022). Diabetes Care in the Hospital: Standards of Medical Care in Diabetes—2022. Diabetes Care 1 January 2022; 45 (Supplement_1): S244–S253. https://doi.org/10.2337/dc22-S016

Citation

CITATION - Bersoux, S., Cook, C.B., Kongable, G.L., Shu, J. (2013). Trends in glycemic control over a 2-year period in 126 US hospitals. J Hosp Med. 2013;8(3):121-125. doi:10.1002/jhm.1997

Citation

CITATION - Donihi, A.C., Gibson, J.M., Noschese, M.L., et al. (2011). Effect of targeted glycemic management program on provider response to inpatient hyperglycemia. Endocr Pract. 2011; (4)552-557

Citation

CITATION - Gosmanov, A.R., Gosmanova, E.O., Kitabchi, A.E. (2021). Hyperglycemic Crises: Diabetic Ketoacidosis and Hyperglycemic Hyperosmolar State. [Updated 2021 May 9]. In: Feingold KR, Anawalt B, Boyce A, et al., editors. Endotext [Internet]. South Dartmouth (MA): MDText.com, Inc.; 2000-. Available from: https://www.ncbi.nlm.nih.gov/books/NBK279052/

Citation

CITATION - Jamesen, E., Nevalainen, P.L., Eskelinen, A., et al. (2015). Risk factors for perioperative hyperglycemia in primary hip and knee replacements. Acta Orthop. 2015; 86(2):175-182

Citation

CITATION - Korytkowski, M.T., Muniyappa, R., Antinori-Lent, K., Donihi, A.C., Drincic, A.T, Hirsch, I.B., Luger, A., McDonnell, M.E., Murad, M.H., Nielsen, C., Pegg, C., Rushakoff, R.J., Santesso, N., Umpierrez, G.E. (2022). Management of Hyperglycemia in Hospitalized Adult Patients in Non-Critical Care Settings: An Endocrine Society Clinical Practice Guideline, The Journal of Clinical Endocrinology & Metabolism, Volume 107, Issue 8, August 2022, Pages 2101–2128, https://doi.org/10.1210/clinem/dgac278

Citation

CITATION - Krinsley, J.S., Jones, R.L. (2016). Cost analysis of intensive glycemic control in critically ill adult patients. Chest. 2016;129(3)644-650

Citation

CITATION - LeRoy, L., Richard, S. (2020). Harms Due to Diabetic Agents (Chapter 8), Making Healthcare Safer III: A Critical Analysis of Existing and Emerging Patient Safety Practices. Retrieved from: https://www.ahrq.gov/sites/default/files/wysiwyg/research/findings/making-healthcare-safer/mhs3/diabetes-1.pdf

Citation

CITATION - Maynard, G., Kulasa, K., Ramos, P., et al. (2015). Impact of a hypoglycemic reduction bundle and a systems approach to inpatient glycemic management. Endocr Pract. 2015;21(4):355-367

Citation

CITATION - Mendez, C.E., Ata, A., Rourke, J.M., et al. (2015). Daily inpatient glycemic survey (DINGS): A process to remotely identify and assist in the management of hospitalized patients with diabetes and hyperglycemia. Endocr Pract. 2015;21(8):927-935

Citation

CITATION - Pasquel, F.J., Lansang, M.C., Dhatariya, K., Umpierrez, G.E. (2021). Management of diabetes and hyperglycaemia in the hospital. The Lancet Diabetes & Endocrinology. 2021; 9: 174–88

Citation

CITATION - Sathya, B., Davis, R., Taveira, T., et al. (2013). Intensity of peri-operative glycemic control and postoperative outcomes in patients with diabetes: a meta-analysis. Diabetes Res Clin Pract. 2013;102(1):815.10.1016/j.diabres.2013.05.003

Citation

CITATION - Umpierrez, G., Cardona, S., Pasquel, F., et al. (2015). Randomized controlled trial of intensive versus conservative glucose control in patients undergoing coronary artery bypass graft surgery: gluco-CABG trial. Diabetes Care. 2015;38(9):1665-1672

Citation

CITATION - Umpierrez, G.E., Hellman, R., Korytkowski, M.T., et al. (2012). Management of Hyperglycemia in Hospitalized Patients in Non-critical Care Setting: An Endocrine Society Clinical Practice Guideline. J Clin Endocrinol Metab. 2012;97, 16-38

Guidance (Usage) The measure is using mg/dL as the unit of measurement for glucose results. Millimoles per liter (mmol/L) should be converted to milligrams per deciliter (mg/dL) for reporting this measure. When evaluating for days with a glucose level >300 mg/dL, the first 24-hour period after admission to the hospital is not evaluated to account for potentially poor glucose control outside of the hospital setting or that preceded the start of hospital care. The admission starts in the ED or observation when the transition between the ED encounter, observation encounter, and the inpatient encounter are within an hour or less of each other. This measure evaluates the first 10 days of an eligible inpatient hospitalization in determining eligible days for the denominator and numerator (i.e., the length of stay is truncated to <=10 days when the length exceeds 10 days). Patients admitted for longer length of stays are more likely to have more complex medical conditions. In determining eligible days for the denominator and numerator, this measure does not evaluate the last day if it was less than a 24-hour period. The “Days in Hospitalization” logic within Measure Observation 1 (associated with the denominator), in conjunction with other logic, returns the day number (e.g., day 1 to day 10) for each day within the hospitalization period to determine the eligible hospital days (e.g., from day 2 to day 10). The “Days in Hospitalization” logic within Measure Observation 2 (associated with the numerator), in conjunction with other logic, returns the day number (e.g., day 1 to day 10) for each day within the hospitalization period to determine the eligible hyperglycemic event days (e.g., from day 2 to day 10). Since the measure does not count any hyperglycemic events that occur in the first 24 hours, day 1 is not considered an eligible hospital day for the Measure Observations. Eligible days range from day 2 up to day 10. However, the measure does allow day 1 to be counted for the Numerator as one of the preceding days for a day where no glucose result is found. In this instance, the measure could evaluate day 1 as one of the two days preceding the day with no glucose result to see if there was a glucose value >=200 mg/dL on day 1. Multiple hyperglycemic events can occur during a ‘day,’ but this is still considered one hyperglycemic event day. The numerator returns the first eligible encounter that meets the qualifying criteria: an inpatient hospitalization with a hyperglycemic event. Only one numerator is counted per encounter. Note that the Numerator returns the encounters, not days, that meet the criteria. This measure includes two measure observations used to calculate the ratio of the number of inpatient hospital days with a hyperglycemic (high blood glucose) event over the total number of eligible inpatient hospital days (<= 10 days) for that encounter. In ratio measures, both the denominator and numerator populations flow separately from the same initial population. Therefore, the same exclusion criteria must be applied to both the denominator and numerator to prevent excluded cases from being considered. The specimen source for the glucose test is blood, serum, plasma, or interstitial fluid, and can be obtained by a laboratory test, a POC test, or a continuous glucose monitor (CGM). Glucose test results from urine specimens are not considered. This eCQM is an episode-based measure. An episode is defined as each inpatient hospitalization or encounter that ends during the measurement period. This FHIR-based measure has been derived from the QDM-based measure: CMS871v5. Please refer to the HL7 QI-Core Implementation Guide https://hl7.org/fhir/us/qicore/STU6/) for more information on QI-Core and mapping recommendations from QDM to QI-Core STU 6 (https://hl7.org/fhir/us/qicore/STU6/qdm-to-qicore.html).
Measure Group (Rate) (ID: Group_1)
Basis Encounter
Scoring Ratio
Type Outcome
Rate Aggregation None
Improvement Notation decrease
Initial Population ID: InitialPopulation_1
Description:

Inpatient hospitalizations for patients age 18 and older that end during the measurement period, as well as either: - A diagnosis of diabetes that starts before or during the encounter; or - Administration of at least one dose of insulin or any hypoglycemic medication during the encounter; or - Presence of at least one glucose value >=200 mg/dL at any time during the encounter

Logic Definition: Initial Population
Denominator ID: Denominator_1
Description:

Equals Initial Population

Logic Definition: Denominator
Denominator Exclusion ID: DenominatorExclusion_1
Description:

Inpatient hospitalizations for patients with a glucose result of >600 mg/dL anytime between 1 hour prior to the start of the encounter to 6 hours after the start of the encounter. -Inpatient hospitalizations for patients who have comfort care measures ordered or provided during the encounter. -Inpatient hospitalizations for patients who have a discharge disposition to hospice care at home or in a health care facility.

Logic Definition: Denominator Exclusions
Numerator ID: Numerator_1
Description:

Inpatient hospitalizations with a hyperglycemic event within the first 10 days of the encounter minus the first 24 hours, and minus the last period before discharge from the hospital if less than 24 hours A hyperglycemic event is defined as: - A day with at least one glucose value >300 mg/dL; OR - A day where a glucose test and result was not found, and it was preceded by two consecutive days where at least one glucose value during each of the two days was >=200 mg/dL

Logic Definition: Numerator
Numerator Exclusion ID: NumeratorExclusion_1
Description:

Inpatient hospitalizations for patients with a glucose result of >600 mg/dL anytime between 1 hour prior to the start of the encounter to 6 hours after the start of the encounter. -Inpatient hospitalizations for patients who have comfort care measures ordered or provided during the encounter. -Inpatient hospitalizations for patients who have a discharge disposition to hospice care at home or in a health care facility.

Logic Definition: Numerator Exclusions
Measure Observation ID: MeasureObservation_1_1
Description:

Measure Observation 1, associated with the denominator of the ratio: The total number of eligible days of the inpatient hospitalization which match the initial population/denominator criteria and did not meet the denominator exclusion criteria.

Logic Definition: Denominator Observations
Measure Observation ID: MeasureObservation_1_2
Description:

Measure Observation 2, associated with the numerator of the ratio: The total number of hyperglycemic days during the inpatient hospitalization that meet the numerator criteria and did not meet the numerator exclusion criteria. Days with a hyperglycemic event are defined as: - All days with a glucose level >300 mg/dL (except those occurring in the first 24-hour period after admission to the hospital (including the emergency department and observation)) OR - All days where a glucose was not measured, and it was immediately preceded by two contiguous, consecutive days where at least one glucose value during each of the two days was >=200 mg/dL.

Logic Definition: Numerator Observations
Supplemental Data Guidance For every patient evaluated by this measure also identify payer, race, ethnicity and sex; SDE Ethnicity SDE Payer SDE Race SDE Sex
Supplemental Data Elements
Supplemental Data Element ID: sde-ethnicity
Usage Code: Supplemental Data
Description: SDE Ethnicity
Logic Definition: SDE Ethnicity
Supplemental Data Element ID: sde-payer
Usage Code: Supplemental Data
Description: SDE Payer
Logic Definition: SDE Payer
Supplemental Data Element ID: sde-race
Usage Code: Supplemental Data
Description: SDE Race
Logic Definition: SDE Race
Supplemental Data Element ID: sde-sex
Usage Code: Supplemental Data
Description: SDE Sex
Logic Definition: SDE Sex
Measure Logic
Primary Library CMS871HHHyperFHIR
Contents Population Criteria
Logic Definitions
Terminology
Dependencies
Data Requirements
Population Criteria
Measure Group (Rate) (ID: Group_1)
Initial Population
define "Initial Population":
  "Encounter with Existing Diabetes Diagnosis"
    union "Encounter with Hypoglycemic Medication"
    union "Encounter with Elevated Glucose Greater Than or Equal to 200"
Denominator
define "Denominator":
  "Initial Population"
Denominator Exclusion
define "Denominator Exclusions":
  "Encounter with Early Glucose Greater Than 600 or with Comfort or Hospice Care"
Numerator
define "Numerator":
  "Encounter with Hyperglycemic Events"
Numerator Exclusion
define "Numerator Exclusions":
  "Encounter with Early Glucose Greater Than 600 or with Comfort or Hospice Care"
Measure Observation
/**
 * Counts the number of eligible days in an encounter. This simply filters and counts the data built in
 * "Relevant Encounters With Hyperglycemic Event Days".*/


define function "Denominator Observations"(QualifyingEncounter Encounter):
  if QualifyingEncounter.id in "Denominator Exclusions".id then singleton from ( "Days with Hyperglycemic Events" EncounterWithEventDays
      where EncounterWithEventDays.encounter = QualifyingEncounter
      return 0
  ) 
    else singleton from ( "Days with Hyperglycemic Events" EncounterWithEventDays
      where EncounterWithEventDays.encounter = QualifyingEncounter
      return Count(EncounterWithEventDays.eligibleEventDays)
  )
Measure Observation
/**
 * Counts the number of eligible days with a hyperglycemic event in an encounter. This simply filters and counts the data built in
 * "Relevant Encounters With Hyperglycemic Event Days".*/


define function "Numerator Observations"(QualifyingEncounter Encounter):
  if QualifyingEncounter.id in "Denominator Exclusions".id then singleton from ( "Days with Hyperglycemic Events" EncounterWithEventDays
      where EncounterWithEventDays.encounter = QualifyingEncounter
      return 0
  ) 
    else singleton from ( "Days with Hyperglycemic Events" EncounterWithEventDays
      where EncounterWithEventDays.encounter = QualifyingEncounter
      return Count(EncounterWithEventDays.eligibleEventDays EligibleEventDay
          where EligibleEventDay.hasHyperglycemicEvent
      )
  )
Logic Definitions
Logic Definition Library Name: SupplementalDataElements
define "SDE Sex":
  case
    when Patient.sex = '248153007' then "Male (finding)"
    when Patient.sex = '248152002' then "Female (finding)"
    else null
  end
Logic Definition Library Name: SupplementalDataElements
define "SDE Payer":
  [Coverage: type in "Payer Type"] Payer
    return {
      code: Payer.type,
      period: Payer.period
    }
Logic Definition Library Name: SupplementalDataElements
define "SDE Ethnicity":
  Patient.ethnicity E
    return Tuple {
      codes: { E.ombCategory } union E.detailed,
      display: E.text
    }
Logic Definition Library Name: SupplementalDataElements
define "SDE Race":
  Patient.race R
    return Tuple {
      codes: R.ombCategory union R.detailed,
      display: R.text
    }
Logic Definition Library Name: CQMCommon
/*
@description: Hospitalization with Observation returns the total interval from the start of any immediately prior emergency department visit through the observation visit to the discharge of the given encounter
@deprecated: This function is deprecated. Use the fluent function `hospitalizationWithObservation()` instead.
*/
define function "HospitalizationWithObservation"(TheEncounter Encounter ):
  TheEncounter Visit
  		let ObsVisit: Last([Encounter: "Observation Services"] LastObs
  				where LastObs.status = 'finished'
            and LastObs.period ends 1 hour or less on or before start of Visit.period
  				sort by end of period
  			),
  			VisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),
  			EDVisit: Last([Encounter: "Emergency Department Visit"] LastED
  				where LastED.status = 'finished'
            and LastED.period ends 1 hour or less on or before VisitStart
  				sort by end of period
  			)
  		return Interval[Coalesce(start of EDVisit.period, VisitStart), end of Visit.period]
Logic Definition Library Name: QICoreCommon
/*
@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, or has an abatement date the resulting 
interval will have a closed ending boundary. Otherwise, the resulting interval will have an open ending boundary.
@deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead
*/
define function ToPrevalenceInterval(condition Choice<"ConditionEncounterDiagnosis", "ConditionProblemsHealthConcerns">):
if condition.clinicalStatus ~ "active"
  or condition.clinicalStatus ~ "recurrence"
  or condition.clinicalStatus ~ "relapse" then
  Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)]
else
   (end of ToAbatementInterval(condition)) abatementDate
    return if abatementDate is null then
      Interval[start of ToInterval(condition.onset), abatementDate)
    else
      Interval[start of ToInterval(condition.onset), abatementDate]
Logic Definition Library Name: QICoreCommon
/*
@description: Given an interval, return the starting point if the interval has a starting boundary specified,
otherwise, return the ending point
@deprecated: This function is deprecated. Use the fluent function `earliest()` instead
*/
define function "Earliest"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ):
  (choice.toInterval()) period
    return
      if (HasStart(period)) then start of period
      else end of period
Logic Definition Library Name: QICoreCommon
/*
@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.
If the input is a Timing, an error will be thrown indicating that Timing calculations are not implemented. Any other input will reslt in a null DateTime Interval
*/
define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>, Timing>):
  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 Timing then
      Message(null, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported') as Interval<DateTime>
		else
			null as Interval<DateTime>
	end
Logic Definition Library Name: FHIRHelpers
define function ToString(value uri): value.value
Logic Definition Library Name: FHIRHelpers
/*
@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]
Logic Definition Library Name: FHIRHelpers
/*
@description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.
*/
define function ToCode(coding FHIR.Coding):
    if coding is null then
        null
    else
        System.Code {
          code: coding.code.value,
          system: coding.system.value,
          version: coding.version.value,
          display: coding.display.value
        }
Logic Definition Library Name: CMS871HHHyperFHIR
define "SDE Sex":
  SDE."SDE Sex"
Logic Definition Library Name: CMS871HHHyperFHIR
define "Qualifying Encounter":
  ["Encounter": "Encounter Inpatient"] InpatientEncounter
    where AgeInYearsAt(date from start of InpatientEncounter.period) >= 18
      and InpatientEncounter.period ends during day of "Measurement Period"
      and InpatientEncounter.status = 'finished'
Logic Definition Library Name: CMS871HHHyperFHIR
/**
 * Create paring of encounters to hospitalization period so this calculation can be inspected and the result 
 * can be reused, making the logic faster.*/


define "Encounter with Hospitalization Period":
  "Qualifying Encounter" QualifyingHospitalization
    return Tuple {
      encounter: QualifyingHospitalization,
      hospitalizationPeriod: CQMCommon."HospitalizationWithObservation" ( QualifyingHospitalization )
    }
Logic Definition Library Name: CMS871HHHyperFHIR
/**
 * Using the already calculated pairing of hospitalization periods with encounters, filter on ones with 
 * diabetes and return the encounter.*/


define "Encounter with Existing Diabetes Diagnosis":
  "Encounter with Hospitalization Period" Hospitalization
    with ["ConditionEncounterDiagnosis": "Diabetes"] Diabetes
      such that ( QICoreCommon."ToPrevalenceInterval" ( Diabetes ) starts before end of Hospitalization.hospitalizationPeriod )
    return Hospitalization.encounter
Logic Definition Library Name: CMS871HHHyperFHIR
/**
 * Using the already calculated pairing of hospitalization periods with encounters, filter on ones with 
 * hypoglycemic medicatons and return the encounter.*/


define "Encounter with Hypoglycemic Medication":
  from
    "Encounter with Hospitalization Period" Hospitalization,
    ["MedicationAdministration": "Hypoglycemics Treatment Medications"] HypoglycemicMed
    where HypoglycemicMed.status in { 'completed', 'in-progress' }
          //and HypoglycemicMed.status != 'not-done'
      
      and QICoreCommon."ToInterval" ( HypoglycemicMed.effective ) during Hospitalization.hospitalizationPeriod
    return Hospitalization.encounter
Logic Definition Library Name: CMS871HHHyperFHIR
/**
 * Using the already calculated pairing of hospitalization periods with encounters, filter on ones with 
 * any elevated (>= 200) blood glucose reading during the hospitalization*/


define "Encounter with Elevated Glucose Greater Than or Equal to 200":
  "Encounter with Hospitalization Period" Hospitalization
    with ["LaboratoryResultObservation": "Glucose Lab Test Mass Per Volume"] GlucoseTest
      such that QICoreCommon."Earliest" ( GlucoseTest.effective ) during Hospitalization.hospitalizationPeriod
        and GlucoseTest.status in { 'final', 'amended', 'corrected' }
            //and GlucoseTest.status != 'cancelled'
        
        and GlucoseTest.value >= 200 'mg/dL'
    return Hospitalization.encounter
Logic Definition Library Name: CMS871HHHyperFHIR
define "Initial Population":
  "Encounter with Existing Diabetes Diagnosis"
    union "Encounter with Hypoglycemic Medication"
    union "Encounter with Elevated Glucose Greater Than or Equal to 200"
Logic Definition Library Name: CMS871HHHyperFHIR
define "Denominator":
  "Initial Population"
Logic Definition Library Name: CMS871HHHyperFHIR
define "Measurement Population":
  "Denominator"
Logic Definition Library Name: CMS871HHHyperFHIR
define "Days in Hospitalization":
  "Measurement Population" EligibleInpatientHospitalization
    let period: CQMCommon."HospitalizationWithObservation" ( EligibleInpatientHospitalization ),
    relevantPeriod: "Hospital Days Max 10"(period)
    return Tuple {
      encounter: EligibleInpatientHospitalization,
      hospitalizationPeriod: period,
      relevantPeriod: relevantPeriod,
      relevantDays: "Days In Period"(relevantPeriod)
    }
Logic Definition Library Name: CMS871HHHyperFHIR
define "Days with Glucose Results":
  "Days in Hospitalization" InpatientHospitalDays
    return Tuple {
      encounter: InpatientHospitalDays.encounter,
      relevantPeriod: InpatientHospitalDays.relevantPeriod,
      relevantDays: ( InpatientHospitalDays.relevantDays EncounterDay
          return Tuple {
            dayNumber: EncounterDay.dayNumber,
            dayPeriod: EncounterDay.dayPeriod,
            hasSevereResult: exists ( ["LaboratoryResultObservation": "Glucose Lab Test Mass Per Volume"] GlucoseTest
                where GlucoseTest.status in { 'final', 'amended', 'corrected' }
                  and GlucoseTest.value > 300 'mg/dL'
                  and QICoreCommon."Earliest" ( GlucoseTest.effective ) during EncounterDay.dayPeriod
            ),
            hasElevatedResult: exists ( ["LaboratoryResultObservation": "Glucose Lab Test Mass Per Volume"] GlucoseTest
                where GlucoseTest.status in { 'final', 'amended', 'corrected' }
                  and GlucoseTest.value >= 200 'mg/dL'
                  and QICoreCommon."Earliest" ( GlucoseTest.effective ) during EncounterDay.dayPeriod
            ),
            hasNoGlucoseTest: not exists ( ["LaboratoryResultObservation": "Glucose Lab Test Mass Per Volume"] GlucoseTest
                where GlucoseTest.status in { 'final', 'amended', 'corrected' }
                  and QICoreCommon."Earliest" ( GlucoseTest.effective ) during EncounterDay.dayPeriod
            )
          }
      )
    }
Logic Definition Library Name: CMS871HHHyperFHIR
/*# hyper days uses "Relevant Encounters With Glucose Result Days" to find if hyper event on each day. Skips 1st day in 'RelevantDays`. Returns boolean based on: Today high result OR Today no result AND Yesterday high result AND 2 days ago high result*/


define "Days with Hyperglycemic Events":
  "Days with Glucose Results" EncounterWithResultDays
    let eligibleEventDays: EncounterWithResultDays.relevantDays EncounterDay
      where EncounterDay.dayNumber > 1
      return Tuple {
        dayIndex: EncounterDay.dayNumber,
        dayPeriod: EncounterDay.dayPeriod,
        hasHyperglycemicEvent: ( EncounterDay.hasSevereResult
            or ( EncounterDay.hasNoGlucoseTest
                and EncounterWithResultDays.relevantDays[EncounterDay.dayNumber - 2].hasElevatedResult
                and EncounterWithResultDays.relevantDays[EncounterDay.dayNumber - 3].hasElevatedResult
            )
        )
      }
    return Tuple {
      encounter: EncounterWithResultDays.encounter,
      relevantPeriod: EncounterWithResultDays.relevantPeriod,
      eligibleEventDays: eligibleEventDays
    }
Logic Definition Library Name: CMS871HHHyperFHIR
/***/


define "Encounter with Hyperglycemic Events":
  "Days with Hyperglycemic Events" HyperglycemicEventDays
    where exists ( HyperglycemicEventDays.eligibleEventDays EligibleEventDay
        where EligibleEventDay.hasHyperglycemicEvent
    )
    return HyperglycemicEventDays.encounter
Logic Definition Library Name: CMS871HHHyperFHIR
define "Numerator":
  "Encounter with Hyperglycemic Events"
Logic Definition Library Name: CMS871HHHyperFHIR
define "Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start":
  from
    "Initial Population" InpatientHospitalization,
    ["LaboratoryResultObservation": "Glucose Lab Test Mass Per Volume"] GlucoseTest
    let HospitalizationInterval: CQMCommon."HospitalizationWithObservation" ( InpatientHospitalization ),
    GlucoseTestTime: QICoreCommon."Earliest" ( GlucoseTest.effective )
    where GlucoseTest.value as Quantity > 600 'mg/dL'
      and GlucoseTest.status in { 'final', 'amended', 'corrected' }
      and GlucoseTestTime during Interval[( start of HospitalizationInterval - 1 hour ), ( start of HospitalizationInterval + 6 hours )]
    return GlucoseTest
Logic Definition Library Name: CMS871HHHyperFHIR
define "Glucose Tests Earlier Than Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start":
  from
    "Initial Population" InpatientHospitalization,
    "Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start" GlucoseResult600,
    ["LaboratoryResultObservation": "Glucose Lab Test Mass Per Volume"] EarlierGlucoseTest
    let HospitalizationInterval: CQMCommon."HospitalizationWithObservation" ( InpatientHospitalization ),
    GlucoseTest600Time: QICoreCommon."Earliest" ( GlucoseResult600.effective ),
    EarlierGlucoseTestTime: QICoreCommon."Earliest" ( EarlierGlucoseTest.effective )
    where GlucoseTest600Time during Interval[( start of HospitalizationInterval - 1 hour ), ( start of HospitalizationInterval + 6 hour )]
      and EarlierGlucoseTestTime during Interval[( start of HospitalizationInterval - 1 hour ), GlucoseTest600Time )
      and EarlierGlucoseTest.id !~ GlucoseResult600.id
    return GlucoseResult600
Logic Definition Library Name: CMS871HHHyperFHIR
define "Initial Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start":
  "Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start" GlucoseResult600
    where not ( GlucoseResult600.id in "Glucose Tests Earlier Than Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start".id )
Logic Definition Library Name: CMS871HHHyperFHIR
define "Encounter with Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start":
  from
    "Initial Population" InpatientHospitalization,
    "Initial Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start" EarlyGlucoseResult
    where EarlyGlucoseResult.value as Quantity > 600 'mg/dL'
      and EarlyGlucoseResult.status in { 'final', 'amended', 'corrected' }
      and QICoreCommon."Earliest" ( EarlyGlucoseResult.effective ) during Interval[( start of CQMCommon."HospitalizationWithObservation" ( InpatientHospitalization ) - 1 hour ), ( start of CQMCommon."HospitalizationWithObservation" ( InpatientHospitalization ) + 6 hours )]
    return InpatientHospitalization
Logic Definition Library Name: CMS871HHHyperFHIR
/***/


define "Comfort Measures Care":
  ["ServiceRequest": "Comfort Measures"]
    union ["Procedure": "Comfort Measures"]
Logic Definition Library Name: CMS871HHHyperFHIR
define "Encounter with Comfort Measures during Hospitalization":
  "Initial Population" InpatientHospitalization
    with "Comfort Measures Care" ComfortCare
      such that Coalesce(ComfortCare.performed.toInterval(), ComfortCare.authoredOn.toInterval()) during CQMCommon."HospitalizationWithObservation" ( InpatientHospitalization )
Logic Definition Library Name: CMS871HHHyperFHIR
define "Encounter with Discharge for Hospice Care":
  "Initial Population" InpatientHospitalization
    where InpatientHospitalization.hospitalization.dischargeDisposition in "Discharged to Home for Hospice Care"
      or InpatientHospitalization.hospitalization.dischargeDisposition in "Discharged to Health Care Facility for Hospice Care"
Logic Definition Library Name: CMS871HHHyperFHIR
define "Encounter with Early Glucose Greater Than 600 or with Comfort or Hospice Care":
  "Encounter with Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start"
    union "Encounter with Comfort Measures during Hospitalization"
    union "Encounter with Discharge for Hospice Care"
Logic Definition Library Name: CMS871HHHyperFHIR
define "Numerator Exclusions":
  "Encounter with Early Glucose Greater Than 600 or with Comfort or Hospice Care"
Logic Definition Library Name: CMS871HHHyperFHIR
define "SDE Payer":
  SDE."SDE Payer"
Logic Definition Library Name: CMS871HHHyperFHIR
define "SDE Ethnicity":
  SDE."SDE Ethnicity"
Logic Definition Library Name: CMS871HHHyperFHIR
define "Denominator Exclusions":
  "Encounter with Early Glucose Greater Than 600 or with Comfort or Hospice Care"
Logic Definition Library Name: CMS871HHHyperFHIR
define "SDE Race":
  SDE."SDE Race"
Logic Definition Library Name: CMS871HHHyperFHIR
/**
 * Crops an interval to a maximum length of 10 days.*/


define function "Hospital Days Max 10"(Period Interval<DateTime>):
  Interval[start of Period, Min({ 
    end of Period, start of Period + 10 days }
  )]
Logic Definition Library Name: CMS871HHHyperFHIR
/**
 * Creates a list of 24 hour long intervals in an interval paired with the index (1 indexed) to which 24 hour interval it is.*/


define function "Days In Period"(Period Interval<DateTime>):
  ( "Interval To Day Numbers"(Period) ) DayNumber
    let startPeriod: start of Period + ( 24 hours * ( DayNumber - 1 ) ),
    endPeriod: if ( hours between startPeriod and end of Period < 24 ) then startPeriod 
      else start of Period + ( 24 hours * DayNumber )
    return Tuple {
      dayNumber: DayNumber,
      dayPeriod: Interval[startPeriod, endPeriod )
    }
Logic Definition Library Name: CMS871HHHyperFHIR
/**
 * Creates a list of integers from 1 to how many days are in the interval. Note, this wont create an index for
 * the final day if it is less than 24 hours. This also includes the first 24 hour period.*/


define function "Interval To Day Numbers"(Period Interval<DateTime>):
  ( expand { Interval[1, duration in days between start of Period and end of Period]} ) DayExpand
    return end of DayExpand
Logic Definition Library Name: CMS871HHHyperFHIR
/**
 * Counts the number of eligible days in an encounter. This simply filters and counts the data built in
 * "Relevant Encounters With Hyperglycemic Event Days".*/


define function "Denominator Observations"(QualifyingEncounter Encounter):
  if QualifyingEncounter.id in "Denominator Exclusions".id then singleton from ( "Days with Hyperglycemic Events" EncounterWithEventDays
      where EncounterWithEventDays.encounter = QualifyingEncounter
      return 0
  ) 
    else singleton from ( "Days with Hyperglycemic Events" EncounterWithEventDays
      where EncounterWithEventDays.encounter = QualifyingEncounter
      return Count(EncounterWithEventDays.eligibleEventDays)
  )
Logic Definition Library Name: CMS871HHHyperFHIR
/**
 * Counts the number of eligible days with a hyperglycemic event in an encounter. This simply filters and counts the data built in
 * "Relevant Encounters With Hyperglycemic Event Days".*/


define function "Numerator Observations"(QualifyingEncounter Encounter):
  if QualifyingEncounter.id in "Denominator Exclusions".id then singleton from ( "Days with Hyperglycemic Events" EncounterWithEventDays
      where EncounterWithEventDays.encounter = QualifyingEncounter
      return 0
  ) 
    else singleton from ( "Days with Hyperglycemic Events" EncounterWithEventDays
      where EncounterWithEventDays.encounter = QualifyingEncounter
      return Count(EncounterWithEventDays.eligibleEventDays EligibleEventDay
          where EligibleEventDay.hasHyperglycemicEvent
      )
  )
Terminology
Code System Description: Code system SNOMEDCT
Resource: SNOMED CT (all versions)
Canonical URL: http://snomed.info/sct
Value Set Description: Value set Encounter Inpatient
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Value Set Description: Value set Observation Services
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143
Value Set Description: Value set Emergency Department Visit
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292
Value Set Description: Value set Diabetes
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.103.12.1001
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.103.12.1001
Value Set Description: Value set Hypoglycemics Treatment Medications
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1196.394
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1196.394
Value Set Description: Value set Glucose Lab Test Mass Per Volume
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.34
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.34
Value Set Description: Value set Comfort Measures
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45
Value Set Description: Value set Discharged to Home for Hospice Care
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.209
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.209
Value Set Description: Value set Discharged to Health Care Facility for Hospice Care
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.207
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.207
Value Set Description: Value set Payer Type
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
Direct Reference Code Display: Male (finding)
Code: 248153007
System: http://snomed.info/sct
Direct Reference Code Display: Female (finding)
Code: 248152002
System: http://snomed.info/sct
Dependencies
Dependency Description: Library SDE
Resource: SupplementalDataElementsversion: null5.1.000)
Canonical URL: https://madie.cms.gov/Library/SupplementalDataElements|5.1.000
Dependency Description: Library FHIRHelpers
Resource: FHIRHelpersversion: null4.4.000)
Canonical URL: https://madie.cms.gov/Library/FHIRHelpers|4.4.000
Dependency Description: Library CQMCommon
Resource: CQMCommonversion: null4.1.000)
Canonical URL: https://madie.cms.gov/Library/CQMCommon|4.1.000
Dependency Description: Library QICoreCommon
Resource: QICoreCommonversion: null4.0.000)
Canonical URL: https://madie.cms.gov/Library/QICoreCommon|4.0.000
Data Requirements
Data Requirement Type: Patient
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient
Must Support Elements: extension, birthDate, birthDate.value, url
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, status, status.value, period, hospitalization, hospitalization.dischargeDisposition
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, status, status.value, period, hospitalization, hospitalization.dischargeDisposition
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, period, status, status.value, hospitalization, hospitalization.dischargeDisposition, hospitalizationPeriod, encounter
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Data Requirement Type: Condition
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.103.12.1001
Data Requirement Type: MedicationAdministration
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration
Must Support Elements: medication, status, status.value, effective
Code Filter(s):
Path: medication
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1196.394
Data Requirement Type: MedicationAdministration
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration
Must Support Elements: medication.reference.value, status, status.value, effective
Data Requirement Type: Medication
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medication
Must Support Elements: id.value, code
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab
Must Support Elements: code, effective, status, status.value, value, id, id.value
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.34
Data Requirement Type: ServiceRequest
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45
Data Requirement Type: Procedure
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45
Data Requirement Type: Coverage
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage
Must Support Elements: type, period
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
Generated using version 0.4.8 of the sample-content-ig Liquid templates

Source

{
  "resourceType": "Measure",
  "id": "CMS871HHHyperFHIR",
  "meta": {
    "profile": [
      "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-shareablemeasure",
      "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/computable-measure-cqfm",
      "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/publishable-measure-cqfm",
      "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/executable-measure-cqfm",
      "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cql-measure-cqfm",
      "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/elm-measure-cqfm",
      "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/ratio-measure-cqfm"
    ]
  },
  "text": {
    "status": "extensions",
    "div": "<!-- snip (see above) -->"
  },
  "contained": [
    {
      "resourceType": "Library",
      "id": "effective-data-requirements",
      "extension": [
        {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode",
          "valueCoding": {
            "system": "http://snomed.info/sct",
            "code": "248153007",
            "display": "Male (finding)"
          }
        },
        {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode",
          "valueCoding": {
            "system": "http://snomed.info/sct",
            "code": "248152002",
            "display": "Female (finding)"
          }
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "SupplementalDataElements"
            },
            {
              "url": "name",
              "valueString": "SDE Sex"
            },
            {
              "url": "statement",
              "valueString": "define \"SDE Sex\":\n  case\n    when Patient.sex = '248153007' then \"Male (finding)\"\n    when Patient.sex = '248152002' then \"Female (finding)\"\n    else null\n  end"
            },
            {
              "url": "displaySequence",
              "valueInteger": 0
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "SDE Sex"
            },
            {
              "url": "statement",
              "valueString": "define \"SDE Sex\":\n  SDE.\"SDE Sex\""
            },
            {
              "url": "displaySequence",
              "valueInteger": 1
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Qualifying Encounter"
            },
            {
              "url": "statement",
              "valueString": "define \"Qualifying Encounter\":\n  [\"Encounter\": \"Encounter Inpatient\"] InpatientEncounter\n    where AgeInYearsAt(date from start of InpatientEncounter.period) >= 18\n      and InpatientEncounter.period ends during day of \"Measurement Period\"\n      and InpatientEncounter.status = 'finished'"
            },
            {
              "url": "displaySequence",
              "valueInteger": 2
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Encounter with Hospitalization Period"
            },
            {
              "url": "statement",
              "valueString": "/**\n * Create paring of encounters to hospitalization period so this calculation can be inspected and the result \n * can be reused, making the logic faster.*/\n\n\ndefine \"Encounter with Hospitalization Period\":\n  \"Qualifying Encounter\" QualifyingHospitalization\n    return Tuple {\n      encounter: QualifyingHospitalization,\n      hospitalizationPeriod: CQMCommon.\"HospitalizationWithObservation\" ( QualifyingHospitalization )\n    }"
            },
            {
              "url": "displaySequence",
              "valueInteger": 3
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Encounter with Existing Diabetes Diagnosis"
            },
            {
              "url": "statement",
              "valueString": "/**\n * Using the already calculated pairing of hospitalization periods with encounters, filter on ones with \n * diabetes and return the encounter.*/\n\n\ndefine \"Encounter with Existing Diabetes Diagnosis\":\n  \"Encounter with Hospitalization Period\" Hospitalization\n    with [\"ConditionEncounterDiagnosis\": \"Diabetes\"] Diabetes\n      such that ( QICoreCommon.\"ToPrevalenceInterval\" ( Diabetes ) starts before end of Hospitalization.hospitalizationPeriod )\n    return Hospitalization.encounter"
            },
            {
              "url": "displaySequence",
              "valueInteger": 4
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Encounter with Hypoglycemic Medication"
            },
            {
              "url": "statement",
              "valueString": "/**\n * Using the already calculated pairing of hospitalization periods with encounters, filter on ones with \n * hypoglycemic medicatons and return the encounter.*/\n\n\ndefine \"Encounter with Hypoglycemic Medication\":\n  from\n    \"Encounter with Hospitalization Period\" Hospitalization,\n    [\"MedicationAdministration\": \"Hypoglycemics Treatment Medications\"] HypoglycemicMed\n    where HypoglycemicMed.status in { 'completed', 'in-progress' }\n          //and HypoglycemicMed.status != 'not-done'\n      \n      and QICoreCommon.\"ToInterval\" ( HypoglycemicMed.effective ) during Hospitalization.hospitalizationPeriod\n    return Hospitalization.encounter"
            },
            {
              "url": "displaySequence",
              "valueInteger": 5
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Encounter with Elevated Glucose Greater Than or Equal to 200"
            },
            {
              "url": "statement",
              "valueString": "/**\n * Using the already calculated pairing of hospitalization periods with encounters, filter on ones with \n * any elevated (>= 200) blood glucose reading during the hospitalization*/\n\n\ndefine \"Encounter with Elevated Glucose Greater Than or Equal to 200\":\n  \"Encounter with Hospitalization Period\" Hospitalization\n    with [\"LaboratoryResultObservation\": \"Glucose Lab Test Mass Per Volume\"] GlucoseTest\n      such that QICoreCommon.\"Earliest\" ( GlucoseTest.effective ) during Hospitalization.hospitalizationPeriod\n        and GlucoseTest.status in { 'final', 'amended', 'corrected' }\n            //and GlucoseTest.status != 'cancelled'\n        \n        and GlucoseTest.value >= 200 'mg/dL'\n    return Hospitalization.encounter"
            },
            {
              "url": "displaySequence",
              "valueInteger": 6
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Initial Population"
            },
            {
              "url": "statement",
              "valueString": "define \"Initial Population\":\n  \"Encounter with Existing Diabetes Diagnosis\"\n    union \"Encounter with Hypoglycemic Medication\"\n    union \"Encounter with Elevated Glucose Greater Than or Equal to 200\""
            },
            {
              "url": "displaySequence",
              "valueInteger": 7
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Denominator"
            },
            {
              "url": "statement",
              "valueString": "define \"Denominator\":\n  \"Initial Population\""
            },
            {
              "url": "displaySequence",
              "valueInteger": 8
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Measurement Population"
            },
            {
              "url": "statement",
              "valueString": "define \"Measurement Population\":\n  \"Denominator\""
            },
            {
              "url": "displaySequence",
              "valueInteger": 9
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Days in Hospitalization"
            },
            {
              "url": "statement",
              "valueString": "define \"Days in Hospitalization\":\n  \"Measurement Population\" EligibleInpatientHospitalization\n    let period: CQMCommon.\"HospitalizationWithObservation\" ( EligibleInpatientHospitalization ),\n    relevantPeriod: \"Hospital Days Max 10\"(period)\n    return Tuple {\n      encounter: EligibleInpatientHospitalization,\n      hospitalizationPeriod: period,\n      relevantPeriod: relevantPeriod,\n      relevantDays: \"Days In Period\"(relevantPeriod)\n    }"
            },
            {
              "url": "displaySequence",
              "valueInteger": 10
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Days with Glucose Results"
            },
            {
              "url": "statement",
              "valueString": "define \"Days with Glucose Results\":\n  \"Days in Hospitalization\" InpatientHospitalDays\n    return Tuple {\n      encounter: InpatientHospitalDays.encounter,\n      relevantPeriod: InpatientHospitalDays.relevantPeriod,\n      relevantDays: ( InpatientHospitalDays.relevantDays EncounterDay\n          return Tuple {\n            dayNumber: EncounterDay.dayNumber,\n            dayPeriod: EncounterDay.dayPeriod,\n            hasSevereResult: exists ( [\"LaboratoryResultObservation\": \"Glucose Lab Test Mass Per Volume\"] GlucoseTest\n                where GlucoseTest.status in { 'final', 'amended', 'corrected' }\n                  and GlucoseTest.value > 300 'mg/dL'\n                  and QICoreCommon.\"Earliest\" ( GlucoseTest.effective ) during EncounterDay.dayPeriod\n            ),\n            hasElevatedResult: exists ( [\"LaboratoryResultObservation\": \"Glucose Lab Test Mass Per Volume\"] GlucoseTest\n                where GlucoseTest.status in { 'final', 'amended', 'corrected' }\n                  and GlucoseTest.value >= 200 'mg/dL'\n                  and QICoreCommon.\"Earliest\" ( GlucoseTest.effective ) during EncounterDay.dayPeriod\n            ),\n            hasNoGlucoseTest: not exists ( [\"LaboratoryResultObservation\": \"Glucose Lab Test Mass Per Volume\"] GlucoseTest\n                where GlucoseTest.status in { 'final', 'amended', 'corrected' }\n                  and QICoreCommon.\"Earliest\" ( GlucoseTest.effective ) during EncounterDay.dayPeriod\n            )\n          }\n      )\n    }"
            },
            {
              "url": "displaySequence",
              "valueInteger": 11
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Days with Hyperglycemic Events"
            },
            {
              "url": "statement",
              "valueString": "/*# hyper days uses \"Relevant Encounters With Glucose Result Days\" to find if hyper event on each day. Skips 1st day in 'RelevantDays`. Returns boolean based on: Today high result OR Today no result AND Yesterday high result AND 2 days ago high result*/\n\n\ndefine \"Days with Hyperglycemic Events\":\n  \"Days with Glucose Results\" EncounterWithResultDays\n    let eligibleEventDays: EncounterWithResultDays.relevantDays EncounterDay\n      where EncounterDay.dayNumber > 1\n      return Tuple {\n        dayIndex: EncounterDay.dayNumber,\n        dayPeriod: EncounterDay.dayPeriod,\n        hasHyperglycemicEvent: ( EncounterDay.hasSevereResult\n            or ( EncounterDay.hasNoGlucoseTest\n                and EncounterWithResultDays.relevantDays[EncounterDay.dayNumber - 2].hasElevatedResult\n                and EncounterWithResultDays.relevantDays[EncounterDay.dayNumber - 3].hasElevatedResult\n            )\n        )\n      }\n    return Tuple {\n      encounter: EncounterWithResultDays.encounter,\n      relevantPeriod: EncounterWithResultDays.relevantPeriod,\n      eligibleEventDays: eligibleEventDays\n    }"
            },
            {
              "url": "displaySequence",
              "valueInteger": 12
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Encounter with Hyperglycemic Events"
            },
            {
              "url": "statement",
              "valueString": "/***/\n\n\ndefine \"Encounter with Hyperglycemic Events\":\n  \"Days with Hyperglycemic Events\" HyperglycemicEventDays\n    where exists ( HyperglycemicEventDays.eligibleEventDays EligibleEventDay\n        where EligibleEventDay.hasHyperglycemicEvent\n    )\n    return HyperglycemicEventDays.encounter"
            },
            {
              "url": "displaySequence",
              "valueInteger": 13
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Numerator"
            },
            {
              "url": "statement",
              "valueString": "define \"Numerator\":\n  \"Encounter with Hyperglycemic Events\""
            },
            {
              "url": "displaySequence",
              "valueInteger": 14
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start"
            },
            {
              "url": "statement",
              "valueString": "define \"Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start\":\n  from\n    \"Initial Population\" InpatientHospitalization,\n    [\"LaboratoryResultObservation\": \"Glucose Lab Test Mass Per Volume\"] GlucoseTest\n    let HospitalizationInterval: CQMCommon.\"HospitalizationWithObservation\" ( InpatientHospitalization ),\n    GlucoseTestTime: QICoreCommon.\"Earliest\" ( GlucoseTest.effective )\n    where GlucoseTest.value as Quantity > 600 'mg/dL'\n      and GlucoseTest.status in { 'final', 'amended', 'corrected' }\n      and GlucoseTestTime during Interval[( start of HospitalizationInterval - 1 hour ), ( start of HospitalizationInterval + 6 hours )]\n    return GlucoseTest"
            },
            {
              "url": "displaySequence",
              "valueInteger": 15
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Glucose Tests Earlier Than Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start"
            },
            {
              "url": "statement",
              "valueString": "define \"Glucose Tests Earlier Than Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start\":\n  from\n    \"Initial Population\" InpatientHospitalization,\n    \"Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start\" GlucoseResult600,\n    [\"LaboratoryResultObservation\": \"Glucose Lab Test Mass Per Volume\"] EarlierGlucoseTest\n    let HospitalizationInterval: CQMCommon.\"HospitalizationWithObservation\" ( InpatientHospitalization ),\n    GlucoseTest600Time: QICoreCommon.\"Earliest\" ( GlucoseResult600.effective ),\n    EarlierGlucoseTestTime: QICoreCommon.\"Earliest\" ( EarlierGlucoseTest.effective )\n    where GlucoseTest600Time during Interval[( start of HospitalizationInterval - 1 hour ), ( start of HospitalizationInterval + 6 hour )]\n      and EarlierGlucoseTestTime during Interval[( start of HospitalizationInterval - 1 hour ), GlucoseTest600Time )\n      and EarlierGlucoseTest.id !~ GlucoseResult600.id\n    return GlucoseResult600"
            },
            {
              "url": "displaySequence",
              "valueInteger": 16
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Initial Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start"
            },
            {
              "url": "statement",
              "valueString": "define \"Initial Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start\":\n  \"Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start\" GlucoseResult600\n    where not ( GlucoseResult600.id in \"Glucose Tests Earlier Than Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start\".id )"
            },
            {
              "url": "displaySequence",
              "valueInteger": 17
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Encounter with Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start"
            },
            {
              "url": "statement",
              "valueString": "define \"Encounter with Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start\":\n  from\n    \"Initial Population\" InpatientHospitalization,\n    \"Initial Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start\" EarlyGlucoseResult\n    where EarlyGlucoseResult.value as Quantity > 600 'mg/dL'\n      and EarlyGlucoseResult.status in { 'final', 'amended', 'corrected' }\n      and QICoreCommon.\"Earliest\" ( EarlyGlucoseResult.effective ) during Interval[( start of CQMCommon.\"HospitalizationWithObservation\" ( InpatientHospitalization ) - 1 hour ), ( start of CQMCommon.\"HospitalizationWithObservation\" ( InpatientHospitalization ) + 6 hours )]\n    return InpatientHospitalization"
            },
            {
              "url": "displaySequence",
              "valueInteger": 18
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Comfort Measures Care"
            },
            {
              "url": "statement",
              "valueString": "/***/\n\n\ndefine \"Comfort Measures Care\":\n  [\"ServiceRequest\": \"Comfort Measures\"]\n    union [\"Procedure\": \"Comfort Measures\"]"
            },
            {
              "url": "displaySequence",
              "valueInteger": 19
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Encounter with Comfort Measures during Hospitalization"
            },
            {
              "url": "statement",
              "valueString": "define \"Encounter with Comfort Measures during Hospitalization\":\n  \"Initial Population\" InpatientHospitalization\n    with \"Comfort Measures Care\" ComfortCare\n      such that Coalesce(ComfortCare.performed.toInterval(), ComfortCare.authoredOn.toInterval()) during CQMCommon.\"HospitalizationWithObservation\" ( InpatientHospitalization )"
            },
            {
              "url": "displaySequence",
              "valueInteger": 20
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Encounter with Discharge for Hospice Care"
            },
            {
              "url": "statement",
              "valueString": "define \"Encounter with Discharge for Hospice Care\":\n  \"Initial Population\" InpatientHospitalization\n    where InpatientHospitalization.hospitalization.dischargeDisposition in \"Discharged to Home for Hospice Care\"\n      or InpatientHospitalization.hospitalization.dischargeDisposition in \"Discharged to Health Care Facility for Hospice Care\""
            },
            {
              "url": "displaySequence",
              "valueInteger": 21
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Encounter with Early Glucose Greater Than 600 or with Comfort or Hospice Care"
            },
            {
              "url": "statement",
              "valueString": "define \"Encounter with Early Glucose Greater Than 600 or with Comfort or Hospice Care\":\n  \"Encounter with Glucose Greater Than 600 within 1 Hour Prior To and 6 Hours After Encounter Start\"\n    union \"Encounter with Comfort Measures during Hospitalization\"\n    union \"Encounter with Discharge for Hospice Care\""
            },
            {
              "url": "displaySequence",
              "valueInteger": 22
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Numerator Exclusions"
            },
            {
              "url": "statement",
              "valueString": "define \"Numerator Exclusions\":\n  \"Encounter with Early Glucose Greater Than 600 or with Comfort or Hospice Care\""
            },
            {
              "url": "displaySequence",
              "valueInteger": 23
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "SupplementalDataElements"
            },
            {
              "url": "name",
              "valueString": "SDE Payer"
            },
            {
              "url": "statement",
              "valueString": "define \"SDE Payer\":\n  [Coverage: type in \"Payer Type\"] Payer\n    return {\n      code: Payer.type,\n      period: Payer.period\n    }"
            },
            {
              "url": "displaySequence",
              "valueInteger": 24
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "SDE Payer"
            },
            {
              "url": "statement",
              "valueString": "define \"SDE Payer\":\n  SDE.\"SDE Payer\""
            },
            {
              "url": "displaySequence",
              "valueInteger": 25
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "SupplementalDataElements"
            },
            {
              "url": "name",
              "valueString": "SDE Ethnicity"
            },
            {
              "url": "statement",
              "valueString": "define \"SDE Ethnicity\":\n  Patient.ethnicity E\n    return Tuple {\n      codes: { E.ombCategory } union E.detailed,\n      display: E.text\n    }"
            },
            {
              "url": "displaySequence",
              "valueInteger": 26
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "SDE Ethnicity"
            },
            {
              "url": "statement",
              "valueString": "define \"SDE Ethnicity\":\n  SDE.\"SDE Ethnicity\""
            },
            {
              "url": "displaySequence",
              "valueInteger": 27
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Denominator Exclusions"
            },
            {
              "url": "statement",
              "valueString": "define \"Denominator Exclusions\":\n  \"Encounter with Early Glucose Greater Than 600 or with Comfort or Hospice Care\""
            },
            {
              "url": "displaySequence",
              "valueInteger": 28
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "SupplementalDataElements"
            },
            {
              "url": "name",
              "valueString": "SDE Race"
            },
            {
              "url": "statement",
              "valueString": "define \"SDE Race\":\n  Patient.race R\n    return Tuple {\n      codes: R.ombCategory union R.detailed,\n      display: R.text\n    }"
            },
            {
              "url": "displaySequence",
              "valueInteger": 29
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "SDE Race"
            },
            {
              "url": "statement",
              "valueString": "define \"SDE Race\":\n  SDE.\"SDE Race\""
            },
            {
              "url": "displaySequence",
              "valueInteger": 30
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "FHIRHelpers"
            },
            {
              "url": "name",
              "valueString": "ToString"
            },
            {
              "url": "statement",
              "valueString": "define function ToString(value uri): value.value"
            },
            {
              "url": "displaySequence",
              "valueInteger": 31
            }
          ],
          "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": 32
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CQMCommon"
            },
            {
              "url": "name",
              "valueString": "HospitalizationWithObservation"
            },
            {
              "url": "statement",
              "valueString": "/*\n@description: Hospitalization with Observation returns the total interval from the start of any immediately prior emergency department visit through the observation visit to the discharge of the given encounter\n@deprecated: This function is deprecated. Use the fluent function `hospitalizationWithObservation()` instead.\n*/\ndefine function \"HospitalizationWithObservation\"(TheEncounter Encounter ):\n  TheEncounter Visit\n  \t\tlet ObsVisit: Last([Encounter: \"Observation Services\"] LastObs\n  \t\t\t\twhere LastObs.status = 'finished'\n            and LastObs.period ends 1 hour or less on or before start of Visit.period\n  \t\t\t\tsort by end of period\n  \t\t\t),\n  \t\t\tVisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),\n  \t\t\tEDVisit: Last([Encounter: \"Emergency Department Visit\"] LastED\n  \t\t\t\twhere LastED.status = 'finished'\n            and LastED.period ends 1 hour or less on or before VisitStart\n  \t\t\t\tsort by end of period\n  \t\t\t)\n  \t\treturn Interval[Coalesce(start of EDVisit.period, VisitStart), end of Visit.period]"
            },
            {
              "url": "displaySequence",
              "valueInteger": 33
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "QICoreCommon"
            },
            {
              "url": "name",
              "valueString": "ToPrevalenceInterval"
            },
            {
              "url": "statement",
              "valueString": "/*\n@description: Returns an interval representing the normalized prevalence period of a given Condition.\n@comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from\nonset to abatement as specified in the given Condition. If the condition is active, or has an abatement date the resulting \ninterval will have a closed ending boundary. Otherwise, the resulting interval will have an open ending boundary.\n@deprecated: This function is deprecated. Use the `prevalenceInterval()` fluent function instead\n*/\ndefine function ToPrevalenceInterval(condition Choice<\"ConditionEncounterDiagnosis\", \"ConditionProblemsHealthConcerns\">):\nif condition.clinicalStatus ~ \"active\"\n  or condition.clinicalStatus ~ \"recurrence\"\n  or condition.clinicalStatus ~ \"relapse\" then\n  Interval[start of ToInterval(condition.onset), end of ToAbatementInterval(condition)]\nelse\n   (end of ToAbatementInterval(condition)) abatementDate\n    return if abatementDate is null then\n      Interval[start of ToInterval(condition.onset), abatementDate)\n    else\n      Interval[start of ToInterval(condition.onset), abatementDate]"
            },
            {
              "url": "displaySequence",
              "valueInteger": 34
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "QICoreCommon"
            },
            {
              "url": "name",
              "valueString": "Earliest"
            },
            {
              "url": "statement",
              "valueString": "/*\n@description: Given an interval, return the starting point if the interval has a starting boundary specified,\notherwise, return the ending point\n@deprecated: This function is deprecated. Use the fluent function `earliest()` instead\n*/\ndefine function \"Earliest\"(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ):\n  (choice.toInterval()) period\n    return\n      if (HasStart(period)) then start of period\n      else end of period"
            },
            {
              "url": "displaySequence",
              "valueInteger": 35
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Hospital Days Max 10"
            },
            {
              "url": "statement",
              "valueString": "/**\n * Crops an interval to a maximum length of 10 days.*/\n\n\ndefine function \"Hospital Days Max 10\"(Period Interval<DateTime>):\n  Interval[start of Period, Min({ \n    end of Period, start of Period + 10 days }\n  )]"
            },
            {
              "url": "displaySequence",
              "valueInteger": 36
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Days In Period"
            },
            {
              "url": "statement",
              "valueString": "/**\n * Creates a list of 24 hour long intervals in an interval paired with the index (1 indexed) to which 24 hour interval it is.*/\n\n\ndefine function \"Days In Period\"(Period Interval<DateTime>):\n  ( \"Interval To Day Numbers\"(Period) ) DayNumber\n    let startPeriod: start of Period + ( 24 hours * ( DayNumber - 1 ) ),\n    endPeriod: if ( hours between startPeriod and end of Period < 24 ) then startPeriod \n      else start of Period + ( 24 hours * DayNumber )\n    return Tuple {\n      dayNumber: DayNumber,\n      dayPeriod: Interval[startPeriod, endPeriod )\n    }"
            },
            {
              "url": "displaySequence",
              "valueInteger": 37
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Interval To Day Numbers"
            },
            {
              "url": "statement",
              "valueString": "/**\n * Creates a list of integers from 1 to how many days are in the interval. Note, this wont create an index for\n * the final day if it is less than 24 hours. This also includes the first 24 hour period.*/\n\n\ndefine function \"Interval To Day Numbers\"(Period Interval<DateTime>):\n  ( expand { Interval[1, duration in days between start of Period and end of Period]} ) DayExpand\n    return end of DayExpand"
            },
            {
              "url": "displaySequence",
              "valueInteger": 38
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "QICoreCommon"
            },
            {
              "url": "name",
              "valueString": "toInterval"
            },
            {
              "url": "statement",
              "valueString": "/*\n@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval\n@comment: Normalizes a choice type of DateTime, Quanitty, Interval<DateTime>, or Interval<Quantity> types\nto an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible\nrepresentations for timing-valued elements in QICore, allowing this function to be used across any resource.\nThe input can be provided as a DateTime, Quantity, Interval<DateTime> or Interval<Quantity>.\nThe intent of this function is to provide a clear and concise mechanism to treat single\nelements that have multiple possible representations as intervals so that logic doesn't have to account\nfor the variability. More complex calculations (such as medication request period or dispense period\ncalculation) need specific guidance and consideration. That guidance may make use of this function, but\nthe focus of this function is on single element calculations where the semantics are unambiguous.\nIf the input is a DateTime, the result a DateTime Interval beginning and ending on that DateTime.\nIf the input is a Quantity, the quantity is expected to be a calendar-duration interpreted as an Age,\nand the result is a DateTime Interval beginning on the Date the patient turned that age and ending immediately before one year later.\nIf the input is a DateTime Interval, the result is the input.\nIf the input is a Quantity Interval, the quantities are expected to be calendar-durations interpreted as an Age, and the result\nis a DateTime Interval beginning on the date the patient turned the age given as the start of the quantity interval, and ending\nimmediately before one year later than the date the patient turned the age given as the end of the quantity interval.\nIf the input is a Timing, an error will be thrown indicating that Timing calculations are not implemented. Any other input will reslt in a null DateTime Interval\n*/\ndefine fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>, Timing>):\n  case\n\t  when choice is DateTime then\n    \tInterval[choice as DateTime, choice as DateTime]\n\t\twhen choice is Interval<DateTime> then\n  \t\tchoice as Interval<DateTime>\n\t\twhen choice is Quantity then\n\t\t  Interval[Patient.birthDate + (choice as Quantity),\n\t\t\t  Patient.birthDate + (choice as Quantity) + 1 year)\n\t\twhen choice is Interval<Quantity> then\n\t\t  Interval[Patient.birthDate + (choice.low as Quantity),\n\t\t\t  Patient.birthDate + (choice.high as Quantity) + 1 year)\n\t\twhen choice is Timing then\n      Message(null, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported') as Interval<DateTime>\n\t\telse\n\t\t\tnull as Interval<DateTime>\n\tend"
            },
            {
              "url": "displaySequence",
              "valueInteger": 39
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Denominator Observations"
            },
            {
              "url": "statement",
              "valueString": "/**\n * Counts the number of eligible days in an encounter. This simply filters and counts the data built in\n * \"Relevant Encounters With Hyperglycemic Event Days\".*/\n\n\ndefine function \"Denominator Observations\"(QualifyingEncounter Encounter):\n  if QualifyingEncounter.id in \"Denominator Exclusions\".id then singleton from ( \"Days with Hyperglycemic Events\" EncounterWithEventDays\n      where EncounterWithEventDays.encounter = QualifyingEncounter\n      return 0\n  ) \n    else singleton from ( \"Days with Hyperglycemic Events\" EncounterWithEventDays\n      where EncounterWithEventDays.encounter = QualifyingEncounter\n      return Count(EncounterWithEventDays.eligibleEventDays)\n  )"
            },
            {
              "url": "displaySequence",
              "valueInteger": 40
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "FHIRHelpers"
            },
            {
              "url": "name",
              "valueString": "ToCode"
            },
            {
              "url": "statement",
              "valueString": "/*\n@description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.\n*/\ndefine function ToCode(coding FHIR.Coding):\n    if coding is null then\n        null\n    else\n        System.Code {\n          code: coding.code.value,\n          system: coding.system.value,\n          version: coding.version.value,\n          display: coding.display.value\n        }"
            },
            {
              "url": "displaySequence",
              "valueInteger": 41
            }
          ],
          "url": "http://hl7.org/fhir/StructureDefinition/cqf-logicDefinition"
        },
        {
          "extension": [
            {
              "url": "libraryName",
              "valueString": "CMS871HHHyperFHIR"
            },
            {
              "url": "name",
              "valueString": "Numerator Observations"
            },
            {
              "url": "statement",
              "valueString": "/**\n * Counts the number of eligible days with a hyperglycemic event in an encounter. This simply filters and counts the data built in\n * \"Relevant Encounters With Hyperglycemic Event Days\".*/\n\n\ndefine function \"Numerator Observations\"(QualifyingEncounter Encounter):\n  if QualifyingEncounter.id in \"Denominator Exclusions\".id then singleton from ( \"Days with Hyperglycemic Events\" EncounterWithEventDays\n      where EncounterWithEventDays.encounter = QualifyingEncounter\n      return 0\n  ) \n    else singleton from ( \"Days with Hyperglycemic Events\" EncounterWithEventDays\n      where EncounterWithEventDays.encounter = QualifyingEncounter\n      return Count(EncounterWithEventDays.eligibleEventDays EligibleEventDay\n          where EligibleEventDay.hasHyperglycemicEvent\n      )\n  )"
            },
            {
              "url": "displaySequence",
              "valueInteger": 42
            }
          ],
          "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": "Library SDE",
          "resource": "https://madie.cms.gov/Library/SupplementalDataElements|5.1.000"
        },
        {
          "type": "depends-on",
          "display": "Library FHIRHelpers",
          "resource": "https://madie.cms.gov/Library/FHIRHelpers|4.4.000"
        },
        {
          "type": "depends-on",
          "display": "Library CQMCommon",
          "resource": "https://madie.cms.gov/Library/CQMCommon|4.1.000"
        },
        {
          "type": "depends-on",
          "display": "Library QICoreCommon",
          "resource": "https://madie.cms.gov/Library/QICoreCommon|4.0.000"
        },
        {
          "type": "depends-on",
          "display": "Code system SNOMEDCT",
          "resource": "http://snomed.info/sct"
        },
        {
          "type": "depends-on",
          "display": "Value set Encounter Inpatient",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"
        },
        {
          "type": "depends-on",
          "display": "Value set Observation Services",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143"
        },
        {
          "type": "depends-on",
          "display": "Value set Emergency Department Visit",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"
        },
        {
          "type": "depends-on",
          "display": "Value set Diabetes",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.103.12.1001"
        },
        {
          "type": "depends-on",
          "display": "Value set Hypoglycemics Treatment Medications",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1196.394"
        },
        {
          "type": "depends-on",
          "display": "Value set Glucose Lab Test Mass Per Volume",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.34"
        },
        {
          "type": "depends-on",
          "display": "Value set Comfort Measures",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45"
        },
        {
          "type": "depends-on",
          "display": "Value set Discharged to Home for Hospice Care",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.209"
        },
        {
          "type": "depends-on",
          "display": "Value set Discharged to Health Care Facility for Hospice Care",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.207"
        },
        {
          "type": "depends-on",
          "display": "Value set Payer Type",
          "resource": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
        }
      ],
      "parameter": [
        {
          "name": "Measurement Period",
          "use": "in",
          "min": 0,
          "max": "1",
          "type": "Period"
        },
        {
          "name": "SDE Sex",
          "use": "out",
          "min": 0,
          "max": "1",
          "type": "Coding"
        },
        {
          "name": "Numerator",
          "use": "out",
          "min": 0,
          "max": "*",
          "type": "Resource"
        },
        {
          "name": "Denominator",
          "use": "out",
          "min": 0,
          "max": "*",
          "type": "Resource"
        },
        {
          "name": "Numerator Exclusions",
          "use": "out",
          "min": 0,
          "max": "*",
          "type": "Resource"
        },
        {
          "name": "SDE Payer",
          "use": "out",
          "min": 0,
          "max": "*",
          "type": "Resource"
        },
        {
          "name": "Initial Population",
          "use": "out",
          "min": 0,
          "max": "*",
          "type": "Resource"
        },
        {
          "name": "SDE Ethnicity",
          "use": "out",
          "min": 0,
          "max": "1",
          "type": "Resource"
        },
        {
          "name": "Denominator Exclusions",
          "use": "out",
          "min": 0,
          "max": "*",
          "type": "Resource"
        },
        {
          "name": "SDE Race",
          "use": "out",
          "min": 0,
          "max": "1",
          "type": "Resource"
        }
      ],
      "dataRequirement": [
        {
          "type": "Patient",
          "profile": [
            "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient"
          ],
          "mustSupport": [
            "extension",
            "birthDate",
            "birthDate.value",
            "url"
          ]
        },
        {
          "type": "Encounter",
          "profile": [
            "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"
          ],
          "mustSupport": [
            "type",
            "status",
            "status.value",
            "period",
            "hospitalization",
            "hospitalization.dischargeDisposition"
          ],
          "codeFilter": [
            {
              "path": "type",
              "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143"
            }
          ]
        },
        {
          "type": "Encounter",
          "profile": [
            "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"
          ],
          "mustSupport": [
            "type",
            "status",
            "status.value",
            "period",
            "hospitalization",
            "hospitalization.dischargeDisposition"
          ],
          "codeFilter": [
            {
              "path": "type",
              "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292"
            }
          ]
        },
        {
          "type": "Encounter",
          "profile": [
            "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"
          ],
          "mustSupport": [
            "type",
            "period",
            "status",
            "status.value",
            "hospitalization",
            "hospitalization.dischargeDisposition",
            "hospitalizationPeriod",
            "encounter"
          ],
          "codeFilter": [
            {
              "path": "type",
              "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307"
            }
          ]
        },
        {
          "type": "Condition",
          "profile": [
            "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis"
          ],
          "mustSupport": [
            "code"
          ],
          "codeFilter": [
            {
              "path": "code",
              "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.103.12.1001"
            }
          ]
        },
        {
          "type": "MedicationAdministration",
          "profile": [
            "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration"
          ],
          "mustSupport": [
            "medication",
            "status",
            "status.value",
            "effective"
          ],
          "codeFilter": [
            {
              "path": "medication",
              "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1196.394"
            }
          ]
        },
        {
          "type": "MedicationAdministration",
          "profile": [
            "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationadministration"
          ],
          "mustSupport": [
            "medication.reference.value",
            "status",
            "status.value",
            "effective"
          ]
        },
        {
          "type": "Medication",
          "profile": [
            "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medication"
          ],
          "mustSupport": [
            "id.value",
            "code"
          ]
        },
        {
          "type": "Observation",
          "profile": [
            "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab"
          ],
          "mustSupport": [
            "code",
            "effective",
            "status",
            "status.value",
            "value",
            "id",
            "id.value"
          ],
          "codeFilter": [
            {
              "path": "code",
              "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.34"
            }
          ]
        },
        {
          "type": "ServiceRequest",
          "profile": [
            "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest"
          ],
          "mustSupport": [
            "code"
          ],
          "codeFilter": [
            {
              "path": "code",
              "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45"
            }
          ]
        },
        {
          "type": "Procedure",
          "profile": [
            "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure"
          ],
          "mustSupport": [
            "code"
          ],
          "codeFilter": [
            {
              "path": "code",
              "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45"
            }
          ]
        },
        {
          "type": "Coverage",
          "profile": [
            "http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage"
          ],
          "mustSupport": [
            "type",
            "period"
          ],
          "codeFilter": [
            {
              "path": "type",
              "valueSet": "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
            }
          ]
        }
      ]
    }
  ],
  "extension": [
    {
      "id": "supplementalDataGuidance",
      "extension": [
        {
          "url": "guidance",
          "valueString": "For every patient evaluated by this measure also identify payer, race, ethnicity and sex; SDE Ethnicity \n SDE Payer \n SDE Race \n SDE Sex \n "
        },
        {
          "url": "usage",
          "valueCodeableConcept": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/measure-data-usage",
                "code": "supplemental-data",
                "display": "Supplemental Data"
              }
            ],
            "text": "Supplemental Data Guidance"
          }
        }
      ],
      "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-supplementalDataGuidance"
    },
    {
      "url": "http://hl7.org/fhir/uv/crmi/StructureDefinition/crmi-effectiveDataRequirements",
      "valueReference": {
        "reference": "#effective-data-requirements"
      }
    }
  ],
  "url": "https://madie.cms.gov/Measure/CMS871HHHyperFHIR",
  "identifier": [
    {
      "use": "usual",
      "type": {
        "coding": [
          {
            "system": "http://terminology.hl7.org/CodeSystem/artifact-identifier-type",
            "code": "short-name",
            "display": "Short Name"
          }
        ]
      },
      "system": "https://madie.cms.gov/measure/shortName",
      "value": "CMS871FHIR"
    },
    {
      "use": "official",
      "type": {
        "coding": [
          {
            "system": "http://terminology.hl7.org/CodeSystem/artifact-identifier-type",
            "code": "version-independent",
            "display": "Version Independent"
          }
        ]
      },
      "system": "urn:ietf:rfc:3986",
      "value": "urn:uuid:c44ca609-d795-4715-a8fc-1b0b30e46048"
    },
    {
      "use": "official",
      "type": {
        "coding": [
          {
            "system": "http://terminology.hl7.org/CodeSystem/artifact-identifier-type",
            "code": "version-specific",
            "display": "Version Specific"
          }
        ]
      },
      "system": "urn:ietf:rfc:3986",
      "value": "urn:uuid:b85cda48-6920-482f-aa2f-16efa09efe3f"
    },
    {
      "use": "official",
      "type": {
        "coding": [
          {
            "system": "http://terminology.hl7.org/CodeSystem/artifact-identifier-type",
            "code": "endorser",
            "display": "Endorser"
          }
        ]
      },
      "system": "https://madie.cms.gov/measure/cbeId",
      "value": "3533e",
      "assigner": {
        "display": "CMS Consensus Based Entity"
      }
    },
    {
      "use": "official",
      "type": {
        "coding": [
          {
            "system": "http://terminology.hl7.org/CodeSystem/artifact-identifier-type",
            "code": "publisher",
            "display": "Publisher"
          }
        ]
      },
      "system": "https://madie.cms.gov/measure/cmsId",
      "value": "871FHIR",
      "assigner": {
        "display": "CMS"
      }
    }
  ],
  "version": "0.3.000",
  "name": "CMS871HHHyperFHIR",
  "title": "Hospital Harm - Severe HyperglycemiaFHIR",
  "status": "active",
  "experimental": false,
  "date": "2025-05-23T20:52:29+00:00",
  "publisher": "Centers for Medicare & Medicaid Services (CMS)",
  "contact": [
    {
      "telecom": [
        {
          "system": "url",
          "value": "https://www.cms.gov/"
        }
      ]
    }
  ],
  "description": "This measure assesses the number of inpatient hospital days for patients age 18 and older with a hyperglycemic event (harm) per the total qualifying inpatient hospital days for that encounter",
  "usage": "The measure is using mg/dL as the unit of measurement for glucose results. Millimoles per liter (mmol/L) should be converted to milligrams per deciliter (mg/dL) for reporting this measure. \n\nWhen evaluating for days with a glucose level >300 mg/dL, the first 24-hour period after admission to the hospital is not evaluated to account for potentially poor glucose control outside of the hospital setting or that preceded the start of hospital care. The admission starts in the ED or observation when the transition between the ED encounter, observation encounter, and the inpatient encounter are within an hour or less of each other.\n\nThis measure evaluates the first 10 days of an eligible inpatient hospitalization in determining eligible days for the denominator and numerator (i.e., the length of stay is truncated to <=10 days when the length exceeds 10 days). Patients admitted for longer length of stays are more likely to have more complex medical conditions.  \n\nIn determining eligible days for the denominator and numerator, this measure does not evaluate the last day if it was less than a 24-hour period.  \n\nThe “Days in Hospitalization” logic within Measure Observation 1 (associated with the denominator), in conjunction with other logic, returns the day number (e.g., day 1 to day 10) for each day within the hospitalization period to determine the eligible hospital days (e.g., from day 2 to day 10). \n\nThe “Days in Hospitalization” logic within Measure Observation 2 (associated with the numerator), in conjunction with other logic, returns the day number (e.g., day 1 to day 10) for each day within the hospitalization period to determine the eligible hyperglycemic event days (e.g., from day 2 to day 10).\n\nSince the measure does not count any hyperglycemic events that occur in the first 24 hours, day 1 is not considered an eligible hospital day for the Measure Observations. Eligible days range from day 2 up to day 10. However, the measure does allow day 1 to be counted for the Numerator as one of the preceding days for a day where no glucose result is found. In this instance, the measure could evaluate day 1 as one of the two days preceding the day with no glucose result to see if there was a glucose value >=200 mg/dL on day 1. \n\nMultiple hyperglycemic events can occur during a ‘day,’ but this is still considered one hyperglycemic event day.\n\nThe numerator returns the first eligible encounter that meets the qualifying criteria: an inpatient hospitalization with a hyperglycemic event. Only one numerator is counted per encounter. Note that the Numerator returns the encounters, not days, that meet the criteria. \n\nThis measure includes two measure observations used to calculate the ratio of the number of inpatient hospital days with a hyperglycemic (high blood glucose) event over the total number of eligible inpatient hospital days (<= 10 days) for that encounter.  \n\nIn ratio measures, both the denominator and numerator populations flow separately from the same initial population. Therefore, the same exclusion criteria must be applied to both the denominator and numerator to prevent excluded cases from being considered. \n\nThe specimen source for the glucose test is blood, serum, plasma, or interstitial fluid, and can be obtained by a laboratory test, a POC test, or a continuous glucose monitor (CGM). Glucose test results from urine specimens are not considered. \n\nThis eCQM is an episode-based measure. An episode is defined as each inpatient hospitalization or encounter that ends during the measurement period.\n\nThis FHIR-based measure has been derived from the QDM-based measure: CMS871v5. Please refer to the HL7 QI-Core Implementation Guide https://hl7.org/fhir/us/qicore/STU6/) for more information on QI-Core and mapping recommendations from QDM to QI-Core STU 6 (https://hl7.org/fhir/us/qicore/STU6/qdm-to-qicore.html).",
  "copyright": "Limited proprietary coding is contained in the Measure specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets. American Institutes for Research(R), formerly IMPAQ International, disclaims all liability for use or accuracy of any third party codes contained in the specifications.\n\nLOINC(R) copyright 2004-2024 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2024 International Health Terminology Standards Development Organisation. ICD-10 copyright 2024 World Health Organization. All Rights Reserved.",
  "effectivePeriod": {
    "start": "2026-01-01",
    "end": "2026-12-31"
  },
  "author": [
    {
      "name": "Mathematica",
      "telecom": [
        {
          "system": "url",
          "value": "https://www.mathematica.org/"
        }
      ]
    }
  ],
  "relatedArtifact": [
    {
      "type": "citation",
      "citation": "CITATION - American Diabetes Association Professional Practice Committee; 16. (2022). Diabetes Care in the Hospital: Standards of Medical Care in Diabetes—2022. Diabetes Care 1 January 2022; 45 (Supplement_1): S244–S253.  https://doi.org/10.2337/dc22-S016\n"
    },
    {
      "type": "citation",
      "citation": "CITATION - Bersoux, S., Cook, C.B., Kongable, G.L., Shu, J. (2013). Trends in glycemic control over a 2-year period in 126 US hospitals. J Hosp Med. 2013;8(3):121-125. doi:10.1002/jhm.1997\n"
    },
    {
      "type": "citation",
      "citation": "CITATION - Donihi, A.C., Gibson, J.M., Noschese, M.L., et al. (2011). Effect of targeted glycemic management program on provider response to inpatient hyperglycemia. Endocr Pract. 2011; (4)552-557\n"
    },
    {
      "type": "citation",
      "citation": "CITATION - Gosmanov, A.R., Gosmanova, E.O., Kitabchi, A.E. (2021). Hyperglycemic Crises: Diabetic Ketoacidosis and Hyperglycemic Hyperosmolar State. [Updated 2021 May 9]. In: Feingold KR, Anawalt B, Boyce A, et al., editors. Endotext [Internet]. South Dartmouth (MA): MDText.com, Inc.; 2000-. Available from: https://www.ncbi.nlm.nih.gov/books/NBK279052/\n"
    },
    {
      "type": "citation",
      "citation": "CITATION - Jamesen, E., Nevalainen, P.L., Eskelinen, A., et al. (2015). Risk factors for perioperative hyperglycemia in primary hip and knee replacements. Acta Orthop. 2015; 86(2):175-182\n"
    },
    {
      "type": "citation",
      "citation": "CITATION - Korytkowski, M.T., Muniyappa, R., Antinori-Lent, K., Donihi, A.C., Drincic, A.T, Hirsch, I.B., Luger, A., McDonnell, M.E., Murad, M.H., Nielsen, C., Pegg, C., Rushakoff, R.J., Santesso, N., Umpierrez, G.E. (2022). Management of Hyperglycemia in Hospitalized Adult Patients in Non-Critical Care Settings: An Endocrine Society Clinical Practice Guideline, The Journal of Clinical Endocrinology & Metabolism, Volume 107, Issue 8, August 2022, Pages 2101–2128,  https://doi.org/10.1210/clinem/dgac278\n"
    },
    {
      "type": "citation",
      "citation": "CITATION - Krinsley, J.S., Jones, R.L. (2016). Cost analysis of intensive glycemic control in critically ill adult patients. Chest. 2016;129(3)644-650\n"
    },
    {
      "type": "citation",
      "citation": "CITATION - LeRoy, L.,  Richard, S. (2020). Harms Due to Diabetic Agents (Chapter 8), Making Healthcare Safer III: A Critical Analysis of Existing and Emerging Patient Safety Practices. Retrieved from: https://www.ahrq.gov/sites/default/files/wysiwyg/research/findings/making-healthcare-safer/mhs3/diabetes-1.pdf\n"
    },
    {
      "type": "citation",
      "citation": "CITATION - Maynard, G., Kulasa, K., Ramos, P., et al. (2015). Impact of a hypoglycemic reduction bundle and a systems approach to inpatient glycemic management. Endocr Pract. 2015;21(4):355-367\n"
    },
    {
      "type": "citation",
      "citation": "CITATION - Mendez, C.E., Ata, A., Rourke, J.M., et al. (2015). Daily inpatient glycemic survey (DINGS): A process to remotely identify and assist in the management of hospitalized patients with diabetes and hyperglycemia. Endocr Pract. 2015;21(8):927-935\n"
    },
    {
      "type": "citation",
      "citation": "CITATION - Pasquel, F.J., Lansang, M.C., Dhatariya, K., Umpierrez, G.E. (2021). Management of diabetes and hyperglycaemia in the hospital. The Lancet Diabetes & Endocrinology. 2021; 9: 174–88\n"
    },
    {
      "type": "citation",
      "citation": "CITATION - Sathya, B., Davis, R., Taveira, T., et al. (2013). Intensity of peri-operative glycemic control and postoperative outcomes in patients with diabetes: a meta-analysis. Diabetes Res Clin Pract. 2013;102(1):815.10.1016/j.diabres.2013.05.003\n"
    },
    {
      "type": "citation",
      "citation": "CITATION - Umpierrez, G., Cardona, S., Pasquel, F., et al. (2015). Randomized controlled trial of intensive versus conservative glucose control in patients undergoing coronary artery bypass graft surgery: gluco-CABG trial. Diabetes Care. 2015;38(9):1665-1672\n"
    },
    {
      "type": "citation",
      "citation": "CITATION - Umpierrez, G.E., Hellman, R., Korytkowski, M.T., et al. (2012). Management of Hyperglycemia in Hospitalized Patients in Non-critical Care Setting: An Endocrine Society Clinical Practice Guideline. J Clin Endocrinol Metab. 2012;97, 16-38\n"
    }
  ],
  "library": [
    "https://madie.cms.gov/Library/CMS871HHHyperFHIR"
  ],
  "disclaimer": "This performance measure is not a clinical guideline and does not establish a standard of medical care, and has not been tested for all potential applications.\n\nTHE MEASURES AND SPECIFICATIONS ARE PROVIDED \"AS IS\" WITHOUT WARRANTY OF ANY KIND.\n\nDue to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].",
  "rationale": "Hyperglycemia, i.e., elevated glucose level, is common among hospitalized patients, especially those with preexisting diabetes (Umpierrez et al., 2012) and accounts for over 30% of noncritically ill hospitalized patients (Korytkowski, 2022). Hyperglycemia can also affect individuals with no prior history of diabetes and may be induced by medications such as steroids or by parenteral (intravenous) or enteral (tube) feeding.\n\nSevere hyperglycemia, i.e., an extremely elevated glucose level, is significantly associated with a range of harms, including increased in-hospital mortality, infection rates, and hospital length of stay (Pasquel, et al., 2021; Umpierrez et al., 2012, 2015). Lower rates of inpatient severe hyperglycemia may not only improve care for patients but also may reduce costs for healthcare payers (Krinsley et al., 2016). The rate of hyperglycemia varies across hospitals, suggesting opportunities for improvement in inpatient glycemic management (Bersoux et al., 2013; Seisa et al., 2022). The rate of inpatient hyperglycemia can be considered a marker for quality of hospital care, since inpatient hyperglycemia is largely avoidable with proper glycemic management. The use of evidence-based standardized protocols and insulin management protocols have been shown to improve glycemic control and safety (Leroy et al., 2020; Maynard et al., 2015).\n\nIt should be noted that this measure does not aim to measure overall glucose control in hospitalized patients; rather, its goal is to assess the occurrence and extent of severe hyperglycemia. This measure is also intended to be used in combination with its companion measure of hypoglycemia (Hospital Harm – Hypoglycemia) to reduce unintended consequences of measurement.",
  "clinicalRecommendationStatement": "Multiple guidelines address recommended levels of glycemic control, though these do not define severe hyperglycemia: \n\nFrom Section 16, Diabetes Care in the Hospital, in the Standards of Care in Diabetes by the American Diabetes Association (American Diabetes Association Professional Practice Committee, 2024): \n\n16.4 Insulin and/or other therapies should be initiated or intensified for treatment of persistent hyperglycemia starting at a threshold of ≥180 mg/dL (10.0 mmol/L) (confirmed on two occasions within 24 hours) for noncritically ill (non-ICU) individuals. \n\n16.5a Once therapy is initiated, a glycemic goal of 140–180 mg/dL (7.8–10.0 mmol/L) is recommended for most critically ill (ICU) individuals with hyperglycemia.\n\n16.5 More stringent glycemic goals, such as 110–140 mg/dL (6.1–7.8 mmol/L), may be appropriate for selected critically ill individuals and are acceptable if they can be achieved without significant hypoglycemia.\n\nFrom Management of Hyperglycemia in Hospitalized Adult Patients in Non-Critical Care Settings: An Endocrine Society Clinical Practice Guideline (Korytkowski et al., 2022): \n\nRecommendation 1.1\nIn adults with insulin-treated diabetes hospitalized for noncritical illness who are at high risk of hypoglycemia, we suggest the use of real-time continuous glucose monitoring (CGM) with confirmatory bedside point-of-care blood glucose (POC-BG) monitoring for adjustments in insulin dosing rather than point-of-care blood glucose (POC-BG) testing alone in hospital settings where resources and training are available.\n\nRecommendation 10.1\nIn adults with no prior history of diabetes hospitalized for noncritical illness with hyperglycemia [defined as blood glucose (BG) > 140 mg/dL (7.8 mmol/L)] during hospitalization, we suggest initial therapy with correctional insulin over scheduled insulin therapy (defined as basal or basal/bolus insulin) to maintain glucose targets in the range of 100 to 180 mg/dL (5.6 to 10.0 mmol/L). For patients with persistent hyperglycemia [≥2 point-of-care blood glucose (POC-BG) measurements ≥ 180 mg/dL (≥10.0 mmol/L) in a 24-hour period on correctional insulin alone], we suggest the addition of scheduled insulin therapy. \n\nRecommendation 10.2\nIn adults with diabetes treated with diet or noninsulin diabetes medications prior to admission, we suggest initial therapy with correctional insulin or scheduled insulin therapy to maintain glucose targets in the range of 100 to 180 mg/dL (5.6 to 10.0 mmol/L). For hospitalized adults started on correctional insulin alone and with persistent hyperglycemia [≥2 point-of-care blood glucose (POC-BG) measurements ≥ 180 mg/dL in a 24-hour period (≥10.0 mmol/L)], we suggest addition of scheduled insulin therapy. We suggest initiation of scheduled insulin therapy for patients with confirmed admission blood glucose (BG) ≥ 180 mg/dL (≥10.0 mmol/L). \n\nRecommendation 10.3\nIn adults with insulin-treated diabetes prior to admission who are hospitalized for noncritical illness, we recommend continuation of the scheduled insulin regimen modified for nutritional status and severity of illness to maintain glucose targets in the range of 100 to 180 mg/dL (5.6 to 10.0 mmol/L).\n\nRemarks\nReductions in the dose of basal insulin (by 10% to 20%) at time of hospitalization may be required for patients on basal heavy insulin regimens (defined as doses of basal insulin ≥ 0.6 to 1.0 units/kg/day), in which basal insulin is being used inappropriately to cover meal-related excursions in BG.\n\nThere is no clinically accepted cutoff for severe hyperglycemia. Studies have used thresholds of >140, >180, >300, >350 and >400 mg/dL, among other values (American Diabetes Association Professional Practice Committee, 2024; Umpierrez et al, 2012, 2015; Jamesen et al., 2015; Donihi et al., 2011; Mendez et al, 2015; Seisa et al., 2022). Blood glucose level <180 mg/dL is associated with lower rates of mortality and stroke compared with a target glucose <200 mg/dL (Sathya et al., 2013). Glycemic goals may also differ among hospitalized patients. For inpatient management of hyperglycemia in noncritical care, the expert consensus recommends a target range of 100–180 mg/dL (5.6–10.0 mmol/L) for noncritically ill patients with “new” hyperglycemia as well as people with known diabetes prior to admission. Glycemic levels up to 250 mg/dL (13.9 mmol/L) may be acceptable in terminally ill patients with short life expectancy, patients with advanced kidney failure and/or on dialysis, patients at high risk for hypoglycemia, and/or patients with labile glycemic excursions. In these individuals, less aggressive treatment goals that would help avoid symptomatic hypoglycemia and/or hyperglycemia are often more appropriate (American Diabetes Association Professional Practice Committee, 2024). In an older patient with a prior history of severe hypoglycemia, some degree of hyperglycemia may be tolerated to maximize safety. Intensive insulin therapy to target glucose of 100 and 140mg/dL in the ICU did not significantly reduce perioperative complications compared with target glucose of 141 and 180mg/dL after coronary artery bypass surgery (Umpierrez et al., 2015). The current recommendation is to maintain a blood glucose level between 140-180 mg/dL (7.8-10.0 mmol/L) in both cardiac and non-cardiac ICU patients (Sreedharan et al., 2022). \n\nFor patients who present with hyperglycemic crises, neurologic status must be monitored closely, with frequent re-examination. Care should be taken to prevent over-correction of hyperglycemia and hyperosmolarity following initial fluid resuscitation of these patients to prevent cerebral edema, which carries a high mortality rate (Gosmanov et al., 2021).",
  "group": [
    {
      "id": "Group_1",
      "extension": [
        {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-scoring",
          "valueCodeableConcept": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/measure-scoring",
                "code": "ratio",
                "display": "Ratio"
              }
            ]
          }
        },
        {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-populationBasis",
          "valueCode": "Encounter"
        },
        {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-type",
          "valueCodeableConcept": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/measure-type",
                "code": "outcome",
                "display": "Outcome"
              }
            ]
          }
        },
        {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-rateAggregation",
          "valueCode": "None"
        },
        {
          "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-improvementNotation",
          "valueCodeableConcept": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/measure-improvement-notation",
                "code": "decrease",
                "display": "decrease"
              }
            ]
          }
        }
      ],
      "population": [
        {
          "id": "InitialPopulation_1",
          "code": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "initial-population",
                "display": "Initial Population"
              }
            ]
          },
          "description": "Inpatient hospitalizations for patients age 18 and older that end during the measurement period, as well as either: \n\n - A diagnosis of diabetes that starts before or during the encounter; or \n - Administration of at least one dose of insulin or any hypoglycemic medication during the encounter; or \n - Presence of at least one glucose value >=200 mg/dL at any time during the encounter",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Initial Population"
          }
        },
        {
          "id": "Denominator_1",
          "code": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "denominator",
                "display": "Denominator"
              }
            ]
          },
          "description": "Equals Initial Population",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Denominator"
          }
        },
        {
          "id": "DenominatorExclusion_1",
          "code": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "denominator-exclusion",
                "display": "Denominator Exclusion"
              }
            ]
          },
          "description": "Inpatient hospitalizations for patients with a glucose result of >600 mg/dL anytime between 1 hour prior to the start of the encounter to 6 hours after the start of the encounter.\n\n-Inpatient hospitalizations for patients who have comfort care measures ordered or provided during the encounter.\n\n-Inpatient hospitalizations for patients who have a discharge disposition to hospice care at home or in a health care facility. \n",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Denominator Exclusions"
          }
        },
        {
          "id": "Numerator_1",
          "code": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "numerator",
                "display": "Numerator"
              }
            ]
          },
          "description": "Inpatient hospitalizations with a hyperglycemic event within the first 10 days of the encounter minus the first 24 hours, and minus the last period before discharge from the hospital if less than 24 hours\n\nA hyperglycemic event is defined as: \n\n - A day with at least one glucose value >300 mg/dL; \nOR\n - A day where a glucose test and result was not found, and it was preceded by two consecutive days where at least one glucose value during each of the two days was >=200 mg/dL",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Numerator"
          }
        },
        {
          "id": "NumeratorExclusion_1",
          "code": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "numerator-exclusion",
                "display": "Numerator Exclusion"
              }
            ]
          },
          "description": "Inpatient hospitalizations for patients with a glucose result of >600 mg/dL anytime between 1 hour prior to the start of the encounter to 6 hours after the start of the encounter.\n\n-Inpatient hospitalizations for patients who have comfort care measures ordered or provided during the encounter.\n\n-Inpatient hospitalizations for patients who have a discharge disposition to hospice care at home or in a health care facility. ",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Numerator Exclusions"
          }
        },
        {
          "id": "MeasureObservation_1_1",
          "extension": [
            {
              "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-aggregateMethod",
              "valueString": "Sum"
            },
            {
              "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-criteriaReference",
              "valueString": "6402512C-2305-42DC-B5F6-A226B5057B89"
            }
          ],
          "code": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "measure-observation",
                "display": "Measure Observation"
              }
            ]
          },
          "description": "Measure Observation 1, associated with the denominator of the ratio: The total number of eligible days of the inpatient hospitalization which match the initial population/denominator criteria and did not meet the denominator exclusion criteria.",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Denominator Observations"
          }
        },
        {
          "id": "MeasureObservation_1_2",
          "extension": [
            {
              "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-aggregateMethod",
              "valueString": "Sum"
            },
            {
              "url": "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-criteriaReference",
              "valueString": "340EA45E-2411-4192-9C9D-3DF8D89A1D97"
            }
          ],
          "code": {
            "coding": [
              {
                "system": "http://terminology.hl7.org/CodeSystem/measure-population",
                "code": "measure-observation",
                "display": "Measure Observation"
              }
            ]
          },
          "description": "Measure Observation 2, associated with the numerator of the ratio: The total number of hyperglycemic days during the inpatient hospitalization that meet the numerator criteria and did not meet the numerator exclusion criteria. Days with a hyperglycemic event are defined as: \n\n- All days with a glucose level >300 mg/dL (except those occurring in the first 24-hour period after admission to the hospital (including the emergency department and observation))\nOR\n- All days where a glucose was not measured, and it was immediately preceded by two contiguous, consecutive days where at least one glucose value during each of the two days was >=200 mg/dL.",
          "criteria": {
            "language": "text/cql-identifier",
            "expression": "Numerator Observations"
          }
        }
      ]
    }
  ],
  "supplementalData": [
    {
      "id": "sde-ethnicity",
      "usage": [
        {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/measure-data-usage",
              "code": "supplemental-data"
            }
          ]
        }
      ],
      "description": "SDE Ethnicity",
      "criteria": {
        "language": "text/cql-identifier",
        "expression": "SDE Ethnicity"
      }
    },
    {
      "id": "sde-payer",
      "usage": [
        {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/measure-data-usage",
              "code": "supplemental-data"
            }
          ]
        }
      ],
      "description": "SDE Payer",
      "criteria": {
        "language": "text/cql-identifier",
        "expression": "SDE Payer"
      }
    },
    {
      "id": "sde-race",
      "usage": [
        {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/measure-data-usage",
              "code": "supplemental-data"
            }
          ]
        }
      ],
      "description": "SDE Race",
      "criteria": {
        "language": "text/cql-identifier",
        "expression": "SDE Race"
      }
    },
    {
      "id": "sde-sex",
      "usage": [
        {
          "coding": [
            {
              "system": "http://terminology.hl7.org/CodeSystem/measure-data-usage",
              "code": "supplemental-data"
            }
          ]
        }
      ],
      "description": "SDE Sex",
      "criteria": {
        "language": "text/cql-identifier",
        "expression": "SDE Sex"
      }
    }
  ]
}