Knowledge Artifact Metadata
Name (machine-readable) | CMS986FHIRMalnutritionScore
Title (human-readable) | Malnutrition Care ScoreFHIR
Status | draft
Experimental | false
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 nutrition assessment, (3) receive a "moderate" or "severe" malnutrition diagnosis by a physician or eligible clinician as defined by the Centers for Medicare & Medicaid Services (CMS), and (4) have a current nutrition care plan performed by an RD/RDN.
Purpose | Percentage of hospitalizations where a patient 18 years of age or older, admitted for 24-hours or more, received optimal malnutrition care
Clinical 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 dCQM 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).
Effective Period | 2026-01-01..2026-12-31
Use Context | org.hl7.fhir.r5.model.UsageContext@465872c9
Measure Developer | Academy of Nutrition and Dietetics
Measure Steward | Academy of Nutrition and Dietetics
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.
Citation | Citation: Citation - Academy of Nutrition and Dietetics. (2017). The Nutrition Care Process Model. Retrieved June 12, 2023 from https://www.ncpro.org/pubs/2020-encpt-en/ncp-model
Citation | Citation: Citation - Hiller, L.D., Shaw, R.F., & Fabri, P.J. (2017) Difference in composite end point of readmission and death between malnourished and nonmalnourished veterans assessed using Academy of Nutrition and Dietetics/American Society for Parenteral and Enteral Nutrition clinical characteristics. Journal of Parenteral and Enteral Nutrition, 41(8), 1316-1324. https://doi.org/10.1177/0148607116668523
Citation | Citation: Citation - Hudson, L., Chittams, J., Griffith, C., & Compher, C. (2018) Malnutrition identified by Academy of Nutrition and Dietetics/American Society for Parenteral and Enteral Nutrition is associated with more 30-day readmissions, greater hospital mortality, and longer hospital stays: a retrospective analysis of nutrition assessment data in a major medical center. Journal of Parenteral and Enteral Nutrition, 42(5), 892-897. https://doi.org/10.1002/jpen.1021
Citation | Citation: Citation - Mogensen, K.M., Malone, A., Becker, P., Cutrell, S., Frank, L., Gonzales, K., Hudson, L., Miller, S., Guenter, P. (2019) Academy of Nutrition and Dietetics/American Society for Parenteral and Enteral Nutrition Consensus Malnutrition Characteristics: Usability and Association With Outcomes. Nutrition in Clinical Practice, 34 (5), 657–665. https://doi.org/10.1002/ncp.10310
Citation | Citation: Citation - Mosquera, C., Koutlas, N.J., Edwards, K.C., Strickland, A., Vohra, N. A., Zervos, E.E., & Fitzgerald, T.L. (2016). Impact of malnutrition on gastrointestinal surgical patients. Journal of Surgical Research. 205(1), 95-101. https://doi.org/10.1016/j.jss.2016.05.030
Citation | Citation: Citation - Mueller, C., Compher, C., Druyan, M.E., & the ASPEN Board of Directors. (2011). ASPEN clinical guidelines on nutrition screening, assessment, and intervention in adults: Journal of Parenteral and Enteral Nutrition, 35(1), 16-24. https://doi.org/10.1177/0148607110389335
Citation | Citation: Citation - Sriram, K., Sulo, S., VanDerBosc,h .G, Partridge, J., Feldstein, J., Hegazi, R.A., Summerfelt, W.T. (2016) A comprehensive nutrition-focused quality improvement program reduces 30-day readmissions and length of stay in hospitalized patients. Journal of Parenteral and Enteral Nutrition, 41(3), 384-391. https://doi.org/10.1177/0148607116681468
Measure Metadata
Short Name Identifier | CMS986FHIR
Version Independent Identifier | urn:uuid:eed68e80-b466-4369-be87-166ada45f7c5
Version Specific Identifier | urn:uuid:50bd152a-d296-450f-83d5-a92c69b2f99c
Publisher (CMS) Identifier | 986FHIR
Identifier | 3592e
Version Number | Draft based on 0.3.001
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 greater than 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 plans 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.
Supplemental Data Guidance | For every patient evaluated by this measure also identify payer, race, ethnicity and sex
Malnutrition Diagnosis Definition | A documented diagnosis that identifies and describes a specific nutrition problem(s) that can be resolved or improved through nutrition intervention(s), monitoring, and evaluation. For the inpatient or acute care setting, the Malnutrition Diagnosis is identified by the physician or other eligible clinician as defined by CMS based on the scope of practice regulations within the respective state, commonwealth, or territory of care delivery.
Malnutrition Risk Screening Definition | The process of identifying and referring those individuals and populations who are at risk for nutrition-related problems, are appropriate for nutrition care services, and would benefit from nutrition interventions. For the inpatient or acute care setting, the Malnutrition Risk Screening can be completed by any eligible healthcare clinician as defined by local, state and federal guidelines.
Nutrition Assessment Definition | A systematic approach for collecting, classifying, and synthesizing important and relevant data to describe nutritional status related nutritional problems, and their causes. This assessment includes review of the "whole" patient and evaluates the anthropometrics (i.e., body measurements and proportions), biochemical data (i.e., laboratory findings), clinical observations, and diet history (also known as 'ABCD'). For the inpatient or acute care setting, the Nutrition Assessment is performed by a RD or RDN.
Nutrition Care Plan Definition | A documented plan based on information collected during the Nutrition Assessment of individualized nutrition recommendations, interventions, and monitoring and evaluation plans that are directed toward resolving the Malnutrition Diagnosis by altering or eliminating the nutrition etiology. The Nutrition Care Plan may encompass the interventions of Food and Nutrient Delivery, Nutrition Education, Nutrition Counseling, Coordination of Nutrition Care, and Population Based Nutrition Action, along with a plan for monitoring and evaluation, and is documented by the RD or RDN.
Measure Population Criteria (ID: Group_1)
Summary | Population Criteria 1
Initial Population | ID: InitialPopulation_1 Description: 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 Logic Definition: Initial Population
Measure Population | ID: MeasurePopulation_1 Description: Equals Initial Population Logic Definition: Measure Population
Measure Population Exclusion | ID: MeasurePopulationExclusion_1 Description: Encounters with hospice care ordered during the inpatient qualifying encounter and encounters with a discharge disposition of hospice Logic Definition: Measure Population Exclusion
Measure Observation | ID: MeasureObservation_1 Description: 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. Logic Definition: Measure Observation 1
Population Basis | Encounter
Scoring | [http://terminology.hl7.org/CodeSystem/measure-scoring#continuous-variable: 'Continuous Variable']
Type | [http://terminology.hl7.org/CodeSystem/measure-type#outcome: 'Outcome']
Improvement Notation | [http://terminology.hl7.org/CodeSystem/measure-improvement-notation#increase: 'Increased score indicates improvement']
Measure Population Criteria (ID: Group_2)
Summary | Nutrition Assessment
Initial Population | ID: InitialPopulation_2 Description: 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 Logic Definition: Initial Population
Measure Population | ID: MeasurePopulation_2 Description: Equals Initial Population Logic Definition: Measure Population
Measure Population Exclusion | ID: MeasurePopulationExclusion_2 Description: Encounters with hospice care ordered during the inpatient qualifying encounter and encounters with a discharge disposition of hospice Logic Definition: Measure Population Exclusion
Measure Observation | ID: MeasureObservation_2 Description: Component Measure 2: Eligible encounters for patients with a documented "Nutrition Assessment" performed by an RD/RDN, after a "Malnutrition Screening Finding of At Risk Result" or a "Dietitian Referral" order from a physician or eligible clinician during the current encounter. "Measure Observation 2" is "Encounter With Most Recent 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". Logic Definition: Measure Observation 2
Population Basis | Encounter
Scoring | [http://terminology.hl7.org/CodeSystem/measure-scoring#continuous-variable: 'Continuous Variable']
Type | [http://terminology.hl7.org/CodeSystem/measure-type#outcome: 'Outcome']
Improvement Notation | [http://terminology.hl7.org/CodeSystem/measure-improvement-notation#increase: 'Increased score indicates improvement']
Measure Population Criteria (ID: Group_3)
Summary | Malnutrition Diagnosis
Initial Population | ID: InitialPopulation_3 Description: 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 Logic Definition: Initial Population
Measure Population | ID: MeasurePopulation_3 Description: Equals Initial Population Logic Definition: Measure Population
Measure Population Exclusion | ID: MeasurePopulationExclusion_3 Description: Encounters with hospice care ordered during the inpatient qualifying encounter and encounters with a discharge disposition of hospice Logic Definition: Measure Population Exclusion
Measure Observation | ID: MeasureObservation_3 Description: Component Measure 3: Eligible encounters for patients with a documented "Malnutrition Diagnosis" based on the most recent finding of "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). Logic Definition: Measure Observation 3
Population Basis | Encounter
Scoring | [http://terminology.hl7.org/CodeSystem/measure-scoring#continuous-variable: 'Continuous Variable']
Type | [http://terminology.hl7.org/CodeSystem/measure-type#outcome: 'Outcome']
Improvement Notation | [http://terminology.hl7.org/CodeSystem/measure-improvement-notation#increase: 'Increased score indicates improvement']
Measure Population Criteria (ID: Group_4)
Summary | Nutrition Care Plan
Initial Population | ID: InitialPopulation_4 Description: 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 Logic Definition: Initial Population
Measure Population | ID: MeasurePopulation_4 Description: Equals Initial Population Logic Definition: Measure Population
Measure Population Exclusion | ID: MeasurePopulationExclusion_4 Description: Encounters with hospice care ordered during the inpatient qualifying encounter and encounters with a discharge disposition of hospice Logic Definition: Measure Population Exclusion
Measure Observation | ID: MeasureObservation_4 Description: Component Measure 4: Eligible encounters for patients with a documented "Nutrition Care Plan" based on the most recent finding of "Nutrition Assessment Status Finding of Moderately Malnourished" or “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). Logic Definition: Measure Observation 4
Population Basis | Encounter
Scoring | [http://terminology.hl7.org/CodeSystem/measure-scoring#continuous-variable: 'Continuous Variable']
Type | [http://terminology.hl7.org/CodeSystem/measure-type#outcome: 'Outcome']
Improvement Notation | [http://terminology.hl7.org/CodeSystem/measure-improvement-notation#increase: 'Increased score indicates improvement']
Measure Population Criteria (ID: Group_5)
Summary | Total Malnutrition Care Components
Initial Population | ID: InitialPopulation_5 Description: 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 Logic Definition: Initial Population
Measure Population | ID: MeasurePopulation_5 Description: Equals Initial Population Logic Definition: Measure Population
Measure Population Exclusion | ID: MeasurePopulationExclusion_5 Description: Encounters with hospice care ordered during the inpatient qualifying encounter and encounters with a discharge disposition of hospice Logic Definition: Measure Population Exclusion
Measure Observation | ID: MeasureObservation_5 Description: 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") Logic Definition: Measure Observation Total Malnutrition Components Score
Population Basis | Encounter
Scoring | [http://terminology.hl7.org/CodeSystem/measure-scoring#continuous-variable: 'Continuous Variable']
Type | [http://terminology.hl7.org/CodeSystem/measure-type#outcome: 'Outcome']
Improvement Notation | [http://terminology.hl7.org/CodeSystem/measure-improvement-notation#increase: 'Increased score indicates improvement']
Measure Population Criteria (ID: Group_6)
Summary | Encounter Malnutrition Care Score
Initial Population | ID: InitialPopulation_6 Description: 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 Logic Definition: Initial Population
Measure Population | ID: MeasurePopulation_6 Description: Equals Initial Population Logic Definition: Measure Population
Measure Population Exclusion | ID: MeasurePopulationExclusion_6 Description: Encounters with hospice care ordered during the inpatient qualifying encounter and encounters with a discharge disposition of hospice Logic Definition: Measure Population Exclusion
Measure Observation | ID: MeasureObservation_6 Description: 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 ("Measure Observation 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" is 2 ---If the most recent "Nutrition Assessment" performed has a result of "Nutrition Status Finding of Well Nourished or Not Malnourished or Mildly Malnourished". --- 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. Logic Definition: Measure Observation Total Malnutrition Care Score as Percentage
Population Basis | Encounter
Scoring | [http://terminology.hl7.org/CodeSystem/measure-scoring#continuous-variable: 'Continuous Variable']
Type | [http://terminology.hl7.org/CodeSystem/measure-type#outcome: 'Outcome']
Improvement Notation | [http://terminology.hl7.org/CodeSystem/measure-improvement-notation#increase: 'Increased score indicates improvement']
Supplemental Data Elements
Supplemental Data Element | ID: sde-payer-type Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Payer Type Logic Definition: SDE Payer Type
Supplemental Data Element | ID: sde-race Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Race Logic Definition: SDE Race
Supplemental Data Element | ID: sde-ethnicity Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Ethnicity Logic Definition: SDE Ethnicity
Supplemental Data Element | ID: sde-sex Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Sex Logic Definition: SDE Sex
Measure Logic
Primary Library | https://madie.cms.gov/Library/CMS986FHIRMalnutritionScore
Dependency | Description: Library FHIRHelpers Resource: https://madie.cms.gov/Library/FHIRHelpers|4.4.000 Canonical URL: `https://madie.cms.gov/Library/FHIRHelpers|4.4.000`
Dependency | Description: Library QICoreCommon Resource: https://madie.cms.gov/Library/QICoreCommon|4.0.000 Canonical URL: `https://madie.cms.gov/Library/QICoreCommon|4.0.000`
Dependency | Description: Library CQMCommon Resource: https://madie.cms.gov/Library/CQMCommon|4.1.000 Canonical URL: `https://madie.cms.gov/Library/CQMCommon|4.1.000`
Dependency | Description: Library SDE Resource: https://madie.cms.gov/Library/SupplementalDataElements|5.1.000 Canonical URL: `https://madie.cms.gov/Library/SupplementalDataElements|5.1.000`
Dependency | Description: Code system SNOMEDCT Resource: http://snomed.info/sct Canonical URL: `http://snomed.info/sct`
Dependency | Description: Code system ConditionClinicalStatusCodes Resource: http://terminology.hl7.org/CodeSystem/condition-clinical Canonical URL: `http://terminology.hl7.org/CodeSystem/condition-clinical`
Dependency | 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`
Dependency | Description: Value set Hospice Care Referral or Admission Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1116.365 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1116.365`
Dependency | Description: Value set Hospice Status Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.101 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.101`
Dependency | 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`
Dependency | 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`
Dependency | Description: Value set Malnutrition Risk Screening Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.92 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.92`
Dependency | Description: Value set Malnutrition Screening Finding of Not At Risk Result Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.34 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.34`
Dependency | Description: Value set Malnutrition Screening Finding of At Risk Result Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.89 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.89`
Dependency | Description: Value set Dietitian Referral Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.91 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.91`
Dependency | Description: Value set Nutrition Assessment Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.21 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.21`
Dependency | Description: Value set Nutrition Assessment Status Finding of Well Nourished or Not Malnourished or Mildly Malnourished Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.96 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.96`
Dependency | Description: Value set Nutrition Assessment Status Finding of Moderately Malnourished Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.47 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.47`
Dependency | Description: Value set Nutrition Assessment Status Finding of Severely Malnourished Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.43 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.43`
Dependency | Description: Value set Malnutrition Diagnosis Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.55 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.55`
Dependency | Description: Value set Nutrition Care Plan Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.93 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.93`
Dependency | 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`
Direct Reference Code | Display: Active Code: active System: `http://terminology.hl7.org/CodeSystem/condition-clinical`
Direct Reference Code | Display: Recurrence Code: recurrence System: `http://terminology.hl7.org/CodeSystem/condition-clinical`
Direct Reference Code | Display: Relapse Code: relapse System: `http://terminology.hl7.org/CodeSystem/condition-clinical`
Parameter | Name: Measurement Period Use: in Min Cardinality: 0 Max Cardinality: 1 Type: Period
Parameter | Name: Measure Population Exclusion Use: out Min Cardinality: 0 Max Cardinality: * Type: Resource
Parameter | Name: Initial Population Use: out Min Cardinality: 0 Max Cardinality: * Type: Resource
Parameter | Name: Measure Population Use: out Min Cardinality: 0 Max Cardinality: * Type: Resource
Parameter | Name: SDE Race Use: out Min Cardinality: 0 Max Cardinality: 1 Type: Resource
Parameter | Name: SDE Sex Use: out Min Cardinality: 0 Max Cardinality: 1 Type: Coding
Parameter | Name: SDE Payer Type Use: out Min Cardinality: 0 Max Cardinality: * Type: Resource
Parameter | Name: SDE Ethnicity Use: out Min Cardinality: 0 Max Cardinality: 1 Type: Resource
Measure Logic Data Requirements
Data Requirement | Type: Patient Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient Must Support Elements: birthDate, birthDate.value, url, extension
Data Requirement | Type: Encounter Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter Must Support Elements: type, status, status.value, period 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 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: id, period, id.value
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, id, id.value, reasonCode, reasonReference 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: ServiceRequest Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest Must Support Elements: code, status, status.value, intent, intent.value, doNotPerform, doNotPerform.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.101
Data Requirement | Type: ServiceRequest Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest Must Support Elements: code, status, status.value, intent, intent.value, doNotPerform, doNotPerform.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.91
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: code, status, status.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.101
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: code, status, status.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.91
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: code, status, status.value, performed Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.93
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment Must Support Elements: code, status, status.value, effective, value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.92
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment 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.1095.21
Data Requirement | Type: Condition Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns Must Support Elements: code Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1095.55
Data Requirement | Type: Resource Profile(s): http://hl7.org/fhir/StructureDefinition/Resource Must Support Elements: id, id.value
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.113762.1.4.1095.55
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
Measure Logic Definitions
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Initial 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'
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Measure Population":
      "Initial Population"
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter with Discharge for Hospice Care":
      "Measure Population" QualifyingEncounter
        where QualifyingEncounter.hospitalization.dischargeDisposition in "Hospice Care Referral or Admission"
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Intervention Hospice Care":
      ( ["ServiceRequest": code in "Hospice Status"] HospiceStatusOrder
          where HospiceStatusOrder.status in { 'active', 'completed', 'on-hold' }
            and HospiceStatusOrder.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
            and HospiceStatusOrder.doNotPerform is not true
      )
        union ( ["Procedure": "Hospice Status"] HospiceStatusPerformed
            where HospiceStatusPerformed.status in { 'completed', 'in-progress' }
        )
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter with Hospice during Eligible Encounter":
      "Measure Population" QualifyingEncounter
        with "Intervention Hospice Care" HospiceStatus
          such that Coalesce(start of HospiceStatus.performed.toInterval(), HospiceStatus.authoredOn) during day of QualifyingEncounter.hospitalizationWithObservation ( )
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Measure Population Exclusion":
      "Encounter with Discharge for Hospice Care"
        union "Encounter with Hospice during Eligible Encounter"
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: CMS986FHIRMalnutritionScore
    define "SDE Race":
      SDE."SDE Race"
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: CMS986FHIRMalnutritionScore
    define "SDE Sex":
      SDE."SDE Sex"
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter with Malnutrition Risk Screening":
      "Measure Population" QualifyingEncounter
        with ["ObservationScreeningAssessment": "Malnutrition Risk Screening"] MalnutritionRiskScreening
          such that ( MalnutritionRiskScreening.status in { 'final', 'amended', 'corrected' }
              and MalnutritionRiskScreening.effective.toInterval ( ) during QualifyingEncounter.hospitalizationWithObservation ( )
              and ( MalnutritionRiskScreening.value as Concept in "Malnutrition Screening Finding of Not At Risk Result"
                  or MalnutritionRiskScreening.value as Concept in "Malnutrition Screening Finding of At Risk Result"
              )
          )
        return QualifyingEncounter
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Intervention Dietitian Referral":
      ( ["ServiceRequest": code in "Dietitian Referral"] DietitianReferralOrder
          where DietitianReferralOrder.status in { 'active', 'completed', 'on-hold' }
            and DietitianReferralOrder.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
            and DietitianReferralOrder.doNotPerform is not true
      )
        union ( ["Procedure": "Dietitian Referral"] DietitianReferralPerformed
            where DietitianReferralPerformed.status in { 'completed', 'in-progress' }
        )
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter with Dietitian Referral":
      "Measure Population" QualifyingEncounter
        with "Intervention Dietitian Referral" DietitianReferral
          such that Coalesce(start of DietitianReferral.performed.toInterval(), DietitianReferral.authoredOn) during day of QualifyingEncounter.hospitalizationWithObservation ( )
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter with Malnutrition Risk Screening or with Dietitian Referral":
      "Measure Population" QualifyingEncounter
        where ( "Encounter with Malnutrition Risk Screening" contains QualifyingEncounter
            or "Encounter with Dietitian Referral" contains QualifyingEncounter
        )
        return QualifyingEncounter
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter with Malnutrition Risk Screening Not At Risk":
      "Measure Population" QualifyingEncounter
        with ["ObservationScreeningAssessment": "Malnutrition Risk Screening"] MalnutritionRiskScreening
          such that MalnutritionRiskScreening.status in { 'final', 'amended', 'corrected' }
            and MalnutritionRiskScreening.effective.toInterval ( ) during QualifyingEncounter.hospitalizationWithObservation ( )
            and ( MalnutritionRiskScreening.value as Concept in "Malnutrition Screening Finding of Not At Risk Result" )
        return QualifyingEncounter
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter with Malnutrition Not At Risk Screening and without Dietitian Referral":
      "Measure Population" QualifyingEncounter
        where "Encounter with Malnutrition Risk Screening Not At Risk" contains QualifyingEncounter
          and not exists ( "Encounter with Dietitian Referral" )
        return QualifyingEncounter
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter with Malnutrition Risk Screening At Risk":
      "Measure Population" QualifyingEncounter
        with ["ObservationScreeningAssessment": "Malnutrition Risk Screening"] MalnutritionRiskScreening
          such that MalnutritionRiskScreening.status in { 'final', 'amended', 'corrected' }
            and MalnutritionRiskScreening.effective.toInterval ( ) during QualifyingEncounter.hospitalizationWithObservation ( )
            and ( MalnutritionRiskScreening.value as Concept in "Malnutrition Screening Finding of At Risk Result" )
        return QualifyingEncounter
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter with Malnutrition Risk Screening At Risk or with Dietitian Referral":
      "Measure Population" QualifyingEncounter
        where "Encounter with Malnutrition Risk Screening At Risk" contains QualifyingEncounter
          or "Encounter with Dietitian Referral" contains QualifyingEncounter
        return QualifyingEncounter
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Nutrition Assessment Performed":
      from
        "Measure Population" QualifyingEncounter,
        ["ObservationScreeningAssessment": "Nutrition Assessment"] NutritionAssessment
        let NAssessLatest: NutritionAssessment.effective.latest ( )
        where "Nutrition Assessment" contains NutritionAssessment.code as Concept
          and NutritionAssessment.status in { 'final', 'amended', 'corrected' }
          and NutritionAssessment.effective.toInterval ( ) during QualifyingEncounter.hospitalizationWithObservation ( )
          and NutritionAssessment.value is not null
        return Tuple {
          HospEncId: QualifyingEncounter.id,
          HospitalizationPeriod: QualifyingEncounter.hospitalizationWithObservation ( ),
          NutrAssessCode: NutritionAssessment.code as Concept,
          NutrAssessId: NutritionAssessment.id,
          NutrAssessResult: NutritionAssessment.value,
          NutrAssessTimingEff: NutritionAssessment.effective,
          NutrAssessTimingInt: NutritionAssessment.effective.toInterval ( ),
          NutrAssessTimingLatest: NAssessLatest
        }
        sort by NutrAssessTimingLatest asc
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter With Most Recent Nutrition Assessment And Identified Status":
      "Measure Population" QualifyingEncounter
        with ["ObservationScreeningAssessment": "Nutrition Assessment"] NutritionAssessment
          such that ( NutritionAssessment.status in { 'final', 'amended', 'corrected' }
              and NutritionAssessment.effective.toInterval ( ) during QualifyingEncounter.hospitalizationWithObservation ( )
              and ( NutritionAssessment.value as Concept in "Nutrition Assessment Status Finding of Well Nourished or Not Malnourished or Mildly Malnourished"
                  or ( NutritionAssessment.value as Concept in "Nutrition Assessment Status Finding of Moderately Malnourished" )
                  or ( NutritionAssessment.value as Concept in "Nutrition Assessment Status Finding of Severely Malnourished" )
              )
              and ( exists ( "Encounter with Malnutrition Risk Screening At Risk" )
                  or exists ( "Encounter with Dietitian Referral" )
              )
              and NutritionAssessment.effective.latest ( ) same day as "Last Nutrition Assessment Day During Encounter"(QualifyingEncounter)
          )
        return QualifyingEncounter
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Has Malnutrition Diagnosis":
      [ConditionProblemsHealthConcerns: "Malnutrition Diagnosis"] MalnutritionDiagnosis
        where MalnutritionDiagnosis.prevalenceInterval ( ) overlaps "Measurement Period"
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter With Encounter Diagnosis Of Malnutrition Diagnosis":
      "Measure Population" QualifyingEncounter
        where QualifyingEncounter.reasonCode in "Malnutrition Diagnosis"
          or exists ( [ConditionEncounterDiagnosis: "Malnutrition Diagnosis"] EncounterDiagnosis
              where QualifyingEncounter.reasonReference.references ( EncounterDiagnosis )
          )
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter with Malnutrition Diagnosis":
      "Measure Population" QualifyingEncounter
        where exists ( "Has Malnutrition Diagnosis" MalnutritionDiagnosis
            where MalnutritionDiagnosis.prevalenceInterval ( ) overlaps day of QualifyingEncounter.hospitalizationWithObservation ( )
        )
          or exists "Encounter With Encounter Diagnosis Of Malnutrition Diagnosis"
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter With Most Recent Nutrition Assessment Status of Not or Mildly Malnourished":
      "Measure Population" QualifyingEncounter
        with ["ObservationScreeningAssessment": "Nutrition Assessment"] NutritionAssessment
          such that ( NutritionAssessment.status in { 'final', 'amended', 'corrected' }
              and NutritionAssessment.effective.toInterval ( ) during QualifyingEncounter.hospitalizationWithObservation ( )
              and ( NutritionAssessment.value as Concept in "Nutrition Assessment Status Finding of Well Nourished or Not Malnourished or Mildly Malnourished" )
              and NutritionAssessment.effective.latest ( ) same day as "Last Nutrition Assessment Day During Encounter"(QualifyingEncounter)
          )
        return QualifyingEncounter
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter With Most Recent Nutrition Assessment Status of Moderately Or Severely Malnourished":
      "Measure Population" QualifyingEncounter
        with ["ObservationScreeningAssessment": "Nutrition Assessment"] NutritionAssessment
          such that NutritionAssessment.status in { 'final', 'amended', 'corrected' }
            and NutritionAssessment.effective.toInterval ( ) during QualifyingEncounter.hospitalizationWithObservation ( )
            and ( NutritionAssessment.value as Concept in "Nutrition Assessment Status Finding of Moderately Malnourished"
                or NutritionAssessment.value as Concept in "Nutrition Assessment Status Finding of Severely Malnourished"
            )
            and NutritionAssessment.effective.latest ( ) same day as "Last Nutrition Assessment Day During Encounter"(QualifyingEncounter)
        return QualifyingEncounter
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define "Encounter with Nutrition Care Plan":
      "Measure Population" QualifyingEncounter
        with ["Procedure": "Nutrition Care Plan"] NutritionCarePlan
          such that NutritionCarePlan.status in { 'completed', 'in-progress' }
            and NutritionCarePlan.performed.earliest ( ) during QualifyingEncounter.hospitalizationWithObservation ( )
        return QualifyingEncounter
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: CMS986FHIRMalnutritionScore
    define "SDE Payer Type":
      SDE."SDE Payer"
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: CMS986FHIRMalnutritionScore
    define "SDE Ethnicity":
      SDE."SDE Ethnicity"
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: 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: 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
    */
    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]
Logic Definition | Library Name: FHIRHelpers
    define function ToString(value uri): value.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: CMS986FHIRMalnutritionScore
    define function "Measure Observation 1"(MalnutritionRiskScreening Encounter):
      if "Encounter with Malnutrition Risk Screening or with Dietitian Referral" contains MalnutritionRiskScreening then 1
        else 0
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    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) })
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define function "Measure Observation 2"(NutritionAssessment Encounter):
      if "Encounter with Malnutrition Not At Risk Screening and without Dietitian Referral" contains NutritionAssessment then 0
        else if "Encounter with Malnutrition Risk Screening At Risk or with Dietitian Referral" contains NutritionAssessment then if "Encounter With Most Recent Nutrition Assessment And Identified Status" contains NutritionAssessment then 1
        else 0
        else 0
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Given an interval, returns the ending point if the interval has an ending boundary specified,
    otherwise, returns the starting point
    */
    define fluent function latest(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ):
      (choice.toInterval()) period
        return
          if (period."hasEnd"()) then end of period
          else start of period
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Given an interval, returns true if the interval has an ending boundary specified
    (i.e. the end of the interval is not null and not the maximum DateTime value)
    */
    define fluent function hasEnd(period Interval<DateTime> ):
      not (
        end of period is null
          or end of period = maximum DateTime
      )
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define function "Last Nutrition Assessment Day During Encounter"(QualifyingEncounter Encounter):
      Last("Nutrition Assessment Performed" NutritionAssessmentTuple
          where NutritionAssessmentTuple.HospEncId = QualifyingEncounter.id
          return NutritionAssessmentTuple.NutrAssessTimingLatest
          sort asc
      )
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define function "Measure Observation 3"(MalnutritionDiagnosis Encounter):
      if "Encounter with Malnutrition Not At Risk Screening and without Dietitian Referral" contains MalnutritionDiagnosis then 0
        else if "Encounter with Malnutrition Risk Screening At Risk or with Dietitian Referral" contains MalnutritionDiagnosis then if "Encounter with Malnutrition Diagnosis" contains MalnutritionDiagnosis then if "Encounter With Most Recent Nutrition Assessment Status of Not or Mildly Malnourished" contains MalnutritionDiagnosis then 0
        else if "Encounter With Most Recent Nutrition Assessment Status of Moderately Or Severely Malnourished" contains MalnutritionDiagnosis then 1
        else 0
        else 0
        else 0
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.
    */
    define fluent function prevalenceInterval(condition Choice<"ConditionEncounterDiagnosis", "ConditionProblemsHealthConcerns">):
    if condition.clinicalStatus ~ "active"
      or condition.clinicalStatus ~ "recurrence"
      or condition.clinicalStatus ~ "relapse" then
      Interval[start of condition.onset.toInterval(), end of condition.abatementInterval()]
    else
        (end of condition.abatementInterval()) abatementDate
        return if abatementDate is null then
          Interval[start of condition.onset.toInterval(), abatementDate)
        else
          Interval[start of condition.onset.toInterval(), abatementDate]
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Returns an interval representing the normalized abatement of a given Condition.
    @comment: If the abatement element of the Condition is represented as a DateTime, the result
    is an interval beginning and ending on that DateTime.
    If the abatement is represented as a Quantity, the quantity is expected to be a calendar-duration and is interpreted as the age of the patient. The
    result is an interval from the date the patient turned that age to immediately before one year later.
    If the abatement is represented as a Quantity Interval, the quantities are expected to be calendar-durations and are interpreted as an age range during
    which the abatement occurred. The result is an interval from the date the patient turned the starting age of the quantity interval, and ending immediately
    before one year later than the date the patient turned the ending age of the quantity interval.
    */
    define fluent function abatementInterval(condition Choice<"ConditionEncounterDiagnosis", "ConditionProblemsHealthConcerns">):
    	if condition.abatement is DateTime then
    	  Interval[condition.abatement as DateTime, condition.abatement as DateTime]
    	else if condition.abatement is Quantity then
    		Interval[Patient.birthDate + (condition.abatement as Quantity),
    			Patient.birthDate + (condition.abatement as Quantity) + 1 year)
    	else if condition.abatement is Interval<Quantity> then
    	  Interval[Patient.birthDate + (condition.abatement.low as Quantity),
    		  Patient.birthDate + (condition.abatement.high as Quantity) + 1 year)
    	else if condition.abatement is Interval<DateTime> then
    	  Interval[condition.abatement.low, condition.abatement.high)
    	else null as Interval<DateTime>
Logic Definition | Library Name: FHIRHelpers
    /*
    @description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.
    */
    define function ToConcept(concept FHIR.CodeableConcept):
        if concept is null then
            null
        else
            System.Concept {
                codes: concept.coding C return ToCode(C),
                display: concept.text.value
            }
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Returns true if any of the given references are to the given resource
    @comment: Returns true if the `id` element of the given resource exactly equals the tail of any of the given references.
    NOTE: This function assumes resources from the same source server.
    */
    define fluent function references(references List<Reference>, resource Resource):
      exists (references R where R.references(resource))
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Returns true if the given reference is to the given resource
    @comment: Returns true if the `id` element of the given resource exactly equals the tail of the given reference.
    NOTE: This function assumes resources from the same source server.
    */
    define fluent function references(reference Reference, resource Resource):
      resource.id = Last(Split(reference.reference, '/'))
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define function "Measure Observation 4"(NutritionCarePlan Encounter):
      if "Encounter with Malnutrition Not At Risk Screening and without Dietitian Referral" contains NutritionCarePlan then 0
        else if "Encounter with Malnutrition Risk Screening At Risk or with Dietitian Referral" contains NutritionCarePlan then if "Encounter with Nutrition Care Plan" contains NutritionCarePlan then if "Encounter With Most Recent Nutrition Assessment Status of Not or Mildly Malnourished" contains NutritionCarePlan then 0
        else if "Encounter With Most Recent Nutrition Assessment Status of Moderately Or Severely Malnourished" contains NutritionCarePlan then 1
        else 0
        else 0
        else 0
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
    */
    define fluent function earliest(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ):
      (choice.toInterval()) period
        return
          if (period."hasStart"()) then start of period
          else end of period
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Given an interval, return true if the interval has a starting boundary specified
    (i.e. the start of the interval is not null and not the minimum DateTime value)
    */
    define fluent function hasStart(period Interval<DateTime> ):
      not ( start of period is null
          or start of period = minimum DateTime
      )
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    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) )
Logic Definition | Library Name: CMS986FHIRMalnutritionScore
    define function "Total Malnutrition Care Score Eligible Occurrences"(QualifyingEncounter Encounter):
      if ( ( "Encounter with Malnutrition Risk Screening or with 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 Dietitian Referral" contains QualifyingEncounter )
            and ( "Encounter with Malnutrition Risk Screening At Risk" contains QualifyingEncounter )
        )
          or ( "Encounter with Dietitian Referral" contains QualifyingEncounter )
      )
        and ( "Encounter With Most Recent Nutrition Assessment Status of Not or Mildly Malnourished" contains QualifyingEncounter )
        or not ( "Encounter With Most Recent Nutrition Assessment And Identified Status" contains QualifyingEncounter ) then 2
        else 4
Generated using version 0.4.7 of the sample-content-ig Liquid templates