Draft dQM CMS Content Implementation Guide
2025.1.0 - CI Build

Draft dQM CMS Content Implementation Guide, published by cqframework. This guide is not an authorized publication; it is the continuous build for version 2025.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/dqm-content-cms-2025/ and changes regularly. See the Directory of published versions

Library: PCMaternal

Official URL: https://madie.cms.gov/Library/PCMaternal Version: 6.1.000
Active as of 2025-08-25 Responsible: The Joint Commission Computable Name: PCMaternal
Other Identifiers: https://madie.cms.gov/login#68560e060d70b65363c69eea (use: official, )

This library specifies common data elements used by PC01, PC02, PC07.

Metadata
Title PCMaternal
Version 6.1.000
Identifier 68560e060d70b65363c69eea
Topic FHIR
Topic CQL
Steward (Publisher) The Joint Commission
Description

This library specifies common data elements used by PC01, PC02, PC07.

Type logic-library from http://terminology.hl7.org/CodeSystem/library-type
Dependency Description: Model USQualityCore
Resource: https://madie.cms.gov/Library/USQualityCore-ModelInfo|0.1.0-cibuild
Canonical URL: https://madie.cms.gov/Library/USQualityCore-ModelInfo|0.1.0-cibuild
Dependency Description: Library FHIRHelpers
Resource: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1
Canonical URL: http://hl7.org/fhir/uv/cql/Library/FHIRHelpers|4.0.1
Dependency Description: Library FHIRCommon
Resource: http://hl7.org/fhir/uv/cql/Library/FHIRCommon|2.0.0
Canonical URL: http://hl7.org/fhir/uv/cql/Library/FHIRCommon|2.0.0
Dependency Description: Library USCoreCommon
Resource: http://hl7.org/fhir/us/cql/Library/USCoreCommon|2.0.0-ballot
Canonical URL: http://hl7.org/fhir/us/cql/Library/USCoreCommon|2.0.0-ballot
Dependency Description: Library USCoreElements
Resource: http://hl7.org/fhir/us/cql/Library/USCoreElements|2.0.0-ballot
Canonical URL: http://hl7.org/fhir/us/cql/Library/USCoreElements|2.0.0-ballot
Dependency Description: Library USQualityCoreCommon
Resource: US Quality Core Commonversion: null0.1.0-cibuild)
Canonical URL: https://madie.cms.gov/Library/USQualityCoreCommon|0.1.0-cibuild
Dependency Description: Library CQMCommon
Resource: CQMCommonversion: null5.1.000)
Canonical URL: https://madie.cms.gov/Library/CQMCommon|5.1.000
Dependency Description: Code System LOINC
Resource: Logical Observation Identifiers, Names and Codes (LOINC)
Canonical URL: http://loinc.org
Dependency Description: Value Set Delivery Procedures
Resource: Delivery Procedures
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.59
Dependency Description: Value Set ED Visit and OB Triage
Resource: ED Visit and OB Triage
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.369
Dependency Description: Value Set Encounter Inpatient
Resource: Encounter Inpatient
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307
Dependency Description: Value Set Estimated Gestational Age at Delivery
Resource: Estimated Gestational Age at Delivery
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.26
Dependency Description: Value Set Observation Services
Resource: Observation Services
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143
Data Requirement Type: Procedure
Profile(s): Procedure
Code Filter(s):
Path: code
ValueSet: Delivery Procedures
Data Requirement Type: Encounter
Profile(s): Encounter
Code Filter(s):
Path: type
ValueSet: Observation Services
Data Requirement Type: Encounter
Profile(s): Encounter
Code Filter(s):
Path: type
ValueSet: ED Visit and OB Triage
Data Requirement Type: Observation
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-simple-observation
Code Filter(s):
Path: code
Code(s): LOINC: 11778-8 (Delivery date Estimated)
Data Requirement Type: Observation
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-simple-observation
Code Filter(s):
Path: code
ValueSet: Estimated Gestational Age at Delivery
Data Requirement Type: Observation
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-simple-observation
Code Filter(s):
Path: code
Code(s): LOINC: 93857-1 (Date and time of obstetric delivery)
Parameters
Name Use Card. Type Documentation
Measurement Period In 0..1 Period
Patient Out 0..1 Resource
Encounter With Age Range Out 0..* Encounter
Delivery Encounter With Age Range Out 0..* Encounter
Variable Calculated Gestational Age Out 0..* Resource
Library Content
CQL Content
/*
NOTE: For use by March 2026 US Realm Connectathon participants for internal use only. Not for use or distribution in commercial products.
*/
library PCMaternal version '6.1.000'

using USQualityCore version '0.1.0-cibuild'
using USCore version '6.1.0-derived'
using FHIR version '4.0.1'

include hl7.fhir.uv.cql.FHIRHelpers version '4.0.1' called FHIRHelpers
include hl7.fhir.uv.cql.FHIRCommon version '2.0.0' called FHIRCommon
include hl7.fhir.us.cql.USCoreCommon version '2.0.0-ballot' called USCoreCommon
include hl7.fhir.us.cql.USCoreElements version '2.0.0-ballot' called USCoreElements

include USQualityCoreCommon version '0.1.0-cibuild' called USQualityCoreCommon
include CQMCommon version '5.1.000' called CQMCommon

codesystem "LOINC": 'http://loinc.org' 

valueset "Delivery Procedures": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.59' 
valueset "ED Visit and OB Triage": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1029.369' 
valueset "Encounter Inpatient": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.666.5.307' 
valueset "Estimated Gestational Age at Delivery": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1045.26' 
valueset "Observation Services": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143' 

code "Date and time of obstetric delivery": '93857-1' from "LOINC" display 'Date and time of obstetric delivery'
code "Delivery date Estimated": '11778-8' from "LOINC" display 'Delivery date Estimated'

parameter "Measurement Period" Interval<DateTime>
  default Interval[@2026-01-01T00:00:00.000Z, @2027-01-01T00:00:00.000Z)

context Patient

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 ()

define "Encounter With Age Range":
  CQMCommon."Inpatient Encounter" InpatientEncounter
    where AgeInYearsAt(date from start of InpatientEncounter.period) in Interval[ 8, 65 )
                  

define "Variable Calculated Gestational Age":
 "Delivery Encounter With Age Range" DeliveryEncounter
    let CGA: DeliveryEncounter.calculatedGestationalAge()
    return {
      EncounterID: DeliveryEncounter.id,
      CalculatedCGA: CGA
    }

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

    
    
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]
  

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 FHIR.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 FHIR.dateTime


  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

define fluent function lastTimeOfDelivery (TheEncounter Encounter ):
  Last(["SimpleObservation": "Date and time of obstetric delivery"] TimeOfDelivery
      where TimeOfDelivery.value as FHIR.dateTime is not null
        and TimeOfDelivery.status in { 'final', 'amended', 'corrected' }
        and TimeOfDelivery.effective.earliest () during TheEncounter.hospitalizationWithEDOBTriageObservation ()
        and TimeOfDelivery.value as FHIR.dateTime during TheEncounter.hospitalizationWithEDOBTriageObservation()
      sort by effective.earliest()
  ).value as FHIR.dateTime
ELM XML Content
Encoded data 
ELM JSON Content
Encoded data 
Generated using version 0.5.4 of the sample-content-ig Liquid templates