eCQM QICore Content Implementation Guide
2025.0.0 - CI Build

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

Library: CMS645FHIRBoneDensityProstateCancerAndrogenDeprivationTherapy

Official URL: https://madie.cms.gov/Library/CMS645FHIRBoneDensityProstateCancerAndrogenDeprivationTherapy Version: 1.5.000
Active as of 2025-04-15 Responsible: Oregon Urology Computable Name: CMS645FHIRBoneDensityProstateCancerAndrogenDeprivationTherapy
Other Identifiers: https://madie.cms.gov/login#CMS645FHIRBoneDensityProstateCancerAndrogenDeprivationTherapy (use: official, )

CMS645FHIRBoneDensityProstateCancerAndrogenDeprivationTherapy

Title: CMS645FHIRBoneDensityProstateCancerAndrogenDeprivationTherapy
Id: CMS645FHIRBoneDensityProstateCancerAndrogenDeprivationTherapy
Version: 1.5.000
Url: https://madie.cms.gov/Library/CMS645FHIRBoneDensityProstateCancerAndrogenDeprivationTherapy
official

CMS645FHIRBoneDensityProstateCancerAndrogenDeprivationTherapy

Type:

system: http://terminology.hl7.org/CodeSystem/library-type

code: logic-library

Date: 2025-04-15T18:57:39+00:00
Publisher: Oregon Urology
Description: CMS645FHIRBoneDensityProstateCancerAndrogenDeprivationTherapy
Related Artifacts:

Dependencies

  • https://madie.cms.gov/Library/SupplementalDataElements|5.1.000
  • https://madie.cms.gov/Library/FHIRHelpers|4.4.000
  • https://madie.cms.gov/Library/QICoreCommon|4.0.000
  • http://snomed.info/sct
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.359
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.352
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.319
  • http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001
Data Requirements:
TypeProfileMSCode Filter
Patient http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient ;;
ServiceRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest ;;;;;;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.359
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest ; code filter:
path: medication
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.352
MedicationRequest http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest ;
Medication http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medication ;;
Condition http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns ; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.319
Condition http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis ; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.319
Observation http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation-lab ;;;; code filter:
path: code
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.359
Coverage http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage ;; code filter:
path: type
value set: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
Content: text/cql
library CMS645FHIRBoneDensityProstateCancerAndrogenDeprivationTherapy version '1.5.000'

using QICore version '6.0.0'

include FHIRHelpers version '4.4.000' called FHIRHelpers
include SupplementalDataElements version '5.1.000' called SDE
include QICoreCommon version '4.0.000' called QICoreCommon

codesystem "SNOMEDCT": 'http://snomed.info/sct'

valueset "Androgen Deprivation Therapy for Urology Care": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.352'
valueset "DEXA Bone Density for Urology Care": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1248.359'
valueset "Office Visit": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001'
valueset "Patient Declined": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1582'
valueset "Prostate Cancer": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.319'

code "Injection of leuprolide acetate for twelve month period (regime/therapy)": '456381000124102' from "SNOMEDCT" display 'Injection of leuprolide acetate for twelve month period (regime/therapy)'

parameter "Measurement Period" Interval<DateTime>

context Patient

define "Initial Population":
  "Has Qualifying Encounter"
    and exists "Order for 12 Months of ADT in 3 Months Before to 9 Months After Start of Measurement Period"

define "Denominator":
  "Initial Population"

define "Numerator":
  "Has Baseline DEXA Scan Two Years Prior to the Start of or Less than Three Months After the Start of ADT"

define "Denominator Exception":
  false
  // @commmentedOutReason: Negation issue related to https://github.com/cqframework/cql-execution/issues/296,
  //                       which is tied to https://oncprojectracking.healthit.gov/support/browse/BONNIEMAT-1455.
  //                       Due to this being the only logic in population, created a 'false' placeholder
  // exists ( "No Bone Density Scan Ordered Due to Patient Refusal")
  //   or exists ( "No Bone Density Scan Performed Due to Patient Refusal")  






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

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

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

define "SDE Sex":
  SDE."SDE Sex"

define "Has Baseline DEXA Scan Two Years Prior to the Start of or Less than Three Months After the Start of ADT":
  exists ( ( [ServiceRequest: "DEXA Bone Density for Urology Care"] DEXAOrdered
        with "Order for 12 Months of ADT in 3 Months Before to 9 Months After Start of Measurement Period" OrderTwelveMonthsADT
          such that DEXAOrdered.authoredOn 3 months or less on or after day of OrderTwelveMonthsADT.authoredOn
            or DEXAOrdered.authoredOn 2 years or less before day of OrderTwelveMonthsADT.authoredOn
        where DEXAOrdered.status in { 'active', 'completed' }
          and DEXAOrdered.intent = 'order'
          and DEXAOrdered.doNotPerform is not true
    )
      union ( [LaboratoryResultObservation: "DEXA Bone Density for Urology Care"] DEXAPerformed
          with "Order for 12 Months of ADT in 3 Months Before to 9 Months After Start of Measurement Period" OrderTwelveMonthsADT
            such that DEXAPerformed.effective.toInterval ( ) 3 months or less on or after day of OrderTwelveMonthsADT.authoredOn
              or DEXAPerformed.effective.toInterval ( ) 2 years or less before day of OrderTwelveMonthsADT.authoredOn
          where DEXAPerformed.status in { 'final', 'amended', 'corrected' }
      )
  )

