eCQM QICore Content Implementation Guide
2024.0.0 - CI Build

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

Measure: Severe Obstetric ComplicationsFHIR (Experimental)

Official URL: https://madie.cms.gov/Measure/SevereObstetricComplicationsFHIR Version: 0.1.000
Draft as of 2024-07-09 Responsible: The Joint Commission Computable Name: SevereObstetricComplicationsFHIR
Other Identifiers: Short Name (use: usual, ), UUID:6cf03fe2-b962-4f83-ac37-26d7477183c7 (use: official, ), UUID:3efa7f95-1d8e-45fa-af68-023d3554e8c1 (use: official, ), Publisher (use: official, )

Copyright/Legal: Measure specifications are in the Public Domain.

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

Patients with severe obstetric complications that occur during the inpatient delivery hospitalization

UNKNOWN

Title: Severe Obstetric ComplicationsFHIR
Id: SevereObstetricComplicationsFHIR
Version: 0.1.000
Url: Severe Obstetric ComplicationsFHIR
short-name identifier:

CMS1028FHIR

version-independent identifier:

urn:uuid:6cf03fe2-b962-4f83-ac37-26d7477183c7

version-specific identifier:

urn:uuid:3efa7f95-1d8e-45fa-af68-023d3554e8c1

publisher (CMS) identifier:

1028FHIR

Effective Period: 2025-01-01..2025-12-31
Status: draft
Experimental: true
Publisher: The Joint Commission
Author: The Joint Commission, Centers for Medicare & Medicaid Services (CMS), Yale New Haven Health Service Corporation/ Center for Outcomes Research and Evaluation
Description:

Patients with severe obstetric complications that occur during the inpatient delivery hospitalization

Purpose:

UNKNOWN

Copyright:

Measure specifications are in the Public Domain.

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

Disclaimer:

These performance measures are not clinical guidelines and do not establish a standard of medical care, and have not been tested for all potential applications. The measures and specifications are provided without warranty.

Scoring:

Proportion

Rationale:

The United States (US) experiences higher rates of maternal morbidity and mortality than most other developed countries. These rates have continued to trend upward in recent decades (CDC, 2021). Research indicates that the overall rate of severe maternal morbidity (SMM) increased by almost 200% between 1993 and 2014 to 144 per 10,000 delivery hospitalizations (CDC, 2021), with more than 25,000 women per year experiencing obstetric complications (U.S. Department of Health and Human Services, 2020). Recent maternal mortality data from 2018 reveal that 658 women in the US died from maternal causes, resulting in a rate of 17.4 deaths per 100,000 live births, with 77% of the deaths attributed to direct obstetric causes like hemorrhage, preeclampsia, obstetric embolism, and other complications (Hoyert & Minino, 2018). 144 per 10,000 women hospitalized for delivery have experienced SMM, including hemorrhage, embolism, hypertension, stroke, and other serious complications (CDC, 2021). Racial and ethnic disparities exist: Black women and Hispanic women are at a significantly higher risk for developing these complications than are Non-Hispanic White women (Leonard, Main, Scott, Profit, & Carmichael, 2019). Increasing rates of SMM are resulting in increased healthcare costs, longer hospitalization stays and impacts on a woman's health (Callaghan, Creanga, & Kuklina, 2012).

There is limited national evaluation of hospitals' performance on maternal morbidity and mortality although SMM is widely used at the population level. SMM is linked to maternal mortality, varies significantly among hospitals, and has significant racial/ethnic and urban/rural disparities. SMM is a cost driver for both Medicaid and commercial plans. This measure is important as it will assist in the discovery and understanding of SMM patterns that can lead to improvements in the safety and quality of maternal care necessary to reduce SMM rates.

Clinical recommendation statement:

Healthy People 2030 Measure (MICH-05): Reduce severe maternal complications identified during delivery hospitalizations (U.S. Department of Health and Human Services, n.d.).

The American College of Obstetricians and Gynecologists (ACOG) and the Society for Maternal-Fetal Medicine recommend identifying potential cases of severe maternal morbidity for further review, with a focus on outcomes and complications, and consider this an important step toward promoting safe obstetric care (American College of Obstetricians and Gynecologists and the Society for Maternal–Fetal Medicine, Kilpatrick, & Ecker, 2016).

