Metadata
Title | Cesarean BirthFHIR
Version | 1.0.000
Short Name | CMS334FHIR
GUID (Version Independent) | urn:uuid:e5be4439-ce75-43cc-aabc-856aec66e841
GUID (Version Specific) | urn:uuid:c477b8d3-b7eb-494d-8c68-9f270815ba41
CMS Identifier | 334FHIR
CMS Consensus Based Entity Identifier | 0471e
Effective Period | 2026-01-01 through 2026-12-31
Experimental | true
Steward (Publisher) | The Joint Commission
Developer | The Joint Commission
Description | Nulliparous patients with a term, singleton baby in a vertex position delivered by cesarean birth
Copyright | Measure specifications are in the Public Domain. 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 | These performance measures are not clinical guidelines, 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.
Rationale | The removal of any pressure to not perform a cesarean birth has led to a skyrocketing of hospital, state and national cesarean birth (CB) rates. Some hospitals' CB rates were over 50%. Hospitals with CB rates at 15-20% have infant outcomes that are just as good and better maternal outcomes (Symum & Zayas-Castro, 2023). There is no data that higher rates improve any outcomes, yet the CB rates continue to rise (Bailit, Garrett, Miller, McMahon, & Cefalo, 2002; Main, Bloomfield, & Hunt, 2004). This measure seeks to focus attention on the most variable portion of the CB epidemic, the term labor CB in nulliparous patients. This population segment accounts for the large majority of the variable portion of the CB rate and is the area most affected by subjectivity. As compared to other CB measures, what is different about Nulliparous, Term, Singleton, Vertex (NTSV) CB rate is that there are clear cut quality improvement activities that can be done to address the differences. Main et al. (2012) found that over 60% of the variation among hospitals can be attributed to first birth labor induction rates and first birth early labor admission rates (Main et al., 2006). The results showed if labor was forced when the cervix was not ready the outcomes were poorer. Rosenstein et al. (2021) also showed that labor and delivery guidelines can make a difference in labor outcomes. Many authors have shown that physician factors, rather than patient characteristics or obstetric diagnoses are the major driver for the difference in rates within a hospital (Berkowitz, Fiarman, Mojica, Bauman, & de Regt, 1989; Goyert, Bottoms, Treadwell, & Nehra, 1989; Luthy, Malmgren, Zingheim, & Leininger, 2003; Symum & Zayas-Castro, 2023; Main et al., 2006). The dramatic variation in cesarean rates seen in all populations studied is striking. Cesarean rates varied tenfold in US hospitals nationwide across hospitals (Agency for Healthcare Research and Quality [AHRQ], 2002), from 7.1% to 69.9%, and there was a 15-fold variation among low-risk women, from 2.4% to 36.5% (Kozhimannil, Law, & Virnig, 2013). A reduction in the number of NTSV patients delivering by cesarean birth will result in increased patient safety, a substantial decrease in maternal and neonatal morbidity and substantial savings in health care costs (Main et al., 2019). Successful quality improvement efforts incorporate audit and feedback strategies combined with provider and nurse education, guidelines and peer review. The measure will assist health care organizations to track NTSV patients delivering by cesarean birth to reduce the occurrence. Nulliparous patients have 4-6 times the cesarean birth rate than multiparous patients thus the NTSV population is the largest driver of primary cesarean birth rate (Sakala, Belanoff, & Declercq, 2020). NTSV has a large variation among facilities, thus identifying an important population on which to focus quality improvement efforts. In accordance with the American College of Obstetricians and Gynecologists (ACOG) recommendations (2020), cesarean delivery is indicated for patients with active genital lesions of genital herpes or prodromal symptoms (i.e., vulvar pain or burning at delivery) that may indicate viral shedding. Therefore, the measure will exclude encounters with a diagnosis of active genital herpes. In addition, the accepted approach to treat placenta accreta spectrum, or the range of pathologic adherence of the placenta that includes placenta increta, placenta percreta, and placenta accreta, as well as placenta previa, is cesarean delivery (ACOG & Society for Maternal-Fetal Medicine (SMFM), 2018). Vasa previa is an indication for cesarean delivery (SMFM Publications Committee, Sinkey, Odibo, & Dashe, 2015). Accordingly, placenta previa, vasa previa, and placenta accreta spectrum are all qualifying conditions to also be excluded from the measure. Ultimately, a reduction in primary cesarean births will reduce the number of patients having repeat cesarean births (almost 90% of mothers who have a primary cesarean birth will have subsequent cesarean birth (Centers for Disease Control and Prevention, 2020)). Thus, improvement in the rates of cesarean birth for the first birth will reduce the morbidity of all future births and avoid all the controversies with trial of labor after cesarean/elective repeat cesareans.
Clinical Recommendation Statement | The (ACOG) report, Evaluation of Cesarean Delivery (2000), recognizes the importance of the Nulliparous, Term, Singleton, Vertex (NTSV) population as the optimal focus for measurement and quality improvement action. A reduction in the number of nulliparous patients with live term singleton newborns in vertex position delivering by cesarean birth will result in increased patient safety, a substantial decrease in maternal and neonatal morbidity and substantial savings in health care costs.
Citation | Agency for Healthcare Research and Quality. (2002). AHRQ Quality Indicators Guide to Inpatient Quality Indicators: Quality of Care in Hospitals Volume, Mortality, and Utilization. Revision 4 (2004, December 22). AHRQ Pub. No. 02-RO204.
Citation | American College of Obstetricians and Gynecologists, & Society for Maternal-Fetal Medicine. (2018). Obstetric Care Consensus No. 7: Placenta Accreta Spectrum. Obstetrics and Gynecology, 132(6), e259-e275. https://doi.org/10.1097/AOG.0000000000002983
Citation | American College of Obstetricians and Gynecologists. (2000). Task Force on Cesarean Delivery Rates. Evaluation of Cesarean Delivery. (Developed under the direction of the Task Force on Cesarean Delivery Rates, Roger K. Freeman, MD, Chair, Arnold W. Cohen, MD, Richard Depp III, MD, Fredric D. Frigoletto Jr, MD, Gary D.V. Hankins, MD, Ellice Lieberman, MD, DrPH, M. Kathryn Menard, MD, David A. Nagey, MD, Carol W. Saffold, MD, Lisa Sams, RNC, MSN and ACOG Staff: Stanley Zinberg, MD, MS, Debra A. Hawks, MPH, and Elizabeth Steele)
Citation | American College of Obstetricians and Gynecologists. (2014). Revitalize: Obstetrics Data Definitions Version 1.0. American College of Obstetricians and Gynecologists. Revitalize: Obstetrics Data Definitions Version 1.0 - Search (bing.com)
Citation | American College of Obstetricians and Gynecologists. (2020). ACOG Practice Bulletin Number 220: Management of Genital Herpes in Pregnancy. Obstetrics & Gynecology, 135(5), e193-e200.
Citation | Bailit, J.L., Garrett, J.M., Miller, W.C., McMahon, M.J., & Cefalo, R.C. (2002). Hospital primary cesarean delivery rates and the risk of poor neonatal outcomes. American Journal Obstetrics & Gynecology, 187(3):721-7. https://doi.org/10.1067/mob.2002.125886
Citation | Berkowitz, G. S., Fiarman, G. S., Mojica, M. A., Bauman, J., & de Regt, R. H. (1989). Effect of physician characteristics on the cesarean birth rate. American Journal of Obstetrics and Gynecology, 161(1), 146-149. https://doi.org/10.1016/0002-9378(89)90252-4
Citation | Centers for Disease Control and Prevention. (2020) Recent trends in vaginal birth after cesarean delivery: United States, 2016-2018. Retrieved from National Center for Health Statistics: https://www.cdc.gov/nchs/products/databriefs/db359.htm
Citation | Goyert, G. L., Bottoms, S. F., Treadwell, M. C., & Nehra, P. C. (1989). The physician factor in cesarean birth rates. The New England Journal of Medicine, 320(11), 706-709. https://doi.org/10.1056/NEJM198903163201106
Citation | Kozhimannil, K. B., Law, M. R., & Virnig, B. A. (2013). Cesarean delivery rates vary tenfold among US hospitals; reducing variation may address quality and cost issues. Health Affairs, 32(3), 527-535. https://doi.org/10.1377/hlthaff.2012.1030
Citation | Luthy, D. A., Malmgren, J. A., Zingheim, R. W., & Leininger, C. J. (2003). Physician contribution to a cesarean delivery risk model. American Journal of Obstetrics and Gynecology, 188(6), 1579-1587. https://doi.org/10.1067/mob.2003.389
Citation | Main E. K., Bloomfield, L., & Hunt, G. (2004). Development of a large-scale obstetric quality-improvement program that focused on the nulliparous patient at term. American Journal of Obstetrics and Gynecology, 190(6), 1747-56. https://doi.org/10.1016/j.ajog.2004.02.055
Citation | Main, E. K., Chang, S. C., Cape, V., Sakowski, C., Smith, H., & Vasher, J. (2019). Safety assessment of a large-scale improvement collaborative to reduce nulliparous cesarean delivery rates. Obstetrics and Gynecology, 133(4), 613-623. https://doi.org/10.1097/AOG.0000000000003109
Citation | Main, E. K., Moore, D., Farrell, B., Schimmel, L. D., Altman, R. J., Abrahams, C., . . . Sterling, J. (2006). Is there a useful cesarean birth measure? Assessment of the nulliparous term singleton vertex cesarean birth rate as a tool for obstetric quality improvement. American Journal of Obstetrics and Gynecology, 194(6), 1644-1651. https://doi.org/10.1016/j.ajog.2006.03.013
Citation | Main, E. K., Morton, C. H., Melsop, K., Hopkins, D., Giuliani, G., & Gould, J. B. (2012). Creating a public agenda for maternity safety and quality in cesarean delivery. Obstetrics and Gynecology, 120(5), 1194-1198. https://doi.org/10.1097/aog.0b013e31826fc13d
Citation | Rosenstein, M. G., Chang, S. C., Sakowski, C., Markow, C., Teleki, S., Lang, L., . . . Main, E. K. (2021). Hospital quality improvement interventions, statewide policy initiatives, and rates of cesarean delivery for nulliparous, term, singleton, vertex births in California. JAMA, 325(16), 1631-1639. https://doi.org/10.1001/jama.2021.3816
Citation | Sakala, C., Belanoff, C., & Declercq, E. R. (2020). Factors Associated with Unplanned Primary Cesarean Birth: Secondary analysis of the listening to mothers in California survey. BMC Pregnancy and Childbirth, 20(1), 462. https://doi.org/10.1186/s12884-020-03095-4
Citation | Society of Maternal-Fetal (SMFM) Publications Committee, Sinkey, R. G., Odibo, A. O., & Dashe, J. S. (2015). #37: Diagnosis and management of vasa previa. American Journal of Obstetrics & Gynecology, 213(5), 615-619. https://doi.org/10.1016/j.ajog.2015.08.031
Citation | Symum, H., & Zayas-Castro, J. L. (2023). A multistate decomposition analysis of cesarean rate variations, associated health outcomes, and financial implications in the United States. American Journal of Perinatology, 40(13), 1473-1483. https://doi.org/10.1055/s-0041-1736538
Definition | Gravidity: The number of pregnancies, current and past, regardless of the pregnancy outcome
Definition | Nulliparous: Parity = 0 or Gravidity = 1 or Preterm & Term Births both = 0
Definition | Parity: The number of pregnancies reaching 20 weeks gestation regardless of the number of fetuses or outcomes
Definition | Preterm Birth: The number of births >= 20 weeks and < 37 weeks gestation, regardless of outcome
Definition | Term Birth: The number of births >= 37 weeks gestation, regardless of outcome
Guidance (Usage) | Vertex position is modeled implicitly, as the measure excludes deliveries with abnormal presentations. Patients who do not receive prenatal care and have no documented gestational age or estimated due date are implicitly excluded from the measure, as gestational age is required to meet denominator criteria. This measure allows for 3 approaches to determine gestational age (GA) in the following order of precedence: The GA is calculated using the American College of Obstetricians and Gynecologists ReVITALize guidelines.* When the calculated GA is not available, the GA is obtained from a discrete field in the electronic health record. The intent is to capture the last estimated GA in the interval starting 24 hours or less prior to delivery and ending before midnight on the same day of delivery. 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. *ACOG ReVITALize Guidelines for Calculating Gestational Age (ACOG, 2014): Gestational Age = (280-(EDD minus Reference Date))/7 Estimated Due Date (EDD): The best obstetrical Estimated Due Date 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 dQM, Reference Date would be the Date of Delivery. Note however, the calculation may yield a non-whole number, and gestational age should be rounded off 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. The timing relationship of relevantDatetime 42 weeks or less before TimeOfDelivery is applied to the data elements of parity, gravida, preterm/term live births for which prenatal records may include relevant information. Note: The dQM and chart-based measure slightly digress in the denominator and denominator exclusion logic. The chart-based measure excludes single stillbirth and patients with multiple gestations from the denominator. These concepts are mutually exclusive of the denominator requirement of live singleton newborn and therefore the logic does not address single stillbirth nor multiple gestation. Parity, preterm, and term live births may be updated by the electronic health record software or by clinicians during a delivery encounter. To capture the pre-delivery value, organizations may need to create a rule or calculation to capture the number prior to the delivery start time. "Gravida", "PretermBirth", "TermBirth" and "Parity" results should be submitted via QRDA I as integer, and not as number or quantity. 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: CMS334v7. 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: 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 Logic Definition: Initial Population
Denominator | ID: Denominator_1 Description: Inpatient hospitalizations for nulliparous patients who delivered a live term singleton newborn greater than or equal to 37 weeks' gestation See Guidance and Definition Sections for more details. Logic Definition: Denominator
Denominator Exclusion | ID: DenominatorExclusion_1 Description: Inpatient hospitalizations for patients with any of the following conditions during the encounter: abnormal presentation genital herpes placenta previa vasa previa placenta accreta placenta increta placenta percreta Logic Definition: Denominator Exclusions
Numerator | ID: Numerator_1 Description: Inpatient hospitalizations for patients who deliver by cesarean section Logic Definition: Numerator
Supplemental Data Guidance | For every patient evaluated by this measure also identify payer, race, ethnicity, sex, and calculated gestational age
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-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: 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-variable-calculated-gestational-age Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Variable Calculated Gestational Age Logic Definition: SDE Variable Calculated Gestational Age
Measure Logic
Primary Library | https://madie.cms.gov/Library/CMS0334FHIRPCCesareanBirth
Contents | Population Criteria Logic Definitions Terminology Dependencies Data Requirements
Population Criteria
Measure Group (Rate) (ID: Group_1)
Initial Population
    define "Initial Population":
      PCMaternal."Delivery Encounter With Age Range"
