eCQM QICore Content Implementation Guide
2024.0.0 - CI Build

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

Measure: Malnutrition Care ScoreFHIR

Official URL: https://madie.cms.gov/Measure/CMS986FHIRMalnutritionScore Version: 0.2.002
Active as of 2024-12-18 Responsible: Academy of Nutrition and Dietetics Computable Name: CMS986FHIRMalnutritionScore
Other Identifiers: Short Name: CMS986FHIR (use: usual, ), UUID:eed68e80-b466-4369-be87-166ada45f7c5 (use: official, ), UUID:af2116f9-3ffe-4baf-9ce0-0730ea210c49 (use: official, ), Endorser: 3592e (use: official, ), Publisher: 986FHIR (use: official, )

Copyright/Legal: Copyright (C) Academy of Nutrition and Dietetics 2025

Limited proprietary coding is contained in the measure specifications for convenience. Users of the proprietary code sets should obtain all necessary licenses from the owners of these code sets.

LOINC(R) copyright 2004-2024 Regenstrief Institute, Inc.

ICD-10 copyright 2024 World Health Organization.

This material contains SNOMED Clinical Terms (R) (SNOMED CT [R]) copyright 2004-2024. International Health Terminology Standards Development Organisation. All Rights Reserved

This measure assesses the percentage of eligible encounters of adults aged 18 years and older at the start of the eligible encounter during the measurement period, with a length of stay equal to or greater than 24 hours, who received optimal malnutrition care where care performed was appropriate to the patient’s level of malnutrition risk and severity. Malnutrition care best practices recommend that for each eligible encounter, adult inpatients are (1) screened for malnutrition risk or for a dietitian referral order to be placed, (2) assessed by a registered dietitian (RD) or registered dietitian nutritionist (RDN) to confirm findings of malnutrition risk, and if identified with a “moderate” or “severe” malnutrition status in the current performed malnutrition assessment, (3) receive a “moderate” or “severe” malnutrition diagnosis by a physician or eligible provider as defined by the Centers for Medicare & Medicaid Services (CMS), and (4) have a current nutrition care plan performed by an RD/RDN.

UNKNOWN

Title: Malnutrition Care ScoreFHIR
Id: CMS986FHIRMalnutritionScore
Version: 0.2.002
Url: Malnutrition Care ScoreFHIR
Short Name Identifier:

CMS986FHIR

Version Independent Identifier:

urn:uuid:eed68e80-b466-4369-be87-166ada45f7c5

Version Specific Identifier:

urn:uuid:af2116f9-3ffe-4baf-9ce0-0730ea210c49

Endorser (CMS Consensus Based Entity) Identifier:

3592e

Publisher (CMS) Identifier:

986FHIR

Effective Period: 2026-01-01..2026-12-31
Publisher: Academy of Nutrition and Dietetics
Author: Academy of Nutrition and Dietetics
Description:

This measure assesses the percentage of eligible encounters of adults aged 18 years and older at the start of the eligible encounter during the measurement period, with a length of stay equal to or greater than 24 hours, who received optimal malnutrition care where care performed was appropriate to the patient's level of malnutrition risk and severity. Malnutrition care best practices recommend that for each eligible encounter, adult inpatients are (1) screened for malnutrition risk or for a dietitian referral order to be placed, (2) assessed by a registered dietitian (RD) or registered dietitian nutritionist (RDN) to confirm findings of malnutrition risk, and if identified with a "moderate" or "severe" malnutrition status in the current performed malnutrition assessment, (3) receive a "moderate" or "severe" malnutrition diagnosis by a physician or eligible provider as defined by the Centers for Medicare & Medicaid Services (CMS), and (4) have a current nutrition care plan performed by an RD/RDN.

Purpose:

UNKNOWN

Copyright:

Copyright (C) Academy of Nutrition and Dietetics 2025

Limited proprietary coding is contained in the measure specifications for convenience. Users of the proprietary code sets should obtain all necessary licenses from the owners of these code sets.

LOINC(R) copyright 2004-2024 Regenstrief Institute, Inc.