Guidance (Usage): In the case of multiple births, map the first delivery date/time (Baby A) as the delivery date/time for the encounter. This measure allows for 3 approaches to determine gestational age (GA) in the following order of precedence: 1. The GA is calculated using the American College of Obstetricians and Gynecologists ReVITALize guidelines.* 2. The GA is obtained from a discrete field in the electronic health record. This option is only used when the calculated GA is not available. 3. The GA is based on ICD10 or SNOMED codes indicative of weeks gestation. This option is only used when results from items #1 and #2 (see above) are not available. Wherever gestational age is mentioned, relative to the delivery, the intent is to capture the last estimated gestational age prior to or at the time of delivery. *ACOG ReVITALize Guidelines for Calculating Gestational Age (ACOG, 2014): Gestational Age = (280-(Estimated Due Date minus Reference Date))/7 --Estimated Due Date (EDD): The best obstetrical EDD is determined by last menstrual period if confirmed by early ultrasound or no ultrasound performed, or early ultrasound if no known last menstrual period or the ultrasound is not consistent with last menstrual period, or known date of fertilization (e.g., assisted reproductive technology) --Reference Date is the date on which you are trying to determine gestational age. For purposes of this eCQM, Reference Date would be the Date of Delivery. Note however the calculation may yield a non-whole number and gestational age should be rounded down to the nearest completed week. For example, an infant born on the 5th day of the 36th week (35 weeks and 5/7 days) is at a gestational age of 35 weeks, not 36 weeks. Definition: For this measure, specifications are modeled after the nationally available and adopted CDC definition for Severe Maternal Morbidity (SMM) with the addition of maternal mortality. At times, we may refer to the CDC indicators of morbidity as SMM, but the outcome of the measure, which includes morbidity and mortality, is referred to as Severe Obstetric Complications (SOC). This eCQM is an episode-based measure. An episode is defined as each inpatient hospitalization or encounter that ends during the measurement period. This FHIR-based measure has been derived from the QDM-based measure CMS1028v3. Please refer to the HL7 QI-Core Implementation Guide (https://hl7.org/fhir/us/qicore/STU4.1.1/) for more information on QI-Core and mapping recommendations from QDM to QI-Core 4.1.1 (https://hl7.org/fhir/us/qicore/STU4.1.1/qdm-to-qicore.html).
Population Criteria: Stratifier Criteria:
64efa90856d636294b157c9a
Initial Population: Inpatient hospitalizations for patients age greater than or equal to 8 years and less than 65 admitted to the hospital for inpatient acute care who undergo a delivery procedure with a discharge date during the measurement period
Denominator: Inpatient hospitalizations for patients delivering stillborn or live birth with greater than or equal to 20 weeks, 0 days gestation completed
Denominator Exclusion: Inpatient hospitalizations for patients with confirmed diagnosis of COVID with COVID-related respiratory condition or patients with confirmed diagnosis of COVID with COVID-related respiratory procedure during the encounter
Numerator: Two numerator populations are defined for this measure: 1. All Severe Obstetric Complications (SOC). 2. SOC excluding encounters where transfusion was the only SOC. Inpatient hospitalizations for patients with severe obstetric complications (not present on admission that occur during the current delivery encounter) including the following: - Severe maternal morbidity diagnoses (see list below) - Severe maternal morbidity procedures (see list below) - Discharge disposition of expired Please note that present on admission codes may be extracted from billing/claims data that was entered by coding staff. Severe Maternal Morbidity Diagnoses: - Cardiac Acute heart failure Acute myocardial infarction Aortic aneurysm Cardiac arrest/ventricular fibrillation Heart failure/arrest during procedure or surgery - Hemorrhage Disseminated intravascular coagulation Shock - Renal Acute renal failure - Respiratory Adult respiratory distress syndrome Pulmonary edema - Sepsis - Other OB Air and thrombotic embolism Amniotic fluid embolism Eclampsia Severe anesthesia complications - Other Medical Puerperal cerebrovascular disorder Sickle cell disease with crisis Severe Maternal Morbidity Procedures: - Blood transfusion - Conversion of cardiac rhythm - Hysterectomy - Temporary tracheostomy - Ventilation
Numerator Exclusion: Inpatient hospitalizations with blood transfusion or hysterectomy with a diagnosis of placenta percreta or placenta increta and no additional severe obstetrical complications.
Stratum: This measure will be stratified by race/ethnicity and payer after measure submission.
658b2eadd4b024647cc00341
Initial Population: Inpatient hospitalizations for patients age >= 8 years and < 65 admitted to the hospital for inpatient acute care who undergo a delivery procedure with a discharge date that ends during the measurement period
Denominator: Inpatient hospitalizations for patients delivering stillborn or live birth with >= 20 weeks, 0 days gestation completed
Denominator Exclusion: Inpatient hospitalizations for patients with confirmed diagnosis of COVID with COVID-related respiratory condition or patients with confirmed diagnosis of COVID with COVID-related respiratory procedure during the encounter
Numerator: Inpatient hospitalizations for patients with severe obstetric complications (not present on admission that occur during the current delivery encounter) including severe maternal morbidity diagnoses (see following list), severe maternal morbidity procedures (see following list), and discharge disposition of expired, yet excluding encounters where transfusion was the only SOC. Please note that present on admission codes may be those entered by coding staff, extracted from billing/claims data. Severe Maternal Morbidity Diagnoses: - Cardiac Acute heart failure Acute myocardial infarction Aortic aneurysm Cardiac arrest/ventricular fibrillation Heart failure/arrest during procedure or surgery - Hemorrhage Disseminated intravascular coagulation Shock - Renal Acute renal failure - Respiratory Adult respiratory distress syndrome Pulmonary edema - Sepsis - Other OB Air and thrombotic embolism Amniotic fluid embolism Eclampsia Severe anesthesia complications - Other Medical Puerperal cerebrovascular disorder Sickle cell disease with crisis Severe Maternal Morbidity Procedures: - Blood transfusion - Conversion of cardiac rhythm - Hysterectomy - Temporary tracheostomy - Ventilation
Numerator Exclusion: Inpatient hospitalizations with blood transfusion or hysterectomy with a diagnosis of placenta percreta or placenta increta and no additional severe obstetrical complications.
Supplemental Data Elements:

SDE Ethnicity

SDE Payer

SDE Race

SDE Sex

SDE Variable Calculated Gestational Age

Risk Adjustment Variable:

Risk Variable Lab and Physical Exam Results

Risk Variable Asthma

Risk Variable Autoimmune Disease

Risk Variable Bariatric Surgery

Risk Variable Bleeding Disorder

Risk Variable Morbid Obesity

Risk Variable Cardiac Disease

Risk Variable Economic Housing Instability

Risk Variable Gastrointestinal Disease

Risk Variable Gestational Diabetes

Risk Variable HIV

Risk Variable Hypertension

Risk Variable Long Term Anticoagulant Use

Risk Variable Mental Health Disorder

Risk Variable Multiple Pregnancy

Risk Variable Neuromuscular

Risk Variable Obstetrical VTE

Risk Variable Placenta Previa

Risk Variable Placental Abruption

Risk Variable Placental Accreta Spectrum

Risk Variable Preexisting Diabetes

Risk Variable Previous Cesarean

Risk Variable Pulmonary Hypertension

Risk Variable Renal Disease

Risk Variable Severe Preeclampsia

Risk Variable Substance Abuse

Risk Variable Thyrotoxicosis

Risk Variable Other Preeclampsia

Risk Variable Preterm Birth

Risk Variable Anemia

Risk Variable Systolic Blood Pressure

Risk Variable Heart Rate

Risk Variable First White Blood Cell Count Lab Test

Risk Variable First Hematocrit Lab Test

Delivery Encounters with Blood Transfusion

Risk Variable Maternal Age

