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.41k stars 1.5k forks source link

ED patients that were transferred to ICU #1707

Open rriccilopes opened 4 months ago

rriccilopes commented 4 months ago

Prerequisites

Description

I would like to do an study only with the ED stays that were transferred to the ICU. I tried to link the edstays with icustays using stay_id, but it returned no rows. I assume they are different ids, although they have the same name. I understand that I would have to use the subject_id, but then if the patient has multiple ED stays I wouldn't be sure which ED stay ended with ICU admission. Is there a way to link the ED stay with the ICU stay, even if the patient has multiple stays? Perhaps I'm missing something? Thanks!

alistairewj commented 4 months ago

Yeah I somewhat regret this naming convention. stay_id uniquely refers to an ED stay or an ICU stay, but not both. You can use the hadm_id from edstays to link to the subsequent hospitalization. Then, you can link that to icustays. ED stays should be 1:1 with hadm_id, but since a hospitalization can have multiple ICU stays, there may be more than one ICU stay_id for a given hadm_id.