eth-mds / ricu

🏥 ICU data with R 🏥
https://eth-mds.github.io/ricu/
GNU General Public License v3.0
33 stars 11 forks source link

Function `trunc_time` does not actually truncate #52

Open prockenschaub opened 3 months ago

prockenschaub commented 3 months ago

The function create_intervals inside expand_intervals used by mimic_rate_cv calls the function trunc_time in order to truncate times after 6 hours. There are two issues here:

  1. I am unsure whether a hard-coded truncation after 6 hours is sensible for a function that isn't MIMIC-specific. There might be something I am missing here but I think it would make sense to have expand_intervals take a max_len argument that then defaults to 6 hours.

https://github.com/eth-mds/ricu/blob/7f2cc42503e003f4aea388847232e4157b7fc8ea/R/callback-itm.R#L414-L415

  1. The above is currently moot in any case, as trunc_time currently doesn't actually truncate. The replace function is currently never assigned back to the vector x.

https://github.com/eth-mds/ricu/blob/7f2cc42503e003f4aea388847232e4157b7fc8ea/R/utils-ts.R#L643-L654

This can be easily checked by running

debugonce(trunc_time)
load_concepts("norepi_rate", "mimic_demo")

which has a max length of 14 even after "truncating".