GEMINI-Medicine / Rgemini

A custom R package that provides a variety of functions to perform data analyses with GEMINI data
https://gemini-medicine.github.io/Rgemini/
Other
3 stars 0 forks source link

Warning message when apply `icu_los()` to data with only date, not time #68

Closed guoyi-smh closed 3 months ago

guoyi-smh commented 8 months ago

In current version of the GEMINI data drm_cleandb_v2. Despite the fact that majority of the sites have good quality in the date time of ICU admission and discharge, the ICU discharge time is missing completely for one site, with only date available. The icu_los() function now only computes the ICU length-of-stay for records with complete scu_admission_date_time and scu_discharge_date_time in %Y%m%d %H%M format, and it fills 0 for encounters without any compete ICU records. As a result, all encounters from this one site will get 0 in the output ICU length-of-stay.

Considering that different project may take different approach to deal with issue , such as impute all with "00:00" or maybe use date only for all records. It may be better for the function to return a warning like x rows in the input ipscu table do not have a valid scu_admission_date_time or scu_discharge_date_time and the computed ICU length-of-stay will be 0 for these records. If you want to include these records in the computation, please impute the missing date-time in your table and re-run the function

loffleraSMH commented 3 months ago

Note: This can be resolved together with issue #76, which will a) convert all date-time variables into the appropriate format, b) return warning messages about missing/invalid date-times, and c) allows for additional, customized warning messages. I'm working on #76 right now and will add the warning message you suggested.

loffleraSMH commented 3 months ago

I'll mark this issue as closed since the fix has been implemented together with issue #76 (requires review).