eCQM QICore Content Implementation Guide
2024.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 2024.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-2024/ and changes regularly. See the Directory of published versions

Measure: Preventive Care and Screening: Screening for Depression and Follow-Up PlanFHIR

Official URL: https://madie.cms.gov/Measure/PCSDepressionScreenAndFollowUpFHIR Version: 0.2.000
Draft as of 2024-07-09 Responsible: Centers for Medicare & Medicaid Services (CMS) Computable Name: PCSDepressionScreenAndFollowUpFHIR
Other Identifiers: Short Name (use: usual, ), UUID:deb30835-dbec-4f11-aab0-3a282040e37c (use: official, ), UUID:7cb8ac66-85c4-489b-aa4a-af861d69c9a5 (use: official, ), Publisher (use: official, )

Copyright/Legal: Limited proprietary coding is contained in the measure specifications for convenience. Users of the proprietary code sets should obtain all necessary licenses from the owners of these code sets. CPT(R) contained in the Measure specifications is copyright 2004-2023 American Medical Association. LOINC(R) is copyright 2004-2023 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2023 International Health Terminology Standards Development Organization. ICD-10 is copyright 2023 World Health Organization. All Rights Reserved.

Percentage of patients aged 12 years and older screened for depression on the date of the encounter or up to 14 days prior to the date of the encounter using an age-appropriate standardized depression screening tool AND if positive a follow-up plan is documented on the date of or up to two days after the date of the qualifying encounter.

UNKNOWN

Title: Preventive Care and Screening: Screening for Depression and Follow-Up PlanFHIR
Id: PCSDepressionScreenAndFollowUpFHIR
Version: 0.2.000
Url: Preventive Care and Screening: Screening for Depression and Follow-Up PlanFHIR
short-name identifier:

CMS2FHIR

version-independent identifier:

urn:uuid:deb30835-dbec-4f11-aab0-3a282040e37c

version-specific identifier:

urn:uuid:7cb8ac66-85c4-489b-aa4a-af861d69c9a5

publisher (CMS) identifier:

2FHIR

Effective Period: 2025-01-01..2025-12-31
Status: draft
Publisher: Centers for Medicare & Medicaid Services (CMS)
Author: Mathematica
Description:

Percentage of patients aged 12 years and older screened for depression on the date of the encounter or up to 14 days prior to the date of the encounter using an age-appropriate standardized depression screening tool AND if positive a follow-up plan is documented on the date of or up to two days after the date of the qualifying encounter.

Purpose:

UNKNOWN

Copyright:

Limited proprietary coding is contained in the measure specifications for convenience. Users of the proprietary code sets should obtain all necessary licenses from the owners of these code sets. CPT(R) contained in the Measure specifications is copyright 2004-2023 American Medical Association. LOINC(R) is copyright 2004-2023 Regenstrief Institute, Inc. This material contains SNOMED Clinical Terms(R) (SNOMED CT[R]) copyright 2004-2023 International Health Terminology Standards Development Organization. ICD-10 is copyright 2023 World Health Organization. All Rights Reserved.

Disclaimer:

These performance measures are not clinical guidelines and do not establish a standard of medical care, and have not been tested for all potential applications. THE MEASURES AND SPECIFICATIONS ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND. Due to technical limitations, registered trademarks are indicated by (R) or [R] and unregistered trademarks are indicated by (TM) or [TM].

Rationale:

