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

Add warnings about missing/invalid date times in `n_imaging`, `n_rbc_transfusions`, and `n_routine_bloodwork` #133

Open loffleraSMH opened 2 months ago

loffleraSMH commented 2 months ago

New Feature Request

All 3 functions have an exclude_ed flag that, if set to TRUE, will exclude tests/transfusions performed during ED (i.e., prior to IP admission date-time). Given that this filter relies on availability of date-time variables (e.g., issue_date_time for transfusions), it would be good to show warnings for missing/invalid entries (which would automatically be excluded when exclude_ed is set to TRUE).

Currently, the filtering is performed within the SQL queries, so all 3 functions would need to be refactored slightly to 1) query all entries in the user-specified cohort first, then 2) run convert_dt (in utils.R) on all relevant date-time variables (which will produce warning messages about missing/invalid values), and 3) finally, perform the filtering based on the date-time variables.

In step 2, we should also add a custom warning message clarifying how missing/invalid date-times are dealt with by each function (e.g., in n_imaging, performed_date_time will be used if order_date_time is missing; in the other functions, entries will missing/invalid date-time will be removed etc.).