MIT-LCP / mimic-code

MIMIC Code Repository: Code shared by the research community for the MIMIC family of databases
https://mimic.mit.edu
MIT License
2.51k stars 1.5k forks source link

Negative death time for some patients #1427

Closed shi-ang closed 1 year ago

shi-ang commented 1 year ago

Prerequisites

Description

Hi,

I found that there are very few patients associated with negative death time from ICU recruitment. This death time from ICU recruitment is calculated by using icu_intime minus the dod from the mimic_derived.icustay file on BigQuerry. I'm wondering if it is the correct way to calculate such a value or if I've made a mistake by assuming the icu_intime should always happen earlier than the dod time.

The SQL code (for MIMIC-IV v2.0) to reproduce some patients with negative death time on BigQuerry:

SELECT
TIMESTAMP_DIFF(icu_detail.dod, icu_detail.icu_intime, HOUR) / 24 as time_to_death,
icu_detail.dod,
icu_detail.icu_intime
from `physionet-data.mimiciv_derived.icustay_detail` icu_detail
where
icu_detail.subject_id = 14150625 or icu_detail.subject_id = 10590985 or icu_detail.subject_id = 13260040
alistairewj commented 1 year ago

This might be because you are comparing a date (dod) with a timestamp (icu_intime). If someone dies on the same day they are admitted, then it would appear as if they died before being admitted. You could try truncating icu_intime to the day, and only calculating integer days of death.

shi-ang commented 1 year ago

I appreciate you reply very much.

However, it is not necessary the case. If you run the SQL code above, you will get the following query results: Screenshot from 2022-12-21 16-19-38 For these three patients, the dod is ahead of icu_intime by a few years.

And there are more of them in the database...

alistairewj commented 1 year ago

How many more? We don't "fix" data as a policy, so if it's a few cases, then it's just bad data, but if it's many cases, then it may be a systematic error in a data source or our process.

shi-ang commented 1 year ago

In total there are 5 cases. So I just dropped them from the dataset.

alistairewj commented 1 year ago

Got it, yep, good to keep an eye out for these inconsistencies!

KimballCai commented 1 year ago

but I found 25 cases. The subject ids are [10554954, 11042406, 11660628, 12207593, 12376923, 12393516, 12921133, 13078944, 15018122, 15190414, 15246174, 15831207, 15834858, 16467939, 16533974, 17536748, 17631949, 17906419, 17955142, 18839671, 19107535, 19379644, 19547124, 19752788, 19914761].

The intime in their ICU records is later than their deathtime. I have checked several ICU stays, and there are several output or chart records for these ICU stays.

I also remove them for now.

Thanks.