You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Errors in the charttime or stayid of chartevens #1961
I used the following code to explore whether there are any chartevents that happened after ICU stay:
SELECT
ce.stay_id,
ce.charttime,
ce.itemid,
ie.intime,
ie.outtime,
EXTRACT(EPOCH FROM (ce.charttime - ie.outtime))/3600/24 AS days_diff
FROM mimiciv_icu.chartevents AS ce
LEFT JOIN mimiciv_icu.icustays AS ie
ON ce.stay_id = ie.stay_id
WHERE ce.charttime > ie.outtime
ORDER BY days_diff DESC;
To my surprise, there are 407966 records of chartevents that happened after ICU stay. Some of them happened many days or even years after ICU outtime. Compare to the 432997491 records of all chartevents, they are not too many though. How did it happen?
charttime after outtime shows up a lot in the raw data — usually late charting / device data, not a stay_id join bug. if you need in-icu only, filter charttime between intime and outtime.
opened docs + audit queries in #2151 — charttime after outtime is common late charting / device clocks, not usually a stay_id join bug. filter explicitly if you need in-icu only.
Activity
chessing234 commentedon Jul 19, 2026
charttime after outtime shows up a lot in the raw data — usually late charting / device data, not a stay_id join bug. if you need in-icu only, filter charttime between intime and outtime.
chessing234 commentedon Jul 31, 2026
opened docs + audit queries in #2151 — charttime after outtime is common late charting / device clocks, not usually a stay_id join bug. filter explicitly if you need in-icu only.
docs(mimic-iv): add CHARTEVENTS_TIMING for charttime vs outtime
docs(mimic-iv): link README(s) to chartevents timing notes
docs(mimic-iv): add documentation helper-query folder
docs(mimic-iv): add chartevents-after-outtime audit query
docs(mimic-iv): sample query for chartevents before intime
docs(mimic-iv): clarify we will not clip chartevents in ETL