Skip to content

Commit

Permalink
Merge pull request #159 from ropensci/152-odata-entities
Browse files Browse the repository at this point in the history
#152: OData endpoints for Entities
  • Loading branch information
florianm authored Nov 6, 2024
2 parents d6642e6 + 5d950c2 commit 5ca229a
Show file tree
Hide file tree
Showing 38 changed files with 1,597 additions and 76 deletions.
82 changes: 44 additions & 38 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
Type: Package
Package: ruODK
Title: An R Client for the ODK Central API
Version: 1.5.0
Authors@R:c(
person(c("Florian", "W."), "Mayer", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-4269-4242")),
person("Maëlle", "Salmon", , "[email protected]", role = "rev",
Version: 1.5.1
Authors@R: c(
person(
given = c("Florian", "W."),
family = "Mayer",
email = "[email protected]",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-4269-4242")
),
person("Maëlle", "Salmon", "[email protected]", role = "rev",
comment = c(ORCID = "0000-0002-2815-0399")),
person("Karissa", "Whiting", role = "rev",
comment = c(ORCID = "0000-0002-4683-1868")),
Expand All @@ -30,44 +35,46 @@ BugReports: https://github.com/ropensci/ruODK/issues
Depends:
R (>= 4.1)
Imports:
cli (>= 3.6.3),
clisymbols (>= 1.2.0),
crayon (>= 1.5.2),
dplyr (>= 1.0.10),
fs (>= 1.6.0),
glue (>= 1.6.2),
httr (>= 1.4.4),
janitor (>= 2.1.0),
lifecycle (>= 1.0.3),
lubridate (>= 1.9.1),
crayon (>= 1.5.3),
dplyr (>= 1.1.4),
fs (>= 1.6.5),
glue (>= 1.8.0),
httr (>= 1.4.7),
janitor (>= 2.2.0),
lifecycle (>= 1.0.4),
lubridate (>= 1.9.3),
magrittr (>= 2.0.3),
purrr (>= 1.0.1),
readr (>= 2.1.3),
rlang (>= 1.0.6),
purrr (>= 1.0.2),
readr (>= 2.1.5),
rlang (>= 1.1.4),
semver (>= 0.2.0),
stringr (>= 1.5.0),
tibble (>= 3.1.8),
tidyr (>= 1.3.0),
xml2 (>= 1.3.3)
stringr (>= 1.5.1),
tibble (>= 3.2.1),
tidyr (>= 1.3.1),
withr (>= 3.0.2),
xml2 (>= 1.3.6)
Suggests:
covr (>= 3.6.1),
DT (>= 0.27),
ggplot2 (>= 3.4.0),
covr (>= 3.6.4),
DT (>= 0.33),
ggplot2 (>= 3.5.1),
here (>= 1.0.1),
knitr (>= 1.42),
lattice (>= 0.20-45),
leafem (>= 0.2.0.9012),
leaflet (>= 2.1.1),
knitr (>= 1.48),
lattice (>= 0.22-6),
leafem (>= 0.2.3.9007),
leaflet (>= 2.2.2),
leafpop (>= 0.1.0),
listviewer (>= 3.0.0),
mapview (>= 2.11.0.9005),
rmarkdown (>= 2.20),
roxygen2 (>= 7.2.3),
sf (>= 1.0-9),
listviewer (>= 4.0.0),
mapview (>= 2.11.2.9000),
rmarkdown (>= 2.29),
roxygen2 (>= 7.3.2),
sf (>= 1.0-19),
skimr (>= 2.1.5),
terra (>= 1.7-3),
testthat (>= 3.1.6),
tmap (>= 3.3-3),
usethis (>= 2.1.6)
terra (>= 1.7-83),
testthat (>= 3.2.1.1),
tmap (>= 3.3-4),
usethis (>= 3.0.0)
VignetteBuilder:
knitr
RdMacros:
Expand All @@ -81,5 +88,4 @@ LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
X-schema.org-applicationCategory: Data Access
X-schema.org-keywords: database, open-data, opendatakit, odk, api, data,
dataset
X-schema.org-keywords: database, open-data, odk, api, data, dataset
9 changes: 9 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Generated by roxygen2: do not edit by hand

S3method(print,odata_entitylist_data_get)
S3method(print,odata_entitylist_metadata_get)
S3method(print,odata_entitylist_service_get)
S3method(print,ru_settings)
export("%>%")
export(attachment_get)
Expand Down Expand Up @@ -62,6 +65,9 @@ export(handle_ru_datetimes)
export(handle_ru_geopoints)
export(handle_ru_geoshapes)
export(handle_ru_geotraces)
export(odata_entitylist_data_get)
export(odata_entitylist_metadata_get)
export(odata_entitylist_service_get)
export(odata_metadata_get)
export(odata_service_get)
export(odata_submission_get)
Expand Down Expand Up @@ -94,6 +100,7 @@ export(submission_list)
export(sym)
export(syms)
export(user_list)
import(rlang)
import(semver)
importFrom(dplyr,all_of)
importFrom(dplyr,any_of)
Expand All @@ -102,11 +109,13 @@ importFrom(dplyr,ends_with)
importFrom(dplyr,everything)
importFrom(dplyr,one_of)
importFrom(dplyr,starts_with)
importFrom(glue,glue)
importFrom(httr,GET)
importFrom(httr,add_headers)
importFrom(httr,authenticate)
importFrom(httr,content)
importFrom(lifecycle,deprecate_soft)
importFrom(lifecycle,deprecated)
importFrom(magrittr,"%>%")
importFrom(rlang,"%||%")
importFrom(rlang,":=")
Expand Down
11 changes: 11 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
# ruODK 1.5.1
## Major changes
* Add support for the OData API endpoints for Entities (#152)
* Bump minimum versions of dependencies

## Minor changes
* `entity_changes` now returns a tibble instead of nested list.
* `submission_export` gains a new parameter `deleted_fields` to export all
known fields of a form, including fields that were deleted in the latest form
version. (#129, #161)

# ruODK 1.5.0
## Major changes
* Support Entities and Entity Lists (Datasets) (#152)
Expand Down
2 changes: 1 addition & 1 deletion R/attachment_get.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ get_one_attachment <- function(pth,

yell_if_missing(url, un, pw)

res <- httr::RETRY(
httr::RETRY(
"GET",
src,
httr::authenticate(un, pw),
Expand Down
14 changes: 8 additions & 6 deletions R/entity_changes.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
#' @template param-odkcv
#' @template param-orders
#' @template param-tz
#' @return A nested list of lists.
#' The first nesting level corresponds to entity updates, the second level
#' lists each updated property. Within the nested list, the names are
#' `old` (old value), `new` (new value), `propertyName` (name of changed
#' entity property).
#' @return A tibble where rows correspond to each Entity update
#' with three columns:
#'
#' - `old` old value
#' - `new` new value
#' - `propertyName` name of changed entity property
# nolint start
#' @seealso \url{https://docs.getodk.org/central-api-entity-management/#getting-changes-between-versions}
# nolint end
Expand Down Expand Up @@ -105,7 +106,8 @@ entity_changes <- function(pid = get_default_pid(),
times = retries
) |>
yell_if_error(url, un, pw) |>
httr::content(encoding = "utf-8")
httr::content(encoding = "utf-8") |>
purrr::map_df(~ purrr::map_df(.x, ~ tibble::as_tibble(.x)))
}

# usethis::use_test("entity_update") # nolint
2 changes: 1 addition & 1 deletion R/entitylist_detail.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ entitylist_detail <- function(pid = get_default_pid(),
ru_msg_warn("entitylist_detail is supported from v2022.3")
}

ds <- httr::RETRY(
httr::RETRY(
"GET",
httr::modify_url(url,
path = glue::glue(
Expand Down
2 changes: 1 addition & 1 deletion R/entitylist_update.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ entitylist_update <- function(pid = get_default_pid(),
ru_msg_warn("entitylist_update is supported from v2022.3")
}

ds <- httr::RETRY(
httr::RETRY(
"PATCH",
httr::modify_url(url,
path = glue::glue(
Expand Down
Loading

0 comments on commit 5ca229a

Please sign in to comment.