Metadata
Title | Anticoagulation Therapy for Atrial Fibrillation/FlutterFHIR
Version | 1.0.000
Short Name | CMS71FHIR
GUID (Version Independent) | urn:uuid:bc80e4cf-d267-47bf-ad0d-4d37f8ae2328
GUID (Version Specific) | urn:uuid:48d6fe97-e70f-4688-b24f-79c3146975be
CMS Identifier | 71FHIR
Effective Period | 2026-01-01 through 2026-12-31
Steward (Publisher) | The Joint Commission
Developer | The Joint Commission
Description | Ischemic stroke patients with atrial fibrillation/flutter who are prescribed or continuing to take anticoagulation therapy at hospital discharge
Copyright | Measure specifications are in the Public Domain. 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.
Disclaimer | These performance measures are not clinical guidelines, do not establish a standard of medical care, and have not been tested for all potential applications. The measures and specifications are provided without warranty.
Rationale | Nonvalvular atrial fibrillation (NVAF) is a common arrhythmia and an important risk factor for stroke. It is one of several conditions and lifestyle factors that have been identified as risk factors for stroke. It has been estimated that over 2 million adults in the United States have NVAF (Kornej, 2020). While the median age of patients with atrial fibrillation is 75 years, the incidence increases with advancing age. For example, The Framingham Heart Study noted a dramatic increase in stroke risk associated with atrial fibrillation with advancing age, from 1.5% for those 50 to 59 years of age to 23.5% for those 80 to 89 years of age. Furthermore, a prior stroke or transient ischemic attack (TIA) are among a limited number of predictors of high stroke risk within the population of patients with atrial fibrillation. Therefore, much emphasis has been placed on identifying methods for preventing recurrent ischemic stroke as well as preventing first stroke. Prevention strategies focus on the modifiable risk factors such as hypertension, smoking, and atrial fibrillation. Analysis of five placebo-controlled clinical trials investigating the efficacy of warfarin in the primary prevention of thromboembolic stroke, found the relative risk of thromboembolic stroke was reduced by 68% for atrial fibrillation patients treated with warfarin. The administration of anticoagulation therapy, unless there are contraindications, is an established effective strategy in preventing recurrent stroke in high stroke risk-atrial fibrillation patients with TIA or prior stroke.
Clinical Recommendation Statement | The administration of anticoagulation therapy, unless there are contraindications, is an established effective strategy in preventing recurrent stroke in high stroke risk atrial fibrillation patients with TIA or prior stroke
Citation | Berge, E., Abdelnoor, M., Nakstad, P. H., et al. (2000, April 8). Low molecular-weight heparin versus aspirin in patients with acute ischaemic stroke and atrial fibrillation: A double-blind randomised study. Lancet, 355(9211), 1205-1210.
Citation | Centers for Disease Control and Prevention. (2009, May 1). Prevalence and most common causes of disability among adults- United States, 2005. Morbidity and Mortality Weekly Report, 58(16), 421-426.
Citation | Connolly, S. J., Ezekowitz, M. D., Yusuf, S., et al. (2009, September 17). Dabigatran versus warfarin in patients with atrial fibrillation. New England Journal of Medicine, 361(12), 1139-1151.
Citation | Fuster, V., Ryden, L. E., Asinger, R. W., et al. (2001, October). ACC/AHA/ESC guidelines for the management of patients with atrial fibrillation: Executive summary. A report of the American College of Cardiology/American Heart Association Task Force on Practice Guidelines and the European Society of Cardiology Committee for Practice Guidelines and Policy Conferences (Committee to Develop Guidelines for the Management of Patients with Atrial Fibrillation). Journal of the American College of Cardiology, 38(4), 1231-1266.
Citation | Fuster, V., Ryden, L. E., Cannom, D. S., et al. (2006, August 15). ACC/AHA/ESC 2006 guidelines for the management of patients with atrial fibrillation: A report of the American College of Cardiology/American Heart Association Task Force on Practice Guidelines and the European Society of Cardiology Committee for Practice Guidelines (writing committee to revise the 2001 guidelines for the management of patients with atrial fibrillation). Circulation, 114(7), e257-354.
Citation | Goldstein, L. B., Adams, R., Alberts, M. J., et al. (2006, June). Primary prevention of ischemic stroke: A guideline from the American Heart Association/American Stroke Association Stroke Council: Cosponsored by the Atherosclerotic Peripheral Vascular Disease Interdisciplinary Working Group; Cardiovascular Nursing Council; Clinical Cardiology Council; Nutrition, Physical Activity, and Metabolism Council; and the Quality of Care and Outcomes Research Interdisciplinary Working Group: The American Academy of Neurology affirms the value of this guideline. Stroke, 37(6), 1583-1633.
Citation | Gorelick, P. B., Sacco, R. L., Smith, D. B., et al. (1999, March). Prevention of a first stroke: A review of guidelines and a multidisciplinary consensus statement from the National Stroke Association. JAMA, 281(12), 1112-1120.
Citation | Hart, R. G., Benavente, O., McBride R., et al. (1999, October 5). Antithrombotic therapy to prevent stroke in patients with atrial fibrillation: A meta-analysis. Annals of Internal Medicine, 131(7), 492-501.
Citation | Jauch, E. C., Saver, J. L., Adams, H. P., Jr., et al. (2013). Guidelines for the early management of patients with acute ischemic stroke: A guideline for health care professionals from the American Heart Association/American Stroke Association. Stroke, 44(3), 870-947.
Citation | Kernan, W. N., Ovbiagele, B., Black, H. R., et al. (2014, May). Guidelines for the prevention of stroke in patients with stroke and transient ischemic attack: A guideline for health care professionals from the American Heart Association/American Stroke Association. Stroke, 45(7), 2160-2223.
Citation | Kleindorfer, D. O., Towfighi, A., Chaturvedi, S., Cockroft, K. M., Gutierrez, J., Lombardi-Hill, D., ... Williams, L. S. (2021). 2021 guideline for the prevention of stroke in patients with stroke and transient ischemic attack: A guideline from the American Heart Association/American Stroke Association. Stroke, 52(7), e364-e467. https://doi.org/10.1161/STR.0000000000000375
Citation | Lin, H. J., Wolf, P. A., Kelly-Hayes, M., et al. (1996, October). Stroke severity in atrial fibrillation: The Framingham Study. Stroke 27(10), 1760-1764
Citation | Penado, S., Cano, M., Acha, O., et al. (2003, February 15). Atrial fibrillation as a risk factor for stroke recurrence. American Journal of Medicine, 114 (3), 206-210.
Citation | Powers, W. J., Rabinstein, A. A., Ackerson, T., et al. (2018, January). 2018 guidelines for the early management of patients with acute ischemic stroke: A guideline for health care professionals from the American Heart Association/American Stroke Association. Stroke, 49, e31-e32.
Citation | Roger, V. L., Go, A. S., Lloyd-Jones, D. M., et al. (2012, January 3). Heart disease and stroke statistics- 2012 update: A report from the American Heart Association. Circulation, 125(1), e2-e220.
Citation | Saxena, R., & Koudstaal, P. J. (2011). Anticoagulants for preventing stroke in patients with nonrheumatic atrial fibrillation and a history of stroke or transient ischemic attack (review). Cochrane Database of Systematic Reviews, (4), CD000185.
Citation | Saxena, R., Lewis, S., Berge, E., et al. (2001, October). Risk of early death and recurrent stroke and effect of heparin in 3,169 patients with acute ischemic stroke and atrial fibrillation in the International Stroke Trial. Stroke, 32(10), 2333-2337.
Citation | Van Walraven, C., Hart, R. G., Singer, D. E., et al. (2002, November 20).Oral anticoagulants vs. aspirin in nonvalvular atrial fibrillation: An individual patient meta-analysis. JAMA, 288(19), 2441-2448.
Citation | Wann, L. S., Curtis, A. B., Ellenbogen, K. A., et al. (2011, March 15). 2011 ACCF/AHA/HRS focused update on the management of patients with atrial fibrillation (update on dabigatran): A report of the American College of Cardiology Foundation/American Heart Association Task Force on Practice Guidelines. Journal of the American College of Cardiology, 57(11), 1330-1337.
Guidance (Usage) | The "Nonelective Inpatient Encounter" value set intends to capture all non-scheduled hospitalizations. This value set is a subset of the "Inpatient Encounter" value set, excluding concepts that specifically refer to elective hospital admissions. Non-elective Inpatient Encounters include emergency, urgent, and unplanned admissions. New or continuing anticoagulant medications are included with the use of the MedicationRequest QI-Core Profile. The Profile's community and discharge category codes indicate that the medications should be taken by or given to the patient after being discharged. The denominator population includes patients with inpatient hospitalizations and patients from Acute Hospital Care at Home programs, who are treated and billed as inpatients but receive care in their home. This dQM is an episode-based measure. An episode is defined as each inpatient hospitalization or encounter that ends during the measurement period. This FHIR-based measure has been derived from the QDM-based measure: CMS71v15. Please refer to the HL7 QI-Core Implementation Guide (https://hl7.org/fhir/us/qicore/STU6/) for more information on QI-Core and mapping recommendations from QDM to QI-Core STU 6. (https://hl7.org/fhir/us/qicore/STU6/qdm-to-qicore.html).
Measure Group (Rate) (ID: Group_1)
Basis | Encounter
Scoring | [http://terminology.hl7.org/CodeSystem/measure-scoring#proportion: 'Proportion']
Type | [http://terminology.hl7.org/CodeSystem/measure-type#process: 'Process']
Rate Aggregation | None
Improvement Notation | [http://terminology.hl7.org/CodeSystem/measure-improvement-notation#increase: 'Increased score indicates improvement']
Initial Population | ID: InitialPopulation_1 Description: Inpatient hospitalizations (non-elective admissions) for patients age 18 and older, discharged from inpatient care with a principal diagnosis of ischemic stroke, that ends during the measurement period Logic Definition: Initial Population
Denominator | ID: Denominator_1 Description: Inpatient hospitalizations for patients with a principal diagnosis of ischemic stroke, and a history of atrial ablation, or current or history of atrial fibrillation/flutter Logic Definition: Denominator
Denominator Exclusion | ID: DenominatorExclusion_1 Description: Inpatient hospitalizations for patients admitted for elective carotid intervention. This exclusion is implicitly modeled by only including non-elective hospitalizations. Inpatient hospitalizations for patients discharged to another hospital Inpatient hospitalizations for patients who left against medical advice Inpatient hospitalizations for patients who expired Inpatient hospitalizations for patients discharged to home for hospice care Inpatient hospitalizations for patients discharged to a health care facility for hospice care Inpatient hospitalizations for patients with comfort measures documented Logic Definition: Denominator Exclusions
Numerator | ID: Numerator_1 Description: Inpatient hospitalizations for patients prescribed or continuing to take anticoagulation therapy at hospital discharge Logic Definition: Numerator
Denominator Exception | ID: DenominatorException_1 Description: Inpatient hospitalizations for patients with a documented reason for not prescribing anticoagulation therapy at discharge Logic Definition: Denominator Exceptions
Supplemental Data Guidance | For every patient evaluated by this measure also identify payer, race, ethnicity and sex
Supplemental Data Elements
Supplemental Data Element | ID: sde-ethnicity Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Ethnicity Logic Definition: SDE Ethnicity
Supplemental Data Element | ID: sde-payer Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Payer Logic Definition: SDE Payer
Supplemental Data Element | ID: sde-race Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Race Logic Definition: SDE Race
Supplemental Data Element | ID: sde-sex Usage Code: [http://terminology.hl7.org/CodeSystem/measure-data-usage#supplemental-data] Description: SDE Sex Logic Definition: SDE Sex
Measure Logic
Primary Library | https://madie.cms.gov/Library/CMS71FHIRSTKAnticoagAFFlutter
Contents | Population Criteria Logic Definitions Terminology Dependencies Data Requirements
Population Criteria
Measure Group (Rate) (ID: Group_1)
Initial Population
    define "Initial Population":
      TJC."Ischemic Stroke Encounter"
Denominator
    define "Denominator":
      "Encounter With A History Of Atrial Ablation"
        union "Encounter With Prior Or Present Diagnosis Of Atrial Fibrillation Or Flutter"
Denominator Exclusion
    define "Denominator Exclusions":
      ( "Denominator" Encounter
          where Encounter.status = 'finished'
            and ( Encounter.hospitalization.dischargeDisposition in "Discharge To Acute Care Facility"
                or Encounter.hospitalization.dischargeDisposition in "Left Against Medical Advice"
                or Encounter.hospitalization.dischargeDisposition in "Patient Expired"
                or Encounter.hospitalization.dischargeDisposition in "Discharged to Home for Hospice Care"
                or Encounter.hospitalization.dischargeDisposition in "Discharged to Health Care Facility for Hospice Care"
            )
      )
        union "Encounter With Comfort Measures During Hospitalization For Patients With Documented Atrial Fibrillation Or Flutter"
Numerator
    define "Numerator":
      "Denominator" Encounter
        with ["MedicationRequest": "Anticoagulant Therapy"] DischargeAnticoagulant
          such that DischargeAnticoagulant.status in { 'active', 'completed' }
            and DischargeAnticoagulant.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
            and ( DischargeAnticoagulant.isCommunity ( )
                or DischargeAnticoagulant.isDischarge ( )
            )
            and DischargeAnticoagulant.authoredOn during Encounter.period
            and not exists ( ["TaskRejected"] TaskReject
                where TaskReject.focus.references ( DischargeAnticoagulant )
                  and TaskReject.code ~ QICoreCommon."Fulfill"
            )
Denominator Exception
    define "Denominator Exceptions":
      "Denominator" Encounter
        with "Documented Reason For Not Giving Anticoagulant At Discharge" NoDischargeAnticoagulant
          such that NoDischargeAnticoagulant.authoredOn during Encounter.period
Logic Definitions
Logic Definition | Library Name: TJCOverall
    define "Non Elective Inpatient Encounter With Age":
      ["Encounter": "Nonelective Inpatient Encounter"] NonElectiveEncounter
            where AgeInYearsAt(date from start of NonElectiveEncounter.period ) >= 18
             and NonElectiveEncounter.period ends during day of "Measurement Period"
Logic Definition | Library Name: TJCOverall
    define "Ischemic Stroke Encounter":
      "Non Elective Inpatient Encounter With Age" NonElectiveEncounterWithAge
       where NonElectiveEncounterWithAge.hasPrincipalDiagnosisOf("Ischemic Stroke" )
Logic Definition | Library Name: TJCOverall
    define "Intervention Comfort Measures":
      ( ["ServiceRequest": "Comfort Measures"] ComfortCare
        where ComfortCare.status in { 'active', 'completed', 'on-hold' }
          and ComfortCare.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
      )
      union ( ["Procedure": "Comfort Measures"] ComfortCarePerformed
            where ComfortCarePerformed.status in { 'completed', 'in-progress' }
      )
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Sex":
      case
        when Patient.sex = '248153007' then "Male (finding)"
        when Patient.sex = '248152002' then "Female (finding)"
        else null
      end
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Payer":
      [Coverage: type in "Payer Type"] Payer
        return {
          code: Payer.type,
          period: Payer.period
        }
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Ethnicity":
      Patient.ethnicity E
        return Tuple {
          codes: { E.ombCategory } union E.detailed,
          display: E.text
        }
Logic Definition | Library Name: SupplementalDataElements
    define "SDE Race":
      Patient.race R
        return Tuple {
          codes: R.ombCategory union R.detailed,
          display: R.text
        }
Logic Definition | Library Name: CMS71FHIRSTKAnticoagAFFlutter
    define "SDE Sex":
      SDE."SDE Sex"
Logic Definition | Library Name: CMS71FHIRSTKAnticoagAFFlutter
    define "Encounter With A History Of Atrial Ablation":
      ( TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
          where exists ( ["Procedure": "Atrial Ablation"] AtrialAblationProcedure
              where AtrialAblationProcedure.status = 'completed'
                and AtrialAblationProcedure.performed.toInterval ( ) starts before start of IschemicStrokeEncounter.period
          )
      )
        union ( TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
            with ["ConditionProblemsHealthConcerns": "History of Atrial Ablation"] AtrialAblationDiagnosis
              such that AtrialAblationDiagnosis.verificationStatus is not null implies ( AtrialAblationDiagnosis.verificationStatus !~ QICoreCommon."refuted"
                  and AtrialAblationDiagnosis.verificationStatus !~ QICoreCommon."entered-in-error"
              )
                and AtrialAblationDiagnosis.onset.toInterval ( ) starts before start of IschemicStrokeEncounter.period
        )
        union ( TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
            with ["SimpleObservation": "History of Atrial Ablation"] AtrialAblationObservation
              such that AtrialAblationObservation.status in { 'final', 'amended', 'corrected' }
                and AtrialAblationObservation.effective.earliest ( ) on or before end of IschemicStrokeEncounter.period
        )
        union ( TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
            with ["ConditionEncounterDiagnosis": "History of Atrial Ablation"] AtrialAblationEncDiagnosis
              such that AtrialAblationEncDiagnosis.verificationStatus is not null implies ( AtrialAblationEncDiagnosis.verificationStatus !~ QICoreCommon."refuted"
                  and AtrialAblationEncDiagnosis.verificationStatus !~ QICoreCommon."entered-in-error"
              )
                and AtrialAblationEncDiagnosis.onset.toInterval ( ) starts before start of IschemicStrokeEncounter.period
        )
Logic Definition | Library Name: CMS71FHIRSTKAnticoagAFFlutter
    define "Encounter With Prior Or Present Diagnosis Of Atrial Fibrillation Or Flutter":
      ( TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
          with ["ConditionProblemsHealthConcerns": "Atrial Fibrillation or Flutter"] AtrialFibrillationFlutter
            such that AtrialFibrillationFlutter.verificationStatus is not null implies ( AtrialFibrillationFlutter.verificationStatus !~ QICoreCommon."refuted"
                and AtrialFibrillationFlutter.verificationStatus !~ QICoreCommon."entered-in-error"
            )
              and AtrialFibrillationFlutter.onset.toInterval ( ) starts on or before end of IschemicStrokeEncounter.period
      )
        union TJC."Ischemic Stroke Encounter" IschemicStrokeEncounter
          where exists ( ( IschemicStrokeEncounter.encounterDiagnosis ( ) ) EncounterDiagnosis
              where EncounterDiagnosis.code in "Atrial Fibrillation or Flutter"
          )
Logic Definition | Library Name: CMS71FHIRSTKAnticoagAFFlutter
    define "Denominator":
      "Encounter With A History Of Atrial Ablation"
        union "Encounter With Prior Or Present Diagnosis Of Atrial Fibrillation Or Flutter"
Logic Definition | Library Name: CMS71FHIRSTKAnticoagAFFlutter
    define "Numerator":
      "Denominator" Encounter
        with ["MedicationRequest": "Anticoagulant Therapy"] DischargeAnticoagulant
          such that DischargeAnticoagulant.status in { 'active', 'completed' }
            and DischargeAnticoagulant.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
            and ( DischargeAnticoagulant.isCommunity ( )
                or DischargeAnticoagulant.isDischarge ( )
            )
            and DischargeAnticoagulant.authoredOn during Encounter.period
            and not exists ( ["TaskRejected"] TaskReject
                where TaskReject.focus.references ( DischargeAnticoagulant )
                  and TaskReject.code ~ QICoreCommon."Fulfill"
            )
Logic Definition | Library Name: CMS71FHIRSTKAnticoagAFFlutter
    define "SDE Payer":
      SDE."SDE Payer"
Logic Definition | Library Name: CMS71FHIRSTKAnticoagAFFlutter
    define "Initial Population":
      TJC."Ischemic Stroke Encounter"
Logic Definition | Library Name: CMS71FHIRSTKAnticoagAFFlutter
    define "SDE Ethnicity":
      SDE."SDE Ethnicity"
Logic Definition | Library Name: CMS71FHIRSTKAnticoagAFFlutter
    define "Encounter With Comfort Measures During Hospitalization For Patients With Documented Atrial Fibrillation Or Flutter":
      "Denominator" Encounter
        with TJC."Intervention Comfort Measures" ComfortMeasure
          such that Coalesce(start of ComfortMeasure.performed.toInterval(), ComfortMeasure.authoredOn) during Encounter.hospitalizationWithObservation ( )
Logic Definition | Library Name: CMS71FHIRSTKAnticoagAFFlutter
    define "Denominator Exclusions":
      ( "Denominator" Encounter
          where Encounter.status = 'finished'
            and ( Encounter.hospitalization.dischargeDisposition in "Discharge To Acute Care Facility"
                or Encounter.hospitalization.dischargeDisposition in "Left Against Medical Advice"
                or Encounter.hospitalization.dischargeDisposition in "Patient Expired"
                or Encounter.hospitalization.dischargeDisposition in "Discharged to Home for Hospice Care"
                or Encounter.hospitalization.dischargeDisposition in "Discharged to Health Care Facility for Hospice Care"
            )
      )
        union "Encounter With Comfort Measures During Hospitalization For Patients With Documented Atrial Fibrillation Or Flutter"
Logic Definition | Library Name: CMS71FHIRSTKAnticoagAFFlutter
    define "SDE Race":
      SDE."SDE Race"
Logic Definition | Library Name: CMS71FHIRSTKAnticoagAFFlutter
    define "Documented Reason For Not Giving Anticoagulant At Discharge":
      ( ["MedicationNotRequested": "Anticoagulant Therapy"] NoAnticoagulant
          where ( NoAnticoagulant.reasonCode in "Medical Reason For Not Providing Treatment"
              or NoAnticoagulant.reasonCode in "Patient Refusal"
          )
            and ( NoAnticoagulant.isCommunity ( )
                or NoAnticoagulant.isDischarge ( )
            )
            and NoAnticoagulant.status in { 'active', 'completed' }
            and NoAnticoagulant.intent in { 'order', 'original-order', 'reflex-order', 'filler-order', 'instance-order' }
      )
        union ( ["MedicationRequest": "Anticoagulant Therapy"] MedReqAntiCoagulant
            with ["TaskRejected"] TaskReject
              such that TaskReject.focus.references ( MedReqAntiCoagulant )
                and ( TaskReject.statusReason in "Medical Reason For Not Providing Treatment"
                    or TaskReject.statusReason in "Patient Refusal"
                )
                and MedReqAntiCoagulant.status in { 'active', 'completed' }
                and TaskReject.code ~ QICoreCommon."Fulfill"
        )
Logic Definition | Library Name: CMS71FHIRSTKAnticoagAFFlutter
    define "Denominator Exceptions":
      "Denominator" Encounter
        with "Documented Reason For Not Giving Anticoagulant At Discharge" NoDischargeAnticoagulant
          such that NoDischargeAnticoagulant.authoredOn during Encounter.period
Logic Definition | Library Name: FHIRHelpers
    define function ToString(value uri): value.value
Logic Definition | Library Name: FHIRHelpers
    /*
    @description: Converts the given [Period](https://hl7.org/fhir/datatypes.html#Period)
    value to a CQL DateTime Interval
    @comment: If the start value of the given period is unspecified, the starting
    boundary of the resulting interval will be open (meaning the start of the interval
    is unknown, as opposed to interpreted as the beginning of time).
    */
    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: FHIRHelpers
    /*
    @description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.
    */
    define function ToConcept(concept FHIR.CodeableConcept):
        if concept is null then
            null
        else
            System.Concept {
                codes: concept.coding C return ToCode(C),
                display: concept.text.value
            }
Logic Definition | Library Name: FHIRHelpers
    /*
    @description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.
    */
    define function ToCode(coding FHIR.Coding):
        if coding is null then
            null
        else
            System.Code {
              code: coding.code.value,
              system: coding.system.value,
              version: coding.version.value,
              display: coding.display.value
            }
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Returns true if any of the given references are to the given resource
    @comment: Returns true if the `id` element of the given resource exactly equals the tail of any of the given references.
    NOTE: This function assumes resources from the same source server.
    */
    define fluent function references(references List<Reference>, resource Resource):
      exists (references R where R.references(resource))
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Returns true if the given reference is to the given resource
    @comment: Returns true if the `id` element of the given resource exactly equals the tail of the given reference.
    NOTE: This function assumes resources from the same source server.
    */
    define fluent function references(reference Reference, resource Resource):
      resource.id = Last(Split(reference.reference, '/'))
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Returns true if the given code is in the given codeList
    @comment: Returns true if the `code` is equivalent to any of the codes in the given `codeList`, false otherwise.
    */
    define fluent function includesCode(codeList List<Concept>, code Code):
      exists (codeList C where C ~ code)
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Returns true if the given reference is to the given resourceId
    @comment: Returns true if the `resourceId` parameter exactly equals the tail of the given reference.
    NOTE: This function assumes resources from the same source server.
    */
    define fluent function references(reference Reference, resourceId String):
      resourceId = Last(Split(reference.reference, '/'))
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
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Given an interval, return the starting point if the interval has a starting boundary specified,
    otherwise, return the ending point
    */
    define fluent function earliest(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>> ):
      (choice.toInterval()) period
        return
          if (period."hasStart"()) then start of period
          else end of period
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Given an interval, return true if the interval has a starting boundary specified
    (i.e. the start of the interval is not null and not the minimum DateTime value)
    */
    define fluent function hasStart(period Interval<DateTime> ):
      not ( start of period is null
          or start of period = minimum DateTime
      )
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Returns true if the given MedicationRequest has a category of Community
    */
    define fluent function isCommunity(medicationRequest Choice<MedicationRequest, MedicationNotRequested>):
      exists (medicationRequest.category C
        where C ~ Community
      )
Logic Definition | Library Name: QICoreCommon
    /*
    @description: Returns true if the given MedicationRequest has a category of Discharge
    */
    define fluent function isDischarge(medicationRequest Choice<MedicationRequest, MedicationNotRequested>):
      exists (medicationRequest.category C
        where C ~ Discharge
      )
Logic Definition | Library Name: CQMCommon
    /*
     @description: Returns the condition that is specified as the principal diagnosis for the encounter and has a code in the given valueSet.
     @comment: See the QICore 6 Authoring Patterns discussion on [Principal Diagnosis and Present on Admission](https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns-QICore-v6.0.0#conditions-present-on-admission-and-principal-diagnoses) for more information
     */
     define fluent function hasPrincipalDiagnosisOf(encounter Encounter, valueSet ValueSet):
       (encounter.principalDiagnosis()) PD
         return PD.diagnosis in valueSet
           or PD.diagnosis.getCondition().code in valueSet
Logic Definition | Library Name: CQMCommon
    /*
    @description: Returns the claim diagnosis element that is specified as the principal diagnosis for the encounter
     @comment: See the QICore 6 Authoring Patterns discussion on [Principal Diagnosis and Present on Admission](https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns-QICore-v6.0.0#conditions-present-on-admission-and-principal-diagnoses) for more information
    */
    define fluent function principalDiagnosis(encounter Encounter):
    singleton from (
         (encounter.claimDiagnosis()) CD
           where CD.type.includesCode("Principal Diagnosis")
       )
Logic Definition | Library Name: CQMCommon
    /*
    @description: Returns the claim diagnosis elements for the given encounter
    @comment: See the QICore 6 Authoring Patterns discussion on [Principal Diagnosis and Present on Admission](https://github.com/cqframework/CQL-Formatting-and-Usage-Wiki/wiki/Authoring-Patterns-QICore-v6.0.0#conditions-present-on-admission-and-principal-diagnoses) for more information
    */
    define fluent function claimDiagnosis(encounter Encounter):
      encounter E
        let
          claim: ([Claim] C where C.status = 'active' and C.use = 'claim' and exists (C.item I where I.encounter.references(E))),
          claimItem: (claim.item I where I.encounter.references(E))
        return claim.diagnosis D where D.sequence in claimItem.diagnosisSequence
Logic Definition | Library Name: CQMCommon
    /*
    @description: Returns the Condition resource for the given reference
    */
    define fluent function getCondition(reference Reference):
      singleton from (([ConditionEncounterDiagnosis] union [ConditionProblemsHealthConcerns]) C where reference.references(C.id))
Logic Definition | Library Name: CQMCommon
    /*
    @description: Returns the Condition resources referenced by the diagnosis element of the Encounter
    */
    define fluent function encounterDiagnosis(Encounter Encounter ):
      Encounter.reasonReference D
        return singleton from (([ConditionEncounterDiagnosis] union [ConditionProblemsHealthConcerns]) C where D.references(C.id))
Logic Definition | Library Name: CQMCommon
    /*
    @description: Hospitalization with Observation returns the total interval from the start of any immediately prior emergency department visit through the observation visit to the discharge of the given encounter
    */
    define fluent function hospitalizationWithObservation(TheEncounter Encounter ):
      TheEncounter Visit
      		let ObsVisit: Last([Encounter: "Observation Services"] LastObs
      				where LastObs.status = 'finished'
                and LastObs.period ends 1 hour or less on or before start of Visit.period
      				sort by end of period
      			),
      			VisitStart: Coalesce(start of ObsVisit.period, start of Visit.period),
      			EDVisit: Last([Encounter: "Emergency Department Visit"] LastED
      				where LastED.status = 'finished'
                and LastED.period ends 1 hour or less on or before VisitStart
      				sort by end of period
      			)
      		return Interval[Coalesce(start of EDVisit.period, VisitStart), end of Visit.period]
Terminology
Code System | Description: Code system SNOMEDCT Resource: http://snomed.info/sct Canonical URL: `http://snomed.info/sct`
Code System | Description: Code system Diagnosis Type Resource: http://terminology.hl7.org/CodeSystem/ex-diagnosistype Canonical URL: `http://terminology.hl7.org/CodeSystem/ex-diagnosistype`
Code System | Description: Code system ConditionVerificationStatusCodes Resource: http://terminology.hl7.org/CodeSystem/condition-ver-status Canonical URL: `http://terminology.hl7.org/CodeSystem/condition-ver-status`
Code System | Description: Code system MedicationRequestCategory Resource: http://terminology.hl7.org/CodeSystem/medicationrequest-category Canonical URL: `http://terminology.hl7.org/CodeSystem/medicationrequest-category`
Code System | Description: Code system TaskCodeSystem Resource: http://hl7.org/fhir/CodeSystem/task-code Canonical URL: `http://hl7.org/fhir/CodeSystem/task-code`
Value Set | Description: Value set Nonelective Inpatient Encounter Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.424 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.424`
Value Set | Description: Value set Ischemic Stroke Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.247 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.247`
Value Set | Description: Value set Atrial Ablation Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.203 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.203`
Value Set | Description: Value set History of Atrial Ablation Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.76 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.76`
Value Set | Description: Value set Atrial Fibrillation or Flutter Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.202 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.202`
Value Set | Description: Value set Anticoagulant Therapy Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.200 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.200`
Value Set | Description: Value set Payer Type Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591`
Value Set | Description: Value set Discharge To Acute Care Facility Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.87 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.87`
Value Set | Description: Value set Left Against Medical Advice Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.308 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.308`
Value Set | Description: Value set Patient Expired Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.309 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.309`
Value Set | Description: Value set Discharged to Home for Hospice Care Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.209 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.209`
Value Set | Description: Value set Discharged to Health Care Facility for Hospice Care Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.207 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.207`
Value Set | Description: Value set Comfort Measures Resource: http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45`
Value Set | Description: Value set Observation Services Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143`
Value Set | Description: Value set Emergency Department Visit Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292`
Value Set | Description: Value set Medical Reason For Not Providing Treatment Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.473 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.473`
Value Set | Description: Value set Patient Refusal Resource: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.93 Canonical URL: `http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.93`
Direct Reference Code | Display: Male (finding) Code: 248153007 System: `http://snomed.info/sct`
Direct Reference Code | Display: Female (finding) Code: 248152002 System: `http://snomed.info/sct`
Direct Reference Code | Display: Principal Diagnosis Code: principal System: `http://terminology.hl7.org/CodeSystem/ex-diagnosistype`
Direct Reference Code | Display: Refuted Code: refuted System: `http://terminology.hl7.org/CodeSystem/condition-ver-status`
Direct Reference Code | Display: Entered in Error Code: entered-in-error System: `http://terminology.hl7.org/CodeSystem/condition-ver-status`
Direct Reference Code | Display: Community Code: community System: `http://terminology.hl7.org/CodeSystem/medicationrequest-category`
Direct Reference Code | Display: Discharge Code: discharge System: `http://terminology.hl7.org/CodeSystem/medicationrequest-category`
Direct Reference Code | Display: Fulfill Code: fulfill System: `http://hl7.org/fhir/CodeSystem/task-code`
Dependencies
Dependency | Description: QICore model information Resource: http://hl7.org/fhir/Library/QICore-ModelInfo Canonical URL: `http://hl7.org/fhir/Library/QICore-ModelInfo`
Dependency | Description: Library SDE Resource: https://madie.cms.gov/Library/SupplementalDataElements|5.1.000 Canonical URL: `https://madie.cms.gov/Library/SupplementalDataElements|5.1.000`
Dependency | Description: Library FHIRHelpers Resource: https://madie.cms.gov/Library/FHIRHelpers|4.4.000 Canonical URL: `https://madie.cms.gov/Library/FHIRHelpers|4.4.000`
Dependency | Description: Library TJC Resource: https://madie.cms.gov/Library/TJCOverall|8.25.000 Canonical URL: `https://madie.cms.gov/Library/TJCOverall|8.25.000`
Dependency | Description: Library CQMCommon Resource: https://madie.cms.gov/Library/CQMCommon|4.1.000 Canonical URL: `https://madie.cms.gov/Library/CQMCommon|4.1.000`
Dependency | Description: Library QICoreCommon Resource: https://madie.cms.gov/Library/QICoreCommon|4.0.000 Canonical URL: `https://madie.cms.gov/Library/QICoreCommon|4.0.000`
Data Requirements
Data Requirement | Type: Patient Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient Must Support Elements: extension, birthDate, birthDate.value, url
Data Requirement | Type: Encounter Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter Must Support Elements: type, status, status.value, period, diagnosis, diagnosis.code, hospitalization, hospitalization.dischargeDisposition Code Filter(s): Path: type ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1111.143
Data Requirement | Type: Encounter Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter Must Support Elements: type, status, status.value, period, diagnosis, diagnosis.code, hospitalization, hospitalization.dischargeDisposition Code Filter(s): Path: type ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.292
Data Requirement | Type: Encounter Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter Must Support Elements: type, period, diagnosis, diagnosis.code, status, status.value, hospitalization, hospitalization.dischargeDisposition Code Filter(s): Path: type ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.424
Data Requirement | Type: Resource Profile(s): http://hl7.org/fhir/StructureDefinition/Resource Must Support Elements: id, id.value
Data Requirement | Type: Claim Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-claim Must Support Elements: status, status.value, use, use.value, item
Data Requirement | Type: Condition Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis Must Support Elements: code, verificationStatus, onset Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.76
Data Requirement | Type: Condition Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-encounter-diagnosis
Data Requirement | Type: Condition Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns Must Support Elements: code, verificationStatus, onset Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.76
Data Requirement | Type: Condition Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns
Data Requirement | Type: Condition Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition-problems-health-concerns Must Support Elements: code, verificationStatus, onset Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.202
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.117.1.7.1.203
Data Requirement | Type: Procedure Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure Must Support Elements: code, status, status.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45
Data Requirement | Type: Observation Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-simple-observation Must Support Elements: code, status, status.value, effective Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113762.1.4.1110.76
Data Requirement | Type: MedicationRequest Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest Must Support Elements: medication, status, status.value, intent, intent.value, authoredOn, authoredOn.value Code Filter(s): Path: medication ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.200
Data Requirement | Type: MedicationRequest Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationrequest Must Support Elements: medication.reference.value, status, status.value, intent, intent.value, authoredOn, authoredOn.value
Data Requirement | Type: Medication Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medication Must Support Elements: id.value, code
Data Requirement | Type: Task Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-taskrejected Must Support Elements: focus, code, statusReason
Data Requirement | Type: Coverage Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage Must Support Elements: type, period Code Filter(s): Path: type ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591
Data Requirement | Type: ServiceRequest Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-servicerequest Must Support Elements: code, status, status.value, intent, intent.value Code Filter(s): Path: code ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/1.3.6.1.4.1.33895.1.3.0.45
Data Requirement | Type: MedicationRequest Profile(s): http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-medicationnotrequested Must Support Elements: medication, reasonCode, status, status.value, intent, intent.value Code Filter(s): Path: medication ValueSet: http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.117.1.7.1.200
Generated using version 0.4.8 of the sample-content-ig Liquid templates