ICD-10 copyright 2024 World Health Organization.

This material contains SNOMED Clinical Terms (R) (SNOMED CT [R]) copyright 2004-2024. International Health Terminology Standards Development Organisation. All Rights Reserved

Disclaimer:

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

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

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

Rationale:

Malnutrition has been documented in approximately one-third of patients in developed countries upon admission to the hospital, and, if left untreated, can significantly impact important clinical outcomes (Mogensen et al., 2019). Adult patients with malnutrition have a significantly longer hospital length of stay (LOS) (Hudson, Chittams, Griffith, & Compher, 2018 and Mosquera et al., 2016) and significantly more patients with malnutrition have a LOS of >7 days when compared to their well-nourished counterparts. Additionally, both higher rates of 30-day readmission and a significantly higher likelihood of 30-day readmission are observed in these patients (Mogensen et al., 2019; Hiller, Shaw, & Fabri, 2016; Mosquera et al., 2016). Lastly, hospitalized adults with malnutrition have an increased likelihood of death within 90 days of discharge (Hiller, Shaw, & Fabri, 2016). These consequences demonstrate the importance of addressing malnutrition in hospitalized patients to improve outcomes.

The components of this measure are supported by clinical guidance that recommends (1) malnutrition screening for patients admitted into the acute inpatient care setting; (2) nutrition assessment for patients identified at risk for malnutrition or with a dietitian referral order to form the basis for appropriate nutrition interventions; (3) appropriate recognition, diagnosis, and documentation of the nutrition status of a patient in order to (4) address their condition with an appropriate plan of care and communicate patient needs to other care providers (Academy of Nutrition and Dietetics, 2017).

The process for risk identification, assessment, diagnosis, and treatment of malnutrition necessitates a multi-disciplinary care team that begins with the identification of an initial risk population for a more thorough assessment by the RD/RDN. The RD/RDN, in turn, provides the necessary treatment recommendations to address nutrition problems utilizing a nutrition diagnosis and care plan, along with the clinical indicators that inform a medical diagnosis of malnutrition completed by a physician or eligible clinician as defined by CMS. The four measure observations individually provide a portion of the necessary information on the quality of care for patients at risk for or with malnutrition. Therefore, the four components are summed and averaged according to a patient’s degree of malnutrition and/or malnutrition risk to determine an encounter-level Malnutrition Care Score.

High performance on this measure requires malnutrition risk screening and/or referral to RDNs for appropriate nutrition assessment for identified patients during the current hospitalization. For patients identified with moderate or severe malnutrition by the nutrition assessment, best practice also recommends a medical diagnosis by a physician or other eligible clinician and the execution of the nutrition care plan by an RD/RDN. Evidence demonstrates that implementing a standardized protocol for screening, assessment, diagnosis, and care planning results in better identification of patients with malnutrition and subsequent improvements in rates of associated nutrition interventions. Outcomes modeling demonstrates benefits to patient outcomes, including reduced risk of 30-day readmissions, length of hospital stays, and complications, as well as improved quality of life after hospitalization (Sriram et al., 2016).

Clinical recommendation statement:

American Society for Parenteral and Enteral Nutrition (ASPEN) clinical guidelines on nutrition screening, assessment, and intervention in adults indicate that screening for nutrition risk is suggested for hospitalized patients (Mueller, Compher, Druyan, & ASPEN Board of Directors, 2011).

This guideline places nutrition assessment and screening in the context of intervention as part of nutrition care. Screening those individuals at risk for malnutrition is the first step in nutrition care as risk for malnutrition, identified by nutrition screening, is associated with longer length of hospital stay, complications, and mortality. Malnutrition screening is also a predictor of mortality risk.

Malnourished patients, identified by nutrition assessment tools, have more complications and longer hospitalizations than do patients with optimal nutrition status. Such patients, identified by nutrition assessment tools, have more infectious and noninfectious complications, longer hospital length of stay, and greater mortality.

