Chronic Disease Surveillance
0.1.0 - CI Build International flag

Chronic Disease Surveillance, published by Clinical Quality Framework. This guide is not an authorized publication; it is the continuous build for version 0.1.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/cqframework/aphl-chronic-ig/ and changes regularly. See the Directory of published versions

Library: DepressionScreeningandFollowUp

Official URL: http://fhir.org/guides/cqf/aphl/chronic-ds/Library/DepressionScreeningandFollowUp Version: 0.1.0
Draft as of 2025-09-25 Computable Name: DepressionScreeningandFollowUp
Metadata
Version 0.1.0
Status Draft
Jurisdiction 001 from http://unstats.un.org/unsd/methods/m49/m49.htm
Steward (Publisher) Clinical Quality Framework
Type logic-library from http://terminology.hl7.org/CodeSystem/library-type
Parameter Name: Measurement Period
Use: In
Min Cardinality: 0
Max Cardinality: 1
Type: Period
Parameter Name: Patient
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Patient
Parameter Name: SDE Ethnicity
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Coding
Parameter Name: SDE Payer
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Resource
Parameter Name: SDE Race
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Coding
Parameter Name: SDE Sex
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Coding
Parameter Name: SDE Age
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: integer
Parameter Name: Stratifier Age Group
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Coding
Parameter Name: SDE State of Residence
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: string
Parameter Name: SDE Postal Code of Residence
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: string
Parameter Name: SDE Food Insecurity Risk Status
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: CodeableConcept
Parameter Name: Qualifying Encounters During Measurement Period
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Encounter
Parameter Name: Initial Population
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Denominator
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: History of Bipolar Diagnosis Before Qualifying Encounter
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Condition
Parameter Name: Denominator Exclusions
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Medical or Patient Reason for Not Screening Adolescent for Depression
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Observation
Parameter Name: Has Adolescent Depression Screening
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Observation
Parameter Name: Medical or Patient Reason for Not Screening Adult for Depression
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Observation
Parameter Name: Has Adult Depression Screening
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Observation
Parameter Name: Denominator Exceptions
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Patient Age 12 to 16 Years at Start of Measurement Period
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Most Recent Adolescent Depression Screening
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Observation
Parameter Name: Most Recent Adolescent Screening Negative
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Most Recent Adolescent Positive Depression Screening
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Observation
Parameter Name: Follow Up Interventions For Positive Adolescent Depression Screening
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Resource
Parameter Name: Most Recent Adolescent Depression Screening Positive and Follow Up Provided
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Patient Age 17 Years at Start of Measurement Period
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Most Recent Adult Depression Screening
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Observation
Parameter Name: Most Recent Adult Screening Negative
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Most Recent Adult Positive Depression Screening
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Observation
Parameter Name: Follow Up Interventions For Positive Adult Depression Screening
Use: Out
Min Cardinality: 0
Max Cardinality: *
Type: Resource
Parameter Name: Most Recent Adult Depression Screening Positive and Follow Up Provided
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Patient Age 18 Years or Older at Start of Measurement Period
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Numerator
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Data Requirement Type: Patient
Profile(s): Patient
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period
Code Filter(s):
Path: type
ValueSet: Encounter to Screen for Depression
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period
Code Filter(s):
Path: type
ValueSet: Physical Therapy Evaluation
Data Requirement Type: Encounter
Profile(s): Encounter
Must Support Elements: type, period
Code Filter(s):
Path: type
ValueSet: Telephone Visits
Data Requirement Type: Condition
Profile(s): Condition
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: Bipolar Disorder
Data Requirement Type: Observation
Profile(s): Observation
Must Support Elements: code, value, effective, issued
Code Filter(s):
Path: code
ValueSet: http://fhir.org/guides/cqf/aphl/chronic-ds/ValueSet/adolescent-depression-screening-assessment
Data Requirement Type: Observation
Profile(s): Observation
Must Support Elements: code, value, effective, issued
Code Filter(s):
Path: code
ValueSet: http://fhir.org/guides/cqf/aphl/chronic-ds/ValueSet/adult-depression-screening-assessment
Data Requirement Type: MedicationRequest
Profile(s): MedicationRequest
Must Support Elements: medication
Code Filter(s):
Path: medication
ValueSet: Adolescent Depression Medications
Data Requirement Type: MedicationRequest
Profile(s): MedicationRequest
Must Support Elements: medication
Code Filter(s):
Path: medication
ValueSet: Adult Depression Medications
Data Requirement Type: MedicationRequest
Profile(s): MedicationRequest
Must Support Elements: medication.reference
Data Requirement Type: Medication
Profile(s): Medication
Must Support Elements: id, code
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: Referral for Adolescent Depression
Data Requirement Type: ServiceRequest
Profile(s): ServiceRequest
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: Referral for Adult Depression
Data Requirement Type: Procedure
Profile(s): Procedure
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: Follow Up for Adolescent Depression
Data Requirement Type: Procedure
Profile(s): Procedure
Must Support Elements: code
Code Filter(s):
Path: code
ValueSet: Follow Up for Adult Depression
Library Content
CQL Content
library DepressionScreeningandFollowUp 

