asitav-sen / KoboconnectR

Download data from Kobotoolbox to R
https://asitav-sen.github.io/KoboconnectR/
GNU General Public License v3.0
13 stars 2 forks source link

The order and structure that is returned when getting the export list from kobo_exports has been switched, leading to a series of problems in the functioning of this library. #23

Open Falnesio opened 6 days ago

Falnesio commented 6 days ago

The order that is returned when getting the export list has been switched so that the newest export appears first, leading to a series of problems in the functioning of this library. export_creator can no longer filter using post_export to obtain latest export. The structure of the list has also changed. This affects export_creator and what it returns because it changes what kobo_exports returns (which is something that may be troubling people that are using this library).

What once could be obtained from:

exportacoes <- kobo_exports(...)
  uid <- exportacoes$results$uid
  atualizacao <- exportacoes$results$date_created
  dados <- exportacoes$results$result   
  fonte <- exportacoes$results$data$source

Now needs to be obtained as such

exportacoes <- kobo_exports(...)
  uid <- purrr::map_chr(exportacoes$results, ~ purrr::pluck(.x, "uid", .default = NA))
  atualizacao <- purrr::map_chr(exportacoes$results, ~ purrr::pluck(.x, "date_created", .default = NA))
  dados <- purrr::map_chr(exportacoes$results, ~ purrr::pluck(.x, "result", .default = NA))
  fonte <- purrr::map(exportacoes$results, ~ .x$data$source %||% NA) %>% flatten_chr()
asitav-sen commented 6 days ago

Thanks @Falnesio . They keep on changing stuff. I will soon be updating the package to cater to these issues.