-
Enhancement
-
Resolution: Done
-
Major
-
None
In QDM, every data type has an implicit interval that is used for timing relationships. For example:
"Diagnosis: Diabetes" overlaps "Encounter, Performed: Inpatient"
is comparing the diagnosis's onset-to-abatement interval with the encounter's admission-to-discharge interval. Special interval attributes or datetime attributes are not required to be explicitly stated – they are implicit to the data type.
In CQL, there is no such thing as an implicit interval or datetime. All timing relationships must be specified using specific attributes of the data type. Since "overlaps" requires intervals, this would need to be written in CQL as:
[Diagnosis: "Diabetes"] D with ["Encounter, Performed": "Inpatient"] E such that Interval[D."onset datetime", D."abatement datetime"] overlaps Interval [E."admission datetime", E."discharge datetime"]
(If you're new to CQL, you may want to read section 2.3 Queries in the CQL specification, otherwise these examples may be confusing. For this discussion, it may also be helpful to read section 5.5.5 Timing and Interval Operators.)
Since interval timing constructs are used a lot, it may be helpful to introduce attributes that represent the interval of interest. For simplicity sake, a "period" attribute could be added to every data type to represent the default interval. Continuing with the example, this would result in the following (improved) CQL:
[Diagnosis: "Diabetes"] D with ["Encounter, Performed": "Inpatient"] E such that D.period overlaps E.period
If more specificity was desired, then instead of calling every interval "period", more specific names could be used, and/or it could be applied only to those data types most likely to use it (for example, the "Order" data types are concerned only with a single order date, so they would not need an interval).