Denominator
    define "Denominator":
      "Singleton Delivery Encounters At 37 Plus Weeks Gravida 1 Parity 0, No Previous Births"
Denominator Exclusion
    define "Denominator Exclusions":
      "Delivery Encounter With Abnormal Presentation, Genital Herpes, Placenta Previa, Vasa Previa Or Placenta Accreta Spectrum"
Numerator
    define "Numerator":
      "Delivery Encounter With Cesarean Birth"
Logic Definitions
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Sex":
      case
        when Patient.sex = '248153007' then "Male (finding)"
        when Patient.sex = '248152002' then "Female (finding)"
        else null
      end
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Payer":
      [Coverage: type in "Payer Type"] Payer
        return {
          code: Payer.type,
          period: Payer.period
        }
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Ethnicity":
      Patient.ethnicity E
        return Tuple {
          codes: { E.ombCategory } union E.detailed,
          display: E.text
        }
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Race":
      Patient.race R
        return Tuple {
          codes: R.ombCategory union R.detailed,
          display: R.text
        }
Logic Definition | Library Name: PCMaternal
    define "Encounter With Age Range":
     CQMCommon."Inpatient Encounter" InpatientEncounter
                          where AgeInYearsAt(date from start of InpatientEncounter.period) in Interval[ 8, 65 )
