Skip to content

QA Multiple Diagnoses and Multiple Value Sets

Darren Duncan edited this page Oct 12, 2017 · 1 revision

Questions and Answers


Q&A - Multiple Diagnoses and Multiple Value Sets

Question

I made Encounter changes from .diagnosis to .diagnoses in the measure logic but I am having a problem. There are two values sets in the same definition which is probably causing the problem. I tried different codes but noting seem to resolve the MAT error.

Here is the definition that needs to be re-worked:

  distinct(
    (
      "Inpatient-Encounter" Encounter
        where Encounter.diagnoses in "Single Live Birth"
          or Encounter.diagnoses in "Single Live Born Newborn Born in Hospital"
    )
    union
    (
      "Inpatient-Encounter" Encounter
        with "Single-Live-Birth-Diagnosis" D
          such that D.prevalencePeriod starts during Encounter.relevantPeriod
    )
  )

Answer

Because there may be multiple diagnoses on a single Encounter, we need to use an "exists" to test whether any diagnosis is in the value set. For example:

  define "Current Diagnosis Atrial FibrillationFlutter": 
    "Encounter with Principle Diagnosis of Ischemic Stroke" NonElectiveEncounter
      where exists (NonElectiveEncounter.diagnoses D where D in "Atrial Fibrillation/Flutter")

Here's a rewritten "Single-Live-Birth-Encounter":

  define "Single-Live-Birth-Encounter":
    (
      "Inpatient-Encounter" Encounter
        where exists (
            Encounter.diagnoses Diagnosis 
              where Diagnosis in "Single Live Birth"
                or Diagnosis in "Single Live Born Newborn Born in Hospital"
          )
    )
    union
    (
      "Inpatient-Encounter" Encounter
        with "Single-Live-Birth-Diagnosis" D
          such that D.prevalencePeriod starts during Encounter.relevantPeriod
    )

Note that in CQL 1.2, you no longer need to use "distinct" on the result of a union, the union operator now eliminates duplicates.

Wiki Index

Home

Authoring Patterns - QICore v4.1.1

Authoring Patterns - QICore v5.0.0

Authoring Patterns - QICore v6.0.0

Authoring Measures in CQL

Composite Measure Development

Cooking with CQL Examples

Cooking with CQL Q&A All Categories
Additional Q&A Examples

CQL 1.3 Impact Guidance

CQL Error Messages

Developers Introduction to CQL

Discussion Items

Example Measures

Formatting and Usage Topics

Formatting Conventions

Library Versioning

Negation in QDM

QDM Known Issues

Specific Occurrences

Specifying Population Criteria

Supplemental Data Elements

Terminology in CQL

Translator Options For Measure Development

Unions in CQL

Clone this wiki locally