eCQM QICore Content Implementation Guide
2023.0.0 - CI Build

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

## Measure: Cataracts: 20/40 or Better Visual Acuity within 90 Days Following Cataract SurgeryFHIR

Official URL: http://ecqi.healthit.gov/ecqms/Measure/Cataracts2040BCVAwithin90DaysFHIR | Version: 0.0.007
Draft as of 2023-10-27 | ​ Responsible: American Academy of Ophthalmology | Computable Name: Cataracts2040BCVAwithin90DaysFHIR
Other Identifiers: Short Name (use: usual, ), UUID:84905817-706b-48a8-a8f8-a05436cd6a0e (use: official, ), UUID:71bb8dc6-ca81-48a4-aa82-af4a0df0e92c (use: official, ), Endorser (use: official, ), Publisher (use: official, )
Usage:Program: EP/EC
Copyright/Legal: Copyright 2023 American Academy of Ophthalmology. All Rights Reserved.

Percentage of cataract surgeries for patients aged 18 and older with a diagnosis of uncomplicated cataract and no significant ocular conditions impacting the visual outcome of surgery and had best-corrected visual acuity of 20/40 or better (distance or near) achieved in the operative eye within 90 days following the cataract surgery

UNKNOWN

Title: | Cataracts: 20/40 or Better Visual Acuity within 90 Days Following Cataract SurgeryFHIR
Id: | Cataracts2040BCVAwithin90DaysFHIR
Download cql: | Cataracts2040BCVAwithin90DaysFHIR.cql
Version: | 0.0.007
Url: | Cataracts: 20/40 or Better Visual Acuity within 90 Days Following Cataract SurgeryFHIR
short-name identifier: | CMS133FHIR
version-independent identifier: | urn:uuid:84905817-706b-48a8-a8f8-a05436cd6a0e
version-specific identifier: | urn:uuid:71bb8dc6-ca81-48a4-aa82-af4a0df0e92c
endorser (NQF) identifier: | 0565e
publisher (CMS) identifier: | 133FHIR
Effective Period: | 2024-01-01 ..2024-12-31
Status: | draft
Date: | 2023-10-27 08:12:31+0000
Approval Date: | 2023-08-14
Last Review Date: | 2023-08-14
Name: | Cataracts2040BCVAwithin90DaysFHIR
Publisher: | American Academy of Ophthalmology
Author: | ​American Academy of Ophthalmology: www.aao.org, American Medical Association (AMA): https://www.ama-assn.org/
Description: | Percentage of cataract surgeries for patients aged 18 and older with a diagnosis of uncomplicated cataract and no significant ocular conditions impacting the visual outcome of surgery and had best-corrected visual acuity of 20/40 or better (distance or near) achieved in the operative eye within 90 days following the cataract surgery
Use Context: |
code | value
--- | ---
program |
Purpose: | UNKNOWN
Copyright: | Copyright 2023 American Academy of Ophthalmology. All Rights Reserved.
Disclaimer: | The Measure is not a clinical guideline, does not establish a standard of medical care, and has not been tested for all potential applications. The Measure, while copyrighted, can be reproduced and distributed, without modification, for noncommercial purposes, e.g., use by health care providers in connection with their practices. Commercial use is defined as the sale, license, or distribution of the Measure for commercial gain, or incorporation of the Measure into a product or service that is sold, licensed or distributed for commercial gain. Commercial uses of the Measure require a license agreement between the user and the American Academy of Ophthalmology (Academy). Neither the Academy, PCPI, nor the American Medical Association (AMA), nor the former AMA-convened Physician Consortium for Performance Improvement(R) (AMA-PCPI), nor their members shall be responsible for any use of the Measure. The PCPI’s and AMA’s significant past efforts and contributions to the development and updating of the Measures are acknowledged. The National Committee for Quality Assurance’s significant past efforts and contributions to the development and updating of the Measure is acknowledged. THE MEASURE AND SPECIFICATIONS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. Limited proprietary coding is contained in the Measure specifications for convenience. A license agreement must be entered prior to a third party’s use of Current Procedural Terminology (CPT[R]) or other proprietary code set contained in the Measures. Any other use of CPT or other coding by the third party is strictly prohibited. The Academy, its members, the AMA, and former members of the PCPI disclaim all liability for use or accuracy of any CPT or other coding contained in the specifications. CPT(R) contained in the Measure specifications is copyright 2004-2022 American Medical Association. LOINC(R) is copyright 2004-2022 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2022 International Health Terminology Standards Development Organisation. ICD-10 is copyright 2022 World Health Organization. All Rights Reserved. Due to technical limitations, registered trademarks are indicated by (R) or [R].
Rationale: | In the United States, cataracts affect more than 24 million adults over 40 years (National Eye Institute, 2019). According to the American Academy of Ophthalmology (2021), cataract surgery has a substantial beneficial impact on visual function and on quality of life. Scientific basis for measuring visual acuity outcomes after cataract surgery The only reason to perform cataract surgery (other than for a limited set of medical indications) is to improve a patient's vision and associated functioning. The use of a 20/40 visual acuity threshold is based on several considerations. First, it is the level for unrestricted operation of a motor vehicle in the US. Second, it has been consistently used by the FDA in its assessment for approval of intraocular lens (IOL) and other vision devices. Third, it is the literature standard to denote success in cataract surgery. Fourth, work by West et al. in the Salisbury Eye Study suggests that 20/40 is a useful threshold for 50th percentile functioning for several vision-related tasks. Most patients achieve excellent visual acuity after cataract surgery (20/40 or better). This outcome is achieved consistently through careful attention through the accurate measurement of axial length and corneal power and the appropriate selection of an IOL power calculation formula. As such, it reflects the care and diligence with which the surgery is assessed, planned and executed. Failure to achieve this after surgery in eyes without comorbid ocular conditions that would impact the success of the surgery would reflect care that should be assessed for opportunities for improvement. The exclusion of patients with other ocular and systemic conditions known to increase the risk of an adverse outcome reflects the findings of the two published prediction rule papers for cataract surgery outcomes, by Mangione et al. (1995) and Steinberg et al. (1994). In both papers, the presence of comorbid glaucoma and macular degeneration negatively impacted the likelihood of successful outcomes of surgery. Further, as noted in the prior indicator, exclusion of eyes with ocular conditions that could impact the success of the surgery would NOT eliminate the large majority of eyes undergoing surgery while also minimizing the potential adverse selection that might otherwise occur relative to those patients with the most complex situations who might benefit the most from having surgery to maximize their remaining vision. Evidence of a gap in care Cataract surgery successfully restores vision in the majority of people who have the procedure. Data from a study of 368,256 cataract surgeries show that corrected visual acuity (CDVA) of 0.5 (20/40) or better was achieved in 94.3% and CDVA of 1.0 (20/20) or better was achieved in 61.3% of cases (Lundstrom, Barry, Henry, Rosen & Stenevi, 2013). Additionally, data from a UK multi-center Cataract National Dataset found a postoperative visual acuity of 6/12 (20/40) or better was achieved for 94.7% of eyes with no co-pathologies and in 79.9% of eyes with one or more co-pathologies (Jaycock et al., 2009). A rate of 85.5-94.7% of patients achieving a 20/40 or better visual acuity in the context of approximately 3 million cataract surgeries in the US annually would mean that between 160,000 to 435,000 individuals would not achieve a 20/40 or better visual acuity which suggests an opportunity for improvement.
Clinical recommendation statement: | This is an outcome measure. As such, there is no statement in the guideline specific to this measurement topic.
Guidance (Usage): | This eCQM is an episode-based measure. An episode for this measure is defined as each cataract surgery during the measurement period, including instances where more than one cataract procedure was performed during the measurement period. Every cataract surgery during the measurement period should be counted as a measurable denominator event for the measure calculation. Only procedures performed during January 1 - September 30 of the reporting period will be considered for this measure, in order to determine if 20/40 or better visual acuity has been achieved within the 90 days following the cataract procedure. Cataract procedures performed during October 1 - December 31 are excluded from the initial population. The measure, as written, does not specifically require documentation of laterality. Coding limitations in particular clinical terminologies do not currently allow for that level of specificity (ICD-10-CM includes laterality, but SNOMED-CT does not uniformly include this distinction). Therefore, at this time, it is not a requirement of this measure to indicate laterality of the diagnoses, findings or procedures. Available coding to capture the data elements specified in this measure has been provided. It is assumed that the eligible professional or eligible clinician will record laterality in the patient medical record, as quality care and clinical documentation should include laterality. This measure is to be reported by the clinician performing the cataract surgery procedure. Clinicians who provide only preoperative or postoperative management of cataract patients are not eligible for this measure. Telehealth encounters are not eligible for this measure because the measure does not contain telehealth-eligible encounter codes. This FHIR-based measure has been derived from the QDM-based measure: CMS133v12. Please refer to the HL7 QI-Core Implementation Guide (http://hl7.org/fhir/us/qicore/index.html) for more information on QI-Core and mapping recommendations from QDM to QI-Core 4.1.1 (http://hl7.org/fhir/us/qicore/qdm-to-qicore.html).
Population Criteria: |
64529e07beb771640fc4cc00
Initial Population: | All cataract surgeries performed between January and September of the measurement period for patients 18 years and older
Denominator: | Equals Initial Population
Denominator Exclusion: | Cataract surgeries in patients with significant ocular conditions impacting the visual outcome of surgery
Numerator: | Cataract surgeries with best-corrected visual acuity of 20/40 or better (distance or near) achieved in the operative eye within 90 days following cataract surgery
Numerator Exclusion: | None
Denominator Exception: | None
Supplemental Data Guidance : |
Supplemental Data Elements: | SDE Payer SDE Ethnicity SDE Race SDE Sex
Libraries: |
Cataracts2040BCVAwithin90DaysFHIR
Related Artifact Dependencies: | SupplementalDataElements version: 3.4.000 QICoreCommon version: 1.5.000 FHIRHelpers version: 4.3.000 `http://hl7.org/fhir/v3/AdministrativeGender` SNOMED CT (all versions) Condition Clinical Status Codes Cataract Surgery Best Corrected Visual Acuity Exam Using Snellen Chart Visual Acuity 20/40 or Better Payer Acute and Subacute Iridocyclitis Amblyopia Burn Confined to Eye and Adnexa Cataract Secondary to Ocular Disorders Cataract, Congenital Cataract, Mature or Hypermature Cataract, Posterior Polar Central Corneal Ulcer Certain Types of Iridocyclitis Choroidal Degenerations Choroidal Detachment Choroidal Hemorrhage and Rupture Chronic Iridocyclitis Cloudy Cornea Corneal Edema Corneal Opacity and Other Disorders of Cornea Degeneration of Macula and Posterior Pole Degenerative Disorders of Globe Diabetic Macular Edema Diabetic Retinopathy Disorders of Optic Chiasm Disorders of Visual Cortex Disseminated Chorioretinitis and Disseminated Retinochoroiditis Focal Chorioretinitis and Focal Retinochoroiditis Glaucoma Glaucoma Associated with Congenital Anomalies, Dystrophies, and Systemic Syndromes Hereditary Choroidal Dystrophies Hereditary Corneal Dystrophies Hereditary Retinal Dystrophies Hypotony of Eye Injury to Optic Nerve and Pathways Macular Scar of Posterior Polar Morgagnian Cataract Nystagmus and Other Irregular Eye Movements Open Wound of Eyeball Optic Atrophy Optic Neuritis Other and Unspecified Forms of Chorioretinitis and Retinochoroiditis Other Background Retinopathy and Retinal Vascular Changes Other Disorders of Optic Nerve Other Endophthalmitis Other Proliferative Retinopathy Pathologic Myopia Posterior Lenticonus Prior Penetrating Keratoplasty Purulent Endophthalmitis Retinal Detachment with Retinal Defect Retinal Vascular Occlusion Retrolental Fibroplasias Scleritis Separation of Retinal Layers Traumatic Cataract Uveitis Vascular Disorders of Iris and Ciliary Body Visual Field Defects
Parameters: |
name | use | min | max | type
--- | --- | --- | --- | ---
Measurement Period | In | 0 | 1 | Period
SDE Sex | Out | 0 | 1 | Coding
Numerator | Out | 0 | * | Resource
Denominator | Out | 0 | * | Resource
SDE Payer | Out | 0 | * | Resource
Initial Population | Out | 0 | * | Resource
SDE Ethnicity | Out | 0 | 1 | Resource
Denominator Exclusions | Out | 0 | * | Resource
SDE Race | Out | 0 | 1 | Resource
DataRequirements: |
Type | Elements | Valueset Name | Valueset
--- | --- | --- | ---
Patient(QICorePatient) | ethnicity race |  |
Procedure(QICoreProcedure) | code performed status status.value | Cataract Surgery | Cataract Surgery
Observation(QICoreObservation) | code effective status status.value value |  |
Observation(QICoreObservation) | code effective status status.value value | Best Corrected Visual Acuity Exam Using Snellen Chart | Best Corrected Visual Acuity Exam Using Snellen Chart
Coverage(QICoreCoverage) | type period | Payer Type | Payer
Condition(QICoreCondition) | code | Acute and Subacute Iridocyclitis | Acute and Subacute Iridocyclitis
Condition(QICoreCondition) | code | Amblyopia | Amblyopia
Condition(QICoreCondition) | code | Burn Confined to Eye and Adnexa | Burn Confined to Eye and Adnexa
Condition(QICoreCondition) | code | Cataract Secondary to Ocular Disorders | Cataract Secondary to Ocular Disorders
Condition(QICoreCondition) | code | Cataract Congenital | Cataract, Congenital
Condition(QICoreCondition) | code | Cataract Mature or Hypermature | Cataract, Mature or Hypermature
Condition(QICoreCondition) | code | Cataract Posterior Polar | Cataract, Posterior Polar
Condition(QICoreCondition) | code | Central Corneal Ulcer | Central Corneal Ulcer
Condition(QICoreCondition) | code | Certain Types of Iridocyclitis | Certain Types of Iridocyclitis
Condition(QICoreCondition) | code | Choroidal Degenerations | Choroidal Degenerations
Condition(QICoreCondition) | code | Choroidal Detachment | Choroidal Detachment
Condition(QICoreCondition) | code | Choroidal Hemorrhage and Rupture | Choroidal Hemorrhage and Rupture
Condition(QICoreCondition) | code | Chronic Iridocyclitis | Chronic Iridocyclitis
Condition(QICoreCondition) | code | Cloudy Cornea | Cloudy Cornea
Condition(QICoreCondition) | code | Corneal Edema | Corneal Edema
Condition(QICoreCondition) | code | Disorders of Cornea Including Corneal Opacity | Corneal Opacity and Other Disorders of Cornea
Condition(QICoreCondition) | code | Degeneration of Macula and Posterior Pole | Degeneration of Macula and Posterior Pole
Condition(QICoreCondition) | code | Degenerative Disorders of Globe | Degenerative Disorders of Globe
Condition(QICoreCondition) | code | Diabetic Macular Edema | Diabetic Macular Edema
Condition(QICoreCondition) | code | Diabetic Retinopathy | Diabetic Retinopathy
Condition(QICoreCondition) | code | Disorders of Optic Chiasm | Disorders of Optic Chiasm
Condition(QICoreCondition) | code | Disorders of Visual Cortex | Disorders of Visual Cortex
Condition(QICoreCondition) | code | Disseminated Chorioretinitis and Disseminated Retinochoroiditis | Disseminated Chorioretinitis and Disseminated Retinochoroiditis
Condition(QICoreCondition) | code | Focal Chorioretinitis and Focal Retinochoroiditis | Focal Chorioretinitis and Focal Retinochoroiditis
Condition(QICoreCondition) | code | Glaucoma | Glaucoma
Condition(QICoreCondition) | code | Glaucoma Associated with Congenital Anomalies and Dystrophies and Systemic Syndromes | Glaucoma Associated with Congenital Anomalies, Dystrophies, and Systemic Syndromes
Condition(QICoreCondition) | code | Hereditary Choroidal Dystrophies | Hereditary Choroidal Dystrophies
Condition(QICoreCondition) | code | Hereditary Corneal Dystrophies | Hereditary Corneal Dystrophies
Condition(QICoreCondition) | code | Hereditary Retinal Dystrophies | Hereditary Retinal Dystrophies
Condition(QICoreCondition) | code | Hypotony of Eye | Hypotony of Eye
Condition(QICoreCondition) | code | Injury to Optic Nerve and Pathways | Injury to Optic Nerve and Pathways
Condition(QICoreCondition) | code | Macular Scar of Posterior Polar | Macular Scar of Posterior Polar
Condition(QICoreCondition) | code | Morgagnian Cataract | Morgagnian Cataract
Condition(QICoreCondition) | code | Nystagmus and Other Irregular Eye Movements | Nystagmus and Other Irregular Eye Movements
Condition(QICoreCondition) | code | Open Wound of Eyeball | Open Wound of Eyeball
Condition(QICoreCondition) | code | Optic Atrophy | Optic Atrophy
Condition(QICoreCondition) | code | Optic Neuritis | Optic Neuritis
Condition(QICoreCondition) | code | Other and Unspecified Forms of Chorioretinitis and Retinochoroiditis | Other and Unspecified Forms of Chorioretinitis and Retinochoroiditis
Condition(QICoreCondition) | code | Other Background Retinopathy and Retinal Vascular Changes | Other Background Retinopathy and Retinal Vascular Changes
Condition(QICoreCondition) | code | Other Disorders of Optic Nerve | Other Disorders of Optic Nerve
Condition(QICoreCondition) | code | Other Endophthalmitis | Other Endophthalmitis
Condition(QICoreCondition) | code | Other Proliferative Retinopathy | Other Proliferative Retinopathy
Condition(QICoreCondition) | code | Pathologic Myopia | Pathologic Myopia
Condition(QICoreCondition) | code | Posterior Lenticonus | Posterior Lenticonus
Condition(QICoreCondition) | code | Prior Penetrating Keratoplasty | Prior Penetrating Keratoplasty
Condition(QICoreCondition) | code | Purulent Endophthalmitis | Purulent Endophthalmitis
Condition(QICoreCondition) | code | Retinal Detachment with Retinal Defect | Retinal Detachment with Retinal Defect
Condition(QICoreCondition) | code | Retinal Vascular Occlusion | Retinal Vascular Occlusion
Condition(QICoreCondition) | code | Retrolental Fibroplasias | Retrolental Fibroplasias
Condition(QICoreCondition) | code | Scleritis | Scleritis
Condition(QICoreCondition) | code | Separation of Retinal Layers | Separation of Retinal Layers
Condition(QICoreCondition) | code | Traumatic Cataract | Traumatic Cataract
Condition(QICoreCondition) | code | Uveitis | Uveitis
Condition(QICoreCondition) | code | Vascular Disorders of Iris and Ciliary Body | Vascular Disorders of Iris and Ciliary Body
Condition(QICoreCondition) | code | Visual Field Defects | Visual Field Defects
Direct Reference Codes: |
display | code | system
--- | --- | ---
Male | M | http://hl7.org/fhir/v3/AdministrativeGender
Female | F | http://hl7.org/fhir/v3/AdministrativeGender
Best corrected visual acuity (observable entity) | 419775003 | http://snomed.info/sct
| active | http://terminology.hl7.org/CodeSystem/condition-clinical
| recurrence | http://terminology.hl7.org/CodeSystem/condition-clinical
| relapse | http://terminology.hl7.org/CodeSystem/condition-clinical
Logic Definitions: |
Group | Scoring | Population Criteria | Expression
--- | --- | --- | ---
64529e07beb771640fc4cc00 | Group scoring: proportion
|  | Initial Population |
    define "Initial Population":
      "Cataract Surgery Between January and September of Measurement Period" CataractSurgeryPerformed
        where AgeInYearsAt(date from start of "Measurement Period") >= 18
|  | Denominator |
    define "Denominator":
      "Initial Population"
|  | Denominator Exclusion |
    define "Denominator Exclusions":
      "Cataract Surgery Between January and September of Measurement Period" CataractSurgeryPerformed
        with ( [Condition: "Acute and Subacute Iridocyclitis"]
          union [Condition: "Amblyopia"]
          union [Condition: "Burn Confined to Eye and Adnexa"]
          union [Condition: "Cataract Secondary to Ocular Disorders"]
          union [Condition: "Cataract Congenital"]
          union [Condition: "Cataract Mature or Hypermature"]
          union [Condition: "Cataract Posterior Polar"]
          union [Condition: "Central Corneal Ulcer"]
          union [Condition: "Certain Types of Iridocyclitis"]
          union [Condition: "Choroidal Degenerations"]
          union [Condition: "Choroidal Detachment"]
          union [Condition: "Choroidal Hemorrhage and Rupture"]
          union [Condition: "Chronic Iridocyclitis"]
          union [Condition: "Cloudy Cornea"]
          union [Condition: "Corneal Edema"]
          union [Condition: "Disorders of Cornea Including Corneal Opacity"]
          union [Condition: "Degeneration of Macula and Posterior Pole"]
          union [Condition: "Degenerative Disorders of Globe"]
          union [Condition: "Diabetic Macular Edema"]
          union [Condition: "Diabetic Retinopathy"]
          union [Condition: "Disorders of Optic Chiasm"]
          union [Condition: "Disorders of Visual Cortex"]
          union [Condition: "Disseminated Chorioretinitis and Disseminated Retinochoroiditis"]
          union [Condition: "Focal Chorioretinitis and Focal Retinochoroiditis"]
          union [Condition: "Glaucoma"]
          union [Condition: "Glaucoma Associated with Congenital Anomalies and Dystrophies and Systemic Syndromes"]
          union [Condition: "Hereditary Choroidal Dystrophies"]
          union [Condition: "Hereditary Corneal Dystrophies"]
          union [Condition: "Hereditary Retinal Dystrophies"]
          union [Condition: "Hypotony of Eye"]
          union [Condition: "Injury to Optic Nerve and Pathways"]
          union [Condition: "Macular Scar of Posterior Polar"]
          union [Condition: "Morgagnian Cataract"]
          union [Condition: "Nystagmus and Other Irregular Eye Movements"]
          union [Condition: "Open Wound of Eyeball"]
          union [Condition: "Optic Atrophy"]
          union [Condition: "Optic Neuritis"]
          union [Condition: "Other and Unspecified Forms of Chorioretinitis and Retinochoroiditis"]
          union [Condition: "Other Background Retinopathy and Retinal Vascular Changes"]
          union [Condition: "Other Disorders of Optic Nerve"]
          union [Condition: "Other Endophthalmitis"]
          union [Condition: "Other Proliferative Retinopathy"]
          union [Condition: "Pathologic Myopia"]
          union [Condition: "Posterior Lenticonus"]
          union [Condition: "Prior Penetrating Keratoplasty"]
          union [Condition: "Purulent Endophthalmitis"]
          union [Condition: "Retinal Detachment with Retinal Defect"]
          union [Condition: "Retinal Vascular Occlusion"]
          union [Condition: "Retrolental Fibroplasias"]
          union [Condition: "Scleritis"]
          union [Condition: "Separation of Retinal Layers"]
          union [Condition: "Traumatic Cataract"]
          union [Condition: "Uveitis"]
          union [Condition: "Vascular Disorders of Iris and Ciliary Body"]
          union [Condition: "Visual Field Defects"] ) ComorbidDiagnosis
          such that ComorbidDiagnosis.prevalenceInterval ( ) overlaps before CataractSurgeryPerformed.performed.toInterval ( )
            and ComorbidDiagnosis.isActive ( )
|  | Numerator |
    define "Numerator":
      "Cataract Surgery Between January and September of Measurement Period" CataractSurgeryPerformed
        with ( [Observation: "Best corrected visual acuity (observable entity)"]
          union [Observation: "Best Corrected Visual Acuity Exam Using Snellen Chart"] ) VisualAcuityExamPerformed
          such that VisualAcuityExamPerformed.effective.toInterval ( ) 90 days or less after day of end of CataractSurgeryPerformed.performed.toInterval ( )
            and VisualAcuityExamPerformed.status in { 'final', 'amended', 'corrected', 'preliminary' }
            and VisualAcuityExamPerformed.value as Concept in "Visual Acuity 20/40 or Better"
|  | Numerator Exclusion | None
|  | Denominator Exception | None

Library Name | Name
--- | ---
SupplementalDataElements | SDE Sex
    define "SDE Sex":
      case
          when Patient.gender = 'male' then "M"
          when Patient.gender = 'female' then "F"
          else null
        end
Library Name | Name
Cataracts2040BCVAwithin90DaysFHIR | SDE Sex
    define "SDE Sex":
      SDE."SDE Sex"
Library Name | Name
Cataracts2040BCVAwithin90DaysFHIR | Cataract Surgery Between January and September of Measurement Period
    define "Cataract Surgery Between January and September of Measurement Period":
      [Procedure: "Cataract Surgery"] CataractSurgery
        where CataractSurgery.performed.toInterval ( ) during "Measurement Period"
          and CataractSurgery.performed.toInterval ( ) starts 92 days or more before end of "Measurement Period"
          and CataractSurgery.status = 'completed'
Library Name | Name
Cataracts2040BCVAwithin90DaysFHIR | Numerator
    define "Numerator":
      "Cataract Surgery Between January and September of Measurement Period" CataractSurgeryPerformed
        with ( [Observation: "Best corrected visual acuity (observable entity)"]
          union [Observation: "Best Corrected Visual Acuity Exam Using Snellen Chart"] ) VisualAcuityExamPerformed
          such that VisualAcuityExamPerformed.effective.toInterval ( ) 90 days or less after day of end of CataractSurgeryPerformed.performed.toInterval ( )
            and VisualAcuityExamPerformed.status in { 'final', 'amended', 'corrected', 'preliminary' }
            and VisualAcuityExamPerformed.value as Concept in "Visual Acuity 20/40 or Better"
Library Name | Name
Cataracts2040BCVAwithin90DaysFHIR | Initial Population
    define "Initial Population":
      "Cataract Surgery Between January and September of Measurement Period" CataractSurgeryPerformed
        where AgeInYearsAt(date from start of "Measurement Period") >= 18
Library Name | Name
Cataracts2040BCVAwithin90DaysFHIR | Denominator
    define "Denominator":
      "Initial Population"
Library Name | Name
SupplementalDataElements | SDE Payer
    define "SDE Payer":
      [Coverage: type in "Payer Type"] Payer
        return {
          code: Payer.type,
          period: Payer.period
        }
Library Name | Name
Cataracts2040BCVAwithin90DaysFHIR | SDE Payer
    define "SDE Payer":
      SDE."SDE Payer"
Library Name | Name
SupplementalDataElements | SDE Ethnicity
    define "SDE Ethnicity":
      Patient.ethnicity E
        return Tuple {
          codes: { E.ombCategory } union E.detailed,
          display: E.text
        }
Library Name | Name
Cataracts2040BCVAwithin90DaysFHIR | SDE Ethnicity
    define "SDE Ethnicity":
      SDE."SDE Ethnicity"
Library Name | Name
Cataracts2040BCVAwithin90DaysFHIR | Denominator Exclusions
    define "Denominator Exclusions":
      "Cataract Surgery Between January and September of Measurement Period" CataractSurgeryPerformed
        with ( [Condition: "Acute and Subacute Iridocyclitis"]
          union [Condition: "Amblyopia"]
          union [Condition: "Burn Confined to Eye and Adnexa"]
          union [Condition: "Cataract Secondary to Ocular Disorders"]
          union [Condition: "Cataract Congenital"]
          union [Condition: "Cataract Mature or Hypermature"]
          union [Condition: "Cataract Posterior Polar"]
          union [Condition: "Central Corneal Ulcer"]
          union [Condition: "Certain Types of Iridocyclitis"]
          union [Condition: "Choroidal Degenerations"]
          union [Condition: "Choroidal Detachment"]
          union [Condition: "Choroidal Hemorrhage and Rupture"]
          union [Condition: "Chronic Iridocyclitis"]
          union [Condition: "Cloudy Cornea"]
          union [Condition: "Corneal Edema"]
          union [Condition: "Disorders of Cornea Including Corneal Opacity"]
          union [Condition: "Degeneration of Macula and Posterior Pole"]
          union [Condition: "Degenerative Disorders of Globe"]
          union [Condition: "Diabetic Macular Edema"]
          union [Condition: "Diabetic Retinopathy"]
          union [Condition: "Disorders of Optic Chiasm"]
          union [Condition: "Disorders of Visual Cortex"]
          union [Condition: "Disseminated Chorioretinitis and Disseminated Retinochoroiditis"]
          union [Condition: "Focal Chorioretinitis and Focal Retinochoroiditis"]
          union [Condition: "Glaucoma"]
          union [Condition: "Glaucoma Associated with Congenital Anomalies and Dystrophies and Systemic Syndromes"]
          union [Condition: "Hereditary Choroidal Dystrophies"]
          union [Condition: "Hereditary Corneal Dystrophies"]
          union [Condition: "Hereditary Retinal Dystrophies"]
          union [Condition: "Hypotony of Eye"]
          union [Condition: "Injury to Optic Nerve and Pathways"]
          union [Condition: "Macular Scar of Posterior Polar"]
          union [Condition: "Morgagnian Cataract"]
          union [Condition: "Nystagmus and Other Irregular Eye Movements"]
          union [Condition: "Open Wound of Eyeball"]
          union [Condition: "Optic Atrophy"]
          union [Condition: "Optic Neuritis"]
          union [Condition: "Other and Unspecified Forms of Chorioretinitis and Retinochoroiditis"]
          union [Condition: "Other Background Retinopathy and Retinal Vascular Changes"]
          union [Condition: "Other Disorders of Optic Nerve"]
          union [Condition: "Other Endophthalmitis"]
          union [Condition: "Other Proliferative Retinopathy"]
          union [Condition: "Pathologic Myopia"]
          union [Condition: "Posterior Lenticonus"]
          union [Condition: "Prior Penetrating Keratoplasty"]
          union [Condition: "Purulent Endophthalmitis"]
          union [Condition: "Retinal Detachment with Retinal Defect"]
          union [Condition: "Retinal Vascular Occlusion"]
          union [Condition: "Retrolental Fibroplasias"]
          union [Condition: "Scleritis"]
          union [Condition: "Separation of Retinal Layers"]
          union [Condition: "Traumatic Cataract"]
          union [Condition: "Uveitis"]
          union [Condition: "Vascular Disorders of Iris and Ciliary Body"]
          union [Condition: "Visual Field Defects"] ) ComorbidDiagnosis
          such that ComorbidDiagnosis.prevalenceInterval ( ) overlaps before CataractSurgeryPerformed.performed.toInterval ( )
            and ComorbidDiagnosis.isActive ( )
Library Name | Name
SupplementalDataElements | SDE Race
    define "SDE Race":
      Patient.race R
        return Tuple {
          codes: R.ombCategory union R.detailed,
          display: R.text
        }
Library Name | Name
Cataracts2040BCVAwithin90DaysFHIR | SDE Race
    define "SDE Race":
      SDE."SDE Race"
Library Name | Name
QICoreCommon | toInterval
    /*
    @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.
    Any other input will reslt in a null DateTime Interval
    */
    define fluent function toInterval(choice Choice<DateTime, Quantity, Interval<DateTime>, Interval<Quantity>>):
      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)
    		else
    			null as Interval<DateTime>
    	end
