ropensci / ruODK

ruODK: An R Client for the ODK Central API
https://docs.ropensci.org/ruODK/
GNU General Public License v3.0
41 stars 12 forks source link

Support new export parameters for submission export #137

Open florianm opened 2 years ago

florianm commented 2 years ago

Feature

Provide the new submission export parameters where applicable, especially "split multiple select answers into columns".

Thaliehln commented 2 years ago

Hi @florianm,

Are you referring here mostly to odata_submission_get(...) or also to submission_export(...)?

If you are interested, I started modifying the function submission_export(...) for my own needs this weekend (mostly as I really need to limit the amount of data I retrieve from the servers to run quick tests, etc - as it starts to be huge), inspired by what you had already done with odata_submission_get(...) (very helpful - I actually reproduced the filter feature exactly as you had implemented it).

I have the following - you can advise if you have a specific convention for naming variables

qry <- list(
      attachments = ifelse(media == FALSE, "false", "true"),
      deletedFields = ifelse(delfields == FALSE, "false", "true"),
      groupPaths = ifelse(group == FALSE, "false", "true"),
      splitSelectMultiples = ifelse(split == FALSE, "false", "true")
)

The updated function seems to work fine on my data but obviously there would be more checks/tests needed for ruODK depending on the version of ODK Central that is used. About this, I am not sure if the odkc_version parameter is dynamically updated? On my side it seems to be systematically set to 1.1 (I am using 1.5 or 1.4)

florianm commented 2 years ago

Hi @Thaliehln! Thanks for the contribution! I'm absolutely behind on updating ruODK to the latest Central features. Thanks for pushing this forward.

Re naming conventions: I've used snake_case elsewhere over camelCase.

Re ODK Central version: Unless you set ODKC_VERSION, https://github.com/ropensci/ruODK/blob/main/R/ru_setup.R#L519 defaults this to 1.1. Under the bonnet, that's fine, as I use it to toggle support for breaking changes - last seen at 1.1. At the next breaking change, I'll bump this to the then current Central version.

Re filter syntax, I'm linking https://github.com/getodk/central-backend/pull/495 here as a reminder to myself to update ruODK functions/help/examples/vignettes where applicable.