// CMS2v13: Preventive Care and Screening: Screening for Depression and Follow-Up Plan

using FHIR version '4.0.1'

include FHIRHelpers version '4.1.000' called FHIRHelpers
include SupplementalDataElementsFHIR4 version '2.0.000' called SDE
include MATGlobalCommonFunctionsFHIR4 version '6.0.000' called Global
include AdultOutpatientEncountersFHIR4 version '2.0.000' called AdultOutpatientEncounters
include HospiceFHIR4 version '2.0.000' called Hospice
include AdvancedIllnessandFrailtyExclusionECQMFHIR4 version '5.12.000' called Frailty
include SurveillanceDataElementsFHIR4 version '1.0.000' called SurveillanceDataElements
include AlphoraCommon called AC
include PalliativeCareFHIR called PalliativeCare
include FHIRCommon version '1.1.000' called FC 

codesystem "LOINC": 'http://loinc.org'
codesystem "SNOMEDCT": 'http://snomed.info/sct' 
codesystem "DataAbsentReason": 'http://terminology.hl7.org/CodeSystem/data-absent-reason'

valueset "Encounter to Screen for Depression": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.600.1916'
valueset "Physical Therapy Evaluation": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1022'
valueset "Telephone Visits": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1080'
valueset "Bipolar Disorder": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.67.1.101.1.128'
valueset "Medical Reason": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1007'
valueset "Adult Depression Screening Assessment": 'http://fhir.org/guides/cqf/aphl/chronic-ds/ValueSet/adult-depression-screening-assessment'
valueset "Adolescent Depression Screening Assessment": 'http://fhir.org/guides/cqf/aphl/chronic-ds/ValueSet/adolescent-depression-screening-assessment'

//adolescent
valueset "Adolescent Depression Medications": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1567'
valueset "Referral for Adolescent Depression": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1570'
valueset "Follow Up for Adolescent Depression": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1569'

//adult
valueset "Adult Depression Medications": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1566'
valueset "Referral for Adult Depression": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1571'
valueset "Follow Up for Adult Depression": 'http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1568'

code "Depression Screening Declined": '720834000' from "SNOMEDCT" display 'Depression Screening Declined (situation)'
// code "Adolescent Depression Screening Assessment": '73831-0' from "LOINC" display 'Adolescent Depression Screening Assessment'
// code "Adult Depression Screening Assessment": '73832-8' from "LOINC" display 'Adult Depression Screening Assessment'
code "Depression Screening Negative": '428171000124102' from "SNOMEDCT" display 'Depression Screening Negative (finding)'
code "Depression Screening Positive": '428181000124104' from "SNOMEDCT" display 'Depression Screening Positive (finding)'
code "not-performed": 'not-performed' from "DataAbsentReason"


parameter "Measurement Period" default Interval[@2025-01-01T00:00:00.000, @2026-01-01T00:00:00.000)

context Patient

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

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

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

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

define "SDE Age":
  SurveillanceDataElements."Age"

define "Stratifier Age Group":
  SurveillanceDataElements."Age Group"

define "SDE State of Residence":
  SurveillanceDataElements."State of Residence"

define "SDE Postal Code of Residence":
  SurveillanceDataElements."Postal Code of Residence"