Logic Definition | Library Name: PCMaternal
    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 ()
Logic Definition | Library Name: PCMaternal
    define "Variable Calculated Gestational Age":
     "Delivery Encounter With Age Range" DeliveryEncounter
        let CGA: DeliveryEncounter.calculatedGestationalAge()
        return {
          EncounterID: DeliveryEncounter.id,
          CalculatedCGA: CGA
        }
Logic Definition | Library Name: PCMaternal
    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]
Logic Definition | Library Name: PCMaternal
    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
Logic Definition | Library Name: PCMaternal
    define fluent function lastTimeOfDelivery (TheEncounter Encounter ):
      Last(["SimpleObservation": "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
Logic Definition | Library Name: PCMaternal
    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(["SimpleObservation": "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
Logic Definition | Library Name: PCMaternal
    define fluent function lastEstimatedGestationalAge (TheEncounter Encounter ):
      Last(["SimpleObservation": "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
Logic Definition | Library Name: FHIRHelpers
    define function ToString(value uri): value.value
Logic Definition | Library Name: FHIRHelpers
    /*
    @description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period)
    value to a CQL DateTime Interval
    @comment: If the start value of the given period is unspecified, the starting
    boundary of the resulting interval will be open (meaning the start of the interval
    is unknown, as opposed to interpreted as the beginning of time).
    */
    define function ToInterval(period FHIR.Period):
        if period is null then
            null
        else
            if period."start" is null then
                Interval(period."start".value, period."end".value]
            else
                Interval[period."start".value, period."end".value]
Logic Definition | Library Name: FHIRHelpers
    /*
    @description: Converts the given FHIR [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: CQMCommon
    define "Inpatient Encounter":
      [Encounter: "Encounter Inpatient"] EncounterInpatient
        where EncounterInpatient.status = 'finished'
          and EncounterInpatient.period ends during day of "Measurement Period"
Logic Definition | Library Name: CQMCommon
    /*
    @description: Returns the Condition resources referenced by the diagnosis element of the Encounter
    */
    define fluent function encounterDiagnosis(Encounter Encounter ):
      Encounter.reasonReference D
        return singleton from (([ConditionEncounterDiagnosis] union [ConditionProblemsHealthConcerns]) C where D.references(C.id))
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, 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 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: CMS0334FHIRPCCesareanBirth
    define "SDE Sex":
      SDE."SDE Sex"
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "Delivery Encounter With Calculated Gestational Age Greater Than Or Equal To 37 Weeks":
      PCMaternal."Delivery Encounter With Age Range" DeliveryEncounter
        where DeliveryEncounter.calculatedGestationalAge ( ) >= 37
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "Delivery Encounter With Estimated Gestational Age Greater Than Or Equal To 37 Weeks":
      PCMaternal."Delivery Encounter With Age Range" DeliveryEncounter
        where DeliveryEncounter.calculatedGestationalAge ( ) is null
          and DeliveryEncounter.lastEstimatedGestationalAge ( ) >= 37 weeks
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "Delivery Encounter With Gestational Age Greater Than Or Equal To 37 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 ( DeliveryEncounter.reasonCode in "37 to 42 Plus Weeks Gestation"
              or DeliveryEncounter.encounterDiagnosis ( ).code in "37 to 42 Plus Weeks Gestation"
          )
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "Delivery Encounter With Gestational Age Greater Than Or Equal To 37 Weeks":
      "Delivery Encounter With Calculated Gestational Age Greater Than Or Equal To 37 Weeks"
        union "Delivery Encounter With Estimated Gestational Age Greater Than Or Equal To 37 Weeks"
        union "Delivery Encounter With Gestational Age Greater Than Or Equal To 37 Weeks Based On Coding"
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "Encounter With Singleton Delivery":
      PCMaternal."Delivery Encounter With Age Range" DeliveryEncounter
        where DeliveryEncounter.reasonCode in "Delivery of Singleton"
          or DeliveryEncounter.encounterDiagnosis ( ).code in "Delivery of Singleton"
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "Singleton Delivery Encounters At 37 Plus Weeks Gravida 1 Parity 0, No Previous Births":
      ( "Delivery Encounter With Gestational Age Greater Than Or Equal To 37 Weeks"
        intersect "Encounter With Singleton Delivery" ) SingletonEncounterGE37Weeks
        where ( ( SingletonEncounterGE37Weeks.lastGravida ( ) = 1 )
            or ( SingletonEncounterGE37Weeks.lastParity ( ) = 0 )
            or ( ( SingletonEncounterGE37Weeks.lastHistoryPretermBirth ( ) = 0 )
                and ( SingletonEncounterGE37Weeks.lastHistoryTermBirth ( ) = 0 )
            )
        )
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "Delivery Encounter With Cesarean Birth":
      "Singleton Delivery Encounters At 37 Plus Weeks Gravida 1 Parity 0, No Previous Births" ThirtySevenWeeksPlusEncounter
        with ["Procedure": "Cesarean Birth"] CSection
          such that CSection.performed.toInterval ( ) during ThirtySevenWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation ( )
            and CSection.status = 'completed'
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "Numerator":
      "Delivery Encounter With Cesarean Birth"
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "Denominator":
      "Singleton Delivery Encounters At 37 Plus Weeks Gravida 1 Parity 0, No Previous Births"
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "SDE Payer":
      SDE."SDE Payer"
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "Initial Population":
      PCMaternal."Delivery Encounter With Age Range"
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "SDE Ethnicity":
      SDE."SDE Ethnicity"
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "Encounter With Abnormal Presentation":
      "Singleton Delivery Encounters At 37 Plus Weeks Gravida 1 Parity 0, No Previous Births" ThirtySevenWeeksPlusEncounter
        let LastAbnormalPresentation: Last(["SimpleObservation": "Abnormal Presentation"] AbnormalPresentation
            where AbnormalPresentation.effective.earliest() before or on ThirtySevenWeeksPlusEncounter.lastTimeOfDelivery()
              and AbnormalPresentation.status in { 'final', 'amended', 'corrected' }
            sort by effective.earliest()
        )
        where LastAbnormalPresentation.effective.earliest ( ) during ThirtySevenWeeksPlusEncounter.hospitalizationWithEDOBTriageObservation ( )
          or ThirtySevenWeeksPlusEncounter.encounterDiagnosis ( ).code in "Abnormal Presentation"
          or ThirtySevenWeeksPlusEncounter.reasonCode in "Abnormal Presentation"
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "Encounter With Genital Herpes, Placenta Previa, Vasa Previa Or Placenta Accreta Spectrum":
      "Singleton Delivery Encounters At 37 Plus Weeks Gravida 1 Parity 0, No Previous Births" ThirtySevenWeeksPlusEncounter
        where ( ThirtySevenWeeksPlusEncounter.encounterDiagnosis ( ).code in "Placenta Accreta Spectrum Previa or Vasa Previa"
            or ThirtySevenWeeksPlusEncounter.encounterDiagnosis ( ).code in "Genital Herpes"
            or ThirtySevenWeeksPlusEncounter.reasonCode in "Genital Herpes"
            or ThirtySevenWeeksPlusEncounter.reasonCode in "Placenta Accreta Spectrum Previa or Vasa Previa"
        )
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "Delivery Encounter With Abnormal Presentation, Genital Herpes, Placenta Previa, Vasa Previa Or Placenta Accreta Spectrum":
      "Encounter With Abnormal Presentation"
        union "Encounter With Genital Herpes, Placenta Previa, Vasa Previa Or Placenta Accreta Spectrum"
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "Denominator Exclusions":
      "Delivery Encounter With Abnormal Presentation, Genital Herpes, Placenta Previa, Vasa Previa Or Placenta Accreta Spectrum"
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "SDE Race":
      SDE."SDE Race"
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define "SDE Variable Calculated Gestational Age":
      PCMaternal."Variable Calculated Gestational Age"
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define fluent function lastGravida(TheEncounter Encounter):
      Last(["SimpleObservation": "[#] Pregnancies"] Gravida
          where Gravida.value is not null
            and Gravida.status in { 'final', 'amended', 'corrected' }
            and Gravida.effective.earliest() 42 weeks or less before TheEncounter.lastTimeOfDelivery()
          sort by effective.earliest()
      ).value as Integer
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define fluent function lastParity(TheEncounter Encounter):
      Last(["SimpleObservation": "[#] Parity"] Parity
          where Parity.effective.earliest() 42 weeks or less before TheEncounter.lastTimeOfDelivery()
            and Parity.status in { 'final', 'amended', 'corrected' }
            and Parity.value is not null
          sort by effective.earliest()
      ).value as Integer
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define fluent function lastHistoryPretermBirth(TheEncounter Encounter):
      Last(["SimpleObservation": "[#] Births.preterm"] PretermBirth
          where PretermBirth.effective.earliest() 42 weeks or less before TheEncounter.lastTimeOfDelivery()
            and PretermBirth.status in { 'final', 'amended', 'corrected' }
            and PretermBirth.value is not null
          sort by effective.earliest()
      ).value as Integer
Logic Definition | Library Name: CMS0334FHIRPCCesareanBirth
    define fluent function lastHistoryTermBirth(TheEncounter Encounter):
      Last(["SimpleObservation": "[#] Births.term"] TermBirth
          where TermBirth.effective.earliest() 42 weeks or less before TheEncounter.lastTimeOfDelivery()
            and TermBirth.status in { 'final', 'amended', 'corrected' }
            and TermBirth.value is not null
          sort by effective.earliest()
      ).value as Integer
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`
Value Set | Description: Value set Encounter Inpatient Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307`
Value Set | Description: Value set Delivery Procedures Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.59 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.59`
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 ED Visit and OB Triage Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.369 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.369`
Value Set | Description: Value set Estimated Gestational Age at Delivery Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.26 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.26`
Value Set | Description: Value set 37 to 42 Plus Weeks Gestation Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.68 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.68`
Value Set | Description: Value set Delivery of Singleton Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.99 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.99`
Value Set | Description: Value set Cesarean Birth Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.282 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.282`
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 Abnormal Presentation Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.105 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.105`
Value Set | Description: Value set Placenta Accreta Spectrum Previa or Vasa Previa Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.37 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.37`
Value Set | Description: Value set Genital Herpes Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.110.12.1049 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.110.12.1049`
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: Date and time of obstetric delivery Code: 93857-1 System: `http://loinc.org`
Direct Reference Code | Display: Delivery date Estimated Code: 11778-8 System: `http://loinc.org`
Direct Reference Code | Display: [#] Pregnancies Code: 11996-6 System: `http://loinc.org`
Direct Reference Code | Display: [#] Parity Code: 11977-6 System: `http://loinc.org`
Direct Reference Code | Display: [#] Births.preterm Code: 11637-6 System: `http://loinc.org`
Direct Reference Code | Display: [#] Births.term Code: 11639-2 System: `http://loinc.org`
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 SDE Resource: https://madie.cms.gov/Library/SupplementalDataElements|5.1.000 Canonical URL: `https://madie.cms.gov/Library/SupplementalDataElements|5.1.000`
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 PCMaternal Resource: https://madie.cms.gov/Library/PCMaternal|5.25.000 Canonical URL: `https://madie.cms.gov/Library/PCMaternal|5.25.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 QICoreCommon Resource: https://madie.cms.gov/Library/QICoreCommon|4.0.000 Canonical URL: `https://madie.cms.gov/Library/QICoreCommon|4.0.000`
Data Requirements
Data Requirement | Type: Patient Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient Must Support Elements: extension, birthDate, birthDate.value, url
Data Requirement | Type: Encounter Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter Must Support Elements: type, period, status, status.value, reasonCode, id, id.value 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, period, status, status.value, reasonCode, id, id.value Code Filter(s): Path: type ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.369
Data Requirement | Type: Encounter Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter Must Support Elements: type, status, status.value, period, reasonCode, id, id.value Code Filter(s): Path: type ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: code, status, status.value, performed Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.59
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: code, performed, status, status.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.282
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-simple-observation Must Support Elements: code, value, status, status.value, effective Code Filter(s): Path: code Code(s): http://loinc.org#93857-1: 'Date and time of obstetric delivery'
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-simple-observation Must Support Elements: code, value, status, status.value, effective Code Filter(s): Path: code Code(s): http://loinc.org#11778-8: 'Delivery date Estimated'
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-simple-observation Must Support Elements: code, effective, value, status, status.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.26
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-simple-observation Must Support Elements: code, value, status, status.value, effective Code Filter(s): Path: code Code(s): http://loinc.org#11996-6: '[#] Pregnancies'
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-simple-observation Must Support Elements: code, effective, status, status.value, value Code Filter(s): Path: code Code(s): http://loinc.org#11977-6: '[#] Parity'
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-simple-observation Must Support Elements: code, effective, status, status.value, value Code Filter(s): Path: code Code(s): http://loinc.org#11637-6: '[#] Births.preterm'
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-simple-observation Must Support Elements: code, effective, status, status.value, value Code Filter(s): Path: code Code(s): http://loinc.org#11639-2: '[#] Births.term'
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-simple-observation Must Support Elements: value
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-simple-observation Must Support Elements: code, effective, status, status.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.105
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: Coverage Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage Must Support Elements: type, period Code Filter(s): Path: type ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
Generated using version 0.4.8 of the sample-content-ig Liquid templates