Knowledge Artifact Metadata
Name (machine-readable) RateOfTimelyFollowUpForColorectalCancerDetection
Title (human-readable) Rate of Timely Follow-up on Positive Stool-based Tests for Colorectal Cancer Detection
Status draft
Experimental false
Description Percentage of patients aged 45 to 75 years with at least one positive stool-based colorectal cancer screening test (i.e., high-sensitivity guaiac fecal occult blood test, fecal immunochemical test, or Cologuard) during the measurement period who completed a colonoscopy within 180 days after their index positive stool-based test result date.
Clinical Usage A higher score (expressed as a percentage) indicates higher quality care.
Effective Period 2024-01-01..2024-12-31
Measure Steward Brigham and Womens Health
Copyright This electronic Clinical Quality Measure (Measure) and related data specifications are owned and stewarded by the Brigham and Women's Hospital (BWH). BWH is not responsible for any use of the Measure. BWH makes no representations, warranties, or endorsement about the quality of any organization or physician that uses or reports performance measures and BWH has no liability to anyone who relies on such measures or specifications. CPT(R) contained in the Measure specifications is copyright 2004-2024 American Medical Association. 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. Due to technical limitations, registered trademarks are indicated by (R) or [R].
Measure Metadata
Short Name Identifier ColorectalCancerMeasureFHIR4
Version Independent Identifier urn:uuid:00378ac7-f21e-4484-b821-3e1ad7acac07
Version Specific Identifier urn:uuid:78a48000-dd34-45bf-b4f0-2c7419bf8a7d
Publisher (CMS) Identifier 1257FHIR
Identifier org.hl7.fhir.r5.model.Identifier@2d6cc4cf
Version Number Draft based on 0.0.022
Rationale Colorectal cancer is the second leading cause of cancer mortality in the United States (American Cancer Society, 2022). Early detection and removal of colorectal polyps and early-stage cancers prevents disease progression and improves the odds of survival (Corley DA, 2017). Noninvasive screening tests (e.g., stool-based tests) are available to detect markers of abnormal growths. However, delays in follow-up colonoscopy reduce the benefits of screening by leading to missed opportunities for timely intervention. Multiple guidelines recommend using stool-based tests (i.e., high-sensitivity gFOBT, FIT, FIT-DNA) as noninvasive screening options, and colonoscopy as the gold standard for follow-up in patients with a positive stool-based test result (USMSTF 2017; USPSTF, 2021; USMSTF, 2022). The American Gastroenterological Association (AGA) guidelines recommended that at least 95% of patients receive a colonoscopy within 6 months of a positive noninvasive test result to complete the full screening process (AGA, 2022). Existing literature supports this timeframe as patients who received their colonoscopies after the 6-month mark were more likely to be diagnosed with more advanced stages of cancer (Mutneja HR, 2021). Rates of timely follow-up in the U.S. are far below the benchmark established by the AGA. A 2023 study examining 39 U.S. health care organizations reported follow-up colonoscopy rates around 50% within 180 days of a positive stool-based test (Mohl JT, 2023). Existing endorsed clinical quality measures report on the percentage of patients who received initial screening for colorectal cancer. This eCQM can be used to measure rates of timely completion of the full screening process after positive non-invasive colorectal cancer screening stool-based test results to help improve health care delivery and quality in medical facilities and health systems across the U.S.
Clinical Recommendation Statement See measure description
Guidance A higher score (expressed as a percentage) indicates higher quality care.
Measure Population Criteria (ID: Group_1)
Initial Population ID: InitialPopulation_1
Description:

Patients aged 45 to 75 years with at least one positive stool-based colorectal cancer screening test

Logic Definition: Initial Population
Denominator ID: Denominator_1
Description:

Equals Initial Population

Logic Definition: Denominator
Denominator Exclusion ID: DenominatorExclusion_1
Description:

Exclude index positive stool-based tests conducted in inpatient or emergency department settings. Exclude index positive stool-based tests where the patient had a prior positive stool-based test result less than 365 days before the index positive stool-based test result date. Exclude index positive stool-based tests where patients had a documented history of colorectal cancer or total colectomy before the index positive stool-based test result date. Exclude index positive stool-based tests where patients received hospice or palliative care within 365 days before or 180 days after the index positive stool-based test result date.

Logic Definition: Denominator Exclusions
Numerator ID: Numerator_1
Description:

Patient had a colonoscopy within 180 days after the index positive stool-based test result date

Logic Definition: Numerator
Denominator Exception ID: DenominatorException_1
Description:

Patient had a colonoscopy within 3 years prior to the index positive stool-based test result date or patient deceased within 180 days after the index positive stool-based test result date

Logic Definition: Denominator Exceptions
Population Basis boolean
Scoring [http://terminology.hl7.org/CodeSystem/measure-scoring#proportion: 'Proportion']
Type [http://terminology.hl7.org/CodeSystem/measure-type#process: 'Process']
Rate Aggregation TBD
Improvement Notation [http://terminology.hl7.org/CodeSystem/measure-improvement-notation#increase: 'Increased score indicates improvement']
Measure Logic
Primary Library https://madie.cms.gov/Library/RateOfTimelyFollowUpForColorectalCancerDetection
Dependency Description: Library FHIRHelpers
Resource: https://madie.cms.gov/Library/FHIRHelpers|4.1.000
Canonical URL: https://madie.cms.gov/Library/FHIRHelpers|4.1.000
Dependency Description: Library QICoreCommon
Resource: https://madie.cms.gov/Library/QICoreCommon|2.0.000
Canonical URL: https://madie.cms.gov/Library/QICoreCommon|2.0.000
Dependency Description: Code system ConditionClinicalStatusCodes
Resource: http://terminology.hl7.org/CodeSystem/condition-clinical
Canonical URL: http://terminology.hl7.org/CodeSystem/condition-clinical
Dependency Description: Code system ConditionVerificationStatusCodes
Resource: http://terminology.hl7.org/CodeSystem/condition-ver-status
Canonical URL: http://terminology.hl7.org/CodeSystem/condition-ver-status
Dependency Description: Code system SNOMEDCT
Resource: http://snomed.info/sct
Canonical URL: http://snomed.info/sct
Dependency Description: Value set Colonoscopy
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.108.12.1020
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.108.12.1020
Dependency Description: Value set Colorectal Screening
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1206.57
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1206.57
Dependency 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
Dependency Description: Value set Emergency Department Evaluation and Management Visit
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010
Dependency Description: Value set Malignant Neoplasm of Colon
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.108.12.1001
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.108.12.1001
Dependency Description: Value set Total Colectomy
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.198.12.1019
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.198.12.1019
Dependency Description: Value set Hospice Care
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.3157.1004.23
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.3157.1004.23
Dependency Description: Value set Hospice Encounter
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003
Dependency Description: Value set Hospice Care Ambulatory
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1108.15
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1108.15
Dependency Description: Value set Palliative Care
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1125.3
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1125.3
Dependency Description: Value set Palliative Care Encounter
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1575
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1575
Direct Reference Code Display: active
Code: active
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Display: recurrence
Code: recurrence
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Display: relapse
Code: relapse
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Display: confirmed
Code: confirmed
System: http://terminology.hl7.org/CodeSystem/condition-ver-status
Direct Reference Code Display: Discharge to home for hospice care (procedure)
Code: 428361000124107
System: http://snomed.info/sct
Parameter Name: Measurement Period
Use: in
Min Cardinality: 0
Max Cardinality: 1
Type: Period
Parameter Name: Numerator
Use: out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Denominator
Use: out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Initial Population
Use: out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Denominator Exclusions
Use: out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Denominator Exceptions
Use: out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Measure Logic Data Requirements
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.113883.3.464.1003.198.12.1019
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.1125.3
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.113883.3.464.1003.108.12.1020
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation
Must Support Elements: effective
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation
Must Support Elements: code, status, status.value, value, effective
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1206.57
Data Requirement Type: Patient
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient
Must Support Elements: birthDate, birthDate.value, deceased
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, status, status.value, period
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, status, status.value, period, hospitalization, hospitalization.dischargeDisposition
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: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, status, status.value, period
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, status, status.value, period
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1108.15
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, status, status.value, period
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1575
Data Requirement Type: Condition
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition
Must Support Elements: code, clinicalStatus, verificationStatus, recordedDate, recordedDate.value
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.108.12.1001
Data Requirement Type: ServiceRequest
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest
Must Support Elements: code, intent, intent.value, authoredOn, authoredOn.value
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.3157.1004.23
Data Requirement Type: ServiceRequest
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest
Must Support Elements: code, intent, intent.value, authoredOn, authoredOn.value
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1125.3
Measure Logic Definitions
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Qualifying Colonoscopy Procedure Performed":
  ["Procedure": "Colonoscopy"] ColonoscopyPerformed
    where ColonoscopyPerformed.status in { 'completed', 'in-progress' }
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Qualifying Stool-based Test with Positive Result":
  [Observation: "Colorectal Screening"] ColorectalScreening
    where ColorectalScreening.status in { 'final', 'amended', 'corrected' }
      and ColorectalScreening.value in { 'Positive', 'positive' }
      and ColorectalScreening.effective.toInterval ( ) during day of "Measurement Period"
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Index Positive Stool-based Test":
  First("Qualifying Stool-based Test with Positive Result" IndexColorectalScreening
      sort by effective
  )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Has Follow-up Colonoscopy Within 180 Days of the Index Positive Stool-based Test":
  exists ( "Qualifying Colonoscopy Procedure Performed" ColonoscopyProcedure
      where ColonoscopyProcedure.performed starts 180 days or less on or after "Index Positive Stool-based Test".effective
  )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Numerator":
  "Has Follow-up Colonoscopy Within 180 Days of the Index Positive Stool-based Test"
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Initial Population":
	/***
	Patients aged between 45 and 75 years with at least 1 qualifying stool-based screening with positive result during the measurement period.
	***/
  
  AgeInYearsAt("Index Positive Stool-based Test".effective) in Interval[45, 75]
    and exists ( "Qualifying Stool-based Test with Positive Result" )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Denominator":
  "Initial Population"
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Qualifying Hospital Encounter":
  ( ["Encounter": "Encounter Inpatient"]
    union ["Encounter": "Emergency Department Evaluation and Management Visit"] ) HospitalEncounter
    where HospitalEncounter.status = 'finished'
      and HospitalEncounter.period during "Measurement Period"
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Index Positive Stool-based Test Done During Hospitalization":
  "Qualifying Hospital Encounter" QualifyingHospitalEncounter
    with "Index Positive Stool-based Test" IndexScreening
      such that IndexScreening.effective.toInterval ( ) starts during day of QualifyingHospitalEncounter.period
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Had Index Positive Stool-based Test Conducted in Hospital or Emergency Department":
  exists ( "Index Positive Stool-based Test Done During Hospitalization" )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Had Positive Stool-based Test Within 365 Days Prior to Index Positive Stool-based Test Result Date":
  exists ( [Observation: "Colorectal Screening"] ColorectalScreening
      where ColorectalScreening.status in { 'final', 'amended', 'corrected' }
        and ColorectalScreening.value in { 'Positive', 'positive' }
        and ColorectalScreening.effective.toInterval ( ) starts 365 days or less before "Index Positive Stool-based Test".effective
  )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Had Colorectal Cancer Prior to Index Positive Stool-based Test Result Date":
  exists ( [Condition: "Malignant Neoplasm of Colon"] ColorectalCancerCondition
      where ( ColorectalCancerCondition.clinicalStatus ~ "active"
          or ColorectalCancerCondition.clinicalStatus ~ "recurrence"
          or ColorectalCancerCondition.clinicalStatus ~ "relapse"
      )
        and ColorectalCancerCondition.verificationStatus ~ "confirmed"
        and ColorectalCancerCondition.recordedDate before "Index Positive Stool-based Test".effective
  )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Had Total Colectomy Performed Prior to Index Positive Stool-based Test Result Date":
  exists ( [Procedure: "Total Colectomy"] TotalColectomyProcedure
      where TotalColectomyProcedure.status = 'completed'
        and TotalColectomyProcedure.performed ends on or before "Index Positive Stool-based Test".effective
  )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Had Hospice Care Within 365 Days Prior to or 180 Days After Index Positive Stool-based Test Result Date":
  exists ( ["Encounter": "Encounter Inpatient"] HospitalEncounter
      where HospitalEncounter.status = 'finished'
        and HospitalEncounter.hospitalization.dischargeDisposition ~ "Discharge to home for hospice care (procedure)"
        and ( HospitalEncounter.period ends 365 days or less on or before "Index Positive Stool-based Test".effective
            or HospitalEncounter.period starts 180 days or less on or after "Index Positive Stool-based Test".effective
        )
  )
    or exists ( [ServiceRequest: "Hospice Care"] HospiceServiceOrder
        where HospiceServiceOrder.intent = 'order'
          and ( HospiceServiceOrder.authoredOn 365 days or less on or before "Index Positive Stool-based Test".effective
              or HospiceServiceOrder.authoredOn 180 days or less on or after "Index Positive Stool-based Test".effective
          )
    )
    or exists ( ( ["Encounter": "Hospice Encounter"]
        union ["Encounter": "Hospice Care Ambulatory"] ) HospiceEncounter
        where HospiceEncounter.status = 'finished'
          and ( HospiceEncounter.period ends 365 days or less on or before "Index Positive Stool-based Test".effective
              or HospiceEncounter.period starts 180 days or less on or after "Index Positive Stool-based Test".effective
          )
    )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Had Palliative Care Within 365 Days Prior to or 180 Days After Index Positive Stool-based Test Result Date":
  exists ( ["Procedure": "Palliative Care"] PalliativeCareProcedure
      where PalliativeCareProcedure.status = 'completed'
        and PalliativeCareProcedure.performed ends 365 days or less on or before "Index Positive Stool-based Test".effective
        or PalliativeCareProcedure.performed starts 180 days or less on or after "Index Positive Stool-based Test".effective
  )
    or exists ( [ServiceRequest: "Palliative Care"] PalliativeCareService
        where PalliativeCareService.intent = 'order'
          and ( PalliativeCareService.authoredOn 365 days or less on or before "Index Positive Stool-based Test".effective
              or PalliativeCareService.authoredOn 180 days or less on or after "Index Positive Stool-based Test".effective
          )
    )
    or exists ( ["Encounter": "Palliative Care Encounter"] PalliativeCareEncounter
        where PalliativeCareEncounter.status = 'finished'
          and ( PalliativeCareEncounter.period ends 365 days or less on or before "Index Positive Stool-based Test".effective
              or PalliativeCareEncounter.period starts 180 days or less on or after "Index Positive Stool-based Test".effective
          )
    )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Denominator Exclusions":
  "Had Index Positive Stool-based Test Conducted in Hospital or Emergency Department"
    or "Had Positive Stool-based Test Within 365 Days Prior to Index Positive Stool-based Test Result Date"
    or "Had Colorectal Cancer Prior to Index Positive Stool-based Test Result Date"
    or "Had Total Colectomy Performed Prior to Index Positive Stool-based Test Result Date"
    or "Had Hospice Care Within 365 Days Prior to or 180 Days After Index Positive Stool-based Test Result Date"
    or "Had Palliative Care Within 365 Days Prior to or 180 Days After Index Positive Stool-based Test Result Date"
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Has Colonoscopy Procedure Performed Within 3 Years Prior to the Index Positive Stool-based Test":
  exists ( "Qualifying Colonoscopy Procedure Performed" ColonoscopyProcedure
      where ColonoscopyProcedure.performed starts 3 years or less before "Index Positive Stool-based Test".effective
  )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Patient Deceased Within 180 Days of the Index Positive Stool-based Test":
  Patient.deceased.toInterval ( ) starts 180 days or less on or after "Index Positive Stool-based Test".effective
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Denominator Exceptions":
  "Has Colonoscopy Procedure Performed Within 3 Years Prior to the Index Positive Stool-based Test"
    or "Patient Deceased Within 180 Days of the Index Positive Stool-based Test"
Logic Definition Library Name: FHIRHelpers
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: 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
Dependency Description: Library FHIRHelpers
Resource: https://madie.cms.gov/Library/FHIRHelpers|4.1.000
Canonical URL: https://madie.cms.gov/Library/FHIRHelpers|4.1.000
Dependency Description: Library QICoreCommon
Resource: https://madie.cms.gov/Library/QICoreCommon|2.0.000
Canonical URL: https://madie.cms.gov/Library/QICoreCommon|2.0.000
Dependency Description: Code system ConditionClinicalStatusCodes
Resource: http://terminology.hl7.org/CodeSystem/condition-clinical
Canonical URL: http://terminology.hl7.org/CodeSystem/condition-clinical
Dependency Description: Code system ConditionVerificationStatusCodes
Resource: http://terminology.hl7.org/CodeSystem/condition-ver-status
Canonical URL: http://terminology.hl7.org/CodeSystem/condition-ver-status
Dependency Description: Code system SNOMEDCT
Resource: http://snomed.info/sct
Canonical URL: http://snomed.info/sct
Dependency Description: Value set Colonoscopy
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.108.12.1020
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.108.12.1020
Dependency Description: Value set Colorectal Screening
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1206.57
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1206.57
Dependency 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
Dependency Description: Value set Emergency Department Evaluation and Management Visit
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010
Dependency Description: Value set Malignant Neoplasm of Colon
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.108.12.1001
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.108.12.1001
Dependency Description: Value set Total Colectomy
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.198.12.1019
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.198.12.1019
Dependency Description: Value set Hospice Care
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.3157.1004.23
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.3157.1004.23
Dependency Description: Value set Hospice Encounter
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003
Dependency Description: Value set Hospice Care Ambulatory
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1108.15
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1108.15
Dependency Description: Value set Palliative Care
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1125.3
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1125.3
Dependency Description: Value set Palliative Care Encounter
Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1575
Canonical URL: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1575
Direct Reference Code Display: active
Code: active
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Display: recurrence
Code: recurrence
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Display: relapse
Code: relapse
System: http://terminology.hl7.org/CodeSystem/condition-clinical
Direct Reference Code Display: confirmed
Code: confirmed
System: http://terminology.hl7.org/CodeSystem/condition-ver-status
Direct Reference Code Display: Discharge to home for hospice care (procedure)
Code: 428361000124107
System: http://snomed.info/sct
Parameter Name: Measurement Period
Use: in
Min Cardinality: 0
Max Cardinality: 1
Type: Period
Parameter Name: Numerator
Use: out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Denominator
Use: out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Initial Population
Use: out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Denominator Exclusions
Use: out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Denominator Exceptions
Use: out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Measure Logic Data Requirements
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.113883.3.464.1003.198.12.1019
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.1125.3
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.113883.3.464.1003.108.12.1020
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation
Must Support Elements: effective
Data Requirement Type: Observation
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-observation
Must Support Elements: code, status, status.value, value, effective
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1206.57
Data Requirement Type: Patient
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient
Must Support Elements: birthDate, birthDate.value, deceased
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, status, status.value, period
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, status, status.value, period, hospitalization, hospitalization.dischargeDisposition
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: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, status, status.value, period
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.1003
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, status, status.value, period
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1108.15
Data Requirement Type: Encounter
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter
Must Support Elements: type, status, status.value, period
Code Filter(s):
Path: type
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1.1575
Data Requirement Type: Condition
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition
Must Support Elements: code, clinicalStatus, verificationStatus, recordedDate, recordedDate.value
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.108.12.1001
Data Requirement Type: ServiceRequest
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest
Must Support Elements: code, intent, intent.value, authoredOn, authoredOn.value
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.3157.1004.23
Data Requirement Type: ServiceRequest
Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest
Must Support Elements: code, intent, intent.value, authoredOn, authoredOn.value
Code Filter(s):
Path: code
ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1125.3
Measure Logic Definitions
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Qualifying Colonoscopy Procedure Performed":
  ["Procedure": "Colonoscopy"] ColonoscopyPerformed
    where ColonoscopyPerformed.status in { 'completed', 'in-progress' }
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Qualifying Stool-based Test with Positive Result":
  [Observation: "Colorectal Screening"] ColorectalScreening
    where ColorectalScreening.status in { 'final', 'amended', 'corrected' }
      and ColorectalScreening.value in { 'Positive', 'positive' }
      and ColorectalScreening.effective.toInterval ( ) during day of "Measurement Period"
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Index Positive Stool-based Test":
  First("Qualifying Stool-based Test with Positive Result" IndexColorectalScreening
      sort by effective
  )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Has Follow-up Colonoscopy Within 180 Days of the Index Positive Stool-based Test":
  exists ( "Qualifying Colonoscopy Procedure Performed" ColonoscopyProcedure
      where ColonoscopyProcedure.performed starts 180 days or less on or after "Index Positive Stool-based Test".effective
  )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Numerator":
  "Has Follow-up Colonoscopy Within 180 Days of the Index Positive Stool-based Test"
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Initial Population":
	/***
	Patients aged between 45 and 75 years with at least 1 qualifying stool-based screening with positive result during the measurement period.
	***/
  
  AgeInYearsAt("Index Positive Stool-based Test".effective) in Interval[45, 75]
    and exists ( "Qualifying Stool-based Test with Positive Result" )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Denominator":
  "Initial Population"
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Qualifying Hospital Encounter":
  ( ["Encounter": "Encounter Inpatient"]
    union ["Encounter": "Emergency Department Evaluation and Management Visit"] ) HospitalEncounter
    where HospitalEncounter.status = 'finished'
      and HospitalEncounter.period during "Measurement Period"
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Index Positive Stool-based Test Done During Hospitalization":
  "Qualifying Hospital Encounter" QualifyingHospitalEncounter
    with "Index Positive Stool-based Test" IndexScreening
      such that IndexScreening.effective.toInterval ( ) starts during day of QualifyingHospitalEncounter.period
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Had Index Positive Stool-based Test Conducted in Hospital or Emergency Department":
  exists ( "Index Positive Stool-based Test Done During Hospitalization" )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Had Positive Stool-based Test Within 365 Days Prior to Index Positive Stool-based Test Result Date":
  exists ( [Observation: "Colorectal Screening"] ColorectalScreening
      where ColorectalScreening.status in { 'final', 'amended', 'corrected' }
        and ColorectalScreening.value in { 'Positive', 'positive' }
        and ColorectalScreening.effective.toInterval ( ) starts 365 days or less before "Index Positive Stool-based Test".effective
  )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Had Colorectal Cancer Prior to Index Positive Stool-based Test Result Date":
  exists ( [Condition: "Malignant Neoplasm of Colon"] ColorectalCancerCondition
      where ( ColorectalCancerCondition.clinicalStatus ~ "active"
          or ColorectalCancerCondition.clinicalStatus ~ "recurrence"
          or ColorectalCancerCondition.clinicalStatus ~ "relapse"
      )
        and ColorectalCancerCondition.verificationStatus ~ "confirmed"
        and ColorectalCancerCondition.recordedDate before "Index Positive Stool-based Test".effective
  )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Had Total Colectomy Performed Prior to Index Positive Stool-based Test Result Date":
  exists ( [Procedure: "Total Colectomy"] TotalColectomyProcedure
      where TotalColectomyProcedure.status = 'completed'
        and TotalColectomyProcedure.performed ends on or before "Index Positive Stool-based Test".effective
  )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Had Hospice Care Within 365 Days Prior to or 180 Days After Index Positive Stool-based Test Result Date":
  exists ( ["Encounter": "Encounter Inpatient"] HospitalEncounter
      where HospitalEncounter.status = 'finished'
        and HospitalEncounter.hospitalization.dischargeDisposition ~ "Discharge to home for hospice care (procedure)"
        and ( HospitalEncounter.period ends 365 days or less on or before "Index Positive Stool-based Test".effective
            or HospitalEncounter.period starts 180 days or less on or after "Index Positive Stool-based Test".effective
        )
  )
    or exists ( [ServiceRequest: "Hospice Care"] HospiceServiceOrder
        where HospiceServiceOrder.intent = 'order'
          and ( HospiceServiceOrder.authoredOn 365 days or less on or before "Index Positive Stool-based Test".effective
              or HospiceServiceOrder.authoredOn 180 days or less on or after "Index Positive Stool-based Test".effective
          )
    )
    or exists ( ( ["Encounter": "Hospice Encounter"]
        union ["Encounter": "Hospice Care Ambulatory"] ) HospiceEncounter
        where HospiceEncounter.status = 'finished'
          and ( HospiceEncounter.period ends 365 days or less on or before "Index Positive Stool-based Test".effective
              or HospiceEncounter.period starts 180 days or less on or after "Index Positive Stool-based Test".effective
          )
    )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Had Palliative Care Within 365 Days Prior to or 180 Days After Index Positive Stool-based Test Result Date":
  exists ( ["Procedure": "Palliative Care"] PalliativeCareProcedure
      where PalliativeCareProcedure.status = 'completed'
        and PalliativeCareProcedure.performed ends 365 days or less on or before "Index Positive Stool-based Test".effective
        or PalliativeCareProcedure.performed starts 180 days or less on or after "Index Positive Stool-based Test".effective
  )
    or exists ( [ServiceRequest: "Palliative Care"] PalliativeCareService
        where PalliativeCareService.intent = 'order'
          and ( PalliativeCareService.authoredOn 365 days or less on or before "Index Positive Stool-based Test".effective
              or PalliativeCareService.authoredOn 180 days or less on or after "Index Positive Stool-based Test".effective
          )
    )
    or exists ( ["Encounter": "Palliative Care Encounter"] PalliativeCareEncounter
        where PalliativeCareEncounter.status = 'finished'
          and ( PalliativeCareEncounter.period ends 365 days or less on or before "Index Positive Stool-based Test".effective
              or PalliativeCareEncounter.period starts 180 days or less on or after "Index Positive Stool-based Test".effective
          )
    )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Denominator Exclusions":
  "Had Index Positive Stool-based Test Conducted in Hospital or Emergency Department"
    or "Had Positive Stool-based Test Within 365 Days Prior to Index Positive Stool-based Test Result Date"
    or "Had Colorectal Cancer Prior to Index Positive Stool-based Test Result Date"
    or "Had Total Colectomy Performed Prior to Index Positive Stool-based Test Result Date"
    or "Had Hospice Care Within 365 Days Prior to or 180 Days After Index Positive Stool-based Test Result Date"
    or "Had Palliative Care Within 365 Days Prior to or 180 Days After Index Positive Stool-based Test Result Date"
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Has Colonoscopy Procedure Performed Within 3 Years Prior to the Index Positive Stool-based Test":
  exists ( "Qualifying Colonoscopy Procedure Performed" ColonoscopyProcedure
      where ColonoscopyProcedure.performed starts 3 years or less before "Index Positive Stool-based Test".effective
  )
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Patient Deceased Within 180 Days of the Index Positive Stool-based Test":
  Patient.deceased.toInterval ( ) starts 180 days or less on or after "Index Positive Stool-based Test".effective
Logic Definition Library Name: RateOfTimelyFollowUpForColorectalCancerDetection
define "Denominator Exceptions":
  "Has Colonoscopy Procedure Performed Within 3 Years Prior to the Index Positive Stool-based Test"
    or "Patient Deceased Within 180 Days of the Index Positive Stool-based Test"
Logic Definition Library Name: FHIRHelpers
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: 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
Generated using version 0.4.6 of the sample-content-ig Liquid templates