define "SDE Food Insecurity Risk Status":
  SurveillanceDataElements."Food Insecurity Risk Status"



define "Initial Population":
  AgeInYearsAt(start of "Measurement Period") >= 12
    and exists(
      "Qualifying Encounters During Measurement Period" E 
        where FC.ToInterval(E.period) during "Measurement Period"
    )

define "Denominator":
  "Initial Population"

define "Denominator Exclusions":
  exists("History of Bipolar Diagnosis Before Qualifying Encounter")

define "Denominator Exceptions":
  (exists("Medical or Patient Reason for Not Screening Adolescent for Depression")
    and not exists("Has Adolescent Depression Screening"))
  or (exists("Medical or Patient Reason for Not Screening Adult for Depression")
    and not exists("Has Adult Depression Screening"))

define "Numerator":
  ( "Patient Age 12 to 16 Years at Start of Measurement Period"
      and ( "Most Recent Adolescent Screening Negative"
        or "Most Recent Adolescent Depression Screening Positive and Follow Up Provided" )
)
  or ( "Patient Age 17 Years at Start of Measurement Period"
    and ( "Most Recent Adolescent Screening Negative"
      or "Most Recent Adolescent Depression Screening Positive and Follow Up Provided"
      or "Most Recent Adult Screening Negative"
      or  "Most Recent Adult Depression Screening Positive and Follow Up Provided") 
  )
  or ( "Patient Age 18 Years or Older at Start of Measurement Period"
    and ( "Most Recent Adult Screening Negative"
      or "Most Recent Adult Depression Screening Positive and Follow Up Provided" ) )


define "Qualifying Encounters During Measurement Period":
  (AC.QualifiedEncounters([Encounter: "Encounter to Screen for Depression"])
    union AC.QualifiedEncounters([Encounter: "Physical Therapy Evaluation"])
    union AC.QualifiedEncounters([Encounter: "Telephone Visits"])) QualifyingEnc 
    where FC.ToInterval(QualifyingEnc.period) during "Measurement Period"


define function "Screening Within 14 Days of Encounter"(observation FHIR.Observation, encounter FHIR.Encounter)
returns System.Boolean:
  Coalesce(end of FC.ToInterval(observation.effective), observation.issued) 14 days or less before day of start of encounter.period
    and observation.value is not null

//Denominator Exclusion 
define "History of Bipolar Diagnosis Before Qualifying Encounter": 
  (AC.QualifiedConditions([Condition: "Bipolar Disorder"])) BipolarDiagnosis 
  with "Qualifying Encounters During Measurement Period" QualifyingEnc
    such that FC.ToPrevalenceInterval(BipolarDiagnosis) starts before QualifyingEnc.period


//Denominator Exception
define "Medical or Patient Reason for Not Screening Adolescent for Depression":
  AC.AbsentData([Observation: "Adolescent Depression Screening Assessment"], "Qualifying Encounters During Measurement Period", "Depression Screening Declined", "Medical Reason")

define "Has Adolescent Depression Screening":
  ((AC.QualifiedObservations([Observation: "Adolescent Depression Screening Assessment"])) AdolescentScreening
    with "Qualifying Encounters During Measurement Period" QualifyingEnc
      such that "Screening Within 14 Days of Encounter"(AdolescentScreening, QualifyingEnc))


define "Medical or Patient Reason for Not Screening Adult for Depression":
  AC.AbsentData([Observation: "Adult Depression Screening Assessment"], "Qualifying Encounters During Measurement Period", "Depression Screening Declined", "Medical Reason")

define "Has Adult Depression Screening":
  ((AC.QualifiedObservations([Observation: "Adult Depression Screening Assessment"])) AdolescentScreening
    with "Qualifying Encounters During Measurement Period" QualifyingEnc
      such that "Screening Within 14 Days of Encounter"(AdolescentScreening, QualifyingEnc))


//Numerator
define "Patient Age 12 to 16 Years at Start of Measurement Period":
  AgeInYearsAt(start of "Measurement Period") in Interval[12, 16]

define "Patient Age 17 Years at Start of Measurement Period":
  AgeInYearsAt(start of "Measurement Period") = 17

