diff --git a/DESCRIPTION b/DESCRIPTION index 64229b82..efd0ea8c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: ruODK Title: An R Client for the ODK Central API -Version: 0.9.0.9000 +Version: 0.9.1 Authors@R: c(person(given = c("Florian", "W."), family = "Mayer", diff --git a/NAMESPACE b/NAMESPACE index b105c960..4078a897 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -6,6 +6,7 @@ export(attachment_get) export(attachment_link) export(attachment_list) export(audit_get) +export(drop_null_coords) export(enexpr) export(enquo) export(ensym) diff --git a/NEWS.md b/NEWS.md index e32b5ff8..7821e5ba 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,16 @@ # `ruODK` (development version) * Development continues in the default branch `main`. + +# `ruODK` 0.9.1 +## Major fixes +ODK Central versions 0.7 to 0.9 export geotraces and geoshapes via OData with +a trailing empty coordinate. `ruODK` removes any trailing empty coordinates from +both GeoJSON and WKT formats. (#88, HT Timon Weitkamp for the bug report) + +## Documentation +A new vignette "Spatial" demonstrates how to parse spatial data into native +formats, such as `sf`, and gives pointers on what to do next with them. + # `ruODK` 0.9.0 This is the release on passing diff --git a/R/data.R b/R/data.R index 4b3972a3..2a687d8f 100644 --- a/R/data.R +++ b/R/data.R @@ -391,6 +391,23 @@ #' @encoding UTF-8 "geo_gj" +#' The parsed submissions of a form containing geofields in GeoJSON +#' with trailing empty coordinates present. +#' +#' \lifecycle{stable} +#' +#' This issue was fixed in #88. +#' ODK Central versions 0.7 - 0.9 export geotraces and geoshapes with trailing +#' empty coordinates. ruODK has a patch to drop trailing empty coordinates. +#' This dataset is used to test the patch in ruODK. +#' +#' @source \code{\link{odata_submission_get}(wkt=FALSE, parse=TRUE)} +#' run on the test form +#' `system.file("extdata", "Locations.xml", package = "ruODK")`. +#' @family included +#' @encoding UTF-8 +"geo_gj88" + #' The unparsed submissions of a form containing geofields in WKT. #' #' \lifecycle{stable} @@ -413,6 +430,23 @@ #' @encoding UTF-8 "geo_wkt" +#' The parsed submissions of a form containing geofields in WKT +#' with trailing empty coordinates present. +#' +#' \lifecycle{stable} +#' +#' This issue was fixed in #88. +#' ODK Central versions 0.7 - 0.9 export geotraces and geoshapes with trailing +#' empty coordinates. ruODK has a patch to drop trailing empty coordinates. +#' This dataset is used to test the patch in ruODK. +#' +#' @source \code{\link{odata_submission_get}(wkt=TRUE, parse=TRUE)} +#' run on the test form +#' `system.file("extdata", "Locations.xml", package = "ruODK")`. +#' @family included +#' @encoding UTF-8 +"geo_wkt88" + #' The unparsed XML form_schema of a form from ODK Central v0.6 as nested list. #' #' \lifecycle{stable} diff --git a/R/drop_null_coords.R b/R/drop_null_coords.R new file mode 100644 index 00000000..e181bd77 --- /dev/null +++ b/R/drop_null_coords.R @@ -0,0 +1,60 @@ +#' Drop any NULL coordinates from a GeoJSON geometry. +#' +#' This helper patches a bug/feature in ODK Central (versions 0.7-0.9), where +#' geotrace / geoshape GeoJSON contains a last coordinate pair with NULL +#' lat/lon (no alt/acc), and WKT ends in `, undefined NaN`. +#' +#' While \code{\link{split_geotrace}} and \code{\link{split_geoshape}} modify +#' the WKT inline, it is more maintainable to separate the GeoJSON cleaner +#' into this function. +#' +#' This helper drops the last element of a GeoJSON coordinate list if it is +#' `list(NULL, NULL)`. +#' +#' @param x A GeoJSON geometry parsed as nested list. +#' E.g. `geo_gj$path_location_path_gps`. +#' @return The nested list minus the last element (if NULL). +#' @family utilities +#' @export +#' @examples +#' # A snapshot of geo data with trailing empty coordinates. +#' data("geo_gj88") +#' +#' len_coords <- length(geo_gj88$path_location_path_gps[[1]]$coordinates) +#' +#' length(geo_gj88$path_location_path_gps[[1]]$coordinates[[len_coords]]) %>% +#' testthat::expect_equal(2) +#' +#' geo_gj88$path_location_path_gps[[1]]$coordinates[[len_coords]][[1]] %>% +#' testthat::expect_null() +#' +#' geo_gj88$path_location_path_gps[[1]]$coordinates[[len_coords]][[2]] %>% +#' testthat::expect_null() +#' +#' # The last coordinate pair is a list(NULL, NULL). +#' # Invalid coordinates like these are a choking hazard for geospatial +#' # packages. We should remove them before we can convert ODK data into native +#' # spatial formats, such as sf. +#' str(geo_gj88$path_location_path_gps[[1]]$coordinates[[len_coords]]) +#' +#' geo_gj_repaired <- geo_gj88 %>% +#' dplyr::mutate( +#' path_location_path_gps = path_location_path_gps %>% +#' purrr::map(drop_null_coords) +#' ) +#' +#' len_coords_repaired <- length( +#' geo_gj_repaired$path_location_path_gps[[1]]$coordinates +#' ) +#' testthat::expect_equal(len_coords_repaired + 1, len_coords) +drop_null_coords <- function(x) { + # Extract and simplify last coords. list(NULL, NULL) becomes list(). + xx <- purrr::compact(x$coordinates[[length(x$coordinates)]]) + # Remove empty coords by setting the entire list(NULL, NULL) to NULL. + if (is.list(xx) && length(xx) == 0) { + x$coordinates[[length(x$coordinates)]] <- NULL + } + x +} + +# usethis::use_test("drop_null_coords") # nolint diff --git a/R/split_geoshape.R b/R/split_geoshape.R index 28307e3e..40d3a9b3 100644 --- a/R/split_geoshape.R +++ b/R/split_geoshape.R @@ -69,17 +69,16 @@ #' ) #' } split_geoshape <- function( - data, - colname, - wkt = FALSE, - odkc_version = odkc_version -) { + data, + colname, + wkt = FALSE, + odkc_version = odkc_version) { if (nrow(data) == 0) { # Option 1: Early exit - nothing to do return(data) } else if (odkc_version < 0.8) { # Option 2: ODK linestring - # ODK Central <=0.7 ignores the WKT argument for geotrace and geoshape + # ODK Central <=0.7 ignores the WKT argument for geotrace and geoshape. # nolint start # ruODK::odata_submission_get(wkt = TRUE, parse = TRUE) # ruODK::odata_submission_get(wkt = FALSE, parse = FALSE) %>% @@ -116,8 +115,13 @@ split_geoshape <- function( dplyr::rename_at( dplyr::vars(dplyr::starts_with("XXX")), list(~ stringr::str_replace(., "XXX", colname)) + ) %>% + # Drop last empty coordinate from colname, a list(NULL, NULL). + # Affects ODK Central Version 0.7-0.9. + dplyr::mutate_at( + dplyr::vars(colname), + list(~ purrr::map(., drop_null_coords)) ) - # TODO #88 drop last empty coord from colname } else { # WKT data %>% @@ -132,6 +136,8 @@ split_geoshape <- function( remove = FALSE, convert = TRUE ) %>% + # Drop last empty coordinate from colname, a trailing ",undefined NaN". + # Affects ODK Central Version 0.7-0.9. dplyr::mutate_at( dplyr::vars(colname), list(~ stringr::str_replace_all(., ",undefined NaN", "")) diff --git a/R/split_geotrace.R b/R/split_geotrace.R index c98cfb14..990dd987 100644 --- a/R/split_geotrace.R +++ b/R/split_geotrace.R @@ -130,8 +130,13 @@ split_geotrace <- function(data, dplyr::rename_at( dplyr::vars(dplyr::starts_with("XXX")), list(~ stringr::str_replace(., "XXX", colname)) + ) %>% + # Drop last empty coordinate from colname, a list(NULL, NULL). + # Affects ODK Central Version 0.7-0.9. + dplyr::mutate_at( + dplyr::vars(colname), + list(~ purrr::map(., drop_null_coords)) ) - # TODO #88 drop last empty coord from colname } else { # Option 4: ODKC v0.8 WKT data %>% diff --git a/codemeta.json b/codemeta.json index e212359e..324fe2d6 100644 --- a/codemeta.json +++ b/codemeta.json @@ -14,11 +14,10 @@ ], "issueTracker": "https://github.com/ropensci/ruODK/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.9.0", + "version": "0.9.1", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", - "version": "4.0.0", "url": "https://r-project.org" }, "runtimePlatform": "R version 4.0.0 (2020-04-24)", @@ -136,6 +135,19 @@ }, "sameAs": "https://CRAN.R-project.org/package=listviewer" }, + { + "@type": "SoftwareApplication", + "identifier": "mapview", + "name": "mapview", + "version": ">= 2.7.8", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=mapview" + }, { "@type": "SoftwareApplication", "identifier": "rmarkdown", @@ -162,6 +174,19 @@ }, "sameAs": "https://CRAN.R-project.org/package=roxygen2" }, + { + "@type": "SoftwareApplication", + "identifier": "sf", + "name": "sf", + "version": ">= 0.9-5", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://CRAN.R-project.org/package=sf" + }, { "@type": "SoftwareApplication", "identifier": "testthat", @@ -472,28 +497,17 @@ ], "name": "ruODK: Client for the ODK Central API", "url": "https://github.com/ropensci/ruODK", - "description": "R package version 0.9.0" + "description": "R package version 0.9.1" } ], "releaseNotes": "https://github.com/ropensci/ruODK/blob/master/NEWS.md", "readme": "https://github.com/ropensci/ruODK/blob/main/README.md", - "fileSize": "1010.359KB", - "contIntegration": [ - "https://travis-ci.org/ropensci/ruODK", - "https://ci.appveyor.com/project/florianm/ruodk/branch/master", - "https://codecov.io/github/ropensci/ruODK?branch=master", - "https://travis-ci.org/ropensci/ruODK", - "https://codecov.io/github/ropensci/ruODK?branch=master", - "https://ci.appveyor.com/project/florianm/ruodk/branch/master", - "https://codecov.io/gh/validmeasures/odkr", - "https://travis-ci.org/unhcr/koboloadeR", - "https://ci.appveyor.com/project/unhcr/koboloadeR", - "https://codecov.io/gh/unhcr/koboloadeR", - "https://travis-ci.org/ropensci/ruODK", - "https://ci.appveyor.com/project/florianm/ruodk/branch/master", - "https://codecov.io/github/ropensci/ruODK?branch=master", - "https://travis-ci.org/edwindj/cbsodataR", - "https://ci.appveyor.com/project/edwindj/cbsodatar" - ], - "developmentStatus": "https://www.repostatus.org/#active" + "fileSize": "3126.119KB", + "contIntegration": ["https://travis-ci.org/ropensci/ruODK", "https://ci.appveyor.com/project/florianm/ruodk/branch/main", "https://codecov.io/gh/ropensci/ruODK", "https://travis-ci.org/ropensci/ruODK", "https://codecov.io/gh/ropensci/ruODK", "https://ci.appveyor.com/project/florianm/ruodk/branch/main", "https://codecov.io/gh/validmeasures/odkr", "https://travis-ci.org/unhcr/koboloadeR", "https://ci.appveyor.com/project/unhcr/koboloadeR", "https://codecov.io/gh/unhcr/koboloadeR", "https://travis-ci.org/ropensci/ruODK", "https://ci.appveyor.com/project/florianm/ruodk/branch/main", "https://codecov.io/gh/ropensci/ruODK", "https://travis-ci.org/edwindj/cbsodataR", "https://ci.appveyor.com/project/edwindj/cbsodatar"], + "developmentStatus": "https://www.repostatus.org/#active", + "review": { + "@type": "Review", + "url": "https://github.com/ropensci/software-review/issues/335", + "provider": "https://ropensci.org" + } } diff --git a/data-raw/make_release.R b/data-raw/make_release.R index 0c03d1ee..63b1aaaf 100644 --- a/data-raw/make_release.R +++ b/data-raw/make_release.R @@ -19,8 +19,8 @@ source(here::here("data-raw/make_data.R")) devtools::test() # # Docs -lintr:::addin_lint_package() styler::style_pkg() +lintr:::addin_lint_package() devtools::document(roclets = c("rd", "collate", "namespace")) spelling::spell_check_package() spelling::spell_check_files("README.Rmd", lang = "en_AU") # TODO update wordlist diff --git a/data/geo_gj.rda b/data/geo_gj.rda index 106cad09..563a827d 100644 Binary files a/data/geo_gj.rda and b/data/geo_gj.rda differ diff --git a/data/geo_gj88.rda b/data/geo_gj88.rda new file mode 100644 index 00000000..23f28e22 Binary files /dev/null and b/data/geo_gj88.rda differ diff --git a/data/geo_wkt88.rda b/data/geo_wkt88.rda new file mode 100644 index 00000000..d4a6b110 Binary files /dev/null and b/data/geo_wkt88.rda differ diff --git a/inst/CITATION b/inst/CITATION index 2285d16c..c0246f51 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -4,12 +4,12 @@ citEntry( entry = "Misc", title = "ruODK: Client for the ODK Central API", author = "Florian W. Mayer", - note = "R package version 0.9.0", + note = "R package version 0.9.1", year = 2020, url = "https://github.com/ropensci/ruODK", textVersion = paste( "Mayer, Florian Wendelin. (2020, July 21). ", - "ruODK: An R Client for the ODK Central API (Version 0.9.0). ", + "ruODK: An R Client for the ODK Central API (Version 0.9.1). ", "Zenodo. http://doi.org/10.5281/zenodo.3953159" ) ) \ No newline at end of file diff --git a/inst/WORDLIST b/inst/WORDLIST index 1c82edd2..ed132a56 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -25,6 +25,7 @@ 8bb2 978f 999z +acc actee AmenazasRD Amit @@ -43,6 +44,7 @@ camelCase Carpark cbs changedate +cheatsheet chr ckanr CMD @@ -70,6 +72,7 @@ DCIM0001 dir DIY Dockerfile +doi DOI dttm Edmx @@ -94,6 +97,8 @@ FloraQuadrat04 floristic fn funder +geo +geofield geofields GeoJSON geopoint @@ -101,6 +106,7 @@ geopoints geoshape geoshapes geospatial +Geospatial geotrace geotraces Geotraces @@ -109,7 +115,9 @@ getodk getters GH github +gj googledrive +gps Hadley http https @@ -141,6 +149,7 @@ metapackage Metapackage mudmap Muntashir +NaN nl NodeJS noop @@ -191,16 +200,21 @@ Roadmap ropensci rOpenSci ROpenSci +Rowlingson rOzCBI +RSpatial Rstudio RStudio ru ruodk ruReady +Sadler Scalability Schemetrica screencast select1 +SimpleFeature +SimpleFeatures Simplifiy situ Stata @@ -235,6 +249,7 @@ v1 v7 vectorised VueJS +Weitkamp wfp whattheyforgot Wickam @@ -248,3 +263,4 @@ XForms XlsForm XlsForms xml2 +zenodo diff --git a/inst/extdoc/ruODK_0.9.0.pdf b/inst/extdoc/ruODK_0.9.0.pdf new file mode 100644 index 00000000..63c386dd Binary files /dev/null and b/inst/extdoc/ruODK_0.9.0.pdf differ diff --git a/man/attachment_get.Rd b/man/attachment_get.Rd index bc2dbfda..dfb38246 100644 --- a/man/attachment_get.Rd +++ b/man/attachment_get.Rd @@ -115,6 +115,7 @@ fresh_parsed <- fresh_raw \%>\% Other utilities: \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/attachment_url.Rd b/man/attachment_url.Rd index 943f1862..299486dc 100644 --- a/man/attachment_url.Rd +++ b/man/attachment_url.Rd @@ -56,6 +56,7 @@ ruODK:::attachment_url("uuid:d3bcefea-32a8-4dbc-80ca-4ecb0678e2b0", \seealso{ Other utilities: \code{\link{attachment_get}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/drop_null_coords.Rd b/man/drop_null_coords.Rd new file mode 100644 index 00000000..567bc504 --- /dev/null +++ b/man/drop_null_coords.Rd @@ -0,0 +1,90 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/drop_null_coords.R +\name{drop_null_coords} +\alias{drop_null_coords} +\title{Drop any NULL coordinates from a GeoJSON geometry.} +\usage{ +drop_null_coords(x) +} +\arguments{ +\item{x}{A GeoJSON geometry parsed as nested list. +E.g. `geo_gj$path_location_path_gps`.} +} +\value{ +The nested list minus the last element (if NULL). +} +\description{ +This helper patches a bug/feature in ODK Central (versions 0.7-0.9), where +geotrace / geoshape GeoJSON contains a last coordinate pair with NULL +lat/lon (no alt/acc), and WKT ends in `, undefined NaN`. +} +\details{ +While \code{\link{split_geotrace}} and \code{\link{split_geoshape}} modify +the WKT inline, it is more maintainable to separate the GeoJSON cleaner +into this function. + +This helper drops the last element of a GeoJSON coordinate list if it is +`list(NULL, NULL)`. +} +\examples{ +# A snapshot of geo data with trailing empty coordinates. +data("geo_gj88") + +len_coords <- length(geo_gj88$path_location_path_gps[[1]]$coordinates) + +length(geo_gj88$path_location_path_gps[[1]]$coordinates[[len_coords]]) \%>\% + testthat::expect_equal(2) + +geo_gj88$path_location_path_gps[[1]]$coordinates[[len_coords]][[1]] \%>\% + testthat::expect_null() + +geo_gj88$path_location_path_gps[[1]]$coordinates[[len_coords]][[2]] \%>\% + testthat::expect_null() + +# The last coordinate pair is a list(NULL, NULL). +# Invalid coordinates like these are a choking hazard for geospatial +# packages. We should remove them before we can convert ODK data into native +# spatial formats, such as sf. +str(geo_gj88$path_location_path_gps[[1]]$coordinates[[len_coords]]) + +geo_gj_repaired <- geo_gj88 \%>\% + dplyr::mutate( + path_location_path_gps = path_location_path_gps \%>\% + purrr::map(drop_null_coords) + ) + +len_coords_repaired <- length( + geo_gj_repaired$path_location_path_gps[[1]]$coordinates +) +testthat::expect_equal(len_coords_repaired + 1, len_coords) +} +\seealso{ +Other utilities: +\code{\link{attachment_get}()}, +\code{\link{attachment_url}()}, +\code{\link{form_schema_parse}()}, +\code{\link{get_one_attachment}()}, +\code{\link{get_one_submission_attachment_list}()}, +\code{\link{get_one_submission}()}, +\code{\link{handle_ru_attachments}()}, +\code{\link{handle_ru_datetimes}()}, +\code{\link{handle_ru_geopoints}()}, +\code{\link{handle_ru_geoshapes}()}, +\code{\link{handle_ru_geotraces}()}, +\code{\link{isodt_to_local}()}, +\code{\link{odata_submission_rectangle}()}, +\code{\link{predict_ruodk_name}()}, +\code{\link{prepend_uuid}()}, +\code{\link{ru_msg_abort}()}, +\code{\link{ru_msg_info}()}, +\code{\link{ru_msg_noop}()}, +\code{\link{ru_msg_success}()}, +\code{\link{ru_msg_warn}()}, +\code{\link{split_geopoint}()}, +\code{\link{split_geoshape}()}, +\code{\link{split_geotrace}()}, +\code{\link{strip_uuid}()}, +\code{\link{tidyeval}}, +\code{\link{unnest_all}()} +} +\concept{utilities} diff --git a/man/form_schema_parse.Rd b/man/form_schema_parse.Rd index 0c3a8ecc..02723628 100644 --- a/man/form_schema_parse.Rd +++ b/man/form_schema_parse.Rd @@ -59,6 +59,7 @@ fsp Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, \code{\link{get_one_submission}()}, diff --git a/man/fq_attachments.Rd b/man/fq_attachments.Rd index fd4b3f54..cd1d12c0 100644 --- a/man/fq_attachments.Rd +++ b/man/fq_attachments.Rd @@ -43,8 +43,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_data.Rd b/man/fq_data.Rd index 60787b1d..96fdcc33 100644 --- a/man/fq_data.Rd +++ b/man/fq_data.Rd @@ -58,8 +58,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_data_strata.Rd b/man/fq_data_strata.Rd index 76ae5e06..5735caed 100644 --- a/man/fq_data_strata.Rd +++ b/man/fq_data_strata.Rd @@ -56,8 +56,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_data_taxa.Rd b/man/fq_data_taxa.Rd index eee0789f..e0ddc78a 100644 --- a/man/fq_data_taxa.Rd +++ b/man/fq_data_taxa.Rd @@ -58,8 +58,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_form_detail.Rd b/man/fq_form_detail.Rd index 1dda543b..981aa3c0 100644 --- a/man/fq_form_detail.Rd +++ b/man/fq_form_detail.Rd @@ -43,8 +43,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_form_list.Rd b/man/fq_form_list.Rd index fd37fcbc..a356fe74 100644 --- a/man/fq_form_list.Rd +++ b/man/fq_form_list.Rd @@ -42,8 +42,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_form_schema.Rd b/man/fq_form_schema.Rd index 0984127b..3c05d003 100644 --- a/man/fq_form_schema.Rd +++ b/man/fq_form_schema.Rd @@ -65,8 +65,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} @@ -93,8 +95,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_form_xml.Rd b/man/fq_form_xml.Rd index b06ff005..10527b20 100644 --- a/man/fq_form_xml.Rd +++ b/man/fq_form_xml.Rd @@ -43,8 +43,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_meta.Rd b/man/fq_meta.Rd index 69bef243..7bdfc682 100644 --- a/man/fq_meta.Rd +++ b/man/fq_meta.Rd @@ -48,8 +48,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_project_detail.Rd b/man/fq_project_detail.Rd index 4cee3d50..ee6acce9 100644 --- a/man/fq_project_detail.Rd +++ b/man/fq_project_detail.Rd @@ -42,8 +42,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_project_list.Rd b/man/fq_project_list.Rd index f20a0be8..8b70fc53 100644 --- a/man/fq_project_list.Rd +++ b/man/fq_project_list.Rd @@ -42,8 +42,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_raw.Rd b/man/fq_raw.Rd index ab61311c..9ede8d75 100644 --- a/man/fq_raw.Rd +++ b/man/fq_raw.Rd @@ -55,8 +55,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_raw_strata.Rd b/man/fq_raw_strata.Rd index bb425c60..9962630b 100644 --- a/man/fq_raw_strata.Rd +++ b/man/fq_raw_strata.Rd @@ -53,8 +53,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_raw_taxa.Rd b/man/fq_raw_taxa.Rd index 1f5bbda3..535948e5 100644 --- a/man/fq_raw_taxa.Rd +++ b/man/fq_raw_taxa.Rd @@ -55,8 +55,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_submission_list.Rd b/man/fq_submission_list.Rd index d1bed1e3..d2ff76af 100644 --- a/man/fq_submission_list.Rd +++ b/man/fq_submission_list.Rd @@ -43,8 +43,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_submissions.Rd b/man/fq_submissions.Rd index f0df42e3..e29aaafc 100644 --- a/man/fq_submissions.Rd +++ b/man/fq_submissions.Rd @@ -44,8 +44,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_svc.Rd b/man/fq_svc.Rd index 94b679cc..8f038f06 100644 --- a/man/fq_svc.Rd +++ b/man/fq_svc.Rd @@ -49,8 +49,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_zip_data.Rd b/man/fq_zip_data.Rd index 6d5dd018..1ef36416 100644 --- a/man/fq_zip_data.Rd +++ b/man/fq_zip_data.Rd @@ -43,8 +43,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_zip_strata.Rd b/man/fq_zip_strata.Rd index ca077c5c..67d96033 100644 --- a/man/fq_zip_strata.Rd +++ b/man/fq_zip_strata.Rd @@ -43,8 +43,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fq_zip_taxa.Rd b/man/fq_zip_taxa.Rd index 5561f301..b1afc02c 100644 --- a/man/fq_zip_taxa.Rd +++ b/man/fq_zip_taxa.Rd @@ -43,8 +43,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fs_v7.Rd b/man/fs_v7.Rd index 9fec4ff4..acf074bc 100644 --- a/man/fs_v7.Rd +++ b/man/fs_v7.Rd @@ -41,8 +41,10 @@ Other included: \code{\link{fq_zip_taxa}}, \code{\link{fs_v7_raw}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/fs_v7_raw.Rd b/man/fs_v7_raw.Rd index 4d489682..4a3092cc 100644 --- a/man/fs_v7_raw.Rd +++ b/man/fs_v7_raw.Rd @@ -41,8 +41,10 @@ Other included: \code{\link{fq_zip_taxa}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/geo_fs.Rd b/man/geo_fs.Rd index 92c07d81..64112c46 100644 --- a/man/geo_fs.Rd +++ b/man/geo_fs.Rd @@ -43,8 +43,10 @@ Other included: \code{\link{fq_zip_taxa}}, \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/geo_gj.Rd b/man/geo_gj.Rd index 7c15e661..e81e2dcb 100644 --- a/man/geo_gj.Rd +++ b/man/geo_gj.Rd @@ -44,7 +44,9 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/geo_gj88.Rd b/man/geo_gj88.Rd new file mode 100644 index 00000000..f50759ae --- /dev/null +++ b/man/geo_gj88.Rd @@ -0,0 +1,61 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\encoding{UTF-8} +\name{geo_gj88} +\alias{geo_gj88} +\title{The parsed submissions of a form containing geofields in GeoJSON +with trailing empty coordinates present.} +\format{ +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 1 rows and 51 columns. +} +\source{ +\code{\link{odata_submission_get}(wkt=FALSE, parse=TRUE)} +run on the test form +`system.file("extdata", "Locations.xml", package = "ruODK")`. +} +\usage{ +geo_gj88 +} +\description{ +\lifecycle{stable} +} +\details{ +This issue was fixed in #88. +ODK Central versions 0.7 - 0.9 export geotraces and geoshapes with trailing +empty coordinates. ruODK has a patch to drop trailing empty coordinates. +This dataset is used to test the patch in ruODK. +} +\seealso{ +Other included: +\code{\link{fq_attachments}}, +\code{\link{fq_data_strata}}, +\code{\link{fq_data_taxa}}, +\code{\link{fq_data}}, +\code{\link{fq_form_detail}}, +\code{\link{fq_form_list}}, +\code{\link{fq_form_schema}}, +\code{\link{fq_form_xml}}, +\code{\link{fq_meta}}, +\code{\link{fq_project_detail}}, +\code{\link{fq_project_list}}, +\code{\link{fq_raw_strata}}, +\code{\link{fq_raw_taxa}}, +\code{\link{fq_raw}}, +\code{\link{fq_submission_list}}, +\code{\link{fq_submissions}}, +\code{\link{fq_svc}}, +\code{\link{fq_zip_data}}, +\code{\link{fq_zip_strata}}, +\code{\link{fq_zip_taxa}}, +\code{\link{fs_v7_raw}}, +\code{\link{fs_v7}}, +\code{\link{geo_fs}}, +\code{\link{geo_gj_raw}}, +\code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, +\code{\link{geo_wkt_raw}}, +\code{\link{geo_wkt}} +} +\concept{included} +\keyword{datasets} diff --git a/man/geo_gj_raw.Rd b/man/geo_gj_raw.Rd index 5345ea0e..7c4fb246 100644 --- a/man/geo_gj_raw.Rd +++ b/man/geo_gj_raw.Rd @@ -44,7 +44,9 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}}, \code{\link{geo_wkt}} } diff --git a/man/geo_wkt.Rd b/man/geo_wkt.Rd index 8d593bbd..752d5cd1 100644 --- a/man/geo_wkt.Rd +++ b/man/geo_wkt.Rd @@ -44,8 +44,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt_raw}} } \concept{included} diff --git a/man/geo_wkt88.Rd b/man/geo_wkt88.Rd new file mode 100644 index 00000000..97d2bda6 --- /dev/null +++ b/man/geo_wkt88.Rd @@ -0,0 +1,61 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\encoding{UTF-8} +\name{geo_wkt88} +\alias{geo_wkt88} +\title{The parsed submissions of a form containing geofields in WKT +with trailing empty coordinates present.} +\format{ +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 1 rows and 48 columns. +} +\source{ +\code{\link{odata_submission_get}(wkt=TRUE, parse=TRUE)} +run on the test form +`system.file("extdata", "Locations.xml", package = "ruODK")`. +} +\usage{ +geo_wkt88 +} +\description{ +\lifecycle{stable} +} +\details{ +This issue was fixed in #88. +ODK Central versions 0.7 - 0.9 export geotraces and geoshapes with trailing +empty coordinates. ruODK has a patch to drop trailing empty coordinates. +This dataset is used to test the patch in ruODK. +} +\seealso{ +Other included: +\code{\link{fq_attachments}}, +\code{\link{fq_data_strata}}, +\code{\link{fq_data_taxa}}, +\code{\link{fq_data}}, +\code{\link{fq_form_detail}}, +\code{\link{fq_form_list}}, +\code{\link{fq_form_schema}}, +\code{\link{fq_form_xml}}, +\code{\link{fq_meta}}, +\code{\link{fq_project_detail}}, +\code{\link{fq_project_list}}, +\code{\link{fq_raw_strata}}, +\code{\link{fq_raw_taxa}}, +\code{\link{fq_raw}}, +\code{\link{fq_submission_list}}, +\code{\link{fq_submissions}}, +\code{\link{fq_svc}}, +\code{\link{fq_zip_data}}, +\code{\link{fq_zip_strata}}, +\code{\link{fq_zip_taxa}}, +\code{\link{fs_v7_raw}}, +\code{\link{fs_v7}}, +\code{\link{geo_fs}}, +\code{\link{geo_gj88}}, +\code{\link{geo_gj_raw}}, +\code{\link{geo_gj}}, +\code{\link{geo_wkt_raw}}, +\code{\link{geo_wkt}} +} +\concept{included} +\keyword{datasets} diff --git a/man/geo_wkt_raw.Rd b/man/geo_wkt_raw.Rd index 8edb6393..2deee2f0 100644 --- a/man/geo_wkt_raw.Rd +++ b/man/geo_wkt_raw.Rd @@ -44,8 +44,10 @@ Other included: \code{\link{fs_v7_raw}}, \code{\link{fs_v7}}, \code{\link{geo_fs}}, +\code{\link{geo_gj88}}, \code{\link{geo_gj_raw}}, \code{\link{geo_gj}}, +\code{\link{geo_wkt88}}, \code{\link{geo_wkt}} } \concept{included} diff --git a/man/get_one_attachment.Rd b/man/get_one_attachment.Rd index 999241ed..df556869 100644 --- a/man/get_one_attachment.Rd +++ b/man/get_one_attachment.Rd @@ -74,6 +74,7 @@ local_fn <- get_one_attachment("media/filename.jpg", "filename.jpg", att_url) Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_submission_attachment_list}()}, \code{\link{get_one_submission}()}, diff --git a/man/get_one_submission.Rd b/man/get_one_submission.Rd index b01cadf5..22dc8358 100644 --- a/man/get_one_submission.Rd +++ b/man/get_one_submission.Rd @@ -94,6 +94,7 @@ names(sub) Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/get_one_submission_attachment_list.Rd b/man/get_one_submission_attachment_list.Rd index ee072b09..87fac34e 100644 --- a/man/get_one_submission_attachment_list.Rd +++ b/man/get_one_submission_attachment_list.Rd @@ -103,6 +103,7 @@ names(al) Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission}()}, diff --git a/man/handle_ru_attachments.Rd b/man/handle_ru_attachments.Rd index f0ba3304..2cf759fb 100644 --- a/man/handle_ru_attachments.Rd +++ b/man/handle_ru_attachments.Rd @@ -97,6 +97,7 @@ testthat::expect_true(fs::dir_ls(t) \%>\% length() > 0) Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/handle_ru_datetimes.Rd b/man/handle_ru_datetimes.Rd index bacd8627..179148ba 100644 --- a/man/handle_ru_datetimes.Rd +++ b/man/handle_ru_datetimes.Rd @@ -64,6 +64,7 @@ dplyr::glimpse(fq_with_dates) Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/handle_ru_geopoints.Rd b/man/handle_ru_geopoints.Rd index 3cf2b6d4..0abeeb03 100644 --- a/man/handle_ru_geopoints.Rd +++ b/man/handle_ru_geopoints.Rd @@ -64,6 +64,7 @@ dplyr::glimpse(geo_wkt_parsed) Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/handle_ru_geoshapes.Rd b/man/handle_ru_geoshapes.Rd index dbbbad36..25c6331d 100644 --- a/man/handle_ru_geoshapes.Rd +++ b/man/handle_ru_geoshapes.Rd @@ -79,6 +79,7 @@ dplyr::glimpse(geo_wkt_parsed) Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/handle_ru_geotraces.Rd b/man/handle_ru_geotraces.Rd index 57736608..3028c703 100644 --- a/man/handle_ru_geotraces.Rd +++ b/man/handle_ru_geotraces.Rd @@ -79,6 +79,7 @@ dplyr::glimpse(geo_wkt_parsed) Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/isodt_to_local.Rd b/man/isodt_to_local.Rd index 038e204b..7634505d 100644 --- a/man/isodt_to_local.Rd +++ b/man/isodt_to_local.Rd @@ -36,6 +36,7 @@ to timezone-aware local times. Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/odata_submission_rectangle.Rd b/man/odata_submission_rectangle.Rd index 2a04f4b1..49524a14 100644 --- a/man/odata_submission_rectangle.Rd +++ b/man/odata_submission_rectangle.Rd @@ -60,6 +60,7 @@ testthat::expect_equal(length(fq_raw$value), nrow(data_parsed)) Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/predict_ruodk_name.Rd b/man/predict_ruodk_name.Rd index 5f0f4f7d..79fe6103 100644 --- a/man/predict_ruodk_name.Rd +++ b/man/predict_ruodk_name.Rd @@ -34,6 +34,7 @@ predict_ruodk_name("rock", "Submissions.foo_fighters") Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/prepend_uuid.Rd b/man/prepend_uuid.Rd index 857488a8..d5c7f2de 100644 --- a/man/prepend_uuid.Rd +++ b/man/prepend_uuid.Rd @@ -28,6 +28,7 @@ prepend_uuid("d3bcefea-32a8-4dbc-80ca-4ecb0678e2b0") Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/ru_msg_abort.Rd b/man/ru_msg_abort.Rd index 108e6c3d..22f50b2d 100644 --- a/man/ru_msg_abort.Rd +++ b/man/ru_msg_abort.Rd @@ -21,6 +21,7 @@ ru_msg_abort("This is an error, abort.") Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/ru_msg_info.Rd b/man/ru_msg_info.Rd index 3dc684ef..1306eb62 100644 --- a/man/ru_msg_info.Rd +++ b/man/ru_msg_info.Rd @@ -19,6 +19,7 @@ ru_msg_info("This is an info message.") Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/ru_msg_noop.Rd b/man/ru_msg_noop.Rd index e2d210b2..eb306173 100644 --- a/man/ru_msg_noop.Rd +++ b/man/ru_msg_noop.Rd @@ -19,6 +19,7 @@ ru_msg_noop("This is a noop message.") Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/ru_msg_success.Rd b/man/ru_msg_success.Rd index fa5d7bf4..85de7124 100644 --- a/man/ru_msg_success.Rd +++ b/man/ru_msg_success.Rd @@ -19,6 +19,7 @@ ru_msg_success("This is a success message.") Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/ru_msg_warn.Rd b/man/ru_msg_warn.Rd index 211998f8..57217c8f 100644 --- a/man/ru_msg_warn.Rd +++ b/man/ru_msg_warn.Rd @@ -21,6 +21,7 @@ ru_msg_warn("This is a warning.") Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/split_geopoint.Rd b/man/split_geopoint.Rd index 3cd233a6..9f4d7b63 100644 --- a/man/split_geopoint.Rd +++ b/man/split_geopoint.Rd @@ -74,6 +74,7 @@ wkt_first_gt$point_location_point_gps_longitude Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/split_geoshape.Rd b/man/split_geoshape.Rd index 34ab2021..c837c095 100644 --- a/man/split_geoshape.Rd +++ b/man/split_geoshape.Rd @@ -92,6 +92,7 @@ testthat::expect_true( Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/split_geotrace.Rd b/man/split_geotrace.Rd index fc478eda..f948ad2d 100644 --- a/man/split_geotrace.Rd +++ b/man/split_geotrace.Rd @@ -113,6 +113,7 @@ testthat::expect_true( Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/strip_uuid.Rd b/man/strip_uuid.Rd index ecc0d21a..b21ba7ba 100644 --- a/man/strip_uuid.Rd +++ b/man/strip_uuid.Rd @@ -28,6 +28,7 @@ strip_uuid("uuid:d3bcefea-32a8-4dbc-80ca-4ecb0678e2b0") Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/tidyeval.Rd b/man/tidyeval.Rd index 2737b6b5..30eb90c0 100644 --- a/man/tidyeval.Rd +++ b/man/tidyeval.Rd @@ -24,6 +24,7 @@ To learn more about tidy eval and how to use these tools, read Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/man/unnest_all.Rd b/man/unnest_all.Rd index 06900cd8..85270a86 100644 --- a/man/unnest_all.Rd +++ b/man/unnest_all.Rd @@ -53,6 +53,7 @@ and hidden from the user. Other utilities: \code{\link{attachment_get}()}, \code{\link{attachment_url}()}, +\code{\link{drop_null_coords}()}, \code{\link{form_schema_parse}()}, \code{\link{get_one_attachment}()}, \code{\link{get_one_submission_attachment_list}()}, diff --git a/tests/testthat/test-drop_null_coords.R b/tests/testthat/test-drop_null_coords.R new file mode 100644 index 00000000..bbfec165 --- /dev/null +++ b/tests/testthat/test-drop_null_coords.R @@ -0,0 +1,55 @@ +test_that("drop_null_coords works on data with empty last coords ", { + # This test will break once the ODK Central Sandbox has fixed + # issue https://github.com/getodk/central-backend/issues/282 + # through https://github.com/getodk/central-backend/pull/283 + # and ruODK's package data have been updated. + # We therefore have included a snapshot of test data exhibiting the problem. + # The data uses "bad" coordinates from the ODK Sandbox and an unpatched ruODK. + # The data "geo_gj" uses "bad" coordinates (soon: good coordinates) from the + # ODK Sandbox and a patched ruODK. + data("geo_gj88") + + len_coords <- length(geo_gj88$path_location_path_gps[[1]]$coordinates) + + length(geo_gj88$path_location_path_gps[[1]]$coordinates[[len_coords]]) %>% + testthat::expect_equal(2) + + geo_gj88$path_location_path_gps[[1]]$coordinates[[len_coords]][[1]] %>% + testthat::expect_null() + + geo_gj88$path_location_path_gps[[1]]$coordinates[[len_coords]][[2]] %>% + testthat::expect_null() + + geo_gj_repaired <- geo_gj88 %>% + dplyr::mutate( + path_location_path_gps = path_location_path_gps %>% + purrr::map(drop_null_coords) + ) + + len_coords_repaired <- length( + geo_gj_repaired$path_location_path_gps[[1]]$coordinates + ) + testthat::expect_equal(len_coords_repaired + 1, len_coords) +}) + +test_that("drop_null_coords works on data without empty last coords ", { + data("geo_gj") + + len_coords <- length(geo_gj$path_location_path_gps[[1]]$coordinates) + + geo_gj_repaired <- geo_gj %>% + dplyr::mutate( + path_location_path_gps = path_location_path_gps %>% + purrr::map(drop_null_coords) + ) + + len_coords_repaired <- length( + geo_gj_repaired$path_location_path_gps[[1]]$coordinates + ) + + # No coordinates were harmed in the making of this test + testthat::expect_equal(len_coords_repaired, len_coords) +}) + + +# usethis::use_r("drop_null_coords") # nolint diff --git a/tests/testthat/test-handle_ru_geoshapes.R b/tests/testthat/test-handle_ru_geoshapes.R index 61a2df96..c71c2b6a 100644 --- a/tests/testthat/test-handle_ru_geoshapes.R +++ b/tests/testthat/test-handle_ru_geoshapes.R @@ -141,30 +141,32 @@ test_that("handle_ru_geoshapes removes last empty coordinate from WKT", { stringr::str_detect(geo_wkt[[geo_fields[i]]], bad_coord), label = glue::glue("WKT field {geo_fields[i]} contains \"{bad_coord}\"") ) - } }) -# TODO #88 -# test_that("handle_ru_geoshapes removes last empty coordinate from GJ", { -# data("geo_fs") # parse T -# data("geo_gj") # parse T, wkt T -# -# -# geo_fields <- geo_fs %>% -# # dplyr::filter(type %in% c("geopoint", "geotrace", "geoshape")) %>% -# dplyr::filter(type == "geoshape") %>% -# magrittr::extract2("ruodk_name") -# -# for (i in seq_len(length(geo_fields))) { -# -# # WKT geofields must not contain bad_coord -# testthat::expect_false( -# geo_gj[[geo_fields[i]]], # last coord is empty, -# label = glue::glue("GJ field {geo_fields[i]} contains empty coord") -# ) -# -# } -# }) +test_that("handle_ru_geoshapes removes last empty coordinate from GJ", { + data("geo_fs") # parse T + data("geo_gj") # parse T, wkt T + + + geo_fields <- geo_fs %>% + # dplyr::filter(type %in% c("geopoint", "geotrace", "geoshape")) %>% + dplyr::filter(type == "geoshape") %>% + magrittr::extract2("ruodk_name") + + for (i in seq_len(length(geo_fields))) { + len_coords <- length(geo_gj[[geo_fields[i]]][[1]]$coordinates) + + # Cmpty coord is list(NULL, NULL) which compacts to list() of length 0 + last_coord_compact <- purrr::compact( + geo_gj[[geo_fields[i]]][[1]]$coordinates[[len_coords]] + ) + # WKT geofields must not contain bad_coord + testthat::expect_false( + length(last_coord_compact) == 0, + label = glue::glue("GJ field {geo_fields[i]} last coord is not empty") + ) + } +}) # usethis::use_r("handle_ru_geoshapes") # nolint diff --git a/tests/testthat/test-handle_ru_geotraces.R b/tests/testthat/test-handle_ru_geotraces.R index ce313a4c..ec3eb604 100644 --- a/tests/testthat/test-handle_ru_geotraces.R +++ b/tests/testthat/test-handle_ru_geotraces.R @@ -122,4 +122,29 @@ test_that("handle_ru_geotraces annotates WKT lines with lon lat alt (no acc)", { } }) +test_that("handle_ru_geotraces removes last empty coordinate from GJ", { + data("geo_fs") # parse T + data("geo_gj") # parse T, wkt T + + + geo_fields <- geo_fs %>% + # dplyr::filter(type %in% c("geopoint", "geotrace", "geoshape")) %>% + dplyr::filter(type == "geotrace") %>% + magrittr::extract2("ruodk_name") + + for (i in seq_len(length(geo_fields))) { + len_coords <- length(geo_gj[[geo_fields[i]]][[1]]$coordinates) + + # Cmpty coord is list(NULL, NULL) which compacts to list() of length 0 + last_coord_compact <- purrr::compact( + geo_gj[[geo_fields[i]]][[1]]$coordinates[[len_coords]] + ) + # WKT geofields must not contain bad_coord + testthat::expect_false( + length(last_coord_compact) == 0, + label = glue::glue("GJ field {geo_fields[i]} last coord is not empty") + ) + } +}) + # usethis::use_r("handle_ru_geotraces") # nolint diff --git a/tests/testthat/test-odata_submission_parse.R b/tests/testthat/test-odata_submission_parse.R index f6b4c817..881a1682 100644 --- a/tests/testthat/test-odata_submission_parse.R +++ b/tests/testthat/test-odata_submission_parse.R @@ -33,7 +33,6 @@ test_that("odata_submission_rectangle works with gaps in first submission", { class(fresh_raw_parsed$observation_start_time[1]), c("POSIXct", "POSIXt") ) - }) # nolint start diff --git a/tests/testthat/test-split_geotrace.R b/tests/testthat/test-split_geotrace.R index c330362b..5724a8c5 100644 --- a/tests/testthat/test-split_geotrace.R +++ b/tests/testthat/test-split_geotrace.R @@ -163,30 +163,8 @@ test_that("handle_ru_geotraces removes last empty coordinate from WKT", { stringr::str_detect(geo_wkt[[geo_fields[i]]], bad_coord), label = glue::glue("WKT field {geo_fields[i]} contains \"{bad_coord}\"") ) - } }) -# TODO #88 -# test_that("handle_ru_geoshapes removes last empty coordinate from GJ", { -# data("geo_fs") # parse T -# data("geo_gj") # parse T, wkt T -# -# -# geo_fields <- geo_fs %>% -# # dplyr::filter(type %in% c("geopoint", "geotrace", "geoshape")) %>% -# dplyr::filter(type == "geoshape") %>% -# magrittr::extract2("ruodk_name") -# -# for (i in seq_len(length(geo_fields))) { -# -# # WKT geofields must not contain bad_coord -# testthat::expect_false( -# geo_gj[[geo_fields[i]]], # last coord is empty, -# label = glue::glue("GJ field {geo_fields[i]} contains empty coord") -# ) -# -# } -# }) # usethis::use_r("split_geotrace") # nolint