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: CMS122FHIRDiabetesAssessGT9Pct

Official URL: https://madie.cms.gov/Library/CMS122FHIRDiabetesAssessGT9Pct Version: 1.1.000
Active as of 2025-07-25 Responsible: National Committee for Quality Assurance Computable Name: CMS122FHIRDiabetesAssessGT9Pct

CMS122FHIRDiabetesAssessGT9Pct

Metadata
Title CMS122FHIRDiabetesAssessGT9Pct
Version 1.1.000
Topic FHIR
Topic CQL
Steward (Publisher) National Committee for Quality Assurance
Description

CMS122FHIRDiabetesAssessGT9Pct

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 CMD
Resource: http://hl7.org/fhir/us/cql/Library/CumulativeMedicationDuration|2.0.0-ballot
Canonical URL: http://hl7.org/fhir/us/cql/Library/CumulativeMedicationDuration|2.0.0-ballot
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 SDE
Resource: SupplementalDataElementsversion: null6.1.000)
Canonical URL: https://madie.cms.gov/Library/SupplementalDataElements|6.1.000
Dependency Description: Code System LOINC
Resource: Logical Observation Identifiers, Names and Codes (LOINC)
Canonical URL: http://loinc.org
Dependency Description: Code System SNOMEDCT
Resource: SNOMED CT (all versions)
Canonical URL: http://snomed.info/sct
Dependency Description: Value Set Adolescent Depression Medications
Resource: Adolescent Depression Medications
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1567
Dependency Description: Value Set Adult Depression Medications
Resource: Adult Depression Medications
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1566
Dependency Description: Value Set Bipolar Disorder
Resource: Bipolar Disorder
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.67.1.101.1.128
Dependency Description: Value Set Encounter to Screen for Depression
Resource: Encounter to Screen for Depression
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1916
Dependency Description: Value Set Follow Up for Adolescent Depression
Resource: Follow Up for Adolescent Depression
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1569
Dependency Description: Value Set Follow Up for Adult Depression
Resource: Follow Up for Adult Depression
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1568
Dependency Description: Value Set Medical Reason
Resource: Medical Reason
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1007
Dependency Description: Value Set Physical Therapy Evaluation
Resource: Physical Therapy Evaluation
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1022
Dependency Description: Value Set Referral for Adolescent Depression
Resource: Referral for Adolescent Depression
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1570
Dependency Description: Value Set Referral for Adult Depression
Resource: Referral for Adult Depression
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1571
Dependency Description: Value Set Telephone Visits
Resource: Telephone Visits
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080
Data Requirement Type: Encounter
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-encounter
Code Filter(s):
Path: type
ValueSet: Encounter to Screen for Depression
Data Requirement Type: Encounter
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-encounter
Code Filter(s):
Path: type
ValueSet: Physical Therapy Evaluation
Data Requirement Type: Encounter
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-encounter
Code Filter(s):
Path: type
ValueSet: Telephone Visits
Data Requirement Type: Condition
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-condition-problems-health-concerns
Code Filter(s):
Path: code
ValueSet: Bipolar Disorder
Data Requirement Type: ServiceRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-servicerequest
Code Filter(s):
Path: code
ValueSet: Referral for Adolescent Depression
Data Requirement Type: Procedure
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-procedure
Code Filter(s):
Path: code
ValueSet: Follow Up for Adolescent Depression
Data Requirement Type: MedicationRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-medicationrequest
Data Requirement Type: Medication
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-medication
Data Requirement Type: ServiceRequest
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-servicerequest
Code Filter(s):
Path: code
ValueSet: Referral for Adult Depression
Data Requirement Type: Procedure
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-procedure
Code Filter(s):
Path: code
ValueSet: Follow Up for Adult Depression
Data Requirement Type: Observation
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-observation-screening-assessment
Code Filter(s):
Path: code
Code(s): LOINC: 73831-0 (Adolescent depression screening assessment)
Data Requirement Type: Observation
Profile(s): http://fhir.org/guides/astp/us-quality-core/StructureDefinition/us-quality-core-observation-screening-assessment
Code Filter(s):
Path: code
Code(s): LOINC: 73832-8 (Adult depression screening assessment)
Parameters
Name Use Card. Type Documentation
Measurement Period In 0..1 Period
Patient Out 0..1 Resource
Patient Age 12 Years or Older at Start of Measurement Period Out 0..1 boolean
Qualifying Encounter During Measurement Period Out 0..* Resource
Initial Population Out 0..1 boolean
Denominator Out 0..1 boolean
History of Bipolar Diagnosis Before Qualifying Encounter Out 0..* Resource
Denominator Exclusions Out 0..1 boolean
Patient Age 12 to 16 Years at Start of Measurement Period Out 0..1 boolean
Most Recent Adolescent Depression Screening Out 0..1 Resource
Has Most Recent Adolescent Screening Negative Out 0..1 boolean
Follow Up Intervention for Positive Adolescent Depression Screening Out 0..* Resource
Most Recent Adolescent Depression Screening Positive and Follow Up Provided Out 0..* Resource
Patient Age 17 Years at Start of Measurement Period Out 0..1 boolean
Most Recent Adult Depression Screening Out 0..1 Resource
Has Most Recent Adult Screening Negative Out 0..1 boolean
Follow Up Intervention for Positive Adult Depression Screening Out 0..* Resource
Most Recent Adult Depression Screening Positive and Follow Up Provided Out 0..* Resource
Patient Age 18 Years or Older at Start of Measurement Period Out 0..1 boolean
Numerator Out 0..1 boolean
Denominator Exceptions Out 0..1 boolean
Has Adolescent Depression Screening Out 0..1 boolean
Has Adult Depression Screening Out 0..1 boolean
SDE Ethnicity Out 0..1 Resource
SDE Payer Out 0..* Resource
SDE Race Out 0..1 Resource
SDE Sex Out 0..1 Coding
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 CMS2FHIRPCSDepScreenAndFollowUp version '1.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.CumulativeMedicationDuration version '2.0.0-ballot' called CMD
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 SupplementalDataElements version '6.1.000' called SDE