Supplemental Data Guidance : For every patient evaluated by this measure also identify payer, race, ethnicity, sex, variable calculated gestational age, SOC diagnosis details, and SOC procedure details
Risk Adjustment Variable Guidance : The Severe Obstetric Complications Risk Adjustment Methodology Report is available on the eCQI Resource Center (https://ecqi.healthit.gov). Pre-existing conditions and variables must be present on admission. Please note that present on admission codes may be extracted from billing/claims data that was entered by coding staff (Leonard, Kennedy, Carmichael, Lyell, & Main, 2020; Main, Leonard, & Menard, 2020). - Anemia (includes sickle cell disease) - Asthma - Autoimmune Disease - Bariatric Surgery - Bleeding Disorder - Cardiac Disease - Economic Housing Instability - Gastrointestinal Disease - Gestational Diabetes - HIV - Hypertension - Long-term Anticoagulant Use - Maternal Age (derived from birthdate) - Mental Health Disorder - Morbid Obesity - Multiple Pregnancy - Neuromuscular Disease - Obstetric VTE - Other Pre-eclampsia - Placenta Previa - Placental Abruption - Placental Accreta Spectrum - Pre-existing Diabetes - Preterm Birth - Previous Cesarean - Pulmonary Hypertension - Renal Disease - Severe Pre-eclampsia - Substance Abuse - Thyrotoxicosis Lab and Physical Exam Results: Report the first resulted value 24 hours prior to start of encounter and before time of delivery in UCUM units specified: - Heart rate: {beats}/min - Systolic blood pressure: mm[Hg] - Hematocrit: % - White blood cell count: 10*3/uL Note regarding submission of risk variable data: The risk variable definitions are included in the specifications and risk variable data should be sent with eCQM data in the QRDA1 file. Specific risk variable templates are not needed in the QRDA1 files.
Libraries:
SevereObstetricComplicationsFHIR
Terminology and Other Dependencies:
  • Library/PCMaternal|5.19.000
  • Library/CQMCommon|2.2.000
  • Library/FHIRHelpers|4.4.000
  • Library/QICoreCommon|2.1.000
  • Library/SupplementalDataElements|3.5.000
  • Logical Observation Identifiers, Names and Codes (LOINC)
  • AdministrativeGender
  • Encounter Inpatient
  • Delivery Procedures
  • Observation Services
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.369
  • Estimated Gestational Age at Delivery
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.67
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.63
  • Asthma
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.302
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.388
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.308
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.332
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.370
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.255
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.256
  • Patient Expired
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.213
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.358
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.357
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.359
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.360
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.299
  • Payer
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.305
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.373
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.376
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.379
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.290
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.275
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.317
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.78
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.287
  • White blood cells count lab test
  • Hematocrit lab test
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.327
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.323
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.341
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.366
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.320
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.335
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.338
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.281
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.296
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.329
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.292
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.272
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.314
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.363
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.311
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.278
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.269
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.284
  • Parameters:
    name use min max type
    Measurement Period In 0 1 Period
    Risk Variable Asthma Out 0 * Resource
    Risk Variable Placental Accreta Spectrum Out 0 * Resource
    Risk Variable Neuromuscular Out 0 * Resource
    Risk Variable Hypertension Out 0 * Resource
    SOC with Hysterectomy or Blood Transfusion with Placenta Increta or Placenta Percreta Without Additional SOC Out 0 * Resource
    Risk Variable Preterm Birth Out 0 * Resource
    SDE Payer Out 0 * Resource
    Risk Variable Placental Abruption Out 0 * Resource
    Denominator Exclusion Out 0 * Resource
    Risk Variable Morbid Obesity Out 0 * Resource
    Risk Variable Preexisting Diabetes Out 0 * Resource
    Risk Variable Bariatric Surgery Out 0 * Resource
    SDE Race Out 0 1 Resource
    Risk Variable Placenta Previa Out 0 * Resource
    SDE Sex Out 0 1 Coding
    Risk Variable Bleeding Disorder Out 0 * Resource
    Risk Variable First White Blood Cell Count Lab Test Out 0 * Resource
    Risk Variable First Hematocrit Lab Test Out 0 * Resource
    Delivery Encounters with Severe Obstetric Complications Out 0 * Resource
    Risk Variable Severe Preeclampsia Out 0 * Resource
    Risk Variable Anemia Out 0 * Resource
    Risk Variable Cardiac Disease Out 0 * Resource
    Risk Variable Long Term Anticoagulant Use Out 0 * Resource
    Risk Variable Systolic Blood Pressure Out 0 * Resource
    Risk Variable Substance Abuse Out 0 * Resource
    Risk Variable Renal Disease Out 0 * Resource
    SDE Variable Calculated Gestational Age Out 0 * Resource
    Risk Variable Gastrointestinal Disease Out 0 * Resource
    Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions Only Out 0 * Resource
    Risk Variable Pulmonary Hypertension Out 0 * Resource
    Risk Variable Thyrotoxicosis Out 0 * Resource
    Risk Variable Other Preeclampsia Out 0 * Resource
    Initial Population Out 0 * Resource
    Risk Variable Economic Housing Instability Out 0 * Resource
    Risk Variable HIV Out 0 * Resource
    SOC Excluding Blood Transfusions Only with Hysterectomy or Blood Transfusion with Placenta Increta or Placenta Percreta Without Additional SOC Out 0 * Resource
    Risk Variable Heart Rate Out 0 * Resource
    Risk Variable Maternal Age Out 0 * Resource
    Risk Variable Mental Health Disorder Out 0 * Resource
    Risk Variable Obstetrical VTE Out 0 * Resource
    Risk Variable Autoimmune Disease Out 0 * Resource
    Risk Variable Previous Cesarean Out 0 * Resource
    Risk Variable Gestational Diabetes Out 0 * Resource
    Risk Variable Multiple Pregnancy Out 0 * Resource
    Denominator Out 0 * Resource
    Delivery Encounters with Blood Transfusion Out 0 * Resource
    SDE Ethnicity Out 0 1 Resource
    DataRequirements:
    Resource Type Resource Elements Valueset Name Valueset
    Encounter(QICoreEncounter) type period status status.value condition condition.reference condition.reference.value extension condition.code hospitalization hospitalization.dischargeDisposition id id.value Observation Services Observation Services
    Encounter(QICoreEncounter) type period status status.value condition condition.reference condition.reference.value extension condition.code hospitalization hospitalization.dischargeDisposition id id.value ED Visit and OB Triage http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.369
    Encounter(QICoreEncounter) type status status.value period condition condition.reference condition.reference.value extension condition.code hospitalization hospitalization.dischargeDisposition id id.value Encounter Inpatient Encounter Inpatient
    Patient(QICorePatient) race ethnicity
    Procedure(QICoreProcedure) code status status.value performed Delivery Procedures Delivery Procedures
    Procedure(QICoreProcedure) code status status.value performed Severe Maternal Morbidity Procedures http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.256
    Procedure(QICoreProcedure) code status status.value performed Hysterectomy http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.358
    Procedure(QICoreProcedure) code status status.value performed Conversion of Cardiac Rhythm http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.357
    Procedure(QICoreProcedure) code status status.value performed Tracheostomy http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.359
    Procedure(QICoreProcedure) code status status.value performed Ventilation http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.360
    Procedure(QICoreProcedure) code status status.value performed Respiratory Support Procedures Related to COVID 19 http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.379
    Procedure(QICoreProcedure) code status status.value performed Blood Transfusion http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.213
    Observation(QICoreObservation) code value status status.value effective
    Observation(QICoreObservation) code value status status.value effective
    Observation(QICoreObservation) code effective value status status.value Estimated Gestational Age at Delivery Estimated Gestational Age at Delivery
    Condition(QICoreCondition) id id.value code
    Coverage(QICoreCoverage) type period Payer Type Payer
    Observation(US Core Laboratory Result Observation Profile) code issued issued.value status status.value value White blood cells count lab test White blood cells count lab test
    Observation(US Core Laboratory Result Observation Profile) code issued issued.value status status.value value Hematocrit lab test Hematocrit lab test
    Observation(Observation Blood Pressure Profile) effective status status.value component
    Observation(Observation Heart Rate Profile) effective status status.value value
    Direct Reference Codes:
    display code system
    Date and time of obstetric delivery 93857-1 http://loinc.org
    Delivery date Estimated 11778-8 http://loinc.org
    Male M http://hl7.org/fhir/administrative-gender
    Female F http://hl7.org/fhir/administrative-gender
    Systolic BP 8480-6 http://loinc.org
    Logic Definitions:
    Group Scoring Population Criteria Expression
    64efa90856d636294b157c9a Group scoring: proportion Measure scoring:

    Proportion

    Type:

    Outcome

    Rate Aggregation: Two hospital-level measure scores are calculated as a risk-adjusted proportion reported as a rate per 10,000 delivery hospitalizations: 1. All Severe Obstetric Complications (SOC). ((Num1 – NumExcl) / (Den-DenExcl)) * 10,000 2. SOC excluding encounters where transfusion was the only SOC. ((Num2 – NumExcl) / (Den-DenExcl)) * 10,000 Num1: Number of delivery encounters with SOC Num2: Number of delivery encounters with SOC excluding encounters where transfusion was the only SOC NumExcl: Delivery encounters with blood transfusion or hysterectomy with Placenta Percreta or Placenta Increta Den: Delivery encounters with > or = 20 weeks gestation completed DenExcl: Delivery encounters for patients with a COVID diagnosis and COVID-related respiratory condition or a COVID diagnosis and COVID-related respiratory procedure
    Improvement Notation:

    Decreased score indicates improvement

    Initial Population
    define "Initial Population":
      PCMaternal."Delivery Encounter with Age Range"
    Denominator
    define "Denominator":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation"
    Denominator Exclusion
    define "Denominator Exclusion":
      "Delivery Encounters with COVID and Respiratory Condition or Procedure"
    Numerator
    define "Delivery Encounters with Severe Obstetric Complications":
      "Delivery Encounters with Severe Obstetric Complications Diagnosis or Procedure Excluding Blood Transfusion"
        union "Delivery Encounters with Expiration"
        union "Delivery Encounters with Blood Transfusion"
    Numerator Exclusion
    define "SOC with Hysterectomy or Blood Transfusion with Placenta Increta or Placenta Percreta Without Additional SOC":
      ( "Delivery Encounters with Severe Obstetric Complications" SOCEncounter
          where exists ( ( SOCEncounter.encounterDiagnosis ( ) ) EncounterDiagnosis
              where EncounterDiagnosis.code in "Placenta Increta or Percreta"
          )
            and ( exists "Delivery Encounters with Blood Transfusion"
                or exists "Delivery Encounters with Hysterectomy"
            )
      )
    	//The following logic keeps encounter in the numerator if there is an additional SOC besides Blood Transfusion or Hysterectomy
        
        except ( ( "Delivery Encounters with Severe Obstetric Complications" SOCEncounter
              where ( SOCEncounter.pOAIsNoOrUTD ( ) in "Severe Maternal Morbidity Diagnoses" )
          )
            union "Delivery Encounters with Cardiac Conversion, Tracheostomy or Ventilation Procedures"
            union "Delivery Encounters with Expiration"
        )
    None
    658b2eadd4b024647cc00341 Group scoring: proportion Measure scoring:

    Proportion

    Type:

    Outcome

    Rate Aggregation: SOC excluding encounters where transfusion was the only SOC, calculated as a risk-adjusted proportion reported as a rate per 10,000 delivery hospitalizations: ((Num2 – NumExcl) / (Den-DenExcl)) * 10,000 Num2: Number of delivery encounters with SOC excluding encounters where transfusion was the only SOC; NumExcl: Delivery encounters with blood transfusion or hysterectomy with Placenta Percreta or Placenta Increta; Den: Delivery encounters with > or = 20 weeks gestation completed; DenExcl: Delivery encounters for patients with a COVID diagnosis and COVID-related respiratory condition or a COVID diagnosis and COVID-related respiratory procedure
    Initial Population
    define "Initial Population":
      PCMaternal."Delivery Encounter with Age Range"
    Denominator
    define "Denominator":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation"
    Denominator Exclusion
    define "Denominator Exclusion":
      "Delivery Encounters with COVID and Respiratory Condition or Procedure"
    Numerator
    define "Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions Only":
      "Delivery Encounters with Severe Obstetric Complications"
        intersect "Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions"
    Numerator Exclusion
    define "SOC Excluding Blood Transfusions Only with Hysterectomy or Blood Transfusion with Placenta Increta or Placenta Percreta Without Additional SOC":
      ( "Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions Only" SOCExcludingTransfusion
          where exists ( ( SOCExcludingTransfusion.encounterDiagnosis ( ) ) EncounterDiagnoses
              where EncounterDiagnoses.code in "Placenta Increta or Percreta"
          )
            and ( exists "Delivery Encounters with Blood Transfusion"
                or exists "Delivery Encounters with Hysterectomy"
            )
      )
    	
    	//The following logic keeps encounter in the numerator if there is an additional SOC besides Blood Transfusion or Hysterectomy
        
        except ( ( "Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions Only" SOCExcludingTransfusion
              where SOCExcludingTransfusion.pOAIsNoOrUTD ( ) in "Severe Maternal Morbidity Diagnoses"
          )
            union "Delivery Encounters with Cardiac Conversion, Tracheostomy or Ventilation Procedures"
            union "Delivery Encounters with Expiration"
        )
    Library Name Name
    CQMCommon Inpatient Encounter
    define "Inpatient Encounter":
      [Encounter: "Encounter Inpatient"] EncounterInpatient
    		where EncounterInpatient.status = 'finished'
    		and EncounterInpatient.period ends during day of "Measurement Period"
    Library Name Name
    PCMaternal Encounter with Age Range
    define "Encounter with Age Range":
     CQMCommon."Inpatient Encounter" InpatientEncounter
                          where AgeInYearsAt(date from start of InpatientEncounter.period) in Interval[ 8, 65 )
    Library Name Name
    PCMaternal Delivery Encounter with Age Range
    define "Delivery Encounter with Age Range":
      "Encounter with Age Range" EncounterWithAge
                    with ["Procedure": "Delivery Procedures"] DeliveryProcedure
                    such that DeliveryProcedure.status = 'completed'
                    and DeliveryProcedure.performed.toInterval  ( ) starts during EncounterWithAge.hospitalizationWithEDOBTriageObservation ()
    Library Name Name
    SevereObstetricComplicationsFHIR Delivery Encounters with Calculated Gestational Age Greater than or Equal to 20 Weeks
    define "Delivery Encounters with Calculated Gestational Age Greater than or Equal to 20 Weeks":
      PCMaternal."Delivery Encounter with Age Range" DeliveryEncounter
        where DeliveryEncounter.calculatedGestationalAge ( ) >= 20
    Library Name Name
    SevereObstetricComplicationsFHIR Delivery Encounters with Estimated Gestational Age Assessment Greater than or Equal to 20 Weeks
    define "Delivery Encounters with Estimated Gestational Age Assessment Greater than or Equal to 20 Weeks":
      PCMaternal."Delivery Encounter with Age Range" DeliveryEncounter
        where DeliveryEncounter.calculatedGestationalAge ( ) is null
          and ( DeliveryEncounter.lastEstimatedGestationalAge ( ) >= 20 weeks )
    Library Name Name
    SevereObstetricComplicationsFHIR Delivery Encounters with Gestational Age Greater than or Equal to 20 Weeks Based on Coding
    define "Delivery Encounters with Gestational Age Greater than or Equal to 20 Weeks Based on Coding":
      PCMaternal."Delivery Encounter with Age Range" DeliveryEncounter
        let CGA: DeliveryEncounter.calculatedGestationalAge ( ),
        EGA: DeliveryEncounter.lastEstimatedGestationalAge ( )
        where CGA is null
          and EGA is null
          and exists ( ( DeliveryEncounter.encounterDiagnosis ( ) ) EncounterDiagnosis
              where EncounterDiagnosis.code in "20 to 42 Plus Weeks Gestation"
          )
    Library Name Name
    SevereObstetricComplicationsFHIR Delivery Encounters At Greater than or Equal to 20 Weeks Gestation
    define "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation":
      "Delivery Encounters with Calculated Gestational Age Greater than or Equal to 20 Weeks"
        union "Delivery Encounters with Estimated Gestational Age Assessment Greater than or Equal to 20 Weeks"
        union "Delivery Encounters with Gestational Age Greater than or Equal to 20 Weeks Based on Coding"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Asthma
    define "Risk Variable Asthma":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Acute or Persistent Asthma"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Placental Accreta Spectrum
    define "Risk Variable Placental Accreta Spectrum":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Placenta Accreta"
          or TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Placenta Increta or Percreta"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Neuromuscular
    define "Risk Variable Neuromuscular":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Neuromuscular Disease"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Hypertension
    define "Risk Variable Hypertension":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Hypertension"
    Library Name Name
    SevereObstetricComplicationsFHIR Delivery Encounters with Severe Obstetric Complications Diagnosis or Procedure Excluding Blood Transfusion
    define "Delivery Encounters with Severe Obstetric Complications Diagnosis or Procedure Excluding Blood Transfusion":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsNoOrUTD ( ) in "Severe Maternal Morbidity Diagnoses"
          or exists ( ["Procedure": "Severe Maternal Morbidity Procedures"] SMMProcedures
              where SMMProcedures.status = 'completed'
                and SMMProcedures.performed.toInterval ( ) starts during day of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation ( )
          )
    Library Name Name
    SevereObstetricComplicationsFHIR Delivery Encounters with Expiration
    define "Delivery Encounters with Expiration":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.hospitalization.dischargeDisposition in "Patient Expired"
    Library Name Name
    SevereObstetricComplicationsFHIR Delivery Encounters with Blood Transfusion
    define "Delivery Encounters with Blood Transfusion":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        with ["Procedure": "Blood Transfusion"] BloodTransfusion
          such that BloodTransfusion.status = 'completed'
            and BloodTransfusion.performed.toInterval ( ) starts during day of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation ( )
    Library Name Name
    SevereObstetricComplicationsFHIR Delivery Encounters with Severe Obstetric Complications
    define "Delivery Encounters with Severe Obstetric Complications":
      "Delivery Encounters with Severe Obstetric Complications Diagnosis or Procedure Excluding Blood Transfusion"
        union "Delivery Encounters with Expiration"
        union "Delivery Encounters with Blood Transfusion"
    Library Name Name
    SevereObstetricComplicationsFHIR Delivery Encounters with Hysterectomy
    define "Delivery Encounters with Hysterectomy":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        with ["Procedure": "Hysterectomy"] Hysterectomy
          such that Hysterectomy.status = 'completed'
            and Hysterectomy.performed.toInterval ( ) starts during day of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation ( )
    Library Name Name
    SevereObstetricComplicationsFHIR Cardiac Conversion, Tracheostomy or Ventilation Procedures
    define "Cardiac Conversion, Tracheostomy or Ventilation Procedures":
      ["Procedure": "Conversion of Cardiac Rhythm"]
        union ["Procedure": "Tracheostomy"]
        union ["Procedure": "Ventilation"]
    Library Name Name
    SevereObstetricComplicationsFHIR Delivery Encounters with Cardiac Conversion, Tracheostomy or Ventilation Procedures
    define "Delivery Encounters with Cardiac Conversion, Tracheostomy or Ventilation Procedures":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        with "Cardiac Conversion, Tracheostomy or Ventilation Procedures" ConvTrachVentProcedures
          such that ConvTrachVentProcedures.status = 'completed'
            and ConvTrachVentProcedures.performed.toInterval ( ) starts during day of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation ( )
    Library Name Name
    SevereObstetricComplicationsFHIR SOC with Hysterectomy or Blood Transfusion with Placenta Increta or Placenta Percreta Without Additional SOC
    define "SOC with Hysterectomy or Blood Transfusion with Placenta Increta or Placenta Percreta Without Additional SOC":
      ( "Delivery Encounters with Severe Obstetric Complications" SOCEncounter
          where exists ( ( SOCEncounter.encounterDiagnosis ( ) ) EncounterDiagnosis
              where EncounterDiagnosis.code in "Placenta Increta or Percreta"
          )
            and ( exists "Delivery Encounters with Blood Transfusion"
                or exists "Delivery Encounters with Hysterectomy"
            )
      )
    	//The following logic keeps encounter in the numerator if there is an additional SOC besides Blood Transfusion or Hysterectomy
        
        except ( ( "Delivery Encounters with Severe Obstetric Complications" SOCEncounter
              where ( SOCEncounter.pOAIsNoOrUTD ( ) in "Severe Maternal Morbidity Diagnoses" )
          )
            union "Delivery Encounters with Cardiac Conversion, Tracheostomy or Ventilation Procedures"
            union "Delivery Encounters with Expiration"
        )
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Preterm Birth
    define "Risk Variable Preterm Birth":
    /*  CGA = Calculated Gestational Age.  EGA = Estimated Gestational Age. */
      
      ( PCMaternal."Delivery Encounter with Age Range" DeliveryEncounter
          let CGA: DeliveryEncounter.calculatedGestationalAge ( ),
          EGA: DeliveryEncounter.lastEstimatedGestationalAge ( )
          where CGA in Interval[20, 36]
            or ( CGA is null
                and ( EGA >= 20 weeks
                    and EGA <= 36 weeks
                )
            )
      )
        union ( PCMaternal."Delivery Encounter with Age Range" DeliveryEncounter
            let CGA: DeliveryEncounter.calculatedGestationalAge ( ),
            EGA: DeliveryEncounter.lastEstimatedGestationalAge ( )
            where CGA is null
              and EGA is null
              and DeliveryEncounter.pOAIsYesOrExempt ( ) in "Preterm Birth"
        )
    Library Name Name
    SupplementalDataElements SDE Payer
    define "SDE Payer":
      [Coverage: type in "Payer Type"] Payer
        return {
          code: Payer.type,
          period: Payer.period
        }
    Library Name Name
    SevereObstetricComplicationsFHIR SDE Payer
    define "SDE Payer":
      SDE."SDE Payer"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Placental Abruption
    define "Risk Variable Placental Abruption":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Placental Abruption"
    Library Name Name
    SevereObstetricComplicationsFHIR Delivery Encounters with COVID and Respiratory Condition or Procedure
    define "Delivery Encounters with COVID and Respiratory Condition or Procedure":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where exists ( ( TwentyWeeksPlusEncounter.encounterDiagnosis ( ) ) EncounterDiagnosis
            where EncounterDiagnosis.code in "COVID 19 Confirmed"
        )
          and ( exists ( ( TwentyWeeksPlusEncounter.encounterDiagnosis ( ) ) EncounterDiagnosis
                where EncounterDiagnosis.code in "Respiratory Conditions Related to COVID 19"
            )
              or exists ( ["Procedure": "Respiratory Support Procedures Related to COVID 19"] COVIDRespiratoryProcedure
                  where COVIDRespiratoryProcedure.status = 'completed'
                    and COVIDRespiratoryProcedure.performed.toInterval ( ) starts during day of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation ( )
              )
          )
    Library Name Name
    SevereObstetricComplicationsFHIR Denominator Exclusion
    define "Denominator Exclusion":
      "Delivery Encounters with COVID and Respiratory Condition or Procedure"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Morbid Obesity
    define "Risk Variable Morbid Obesity":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Morbid or Severe Obesity"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Preexisting Diabetes
    define "Risk Variable Preexisting Diabetes":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Preexisting Diabetes"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Bariatric Surgery
    define "Risk Variable Bariatric Surgery":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Bariatric Surgery"
    Library Name Name
    SupplementalDataElements SDE Race
    define "SDE Race":
      Patient.race R
        return Tuple {
          codes: R.ombCategory union R.detailed,
          display: R.text
        }
    Library Name Name
    SevereObstetricComplicationsFHIR SDE Race
    define "SDE Race":
      SDE."SDE Race"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Placenta Previa
    define "Risk Variable Placenta Previa":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Placenta Previa"
    Library Name Name
    SupplementalDataElements SDE Sex
    define "SDE Sex":
      case
        when Patient.gender = 'male' then "M"
        when Patient.gender = 'female' then "F"
        else null
      end
    Library Name Name
    SevereObstetricComplicationsFHIR SDE Sex
    define "SDE Sex":
      SDE."SDE Sex"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Bleeding Disorder
    define "Risk Variable Bleeding Disorder":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Bleeding Disorder"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable First White Blood Cell Count Lab Test
    //First resulted value 24 hours prior to start of encounter and before time of delivery
     //Report white blood cell count as 10*3/uL
    
    
    
    define "Risk Variable First White Blood Cell Count Lab Test":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        let FirstWBC: First(["USCoreLaboratoryResultObservationProfile": "White blood cells count lab test"] WBC
            where WBC.issued during Interval[start of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation() - 1440 minutes, TwentyWeeksPlusEncounter.lastTimeOfDelivery())
              and WBC.status in { 'final', 'amended', 'corrected' }
              and WBC.value is not null
            sort by issued.earliest()
        )
        return {
          EncounterId: TwentyWeeksPlusEncounter.id,
          FirstWBCResult: FirstWBC.value as Quantity,
          Timing: FirstWBC.issued
        }
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable First Hematocrit Lab Test
    //First resulted value 24 hours prior to start of encounter and before time of delivery
     //Report hematocrit as %
    
    
    
    define "Risk Variable First Hematocrit Lab Test":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        let FirstHematocrit: First(["USCoreLaboratoryResultObservationProfile": "Hematocrit lab test"] Hematocrit
            where Hematocrit.issued during Interval[start of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation() - 1440 minutes, TwentyWeeksPlusEncounter.lastTimeOfDelivery())
              and Hematocrit.status in { 'final', 'amended', 'corrected' }
              and Hematocrit.value is not null
            sort by issued.earliest()
        )
        return {
          EncounterId: TwentyWeeksPlusEncounter.id,
          FirstHematocritResult: FirstHematocrit.value as Quantity,
          Timing: FirstHematocrit.issued
        }
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Severe Preeclampsia
    define "Risk Variable Severe Preeclampsia":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Severe Preeclampsia"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Anemia
    define "Risk Variable Anemia":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Anemia"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Cardiac Disease
    define "Risk Variable Cardiac Disease":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Cardiac Disease"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Long Term Anticoagulant Use
    define "Risk Variable Long Term Anticoagulant Use":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Long Term Anticoagulant Use"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Systolic Blood Pressure
    //First resulted value 24 hours prior to start of encounter and before time of delivery
    //Report systolic blood pressure as mm[Hg]
    //Systolic blood pressure value cannot be null per QICore profile requirement.
    
    
    
    
    define "Risk Variable Systolic Blood Pressure":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        let FirstSystolicBP: First(["observation-bp"] BP
            where BP.effective.earliest() during Interval[start of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation() - 1440 minutes, TwentyWeeksPlusEncounter.lastTimeOfDelivery())
              and BP.status in { 'final', 'amended', 'corrected' }
              and BP.component.value is not null
            sort by effective.earliest()
        )
        return {
          EncounterId: TwentyWeeksPlusEncounter.id,
          FirstSBPResult: FirstSystolicBP.component C
            where C.code ~ "Systolic blood pressure"
            return C.value as Quantity,
          Timing: FirstSystolicBP.effective.earliest ( )
        }
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Substance Abuse
    define "Risk Variable Substance Abuse":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Substance Abuse"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Renal Disease
    define "Risk Variable Renal Disease":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Renal Disease"
    Library Name Name
    PCMaternal Variable Calculated Gestational Age
    define "Variable Calculated Gestational Age":
     // This definition establishes a variable of CGA (Calculated Gestational Age).  CGA is a supplemental data element to store the calculated gestational age result from the "CalculatedGestationalAge" function.  The data element enables the capturing and saving of the CGA for data analysis post data receipt. Hospitals do not need to submit any additional data to comply with this definition
      "Delivery Encounter with Age Range" DeliveryEncounter
        let CGA: DeliveryEncounter.calculatedGestationalAge()
      //  return { QualifyingEncounter, CGA }
        return {
          EncounterID: DeliveryEncounter.id,
          CalculatedCGA: CGA
        }
    Library Name Name
    SevereObstetricComplicationsFHIR SDE Variable Calculated Gestational Age
    define "SDE Variable Calculated Gestational Age":
      //This definition establishes a variable of CGA (Calculated Gestational Age).  CGA is a supplemental data element to store the calculated gestational age result from the "CalculatedGestationalAge" function.  The data element enables the capturing and saving of the CGA for data analysis post data receipt. Hospitals do not need to submit any additional data to comply with this definition. 
      
      PCMaternal."Variable Calculated Gestational Age"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Gastrointestinal Disease
    define "Risk Variable Gastrointestinal Disease":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Gastrointestinal Disease"
    Library Name Name
    SevereObstetricComplicationsFHIR Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions
    define "Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions":
      "Delivery Encounters with Severe Obstetric Complications Diagnosis or Procedure Excluding Blood Transfusion"
        union "Delivery Encounters with Expiration"
    Library Name Name
    SevereObstetricComplicationsFHIR Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions Only
    define "Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions Only":
      "Delivery Encounters with Severe Obstetric Complications"
        intersect "Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Pulmonary Hypertension
    define "Risk Variable Pulmonary Hypertension":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Pulmonary Hypertension"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Thyrotoxicosis
    define "Risk Variable Thyrotoxicosis":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Thyrotoxicosis"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Other Preeclampsia
    define "Risk Variable Other Preeclampsia":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Mild or Moderate Preeclampsia"
    Library Name Name
    SevereObstetricComplicationsFHIR Initial Population
    define "Initial Population":
      PCMaternal."Delivery Encounter with Age Range"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Economic Housing Instability
    define "Risk Variable Economic Housing Instability":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Economic Housing Instability"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable HIV
    define "Risk Variable HIV":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "HIV in Pregnancy Childbirth and Puerperium"
    Library Name Name
    SevereObstetricComplicationsFHIR SOC Excluding Blood Transfusions Only with Hysterectomy or Blood Transfusion with Placenta Increta or Placenta Percreta Without Additional SOC
    define "SOC Excluding Blood Transfusions Only with Hysterectomy or Blood Transfusion with Placenta Increta or Placenta Percreta Without Additional SOC":
      ( "Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions Only" SOCExcludingTransfusion
          where exists ( ( SOCExcludingTransfusion.encounterDiagnosis ( ) ) EncounterDiagnoses
              where EncounterDiagnoses.code in "Placenta Increta or Percreta"
          )
            and ( exists "Delivery Encounters with Blood Transfusion"
                or exists "Delivery Encounters with Hysterectomy"
            )
      )
    	
    	//The following logic keeps encounter in the numerator if there is an additional SOC besides Blood Transfusion or Hysterectomy
        
        except ( ( "Delivery Encounters with Severe Obstetric Complications Excluding Blood Transfusions Only" SOCExcludingTransfusion
              where SOCExcludingTransfusion.pOAIsNoOrUTD ( ) in "Severe Maternal Morbidity Diagnoses"
          )
            union "Delivery Encounters with Cardiac Conversion, Tracheostomy or Ventilation Procedures"
            union "Delivery Encounters with Expiration"
        )
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Heart Rate
    //First resulted value 24 hours prior to start of encounter and before time of delivery
     //Report heart rate as beats/min
     //Heart rate value cannot be null per QICore profile requirement.
    
    
    
    
    define "Risk Variable Heart Rate":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        let FirstHeartRate: First(["observation-heartrate"] HeartRate
            where HeartRate.effective.earliest() during Interval[start of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation() - 1440 minutes, TwentyWeeksPlusEncounter.lastTimeOfDelivery())
              and HeartRate.status in { 'final', 'amended', 'corrected' }
            sort by effective.earliest()
        )
        return {
          EncounterId: TwentyWeeksPlusEncounter.id,
          FirstHRResult: FirstHeartRate.value as Quantity,
          Timing: FirstHeartRate.effective.earliest ( )
        }
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Maternal Age
    define "Risk Variable Maternal Age":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        let MaternalAge: AgeInYearsAt(date from start of TwentyWeeksPlusEncounter.period)
        return { TwentyWeeksPlusEncounter, MaternalAge }
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Mental Health Disorder
    define "Risk Variable Mental Health Disorder":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Mental Health Disorder"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Obstetrical VTE
    define "Risk Variable Obstetrical VTE":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Venous Thromboembolism in Pregnancy"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Autoimmune Disease
    define "Risk Variable Autoimmune Disease":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Autoimmune Disease"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Previous Cesarean
    define "Risk Variable Previous Cesarean":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Previous Cesarean"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Gestational Diabetes
    define "Risk Variable Gestational Diabetes":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Gestational Diabetes"
    Library Name Name
    SevereObstetricComplicationsFHIR Risk Variable Multiple Pregnancy
    define "Risk Variable Multiple Pregnancy":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
        where TwentyWeeksPlusEncounter.pOAIsYesOrExempt ( ) in "Multiple Pregnancy"
    Library Name Name
    SevereObstetricComplicationsFHIR Denominator
    define "Denominator":
      "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation"
    Library Name Name
    SupplementalDataElements SDE Ethnicity
    define "SDE Ethnicity":
      Patient.ethnicity E
        return Tuple {
          codes: { E.ombCategory } union E.detailed,
          display: E.text
        }
    Library Name Name
    SevereObstetricComplicationsFHIR SDE Ethnicity
    define "SDE Ethnicity":
      SDE."SDE Ethnicity"
    Library Name Name
    PCMaternal hospitalizationWithEDOBTriageObservation
    /*define function "HospitalizationWithEDOBTriageObservation"(Encounter Encounter ):
      HospitalizationWithEDOBTriageObservation returns the total interval from the start of any immediately prior emergency department visit or OB Triage visit through the observation visit to the discharge of the given encounter
      Encounter Visit
        let ObsVisit: Last(["Encounter": "Observation Services"] LastObs
            where LastObs.period ends 1 hour or less on or before start of Visit.period
              and LastObs.status = 'finished'
            sort by 
            end of period
        ),
        VisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),
        EDOBTriageVisit: Last(["Encounter": "ED Visit and OB Triage"] LastEDOBTriage
            where LastEDOBTriage.period ends 1 hour or less on or before VisitStart
              and LastEDOBTriage.status = 'finished'
            sort by 
            end of period
        )
        return Interval[Coalesce(start of EDOBTriageVisit.period, VisitStart), 
        end of Visit.period]*/
        
        
    define fluent function hospitalizationWithEDOBTriageObservation (TheEncounter Encounter ):
      /*hospitalizationWithEDOBTriageObservation returns the total interval from the start of any immediately prior emergency department visit or OB Triage visit through the observation visit to the discharge of the given encounter*/
      TheEncounter Visit
        let ObsVisit: Last(["Encounter": "Observation Services"] LastObs
            where LastObs.period ends 1 hour or less on or before start of Visit.period
              and LastObs.status = 'finished'
            sort by 
            end of period
        ),
        VisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),
        EDOBTriageVisit: Last(["Encounter": "ED Visit and OB Triage"] LastEDOBTriage
            where LastEDOBTriage.period ends 1 hour or less on or before VisitStart
              and LastEDOBTriage.status = 'finished'
            sort by 
            end of period
        )
        return Interval[Coalesce(start of EDOBTriageVisit.period, VisitStart), 
        end of Visit.period]
    Library Name Name
    PCMaternal calculatedGestationalAge
    define fluent function calculatedGestationalAge (TheEncounter Encounter ):
      //Gestational Age = (280-(Estimated Delivery Date minus Reference Date/Delivery Date))/7
     ( 280 - ( difference in days between TheEncounter.lastTimeOfDelivery () and TheEncounter.lastEstimatedDeliveryDate( )) ) div 7
    Library Name Name
    PCMaternal lastTimeOfDelivery
    define fluent function lastTimeOfDelivery (TheEncounter Encounter ):
      Last(["Observation": "Date and time of obstetric delivery"] TimeOfDelivery
          where TimeOfDelivery.value as DateTime is not null
            and TimeOfDelivery.status in { 'final', 'amended', 'corrected' }
            and TimeOfDelivery.effective.earliest () during TheEncounter.hospitalizationWithEDOBTriageObservation ()
            and TimeOfDelivery.value as DateTime during TheEncounter.hospitalizationWithEDOBTriageObservation()
          sort by effective.earliest()
      ).value as DateTime
    Library Name Name
    QICoreCommon earliest
    /*
    @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
    Library Name Name
    PCMaternal lastEstimatedDeliveryDate
    /*===============================================================*/
      /*  03/14/2022 from MATGlobalCommonFunctionsv7.000 - latest QDM  */
      /*     even though this PCMaternalFHIR was derived from          */
      /*     PCMaternal=2.1.000 cql, to make next update easier.       */
      /*     Will need to re-insert "Global". in front of these        */
      /*     function names later (whereever they are directly used.*/
    
    define fluent function lastEstimatedDeliveryDate (TheEncounter Encounter ):
      /*This function identifies the last time the EDD was assessed 42 weeks or less prior to or on delivery and stores the result of that assessment.*/
      Last(["Observation": "Delivery date Estimated"] EstimatedDateOfDelivery
          where EstimatedDateOfDelivery.value as DateTime is not null
            and EstimatedDateOfDelivery.status in { 'final', 'amended', 'corrected' }
            and EstimatedDateOfDelivery.effective.earliest ( ) 42 weeks or less before or on TheEncounter.lastTimeOfDelivery ()
          sort by effective.earliest ( )
      ).value as DateTime
    Library Name Name
    PCMaternal lastEstimatedGestationalAge
    /*define fluent function lastEstimatedGestationalAge (TheEncounter Encounter ):
      Last(["Observation": "Estimated Gestational Age at Delivery"] EstimatedGestationalAge
          where EstimatedGestationalAge.value is not null
            and EstimatedGestationalAge.status in { 'final', 'amended', 'corrected' }
            and EstimatedGestationalAge.effective.earliest() 24 hours or less before or on TheEncounter.lastTimeOfDelivery ()
          sort by effective.earliest ()
      ).value as Quantity*/
      
      define fluent function lastEstimatedGestationalAge (TheEncounter Encounter ):
      Last(["Observation": "Estimated Gestational Age at Delivery"] EstimatedGestationalAge
      let EGATiming:  EstimatedGestationalAge.effective.earliest() where 
      (EGATiming 24 hours or less before or on TheEncounter.lastTimeOfDelivery () 
      and EstimatedGestationalAge.value is not null 
      and EstimatedGestationalAge.status in { 'final', 'amended', 'corrected' }) or 
          (EGATiming same day as TheEncounter.lastTimeOfDelivery () 
          and EGATiming during TheEncounter.hospitalizationWithEDOBTriageObservation() 
          and EstimatedGestationalAge.value is not null)
     sort by effective.earliest ())
             .value as Quantity
    Library Name Name
    CQMCommon encounterDiagnosis
    /*
    @description: Returns the Condition resources referenced by the diagnosis element of the Encounter
    */
    define fluent function encounterDiagnosis(Encounter Encounter ):
      Encounter.diagnosis D
        return singleton from ([Condition] C where C.id = D.condition.reference.getId())
    Library Name Name
    QICoreCommon getId
    /*
    @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI).
    @comment: This function can be used to determine the logical id of a given resource. It can be used in
    a single-server environment to trace references. However, this function does not attempt to resolve
    or distinguish the base of the given url, and so cannot be used safely in multi-server environments.
    */
    define fluent function getId(uri String):
      Last(Split(uri, '/'))
    Library Name Name
    SevereObstetricComplicationsFHIR pOAIsYesOrExempt
    define fluent function pOAIsYesOrExempt(TheEncounter Encounter):
      TheEncounter.diagnosis EncounterDiagnoses
        where EncounterDiagnoses.diagnosisPresentOnAdmission in "Present On Admission is Yes or Exempt"
        return EncounterDiagnoses.condition.getCondition ( ).code
    Library Name Name
    FHIRHelpers ToString
    define function ToString(value uri): value.value
    Library Name Name
    CQMCommon getCondition
    /*
    @description: Returns the Condition resource for the given reference
    */
    define fluent function getCondition(reference Reference):
      singleton from ([Condition] C where C.id = reference.reference.getId())
    Library Name Name
    SevereObstetricComplicationsFHIR pOAIsNoOrUTD
    /*define function "FirstLabTestWithEncounterId"(LabList List<Observation>, CCDE String ):
         "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
      let FirstLab: First(LabList Lab
      //(first resulted value 24 hours prior to start of encounter and before time of delivery)
          where Lab.issued.earliest() during Interval[start of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation()- 1440 minutes, TwentyWeeksPlusEncounter.lastTimeOfDelivery()) 
          and Lab.status in {'final', 'amended', 'corrected'}
          and Lab.value is not null
          sort by issued.earliest())
        return {
        EncounterId: TwentyWeeksPlusEncounter.id,
        FirstResult: FirstLab.value as Quantity,
        Timing: FirstLab.issued
      }
    
    define function "FirstPhysicalExamWithEncounterId"(ExamList List<Observation>, CCDE String):
         "Delivery Encounters At Greater than or Equal to 20 Weeks Gestation" TwentyWeeksPlusEncounter
      let FirstExam: First(ExamList Exam
        where Exam.effective.earliest() during Interval[start of TwentyWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation()- 1440 minutes, TwentyWeeksPlusEncounter.lastTimeOfDelivery()) 
        and Exam.status in {'final', 'amended', 'corrected'}
        and Exam.value is not null
        sort by effective.earliest() )
           return {
        EncounterId: TwentyWeeksPlusEncounter.id,
        FirstResult: FirstExam.value as Quantity,
        Timing: FirstExam.effective.earliest()
      }
      
    define "Risk Variable Lab and Physical Exam Results":
      flatten{
         // First physical exams (vital signs):  Report heart rate as {beats}/min, systolic blood pressure as mm[Hg]
              "FirstPhysicalExamWithEncounterId"([Observation: "Heart rate"], 'FirstHeartRate'),
              "FirstPhysicalExamWithEncounterId"([Observation: "Systolic blood pressure"], 'FirstSystolicBP'),
         //First lab tests:  Report hematocrit as %, white blood cell count as 10*3/uL
              "FirstLabTestWithEncounterId"([Observation: "Hematocrit lab test"], 'FirstHematocrit'),
              "FirstLabTestWithEncounterId"([Observation: "White blood cells count lab test"], 'FirstWhiteBloodCell') 
        }*/
    
    
    define fluent function pOAIsNoOrUTD(TheEncounter Encounter):
      TheEncounter.diagnosis EncounterDiagnoses
        where EncounterDiagnoses.diagnosisPresentOnAdmission in "Present on Admission is No or Unable To Determine"
        return EncounterDiagnoses.condition.getCondition ( ).code
    Library Name Name
    FHIRHelpers ToCode
    /*
    @description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.
    */
    define function ToCode(coding FHIR.Coding):
        if coding is null then
            null
        else
            System.Code {
              code: coding.code.value,
              system: coding.system.value,
              version: coding.version.value,
              display: coding.display.value
            }