define "Patient Age 18 Years or Older at Start of Measurement Period":
  AgeInYearsAt(start of "Measurement Period") >= 18


//Adolescent Numerator
define "Most Recent Adolescent Depression Screening":
  AC.MostRecent(("Has Adolescent Depression Screening"))

define "Most Recent Adolescent Screening Negative":
  ("Most Recent Adolescent Depression Screening" AdolescentScreening
    where AdolescentScreening.value ~ ToConcept("Depression Screening Negative")) is not null

define "Most Recent Adolescent Positive Depression Screening":
  "Most Recent Adolescent Depression Screening" RecentScreening
    where RecentScreening.value ~ ToConcept("Depression Screening Positive")

define "Follow Up Interventions For Positive Adolescent Depression Screening":
  (AC.QualifiedMedicationRequests([MedicationRequest: "Adolescent Depression Medications"])
    union AC.QualifiedServiceRequests([ServiceRequest: "Referral for Adolescent Depression"])
    union AC.QualifiedProcedures([Procedure: "Follow Up for Adolescent Depression"])) FollowUpInterventions
    let "Intervention Day": Coalesce(FC.ToInterval(FollowUpInterventions.authoredOn), FC.ToInterval(FollowUpInterventions.performed))
    with "Qualifying Encounters During Measurement Period" QualifyingEnc
      such that "Intervention Day" same day as QualifyingEnc.period
      or "Intervention Day" 2 days or less after day of end of FC.ToInterval(QualifyingEnc.period) 
 
define "Most Recent Adolescent Depression Screening Positive and Follow Up Provided":
  ("Most Recent Adolescent Positive Depression Screening" RecentScreening
  let "Screening Day": Coalesce(FC.ToInterval(RecentScreening.effective), FC.ToInterval(RecentScreening.issued))
  with "Follow Up Interventions For Positive Adolescent Depression Screening" FollowUpInterventions
    such that "Screening Day" 14 days or less before start of Coalesce(FC.ToInterval(FollowUpInterventions.authoredOn), FC.ToInterval(FollowUpInterventions.performed))
  ) is not null 

//Adult Numerator
define "Most Recent Adult Depression Screening":
  AC.MostRecent(("Has Adult Depression Screening"))

define "Most Recent Adult Screening Negative":
  ("Most Recent Adult Depression Screening" AdultScreening
    where AdultScreening.value ~ ToConcept("Depression Screening Negative")) is not null

define "Most Recent Adult Positive Depression Screening":
  "Most Recent Adult Depression Screening" RecentScreening
    where RecentScreening.value ~ ToConcept("Depression Screening Positive")

define "Follow Up Interventions For Positive Adult Depression Screening":
  ((AC.QualifiedMedicationRequests([MedicationRequest: "Adult Depression Medications"])
    union AC.QualifiedServiceRequests([ServiceRequest: "Referral for Adult Depression"])
    union AC.QualifiedProcedures([Procedure: "Follow Up for Adult Depression"]))) FollowUpInterventions
    let "Intervention Day": Coalesce(FC.ToInterval(FollowUpInterventions.authoredOn), FC.ToInterval(FollowUpInterventions.performed))
    with "Qualifying Encounters During Measurement Period" QualifyingEnc
      such that "Intervention Day" same day as QualifyingEnc.period
      or "Intervention Day" 2 days or less after day of end of FC.ToInterval(QualifyingEnc.period) 

define "Most Recent Adult Depression Screening Positive and Follow Up Provided":
  ("Most Recent Adult Positive Depression Screening" RecentScreening
  let "Screening Day": Coalesce(FC.ToInterval(RecentScreening.effective), FC.ToInterval(RecentScreening.issued))
  with "Follow Up Interventions For Positive Adult Depression Screening" FollowUpInterventions
    such that "Screening Day" 14 days or less before start of Coalesce(FC.ToInterval(FollowUpInterventions.authoredOn), FC.ToInterval(FollowUpInterventions.performed))
  ) is not null 
ELM XML Content
Encoded data (263028 characters)
ELM JSON Content
Encoded data (504768 characters)
Generated using version 0.5.1-cibuild of the sample-content-ig Liquid templates