codesystem "LOINC": 'http://loinc.org'
codesystem "SNOMEDCT": 'http://snomed.info/sct'

valueset "Adolescent Depression Medications": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1567'
valueset "Adult Depression Medications": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1566'
valueset "Bipolar Disorder": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.67.1.101.1.128'
valueset "Encounter to Screen for Depression": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1916'
valueset "Follow Up for Adolescent Depression": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1569'
valueset "Follow Up for Adult Depression": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1568'
valueset "Medical Reason": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1007'
valueset "Physical Therapy Evaluation": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1022'
valueset "Referral for Adolescent Depression": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1570'
valueset "Referral for Adult Depression": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1571'
valueset "Telephone Visits": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080'

code "Adolescent depression screening assessment": '73831-0' from "LOINC" display 'Adolescent depression screening assessment'
code "Adult depression screening assessment": '73832-8' from "LOINC" display 'Adult depression screening assessment'
code "Depression screening declined (situation)": '720834000' from "SNOMEDCT" display 'Depression screening declined (situation)'
code "Depression screening negative (finding)": '428171000124102' from "SNOMEDCT" display 'Depression screening negative (finding)'
code "Depression screening positive (finding)": '428181000124104' from "SNOMEDCT" display 'Depression screening positive (finding)'

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

context Patient

define "Initial Population":
  "Patient Age 12 Years or Older at Start of Measurement Period"
    and exists ( "Qualifying Encounter During Measurement Period" )

define "Denominator":
  "Initial Population"

define "Denominator Exclusions":
  exists "History of Bipolar Diagnosis Before Qualifying Encounter"

define "Numerator":
  ( "Patient Age 12 to 16 Years at Start of Measurement Period"
      and ( "Has Most Recent Adolescent Screening Negative"
          or exists "Most Recent Adolescent Depression Screening Positive and Follow Up Provided"
      )
  )
    or ( "Patient Age 17 Years at Start of Measurement Period"
        and ( "Has Most Recent Adolescent Screening Negative"
            or exists "Most Recent Adolescent Depression Screening Positive and Follow Up Provided"
            or "Has Most Recent Adult Screening Negative"
            or exists "Most Recent Adult Depression Screening Positive and Follow Up Provided"
        )
    )
    or ( "Patient Age 18 Years or Older at Start of Measurement Period"
        and ( "Has Most Recent Adult Screening Negative"
            or exists "Most Recent Adult Depression Screening Positive and Follow Up Provided"
        )
    )

define "Denominator Exceptions":
  false
/*
TODO: Need to reassess how we are representing given no ObservationCancelled profile
  ( exists "Medical or Patient Reason for Not Screening Adolescent for Depression"
      and not "Has Adolescent Depression Screening"
  )
    or ( exists "Medical or Patient Reason for Not Screening Adult for Depression"
        and not "Has Adult Depression Screening"
    )
*/

