projecttacoma / fqm-execution

fqm-execution is a library that allows users to calculate FHIR-based electronic Clinical Quality Measures (eCQMs) and retrieve the results in a variety of formats
https://projecttacoma.github.io/fqm-execution/
Apache License 2.0
18 stars 6 forks source link

Included-in operation as it applies to dates #224

Closed gregory-akins closed 1 year ago

gregory-akins commented 1 year ago

Summary

We have a test case that is looking for Location period "Included-In" Encounter period. The data doesn't evaluate correct for cases where the start date of location is equal to the start date of the encounter (even though inclusiveness on the Periods should be for Where start date is >=

Expected Behavior

When test data indicates the start date of a Location is = the start date of the encounter & the end date of the location is < the end date of the encounter, the test case should be present for the definition of "during" as during is defined http://cql.hl7.org/09-b-cqlreference.html#included-in

Version or Commit

1.0.8

Inputs (e.g. Measure Bundle, Patient Bundle, CQL Library)

Attached zip has bundle, test case and a text document that outlines the date range issue bundleAndTestcase.zip

Relevant Calculation Options (e.g. Measurement Period, meta.profile Validation)

image

define "Encounter with ICU Location": VTE."Encounter with Age Range and without VTE Diagnosis or Obstetrical Conditions" QualifyingEncounter where exists (QualifyingEncounter.location Location where CQMCommon.GetLocation(Location.location).type in "Intensive Care Unit" and Location.period during QualifyingEncounter.period )

cql-to-elm Version Used for Measure Logic Translation (if known)

2.7.0

Any Additional Info

mgramigna commented 1 year ago

Hi @gregory-akins! It looks like there are some similar things going on with this issue as there were in #177 where due to lack of millisecond precision on some of the data, cql-execution constructs an uncertainty containing the range of 0 to 999 milliseconds for a given DateTime.

In the patient data provided, the location's period specified .000 as the millisecond precision on .start:

"location": [
  {
    "location": {
      "reference": "Location/intensive-care-unit-abcf"
    },
    "period": {
      "start": "2021-12-01T08:00:00.000+00:00", <-- precision defined here
      "end": "2021-12-03T11:59:00.000+00:00"
    }
  }
]

However, the Encounter's period does not specify the precision:

"period": {
  "start": "2021-12-01T08:00:00+00:00", <-- no precision specified
  "end": "2021-12-31T23:59:00+00:00"
}

cql-execution needs to account for all possible period starts of the Encounter. This will be represented as an Uncertainty, similar to what's mentioned in #177. In this case, since there is a possible period start that starts after the Location's period start, the result of that during clause will be null.

I added millisecond precision to the Encounter's period, and that seemed to resolve the issue:

image

hossenlopp commented 1 year ago

Closing this ticket. Precision with the data was the issue here.