define "No Bone Density Scan Ordered Due to Patient Refusal":
  [ServiceNotRequested: "DEXA Bone Density for Urology Care"] DEXANotOrdered
    with "Order for 12 Months of ADT in 3 Months Before to 9 Months After Start of Measurement Period" OrderTwelveMonthsADT
      such that DEXANotOrdered.authoredOn 3 months or less on or after day of OrderTwelveMonthsADT.authoredOn
        and DEXANotOrdered.reasonRefused in "Patient Declined"

define "No Bone Density Scan Performed Due to Patient Refusal":
  [ObservationCancelled: "DEXA Bone Density for Urology Care"] DEXANotPerformed
    with "Order for 12 Months of ADT in 3 Months Before to 9 Months After Start of Measurement Period" OrderTwelveMonthsADT
      such that DEXANotPerformed.issued 3 months or less on or after day of OrderTwelveMonthsADT.authoredOn
        and DEXANotPerformed.notDoneReason in "Patient Declined"

define "First ADT in 3 Months Before to 9 Months After Start of Measurement Period":
  First(("Androgen Deprivation Therapy for Urology Care Medication Active Start Dates"
      union "Androgen Deprivation Therapy for Urology Care Medication Order Start Dates") ADTDateTime
      with "Prostate Cancer Diagnosis" ProstateCancer
        such that ADTDateTime during day of ProstateCancer.prevalenceInterval()
          and ADTDateTime during day of Interval[start of "Measurement Period" - 3 months, start of "Measurement Period" + 9 months]
      sort ascending
  )

define "Order for 12 Months of ADT in 3 Months Before to 9 Months After Start of Measurement Period":
  [ServiceRequest: "Injection of leuprolide acetate for twelve month period (regime/therapy)"] OrderTwelveMonthADT
    with "First ADT in 3 Months Before to 9 Months After Start of Measurement Period" FirstADTMP
      such that OrderTwelveMonthADT.authoredOn on or after day of FirstADTMP
        and OrderTwelveMonthADT.authoredOn during day of Interval[start of "Measurement Period" - 3 months, start of "Measurement Period" + 9 months]
        and OrderTwelveMonthADT.status in { 'active', 'completed' }
        and OrderTwelveMonthADT.intent = 'order'
        and OrderTwelveMonthADT.doNotPerform is not true

define "Androgen Deprivation Therapy for Urology Care Medication Active Start Dates":
  [MedicationRequest: "Androgen Deprivation Therapy for Urology Care"] ADTActive
    let firstMedicationPeriod: First((collapse(ADTActive.dosageInstruction.timing.repeat.bounds DoseTime
          return DoseTime.toInterval()
      )) DrugPeriods
        sort by start of $this
    ),
    //get the very first event
    
    firstMedicationEvent: First((ADTActive.dosageInstruction.timing dosageTiming
        //returns first event for the specific dosageTiming
        
        return First(dosageTiming.event dosageTimingEvents
            sort ascending
        )) firstEvents
        sort ascending
    ),
    medicationDateTime: NormalizeInterval(firstMedicationEvent, firstMedicationPeriod).earliest ( )
    where ADTActive.status in { 'active', 'completed' }
      and ADTActive.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
    return medicationDateTime

define "Androgen Deprivation Therapy for Urology Care Medication Order Start Dates":
  [MedicationRequest: "Androgen Deprivation Therapy for Urology Care"] ADTOrder
    let firstMedicationPeriod: First((collapse(ADTOrder.dosageInstruction.timing.repeat.bounds DoseTime
          return DoseTime.toInterval()
      )) DrugPeriods
        sort by start of $this
    ),
    medicationDateTime: NormalizeInterval(ADTOrder.authoredOn, firstMedicationPeriod).earliest ( )
    where ADTOrder.status in { 'active', 'completed' }
      and ADTOrder.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
    return medicationDateTime

define "Has Qualifying Encounter":
  exists ( ["Encounter": "Office Visit"] OfficeVisit
      where OfficeVisit.period during "Measurement Period"
        and OfficeVisit.status = 'finished'
  )

define "Prostate Cancer Diagnosis":
  ( [ConditionProblemsHealthConcerns: "Prostate Cancer"]
    union [ConditionEncounterDiagnosis: "Prostate Cancer"] ) ProstateCancer
    where ProstateCancer.prevalenceInterval ( ) overlaps "Measurement Period"
      and ProstateCancer.clinicalStatus ~ QICoreCommon."active"
      and ProstateCancer.verificationStatus ~ QICoreCommon."confirmed"

define function NormalizeInterval(pointInTime DateTime, dateTimeInterval Interval<DateTime>):
  if pointInTime is not null then Interval[pointInTime, pointInTime]
    else if dateTimeInterval is not null then dateTimeInterval 
    else null as Interval<DateTime>