define "Follow Up Intervention for Positive Adolescent Depression Screening":
  ( ( [USQualityCore.MedicationRequest: "Adolescent Depression Medications"] AdolescentMed
        with "Qualifying Encounter During Measurement Period" QualifyingEncounter
          such that "Most Recent Adolescent Depression Screening".effective.toInterval ( ) starts 14 days or less on or before day of start of QualifyingEncounter.period
            and AdolescentMed.medicationRequestPeriod ( ) overlaps after day of QualifyingEncounter.period
            and "Most Recent Adolescent Depression Screening".value ~ "Depression screening positive (finding)"
            and AdolescentMed.status in { 'active', 'completed' }
            and AdolescentMed.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
    )
      union ( [USQualityCore.ServiceRequest: "Referral for Adolescent Depression"] AdolescentReferral
          where AdolescentReferral.status in { 'active', 'completed' }
      )
      union ( [USQualityCore.Procedure: "Follow Up for Adolescent Depression"] AdolescentFollowUp
          where AdolescentFollowUp.status = 'completed'
      )
  )

define "Follow Up Intervention for Positive Adult Depression Screening":
  ( ( [USQualityCore.MedicationRequest: "Adult Depression Medications"] AdultMed
        with "Qualifying Encounter During Measurement Period" QualifyingEncounter
          such that "Most Recent Adult Depression Screening".effective.toInterval ( ) starts 14 days or less on or before day of start of QualifyingEncounter.period
            and AdultMed.medicationRequestPeriod ( ) overlaps after day of QualifyingEncounter.period
            and "Most Recent Adult Depression Screening".value ~ "Depression screening positive (finding)"
            and AdultMed.status in { 'active', 'completed' }
            and AdultMed.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
    )
      union ( [USQualityCore.ServiceRequest: "Referral for Adult Depression"] AdultReferral
          where AdultReferral.status in { 'active', 'completed' }
      )
      union ( [USQualityCore.Procedure: "Follow Up for Adult Depression"] AdultFollowUp
          where AdultFollowUp.status = 'completed'
      )
  )

define "Has Adolescent Depression Screening":
  exists ( [USQualityCore.ObservationScreeningAssessment: "Adolescent depression screening assessment"] AdolescentScreening
      with "Qualifying Encounter During Measurement Period" QualifyingEncounter
        such that AdolescentScreening.effective.toInterval ( ) 14 days or less on or before day of start of QualifyingEncounter.period
          and AdolescentScreening.value is not null
          and AdolescentScreening.status in { 'final', 'amended', 'corrected' }
  )

define "Has Adult Depression Screening":
  exists ( [USQualityCore.ObservationScreeningAssessment: "Adult depression screening assessment"] AdultScreening
      with "Qualifying Encounter During Measurement Period" QualifyingEncounter
        such that AdultScreening.effective.toInterval ( ) 14 days or less on or before day of start of QualifyingEncounter.period
          and AdultScreening.value is not null
          and AdultScreening.status in { 'final', 'amended', 'corrected' }
  )

define "Has Most Recent Adolescent Screening Negative":
  ( "Most Recent Adolescent Depression Screening" AdolescentScreen
      where AdolescentScreen.value ~ "Depression screening negative (finding)"
  ) is not null

define "Has Most Recent Adult Screening Negative":
  ( "Most Recent Adult Depression Screening" AdultScreen
      where AdultScreen.value ~ "Depression screening negative (finding)"
  ) is not null

define "History of Bipolar Diagnosis Before Qualifying Encounter":
  [USQualityCore.ConditionProblemsHealthConcerns: "Bipolar Disorder"] BipolarDiagnosis
    with "Qualifying Encounter During Measurement Period" QualifyingEncounter
      such that BipolarDiagnosis.prevalenceInterval ( ) starts before day of start of QualifyingEncounter.period

/*
TODO: Needs to be reassessed given the pattern change for ObservationCancelled, this should really be a ServiceRequest with a TaskRejected, yes?
define "Medical or Patient Reason for Not Screening Adolescent for Depression":
  [USQualityCore.ObservationCancelled: code ~ "Adolescent depression screening assessment"] NoAdolescentScreen
    with "Qualifying Encounter During Measurement Period" QualifyingEncounter
      such that NoAdolescentScreen.issued during day of QualifyingEncounter.period
    where ( NoAdolescentScreen.notDoneReason ~ "Depression screening declined (situation)"
        or NoAdolescentScreen.notDoneReason in "Medical Reason"
    )

define "Medical or Patient Reason for Not Screening Adult for Depression":
  [USQualityCore.ObservationCancelled: code ~ "Adult depression screening assessment"] NoAdultScreen
    with "Qualifying Encounter During Measurement Period" QualifyingEncounter
      such that NoAdultScreen.issued during day of QualifyingEncounter.period
    where ( NoAdultScreen.notDoneReason ~ "Depression screening declined (situation)"
        or NoAdultScreen.notDoneReason in "Medical Reason"
    )
*/