Nutrition intervention is recommended for patients identified by assessment as at risk for malnutrition or malnourished. Nutrition intervention with associated monitoring and evaluation plants in patients identified as at risk for malnutrition or malnourished improves clinical outcomes. Nutrition interventions and their associated monitoring and evaluation plans in malnourished patients are associated with improved nutrition status, nutrient intake, physical function, and quality of life. Hospital readmissions, inpatient length of stay, and complications were reduced with increased nutrition support interventions.

Guidance (Usage): This measure is constructed of four clinically eligible components that are aggregated as an arithmetic average of eligible encounters and expressed as a percentage. The four populations used to calculate the four components may differ and the measure observations for the four components do not need to be performed sequentially. This eCQM is an episode-based measure. An episode is defined as each eligible encounter with a length of stay of greater than or equal to 24 hours among individuals 18 years of age and older at the start of the inpatient encounter. This FHIR-based measure has been derived from the QDM-based measure: CMS986v5. Please refer to the HL7 QI-Core Implementation Guide (https://hl7.org/fhir/us/qicore/STU4.1.1/) for more information on QI-Core and mapping recommendations from QDM to QI-Core 4.1.1 (https://hl7.org/fhir/us/qicore/STU4.1.1/qdm-to-qicore.html).
Population Criteria:
675761f046b6174510cfee0b
Initial Population: Eligible encounters during the measurement period with length of stay of 24 hours or more among individuals 18 years of age and older at the start of the inpatient encounter
Measure Population: Equals Initial Population
Measure Population Exclusion: Encounters with hospice care ordered during the inpatient qualifying encounter and encounters with a discharge disposition of hospice
Measure Observation: Component Measure 1: Eligible encounters for patients with a current "Malnutrition Risk Screening" performed by an eligible healthcare clinician or a Dietitian Referral. "Measure Observation 1" is "Encounters with Malnutrition Risk Screening and Identified Result or a Dietitian Referral" "Measure Observation 1" identifies eligible encounters where a "Malnutrition Risk Screening" was performed or authored during the encounter (including preceding observation or emergency department encounters) with an identified "Malnutrition Screening Finding of Not At Risk Result" or "Malnutrition Screening Finding of At Risk Result". It also identifies an eligible encounter where there is a Dietitian Referral, whether there is a "Malnutrition Risk Screening" performed or not.
675761f046b6174510cfee0c
Initial Population: Eligible encounters during the measurement period with length of stay of 24 hours or more among individuals 18 years of age and older at the start of the inpatient encounter
Measure Population: Equals Initial Population
Measure Population Exclusion: Encounters with hospice care ordered during the inpatient qualifying encounter and encounters with a discharge disposition of hospice
Measure Observation: Component Measure 2: Eligible encounters for patients with a current "Nutrition Assessment" performed by an RD/RDN, after a "Malnutrition Screening Finding of At Risk Result" during the current encounter or a "Dietitian Referral" order from a physician or eligible clinician during the current encounter. "Measure Observation 2" is "Encounter with Nutrition Assessment and Identified Status" "Measure Observation 2" identifies eligible encounters where a "Nutrition Assessment" was performed or authored during the encounter (including preceding observation or emergency department encounters) with an identified "Nutrition Assessment Status Finding of Well Nourished or Not Malnourished or Mildly Malnourished", "Nutrition Assessment Status Finding of Moderately Malnourished", or "Nutrition Assessment Status Finding of Severely Malnourished".
675761f046b6174510cfee0d
Initial Population: Eligible encounters during the measurement period with length of stay of 24 hours or more among individuals 18 years of age and older at the start of the inpatient encounter
Measure Population: Equals Initial Population
Measure Population Exclusion: Encounters with hospice care ordered during the inpatient qualifying encounter and encounters with a discharge disposition of hospice-
Measure Observation: Component Measure 3: Eligible encounters for patients with a documented "Malnutrition Diagnosis" as a result of a "Nutrition Assessment Status Finding of Moderately Malnourished" OR "Nutrition Assessment Status Finding of Severely Malnourished". "Measure Observation 3" is "Encounters with Malnutrition Diagnosis" "Measure Observation 3" identifies eligible encounters where a "Malnutrition Diagnosis" was active during the encounter (including preceding observation or emergency department encounters).
675761f046b6174510cfee0e
Initial Population: Eligible encounters during the measurement period with length of stay of 24 hours or more among individuals 18 years of age and older at the start of the inpatient encounter
Measure Population: Equals Initial Population
Measure Population Exclusion: Encounters with hospice care ordered during the inpatient qualifying encounter and encounters with a discharge disposition of hospice
Measure Observation: Component Measure 4: Eligible encounters for patients with a current "Nutrition Care Plan" performed as a result of a current "Nutrition Assessment Status Finding of Moderately Malnourished" OR current “Nutrition Assessment Status Finding of Severely Malnourished”. “Measure Observation 4” is “Encounters with Nutrition Care Plan” "Measure Observation 4" identifies eligible encounters where a "Nutrition Care Plan" was performed or authored during the encounter (including preceding observation or emergency department encounters).
675761f046b6174510cfee0f
Initial Population: None
Measure Population: None
Measure Population Exclusion: None
Measure Observation: "Population 5 Measure Observation Total Malnutrition Components Score" Calculations -For each eligible encounter, Population Criteria 5 represents the subtotal of Measure Observations performed for Population Criteria 1, 2, 3, and 4. Possible values may be 0, 1, 2, 3, or 4. "Population 5 Measure Observation Total Malnutrition Components Score" is ("Measure Observation 1" plus "Measure Observation 2" plus "Measure Observation 3" plus "Measure Observation 4")
675761f046b6174510cfee10
Initial Population: None
Measure Population: None
Measure Population Exclusion: None
Measure Observation: "Population 6 Measure Observation Total Malnutrition Care Score as Percentage" Calculations: -For each eligible encounter, Population Criteria 6 represents the sum of performed Measure Observations 1, 2, 3, and 4 divided by the number of clinically eligible occurrences. "Population 6 Measure Observation Total Malnutrition Care Score as Percentage" is 100 multiplied by ("Total Malnutrition Components Score" divided by "Total Malnutrition Care Score Eligible Occurrences"). Possible values may be 0, 50, 75, or 100 percent. "Total Malnutrition Care Score Eligible Occurrences" is always 4 except in the following instances: -The "Total Malnutrition Care Score Eligible Occurrences" is 1 if ---A "Malnutrition Risk Screening" was performed and a "Malnutrition Screening Finding of Not At Risk Result" was identified AND "Dietitian Referral" was not ordered. - The "Total Malnutrition Care Score Eligible Occurrences" are 2 ---If a "Nutrition Assessment" was performed and a "Nutrition Status Finding of Well Nourished or Not Malnourished or Mildly Malnourished" was identified --- A "Malnutrition Risk Screening" was performed and a "Malnutrition Screening Finding of Not At Risk Result" was identified AND "Dietitian Referral" was ordered OR a "Malnutrition Risk Screening" was performed and a "Malnutrition Screening Finding of At Risk Result" was identified but the “Nutrition Assessment” was not performed
Supplemental Data Elements:

SDE Payer Type

SDE Patient sex for quality measurement

SDE Race

SDE Ethnicity

Supplemental Data Guidance : For every patient evaluated by this measure also identify payer, race, ethnicity and sex
Libraries:
CMS986FHIRMalnutritionScore
Terminology and Other Dependencies:
  • Library/SupplementalDataElements|3.5.000
  • Library/FHIRHelpers|4.4.000
  • Library/QICoreCommon|2.1.000
  • Library/CQMCommon|2.2.000
  • AdministrativeGender
  • Encounter Inpatient
  • Hospice Care Referral or Admission
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.101
  • Observation Services
  • Emergency Department Visit
  • Payer
  • Parameters:
    name use min max type
    Measurement Period In 0 1 Period
    SDE Patient sex for quality measurement Out 0 1 Coding
    Measure Population Exclusion Out 0 * Resource
    SDE Race Out 0 1 Resource
    SDE Payer Type Out 0 * Resource
    Initial Population Out 0 * Resource
    SDE Ethnicity Out 0 1 Resource
    Measure Population Out 0 * Resource
    DataRequirements:
    Resource Type Resource Elements Valueset Name Valueset
    Patient(QICorePatient) race ethnicity
    Encounter(QICoreEncounter) type period status status.value hospitalization hospitalization.dischargeDisposition Encounter Inpatient Encounter Inpatient
    Encounter(QICoreEncounter) type status status.value period Observation Services Observation Services
    Encounter(QICoreEncounter) type status status.value period Emergency Department Visit Emergency Department Visit
    Encounter(QICoreEncounter) type period status status.value Encounter Inpatient Encounter Inpatient
    ServiceRequest(QICoreServiceRequest) code Hospice Status http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.101
    Procedure(QICoreProcedure) code Hospice Status http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.101
    Coverage(QICoreCoverage) type period Payer Type Payer
    Direct Reference Codes:
    display code system
    Male M http://hl7.org/fhir/administrative-gender
    Female F http://hl7.org/fhir/administrative-gender
    Logic Definitions:
    Group Scoring Population Criteria Expression
    675761f046b6174510cfee0b Group scoring: continuous-variable
    Type:

    Outcome

    Initial Population
    define "Initial Population":
      "Measure Population"
    Measure Population
    define "Measure Population":
      [Encounter: "Encounter Inpatient"] EncounterInpatient
        where EncounterInpatient.period ends during day of "Measurement Period"
          and AgeInYearsAt(date from start of EncounterInpatient.period) >= 18
          and ( duration in hours of EncounterInpatient.period >= 24 )
          and EncounterInpatient.status = 'finished'
    Measure Population Exclusion
    define "Measure Population Exclusion":
      "Encounter with Discharge for Hospice Care"
        union "Encounter with Hospice during Eligible Encounter"
    Measure Observation
    define function "Measure Observation 1"(MalnutritionRiskScreening Encounter):
      if "Encounter with Malnutrition Risk Screening or with Hospital Dietitian Referral" contains MalnutritionRiskScreening then 1 
        else 0
    675761f046b6174510cfee0c Group scoring: continuous-variable
    Type:

    Outcome

    Initial Population
    define "Initial Population":
      "Measure Population"
    Measure Population
    define "Measure Population":
      [Encounter: "Encounter Inpatient"] EncounterInpatient
        where EncounterInpatient.period ends during day of "Measurement Period"
          and AgeInYearsAt(date from start of EncounterInpatient.period) >= 18
          and ( duration in hours of EncounterInpatient.period >= 24 )
          and EncounterInpatient.status = 'finished'
    Measure Population Exclusion
    define "Measure Population Exclusion":
      "Encounter with Discharge for Hospice Care"
        union "Encounter with Hospice during Eligible Encounter"
    Measure Observation
    define function "Measure Observation 2"(NutritionAssessment Encounter):
      if "Encounter with Malnutrition Not At Risk Screening and without Hospital Dietitian Referral" contains NutritionAssessment then 0 
        else if "Encounter with Malnutrition Risk Screening At Risk or with Hospital Dietitian Referral" contains NutritionAssessment then if "Most Recent Encounter with Nutrition Assessment and Identified Status" contains NutritionAssessment then 1 
        else 0 
        else 0
    675761f046b6174510cfee0d Group scoring: continuous-variable
    Type:

    Outcome

    Initial Population
    define "Initial Population":
      "Measure Population"
    Measure Population
    define "Measure Population":
      [Encounter: "Encounter Inpatient"] EncounterInpatient
        where EncounterInpatient.period ends during day of "Measurement Period"
          and AgeInYearsAt(date from start of EncounterInpatient.period) >= 18
          and ( duration in hours of EncounterInpatient.period >= 24 )
          and EncounterInpatient.status = 'finished'
    Measure Population Exclusion
    define "Measure Population Exclusion":
      "Encounter with Discharge for Hospice Care"
        union "Encounter with Hospice during Eligible Encounter"
    Measure Observation
    define function "Measure Observation 3"(MalnutritionDiagnosis Encounter):
      if "Encounter with Malnutrition Not At Risk Screening and without Hospital Dietitian Referral" contains MalnutritionDiagnosis then 0 
        else if "Encounter with Malnutrition Risk Screening At Risk or with Hospital Dietitian Referral" contains MalnutritionDiagnosis then if "Encounter with Malnutrition Diagnosis" contains MalnutritionDiagnosis then if "Encounter with Nutrition Assessment Not or Mildly Malnourished" contains MalnutritionDiagnosis then 0 
        else if "Encounter with Nutrition Assessment Status Moderately Or Severely Malnourished" contains MalnutritionDiagnosis then 1 
        else 0 
        else 0 
        else 0
    675761f046b6174510cfee0e Group scoring: continuous-variable
    Type:

    Outcome

    Initial Population
    define "Initial Population":
      "Measure Population"
    Measure Population
    define "Measure Population":
      [Encounter: "Encounter Inpatient"] EncounterInpatient
        where EncounterInpatient.period ends during day of "Measurement Period"
          and AgeInYearsAt(date from start of EncounterInpatient.period) >= 18
          and ( duration in hours of EncounterInpatient.period >= 24 )
          and EncounterInpatient.status = 'finished'
    Measure Population Exclusion
    define "Measure Population Exclusion":
      "Encounter with Discharge for Hospice Care"
        union "Encounter with Hospice during Eligible Encounter"
    Measure Observation
    define function "Measure Observation 4"(NutritionCarePlan Encounter):
      if "Encounter with Malnutrition Not At Risk Screening and without Hospital Dietitian Referral" contains NutritionCarePlan then 0 
        else if "Encounter with Malnutrition Risk Screening At Risk or with Hospital Dietitian Referral" contains NutritionCarePlan then if "Encounter with Nutrition Care Plan" contains NutritionCarePlan then if "Encounter with Nutrition Assessment Not or Mildly Malnourished" contains NutritionCarePlan then 0 
        else if "Encounter with Nutrition Assessment Status Moderately Or Severely Malnourished" contains NutritionCarePlan then 1 
        else 0 
        else 0 
        else 0
    675761f046b6174510cfee0f Group scoring: continuous-variable
    Type:

    Outcome

    Initial Population
    define "Initial Population":
      "Measure Population"
    Measure Population
    define "Measure Population":
      [Encounter: "Encounter Inpatient"] EncounterInpatient
        where EncounterInpatient.period ends during day of "Measurement Period"
          and AgeInYearsAt(date from start of EncounterInpatient.period) >= 18
          and ( duration in hours of EncounterInpatient.period >= 24 )
          and EncounterInpatient.status = 'finished'
    Measure Population Exclusion
    define "Measure Population Exclusion":
      "Encounter with Discharge for Hospice Care"
        union "Encounter with Hospice during Eligible Encounter"
    Measure Observation
    define function "Measure Observation Total Malnutrition Components Score"(QualifyingEncounter Encounter):
      Sum({ "Measure Observation 1"(QualifyingEncounter), "Measure Observation 2"(QualifyingEncounter), "Measure Observation 3"(QualifyingEncounter), "Measure Observation 4"(QualifyingEncounter) })
    675761f046b6174510cfee10 Group scoring: continuous-variable
    Type:

    Outcome

    Initial Population
    define "Initial Population":
      "Measure Population"
    Measure Population
    define "Measure Population":
      [Encounter: "Encounter Inpatient"] EncounterInpatient
        where EncounterInpatient.period ends during day of "Measurement Period"
          and AgeInYearsAt(date from start of EncounterInpatient.period) >= 18
          and ( duration in hours of EncounterInpatient.period >= 24 )
          and EncounterInpatient.status = 'finished'
    Measure Population Exclusion
    define "Measure Population Exclusion":
      "Encounter with Discharge for Hospice Care"
        union "Encounter with Hospice during Eligible Encounter"
    Measure Observation
    define function "Measure Observation Total Malnutrition Care Score as Percentage"(QualifyingEncounter Encounter):
      100 * ( "Measure Observation Total Malnutrition Components Score"(QualifyingEncounter) / "Total Malnutrition Care Score Eligible Occurrences"(QualifyingEncounter) )
    Library Name Name
    SupplementalDataElements SDE Sex
    define "SDE Sex":
      case
        when Patient.gender = 'male' then "M"
        when Patient.gender = 'female' then "F"
        else null
      end
    Library Name Name
    CMS986FHIRMalnutritionScore SDE Patient sex for quality measurement
    define "SDE Patient sex for quality measurement":
      SDE."SDE Sex"
    Library Name Name
    CMS986FHIRMalnutritionScore Measure Population
    define "Measure Population":
      [Encounter: "Encounter Inpatient"] EncounterInpatient
        where EncounterInpatient.period ends during day of "Measurement Period"
          and AgeInYearsAt(date from start of EncounterInpatient.period) >= 18
          and ( duration in hours of EncounterInpatient.period >= 24 )
          and EncounterInpatient.status = 'finished'
    Library Name Name
    CMS986FHIRMalnutritionScore Encounter with Discharge for Hospice Care
    define "Encounter with Discharge for Hospice Care":
      ( "Measure Population" QualifyingEncounter
          where QualifyingEncounter.status = 'finished'
            and ( QualifyingEncounter.hospitalization.dischargeDisposition in "Hospice Care Referral or Admission" )
      )
    Library Name Name
    CMS986FHIRMalnutritionScore Encounter with Hospice during Eligible Encounter
    define "Encounter with Hospice during Eligible Encounter":
      from
        "Measure Population" QualifyingEncounter,
        ( ["ServiceRequest": code in "Hospice Status"]
          union ["Procedure": "Hospice Status"] ) HospiceStatus
        where "Hospice Status" contains HospiceStatus.code as Concept
          and HospiceStatus.status in { 'active', 'completed' }
          and Coalesce(start of HospiceStatus.performed.toInterval(), HospiceStatus.authoredOn) during day of QualifyingEncounter."hospitalizationWithObservation" ( )
        return QualifyingEncounter
    Library Name Name
    CMS986FHIRMalnutritionScore Measure Population Exclusion
    define "Measure Population Exclusion":
      "Encounter with Discharge for Hospice Care"
        union "Encounter with Hospice during Eligible Encounter"
    Library Name Name
    SupplementalDataElements SDE Race
    define "SDE Race":
      Patient.race R
        return Tuple {
          codes: R.ombCategory union R.detailed,
          display: R.text
        }
    Library Name Name
    CMS986FHIRMalnutritionScore SDE Race
    define "SDE Race":
      SDE."SDE Race"
    Library Name Name
    SupplementalDataElements SDE Payer
    define "SDE Payer":
      [Coverage: type in "Payer Type"] Payer
        return {
          code: Payer.type,
          period: Payer.period
        }
    Library Name Name
    CMS986FHIRMalnutritionScore SDE Payer Type
    define "SDE Payer Type":
      SDE."SDE Payer"
    Library Name Name
    CMS986FHIRMalnutritionScore Initial Population
    define "Initial Population":
      "Measure Population"
    Library Name Name
    SupplementalDataElements SDE Ethnicity
    define "SDE Ethnicity":
      Patient.ethnicity E
        return Tuple {
          codes: { E.ombCategory } union E.detailed,
          display: E.text
        }
    Library Name Name
    CMS986FHIRMalnutritionScore SDE Ethnicity
    define "SDE Ethnicity":
      SDE."SDE Ethnicity"
    Library Name Name
    CQMCommon hospitalizationWithObservation
    /*
    @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
    */
    define fluent 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]
    Library Name Name
    FHIRHelpers ToString
    define function ToString(value uri): value.value
    Library Name Name
    FHIRHelpers ToCode
    /*
    @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
            }
    Library Name Name
    CMS986FHIRMalnutritionScore Measure Observation 1
    define function "Measure Observation 1"(MalnutritionRiskScreening Encounter):
      if "Encounter with Malnutrition Risk Screening or with Hospital Dietitian Referral" contains MalnutritionRiskScreening then 1 
        else 0
    Library Name Name
    CMS986FHIRMalnutritionScore Measure Observation Total Malnutrition Components Score
    define function "Measure Observation Total Malnutrition Components Score"(QualifyingEncounter Encounter):
      Sum({ "Measure Observation 1"(QualifyingEncounter), "Measure Observation 2"(QualifyingEncounter), "Measure Observation 3"(QualifyingEncounter), "Measure Observation 4"(QualifyingEncounter) })
    Library Name Name
    CMS986FHIRMalnutritionScore Measure Observation 2
    define function "Measure Observation 2"(NutritionAssessment Encounter):
      if "Encounter with Malnutrition Not At Risk Screening and without Hospital Dietitian Referral" contains NutritionAssessment then 0 
        else if "Encounter with Malnutrition Risk Screening At Risk or with Hospital Dietitian Referral" contains NutritionAssessment then if "Most Recent Encounter with Nutrition Assessment and Identified Status" contains NutritionAssessment then 1 
        else 0 
        else 0
    Library Name Name
    CMS986FHIRMalnutritionScore Measure Observation 3
    define function "Measure Observation 3"(MalnutritionDiagnosis Encounter):
      if "Encounter with Malnutrition Not At Risk Screening and without Hospital Dietitian Referral" contains MalnutritionDiagnosis then 0 
        else if "Encounter with Malnutrition Risk Screening At Risk or with Hospital Dietitian Referral" contains MalnutritionDiagnosis then if "Encounter with Malnutrition Diagnosis" contains MalnutritionDiagnosis then if "Encounter with Nutrition Assessment Not or Mildly Malnourished" contains MalnutritionDiagnosis then 0 
        else if "Encounter with Nutrition Assessment Status Moderately Or Severely Malnourished" contains MalnutritionDiagnosis then 1 
        else 0 
        else 0 
        else 0
    Library Name Name
    CMS986FHIRMalnutritionScore Measure Observation 4
    define function "Measure Observation 4"(NutritionCarePlan Encounter):
      if "Encounter with Malnutrition Not At Risk Screening and without Hospital Dietitian Referral" contains NutritionCarePlan then 0 
        else if "Encounter with Malnutrition Risk Screening At Risk or with Hospital Dietitian Referral" contains NutritionCarePlan then if "Encounter with Nutrition Care Plan" contains NutritionCarePlan then if "Encounter with Nutrition Assessment Not or Mildly Malnourished" contains NutritionCarePlan then 0 
        else if "Encounter with Nutrition Assessment Status Moderately Or Severely Malnourished" contains NutritionCarePlan then 1 
        else 0 
        else 0 
        else 0
    Library Name Name
    CMS986FHIRMalnutritionScore Measure Observation Total Malnutrition Care Score as Percentage
    define function "Measure Observation Total Malnutrition Care Score as Percentage"(QualifyingEncounter Encounter):
      100 * ( "Measure Observation Total Malnutrition Components Score"(QualifyingEncounter) / "Total Malnutrition Care Score Eligible Occurrences"(QualifyingEncounter) )
    Library Name Name
    CMS986FHIRMalnutritionScore Total Malnutrition Care Score Eligible Occurrences
    define function "Total Malnutrition Care Score Eligible Occurrences"(QualifyingEncounter Encounter):
      if ( ( "Encounter with Malnutrition Risk Screening or with Hospital Dietitian Referral" contains QualifyingEncounter )
          and ( "Encounter with Malnutrition Risk Screening Not At Risk" contains QualifyingEncounter )
      )
        and not ( "Encounter with Dietitian Referral" contains QualifyingEncounter ) then 1 
        else if ( ( ( "Encounter with Malnutrition Risk Screening or with Hospital Dietitian Referral" contains QualifyingEncounter )
            and ( "Encounter with Malnutrition Risk Screening At Risk" contains QualifyingEncounter )
        )
          or ( "Encounter with Dietitian Referral" contains QualifyingEncounter )
      )
        and ( "Encounter with Nutrition Assessment Not or Mildly Malnourished" contains QualifyingEncounter )
        or not ( "Most Recent Encounter with Nutrition Assessment and Identified Status" contains QualifyingEncounter ) then 2 
        else 4