-
New Feature
-
Resolution: Answered
-
Minor
-
None
The “INDEX” subset operator serves as a reference in the logic to select specific instances of events for measurement; e.g., the first, second, or third elements in a discrete list of events. “INDEX” treats the list of events as being sorted by ascending timestamps, i.e. the oldest event is first and the newest event is last. Note that the sort order first compares start dates of events followed by the end dates. For events that are an instant in time the start and end dates are the same. Therefore INDEX(1) is equivalent to the “FIRST” subset operator. This allows for more general functionality than the existing subset operators such as “FIRST”, “SECOND”, “THIRD”, etc. It is recommended to keep both “FIRST” and “MOST RECENT”, since they are explicit in their functionality and used frequently. The other subset operators, such as “SECOND” and “THIRD”, should be removed in favor of the more general “INDEX” notation.
The introduction of the “INDEX” operator is important since it prevents limitations in the ability to choose events. Without the operator any subset selection past the given maximum is invalid and requires an update to the QDM specification. For instance, consider trying to get the 9th event for the following example:
AND: NINTH: Occurrence A of X during “Measurement Period”
Currently this is not possible to do, since no “NINTH” subset operator exists. The “INDEX” operator solves this issue by providing the following:
AND: INDEX(9): Occurrence A of X during “Measurement Period”
The “INDEX” operator provides an additional modifier, “DESC”, that orders selection in descending order. The operator “INDEX DESC” treats the list as if it were sorted beginning with the most recent timestamp to the oldest timestamp. Therefore “INDEX DESC(1)” would be equivalent to the “MOST RECENT” operator, “INDEX DESC(2)” next to last event, etc. For example to verify that any of the three most recent lab results were under a certain result limit, we could use the following logic:
RecentLabResults = UNION: INDEX DESC(1): Laboratory Test, Result: X UNION: INDEX DESC(2): Laboratory Test, Result: X UNION: INDEX DESC(3): Laboratory Test, Result: X AND: $RecentLabResults (result < 40 mg/dL)
Note that this example makes use of the variable assignments described in QDM-8. This could alternatively be accomplished with specific occurrences.
In cases where multiple events of the same type have identical timestamps, all relevant events should be considered. For instance consider the case where two “Laboratory Test, Result: X” events were received at the same time, and fell within the three most recent timestamps. Then both results would be considered during evaluation of the measure logic. An example of this is shown in the table below:
INDEX DESC | Result | Timestamp |
---|---|---|
1 | 102 mg/dL | 2014-01-08T15:19Z |
2 | 84 mg/dL | 2014-01-02T04:05Z |
3 | 78 mg/dL | 2014-01-08T09:00Z |
3 | 22 mg/dL | 2014-01-08T09:00Z |
Even though the first three entries of the table are above the 40 mg/dL threshold, the measure logic from the example would still hold true. This is because both of the events corresponding to “INDEX DESC(3)” are considered during evaluation. Since at least one them is under the result limit, the “AND” statement is satisfied.
This now allows for any arbitrary selection of events for any offset that may be needed.