eCQM QICore Content Implementation Guide
2023.0.0 - CI Build

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

## Library: Status

Official URL: http://ecqi.healthit.gov/ecqms/Library/Status | Version: 1.6.000
Active as of 2023-08-14 | Responsible: National Committee for Quality Assurance | Computable Name: Status
Other Identifiers: https://madie.cms.gov/login#64b86a20774bb523d9a1457b (use: official, )

This library contains functions used to constrain FHIR resource elements for measures authored by NCQA, based on QDM 5.6 to QICore 4.1.1 Mapping.

Id: | 64b86a20774bb523d9a1457b
Url: | http://ecqi.healthit.gov/ecqms/Library/Status
Version: | 1.6.000
Identifier: | value: 64b86a20774bb523d9a1457b
Name: | Status
Title: | Status
Status: | active
Experimental: | false
Type: | system: http://terminology.hl7.org/CodeSystem/library-type code: logic-library
Date: | 2023-08-14T15:19:28+00:00
Publisher: | National Committee for Quality Assurance
Description: | This library contains functions used to constrain FHIR resource elements for measures authored by NCQA, based on QDM 5.6 to QICore 4.1.1 Mapping.
Related Artifacts: | Dependencies
Content: text/cql
    library Status version '1.6.000'

    using QICore version '4.1.1'

    include FHIRHelpers version '4.3.000' called FHIRHelpers

    codesystem "ObservationCategoryCodes": 'http://terminology.hl7.org/CodeSystem/observation-category'
    codesystem "ConditionClinicalStatusCodes": 'http://terminology.hl7.org/CodeSystem/condition-clinical'

    code "laboratory": 'laboratory' from "ObservationCategoryCodes" display 'laboratory'
    code "exam": 'exam' from "ObservationCategoryCodes" display 'exam'
    code "survey": 'survey' from "ObservationCategoryCodes" display 'survey'
    code "vital-signs": 'vital-signs' from "ObservationCategoryCodes" display 'vital-signs'
    code "active": 'active' from "ConditionClinicalStatusCodes"

    context Patient

    //This library contains functions that are based on QDM 5.6 to QICore 4.1.1 March 2023, used for measures authored by NCQA, with notes on intentional differences. The functions in this library have similarities to QICoreCommon (i.e., category constraints) but different in that there are additional constraints such as status or clinical status for each resource.

    //Assessment, Performed
    define function "Final Survey Observation"(Obs List<Observation>):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }
          and exists ( O.category ObservationCategory
              where ( ObservationCategory ) ~ "survey"
          )

    //Similar but different from QICoreCommon.isSurvey, which does not have status constraints
    define fluent function isAssessmentPerformed(Obs List<Observation>):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }
              and exists ( O.category ObservationCategory
              where ( ObservationCategory ) ~ "survey"
          )

    //Diagnosis
    define function "Active Condition"(Condition List<Condition>):
      Condition C
        where C.clinicalStatus ~ "active"

    //Similar but different from QICoreCommon.isActive, which has recurrence and relapse as additional constraints
    define fluent function isActiveOnly(Condition List<Condition>):
      Condition C
      where C.clinicalStatus ~ "active"

    //Device, Order - Personal Use Devices: active and completed only
    define function "Completed or Ongoing Device Request"(DeviceRequest List<DeviceRequest>):
      DeviceRequest D
        where D.status in { 'active', 'completed' }
          and D.intent = 'order'

    define fluent function isDeviceOrder(DeviceRequest List<DeviceRequest>):
      DeviceRequest D
        where D.status in { 'active', 'completed' }
          and D.intent = 'order'

    //Diagnostic Study, Order: active and completed only
    //Intervention, Order: active and completed only
    //Laboratory Test, Order: active and completed only
    define function "Completed or Ongoing Service Request"(ServiceRequest List<ServiceRequest>):
      ServiceRequest S
        where S.status in { 'active', 'completed' }
          and S.intent = 'order'

    define fluent function isDiagnosticStudyOrder(ServiceRequest List<ServiceRequest>):
      ServiceRequest S
        where S.status in { 'active', 'completed' }
          and S.intent = 'order'

    define fluent function isInterventionOrder(ServiceRequest List<ServiceRequest>):
      ServiceRequest S
        where S.status in { 'active', 'completed' }
          and S.intent = 'order'

    define fluent function isLaboratoryTestOrder(ServiceRequest List<ServiceRequest>):
      ServiceRequest S
        where S.status in { 'active', 'completed' }
          and S.intent = 'order'

    //Diagnostic Study, Performed
    define function "Final Observation"(Obs List<Observation>):
      Obs O
        where O.status in {'final', 'amended', 'corrected' }

    define fluent function isDiagnosticStudyPerformed(Obs List<Observation>):
      Obs O
        where O.status in {'final', 'amended', 'corrected' }

    //Encounter, Performed
    //General usage unless required otherwise by the measure's specific use case (e.g., follow-up encounters)
    define function "Finished Encounter"(Enc List<Encounter>):
      Enc E
        where E.status in {'finished', 'arrived', 'triaged', 'in-progress', 'onleave'}

    define fluent function isEncounterPerformed(Enc List<Encounter>):
      Enc E
        where E.status in {'finished', 'arrived', 'triaged', 'in-progress', 'onleave'}

    // //Encounter, Performed: finished and in-progress only
    // define function "Finished or Ongoing Encounter"(Enc List<Encounter>):
    //   Enc E
    //     where E.status in { 'finished', 'in-progress' }

    // define fluent function "isEncounterPerformed"(Enc Encounter):
    //   Enc.status in { 'finished', 'in-progress' }

    //Immunization, Administered: completed only
    define function "Completed Immunization"(Immunization List<Immunization>):
      Immunization I
        where I.status ~ 'completed'

    define fluent function isImmunizationAdministered(Immunization List<Immunization>):
      Immunization I
        where I.status ~ 'completed'

    //Intervention, Performed
    //Procedure, Performed
    define function "Completed Procedure"(Proc List<Procedure>):
      Proc P
        where P.status ~ 'completed'

    define fluent function isInterventionPerformed(Proc List<Procedure>):
      Proc P
        where P.status ~ 'completed'

    define fluent function isProcedurePerformed(Proc List<Procedure>):
      Proc P
        where P.status ~ 'completed'

    //Laboratory Test, Performed
    define function "Final Lab Observation"(Obs List<Observation>):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }
          and exists ( O.category ObservationCategory
              where ( ObservationCategory ) ~ "laboratory"
          )

    define fluent function isLaboratoryTestPerformed(Obs List<Observation>):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }
          and exists ( O.category ObservationCategory
              where ( ObservationCategory ) ~ "laboratory"
          )

    //Medication, Active
    define function "Active Medication"(MedicationRequest List<MedicationRequest>):
      MedicationRequest M
        where M.status = 'active'
          and M.intent = 'order'

    define fluent function isMedicationActive(MedicationRequest List<MedicationRequest>):
      MedicationRequest M
        where M.status = 'active'
          and M.intent = 'order'

    //Medication, Dispensed
    define function "Dispensed Medication"(Med List<MedicationDispense>):
      Med M
        where M.status in { 'completed', 'in-progress', 'on-hold' }

    define fluent function isMedicationDispensed(Med List<MedicationDispense>):
      Med M
        where M.status in { 'completed', 'in-progress', 'on-hold' }

    //Medication, Order: active and completed only
    define function "Active or Completed Medication Request"(MedicationRequest List<MedicationRequest>):
      MedicationRequest M
        where M.status in { 'active', 'completed' }
          and M.intent = 'order'

    define fluent function isMedicationOrder(MedicationRequest List<MedicationRequest>):
      MedicationRequest M
        where M.status in { 'active', 'completed' }
          and M.intent = 'order'

    //Physical Exam, Performed
    define function "Final Exam Observation"(Obs List<Observation>):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }
          and exists ( O.category ObservationCategory
              where ( ObservationCategory ) ~ "exam"
          )

    define fluent function isPhysicalExamPerformed(Obs List<Observation>):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }
          and exists ( O.category ObservationCategory
              where ( ObservationCategory ) ~ "exam"
          )

    //Observation Vital Signs
    define function "BloodPressure"(Obs List<"QICore.observation-bp">):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }

    define function "BodyHeight"(Obs List<"QICore.observation-bodyheight">):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }

    define function "BodyWeight"(Obs List<"QICore.observation-bodyweight">):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }

    define function "BMI"(Obs List<"QICore.observation-bmi">):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }

    //fluent function versions
    define fluent function isObservationBP(Obs List<"QICore.observation-bp">):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }

    define fluent function isObservationBodyHeight(Obs List<"QICore.observation-bodyheight">):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }

    define fluent function isObservationBodyWeight(Obs List<"QICore.observation-bodyweight">):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }

    define fluent function isObservationBMI(Obs List<"QICore.observation-bmi">):
      Obs O
        where O.status in { 'final', 'amended', 'corrected' }

    //Symptom
    define function "Initial or Final Observation"(Obs List<Observation>):
      Obs O
        where O.status in { 'preliminary', 'final', 'amended', 'corrected' }

    define fluent function isSymptom(Obs List<Observation>):
      Obs O
        where O.status in { 'preliminary', 'final', 'amended', 'corrected' }
Content: application/elm+xml
    Encoded data (315056 characters)
Content: application/elm+json
    Encoded data (455980 characters)