Quality Measure Implementation Guide (STU4)
4.0.0 - STU4 United States of America flag

This page is part of the Quality Measure STU2 for FHIR R4 Implementation Guide (v4.0.0: STU4 (v4.0.0)) based on FHIR R4. This is the current published version in its permanent home (it will always be available at this URL). For a full list of available versions, see the Directory of published versions

Example Measure: Breast Cancer Screening

Draft as of 2022-02-22
Id: BCSComponent
Download cql: BCSComponent.cql
Url: Breast Cancer Screening
Version: 0.0.001
Name: BCSComponent
Title: Breast Cancer Screening
Status: draft
Experimental: true
Scoring:

Proportion

Improvement Notation:

increase

Type:

process

Date: 2022-02-22 11:37:03-0600
Publisher: Clinical Quality Information WG
Description:

This is an example only.

Jurisdiction: US
Effective Period: 2022-01-01..2022-12-31
Supplemental Data Elements: SDE Ethnicity SDE Payer SDE Race SDE Sex
Libraries:
BCS Component Library
Related Artifact Dependencies:
  • Supplemental Data Elements Library
  • http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1
  • MAT Global Common Functions FHIR Library
  • Adult Outpatient Encounters Common Library
  • Hospice FHIR Library
  • Advanced Illness and Frailty Exclusion Library
  • http://snomed.info/sct|http://snomed.info/sct/731000124108/version/201709
  • Mammography
  • Office Visit
  • Annual Wellness Visit
  • Preventive Care Services Established Office Visit, 18 and Up
  • Preventive Care Services Initial Office Visit, 18 and Up
  • Home Healthcare Services
  • Payer
  • Encounter Inpatient
  • Hospice Care Ambulatory
  • Status Post Right Mastectomy
  • Unilateral Mastectomy, Unspecified Laterality
  • Right
  • Unilateral Mastectomy Right
  • Status Post Left Mastectomy
  • Left
  • Unilateral Mastectomy Left
  • History of bilateral mastectomy
  • Bilateral Mastectomy
  • Frailty Device
  • Frailty Diagnosis
  • Frailty Encounter
  • Frailty Symptom
  • Outpatient
  • Observation
  • ED
  • Nonacute Inpatient
  • Advanced Illness
  • Acute Inpatient
  • Dementia Medications
  • Care Services in Long Term Residential Facility
  • Nursing Facility Visit
  • Parameters:
    nameuseminmaxtype
    Measurement Period in 0 1 Period
    SDE Sex out 0 1 Coding
    Numerator out 0 1 boolean
    Denominator out 0 1 boolean
    SDE Payer out 0 * Resource
    Initial Population out 0 1 boolean
    SDE Ethnicity out 0 * Coding
    Denominator Exclusion out 0 1 boolean
    SDE Race out 0 * Coding
    DataRequirements:
    TypeMust SupportValueset NameValueset
    Coverage period type Payer Payer
    Patient extension value url
    Encounter type Care Services in Long-Term Residential Facility Care Services in Long Term Residential Facility
    Encounter type Nursing Facility Visit Nursing Facility Visit
    Encounter type Office Visit Office Visit
    Encounter type Annual Wellness Visit Annual Wellness Visit
    Encounter type Preventive Care Services - Established Office Visit, 18 and Up Preventive Care Services Established Office Visit, 18 and Up
    Encounter type Preventive Care Services-Initial Office Visit, 18 and Up Preventive Care Services Initial Office Visit, 18 and Up
    Encounter type Home Healthcare Services Home Healthcare Services
    Encounter period diagnosis type Acute Inpatient Acute Inpatient
    Encounter period hospitalization hospitalization.dischargeDisposition type status Encounter Inpatient Encounter Inpatient
    Encounter period type Frailty Encounter Frailty Encounter
    Encounter type Outpatient Outpatient
    Encounter type Observation Observation
    Encounter type ED ED
    Encounter type Nonacute Inpatient Nonacute Inpatient
    Procedure code performed status Unilateral Mastectomy Left Unilateral Mastectomy Left
    Procedure code performed status Hospice care ambulatory Hospice Care Ambulatory
    Procedure code performed status Bilateral Mastectomy Bilateral Mastectomy
    Procedure code performed status Unilateral Mastectomy Right Unilateral Mastectomy Right
    Condition code Status Post Right Mastectomy Status Post Right Mastectomy
    Condition code Status Post Left Mastectomy Status Post Left Mastectomy
    Condition bodySite code Unilateral Mastectomy, Unspecified Laterality Unilateral Mastectomy, Unspecified Laterality
    Condition code Frailty Diagnosis Frailty Diagnosis
    Condition code id Advanced Illness Advanced Illness
    Condition code onset History of bilateral mastectomy History of bilateral mastectomy
    ServiceRequest code authoredOn intent Hospice care ambulatory Hospice Care Ambulatory
    DeviceRequest code authoredOn Frailty Device Frailty Device
    Observation effective code Frailty Symptom Frailty Symptom
    MedicationDispense whenHandedOver medication Dementia Medications Dementia Medications
    DiagnosticReport effective code status Mammography Mammography
    Direct Reference Codes:
    displaycodesystem
    Discharge to home for hospice care (procedure) 428361000124107 SNOMED CT (all versions)
    Discharge to healthcare facility for hospice care (procedure) 428371000124100 SNOMED CT (all versions)
    Logic Definitions:
    GroupScoringPopulation CriteriaExpression
    Measure scoring:

    Proportion

    Initial Population
    define "Initial Population":   Patient.gender = 'female'       and Global."CalendarAgeInYearsAt" ( FHIRHelpers.ToDate ( Patient.birthDate ), start of "Measurement Period" ) in Interval[51, 74 )       and exists AdultOutpatientEncounters."Qualifying Encounters"
    Denominator
    define "Denominator":   "Initial Population"
    Denominator Exclusion
    define "Denominator Exclusion":   Hospice."Has Hospice"       or ( ( exists "Right Mastectomy Diagnosis"             or exists "Right Mastectomy Procedure"         )           and ( exists "Left Mastectomy"               or exists "Left Mastectomy Procedure"           )       )       or exists "Bilateral Mastectomy Diagnosis"       or exists "Bilateral Mastectomy Procedure"       or Frailty."Advanced Illness and Frailty Exclusion Not Including Over Age 80"       or ( Global."CalendarAgeInYearsAt" ( FHIRHelpers.ToDate ( Patient.birthDate ), start of "Measurement Period" ) >= 65           and Frailty."Long Term Care Periods Longer Than 90 Consecutive Days"       )
    Numerator
    define "Numerator":   exists ( [DiagnosticReport: "Mammography"] Mammogram         where ( Global."Normalize Interval" ( Mammogram.effective ) ends 27 months or less on or before           end of "Measurement Period"         )           and Mammogram.status in { 'final', 'amended', 'corrected', 'appended' }     )
    Library NameName
    SupplementalDataElements SDE Sex
    define "SDE Sex":   case       when Patient.gender = 'male' then Code { code: 'M', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Male' }       when Patient.gender = 'female' then Code { code: 'F', system: 'http://hl7.org/fhir/v3/AdministrativeGender', display: 'Female' }       else null     end
    Library NameName
    BCSComponent SDE Sex
    define "SDE Sex":   SDE."SDE Sex"
    Library NameName
    BCSComponent Numerator
    define "Numerator":   exists ( [DiagnosticReport: "Mammography"] Mammogram         where ( Global."Normalize Interval" ( Mammogram.effective ) ends 27 months or less on or before           end of "Measurement Period"         )           and Mammogram.status in { 'final', 'amended', 'corrected', 'appended' }     )
    Library NameName
    AdultOutpatientEncounters Qualifying Encounters
    define "Qualifying Encounters":  (     [Encounter: "Office Visit"]     union [Encounter: "Annual Wellness Visit"]     union [Encounter: "Preventive Care Services - Established Office Visit, 18 and Up"]     union [Encounter: "Preventive Care Services-Initial Office Visit, 18 and Up"]     union [Encounter: "Home Healthcare Services"]   ) ValidEncounter   where ValidEncounter.period during "Measurement Period"     and ValidEncounter.status  = 'finished'
    Library NameName
    BCSComponent Initial Population
    define "Initial Population":   Patient.gender = 'female'       and Global."CalendarAgeInYearsAt" ( FHIRHelpers.ToDate ( Patient.birthDate ), start of "Measurement Period" ) in Interval[51, 74 )       and exists AdultOutpatientEncounters."Qualifying Encounters"
    Library NameName
    BCSComponent Denominator
    define "Denominator":   "Initial Population"
    Library NameName
    SupplementalDataElements SDE Payer
    define "SDE Payer":   [Coverage: type in "Payer"] Payer         return {           code: Payer.type,           period: Payer.period         }
    Library NameName
    BCSComponent SDE Payer
    define "SDE Payer":   SDE."SDE Payer"
    Library NameName
    SupplementalDataElements SDE Ethnicity
    define "SDE Ethnicity":   (flatten (       Patient.extension Extension         where Extension.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity'           return Extension.extension     )) E       where E.url = 'ombCategory'         or E.url = 'detailed'       return E.value as Coding
    Library NameName
    BCSComponent SDE Ethnicity
    define "SDE Ethnicity":   SDE."SDE Ethnicity"
    Library NameName
    Hospice Has Hospice
    define "Has Hospice":  exists (     [Encounter: "Encounter Inpatient"] DischargeHospice    where DischargeHospice.status = 'finished'       and (          DischargeHospice.hospitalization.dischargeDisposition ~ "Discharge to home for hospice care (procedure)"         or DischargeHospice.hospitalization.dischargeDisposition ~ "Discharge to healthcare facility for hospice care (procedure)"       )     and DischargeHospice.period ends during "Measurement Period"  )     or exists (       [ServiceRequest: "Hospice care ambulatory"] HospiceOrder         where HospiceOrder.intent = 'order'             and HospiceOrder.authoredOn in "Measurement Period"     )     or exists (       [Procedure: "Hospice care ambulatory"] HospicePerformed         where HospicePerformed.status = 'completed'           and Global."Normalize Interval"(HospicePerformed.performed) overlaps "Measurement Period"     )
    Library NameName
    BCSComponent Right Mastectomy Diagnosis
    define "Right Mastectomy Diagnosis":   ( ( [Condition: "Status Post Right Mastectomy"] )       union ( [Condition: "Unilateral Mastectomy, Unspecified Laterality"] UnilateralMastectomyDiagnosis           where UnilateralMastectomyDiagnosis.bodySite in "Right"       ) ) RightMastectomy       where Global."Normalize Interval" ( RightMastectomy.onset ) starts on or before       end of "Measurement Period"
    Library NameName
    BCSComponent Right Mastectomy Procedure
    define "Right Mastectomy Procedure":   [Procedure: "Unilateral Mastectomy Right"] UnilateralMastectomyRightPerformed       where Global."Normalize Interval" ( UnilateralMastectomyRightPerformed.performed ) ends on or before       end of "Measurement Period"         and UnilateralMastectomyRightPerformed.status = 'completed'
    Library NameName
    BCSComponent Left Mastectomy
    define "Left Mastectomy":   ( ( [Condition: "Status Post Left Mastectomy"] )       union ( [Condition: "Unilateral Mastectomy, Unspecified Laterality"] UnilateralMastectomyDiagnosis           where UnilateralMastectomyDiagnosis.bodySite in "Left"       ) ) LeftMastectomy       where Global."Normalize Interval" ( LeftMastectomy.onset ) starts on or before       end of "Measurement Period"
    Library NameName
    BCSComponent Left Mastectomy Procedure
    define "Left Mastectomy Procedure":   [Procedure: "Unilateral Mastectomy Left"] UnilateralMastectomyLeftPerformed       where Global."Normalize Interval" ( UnilateralMastectomyLeftPerformed.performed ) ends on or before       end of "Measurement Period"         and UnilateralMastectomyLeftPerformed.status = 'completed'
    Library NameName
    BCSComponent Bilateral Mastectomy Diagnosis
    define "Bilateral Mastectomy Diagnosis":   [Condition: "History of bilateral mastectomy"] BilateralMastectomyHistory       where Global."Normalize Interval" ( BilateralMastectomyHistory.onset ) starts on or before       end of "Measurement Period"
    Library NameName
    BCSComponent Bilateral Mastectomy Procedure
    define "Bilateral Mastectomy Procedure":   [Procedure: "Bilateral Mastectomy"] BilateralMastectomyPerformed       where Global."Normalize Interval" ( BilateralMastectomyPerformed.performed ) ends on or before       end of "Measurement Period"         and BilateralMastectomyPerformed.status = 'completed'
    Library NameName
    AdvancedIllnessandFrailtyExclusion Has Criteria Indicating Frailty
    define "Has Criteria Indicating Frailty":   //Ask Bryn about devices        exists ( [DeviceRequest: "Frailty Device"] FrailtyDeviceOrder          where FrailtyDeviceOrder.authoredOn during "Measurement Period"        )           // DeviceUseStatement has a known issue with the publication tooling           // so it is removed to allow this IG to publish until that is fixed         //or exists ( [DeviceUseStatement: "Frailty Device"] FrailtyDeviceUse         //  where Global."Normalize Interval"(FrailtyDeviceUse.timing) overlaps "Measurement Period"         //)         or exists ( [Condition: "Frailty Diagnosis"] FrailtyDiagnosis           where Global."Prevalence Period"(FrailtyDiagnosis) overlaps "Measurement Period"         )         or exists ( [Encounter: "Frailty Encounter"] FrailtyEncounter           where FrailtyEncounter.period overlaps "Measurement Period"         )         or exists ( [Observation: "Frailty Symptom"] FrailtySymptomObservation           where Global."Normalize Interval"(FrailtySymptomObservation.effective) overlaps "Measurement Period"         )
    Library NameName
    AdvancedIllnessandFrailtyExclusion Outpatient Encounters with Advanced Illness
    define "Outpatient Encounters with Advanced Illness":   ( [Encounter: "Outpatient"]         union [Encounter: "Observation"]         union [Encounter: "ED"]         union [Encounter: "Nonacute Inpatient"] ) OutpatientEncounter          with [Condition: "Advanced Illness"] AdvancedIllnessDiagnosis                   such that exists (                       OutpatientEncounter.diagnosis.condition EncounterDiagnosis                           where EndsWith(EncounterDiagnosis.reference, AdvancedIllnessDiagnosis.id)                   )                   and OutpatientEncounter.period starts 2 years or less on or before          end of "Measurement Period"
    Library NameName
    AdvancedIllnessandFrailtyExclusion Inpatient Encounter with Advanced Illness
    define "Inpatient Encounter with Advanced Illness":   [Encounter: "Acute Inpatient"] InpatientEncounter         with [Condition: "Advanced Illness"] AdvancedIllnessDiagnosis                   such that exists (                       InpatientEncounter.diagnosis.condition EncounterDiagnosis                           where EndsWith(EncounterDiagnosis.reference, AdvancedIllnessDiagnosis.id)                   )          and InpatientEncounter.period starts 2 years or less on or before          end of "Measurement Period"
    Library NameName
    AdvancedIllnessandFrailtyExclusion Dementia Medications In Year Before or During Measurement Period
    define "Dementia Medications In Year Before or During Measurement Period":   ["MedicationDispense": "Dementia Medications"] DementiaMed         where DementiaMed.whenHandedOver during Interval[                   ( start of "Measurement Period" - 1 year ), end of "Measurement Period"               ]
    Library NameName
    AdvancedIllnessandFrailtyExclusion Advanced Illness and Frailty Exclusion Not Including Over Age 80
    define "Advanced Illness and Frailty Exclusion Not Including Over Age 80":   //If the measure does NOT include populations age 80 and older, then use this logic:        Global."CalendarAgeInYearsAt"(FHIRHelpers.ToDate(Patient.birthDate), start of "Measurement Period")>= 65               and "Has Criteria Indicating Frailty"               and ( Count("Outpatient Encounters with Advanced Illness")>= 2                   or exists ( "Inpatient Encounter with Advanced Illness" )                   or exists "Dementia Medications In Year Before or During Measurement Period"               )
    Library NameName
    AdvancedIllnessandFrailtyExclusion Long Term Care Periods During Measurement Period
    // start here define "Long Term Care Periods During Measurement Period":   ( [Encounter: "Care Services in Long-Term Residential Facility"]                 union [Encounter: "Nursing Facility Visit"] ) LongTermFacilityEncounter                 where LongTermFacilityEncounter.period overlaps "Measurement Period"                 return LongTermFacilityEncounter.period                  intersect "Measurement Period"
    Library NameName
    AdvancedIllnessandFrailtyExclusion Long Term Care Periods Longer Than 90 Consecutive Days
    define "Long Term Care Periods Longer Than 90 Consecutive Days":   exists ( "Long Term Care Periods During Measurement Period" LongTermCareDuringMP         where duration in days of LongTermCareDuringMP > 90     )
    Library NameName
    BCSComponent Denominator Exclusion
    define "Denominator Exclusion":   Hospice."Has Hospice"       or ( ( exists "Right Mastectomy Diagnosis"             or exists "Right Mastectomy Procedure"         )           and ( exists "Left Mastectomy"               or exists "Left Mastectomy Procedure"           )       )       or exists "Bilateral Mastectomy Diagnosis"       or exists "Bilateral Mastectomy Procedure"       or Frailty."Advanced Illness and Frailty Exclusion Not Including Over Age 80"       or ( Global."CalendarAgeInYearsAt" ( FHIRHelpers.ToDate ( Patient.birthDate ), start of "Measurement Period" ) >= 65           and Frailty."Long Term Care Periods Longer Than 90 Consecutive Days"       )
    Library NameName
    SupplementalDataElements SDE Race
    define "SDE Race":   (flatten (       Patient.extension Extension         where Extension.url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race'           return Extension.extension     )) E       where E.url = 'ombCategory'         or E.url = 'detailed'       return E.value as Coding
    Library NameName
    BCSComponent SDE Race
    define "SDE Race":   SDE."SDE Race"

    Contained resources