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.).
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 whenexclude_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) runconvert_dt
(inutils.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 iforder_date_time
is missing; in the other functions, entries will missing/invalid date-time will be removed etc.).