define "Most Recent Adolescent Depression Screening":
  Last([USQualityCore.ObservationScreeningAssessment: "Adolescent depression screening assessment"] AdolescentDepressionScreening
      with "Qualifying Encounter During Measurement Period" QualifyingEncounter
        such that AdolescentDepressionScreening.effective.toInterval() 14 days or less on or before day of start of QualifyingEncounter.period
          and AdolescentDepressionScreening.value is not null
          and AdolescentDepressionScreening.status in { 'final', 'amended', 'corrected' }
      sort by start of effective.toInterval()
  )

define "Most Recent Adolescent Depression Screening Positive and Follow Up Provided":
  from
    "Most Recent Adolescent Depression Screening" LastAdolescentScreen,
    "Follow Up Intervention for Positive Adolescent Depression Screening" FollowUpPositiveAdolescentScreen,
    "Qualifying Encounter During Measurement Period" QualifyingEncounter
    where LastAdolescentScreen.effective.toInterval ( ) starts 14 days or less on or before day of start of QualifyingEncounter.period
      and LastAdolescentScreen.value ~ "Depression screening positive (finding)"
      and ( start of FollowUpPositiveAdolescentScreen.performed.toInterval ( ) during QualifyingEncounter.period
          or FollowUpPositiveAdolescentScreen.authoredOn 2 days or less on or after day of end of QualifyingEncounter.period
      )
      and ( Coalesce(start of FollowUpPositiveAdolescentScreen.performed.toInterval(), FollowUpPositiveAdolescentScreen.authoredOn) during day of "Measurement Period" )

define "Most Recent Adult Depression Screening":
  Last([USQualityCore.ObservationScreeningAssessment: "Adult depression screening assessment"] AdultDepressionScreening
      with "Qualifying Encounter During Measurement Period" QualifyingEncounter
        such that AdultDepressionScreening.effective.toInterval() 14 days or less on or before day of start of QualifyingEncounter.period
          and AdultDepressionScreening.value is not null
          and AdultDepressionScreening.status in { 'final', 'amended', 'corrected' }
      sort by start of effective.toInterval()
  )

define "Most Recent Adult Depression Screening Positive and Follow Up Provided":
  from
    "Most Recent Adult Depression Screening" LastAdultScreen,
    "Follow Up Intervention for Positive Adult Depression Screening" FollowUpPositiveAdultScreen,
    "Qualifying Encounter During Measurement Period" QualifyingEncounter
    where LastAdultScreen.effective.toInterval ( ) starts 14 days or less on or before day of start of QualifyingEncounter.period
      and LastAdultScreen.value ~ "Depression screening positive (finding)"
      and ( start of FollowUpPositiveAdultScreen.performed.toInterval ( ) during QualifyingEncounter.period
          or FollowUpPositiveAdultScreen.authoredOn 2 days or less on or after day of end of QualifyingEncounter.period
      )
      and ( Coalesce(start of FollowUpPositiveAdultScreen.performed.toInterval(), FollowUpPositiveAdultScreen.authoredOn) during day of "Measurement Period" )

define "Patient Age 12 to 16 Years at Start of Measurement Period":
  AgeInYearsAt(date from start of "Measurement Period") in Interval[12, 16]

define "Patient Age 12 Years or Older at Start of Measurement Period":
  AgeInYearsAt(date from start of "Measurement Period") >= 12

define "Patient Age 17 Years at Start of Measurement Period":
  AgeInYearsAt(date from start of "Measurement Period") = 17

define "Patient Age 18 Years or Older at Start of Measurement Period":
  AgeInYearsAt(date from start of "Measurement Period") >= 18

define "Qualifying Encounter During Measurement Period":
  ( [USQualityCore.Encounter: "Encounter to Screen for Depression"]
    union [USQualityCore.Encounter: "Physical Therapy Evaluation"]
    union [USQualityCore.Encounter: "Telephone Visits"] ) QualifyingEncounter
    where QualifyingEncounter.period during day of "Measurement Period"
      and QualifyingEncounter.status = 'finished'

define "SDE Ethnicity":
  SDE."SDE Ethnicity"

define "SDE Payer":
  SDE."SDE Payer"

define "SDE Race":
  SDE."SDE Race"

define "SDE Sex":
  SDE."SDE Sex"
ELM XML Content
Encoded data 
ELM JSON Content
Encoded data 
Generated using version 0.5.4 of the sample-content-ig Liquid templates