Welcome to the 4th installment of the Teach Me CQL
series. This series is presented by The Centers for Medicare and
Medicaid Services (CMS). It is intended to support healthcare
quality leaders, health IT vendors, and measure developers
explore the use of CQL, or Clinical Quality Language.
In today's segment, we will discuss the use of the
Coalesce function, native to CQL. As we have done
in our previous sessions, we will use current eCQM logic
examples to illustrate the lesson. In our previous sessions,
we have discussed CQL functions in the global common
library, like NormalizeInterval and LatestOf.
These functions use CQL to create functions
that are shared across eCQMs using the global common library.
Today, we will be talking about a native operator
To CQL that can be referenced in the HL7
CQL specification. CQL
is an HL7 standard that defines a representation
for the expression of clinical knowledge that can be used within
both the Clinical Decision (CDS) and Clinical Quality
Measurement (CQM) domains. The landing page for the CQL
specification provides a blue navigation bar that lists
chapters within the specification, like "Author's Guide"
and CQL reference. The Author's Guide
Introduces the high-level syntax for the CQL focused on
measure and decision support authors. The Developer's
Guide complements the Author's Guide by providing more in-depth
discussion of language elements, semantics, and
more complex query scenarios, and more advanced topics
such as typing and function definition.
For today's lesson, we will look in the Developer's Guide and scroll
down to section 6 - Nullological operators.
Let's learn a little bit about the Coalesce operator before
we review our measure example.
In the CQL specification, the 'coalesce' operator
Is defined as follows: to return the first non-null
expression among two or more expressions, the the
Coalesce operator and we see here
the Coalesce statement includes X, Y, and Z,
which is equivalent to the case when X is not
null then X, when Y is not null then Y,
or else Z and then end.
Stated another way, the coalesce operator asks the
computer to look through a set of expressions and return the first
one that has a value that is not a null value.
Let's take a look at a measure example to help bring this expression to life.
For our measure example today, we will
be using CMS 145 Coronary Artery
Disease (CAD): Beta-Blocker Therapy-Prior
Myocardial Infarction (MI) or Left Ventricular Systolic Dysfunction (LVEF <=40%).
This measure looks for percentage of patients aged 18
years and older with a diagnosis of coronary artery
disease within a 12-month period who also have a prior
MI or a current or prior
LVEF <=40% who were prescribed
beta-blocker therapy. If we look at the definition
Qualifying CAD Encounter and History of
Moderate or Severe LVSD,
we will see the use of the coalesce operator there.
In this definition statement, the coalesce operator is helping
to find the first non-null datetime value
associated with the LVSD findings -
whether that data is collected using a datetime
or period. You now have a better understanding of the
coalesce operator and how it behaves with measure data types.
We hope you have enjoyed this series on the CQL functions and the
global common library. If you have further CQL questions or need technical
assistance, please visit the ONC JIRA CQL
issue tracker.