Closed achafetz closed 10 months ago
Hi AC,
Can you take another look at this? Looks like countries with undocumented levels in the org_levels, don't get child-parent mapping right.
Here is an example:
grabr::datim_orgunits("Tanzania", glamr::datim_user(), glamr::datim_pwd())
grabr::datim_orgunits("Tanzania", glamr::datim_user(), glamr::datim_pwd(), reshape = T)
Lucky me that TZA updated their PSNU levels I guess.
First line runs well 👍
grabr::datim_orgunits("Tanzania", glamr::datim_user(), glamr::datim_pwd())
Second line runs into an issue - str_replace()
appears to be missing an explicit reference - stringr::str_replace()
- somwhere within the function
I think it is coming from here https://github.com/USAID-OHA-SI/grabr/blob/be34c97e33b1222a891c6dc32d39dbb9f82e9a59/R/extract_datim.R#L1235
#test 1 - bad creds
datim_orgunits("Malawi", user = "blah", password = "blah")
#test 2 - default
datim_orgunits("Malawi") %>% dplyr::glimpse()
#test 3 - reshape = T
datim_orgunits("Malawi", reshape = TRUE) %>% dplyr::glimpse()
With bad credentials, we get the correct error message, but it doesn't appear we have a clean exit. We have code here looking like the code continued to try to run after the bad creds and then ran into an error (because there wasn't a dataframe)
With the default setting, we get a print out about "New names" that we should ideally supress.
Testing with the update and still getting an getting a new error: "Unknown or uninitialised column: orgunit_level
"
Pushed some new updates - fixes level issue and reshaping. Give it another try when you can
#test 1 - bad creds
datim_orgunits("Malawi", user = "blah", password = "blah")
#test 2 - default
datim_orgunits("Malawi") %>% dplyr::glimpse()
#test 3 - reshape = T
datim_orgunits("Malawi", reshape = TRUE) %>% dplyr::glimpse()
✅ provided bad creds and got back an "unauthorized" error message
🟡 run works, but we get a print out about "New names" that we should ideally supress.
❌ error within subfuction clean_orgunits()
that there are unused arguments (username, password, baseurl)
🟡 print out "New names" should ideally supress.
Fixed - Dropped some params and forgot to update downstream functions.
Note: the warnings new names
are upstreams. Comming from as_tibble()
with name_repairs. Will track those down over time.
Thanks for these tests