openpharma / clinsight

ClinSight - An application for medical monitoring within clinical trials
https://openpharma.github.io/clinsight/
Other
3 stars 0 forks source link

`merge_meta_with_data()` is borked when no vital signs data provided in metadata.xlsx #51

Closed aclark02-arcus closed 3 months ago

aclark02-arcus commented 4 months ago

image

Code that is borked because weight_change_data is empty, and thus the data types differ: https://github.com/openpharma/clinsight/blob/main/R/fct_appdata.R#L195

Easy solution is to replace that line with:

data <- dplyr::bind_rows(data, purrr::map2_df(weight_change_data, purrr::map(data, class), ~{class(.x) <- .y;.x}))

... but, be aware that this adds a new dependency: {purrr} that would need to be added to the namespace and to the description file.

LDSamson commented 3 months ago

@aclark02-arcus I think in this case, the problem lays in the tidyr::pivot_wider step since item_value should never be a list, and converting item_value from a character to class list is probably not desirable.

aclark02-arcus commented 3 months ago

ah yes, you're right. Good catch @LDSamson! I will fix my open PR to remove this "fix".