# Adult Major Depressive Disorder (MDD): Suicide Risk AssessmentFHIR - eCQM QICore Content Implementation Guide v2023.0.0

* [**Table of Contents**](toc.md)
* [**Artifacts Summary**](artifacts.md)
* **Adult Major Depressive Disorder (MDD): Suicide Risk AssessmentFHIR**

## Measure: Adult Major Depressive Disorder (MDD): Suicide Risk AssessmentFHIR 

| | | |
| :--- | :--- | :--- |
| *Official URL*:http://ecqi.healthit.gov/ecqms/Measure/AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR | *Version*:0.0.004 | |
| Draft as of 2023-10-27 | *Responsible:*[Mathematica](https://www.mathematica.org/) | *Computable Name*:AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR |
| *Other Identifiers:*Short Name (use: usual, ), UUID:9e056df9-6c0c-4847-a88e-bc9932dd69bd (use: official, ), UUID:2c928085806c39a20180859994bf050e (use: official, ), Endorser (use: official, ), Publisher (use: official, ) | | |
| **Usage:**Program: EP/EC | | |
| **Copyright/Legal**: Copyright 2023 Mathematica Inc. All Rights Reserved. The PCPI and American Medical Association’s (AMA) significant past efforts and contributions to the development and updating of the Measure is acknowledged. | | |

 
Percentage of all patient visits for those patients that are 17 years of age or older at the start of the measurement period in which a new or recurrent diagnosis of major depressive disorder (MDD) was identified and a suicide risk assessment was completed during the visit 

 
UNKNOWN 

* **Logic Definitions:**: **Id: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
* **Logic Definitions:**: **Download cql: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: [AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR.cql](Library-AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR.cql)
* **Logic Definitions:**: **Version: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: 0.0.004
* **Logic Definitions:**: **Url: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: [Adult Major Depressive Disorder (MDD): Suicide Risk AssessmentFHIR](Measure-AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR.md)
* **Logic Definitions:**: ** short-name identifier: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````:  CMS161FHIR 
* **Logic Definitions:**: ** version-independent identifier: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````:  urn:uuid:9e056df9-6c0c-4847-a88e-bc9932dd69bd 
* **Logic Definitions:**: ** version-specific identifier: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````:  urn:uuid:2c928085806c39a20180859994bf050e 
* **Logic Definitions:**: ** endorser (NQF) identifier: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````:  0104e 
* **Logic Definitions:**: ** publisher (CMS) identifier: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````:  161FHIR 
* **Logic Definitions:**: **Effective Period: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: 2024-01-01 ..2024-12-31
* **Logic Definitions:**: **Status: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: draft
* **Logic Definitions:**: **Date: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: 2023-10-27 08:12:31+0000
* **Logic Definitions:**: **Approval Date: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: 2023-08-14
* **Logic Definitions:**: **Last Review Date: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: 2023-08-14
* **Logic Definitions:**: **Name: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
* **Logic Definitions:**: **Publisher: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: Mathematica
* **Logic Definitions:**: **Author: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: Mathematica:[https://www.mathematica.org/](https://www.mathematica.org/), American Medical Association (AMA):[https://www.ama-assn.org/](https://www.ama-assn.org/)
* **Logic Definitions:**: **Description: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: Percentage of all patient visits for those patients that are 17 years of age or older at the start of the measurement period in which a new or recurrent diagnosis of major depressive disorder (MDD) was identified and a suicide risk assessment was completed during the visit
* **Logic Definitions:**: **Purpose: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: UNKNOWN
* **Logic Definitions:**: **Copyright: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: Copyright 2023 Mathematica Inc. All Rights Reserved. The PCPI and American Medical Association's (AMA) significant past efforts and contributions to the development and updating of the Measure is acknowledged.
* **Logic Definitions:**: **Disclaimer: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: 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 Mathematica. Neither Mathematica, the 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.Mathematica encourages use of the Measure by other health care professionals, where appropriate.THE MEASURE AND SPECIFICATIONS ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.Limited proprietary coding may be 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 Measure. Any other use of CPT or other coding by a third party is strictly prohibited. Mathematica, the AMA, and former members of the PCPI disclaim all liability for use or accuracy of any CPT(R) 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].
* **Logic Definitions:**: **Rationale: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: This measure aims to improve rates of clinician assessment of suicide risk during an encounter where a new or recurrent episode of major depressive disorder (MDD) is identified. In an epidemiologic study of mental illness in the United States with a large, representative sample, 69% of respondents with lifetime suicide attempts had also met diagnostic criteria for MDD. When considering other mood disorders related to depression, such as dysthymia and bipolar disorders, this rate increases to 74% (Bolton & Robinson, 2010). In a study of individuals who had died by suicide and were enrolled in one of eight major health systems in the United States, individuals with a depressive disorder diagnosis had 7.20 increased odds of dying by suicide within one year, after adjusting for age and sociodemographic factors (Yeh et al., 2019). A recent meta-analysis (Moitra et al., 2021) presented similar findings in which depressive disorder conferred a predictive relative risk for suicide of 7.64 after adjusting for relevant factors.Suicide is associated with increased use of healthcare services, which provides an opportunity for intervention through assessment and intervention. Individuals who die by suicide are more likely to have any healthcare utilization (Ahmedani et al., 2019) and a higher frequency of healthcare visits than the general population (Chock, Bommersbach, Geske, & Bostwick, 2015). A study of individuals who died by suicide and were enrolled within one of eight health systems in the Mental Health Research Network in the United States found that 50% of these individuals had been seen in a healthcare setting within four weeks prior to death (Ahmedani et al., 2014). Better assessment and identification of suicide risk in the healthcare setting should lead to improved connection to treatment and reduction in suicide attempts and deaths by suicide. A recent analysis of depression severity and suicidal ideation symptom trajectories (Witt et al., 2021) found that suicidal ideation among children and young adults (15-25 years) might not improve with depression symptom severity. This evidence suggests the potential utility of continued suicide risk screening after improvements in depression symptoms.
* **Logic Definitions:**: **Clinical recommendation statement: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: A careful and ongoing evaluation of suicide risk is necessary for all patients with major depressive disorder (American Psychiatric Association, 2010a).Such an assessment includes specific inquiry about suicidal thoughts, intent, plans, means, and behaviors; identification of specific psychiatric symptoms (e.g., psychosis, severe anxiety, substance use, hopelessness, insomnia, agitation) or general medical conditions that may increase the likelihood of acting on suicidal ideas; assessment of past and, particularly, recent suicidal behavior; delineation of current stressors and potential protective factors (e.g., positive reasons for living, strong social support); and identification of any family history of suicide or mental illness (American Psychiatric Association, 2010a; Department of Veterans Affairs and Department of Defense, 2019).As part of the assessment process, impulsivity and potential for risk to others should also be evaluated, including any history of violence or violent or homicidal ideas, plans, or intentions, or the availability of firearms (American Psychiatric Association, 2010a; Department of Veterans Affairs and Department of Defense, 2019).The patient's risk of harm to him- or herself and to others should also be monitored as treatment proceeds (American Psychiatric Association, 2010a).Guidelines for Selecting a Treatment Setting for Patients at Risk for Suicide or Suicidal Behaviors (from American Psychiatric Association’s Practice Guideline for Assessment and Treatment of Patients With Suicidal Behaviors, 2010b):ADMISSION GENERALLY INDICATED After a suicide attempt or aborted suicide attempt if:* Patient is psychotic
* Attempt was violent, near-lethal, or premeditated
* Precautions were taken to avoid rescue or discovery
* Persistent plan and/or intent is present
* Distress is increased or patient regrets surviving
* Patient is male, older than age 45 years, especially with new onset of psychiatric illness or suicidal thinking
* Patient has limited family and/or social support, including lack of stable living situation
* Current impulsive behavior, severe agitation, poor judgment, or refusal of help is evident
* Patient has change in mental status with a metabolic, toxic, infectious, or other etiology requiring further workup in a structured setting
In the presence of suicidal ideation with:* Specific plan with high lethality
* High suicidal intent
ADMISSION MAY BE NECESSARY After a suicide attempt or aborted suicide attempt, except in circumstances for which admission is generally indicatedIn the presence of suicidal ideation with:* Psychosis
* Major psychiatric disorder
* Past attempts, particularly if medically serious
* Possibly contributing medical condition (e.g., acute neurological disorder, cancer, infection)
* Lack of response to or inability to cooperate with partial hospital or outpatient treatment
* Need for supervised setting for medication trial or electroconvulsive therapy (ECT)
* Need for skilled observation, clinical tests, or diagnostic assessments that require a structured setting
* Limited family and/or social support, including lack of stable living situation
* Lack of an ongoing clinician-patient relationship or lack of access to timely outpatient follow-up
* Evidence of putting one's affairs in order (e.g., giving away possessions, writing a will)
In the absence of suicide attempts or reported suicidal ideation/plan/intent but evidence from the psychiatric evaluation and/or history from others suggests a high level of suicide risk and a recent acute increase in riskRELEASE FROM EMERGENCY DEPARTMENT WITH FOLLOW-UP RECOMMENDATIONS MAY BE POSSIBLE After a suicide attempt or in the presence of suicidal ideation/plan when:* Suicidality is a reaction to precipitating events (e.g., exam failure, relationship difficulties), particularly if the patient's view of situation has changed since coming to emergency department
* Plan/method and intent have low lethality
* Patient has stable and supportive living situation
* Patient is able to cooperate with recommendations for follow-up, with treater contacted, if possible, if patient is currently in treatment
OUTPATIENT TREATMENT MAY BE MORE BENEFICIAL THAN HOSPITALIZATIONPatient has chronic suicidal ideation and/or self-injury without prior medically serious attempts, if a safe and supportive living situation is available and outpatient psychiatric care is ongoing
* **Logic Definitions:**: **Guidance (Usage): **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: This eCQM is an episode-based measure and should be reported for each instance of a new or recurrent episode of major depressive disorder (MDD) during the measurement period. This measure should be reported for each eligible encounter during which a new or recurrent episode of MDD is identified in adults that turn 18 or older during the measurement period. As the guidelines state, it is important to assess for additional factors which may increase or decrease suicide risk, such as presence of additional symptoms (e.g., psychosis, severe anxiety, hopelessness, severe chronic pain); presence of substance abuse; history and seriousness of previous attempts, particularly, recent suicidal behavior; current stressors and potential protective factors (e.g., positive reasons for living, strong social support); family history of suicide or mental illness or recent exposure to suicide; impulsivity and potential for risk to others, including history of violence or violent or homicidal ideas, plans, or intentions; and putting one's affairs in order (e.g., giving away possessions, writing a will). In addition, although the measure focuses on the initial visit, it is critical that suicide risk be monitored especially for the 90 days following the initial visit and throughout MDD treatment. It is expected that a suicide risk assessment will be completed at the visit during which a new diagnosis is made or at the visit during which a recurrent episode is first identified (i.e., at the initial evaluation). For the purposes of this measure, an episode of MDD would be considered to be recurrent if a patient has not had an MDD-related encounter in the past 105 days. If there is a gap of 105 or more days between visits for MDD, that would imply a recurrent episode. The 105-day look-back period is an operational provision and not a clinical recommendation, or definition of relapse, remission, or recurrence. In recognition of the growing use of integrated and team-based care, the diagnosis of depression and the assessment for suicide risk need not be performed by the same provider or clinician. Suicide risk assessments completed via telehealth services can also meet numerator performance. Use of a standardized tool(s) or instrument(s) to assess suicide risk will meet numerator performance. Standardized tools can be mapped to the concept "Intervention, Performed": "Suicide risk assessment (procedure)" included in the numerator logic below, as no individual suicide risk assessment tool or instrument would satisfy the requirements alone. To ensure all patients with MDD are assessed for suicide risk, there are two clinical quality measures addressing suicide risk assessment; CMS177-Child and Adolescent Major Depressive Disorder (MDD): Suicide Risk Assessment covers children and adolescents aged 6 through 16 at the start of the measurement period, and CMS161 covers the adult population aged 17 years and older at the start of the measurement period. This FHIR-based measure has been derived from the QDM-based measure: CMS161v12. 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).
* **Logic Definitions:**: ** Supplemental Data Guidance : **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: test1 test 2 test 3 test4
* **Logic Definitions:**: ** Supplemental Data Elements: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: SDE Ethnicity SDE Payer SDE Race SDE Sex
* **Logic Definitions:**: **Libraries: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: 
| |
| :--- |
| [AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR](Library-AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR.md) |

* **Logic Definitions:**: **Related Artifact Dependencies: **
  * * **Group**: 6419eb169ef3a941fbe47b3b
  * **Scoring**: **Group scoring:** proportion 

* **Library Name**: SupplementalDataElements
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": case when Patient.gender = 'male' then "M" when Patient.gender = 'female' then "F" else null end````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Sex
* **Library Name**: 
  * **Name**: ````define "SDE Sex": SDE."SDE Sex"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "Major Depressive Disorder Encounter": ( ["Encounter": "Psych Visit Diagnostic Evaluation"] union ["Encounter": "Emergency Department Visit"] union ["Encounter": "Office Visit"] union ["Encounter": "Outpatient Consultation"] union ["Encounter": "Psych Visit Psychotherapy"] union ["Encounter": "Psychoanalysis"] union ["Encounter": "Telehealth Services"] ) ValidEncounter where ValidEncounter.status = 'finished' and ValidEncounter.class ~ "AMB" and ( ValidEncounter.reasonCode in "Major Depressive Disorder Active" or exists ( ( CQMCommon."EncounterDiagnosis" ( ValidEncounter ) ) EncounterDiagnosis where EncounterDiagnosis.code in "Major Depressive Disorder Active" ) )````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: New or Recurrent Major Depressive Disorder Encounter
* **Library Name**: 
  * **Name**: ````define "New or Recurrent Major Depressive Disorder Encounter": "Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter without "Major Depressive Disorder Encounter" PriorMDDEpisodeEncounter such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period ) where NewOrRecurrentMDDEncounter.period during "Measurement Period"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Numerator
* **Library Name**: 
  * **Name**: ````define "Numerator": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter with ["Procedure": "Suicide risk assessment (procedure)"] SuicideRiskAssessment such that SuicideRiskAssessment.status = 'completed' and QICoreCommon."ToInterval" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Initial Population
* **Library Name**: 
  * **Name**: ````define "Initial Population": "New or Recurrent Major Depressive Disorder Encounter" NewOrRecurrentMDDEncounter where "AgeInYearsAt"(date from start of "Measurement Period") >= 17````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: Denominator
* **Library Name**: 
  * **Name**: ````define "Denominator": "Initial Population"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": [Coverage: type in "Payer Type"] Payer return { code: Payer.type, period: Payer.period }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Payer
* **Library Name**: 
  * **Name**: ````define "SDE Payer": SDE."SDE Payer"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": Patient.ethnicity E return Tuple { codes: { E.ombCategory } union E.detailed, display: E.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Ethnicity
* **Library Name**: 
  * **Name**: ````define "SDE Ethnicity": SDE."SDE Ethnicity"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: SupplementalDataElements
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": Patient.race R return Tuple { codes: R.ombCategory union R.detailed, display: R.text }````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR
  * **Name**: SDE Race
* **Library Name**: 
  * **Name**: ````define "SDE Race": SDE."SDE Race"````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToConcept
* **Library Name**: 
  * **Name**: ````/* @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**: **Library Name**
  * **Name**: **Name**
* **Library Name**: CQMCommon
  * **Name**: EncounterDiagnosis
* **Library Name**: 
  * **Name**: ````/* @description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter @deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead. */ define function "EncounterDiagnosis"(Encounter Encounter ): Encounter.diagnosis D return singleton from ([Condition] C where C.id = D.condition.reference.getId())````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: QICoreCommon
  * **Name**: getId
* **Library Name**: 
  * **Name**: ````/* @description: Returns the tail of the given uri (i.e. everything after the last slash in the URI). @comment: This function can be used to determine the logical id of a given resource. It can be used in a single-server environment to trace references. However, this function does not attempt to resolve or distinguish the base of the given url, and so cannot be used safely in multi-server environments. */ define fluent function getId(uri String): Last(Split(uri, '/'))````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToString
* **Library Name**: 
  * **Name**: ````define function ToString(value uri): value.value````
* **Library Name**: **Library Name**
  * **Name**: **Name**
* **Library Name**: FHIRHelpers
  * **Name**: ToCode
* **Library Name**: 
  * **Name**: ````/* @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 }````: * [SupplementalDataElements](Library-SupplementalDataElements.md) version: 3.4.000
* [FHIRHelpers](Library-FHIRHelpers.md) version: 4.3.000
* [CQMCommon](Library-CQMCommon.md) version: 1.4.000
* [QICoreCommon](Library-QICoreCommon.md) version: 1.5.000
* `http://hl7.org/fhir/v3/AdministrativeGender`
* [ActCode](http://terminology.hl7.org/7.1.0/CodeSystem-v3-ActCode.html)
* [SNOMED CT (all versions)](http://hl7.org/fhir/R4/codesystem-snomedct.html)
* [Psych Visit - Diagnostic Evaluation](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.526.3.1492/expansion)
* [Emergency Department Visit](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.101.12.1010/expansion)
* [Office Visit](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.101.12.1001/expansion)
* [Outpatient Consultation](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.101.12.1008/expansion)
* [Psych Visit - Psychotherapy](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.526.3.1496/expansion)
* [Psychoanalysis](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.526.3.1141/expansion)
* [Telehealth Services](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.464.1003.101.12.1031/expansion)
* [Major Depressive Disorder-Active](https://vsac.nlm.nih.gov/valueset/2.16.840.1.113883.3.526.3.1491/expansion)
* [Payer](https://vsac.nlm.nih.gov/valueset/2.16.840.1.114222.4.11.3591/expansion)




## Resource Content

```json
{
  "resourceType" : "Measure",
  "id" : "AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR",
  "meta" : {
    "profile" : ["http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/computable-measure-cqfm",
    "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/publishable-measure-cqfm",
    "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/executable-measure-cqfm"]
  },
  "contained" : [{
    "resourceType" : "Library",
    "id" : "effective-data-requirements",
    "extension" : [{
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode",
      "valueCoding" : {
        "system" : "http://hl7.org/fhir/v3/AdministrativeGender",
        "code" : "M",
        "display" : "Male"
      }
    },
    {
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode",
      "valueCoding" : {
        "system" : "http://hl7.org/fhir/v3/AdministrativeGender",
        "code" : "F",
        "display" : "Female"
      }
    },
    {
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode",
      "valueCoding" : {
        "system" : "http://terminology.hl7.org/CodeSystem/v3-ActCode",
        "code" : "AMB",
        "display" : "Ambulatory"
      }
    },
    {
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-directReferenceCode",
      "valueCoding" : {
        "system" : "http://snomed.info/sct",
        "code" : "225337009",
        "display" : "Suicide risk assessment (procedure)"
      }
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "SupplementalDataElements"
      },
      {
        "url" : "name",
        "valueString" : "SDE Sex"
      },
      {
        "url" : "statement",
        "valueString" : "define \"SDE Sex\":\n  case\n      when Patient.gender = 'male' then \"M\"\n      when Patient.gender = 'female' then \"F\"\n      else null\n    end"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 0
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR"
      },
      {
        "url" : "name",
        "valueString" : "SDE Sex"
      },
      {
        "url" : "statement",
        "valueString" : "define \"SDE Sex\":\n  SDE.\"SDE Sex\""
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 1
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR"
      },
      {
        "url" : "name",
        "valueString" : "Major Depressive Disorder Encounter"
      },
      {
        "url" : "statement",
        "valueString" : "define \"Major Depressive Disorder Encounter\":\n  ( [\"Encounter\": \"Psych Visit Diagnostic Evaluation\"]\n    union [\"Encounter\": \"Emergency Department Visit\"]\n    union [\"Encounter\": \"Office Visit\"]\n    union [\"Encounter\": \"Outpatient Consultation\"]\n    union [\"Encounter\": \"Psych Visit Psychotherapy\"]\n    union [\"Encounter\": \"Psychoanalysis\"]\n    union [\"Encounter\": \"Telehealth Services\"] ) ValidEncounter\n    where ValidEncounter.status = 'finished'\n      and ValidEncounter.class ~ \"AMB\"\n      and ( ValidEncounter.reasonCode in \"Major Depressive Disorder Active\"\n          or exists ( ( CQMCommon.\"EncounterDiagnosis\" ( ValidEncounter ) ) EncounterDiagnosis\n              where EncounterDiagnosis.code in \"Major Depressive Disorder Active\"\n          )\n      )"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 2
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR"
      },
      {
        "url" : "name",
        "valueString" : "New or Recurrent Major Depressive Disorder Encounter"
      },
      {
        "url" : "statement",
        "valueString" : "define \"New or Recurrent Major Depressive Disorder Encounter\":\n  \"Major Depressive Disorder Encounter\" NewOrRecurrentMDDEncounter\n    without \"Major Depressive Disorder Encounter\" PriorMDDEpisodeEncounter\n      such that ( PriorMDDEpisodeEncounter !~ NewOrRecurrentMDDEncounter\n          and PriorMDDEpisodeEncounter.period ends 104 days or less before day of start of NewOrRecurrentMDDEncounter.period\n      )\n    where NewOrRecurrentMDDEncounter.period during \"Measurement Period\""
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 3
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR"
      },
      {
        "url" : "name",
        "valueString" : "Numerator"
      },
      {
        "url" : "statement",
        "valueString" : "define \"Numerator\":\n  \"New or Recurrent Major Depressive Disorder Encounter\" NewOrRecurrentMDDEncounter\n    with [\"Procedure\": \"Suicide risk assessment (procedure)\"] SuicideRiskAssessment\n      such that SuicideRiskAssessment.status = 'completed'\n        and QICoreCommon.\"ToInterval\" ( SuicideRiskAssessment.performed ) during NewOrRecurrentMDDEncounter.period"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 4
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR"
      },
      {
        "url" : "name",
        "valueString" : "Initial Population"
      },
      {
        "url" : "statement",
        "valueString" : "define \"Initial Population\":\n  \"New or Recurrent Major Depressive Disorder Encounter\" NewOrRecurrentMDDEncounter\n    where \"AgeInYearsAt\"(date from start of \"Measurement Period\") >= 17"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 5
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR"
      },
      {
        "url" : "name",
        "valueString" : "Denominator"
      },
      {
        "url" : "statement",
        "valueString" : "define \"Denominator\":\n  \"Initial Population\""
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 6
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "SupplementalDataElements"
      },
      {
        "url" : "name",
        "valueString" : "SDE Payer"
      },
      {
        "url" : "statement",
        "valueString" : "define \"SDE Payer\":\n  [Coverage: type in \"Payer Type\"] Payer\n    return {\n      code: Payer.type,\n      period: Payer.period\n    }"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 7
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR"
      },
      {
        "url" : "name",
        "valueString" : "SDE Payer"
      },
      {
        "url" : "statement",
        "valueString" : "define \"SDE Payer\":\n  SDE.\"SDE Payer\""
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 8
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "SupplementalDataElements"
      },
      {
        "url" : "name",
        "valueString" : "SDE Ethnicity"
      },
      {
        "url" : "statement",
        "valueString" : "define \"SDE Ethnicity\":\n  Patient.ethnicity E\n    return Tuple {\n      codes: { E.ombCategory } union E.detailed,\n      display: E.text\n    }"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 9
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR"
      },
      {
        "url" : "name",
        "valueString" : "SDE Ethnicity"
      },
      {
        "url" : "statement",
        "valueString" : "define \"SDE Ethnicity\":\n  SDE.\"SDE Ethnicity\""
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 10
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "SupplementalDataElements"
      },
      {
        "url" : "name",
        "valueString" : "SDE Race"
      },
      {
        "url" : "statement",
        "valueString" : "define \"SDE Race\":\n  Patient.race R\n    return Tuple {\n      codes: R.ombCategory union R.detailed,\n      display: R.text\n    }"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 11
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR"
      },
      {
        "url" : "name",
        "valueString" : "SDE Race"
      },
      {
        "url" : "statement",
        "valueString" : "define \"SDE Race\":\n  SDE.\"SDE Race\""
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 12
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "FHIRHelpers"
      },
      {
        "url" : "name",
        "valueString" : "ToConcept"
      },
      {
        "url" : "statement",
        "valueString" : "/*\n@description: Converts the given FHIR [CodeableConcept](https://hl7.org/fhir/datatypes.html#CodeableConcept) value to a CQL Concept.\n*/\ndefine function ToConcept(concept FHIR.CodeableConcept):\n    if concept is null then\n        null\n    else\n        System.Concept {\n            codes: concept.coding C return ToCode(C),\n            display: concept.text.value\n        }"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 13
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "CQMCommon"
      },
      {
        "url" : "name",
        "valueString" : "EncounterDiagnosis"
      },
      {
        "url" : "statement",
        "valueString" : "/*\n@description: Returns the Condition resource referenced by the `diagnosis.condition` element of the Encounter\n@deprecated: This function is deprecated. Use the fluent function `encounterDiagnosis()` instead.\n*/\ndefine function \"EncounterDiagnosis\"(Encounter Encounter ):\n  Encounter.diagnosis D\n\treturn singleton from ([Condition] C where C.id = D.condition.reference.getId())"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 14
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "QICoreCommon"
      },
      {
        "url" : "name",
        "valueString" : "getId"
      },
      {
        "url" : "statement",
        "valueString" : "/*\n@description: Returns the tail of the given uri (i.e. everything after the last slash in the URI).\n@comment: This function can be used to determine the logical id of a given resource. It can be used in\na single-server environment to trace references. However, this function does not attempt to resolve\nor distinguish the base of the given url, and so cannot be used safely in multi-server environments.\n*/\ndefine fluent function getId(uri String):\n  Last(Split(uri, '/'))"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 15
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "FHIRHelpers"
      },
      {
        "url" : "name",
        "valueString" : "ToString"
      },
      {
        "url" : "statement",
        "valueString" : "define function ToString(value uri): value.value"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 16
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    },
    {
      "extension" : [{
        "url" : "libraryName",
        "valueString" : "FHIRHelpers"
      },
      {
        "url" : "name",
        "valueString" : "ToCode"
      },
      {
        "url" : "statement",
        "valueString" : "/*\n@description: Converts the given FHIR [Coding](https://hl7.org/fhir/datatypes.html#Coding) value to a CQL Code.\n*/\ndefine function ToCode(coding FHIR.Coding):\n    if coding is null then\n        null\n    else\n        System.Code {\n          code: coding.code.value,\n          system: coding.system.value,\n          version: coding.version.value,\n          display: coding.display.value\n        }"
      },
      {
        "url" : "displaySequence",
        "valueInteger" : 17
      }],
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-logicDefinition"
    }],
    "status" : "active",
    "type" : {
      "coding" : [{
        "system" : "http://terminology.hl7.org/CodeSystem/library-type",
        "code" : "module-definition"
      }]
    },
    "relatedArtifact" : [{
      "type" : "depends-on",
      "display" : "Library SDE",
      "resource" : "http://ecqi.healthit.gov/ecqms/Library/SupplementalDataElements|3.4.000"
    },
    {
      "type" : "depends-on",
      "display" : "Library FHIRHelpers",
      "resource" : "http://ecqi.healthit.gov/ecqms/Library/FHIRHelpers|4.3.000"
    },
    {
      "type" : "depends-on",
      "display" : "Library CQMCommon",
      "resource" : "http://ecqi.healthit.gov/ecqms/Library/CQMCommon|1.4.000"
    },
    {
      "type" : "depends-on",
      "display" : "Library QICoreCommon",
      "resource" : "http://ecqi.healthit.gov/ecqms/Library/QICoreCommon|1.5.000"
    },
    {
      "type" : "depends-on",
      "display" : "Code system AdministrativeGender",
      "resource" : "http://hl7.org/fhir/v3/AdministrativeGender"
    },
    {
      "type" : "depends-on",
      "display" : "Code system ActCode",
      "resource" : "http://terminology.hl7.org/CodeSystem/v3-ActCode"
    },
    {
      "type" : "depends-on",
      "display" : "Code system SNOMEDCT",
      "resource" : "http://snomed.info/sct"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Psych Visit Diagnostic Evaluation",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1492"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Emergency Department Visit",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Office Visit",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Outpatient Consultation",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1008"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Psych Visit Psychotherapy",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1496"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Psychoanalysis",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1141"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Telehealth Services",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1031"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Major Depressive Disorder Active",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1491"
    },
    {
      "type" : "depends-on",
      "display" : "Value set Payer Type",
      "resource" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
    }],
    "parameter" : [{
      "name" : "Measurement Period",
      "use" : "in",
      "min" : 0,
      "max" : "1",
      "type" : "Period"
    },
    {
      "name" : "SDE Sex",
      "use" : "out",
      "min" : 0,
      "max" : "1",
      "type" : "Coding"
    },
    {
      "name" : "Numerator",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Resource"
    },
    {
      "name" : "Denominator",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Resource"
    },
    {
      "name" : "SDE Payer",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Resource"
    },
    {
      "name" : "Initial Population",
      "use" : "out",
      "min" : 0,
      "max" : "*",
      "type" : "Resource"
    },
    {
      "name" : "SDE Ethnicity",
      "use" : "out",
      "min" : 0,
      "max" : "1",
      "type" : "Resource"
    },
    {
      "name" : "SDE Race",
      "use" : "out",
      "min" : 0,
      "max" : "1",
      "type" : "Resource"
    }],
    "dataRequirement" : [{
      "type" : "Patient",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-patient"],
      "mustSupport" : ["ethnicity", "race"]
    },
    {
      "type" : "Condition",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-condition"],
      "mustSupport" : ["id", "id.value", "code"]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type",
      "condition",
      "condition.reference",
      "condition.reference.value",
      "status",
      "status.value",
      "class",
      "reasonCode",
      "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1492"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type",
      "condition",
      "condition.reference",
      "condition.reference.value",
      "status",
      "status.value",
      "class",
      "reasonCode",
      "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1010"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type",
      "condition",
      "condition.reference",
      "condition.reference.value",
      "status",
      "status.value",
      "class",
      "reasonCode",
      "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1001"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type",
      "condition",
      "condition.reference",
      "condition.reference.value",
      "status",
      "status.value",
      "class",
      "reasonCode",
      "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1008"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type",
      "condition",
      "condition.reference",
      "condition.reference.value",
      "status",
      "status.value",
      "class",
      "reasonCode",
      "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1496"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type",
      "condition",
      "condition.reference",
      "condition.reference.value",
      "status",
      "status.value",
      "class",
      "reasonCode",
      "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.526.3.1141"
      }]
    },
    {
      "type" : "Encounter",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-encounter"],
      "mustSupport" : ["type",
      "condition",
      "condition.reference",
      "condition.reference.value",
      "status",
      "status.value",
      "class",
      "reasonCode",
      "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.113883.3.464.1003.101.12.1031"
      }]
    },
    {
      "type" : "Procedure",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-procedure"],
      "mustSupport" : ["code", "status", "status.value", "performed"],
      "codeFilter" : [{
        "path" : "code",
        "code" : [{
          "system" : "http://snomed.info/sct",
          "code" : "225337009",
          "display" : "Suicide risk assessment (procedure)"
        }]
      },
      {
        "path" : "status.value",
        "code" : [{
          "code" : "completed"
        }]
      }]
    },
    {
      "type" : "Coverage",
      "profile" : ["http://hl7.org/fhir/us/qicore/StructureDefinition/qicore-coverage"],
      "mustSupport" : ["type", "period"],
      "codeFilter" : [{
        "path" : "type",
        "valueSet" : "http://cts.nlm.nih.gov/fhir/ValueSet/2.16.840.1.114222.4.11.3591"
      }]
    }]
  }],
  "extension" : [{
    "id" : "supplementalDataGuidance",
    "extension" : [{
      "url" : "guidance",
      "valueString" : "test1 test 2\n test 3 test4"
    },
    {
      "url" : "usage",
      "valueCodeableConcept" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-data-usage",
          "code" : "supplemental-data",
          "display" : "Supplemental Data"
        }],
        "text" : "Supplemental Data Guidance"
      }
    }],
    "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-supplementalDataGuidance"
  },
  {
    "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-softwaresystem",
    "valueReference" : {
      "reference" : "Device/cqf-tooling"
    }
  },
  {
    "id" : "effective-data-requirements",
    "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-effectiveDataRequirements",
    "valueReference" : {
      "reference" : "#effective-data-requirements"
    }
  }],
  "url" : "http://ecqi.healthit.gov/ecqms/Measure/AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR",
  "identifier" : [{
    "use" : "usual",
    "type" : {
      "coding" : [{
        "system" : "http://hl7.org/fhir/us/cqfmeasures/CodeSystem/identifier-type",
        "code" : "short-name"
      }]
    },
    "system" : "https://madie.cms.gov/measure/shortName",
    "value" : "CMS161FHIR"
  },
  {
    "use" : "official",
    "type" : {
      "coding" : [{
        "system" : "http://hl7.org/fhir/us/cqfmeasures/CodeSystem/identifier-type",
        "code" : "version-independent"
      }]
    },
    "system" : "urn:ietf:rfc:3986",
    "value" : "urn:uuid:9e056df9-6c0c-4847-a88e-bc9932dd69bd"
  },
  {
    "use" : "official",
    "type" : {
      "coding" : [{
        "system" : "http://hl7.org/fhir/us/cqfmeasures/CodeSystem/identifier-type",
        "code" : "version-specific"
      }]
    },
    "system" : "urn:ietf:rfc:3986",
    "value" : "urn:uuid:2c928085806c39a20180859994bf050e"
  },
  {
    "use" : "official",
    "type" : {
      "coding" : [{
        "system" : "http://hl7.org/fhir/us/cqfmeasures/CodeSystem/identifier-type",
        "code" : "endorser"
      }]
    },
    "system" : "https://madie.cms.gov/measure/nqfId",
    "value" : "0104e",
    "assigner" : {
      "display" : "NQF"
    }
  },
  {
    "use" : "official",
    "type" : {
      "coding" : [{
        "system" : "http://hl7.org/fhir/us/cqfmeasures/CodeSystem/identifier-type",
        "code" : "publisher"
      }]
    },
    "system" : "https://madie.cms.gov/measure/cmsId",
    "value" : "161FHIR",
    "assigner" : {
      "display" : "CMS"
    }
  }],
  "version" : "0.0.004",
  "name" : "AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR",
  "title" : "Adult Major Depressive Disorder (MDD): Suicide Risk AssessmentFHIR",
  "status" : "draft",
  "experimental" : false,
  "date" : "2023-10-27T08:12:31+00:00",
  "publisher" : "Mathematica",
  "contact" : [{
    "telecom" : [{
      "system" : "url",
      "value" : "https://www.mathematica.org/"
    }]
  }],
  "description" : "Percentage of all patient visits for those patients that are 17 years of age or older at the start of the measurement period in which a new or recurrent diagnosis of major depressive disorder (MDD) was identified and a suicide risk assessment was completed during the visit",
  "useContext" : [{
    "code" : {
      "system" : "http://terminology.hl7.org/CodeSystem/usage-context-type",
      "code" : "program"
    },
    "valueCodeableConcept" : {
      "coding" : [{
        "system" : "http://hl7.org/fhir/us/cqfmeasures/CodeSystem/quality-programs",
        "code" : "ep-ec",
        "display" : "EP/EC"
      }]
    }
  }],
  "purpose" : "UNKNOWN",
  "usage" : "This eCQM is an episode-based measure and should be reported for each instance of a new or recurrent episode of major depressive disorder (MDD) during the measurement period. This measure should be reported for each eligible encounter during which a new or recurrent episode of MDD is identified in adults that turn 18 or older during the measurement period.\n\nAs the guidelines state, it is important to assess for additional factors which may increase or decrease suicide risk, such as presence of additional symptoms (e.g., psychosis, severe anxiety, hopelessness, severe chronic pain); presence of substance abuse; history and seriousness of previous attempts, particularly, recent suicidal behavior; current stressors and potential protective factors (e.g., positive reasons for living, strong social support); family history of suicide or mental illness or recent exposure to suicide; impulsivity and potential for risk to others, including history of violence or violent or homicidal ideas, plans, or intentions; and putting one's affairs in order (e.g., giving away possessions, writing a will). In addition, although the measure focuses on the initial visit, it is critical that suicide risk be monitored especially for the 90 days following the initial visit and throughout MDD treatment.\n\nIt is expected that a suicide risk assessment will be completed at the visit during which a new diagnosis is made or at the visit during which a recurrent episode is first identified (i.e., at the initial evaluation). For the purposes of this measure, an episode of MDD would be considered to be recurrent if a patient has not had an MDD-related encounter in the past 105 days. If there is a gap of 105 or more days between visits for MDD, that would imply a recurrent episode. The 105-day look-back period is an operational provision and not a clinical recommendation, or definition of relapse, remission, or recurrence.\n\nIn recognition of the growing use of integrated and team-based care, the diagnosis of depression and the assessment for suicide risk need not be performed by the same provider or clinician.\n\nSuicide risk assessments completed via telehealth services can also meet numerator performance.\n\nUse of a standardized tool(s) or instrument(s) to assess suicide risk will meet numerator performance. Standardized tools can be mapped to the concept \"Intervention, Performed\": \"Suicide risk assessment (procedure)\" included in the numerator logic below, as no individual suicide risk assessment tool or instrument would satisfy the requirements alone.\n\nTo ensure all patients with MDD are assessed for suicide risk, there are two clinical quality measures addressing suicide risk assessment; CMS177-Child and Adolescent Major Depressive Disorder (MDD): Suicide Risk Assessment covers children and adolescents aged 6 through 16 at the start of the measurement period, and CMS161 covers the adult population aged 17 years and older at the start of the measurement period.\n\nThis FHIR-based measure has been derived from the QDM-based measure: CMS161v12.\n\nPlease 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).",
  "copyright" : "Copyright 2023 Mathematica Inc. All Rights Reserved.\nThe PCPI and American Medical Association's (AMA) significant past efforts and contributions to the development and updating of the Measure is acknowledged.",
  "approvalDate" : "2023-08-14",
  "lastReviewDate" : "2023-08-14",
  "effectivePeriod" : {
    "start" : "2024-01-01",
    "end" : "2024-12-31"
  },
  "author" : [{
    "name" : "Mathematica",
    "telecom" : [{
      "system" : "url",
      "value" : "https://www.mathematica.org/"
    }]
  },
  {
    "name" : "American Medical Association (AMA)",
    "telecom" : [{
      "system" : "url",
      "value" : "https://www.ama-assn.org/"
    }]
  }],
  "library" : ["http://ecqi.healthit.gov/ecqms/Library/AdultMajorDepressiveDisorderMDDSuicideRiskAssessmentFHIR"],
  "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. \n\nThe 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. \n\nCommercial uses of the Measure require a license agreement between the user and Mathematica. Neither Mathematica, the 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.\n\nMathematica encourages use of the Measure by other health care professionals, where appropriate.\n\nTHE MEASURE AND SPECIFICATIONS ARE PROVIDED \"AS IS\" WITHOUT WARRANTY OF ANY KIND.\n\nLimited proprietary coding may be 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 Measure. Any other use of CPT or other coding by a third party is strictly prohibited. Mathematica, the AMA, and former members of the PCPI disclaim all liability for use or accuracy of any CPT(R) or other coding contained in the specifications. \n\nCPT(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.\n\nDue to technical limitations, registered trademarks are indicated by (R) or [R].",
  "rationale" : "This measure aims to improve rates of clinician assessment of suicide risk during an encounter where a new or recurrent episode of major depressive disorder (MDD) is identified. In an epidemiologic study of mental illness in the United States with a large, representative sample, 69% of respondents with lifetime suicide attempts had also met diagnostic criteria for MDD. When considering other mood disorders related to depression, such as dysthymia and bipolar disorders, this rate increases to 74% (Bolton & Robinson, 2010). In a study of individuals who had died by suicide and were enrolled in one of eight major health systems in the United States, individuals with a depressive disorder diagnosis had 7.20 increased odds of dying by suicide within one year, after adjusting for age and sociodemographic factors (Yeh et al., 2019). A recent meta-analysis (Moitra et al., 2021) presented similar findings in which depressive disorder conferred a predictive relative risk for suicide of 7.64 after adjusting for relevant factors.\n\nSuicide is associated with increased use of healthcare services, which provides an opportunity for intervention through assessment and intervention. Individuals who die by suicide are more likely to have any healthcare utilization (Ahmedani et al., 2019) and a higher frequency of healthcare visits than the general population (Chock, Bommersbach, Geske, & Bostwick, 2015). A study of individuals who died by suicide and were enrolled within one of eight health systems in the Mental Health Research Network in the United States found that 50% of these individuals had been seen in a healthcare setting within four weeks prior to death (Ahmedani et al., 2014). Better assessment and identification of suicide risk in the healthcare setting should lead to improved connection to treatment and reduction in suicide attempts and deaths by suicide. A recent analysis of depression severity and suicidal ideation symptom trajectories (Witt et al., 2021) found that suicidal ideation among children and young adults (15-25 years) might not improve with depression symptom severity. This evidence suggests the potential utility of continued suicide risk screening after improvements in depression symptoms.",
  "clinicalRecommendationStatement" : "A careful and ongoing evaluation of suicide risk is necessary for all patients with major depressive disorder (American Psychiatric Association, 2010a).\n\nSuch an assessment includes specific inquiry about suicidal thoughts, intent, plans, means, and behaviors; identification of specific psychiatric symptoms (e.g., psychosis, severe anxiety, substance use, hopelessness, insomnia, agitation) or general medical conditions that may increase the likelihood of acting on suicidal ideas; assessment of past and, particularly, recent suicidal behavior; delineation of current stressors and potential protective factors (e.g., positive reasons for living, strong social support); and identification of any family history of suicide or mental illness (American Psychiatric Association, 2010a; Department of Veterans Affairs and Department of Defense, 2019).\n\nAs part of the assessment process, impulsivity and potential for risk to others should also be evaluated, including any history of violence or violent or homicidal ideas, plans, or intentions, or the availability of firearms (American Psychiatric Association, 2010a; Department of Veterans Affairs and Department of Defense, 2019).\n\nThe patient's risk of harm to him- or herself and to others should also be monitored as treatment proceeds (American Psychiatric Association, 2010a).\n\nGuidelines for Selecting a Treatment Setting for Patients at Risk for Suicide or Suicidal Behaviors (from American Psychiatric Association’s Practice Guideline for Assessment and Treatment of Patients With Suicidal Behaviors, 2010b):\n\nADMISSION GENERALLY INDICATED\nAfter a suicide attempt or aborted suicide attempt if:\n- Patient is psychotic\n- Attempt was violent, near-lethal, or premeditated\n- Precautions were taken to avoid rescue or discovery\n- Persistent plan and/or intent is present\n- Distress is increased or patient regrets surviving\n- Patient is male, older than age 45 years, especially with new onset of psychiatric illness or suicidal thinking\n- Patient has limited family and/or social support, including lack of stable living situation\n- Current impulsive behavior, severe agitation, poor judgment, or refusal of help is evident\n- Patient has change in mental status with a metabolic, toxic, infectious, or other etiology requiring further workup in a structured setting\n\nIn the presence of suicidal ideation with:\n- Specific plan with high lethality\n- High suicidal intent\n\nADMISSION MAY BE NECESSARY\nAfter a suicide attempt or aborted suicide attempt, except in circumstances for which admission is generally indicated\n\nIn the presence of suicidal ideation with:\n- Psychosis\n- Major psychiatric disorder\n- Past attempts, particularly if medically serious\n- Possibly contributing medical condition (e.g., acute neurological disorder, cancer, infection)\n- Lack of response to or inability to cooperate with partial hospital or outpatient treatment\n- Need for supervised setting for medication trial or electroconvulsive therapy (ECT)\n- Need for skilled observation, clinical tests, or diagnostic assessments that require a structured setting\n- Limited family and/or social support, including lack of stable living situation\n- Lack of an ongoing clinician-patient relationship or lack of access to timely outpatient follow-up\n- Evidence of putting one's affairs in order (e.g., giving away possessions, writing a will)\n\nIn the absence of suicide attempts or reported suicidal ideation/plan/intent but evidence from the psychiatric evaluation and/or history from others suggests a high level of suicide risk and a recent acute increase in risk\n\nRELEASE FROM EMERGENCY DEPARTMENT WITH FOLLOW-UP RECOMMENDATIONS MAY BE POSSIBLE\nAfter a suicide attempt or in the presence of suicidal ideation/plan when:\n- Suicidality is a reaction to precipitating events (e.g., exam failure, relationship difficulties), particularly if the patient's view of situation has changed since coming to emergency department\n- Plan/method and intent have low lethality\n- Patient has stable and supportive living situation\n- Patient is able to cooperate with recommendations for follow-up, with treater contacted, if possible, if patient is currently in treatment\n\nOUTPATIENT TREATMENT MAY BE MORE BENEFICIAL THAN HOSPITALIZATION\n\nPatient has chronic suicidal ideation and/or self-injury without prior medically serious attempts, if a safe and supportive living situation is available and outpatient psychiatric care is ongoing",
  "group" : [{
    "id" : "6419eb169ef3a941fbe47b3b",
    "extension" : [{
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-scoring",
      "valueCodeableConcept" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-scoring",
          "code" : "proportion",
          "display" : "Proportion"
        }]
      }
    },
    {
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-populationBasis",
      "valueCode" : "Encounter"
    },
    {
      "url" : "http://hl7.org/fhir/us/cqfmeasures/StructureDefinition/cqfm-type",
      "valueCodeableConcept" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-type",
          "code" : "process",
          "display" : "Process"
        }]
      }
    }],
    "description" : "CMS161FHIR",
    "population" : [{
      "id" : "0d3520c9-ba24-4caf-87fb-e8277a5848fc",
      "code" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-population",
          "code" : "initial-population",
          "display" : "Initial Population"
        }]
      },
      "description" : "Patient visits for patients that are 17 years of age or older at the start of the measurement period during which a new diagnosis of MDD, single or recurrent episode, was identified",
      "criteria" : {
        "language" : "text/cql-identifier",
        "expression" : "Initial Population"
      }
    },
    {
      "id" : "dadb23d6-32b1-4508-8e66-155d1ea1d9cb",
      "code" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-population",
          "code" : "denominator",
          "display" : "Denominator"
        }]
      },
      "description" : "Equals Initial Population",
      "criteria" : {
        "language" : "text/cql-identifier",
        "expression" : "Denominator"
      }
    },
    {
      "id" : "b36eebb3-6f28-4ef0-af25-98d1bf1e7edc",
      "code" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-population",
          "code" : "denominator-exclusion",
          "display" : "Denominator Exclusion"
        }]
      },
      "description" : "None",
      "criteria" : {
        "language" : "text/cql-identifier"
      }
    },
    {
      "id" : "5072c83f-c169-4f31-b5d0-857fd1d141a0",
      "code" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-population",
          "code" : "numerator",
          "display" : "Numerator"
        }]
      },
      "description" : "Patient visits during which a new diagnosis of MDD, single or recurrent episode, was identified and a suicide risk assessment was completed during the visit",
      "criteria" : {
        "language" : "text/cql-identifier",
        "expression" : "Numerator"
      }
    },
    {
      "id" : "f0562aa4-2642-47e7-bd49-3fade03805b4",
      "code" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-population",
          "code" : "numerator-exclusion",
          "display" : "Numerator Exclusion"
        }]
      },
      "description" : "Not Applicable",
      "criteria" : {
        "language" : "text/cql-identifier"
      }
    },
    {
      "id" : "7cef58d0-dea6-4d10-a2f2-d8e7ca8dadb9",
      "code" : {
        "coding" : [{
          "system" : "http://terminology.hl7.org/CodeSystem/measure-population",
          "code" : "denominator-exception",
          "display" : "Denominator Exception"
        }]
      },
      "description" : "None",
      "criteria" : {
        "language" : "text/cql-identifier"
      }
    }]
  }],
  "supplementalData" : [{
    "id" : "sde-ethnicity",
    "usage" : [{
      "coding" : [{
        "system" : "http://terminology.hl7.org/CodeSystem/measure-data-usage",
        "code" : "supplemental-data"
      }]
    }],
    "description" : "SDE Ethnicity",
    "criteria" : {
      "language" : "text/cql-identifier",
      "expression" : "SDE Ethnicity"
    }
  },
  {
    "id" : "sde-payer",
    "usage" : [{
      "coding" : [{
        "system" : "http://terminology.hl7.org/CodeSystem/measure-data-usage",
        "code" : "supplemental-data"
      }]
    }],
    "description" : "SDE Payer",
    "criteria" : {
      "language" : "text/cql-identifier",
      "expression" : "SDE Payer"
    }
  },
  {
    "id" : "sde-race",
    "usage" : [{
      "coding" : [{
        "system" : "http://terminology.hl7.org/CodeSystem/measure-data-usage",
        "code" : "supplemental-data"
      }]
    }],
    "description" : "SDE Race",
    "criteria" : {
      "language" : "text/cql-identifier",
      "expression" : "SDE Race"
    }
  },
  {
    "id" : "sde-sex",
    "usage" : [{
      "coding" : [{
        "system" : "http://terminology.hl7.org/CodeSystem/measure-data-usage",
        "code" : "supplemental-data"
      }]
    }],
    "description" : "SDE Sex",
    "criteria" : {
      "language" : "text/cql-identifier",
      "expression" : "SDE Sex"
    }
  }]
}

```