Library Name | Name
FHIRHelpers | ToString
    define function ToString(value uri): value.value
Library Name | Name
FHIRHelpers | ToCode
    /*
    @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
            }
Library Name | Name
QICoreCommon | prevalenceInterval
    /*
    @description: Returns an interval representing the normalized prevalence period of a given Condition.
    @comment: Uses the ToInterval and ToAbatementInterval functions to determine the widest potential interval from
    onset to abatement as specified in the given Condition. If the condition is active, the resulting interval will have
    a closed ending boundary. If the condition is not active, the resulting interval will have an open ending boundary.
    */
    define fluent function prevalenceInterval(condition Condition):
    if condition.clinicalStatus ~ "active"
      or condition.clinicalStatus ~ "recurrence"
      or condition.clinicalStatus ~ "relapse" then
      Interval[start of condition.onset.toInterval(), end of condition.abatementInterval()]
    else
      Interval[start of condition.onset.toInterval(), end of condition.abatementInterval())
Library Name | Name
QICoreCommon | isActive
    /* Candidates for FHIRCommon */

    /*
    @description: Returns true if the given condition has a clinical status of active, recurrence, or relapse
    */
    define fluent function isActive(condition Condition):
      condition.clinicalStatus ~ "active"
        or condition.clinicalStatus ~ "recurrence"
        or condition.clinicalStatus ~ "relapse"