opensafely-core / cohort-extractor

Cohort extractor tool which can generate dummy data, or real data against OpenSAFELY-compliant research databases
Other
38 stars 13 forks source link

Treat null dates as 1900-01-01 in EMIS #522

Closed HelenCEBM closed 3 years ago

HelenCEBM commented 3 years ago

Problem

Currently, clinical events with no known "applicable" date are NULL in EMIS (this is the date we use in cohortextractor which represents the date the information applies to, rather than when it was entered). In TPP unknown dates default to 1900-01-01. This means that these events are treated differently in cohort-extractor: (a) events with null dates are excluded when an on-or-before date is entered, and (b) if no date limits are entered, a result is returned for all returning options other than date, which returns a null, not indicating that the patient had actually matched the given criteria.

Further discussion in this issue.

Solution

Convert null dates to 1900-01-01 (or make sure cohortextractor treats them as such).

sebbacon commented 3 years ago

We should consider implementing this as a FLOOR_DATE and (CEILING_DATE?) "constant" in code to make its intent clear. We will also need to be sure we add this in the right places in documentation.