Depression affects more than two hundred sixty million people across the world and is a leading cause of disability, with a variety of depressive disorders that are independent risk factors for chronic diseases, such as cardiovascular disease and diabetes, lending screening for depression as paramount to identify depressive disorders that can affect the most vulnerable populations (Costantini et al., 2021). Results from a 2018 U.S. survey indicated that 14.4 percent of adolescents (3.5 million adolescents) had a major depressive episode (MDE) in the past year, with nine percent of adolescents (2.4 million adolescents) having one MDE with severe impairment (Substance Abuse and Mental Health Services Administration, 2019). The odds of a diagnosis of depression are believed to be 2.6 times greater for children and adolescents exposed to trauma as compared to those unexposed or less exposed (Vibhakar et al., 2019). Children and teens with major depressive disorder (MDD) have been found to have difficulty carrying out their daily activities, relating to others, growing up healthy, and are at an increased risk of suicide (Siu on behalf of the U.S. Preventive Services Task Force [USPSTF], 2016). The same 2018 study indicated that 7.2 percent of adults aged 18 or older (17.7 million adults) had at least one MDE with 4.7 percent of adults (11.5 million adults) having one MDE with severe impairment in the past year (Substance Abuse and Mental Health Services Administration, 2019). Moreover, it is estimated 22.9 percent of adult patients with chronic pain (2.2 million adults) were diagnosed with comorbid depression from 2011 to 2015, with an upward trend of prevalence among Black Americans, patients aged 65 to 84 years old, Medicare and Medicaid insured patients, and patients from zip code areas with low annual household incomes (Orhurhu et al., 2019). Depression and other mood disorders, such as bipolar disorder and anxiety disorders, especially during the perinatal period, can have devastating effects on women, infants, and families (American College of Obstetricians and Gynecologists, 2018). It's estimated that the global prevalence of antenatal (or perinatal) depression ranges from 15 to 65 percent, with current or previous exposure to abuse and violence, lack of social support, and family history of mental disorders being risk factors. Depressive symptoms measured during pregnancy have been shown to influence the quality of the postpartum mother-infant relationship (Hazell Raine et al., 2020). Additionally, the risk of low birth weight and preterm birth is higher among infants born from depressed mothers (Dadi, Miller, Bisetegn, & Mwanri, 2020). Negative outcomes associated with depression make it crucial to screen in order to identify and treat depression in its early stages. Multiple social costs of depression have been identified, such as reduced educational achievements, poor financial success and role performance, higher amount of days out of role, and increased risk of job loss (Costantini et al., 2021). Depression also imposes significant economic burden through direct and indirect costs, supporting the need for regular depression screening. "In the United States, an estimated $22.8 billion was spent on depression treatment in 2009, and lost productivity cost an additional estimated $23 billion in 2011" (Siu & USPSTF, 2016, p. 383-384). Numerous studies have found significant disparities in depression prevalence and treatment among racial/ethnic minorities. One study revealed that Indigenous adults are at a high risk for posttraumatic stress disorder, depression, suicide, substance use disorder, and concurrent behavioral health disorders secondary to these initial health problems (Ka’apu and Burnette, 2019). Additionally, though rates of depression are lower among Blacks and Hispanics than among whites, depression among Blacks and Hispanics is likely to be more recurrent. Furthermore, 48 percent of whites receive mental health services, compared to just 31 percent of Blacks and Hispanics, and 22 percent of Asians (American Psychiatric Association, 2017). Asian Americans and Black Americans are also significantly more likely to utilize emergency rooms for depression treatment, which contributes to inconsistent follow-up care (Lee et al., 2014). While primary care providers (PCPs) serve as the first line of defense in the detection of depression, studies show that PCPs fail to recognize up to 46 percent of depressed patients (Borner et al., 2010). "In nationally representative U.S. surveys, about eight percent of adolescents reported having major depression in the past year. Only 36 percent to 44 percent of children and adolescents with depression receive treatment, suggesting that a majority of depressed youth are undiagnosed and untreated" (Siu on behalf of USPSTF, 2016). Furthermore, evidence supports that screening for depression in pregnant and postpartum women is of moderate net benefit, and treatment options for positive depression screening should be available for patients twelve and older including pregnant and postpartum women. This measure seeks to align with USPSTF clinical guideline recommendations as well as the Healthy People 2030 recommendation to increase the proportion of adolescents and adults who are screened for depression and if positive, receive appropriate treatment (U.S. Preventive Services Task Force, 2016). For patients depression, rescreening has been shown to be an effective tool for measuring response to therapy, therefore influencing appropriate care adjustments in the treatment of depression (Anderson et al., 2002). Chen et al. noted that when patients were re-administered a screening tool after at least eight weeks after starting treatment, their "score gave primary care physicians a clear idea about the nature of patients' depressive symptoms and gave both the patient and the physician an indication of treatment progress" (Chen et al., 2006).

Clinical recommendation statement:

Adolescent Recommendation (12-18 years): "The USPSTF recommends screening for MDD in adolescents aged 12 to 18 years. Screening should be implemented with adequate systems in place to ensure accurate diagnosis, effective treatment, and appropriate follow-up (B recommendation)" (Siu on behalf of USPSTF, 2016). Adult Recommendation (18 years and older): "The USPSTF recommends screening for depression in the general adult population, including pregnant and postpartum women. Screening should be implemented with adequate systems in place to ensure accurate diagnosis, effective treatment, and appropriate follow-up (B recommendation)" (Siu & USPSTF, 2016). “The USPSTF recommends that clinicians provide or refer pregnant and postpartum persons who are at increased risk of perinatal depression to counseling interventions (B recommendation)” (U.S. Preventive Services Task Force, 2019). The American College of Obstetricians and Gynecologists (ACOG) provides the following recommendation: "All obstetrician–gynecologists and other obstetric care providers should complete a full assessment of mood and emotional well-being (including screening for postpartum depression and anxiety with a validated instrument) during the comprehensive postpartum visit for each patient" (American College of Obstetricians and Gynecologists, 2018). The Institute for Clinical Systems Improvement (ICSI) health care guideline, Adult Depression in Primary Care, provides the following recommendations: 1. "Clinicians should routinely screen all adults for depression using a standardized instrument." 2. "Clinicians should establish and maintain follow-up with patients." 3. "Clinicians should screen and monitor depression in pregnant and post-partum women" (Trangle et al., 2016).

