FHIR Chat · BCSE - some help · cql

Stream: cql

Topic: BCSE - some help


view this post on Zulip Vasyl Herman (Jun 23 2021 at 18:22):

Hello,
I got stuck on AdvancedIllnessFrailty."Acute Inpatient Discharge with Advanced Illness"
Here: https://github.com/cql-fhir-project/ecqm-content-r4-2021/blob/master/bundles/ncqa/BCSE_HEDIS_MY2022-1.0.0/libraryCql/NCQA_AdvancedIllnessandFrailty-1.0.0.cql#L120-L125

Could any body give an example of Patient's Bundle that would hit Acute Inpatient Discharge with Advanced Illness definition, please?

view this post on Zulip Vasyl Herman (Jun 23 2021 at 18:56):

AdvancedIllnessFrailty."Nonacute Inpatient Discharge with Advanced Illness" the same situation:

define "Nonacute Inpatient Discharge with Advanced Illness":
  ( ( Claims."Medical Claims With Diagnosis" ( Claims."Medical Claims With Nonacute or Acute Inpatient Discharge" ( [Claim] ).NonacuteInpatientDischarge, "Advanced Illness ValueSet" ).ServicePeriod ) DischargeWithDiagnosis
    where date from
    end of DischargeWithDiagnosis during Interval[date from start of "Measurement Period" - 1 year, date from
    end of "Measurement Period"]) InpatientDischarge
    return date from
    end of InpatientDischarge

To be more specific I am having trouble with Claims."Medical Claims With Nonacute or Acute Inpatient Discharge" function github link
Could anybody please explain on high level what means Tuple return tuple return tuple? or give a Bundle ?
Thanks in advanced!

view this post on Zulip JP (Jun 24 2021 at 16:28):

I'll take a stab at explaining it. The overall goal of the function is to go from a set of Claims, to a set of Line Items that are grouped by category. There are 3 main sections of that function. Each builds on the last and filters/transforms the data along the way.

Input data (Claims) -> (apply filter) ->
Tuple 1 (Medical Claims) -> (group line items by acute inpatient and non acute inpatient) ->
Tuple 2 (InpatientStayLineItems, NonacuteInpatientLineItems) -> (further separate the line items) ->
Tuple 3 (InpatientDischarge, NonacuteInpatientDischarge, AcuteInpatientDischarge)

A difference between the return statement in CQL and many other programming languages is that the return is at the query level and not the function level (specifically, return is used for query shaping - https://cql.hl7.org/02-authorsguide.html#queries). In other words, the returns that occur midstream are transient and only feed into the next step in the pipeline. The return value of the overall function is a List of Tuple 3 which is the last step in that pipeline.

view this post on Zulip Vasyl Herman (Jun 24 2021 at 18:19):

Thaks! It helped a lot!
Basically, at the end you will have an Object of arrays. AcuteInpatientDischarge is empty if there is a NonacuteInpatientDischarge, right?

Screenshot-2021-06-24-at-21.15.46.png


Last updated: Apr 12 2022 at 19:14 UTC