Metadata
Title | Hospital Harm - Postoperative Respiratory FailureFHIR
Version | 1.0.000
Short Name | CMS1218FHIR
GUID (Version Independent) | urn:uuid:b6857e46-6412-432d-abc8-0508efc0d2d7
GUID (Version Specific) | urn:uuid:fb07b5c1-50c3-45e7-b8c7-ca26409a0f48
CMS Identifier | 1218FHIR
CMS Consensus Based Entity Identifier | 4130e
Effective Period | 2026-01-01 through 2026-12-31
Steward (Publisher) | Centers for Medicare & Medicaid Services (CMS)
Developer | Mathematica
Description | This measure assesses the number of elective inpatient hospitalizations for patients aged 18 years and older without an obstetrical condition who have a procedure resulting in postoperative respiratory failure (PRF)
Copyright | Limited proprietary coding is contained in the Measure specifications for user convenience. Users of proprietary code sets should obtain all necessary licenses from the owners of the code sets. Mathematica disclaims all liability for use or accuracy of any third-party codes contained in the specifications. LOINC(R) copyright 2004-2024 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2024 International Health Terminology Standards Development Organisation. ICD-10 copyright 2024 World Health Organization. All Rights Reserved.
Disclaimer | This performance measure is not a clinical guideline, does not establish a standard of medical care, and has not been tested for all potential applications. THE MEASURES AND SPECIFICATIONS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. Due to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].
Rationale | Postoperative respiratory failure (PRF), defined as unplanned endotracheal reintubation, prolonged inability to wean from mechanical ventilation, or inadequate oxygenation and/or ventilation, is the most common serious postoperative pulmonary complication, with an incidence of up to 7.5% (the incidence of any postoperative pulmonary complication ranges from 10-40%) (Arozullah et al., 2000; Canet et al., 2015; Gupta et al., 2011; Kor et al., 2014). This measure addresses the prevalence of PRF and the variance between hospitals in the incidence of PRF. PRF is a serious complication that can increase the risk of morbidity and mortality, with in-hospital mortality resulting from PRF estimated at 25% to 40% (Arozullah et al., 2000; Canet & Gallart, 2014). Surgical procedures complicated by PRF have 3.74 times higher adjusted odds of death than those not complicated by respiratory failure, 1.47 times higher odds of 90-day readmission, and 1.86 times higher odds of an outpatient visit with one of 44 postoperative conditions (e.g., bacterial infection, fluid and electrolyte disorder, abdominal hernia) within 90 days of hospital discharge (Miller et al., 2001; Romano et al, 2009). PRF is additionally associated with prolonged mechanical ventilation and the need for rehabilitation or skilled nursing facility placement upon discharge (Thompson & Lisco, 2018). The incidence of PRF varies by hospital, with higher reported rates of PRF in nonteaching hospitals than teaching hospitals (Rahman et al., 2013). Additionally, one study found that the odds of developing PRF increased by 6% for each level increase in hospital size from small to large (Rahman et al., 2013). This suggests that there remains room for improvement in hospitals reporting higher rates of PRF. The most widely used current measures of PRF are based on either claims data (CMS Patient Safety Indicator (PSI) 11) or proprietary registry data (National Surgical Quality Improvement Program (NSQIP) of the American College of Surgeons). The dQM is closely modeled after the NSQIP measure of PRF, which has been widely adopted across American hospitals, and is intended to complement and eventually supplant CMS PSI 11.
Clinical Recommendation Statement | Recent studies and current clinical practice guidelines for PRF have identified enhanced recovery pathways, prophylactic mucolytics, postoperative continuous positive airway pressure ventilation, lung protective intraoperative ventilation, prophylactic respiratory physiotherapy, epidural analgesia, and goal directed hemodynamic therapy as evidence-based interventions to reduce the incidence of PRF. Yet, progress in reducing the incidence of PRF has been stymied by lack of consensus regarding the definition of PRF, which patients are most at-risk, which risk factors are potentially modifiable, and which patients are more likely to benefit from targeted interventions of a health care system's limited resources. This measure would address this gap in data. Relevant clinical guidelines for preventing postoperative respiratory failure can be found in the following: Mohanty, et al. Optimal Perioperative Management of the Geriatric Patient: Best Practices Guideline from ACS NSQIP/AGS, 2016 Piraino, et al. AARC Clinical Practice Guideline: Management of Adult Patients with Oxygen in the Acute Care Setting, 2022
Citation | Arozullah, A.M., Daley, J., Henderson, W.G., & Khuri, S.F. (2000). Multifactorial risk index for predicting postoperative respiratory failure in men after major noncardiac surgery. The National Veterans Administration Surgical Quality Improvement Program. Annals of surgery. 232(2):242-253. doi: 10.1097/00000658-200008000-00015. PMID: 10903604; PMCID: PMC1421137.
Citation | Canet, J., & Gallart, L. (2014). Postoperative respiratory failure: Pathogenesis, prediction, and prevention. Current Opinion in Critical Care. 20(1):56-62. doi: 10.1097/MCC.0000000000000045. PMID: 24240985.
Citation | Canet, J., Sabate, S., Mazo, V., Gallart, L., de Abreu, M.G., Belda, J., ... & Pelosi, P. (2015). PERISCOPE group. Development and validation of a score to predict postoperative respiratory failure in a multicentre European cohort: A prospective, observational study. Eur J Anaesthesiol. 32(7):458-70. doi: 10.1097/EJA.0000000000000223. PMID: 26020123.
Citation | Gupta, H., Gupta, P.K., Fang, X., Miller, W.J., Cemaj, S., Forse, R.A., & Morrow, L.E. (2011). Development and validation of a risk calculator predicting postoperative respiratory failure. Chest. 140(5):1207-1215. doi: 10.1378/chest.11-0466. Epub 2011 Jul 14. PMID: 21757571.
Citation | Kor, D.J., Lingineni, R.K., Gajic, O., Park, P.K., Blum, J.M., Hou, P.C., ... & Talmor, D.S. (2014). Predicting risk of postoperative lung injury in high-risk surgical patients: a multicenter cohort study. Anesthesiology. 120(5):1168-81. doi: 10.1097/ALN.0000000000000216. PMID: 24755786; PMCID: PMC3999474.
Citation | Miller, M.R., Elixhauser, A., Zhan, C., & Meyer, G.S. (2001). Patient Safety Indicators: using administrative data to identify potential patient safety concerns. Health Serv Res. 36(6 Pt 2):110-32. PMID: 16148964; PMCID: PMC1383610.
Citation | Rahman, M., Neal, D., Fargen, K.M., & Hoh, B.L. (2013). Establishing standard performance measures for adult brain tumor patients: a Nationwide Inpatient Sample database study. Neuro Oncol. 15(11):1580-8. doi: 10.1093/neuonc/not108. Epub 2013 Sep 30. PMID: 24084409; PMCID: PMC3813415.
Citation | Romano, P.S., Mull, H.J., Rivard, P.E., Zhao, S., Henderson, W.G., Loveland, S., Tsilimingras, D., ... & Rosen, A.K. (2009). Validity of selected AHRQ patient safety indicators based on VA National Surgical Quality Improvement Program data. Health Serv Res. 44(1):182-204. doi: 10.1111/j.1475-6773.2008.00905.x. Epub 2008 Sep 17. PMID: 18823449; PMCID: PMC2669628.
Citation | Thompson, S.L., & Lisco, S.J. (2018). Postoperative respiratory failure. Int Anesthesiol Clin. 56(1):147-164. doi: 10.1097/AIA.0000000000000173. PMID: 29189437.
Guidance (Usage) | PRF is evaluated using mechanical ventilation (MV) documentation or intubation and extubation documentation to allow for hospital documentation variances. Therefore, if MV documentation is not available, intubation and extubation can serve as a proxy for determining if MV occurred and its duration. To determine that an unplanned initiation of MV occurred, the logic looks for evidence of a non-invasive oxygen therapy assessment such as oxygen via 'nasal canula' or 'breathing room air' prior to the MV occurrence to verify that MV was newly initiated. Additionally, facility location codes are used to determine if MV was initiated outside of a procedural area (e.g., medical floor). Conversely, to determine MV duration, the logic looks for evidence that a non-invasive oxygen therapy assessment or another operating room procedure does not exist prior to the MV occurrence to verify that MV was continued without interruption from a procedural area. This dQM is an episode-based measure. An episode is defined as each inpatient hospitalization or encounter that ends during the measurement period. This FHIR-based measure has been derived from the QDM-based measure: CMS1218v2. Please refer to the HL7 QI-Core Implementation Guide (https://hl7.org/fhir/us/qicore/STU6/) for more information on QI-Core and mapping recommendations from QDM to QI-Core STU 6 (https://hl7.org/fhir/us/qicore/STU6/qdm-to-qicore.html).
Measure Group (Rate) (ID: Group_1)
Basis | Encounter
Scoring | [http://terminology.hl7.org/CodeSystem/measure-scoring#proportion: 'Proportion']
Type | [http://terminology.hl7.org/CodeSystem/measure-type#outcome: 'Outcome']
Rate Aggregation | None
Improvement Notation | [http://terminology.hl7.org/CodeSystem/measure-improvement-notation#decrease: 'Decreased score indicates improvement']
Initial Population | ID: InitialPopulation_1 Description: Elective inpatient hospitalizations with no preceding emergency department visit that end during the measurement period for patients aged 18 and older without an obstetrical condition and at least one surgical procedure was performed within the first 3 days of the encounter Logic Definition: Initial Population
Denominator | ID: Denominator_1 Description: Equals Initial Population Logic Definition: Denominator
Denominator Exclusion | ID: DenominatorExclusion_1 Description: Inpatient hospitalizations for patients: With a diagnosis for a degenerative neurological disorder With any selected head, neck, and thoracic surgery involving significant risk of airway compromise or requiring airway protection Who have mechanical ventilation that starts more than one hour prior to the start of the first operating room (OR) procedure With a diagnosis for a neuromuscular disorder With arterial partial pressure of carbon dioxide (PaCO2)>50 mmHg combined with an arterial pH<7.30 within 48 hours or less prior to the start of the first OR procedure With arterial partial pressure of oxygen (PaO2)<50 mmHg within 48 hours or less prior to the start of the first OR procedure With a principal diagnosis for acute respiratory failure With a diagnosis for acute respiratory failure present on admission With any diagnosis present on admission for the existence of a tracheostomy Where a tracheostomy is performed before or on the same day as the first OR procedure Logic Definition: Denominator Exclusions
Numerator | ID: Numerator_1 Description: Elective inpatient hospitalizations for patients with postoperative respiratory failure as evidenced by any of the following: Criterion A: Mechanical ventilation (MV) initiated within 30 days after first OR procedure, as evidenced by: A.1. Intubation that occurs outside of a procedural area and within 30 days after the end of the first OR procedure of the encounter. or A.2. MV that occurs outside of a procedural area within 30 days after the end of the first OR procedure of the encounter and is preceded by a period of non-invasive oxygen therapy between the end of the OR procedure and the MV occurrence, and without a subsequent OR procedure between the non-invasive oxygen therapy and the MV occurrence. or Criterion B: MV with a duration of more than 48 hours after the first OR procedure, as evidenced by: B.1. Extubation that occurs outside of a procedural area more than 48 hours after the end of an OR procedure and within 30 days after the end of the first OR procedure, and is not preceded by a period of non-invasive oxygen therapy or a subsequent OR procedure between the end of the OR procedure and the extubation occurrence. or B.2 Mechanical ventilation that occurs between 48 and 72 hours after the end of an OR procedure and within 30 days after the end of the first OR procedure, and is not preceded by a non-invasive oxygen therapy or a subsequent OR procedure between the end of the OR procedure and the MV occurrence. Logic Definition: Numerator
Supplemental Data Guidance | For every patient evaluated by this measure also identify payer, race, ethnicity and sex
Supplemental Data Guidance | Variables are collected for the development of baseline risk adjustment model Report the first resulted vital sign values during the encounter in the Unified Code for Units of Measure (UCUM) units specified: Body temperature: Cel, [degF] Heart rate: {Beats}/min Respiratory rate: {Breaths}/min Systolic blood pressure: mm[Hg] Report the first resulted laboratory test values during the encounter in UCUM units specified: Albumin: g/dL, umol/L Aspartate aminotransferase (AST/SGOT): U/L, IU/L Bicarbonate: mmol/L Bilirubin: mg/dL, umol/L Blood urea nitrogen (BUN): mg/dL, umol/L Carbon dioxide (partial pressure): mm[Hg] Creatinine: mg/dL, umol/L Hematocrit: % Hemoglobin: g/dL, mmol/L Leukocyte count: {cells}/uL, 103/uL, 109/L, /mm3 Oxygen (partial pressure): mm[Hg] pH of arterial blood: [pH] Platelet count: 103/uL, 109/L, /mm3 Sodium: meq/L, mmol/L White blood cell count: {cells}/uL, 103/uL, 109/L, /mm3 Additional variables used for risk adjustment: American Society of Anesthesiologists (ASA) physical status class assessment that starts during the encounter First Body mass index (BMI), reported using UCUM unit: kg/m2 Encounter diagnoses with their present on admission (POA) indicators Most recent smoking status Principal surgical procedures that start during the encounter Please see the Hospital Harm - Postoperative Respiratory Failure Risk Adjustment Methodology Report on the dQM-specific page on the eCQI Resource Center website: https://ecqi.healthit.gov/
Supplemental Data Elements
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-payer Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Payer Logic Definition: SDE Payer
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-sex Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Sex Logic Definition: SDE Sex
Supplemental Data Element | ID: risk-variable-all-encounter-diagnoses-with-poa-indication Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable All Encounter Diagnoses With POA Indication Logic Definition: Risk Variable All Encounter Diagnoses With POA Indication
Supplemental Data Element | ID: risk-variable-asa-physical-status-class Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable ASA Physical Status Class Logic Definition: Risk Variable ASA Physical Status Class
Supplemental Data Element | ID: risk-variable-body-mass-index-(bmi) Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable Body Mass Index (BMI) Logic Definition: Risk Variable Body Mass Index (BMI)
Supplemental Data Element | ID: risk-variable-encounter-procedures Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable Encounter Procedures Logic Definition: Risk Variable Encounter Procedures
Supplemental Data Element | ID: risk-variable-first-albumin-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Albumin In Encounter Logic Definition: Risk Variable First Albumin In Encounter
Supplemental Data Element | ID: risk-variable-first-arterial-ph-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Arterial pH In Encounter Logic Definition: Risk Variable First Arterial pH In Encounter
Supplemental Data Element | ID: risk-variable-first-ast-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First AST In Encounter Logic Definition: Risk Variable First AST In Encounter
Supplemental Data Element | ID: risk-variable-first-bicarbonate-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Bicarbonate In Encounter Logic Definition: Risk Variable First Bicarbonate In Encounter
Supplemental Data Element | ID: risk-variable-first-bilirubin-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Bilirubin In Encounter Logic Definition: Risk Variable First Bilirubin In Encounter
Supplemental Data Element | ID: risk-variable-first-blood-urea-nitrogen-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Blood Urea Nitrogen In Encounter Logic Definition: Risk Variable First Blood Urea Nitrogen In Encounter
Supplemental Data Element | ID: risk-variable-first-bmi Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First BMI Logic Definition: Risk Variable First BMI
Supplemental Data Element | ID: risk-variable-first-body-temperature-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Body Temperature In Encounter Logic Definition: Risk Variable First Body Temperature In Encounter
Supplemental Data Element | ID: risk-variable-first-carbon-dioxide-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Carbon Dioxide In Encounter Logic Definition: Risk Variable First Carbon Dioxide In Encounter
Supplemental Data Element | ID: risk-variable-first-creatinine-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Creatinine In Encounter Logic Definition: Risk Variable First Creatinine In Encounter
Supplemental Data Element | ID: risk-variable-first-heart-rate-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Heart Rate In Encounter Logic Definition: Risk Variable First Heart Rate In Encounter
Supplemental Data Element | ID: risk-variable-first-hematocrit-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Hematocrit In Encounter Logic Definition: Risk Variable First Hematocrit In Encounter
Supplemental Data Element | ID: risk-variable-first-hemoglobin-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Hemoglobin In Encounter Logic Definition: Risk Variable First Hemoglobin In Encounter
Supplemental Data Element | ID: risk-variable-first-leukocyte-count-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Leukocyte Count In Encounter Logic Definition: Risk Variable First Leukocyte Count In Encounter
Supplemental Data Element | ID: risk-variable-first-oxygen-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Oxygen In Encounter Logic Definition: Risk Variable First Oxygen In Encounter
Supplemental Data Element | ID: risk-variable-first-platelet-count-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Platelet Count In Encounter Logic Definition: Risk Variable First Platelet Count In Encounter
Supplemental Data Element | ID: risk-variable-first-respiratory-rate-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Respiratory Rate In Encounter Logic Definition: Risk Variable First Respiratory Rate In Encounter
Supplemental Data Element | ID: risk-variable-first-sodium-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Sodium In Encounter Logic Definition: Risk Variable First Sodium In Encounter
Supplemental Data Element | ID: risk-variable-first-systolic-blood-pressure-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First Systolic Blood Pressure In Encounter Logic Definition: Risk Variable First Systolic Blood Pressure In Encounter
Supplemental Data Element | ID: risk-variable-first-white-blood-cell-count-in-encounter Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable First White Blood Cell Count In Encounter Logic Definition: Risk Variable First White Blood Cell Count In Encounter
Supplemental Data Element | ID: risk-variable-principal-procedure Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#risk-adjustment-factor] Description: Risk Variable Principal Procedure Logic Definition: Risk Variable Principal Procedure
Measure Logic
Primary Library | https://madie.cms.gov/Library/CMS1218FHIRHHRF
Contents | Population Criteria Logic Definitions Terminology Dependencies Data Requirements
Population Criteria
Measure Group (Rate) (ID: Group_1)
Initial Population
    define "Initial Population":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days"
Denominator
    define "Denominator":
      "Initial Population"
Denominator Exclusion
    define "Denominator Exclusions":
      "Encounter With Degenerative Neurological Disorder"
        union "Encounter With High Risk To Airway Head Neck And Thoracic Surgery"
        union "Encounter With Mechanical Ventilation That Starts More Than One Hour Prior To Start Of First OR Procedure"
        union "Encounter With Neuromuscular Disorder"
        union "Encounter With PaCO2 Greater Than 50 And Arterial pH Less Than 7.30 Within 48 Hours Prior To Start Of First OR Procedure"
        union "Encounter With PaO2 Less Than 50 Within 48 Hours Prior To Start Of First OR Procedure"
        union "Encounter With Principal Diagnosis Of Acute Respiratory Failure"
        union "Encounter With Diagnosis Of Acute Respiratory Failure Present On Admission"
        union "Encounter With Tracheostomy Present On Admission"
        union "Encounter With Tracheostomy Prior To Or On The Same Day Of First OR Procedure"
Numerator
    define "Numerator":
      "Encounter With Intubation Outside Of Procedural Area Within 30 Days Of End Of First OR Procedure"
        union "Encounter With Mechanical Ventilation Outside Of Procedural Area Within 30 Days Of End Of First OR Procedure And Preceded By Non Invasive Oxygen Therapy"
        union "Encounter With Extubation Outside Of Procedural Area Within 30 Days Of End Of First OR Procedure More Than 48 Hours After End Of Anesthesia"
        union "Encounter With Mechanical Ventilation Within 30 Days Of End Of First OR Procedure And Between 48 And 72 Hours After End Of OR Procedure And Not Preceded By Non Invasive Oxygen Therapy Or Anesthesia"
Logic Definitions
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Payer":
      [Coverage: type in "Payer Type"] Payer
        return {
          code: Payer.type,
          period: Payer.period
        }
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Race":
      Patient.race R
        return Tuple {
          codes: R.ombCategory union R.detailed,
          display: R.text
        }
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Sex":
      case
        when Patient.sex = '248153007' then "Male (finding)"
        when Patient.sex = '248152002' then "Female (finding)"
        else null
      end
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Ethnicity":
      Patient.ethnicity E
        return Tuple {
          codes: { E.ombCategory } union E.detailed,
          display: E.text
        }
Logic Definition | Library Name: FHIRHelpers
    /*
    @description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period)
    value to a CQL DateTime Interval
    @comment: If the start value of the given period is unspecified, the starting
    boundary of the resulting interval will be open (meaning the start of the interval
    is unknown, as opposed to interpreted as the beginning of time).
    */
    define function ToInterval(period FHIR.Period):
        if period is null then
            null
        else
            if period."start" is null then
                Interval(period."start".value, period."end".value]
            else
                Interval[period."start".value, period."end".value]
Logic Definition | Library Name: FHIRHelpers
    /*
    @description: Converts the given FHIR [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: 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: FHIRHelpers
    define function ToString(value uri): value.value
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Returns true if the given reference is to the given resourceId
    @comment: Returns true if the `resourceId` parameter exactly equals the tail of the given reference.
    NOTE: This function assumes resources from the same source server.
    */
    define fluent function references(reference Reference, resourceId String):
      resourceId = Last(Split(reference.reference, '/'))
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: 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: 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: 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: QICoreCommon
    /*
    @description: Returns true if the given code is in the given codeList
    @comment: Returns true if the `code` is equivalent to any of the codes in the given `codeList`, false otherwise.
    */
    define fluent function includesCode(codeList List<Concept>, code Code):
      exists (codeList C where C ~ code)
Logic Definition | Library Name: CQMCommon
    /*
    @description: Hospitalization with Observation and Outpatient Surgery Service returns the total interval from the start of any immediately prior emergency department visit, outpatient surgery visit or observation visit to the discharge of the given encounter.
    */
    define fluent function hospitalizationWithObservationAndOutpatientSurgeryService(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
        	),
        	VisitStartWithED: Coalesce(start of EDVisit.period, VisitStart),
        	OutpatientSurgeryVisit: Last([Encounter: "Outpatient Surgery Service"] LastSurgeryOP
    			  where LastSurgeryOP.period ends 1 hour or less on or before VisitStartWithED
    			  sort by	end of period
        	)
      	return Interval[Coalesce(start of OutpatientSurgeryVisit.period, VisitStartWithED), end of Visit.period]
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: CQMCommon
    /*
     @description: Returns the condition that is specified as the principal diagnosis for the encounter and has a code in the given valueSet.
     @comment: See the QICore 6 Authoring Patterns discussion on [Principal Diagnosis and Present on Admission](https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns-QICore-v6.0.0#conditions-present-on-admission-and-principal-diagnoses) for more information
     */
     define fluent function hasPrincipalDiagnosisOf(encounter Encounter, valueSet ValueSet):
       (encounter.principalDiagnosis()) PD
         return PD.diagnosis in valueSet
           or PD.diagnosis.getCondition().code in valueSet
Logic Definition | Library Name: CQMCommon
    /*
    @description: Returns the claim diagnosis element that is specified as the principal diagnosis for the encounter
     @comment: See the QICore 6 Authoring Patterns discussion on [Principal Diagnosis and Present on Admission](https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns-QICore-v6.0.0#conditions-present-on-admission-and-principal-diagnoses) for more information
    */
    define fluent function principalDiagnosis(encounter Encounter):
    singleton from (
         (encounter.claimDiagnosis()) CD
           where CD.type.includesCode("Principal Diagnosis")
       )
Logic Definition | Library Name: CQMCommon
    /*
    @description: Returns the claim diagnosis elements for the given encounter
    @comment: See the QICore 6 Authoring Patterns discussion on [Principal Diagnosis and Present on Admission](https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns-QICore-v6.0.0#conditions-present-on-admission-and-principal-diagnoses) for more information
    */
    define fluent function claimDiagnosis(encounter Encounter):
      encounter E
        let
          claim: ([Claim] C where C.status = 'active' and C.use = 'claim' and exists (C.item I where I.encounter.references(E))),
          claimItem: (claim.item I where I.encounter.references(E))
        return claim.diagnosis D where D.sequence in claimItem.diagnosisSequence
Logic Definition | Library Name: CQMCommon
    /*
    @description: Returns the Condition resource for the given reference
    */
    define fluent function getCondition(reference Reference):
      singleton from (([ConditionEncounterDiagnosis] union [ConditionProblemsHealthConcerns]) C where reference.references(C.id))
Logic Definition | Library Name: CQMCommon
    /*
     @description: Returns true if the given diagnosis is present on admission, based on the given poaValueSet
     @comment: See the QICore 6 Authoring Patterns discussion on [Principal Diagnosis and Present on Admission](https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns-QICore-v6.0.0#conditions-present-on-admission-and-principal-diagnoses) for more information
     */
     define fluent function isDiagnosisPresentOnAdmission(encounter Encounter, diagnosisValueSet ValueSet, poaValueSet ValueSet):
       exists (
         (encounter.claimDiagnosis()) CD
           where CD.onAdmission in poaValueSet
             and (
               CD.diagnosis in diagnosisValueSet
                 or CD.diagnosis.getCondition().code in diagnosisValueSet
             )
       )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Elective Inpatient Encounter With Age 18 And Older Without ED Visit":
      ["Encounter": "Elective Inpatient Encounter"] ElectiveEncounter
        where ElectiveEncounter.status = 'finished'
          and ElectiveEncounter.period ends during day of "Measurement Period"
          and ElectiveEncounter.priority is not null implies ElectiveEncounter.priority ~ "Elective (qualifier value)"
          and AgeInYearsAt(date from start of ElectiveEncounter.period) >= 18
          and not exists ( ["Encounter": "Emergency Department Visit"] EDVisit
              where EDVisit.status = 'finished'
                and EDVisit.period ends 1 hour or less before or on start of ElectiveEncounter.period
          )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Elective Inpatient Encounter With Age And Without Obstetrical Condition":
      "Elective Inpatient Encounter With Age 18 And Older Without ED Visit" ElectiveEncounter
        where not ( ElectiveEncounter.reasonCode in "Obstetrical Or Pregnancy Related Conditions"
            or ElectiveEncounter.encounterReason ( ).code in "Obstetrical Or Pregnancy Related Conditions"
        )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Elective Inpatient Encounter With OR Procedure Within 3 Days":
      "Elective Inpatient Encounter With Age And Without Obstetrical Condition" ElectiveEncounter
        with ["Procedure": "General And Neuraxial Anesthesia"] SurgeryWithAnesthesia
          such that SurgeryWithAnesthesia.status = 'completed'
            and SurgeryWithAnesthesia.performed.earliest ( ) during ElectiveEncounter.hospitalizationWithObservationAndOutpatientSurgeryService ( )
            and SurgeryWithAnesthesia.performed.earliest ( ) 3 days or less after start of ElectiveEncounter.hospitalizationWithObservationAndOutpatientSurgeryService ( )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Initial Population":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days"
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Respiratory Rate In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstRespiratoryRate: QualifyingEncounter.firstRespiratoryRate ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Albumin In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstAlbumin: QualifyingEncounter.firstAlbumin ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Arterial pH In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstArterialpH: QualifyingEncounter.firstArterialpH ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Body Temperature In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstBodyTemp: QualifyingEncounter.firstBodyTemperature ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Carbon Dioxide In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstCarbonDioxide: QualifyingEncounter.firstCarbonDioxide ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Hematocrit In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstHematocrit: QualifyingEncounter.firstHematocrit ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Heart Rate In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstHeartRate: QualifyingEncounter.firstHeartRate ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First BMI":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstBMI: QualifyingEncounter.firstBMI ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Hemoglobin In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstHemoglobin: QualifyingEncounter.firstHemoglobin ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable All Encounter Diagnoses With POA Indication":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          diagnoses: QualifyingEncounter.claimDiagnosesWithPOA ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Sodium In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstSodium: QualifyingEncounter.firstSodium ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "SDE Payer":
      SDE."SDE Payer"
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Creatinine In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstCreatinine: QualifyingEncounter.firstCreatinine ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First White Blood Cell Count In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstWBCcount: QualifyingEncounter.firstWhiteBloodCellCount ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable ASA Physical Status Class":
      ["ObservationScreeningAssessment": "American society of anesthesiologists morbidity state"] ASAclass
        with "Initial Population" QualifyingEncounter
          such that ASAclass.status in { 'final', 'amended', 'corrected' }
            and ASAclass.startsDuringHospitalization ( QualifyingEncounter )
            and ASAclass.value as Concept in "ASA Physical Status Class"
        return ASAclass.value as Concept
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable Principal Procedure":
      from
        ["Procedure"] TheProcedure,
        "Initial Population" QualifyingEncounter
        where TheProcedure.status = 'completed'
          and TheProcedure.rank ( QualifyingEncounter ) is not null
          and TheProcedure.startsDuringHospitalization ( QualifyingEncounter )
        return Tuple {
          encounterId: QualifyingEncounter.id,
          procedureId: TheProcedure.id,
          procedureCode: TheProcedure.code,
          procedureRank: TheProcedure.rank ( QualifyingEncounter ),
          procedureTime: TheProcedure.performed.toInterval ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable Body Mass Index (BMI)":
      ["USCoreBMIProfile"] BMI
        with "Initial Population" InpatientEncounter
          such that BMI.effective.toInterval ( ) starts during InpatientEncounter.hospitalizationWithObservation ( )
            and BMI.value is not null
            and BMI.status in { 'final', 'amended', 'corrected' }
        return BMI.value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Bicarbonate In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstBicarbonate: QualifyingEncounter.firstBicarbonate ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Bilirubin In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstBilirubin: QualifyingEncounter.firstBilirubin ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Qualifying Systolic Blood Pressure Reading":
      ["USCoreBloodPressureProfile"] BloodPressure
        where BloodPressure.effective.earliest ( ) during day of "Measurement Period"
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Systolic Blood Pressure In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstSystolic: QualifyingEncounter.firstSystolicBloodPressure ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Oxygen In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstOxygen: QualifyingEncounter.firstOxygen ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Leukocyte Count In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstLeukocyte: QualifyingEncounter.firstLeukocyte ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "SDE Race":
      SDE."SDE Race"
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "SDE Sex":
      SDE."SDE Sex"
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Anesthesia Procedure List":
      ["Procedure": "General And Neuraxial Anesthesia"] AnesthesiaProcedures
        where AnesthesiaProcedures.performed.latest ( ) during day of "Measurement Period"
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "General Anesthesia And MAC":
      ["Procedure": "Anesthesia Requiring Monitored Care"] MAC
        union ["Procedure": "General And Neuraxial Anesthesia"]
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Intubation During General Anesthesia And MAC":
      from
        "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery,
        ["Procedure": "Intubation"] ProceduralIntubation,
        "General Anesthesia And MAC" Anesthesia
        where ProceduralIntubation.status = 'completed'
          and ProceduralIntubation.startsDuringHospitalization ( EncounterWithSurgery )
          and ProceduralIntubation.performed.toInterval ( ) starts during Anesthesia.performed.toInterval ( )
        return ProceduralIntubation
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With Intubation Outside Of Procedural Area Within 30 Days Of End Of First OR Procedure":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery
        with ["Procedure": "Intubation"] EndotrachealTubeIn
          such that EndotrachealTubeIn.status = 'completed'
            and EndotrachealTubeIn.starts30DaysOrLessAfterFirstAnesthesia ( EncounterWithSurgery )
            and EndotrachealTubeIn.startsDuringHospitalization ( EncounterWithSurgery )
            and EndotrachealTubeIn.performed.toInterval ( ) starts after end of EndotrachealTubeIn.latestGeneralAnesthesiaOrMAC ( ).performed.toInterval ( )
            and EncounterWithSurgery.isNotAtProceduralHospitalLocationDuring ( EndotrachealTubeIn.performed.toInterval ( ) )
            and not ( "Intubation During General Anesthesia And MAC".id contains EndotrachealTubeIn.id )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Noninvasive Oxygen Therapy":
      ( ["Procedure": "Non Invasive Oxygen Therapy By Nasal Cannula Or Mask"] P
          where P.status = 'completed'
      )
        union ( ["LaboratoryResultObservation": "Non Invasive Oxygen Therapy"] O
            where O.status in { 'final', 'amended', 'corrected' }
        )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With Mechanical Ventilation Outside Of Procedural Area Within 30 Days Of End Of First OR Procedure And Preceded By Non Invasive Oxygen Therapy":
      from
        "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery,
        ["Procedure": "Mechanical Ventilation"] Ventilation,
        "Noninvasive Oxygen Therapy" OxygenSupport
        let VentilationInterval: Ventilation.performed.toInterval ( ),
        LatestAnesthesiaInterval: Ventilation.latestGeneralAnesthesiaOrMAC ( ).performed.toInterval ( )
        where Ventilation.status = 'completed'
          and Ventilation.starts30DaysOrLessAfterFirstAnesthesia ( EncounterWithSurgery )
          and Ventilation.startsDuringHospitalization ( EncounterWithSurgery )
          and VentilationInterval starts after end of LatestAnesthesiaInterval
          and OxygenSupport.interval ( ) starts during Interval[end of LatestAnesthesiaInterval, start of VentilationInterval]
          and EncounterWithSurgery.isNotAtProceduralHospitalLocationDuring ( VentilationInterval )
        return EncounterWithSurgery
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Extubation With Preceding Noninvasive Oxygen":
      from
        "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery,
        ["Procedure": "Removal of endotracheal tube (procedure)"] Extubation,
        "Noninvasive Oxygen Therapy" OxygenSupport
        let LatestAnesthesia: Extubation.latestGeneralAnesthesiaOrMAC ( )
        where Extubation.status = 'completed'
          and Extubation.startsDuringHospitalization ( EncounterWithSurgery )
          and Extubation.performed.toInterval ( ) starts after LatestAnesthesia.performed.toInterval ( )
          and OxygenSupport.interval ( ) starts during Interval[end of LatestAnesthesia.performed.toInterval ( ), start of Extubation.performed.toInterval ( )]
        return Extubation
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Extubation During General Anesthesia":
      from
        "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery,
        ["Procedure": "Removal of endotracheal tube (procedure)"] Extubation,
        "General Anesthesia And MAC" Anesthesia
        where Extubation.status = 'completed'
          and Extubation.startsDuringHospitalization ( EncounterWithSurgery )
          and Extubation.performed.toInterval ( ) starts during Anesthesia.performed.toInterval ( )
        return Extubation
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With Extubation Outside Of Procedural Area Within 30 Days Of End Of First OR Procedure More Than 48 Hours After End Of Anesthesia":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery
        with ["Procedure": "Removal of endotracheal tube (procedure)"] Extubation
          such that Extubation.status = 'completed'
            and Extubation.isDuringHospitalization ( EncounterWithSurgery )
            and Extubation.starts30DaysOrLessAfterFirstAnesthesia ( EncounterWithSurgery )
            and Extubation.performed.toInterval ( ) starts more than 48 hours after end of Extubation.latestGeneralAnesthesiaOrMAC ( ).performed.toInterval ( )
            and not ( ( "Extubation With Preceding Noninvasive Oxygen".id contains Extubation.id )
                and not ( "Extubation During General Anesthesia".id contains Extubation.id )
            )
            and EncounterWithSurgery.isNotAtProceduralHospitalLocation ( )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With Mechanical Ventilation Within 30 Days Of End Of First OR Procedure And Between 48 And 72 Hours After End Of OR Procedure And Not Preceded By Non Invasive Oxygen Therapy Or Anesthesia":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery
        with ["Procedure": "Mechanical Ventilation"] Ventilation
          such that Ventilation.status = 'completed'
            and Ventilation.performed.toInterval ( ) starts 48 hours or more after end of Ventilation.latestGeneralAnesthesiaOrMAC ( ).performed.toInterval ( )
            and Ventilation.performed.toInterval ( ) starts 72 hours or less after end of Ventilation.latestGeneralAnesthesiaOrMAC ( ).performed.toInterval ( )
            and Ventilation.starts30DaysOrLessAfterFirstAnesthesia ( EncounterWithSurgery )
            and Ventilation.startsDuringHospitalization ( EncounterWithSurgery )
            and not ( "Encounter With Mechanical Ventilation Outside Of Procedural Area Within 30 Days Of End Of First OR Procedure And Preceded By Non Invasive Oxygen Therapy".id contains EncounterWithSurgery.id )
            and EncounterWithSurgery.isNotAtProceduralHospitalLocation ( )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Numerator":
      "Encounter With Intubation Outside Of Procedural Area Within 30 Days Of End Of First OR Procedure"
        union "Encounter With Mechanical Ventilation Outside Of Procedural Area Within 30 Days Of End Of First OR Procedure And Preceded By Non Invasive Oxygen Therapy"
        union "Encounter With Extubation Outside Of Procedural Area Within 30 Days Of End Of First OR Procedure More Than 48 Hours After End Of Anesthesia"
        union "Encounter With Mechanical Ventilation Within 30 Days Of End Of First OR Procedure And Between 48 And 72 Hours After End Of OR Procedure And Not Preceded By Non Invasive Oxygen Therapy Or Anesthesia"
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Denominator":
      "Initial Population"
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable Encounter Procedures":
      from
        ["Procedure"] TheProcedure,
        "Initial Population" QualifyingEncounter
        where TheProcedure.status = 'completed'
          and TheProcedure.startsDuringHospitalization ( QualifyingEncounter )
        return {
          encounterId: QualifyingEncounter.id,
          procedureId: TheProcedure.id,
          procedureCode: TheProcedure.code,
          procedureRank: TheProcedure.rank ( QualifyingEncounter ),
          procedureTime: TheProcedure.performed.toInterval ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Blood Urea Nitrogen In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstBUN: QualifyingEncounter.firstBloodUreaNitrogen ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "SDE Ethnicity":
      SDE."SDE Ethnicity"
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With Degenerative Neurological Disorder":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery
        where EncounterWithSurgery.reasonCode in "Degenerative Neurological Disorder"
          or EncounterWithSurgery.encounterReason ( ).code in "Degenerative Neurological Disorder"
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With High Risk To Airway Head Neck And Thoracic Surgery":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery
        with ["Procedure": "Head, Neck, And Thoracic Surgeries With High Risk Airway Compromise"] HeadNeckProcedures
          such that HeadNeckProcedures.status = 'completed'
            and HeadNeckProcedures.startsDuringHospitalization ( EncounterWithSurgery )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With Mechanical Ventilation That Starts More Than One Hour Prior To Start Of First OR Procedure":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery
        with ["Procedure": "Mechanical Ventilation"] Ventilation
          such that Ventilation.status = 'completed'
            and Ventilation.performed.toInterval ( ) starts more than 1 hour before start of EncounterWithSurgery.firstAnesthesiaDuringHospitalization ( ).performed.toInterval ( )
            and Ventilation.startsDuringHospitalization ( EncounterWithSurgery )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With Neuromuscular Disorder":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery
        where EncounterWithSurgery.reasonCode in "Neuromuscular Disorder"
          or EncounterWithSurgery.encounterReason ( ).code in "Neuromuscular Disorder"
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With PaCO2 Greater Than 50 And Arterial pH Less Than 7.30 Within 48 Hours Prior To Start Of First OR Procedure":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery
        let FirstProcedureTime: EncounterWithSurgery.firstAnesthesiaDuringHospitalization ( ).performed.toInterval ( )
        with ["LaboratoryResultObservation": "Carbon Dioxide Partial Pressure In Arterial Blood"] CarbonDioxide
          such that CarbonDioxide.status in { 'final', 'amended', 'corrected' }
            and CarbonDioxide.effective.toInterval ( ) starts 48 hours or less before start of FirstProcedureTime
            and CarbonDioxide.value as Quantity > 50 'mm[Hg]'
        with ["LaboratoryResultObservation": "Arterial Blood pH"] BloodpH
          such that BloodpH.status in { 'final', 'amended', 'corrected' }
            and BloodpH.effective.toInterval ( ) starts 48 hours or less before start of FirstProcedureTime
            and BloodpH.value as Quantity < 7.30 '[pH]'
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With PaO2 Less Than 50 Within 48 Hours Prior To Start Of First OR Procedure":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery
        let FirstProcedure: EncounterWithSurgery.firstAnesthesiaDuringHospitalization ( )
        with ["LaboratoryResultObservation": "Oxygen Partial Pressure In Arterial Blood"] Oxygen
          such that Oxygen.status in { 'final', 'amended', 'corrected' }
            and Oxygen.effective.toInterval ( ) starts 48 hours or less before start of FirstProcedure.performed.toInterval ( )
            and Oxygen.value as Quantity < 50 'mm[Hg]'
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With Principal Diagnosis Of Acute Respiratory Failure":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery
        where EncounterWithSurgery.hasPrincipalDiagnosisOf ( "Acute Respiratory Failure" )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With Diagnosis Of Acute Respiratory Failure Present On Admission":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery
        where EncounterWithSurgery.isDiagnosisPresentOnAdmission ( "Acute Respiratory Failure", "Present On Admission Or Clinically Undetermined" )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With Tracheostomy Present On Admission":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery
        where EncounterWithSurgery.isDiagnosisPresentOnAdmission ( "Tracheostomy Diagnoses", "Present On Admission Or Clinically Undetermined" )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With Tracheostomy Before Day Of First OR Procedure":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery
        let FirstProcedure: EncounterWithSurgery.firstAnesthesiaDuringHospitalization ( )
        with ["Procedure": "Tracheostomy Procedures"] TracheostomySurgery
          such that TracheostomySurgery.status = 'completed'
            and TracheostomySurgery.startsDuringHospitalization ( EncounterWithSurgery )
            and TracheostomySurgery.performed.toInterval ( ) starts before day of FirstProcedure.performed.toInterval ( )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With Tracheostomy Same Day Of First OR Procedure":
      "Elective Inpatient Encounter With OR Procedure Within 3 Days" EncounterWithSurgery
        let FirstProcedure: EncounterWithSurgery.firstAnesthesiaDuringHospitalization ( )
        with ["Procedure": "Tracheostomy Procedures"] TracheostomySurgery
          such that TracheostomySurgery.status = 'completed'
            and TracheostomySurgery.startsDuringHospitalization ( EncounterWithSurgery )
            and TracheostomySurgery.performed.toInterval ( ) starts during day of FirstProcedure.performed.toInterval ( )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Encounter With Tracheostomy Prior To Or On The Same Day Of First OR Procedure":
      "Encounter With Tracheostomy Before Day Of First OR Procedure"
        union "Encounter With Tracheostomy Same Day Of First OR Procedure"
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Denominator Exclusions":
      "Encounter With Degenerative Neurological Disorder"
        union "Encounter With High Risk To Airway Head Neck And Thoracic Surgery"
        union "Encounter With Mechanical Ventilation That Starts More Than One Hour Prior To Start Of First OR Procedure"
        union "Encounter With Neuromuscular Disorder"
        union "Encounter With PaCO2 Greater Than 50 And Arterial pH Less Than 7.30 Within 48 Hours Prior To Start Of First OR Procedure"
        union "Encounter With PaO2 Less Than 50 Within 48 Hours Prior To Start Of First OR Procedure"
        union "Encounter With Principal Diagnosis Of Acute Respiratory Failure"
        union "Encounter With Diagnosis Of Acute Respiratory Failure Present On Admission"
        union "Encounter With Tracheostomy Present On Admission"
        union "Encounter With Tracheostomy Prior To Or On The Same Day Of First OR Procedure"
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First AST In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstAST: QualifyingEncounter.firstAST ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define "Risk Variable First Platelet Count In Encounter":
      "Initial Population" QualifyingEncounter
        return Tuple {
          encounterId: QualifyingEncounter.id,
          firstPlatelet: QualifyingEncounter.firstPlatelet ( )
        }
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function encounterReason(Encounter Encounter):
      Encounter.reasonReference D
        return singleton from ( ( [ConditionEncounterDiagnosis] cA
            union [ConditionProblemsHealthConcerns] cB ) C
            where D.references ( C.id )
        )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstRespiratoryRate(QualifyingEncounter Encounter):
      First([USCoreRespiratoryRateProfile: "Respiratory rate"] FirstRespiration
          where FirstRespiration.status in { 'final', 'amended', 'corrected' }
            and FirstRespiration.effective.earliest() during QualifyingEncounter.hospitalizationWithObservation()
            and FirstRespiration.value is not null
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstAlbumin(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "Albumin Lab Test"] FirstAlbuminTest
          where FirstAlbuminTest.status in { 'final', 'amended', 'corrected' }
            and FirstAlbuminTest.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function isEarliestDuringHospitalization(choice Choice<Procedure, LaboratoryResultObservation>, encounter Encounter):
      case
        when choice is Procedure then ( choice as Procedure ).earliestIsDuringHospitalization ( encounter )
        when choice is LaboratoryResultObservation then ( choice as LaboratoryResultObservation ).earliestOccursDuringHospitalization ( encounter )
        else false end
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function earliestIsDuringHospitalization(procedure Procedure, encounter Encounter):
      procedure.performed.earliest ( ) during encounter.hospitalizationWithObservationAndOutpatientSurgeryService ( )
        and procedure.partOf is not null
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function earliestOccursDuringHospitalization(observation LaboratoryResultObservation, encounter Encounter):
      observation.effective.earliest ( ) during encounter.hospitalizationWithObservationAndOutpatientSurgeryService ( )
        and observation.value is not null
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstArterialpH(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "Arterial Blood pH"] FirstArterialpHTest
          where FirstArterialpHTest.status in { 'final', 'amended', 'corrected' }
            and FirstArterialpHTest.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstBodyTemperature(QualifyingEncounter Encounter):
      First(["USCoreBodyTemperatureProfile": "Body temperature"] FirstTemperature
          where FirstTemperature.status in { 'final', 'amended', 'corrected' }
            and FirstTemperature.effective.earliest() during QualifyingEncounter.hospitalizationWithObservation()
            and FirstTemperature.value is not null
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstCarbonDioxide(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "Carbon Dioxide Partial Pressure In Arterial Blood"] FirstCarbonDioxideTest
          where FirstCarbonDioxideTest.status in { 'final', 'amended', 'corrected' }
            and FirstCarbonDioxideTest.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstHematocrit(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "Hematocrit Lab Test"] FirstHematocritTest
          where FirstHematocritTest.status in { 'final', 'amended', 'corrected' }
            and FirstHematocritTest.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstHeartRate(QualifyingEncounter Encounter):
      First(["USCoreHeartRateProfile": "Heart rate"] FirstHeartBeats
          where FirstHeartBeats.status in { 'final', 'amended', 'corrected' }
            and FirstHeartBeats.effective.earliest() during QualifyingEncounter.hospitalizationWithObservation()
            and FirstHeartBeats.value is not null
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstBMI(QualifyingEncounter Encounter):
      First([USCoreBMIProfile] FirstBodyMass
          where FirstBodyMass.status in { 'final', 'amended', 'corrected' }
            and FirstBodyMass.effective.toInterval() starts during QualifyingEncounter.hospitalizationWithObservation()
            and FirstBodyMass.value is not null
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstHemoglobin(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "Hemoglobin Lab Test"] FirstHemoglobinTest
          where FirstHemoglobinTest.status in { 'final', 'amended', 'corrected' }
            and FirstHemoglobinTest.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function claimDiagnosesWithPOA(encounter Encounter):
      encounter E
        let claim: ( [Claim] C
            where C.status = 'active'
              and C.use = 'claim'
              and exists ( C.item I
                  where I.encounter.references ( E )
              )
        ),
        claimItem: ( claim.item I
            where I.encounter.references ( E )
        )
        return claim.diagnosis D
          where D.sequence in claimItem.diagnosisSequence
            and D.onAdmission is not null
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstSodium(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "Sodium Lab Test"] FirstSodiumTest
          where FirstSodiumTest.status in { 'final', 'amended', 'corrected' }
            and FirstSodiumTest.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstCreatinine(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "Creatinine Lab Test"] FirstCreatinineTest
          where FirstCreatinineTest.status in { 'final', 'amended', 'corrected' }
            and FirstCreatinineTest.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstWhiteBloodCellCount(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "White Blood Cells Count Lab Test"] FirstWBCCount
          where FirstWBCCount.status in { 'final', 'amended', 'corrected' }
            and FirstWBCCount.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function startsDuringHospitalization(choice Choice<Procedure, LaboratoryResultObservation, ObservationScreeningAssessment>, enc Encounter):
      case
        when choice is Procedure then ( choice as Procedure ).performed.toInterval ( ) starts during enc.hospitalizationWithObservationAndOutpatientSurgeryService ( )
        when choice is LaboratoryResultObservation then ( choice as LaboratoryResultObservation ).effective.toInterval ( ) starts during enc.hospitalizationWithObservationAndOutpatientSurgeryService ( )
        when choice is ObservationScreeningAssessment then ( choice as ObservationScreeningAssessment ).effective.toInterval ( ) starts during enc.hospitalizationWithObservationAndOutpatientSurgeryService ( )
        else false end
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function rank(targetProcedure Procedure, parentEncounter Encounter):
      singleton from ( targetProcedure P
          let claim: ( [Claim] C
              where C.status = 'active'
                and C.use = 'claim'
                and exists ( C.item I
                    where I.encounter.references ( parentEncounter )
                )
          ),
          claimProc: ( claim.procedure proc
              where proc.procedure.references ( P )
          )
          return claimProc.sequence R
      )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstBicarbonate(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "Bicarbonate Lab Test"] FirstBicarbonateTest
          where FirstBicarbonateTest.status in { 'final', 'amended', 'corrected' }
            and FirstBicarbonateTest.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstBilirubin(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "Bilirubin Lab Test"] FirstBilirubinTest
          where FirstBilirubinTest.status in { 'final', 'amended', 'corrected' }
            and FirstBilirubinTest.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function "firstSystolicBloodPressure"(QualifyingEncounter Encounter):
      First("Qualifying Systolic Blood Pressure Reading" SBPReading
          where SBPReading.status in { 'final', 'amended', 'corrected' }
            and SBPReading.effective.earliest() during QualifyingEncounter.hospitalizationWithObservation()
          return singleton from(SBPReading.component SBPComponent
              where SBPComponent.code ~ "Systolic blood pressure"
              return SBPComponent.value as Quantity
          )
      )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstOxygen(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "Oxygen Partial Pressure In Arterial Blood"] FirstOxygenTest
          where FirstOxygenTest.status in { 'final', 'amended', 'corrected' }
            and FirstOxygenTest.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstLeukocyte(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "Leukocyte Count Lab Test"] FirstLeukocyteCount
          where FirstLeukocyteCount.status in { 'final', 'amended', 'corrected' }
            and FirstLeukocyteCount.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function starts30DaysOrLessAfterFirstAnesthesia(procedure Procedure, encounter Encounter):
      procedure.performed.toInterval ( ) starts 30 days or less after end of encounter.firstAnesthesiaDuringHospitalization ( ).performed.toInterval ( )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function "firstAnesthesiaDuringHospitalization"(QualifyingEncounter Encounter):
      First("Anesthesia Procedure List" anesthesia
          where anesthesia.status = 'completed'
            and anesthesia.startsDuringHospitalization(QualifyingEncounter)
          sort by start of performed.toInterval()
      )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function latestGeneralAnesthesiaOrMAC(event Procedure):
      Last("General Anesthesia And MAC" ProcedureList
          where ProcedureList.status = 'completed'
            and ProcedureList.performed.toInterval() ends before start of event.performed.toInterval()
          sort by start of performed.toInterval()
      )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function isNotAtProceduralHospitalLocationDuring(encounter Encounter, intrvl Interval<DateTime>):
      not exists ( encounter.location EncounterLocation
          with [Location] Location
            such that EncounterLocation.location.references ( Location )
              and Location.type.includesCode ( "ER" )
              and EncounterLocation.period starts during intrvl
      )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function isDuringHospitalization(choice Choice<Procedure, LaboratoryResultObservation>, enc Encounter):
      case
        when choice is Procedure then ( choice as Procedure ).performed.toInterval ( ) during enc.hospitalizationWithObservationAndOutpatientSurgeryService ( )
        when choice is LaboratoryResultObservation then ( choice as LaboratoryResultObservation ).effective.toInterval ( ) during enc.hospitalizationWithObservationAndOutpatientSurgeryService ( )
        else false end
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function isNotAtProceduralHospitalLocation(encounter Encounter):
      not exists ( encounter.location EncounterLocation
          with [Location] Location
            such that EncounterLocation.location.references ( Location )
              and Location.type.includesCode ( "ER" )
      )
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstBloodUreaNitrogen(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "Blood Urea Nitrogen Lab Test"] FirstBUN
          where FirstBUN.status in { 'final', 'amended', 'corrected' }
            and FirstBUN.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstAST(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "Aspartate transaminase Lab Test"] FirstASTTest
          where FirstASTTest.status in { 'final', 'amended', 'corrected' }
            and FirstASTTest.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Logic Definition | Library Name: CMS1218FHIRHHRF
    define fluent function firstPlatelet(QualifyingEncounter Encounter):
      First([LaboratoryResultObservation: "Platelet Count Lab Test"] FirstPlateletCount
          where FirstPlateletCount.status in { 'final', 'amended', 'corrected' }
            and FirstPlateletCount.isEarliestDuringHospitalization(QualifyingEncounter)
          sort by effective.earliest()
      ).value as Quantity
Terminology
Code System | Description: Code system SNOMEDCT Resource: http://snomed.info/sct Canonical URL: `http://snomed.info/sct`
Code System | Description: Code system LOINC Resource: http://loinc.org Canonical URL: `http://loinc.org`
Code System | Description: Code system LocationRoles Resource: http://terminology.hl7.org/CodeSystem/v3-RoleCode Canonical URL: `http://terminology.hl7.org/CodeSystem/v3-RoleCode`
Code System | Description: Code system Diagnosis Type Resource: http://terminology.hl7.org/CodeSystem/ex-diagnosistype Canonical URL: `http://terminology.hl7.org/CodeSystem/ex-diagnosistype`
Value Set | Description: Value set Elective Inpatient Encounter Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.85 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.85`
Value Set | Description: Value set Emergency Department Visit Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292`
Value Set | Description: Value set Obstetrical Or Pregnancy Related Conditions Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.263 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.263`
Value Set | Description: Value set General And Neuraxial Anesthesia Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.208 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.208`
Value Set | Description: Value set Observation Services Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143`
Value Set | Description: Value set Outpatient Surgery Service Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.38 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.38`
Value Set | Description: Value set Albumin Lab Test Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.221 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.221`
Value Set | Description: Value set Arterial Blood pH Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.96 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.96`
Value Set | Description: Value set Carbon Dioxide Partial Pressure In Arterial Blood Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.95 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.95`
Value Set | Description: Value set Hematocrit Lab Test Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.114 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.114`
Value Set | Description: Value set Hemoglobin Lab Test Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.219 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.219`
Value Set | Description: Value set Sodium Lab Test Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.119 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.119`
Value Set | Description: Value set Payer Type Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591`
Value Set | Description: Value set Creatinine Lab Test Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.2363 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.2363`
Value Set | Description: Value set White Blood Cells Count Lab Test Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.129 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.129`
Value Set | Description: Value set ASA Physical Status Class Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.217 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.217`
Value Set | Description: Value set Bicarbonate Lab Test Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.139 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.139`
Value Set | Description: Value set Bilirubin Lab Test Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.223 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.223`
Value Set | Description: Value set Oxygen Partial Pressure In Arterial Blood Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.94 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.94`
Value Set | Description: Value set Leukocyte Count Lab Test Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.222 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.222`
Value Set | Description: Value set Intubation Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.179 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.179`
Value Set | Description: Value set Anesthesia Requiring Monitored Care Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.255 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.255`
Value Set | Description: Value set Mechanical Ventilation Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.107 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.107`
Value Set | Description: Value set Non Invasive Oxygen Therapy By Nasal Cannula Or Mask Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.209 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.209`
Value Set | Description: Value set Non Invasive Oxygen Therapy Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.213 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.213`
Value Set | Description: Value set Blood Urea Nitrogen Lab Test Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.218 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.218`
Value Set | Description: Value set Degenerative Neurological Disorder Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.241 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.241`
Value Set | Description: Value set Head, Neck, And Thoracic Surgeries With High Risk Airway Compromise Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.251 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.251`
Value Set | Description: Value set Neuromuscular Disorder Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.239 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.239`
Value Set | Description: Value set Acute Respiratory Failure Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.88 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.88`
Value Set | Description: Value set Present On Admission Or Clinically Undetermined Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1147.197 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1147.197`
Value Set | Description: Value set Tracheostomy Diagnoses Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.89 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.89`
Value Set | Description: Value set Tracheostomy Procedures Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.181 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.181`
Value Set | Description: Value set Aspartate transaminase Lab Test Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.224 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.224`
Value Set | Description: Value set Platelet Count Lab Test Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.127 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.127`
Direct Reference Code | Display: Elective (qualifier value) Code: 103390000 System: `http://snomed.info/sct`
Direct Reference Code | Display: Respiratory rate Code: 9279-1 System: `http://loinc.org`
Direct Reference Code | Display: Body temperature Code: 8310-5 System: `http://loinc.org`
Direct Reference Code | Display: Heart rate Code: 8867-4 System: `http://loinc.org`
Direct Reference Code | Display: American society of anesthesiologists morbidity state Code: 97816-3 System: `http://loinc.org`
Direct Reference Code | Display: Systolic blood pressure Code: 8480-6 System: `http://loinc.org`
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: Emergency room Code: ER System: `http://terminology.hl7.org/CodeSystem/v3-RoleCode`
Direct Reference Code | Display: Removal of endotracheal tube (procedure) Code: 271280005 System: `http://snomed.info/sct`
Direct Reference Code | Display: Principal Diagnosis Code: principal System: `http://terminology.hl7.org/CodeSystem/ex-diagnosistype`
Dependencies
Dependency | Description: QICore model information Resource: http://hl7.org/fhir/Library/QICore-ModelInfo Canonical URL: `http://hl7.org/fhir/Library/QICore-ModelInfo`
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`
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, period, id, id.value, location, reasonCode, diagnosis, diagnosis.code, onAdmission Code Filter(s): Path: type ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.38
Data Requirement | Type: Encounter Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter Must Support Elements: type, status, status.value, period, priority, id, id.value, location, reasonCode, diagnosis, diagnosis.code, onAdmission Code Filter(s): Path: type ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.85
Data Requirement | Type: Encounter Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter Must Support Elements: type, status, status.value, period, id, id.value, location, reasonCode, diagnosis, diagnosis.code, onAdmission 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, id, id.value, location, reasonCode, diagnosis, diagnosis.code, onAdmission 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: Condition Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis
Data Requirement | Type: Condition Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: code, status, status.value, performed, id, id.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.255
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: code, status, status.value, performed, id, id.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.208
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: code, status, status.value, performed, id, id.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.179
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: code, status, status.value, performed, id, id.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.209
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: code, status, status.value, performed, id, id.value Code Filter(s): Path: code Code(s): http://snomed.info/sct#271280005: 'Removal of endotracheal tube (procedure)'
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: code, status, status.value, performed, id, id.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.251
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: code, performed, status, status.value, id, id.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.107
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: performed, status, status.value, id, id.value, partOf, code
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: code, status, status.value, performed, id, id.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.181
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/core/StructureDefinition/us-core-respiratory-rate Must Support Elements: code, status, status.value, effective, value Code Filter(s): Path: code Code(s): http://loinc.org#9279-1: 'Respiratory rate'
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/core/StructureDefinition/us-core-respiratory-rate Must Support Elements: value
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1248.221
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1045.114
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1248.219
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1045.119
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab Must Support Elements: code, status, status.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.2363
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1045.129
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1045.139
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1248.223
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1248.222
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1248.213
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1248.218
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1248.95
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1248.96
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1248.94
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1248.224
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab 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.1045.127
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab Must Support Elements: effective, value
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-temperature Must Support Elements: code, status, status.value, effective, value Code Filter(s): Path: code Code(s): http://loinc.org#8310-5: 'Body temperature'
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/core/StructureDefinition/us-core-body-temperature Must Support Elements: value
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/core/StructureDefinition/us-core-heart-rate Must Support Elements: code, status, status.value, effective, value Code Filter(s): Path: code Code(s): http://loinc.org#8867-4: 'Heart rate'
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/core/StructureDefinition/us-core-heart-rate Must Support Elements: value
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/core/StructureDefinition/us-core-bmi Must Support Elements: status, status.value, effective, value
Data Requirement | Type: Resource Profile(s): http://hl7.org/fhir/StructureDefinition/Resource Must Support Elements: id, id.value
Data Requirement | Type: Claim Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-claim Must Support Elements: status, status.value, use, use.value, item
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
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment Must Support Elements: effective
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-screening-assessment Must Support Elements: code, status, status.value, value Code Filter(s): Path: code Code(s): http://loinc.org#97816-3: 'American society of anesthesiologists morbidity state'
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/core/StructureDefinition/us-core-blood-pressure Must Support Elements: effective, status, status.value, component
Data Requirement | Type: Location Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-location Must Support Elements: type
Generated using version 0.4.8 of the sample-content-ig Liquid templates