Guidance (Usage): The intent of the measure is to screen all patients for depression except those with a diagnosis of bipolar disorder. Patients who have ever been diagnosed with bipolar disorder prior to the qualifying encounter will be excluded from the measure regardless of whether the diagnosis is active or not. A depression screen is completed on the date of the encounter or up to 14 calendar days prior to the date of the encounter using an age-appropriate standardized depression screening tool AND if positive, a follow-up plan must be documented on the date of or up to two calendar days after the date of the encounter, such as referral to a provider for additional evaluation, pharmacological interventions, or other interventions for the treatment of depression. An example to illustrate the follow-up plan documentation timing: if the encounter is on a Monday from 3-4 pm (day 0) and the patient screens positive, the clinician has through anytime on Wednesday (day 2) to complete follow-up plan documentation. This measure does not require documentation of a specific score, just whether results of the normalized and validated depression screening tool used are considered positive or negative. Each standardized screening tool provides guidance on whether a particular score is considered positive for depression. This eCQM is a patient-based measure. Depression screening is required once per measurement period, not at all encounters. Screening Tools: - An age-appropriate, standardized, and validated depression screening tool must be used for numerator compliance. - The name of the age-appropriate standardized depression screening tool utilized must be documented in the medical record. - The depression screening must be reviewed and addressed by the provider, filing the code, on the date of the encounter. Positive pre-screening results indicating a patient is at high risk for self-harm should receive more urgent intervention as determined by the provider practice. - The screening should occur during a qualifying encounter or up to 14 calendar days prior to the date of the qualifying encounter. - The measure assesses the most recent depression screening completed either during the qualifying encounter or within the 14 calendar days prior to that encounter. Therefore, a clinician would not be able to complete another screening at the time of the encounter to count towards a follow-up, because that would serve as the most recent screening. In order to satisfy the follow-up requirement for a patient screening positively, the eligible clinician would need to provide one of the aforementioned follow-up actions, which does not include use of a standardized depression screening tool. Follow-Up Plan: The follow-up plan MUST still be provided for and discussed with the patient during the qualifying encounter used to evaluate the numerator. However, documentation of the follow-up plan can occur up to two calendar days after the qualifying encounter, in accordance with the policies of an eligible clinician or provider’s practice or health system. All services should be documented during, or as soon as practicable, after the qualifying encounter in order to maintain an accurate medical record. The follow-up plan must be related to a positive depression screening, for example: "Patient referred for psychiatric evaluation due to positive depression screening." Examples of a follow-up plan include but are not limited to: - Referral to a provider or program for further evaluation for depression, for example, referral to a psychiatrist, psychiatric nurse practitioner, psychologist, clinical social worker, mental health counselor, or other mental health service such as family or group therapy, support group, depression management program, or other service for treatment of depression - Other interventions designed to treat depression such as behavioral health evaluation, psychotherapy, pharmacological interventions, or additional treatment options Should a patient screen positive for depression, a clinician should: - Only order pharmacological intervention when appropriate and after sufficient diagnostic evaluation. However, for the purposes of this measure, additional screening and assessment during the qualifying encounter will not qualify as a follow-up plan. - Opt to complete a suicide risk assessment when appropriate and based on individual patient characteristics. However, for the purposes of this measure, a suicide risk assessment or an additional screening using a standardized tool will not qualify as a follow-up plan. This FHIR-based measure has been derived from the QDM-based measure: CMS2v14. Please refer to the HL7 QI-Core Implementation Guide (https://hl7.org/fhir/us/qicore/STU4.1.1/) for more information on QI-Core and mapping recommendations from QDM to QI-Core 4.1.1 (https://hl7.org/fhir/us/qicore/STU4.1.1/qdm-to-qicore.html).
Population Criteria:
64ef8dd856d636294b157c6f
Initial Population: All patients aged 12 years and older at the beginning of the measurement period with at least one qualifying encounter during the measurement period
Denominator: Equals Initial Population
Denominator Exclusion: Patients who have ever been diagnosed with bipolar disorder at any time prior to the qualifying encounter
Numerator: Patients screened for depression on the date of the encounter or up to 14 days prior to the date of the encounter using an age-appropriate standardized tool AND if positive, a follow-up plan is documented on the date of or up to two days after the date of the qualifying encounter
Denominator Exception: Patient Reason(s) Patient refuses to participate in or complete the depression screening OR Medical Reason(s) Documentation of medical reason for not screening patient for depression (e.g., cognitive, functional, or motivational limitations that may impact accuracy of results; patient is in an urgent or emergent situation where time is of the essence and to delay treatment would jeopardize the patient's health status)
Supplemental Data Elements:

SDE Ethnicity

SDE Payer

SDE Race

SDE Sex

Supplemental Data Guidance : For every patient evaluated by this measure also identify payer, race, ethnicity, and sex; SDE Ethnicity SDE Payer SDE Race SDE Sex
Libraries:
PCSDepressionScreenAndFollowUpFHIR
Terminology and Other Dependencies:
  • Library/SupplementalDataElements|3.5.000
  • Library/FHIRHelpers|4.4.000
  • Library/QICoreCommon|2.1.000
  • AdministrativeGender
  • Logical Observation Identifiers, Names and Codes (LOINC)
  • SNOMED CT (all versions)
  • Condition Category Codes
  • US Core Condition Category Extension Codes
  • Encounter to Screen for Depression
  • Physical Therapy Evaluation
  • Telephone Visits
  • Adolescent Depression Medications
  • Referral for Adolescent Depression
  • Follow Up for Adolescent Depression
  • Adult Depression Medications
  • Referral for Adult Depression
  • Follow Up for Adult Depression
  • Payer
  • Bipolar Disorder
  • Medical Reason
  • Parameters:
    name use min max type
    Measurement Period In 0 1 Period
    SDE Sex Out 0 1 Coding
    Numerator Out 0 1 boolean
    Denominator Out 0 1 boolean
    SDE Payer Out 0 * Resource
    Initial Population Out 0 1 boolean
    SDE Ethnicity Out 0 1 Resource
    Denominator Exclusions Out 0 1 boolean
    SDE Race Out 0 1 Resource
    Denominator Exceptions Out 0 1 boolean
    DataRequirements:
    Resource Type Resource Elements Valueset Name Valueset
    Patient(QICorePatient) ethnicity race
    Encounter(QICoreEncounter) type period status status.value Encounter to Screen for Depression Encounter to Screen for Depression
    Encounter(QICoreEncounter) type period status status.value Physical Therapy Evaluation Physical Therapy Evaluation
    Encounter(QICoreEncounter) type period status status.value Telephone Visits Telephone Visits
    Observation(QICoreObservation) code effective value status status.value
    Observation(QICoreObservation) code effective value status status.value
    Medication(QICoreMedication) id
    Medication(QICoreMedication) id
    MedicationRequest(QICoreMedicationRequest) medication status status.value intent intent.value Adolescent Depression Medications Adolescent Depression Medications
    MedicationRequest(QICoreMedicationRequest) medication.reference status status.value intent intent.value
    MedicationRequest(QICoreMedicationRequest) medication status status.value intent intent.value Adult Depression Medications Adult Depression Medications
    ServiceRequest(QICoreServiceRequest) code status status.value Referral for Adolescent Depression Referral for Adolescent Depression
    ServiceRequest(QICoreServiceRequest) code status status.value Referral for Adult Depression Referral for Adult Depression
    Procedure(QICoreProcedure) code status status.value Follow Up for Adolescent Depression Follow Up for Adolescent Depression
    Procedure(QICoreProcedure) code status status.value Follow Up for Adult Depression Follow Up for Adult Depression
    Coverage(QICoreCoverage) type period Payer Type Payer
    Condition(QICoreCondition) code Bipolar Disorder Bipolar Disorder
    Observation(QICoreObservationNotDone) code issued issued.value extension status status.value
    Observation(QICoreObservationNotDone) code issued issued.value extension status status.value
    Direct Reference Codes:
    display code system
    Male M http://hl7.org/fhir/administrative-gender
    Female F http://hl7.org/fhir/administrative-gender
    Adolescent depression screening assessment 73831-0 http://loinc.org
    Depression screening negative (finding) 428171000124102 http://snomed.info/sct
    Depression screening positive (finding) 428181000124104 http://snomed.info/sct
    Adult depression screening assessment 73832-8 http://loinc.org
    Problem List Item problem-list-item http://terminology.hl7.org/CodeSystem/condition-category
    Health Concern health-concern http://hl7.org/fhir/us/core/CodeSystem/condition-category
    Depression screening declined (situation) 720834000 http://snomed.info/sct
    Logic Definitions:
    Group Scoring Population Criteria Expression
    64ef8dd856d636294b157c6f Group scoring: proportion
    Type:

    Process

    Rate Aggregation: None
    Improvement Notation:

    increase

    Initial Population
    define "Initial Population":
      "Patient Age 12 Years or Older at Start of Measurement Period"
        and exists ( "Qualifying Encounter During Measurement Period" )
    Denominator
    define "Denominator":
      "Initial Population"
    Denominator Exclusion
    define "Denominator Exclusions":
      exists "History of Bipolar Diagnosis Before Qualifying Encounter"
    Numerator
    define "Numerator":
      ( "Patient Age 12 to 16 Years at Start of Measurement Period"
          and ( "Has Most Recent Adolescent Screening Negative"
              or exists "Most Recent Adolescent Depression Screening Positive and Follow Up Provided"
          )
      )
        or ( "Patient Age 17 Years at Start of Measurement Period"
            and ( "Has Most Recent Adolescent Screening Negative"
                or exists "Most Recent Adolescent Depression Screening Positive and Follow Up Provided"
                or "Has Most Recent Adult Screening Negative"
                or exists "Most Recent Adult Depression Screening Positive and Follow Up Provided"
            )
        )
        or ( "Patient Age 18 Years or Older at Start of Measurement Period"
            and ( "Has Most Recent Adult Screening Negative"
                or exists "Most Recent Adult Depression Screening Positive and Follow Up Provided"
            )
        )
    Denominator Exception
    define "Denominator Exceptions":
      ( exists "Medical or Patient Reason for Not Screening Adolescent for Depression"
          and not "Has Adolescent Depression Screening"
      )
        or ( exists "Medical or Patient Reason for Not Screening Adult for Depression"
            and not "Has Adult Depression Screening"
        )
    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
    PCSDepressionScreenAndFollowUpFHIR SDE Sex
    define "SDE Sex":
      SDE."SDE Sex"
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Patient Age 12 to 16 Years at Start of Measurement Period
    define "Patient Age 12 to 16 Years at Start of Measurement Period":
      AgeInYearsAt(date from start of "Measurement Period") in Interval[12, 16]
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Qualifying Encounter During Measurement Period
    define "Qualifying Encounter During Measurement Period":
      ( [Encounter: "Encounter to Screen for Depression"]
        union [Encounter: "Physical Therapy Evaluation"]
        union [Encounter: "Telephone Visits"] ) QualifyingEncounter
        where QualifyingEncounter.period during day of "Measurement Period"
          and QualifyingEncounter.status = 'finished'
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Most Recent Adolescent Depression Screening
    define "Most Recent Adolescent Depression Screening":
      Last([Observation: "Adolescent depression screening assessment"] AdolescentDepressionScreening
          with "Qualifying Encounter During Measurement Period" QualifyingEncounter
            such that AdolescentDepressionScreening.effective.toInterval() 14 days or less on or before day of start of QualifyingEncounter.period
              and AdolescentDepressionScreening.value is not null
              and AdolescentDepressionScreening.status = 'final'
          sort by start of effective.toInterval()
      )
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Has Most Recent Adolescent Screening Negative
    define "Has Most Recent Adolescent Screening Negative":
      ( "Most Recent Adolescent Depression Screening" AdolescentScreen
          where AdolescentScreen.value ~ "Depression screening negative (finding)"
      ) is not null
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Follow Up Intervention for Positive Adolescent Depression Screening
    define "Follow Up Intervention for Positive Adolescent Depression Screening":
      ( ( [MedicationRequest: "Adolescent Depression Medications"] AdolescentMed
            where AdolescentMed.status in { 'active', 'completed' }
              and AdolescentMed.intent = 'order'
        )
          union ( [ServiceRequest: "Referral for Adolescent Depression"] AdolescentReferral
              where AdolescentReferral.status in { 'active', 'completed' }
          )
          union ( [Procedure: "Follow Up for Adolescent Depression"] AdolescentFollowUp
              where AdolescentFollowUp.status = 'completed'
          )
      )
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Most Recent Adolescent Depression Screening Positive and Follow Up Provided
    define "Most Recent Adolescent Depression Screening Positive and Follow Up Provided":
      from
        "Most Recent Adolescent Depression Screening" LastAdolescentScreen,
        "Follow Up Intervention for Positive Adolescent Depression Screening" FollowUpPositiveAdolescentScreen,
        "Qualifying Encounter During Measurement Period" QualifyingEncounter
        where LastAdolescentScreen.effective.toInterval ( ) starts 14 days or less on or before day of start of QualifyingEncounter.period
          and LastAdolescentScreen.value ~ "Depression screening positive (finding)"
          and ( start of FollowUpPositiveAdolescentScreen.performed.toInterval ( ) during QualifyingEncounter.period
              or FollowUpPositiveAdolescentScreen.authoredOn 2 days or less on or after day of end of QualifyingEncounter.period
          )
          and ( Coalesce(start of FollowUpPositiveAdolescentScreen.performed.toInterval(), FollowUpPositiveAdolescentScreen.authoredOn) during day of "Measurement Period" )
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Patient Age 17 Years at Start of Measurement Period
    define "Patient Age 17 Years at Start of Measurement Period":
      AgeInYearsAt(date from start of "Measurement Period") = 17
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Most Recent Adult Depression Screening
    define "Most Recent Adult Depression Screening":
      Last([Observation: "Adult depression screening assessment"] AdultDepressionScreening
          with "Qualifying Encounter During Measurement Period" QualifyingEncounter
            such that AdultDepressionScreening.effective.toInterval() 14 days or less on or before day of start of QualifyingEncounter.period
              and AdultDepressionScreening.value is not null
              and AdultDepressionScreening.status = 'final'
          sort by start of effective.toInterval()
      )
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Has Most Recent Adult Screening Negative
    define "Has Most Recent Adult Screening Negative":
      ( "Most Recent Adult Depression Screening" AdultScreen
          where AdultScreen.value ~ "Depression screening negative (finding)"
      ) is not null
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Follow Up Intervention for Positive Adult Depression Screening
    define "Follow Up Intervention for Positive Adult Depression Screening":
      ( ( [MedicationRequest: "Adult Depression Medications"] AdultMed
            where AdultMed.status in { 'active', 'completed' }
              and AdultMed.intent = 'order'
        )
          union ( [ServiceRequest: "Referral for Adult Depression"] AdultReferral
              where AdultReferral.status in { 'active', 'completed' }
          )
          union ( [Procedure: "Follow Up for Adult Depression"] AdultFollowUp
              where AdultFollowUp.status = 'completed'
          )
      )
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Most Recent Adult Depression Screening Positive and Follow Up Provided
    define "Most Recent Adult Depression Screening Positive and Follow Up Provided":
      from
        "Most Recent Adult Depression Screening" LastAdultScreen,
        "Follow Up Intervention for Positive Adult Depression Screening" FollowUpPositiveAdultScreen,
        "Qualifying Encounter During Measurement Period" QualifyingEncounter
        where LastAdultScreen.effective.toInterval ( ) starts 14 days or less on or before day of start of QualifyingEncounter.period
          and LastAdultScreen.value ~ "Depression screening positive (finding)"
          and ( start of FollowUpPositiveAdultScreen.performed.toInterval ( ) during QualifyingEncounter.period
              or FollowUpPositiveAdultScreen.authoredOn 2 days or less on or after day of end of QualifyingEncounter.period
          )
          and ( Coalesce(start of FollowUpPositiveAdultScreen.performed.toInterval(), FollowUpPositiveAdultScreen.authoredOn) during day of "Measurement Period" )
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Patient Age 18 Years or Older at Start of Measurement Period
    define "Patient Age 18 Years or Older at Start of Measurement Period":
      AgeInYearsAt(date from start of "Measurement Period") >= 18
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Numerator
    define "Numerator":
      ( "Patient Age 12 to 16 Years at Start of Measurement Period"
          and ( "Has Most Recent Adolescent Screening Negative"
              or exists "Most Recent Adolescent Depression Screening Positive and Follow Up Provided"
          )
      )
        or ( "Patient Age 17 Years at Start of Measurement Period"
            and ( "Has Most Recent Adolescent Screening Negative"
                or exists "Most Recent Adolescent Depression Screening Positive and Follow Up Provided"
                or "Has Most Recent Adult Screening Negative"
                or exists "Most Recent Adult Depression Screening Positive and Follow Up Provided"
            )
        )
        or ( "Patient Age 18 Years or Older at Start of Measurement Period"
            and ( "Has Most Recent Adult Screening Negative"
                or exists "Most Recent Adult Depression Screening Positive and Follow Up Provided"
            )
        )
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Patient Age 12 Years or Older at Start of Measurement Period
    define "Patient Age 12 Years or Older at Start of Measurement Period":
      AgeInYearsAt(date from start of "Measurement Period") >= 12
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Initial Population
    define "Initial Population":
      "Patient Age 12 Years or Older at Start of Measurement Period"
        and exists ( "Qualifying Encounter During Measurement Period" )
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR 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
    PCSDepressionScreenAndFollowUpFHIR 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
    PCSDepressionScreenAndFollowUpFHIR SDE Ethnicity
    define "SDE Ethnicity":
      SDE."SDE Ethnicity"
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR History of Bipolar Diagnosis Before Qualifying Encounter
    define "History of Bipolar Diagnosis Before Qualifying Encounter":
      [Condition: "Bipolar Disorder"] BipolarDiagnosis
        with "Qualifying Encounter During Measurement Period" QualifyingEncounter
          such that ( BipolarDiagnosis.isProblemListItem ( )
              or BipolarDiagnosis.isHealthConcern ( )
          )
            and BipolarDiagnosis.prevalenceInterval ( ) starts before QualifyingEncounter.period
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Denominator Exclusions
    define "Denominator Exclusions":
      exists "History of Bipolar Diagnosis Before Qualifying Encounter"
    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
    PCSDepressionScreenAndFollowUpFHIR SDE Race
    define "SDE Race":
      SDE."SDE Race"
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Medical or Patient Reason for Not Screening Adolescent for Depression
    define "Medical or Patient Reason for Not Screening Adolescent for Depression":
      [ObservationNotDone: code ~ "Adolescent depression screening assessment"] NoAdolescentScreen
        with "Qualifying Encounter During Measurement Period" QualifyingEncounter
          such that NoAdolescentScreen.issued during QualifyingEncounter.period
        where ( NoAdolescentScreen.notDoneReason ~ "Depression screening declined (situation)"
            or NoAdolescentScreen.notDoneReason in "Medical Reason"
        )
          and NoAdolescentScreen.status = 'cancelled'
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Has Adolescent Depression Screening
    define "Has Adolescent Depression Screening":
      exists ( [Observation: "Adolescent depression screening assessment"] AdolescentScreening
          with "Qualifying Encounter During Measurement Period" QualifyingEncounter
            such that AdolescentScreening.effective.toInterval ( ) 14 days or less on or before day of start of QualifyingEncounter.period
              and AdolescentScreening.value is not null
              and AdolescentScreening.status = 'final'
      )
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Medical or Patient Reason for Not Screening Adult for Depression
    define "Medical or Patient Reason for Not Screening Adult for Depression":
      [ObservationNotDone: code ~ "Adult depression screening assessment"] NoAdultScreen
        with "Qualifying Encounter During Measurement Period" QualifyingEncounter
          such that NoAdultScreen.issued during QualifyingEncounter.period
        where ( NoAdultScreen.notDoneReason ~ "Depression screening declined (situation)"
            or NoAdultScreen.notDoneReason in "Medical Reason"
        )
          and NoAdultScreen.status = 'cancelled'
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Has Adult Depression Screening
    define "Has Adult Depression Screening":
      exists ( [Observation: "Adult depression screening assessment"] AdultScreening
          with "Qualifying Encounter During Measurement Period" QualifyingEncounter
            such that AdultScreening.effective.toInterval ( ) 14 days or less on or before day of start of QualifyingEncounter.period
              and AdultScreening.value is not null
              and AdultScreening.status = 'final'
      )
    Library Name Name
    PCSDepressionScreenAndFollowUpFHIR Denominator Exceptions
    define "Denominator Exceptions":
      ( exists "Medical or Patient Reason for Not Screening Adolescent for Depression"
          and not "Has Adolescent Depression Screening"
      )
        or ( exists "Medical or Patient Reason for Not Screening Adult for Depression"
            and not "Has Adult Depression Screening"
        )
    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 isProblemListItem
    /*
    @description: Returns true if the given condition is a problem list item.
    */
    define fluent function isProblemListItem(condition Condition):
      exists (condition.category C
        where C ~ "problem-list-item"
      )
    Library Name Name
    FHIRHelpers ToConcept
    /*
    @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
            }
    Library Name Name
    QICoreCommon isHealthConcern
    /*
    @description: Returns true if the given condition is a health concern
    */
    define fluent function isHealthConcern(condition Condition):
      exists (condition.category C
        where C ~ "health-concern"
      )