Open AmyMikhail opened 2 years ago
Update:
If a required column such as date of birth has no data in the active outbreak, get_cases_epiwindow()
still returns cases within the selected date range, and the column with no data (in this case dob
) is just filled with NA
. So the problem lies in lab2godata_wrapper()
which needs a suitable error added for this scenario.
Running the following code when there is no date of birth in the active outbreak in Go.Data:
# Import lab data:
labdata <- rio::import("inst/extdata/Lab_results_new.xlsx")
# Check lab2godata_wrapper when DOB is not filled:
r21labmatches <- godataR::lab2godata_wrapper(url = url,
username = username,
password = password,
reason = "link new",
daterangeformat = "ymd",
epiwindow = 120,
method = "fuzzy",
matchcols = "names & dob",
labdata = labdata,
basedatecol = "sample_collection_date",
firstnamecol = "firstname",
lastnamecol = "surname",
dobcol = "birthdate")
gives the following error:
Error in 1:ceiling(8 * length(table) * length(x)/limitMem) :
NA/NaN argument
Further update:
The function is now producing a user friendly error which asks you to choose a different set of columns to match on if there is no data in one of the ones you have chosen. However for some reason, the error is appearing in the R console, along with the traceback (which is handy for me but probably too much for users). I will find out how to make the error appear in the app instead.
godataR version / branch:
amymikhail_labimportfunctions
Reported by:
@sarahollis cc @jamesfuller-cdc
Problem statement:
If a user runs the lab2godata shiny app and selects e.g. First name, last name and date of birth to match on but there are no dates of birth entered in their active outbreak in Go.Data, the shiny app exits with an error after pressing the submit parameters button.
Proposed solution:
get_cases_epiwindow()
when, as in this example, one of the core match columns is empty;match_cases()
to return 'no match' for that column ifis.null(dob)
oris.na(dob)
.This should allow the generation of the match report and return 'no match' for that column. The main match columns that could be empty in a given Go.Data instance (and therefore affected by this error) are date of birth or document number. First name and surname will always be present (mandatory) as will age if date of birth is missing.
It might also be useful to return an informative stop error to the user if one of their selected match columns is completely empty. Something like: