Skip to content

New Feature: Support for datetime calculations in cohort definitions #2886

Description

@TomWhite-MedStar

Problem Statement

Multiple US electronic Clinical Quality Measure (eCQM) require datetime calculations when doing computations from electronic health records. Public domain examples are published here. The trend for needing datetime logic appears to be increasing.

In many cases, it is possible to create versions of those eCQM as Atlas cohorts, and then adapt the SQL to use datetime calculations instead of datetime. Although this may work for single institutions, it does not lend itself to developing these as phenotypes that can be run in a network study.

Examples:

  1. Hospital Harm - Severe Hyperglycemia. Checks for days when very high glucose measurements are present, but based upon rolling 24 hour periods starting from the time of ED or hospital admission (instead of calendar dates). Thus, the index date is actually a datetime.
  2. Hospital Harm - Severe Hypoglycemia. Checks whether follow-up glucose measurements occurred within 5 minutes after critically low measurements.
  3. Hospital Harm - Opiate-Related Adverse Events. Checks whether opioid antagonists had to be administered within 12 hours after administration of an opioid.

Current Behavior

The Atlas GUI for selecting timespans (e.g. between two dates) only supports whole-number date logic.

Desired behavior

Augment the Atlas GUI to allow for whole number datetime interval logic, with options to specify "seconds", "minutes", "hours", or "days" instead of only "days".

For simplicity to the users, the internal logic should know to use datetime interval logic instead of date logic whenever "seconds", "minutes", or "hours" are selected. This would eliminate the need for cohort authors to choose between "index start date" and "index start datetime".

For example, if you want to know that an event occurred within 24 hours of admission, you would use an interval of 24 hours (which would use datetime logic) rather than 1 day (which would use date logic).

Here is example where I'd want to use 24 hours:
image

And here is example where I'd want to use minutes:
image

Feature Request Scope

  1. Make the word "days" a drop-down box like "Before/After" than has choices {days, hours, minutes, seconds)
  2. Augment the JSON to support this. I presume you want backwards compatibility. So, perhaps keep the existing syntax, but modify it to add optional "TimeUnit" and "TimeUnitValue" fields, where "TimeUnit" can have values "Days", "Hours", "Minutes", "Seconds"; and "TimeUnitValue" would have the desired value (that is currently show in the "Days" field? Below is example of how such time windows are currently represented in JSON:
                "StartWindow": {
                  "Start": {
                    "Days": 9,
                    "Coeff": -1
                  },
                  "End": {
                    "Days": 1,
                    "Coeff": -1
                  },
  1. Augment the generated SQL to use time interval logic whenever a TimeUnit other than "Days" is selected. Retain the current logic when "Days" is selected. Note. I have opened a feature enhancement issue with SqlRender to see if are able to generate interval time translations across all supported databases. Per GPT-4, the translations looks pretty straight forward.
  2. Are augmentations to WebAPI needed?

Note, although not all data source have datetime-level data, the 5.3 OMOP data model and above all require datetime fields. By convention, those are populated with the same value that are in the matching data field. So, if this enhancement is added, phenotypes using seconds/minutes/hours should work (without breaking) on any 5.3 and above OMOP datasets. Data contributors would need to clarify which subset (if any) of their data has true datetime values, and Researchers would need to take that into consideration.

Metadata

Metadata

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions