Context

  • WACensus, an Oracle database, is the point of truth for WA taxonomic names at DBCA.
  • KMI publishes a few WACensus views as GeoServer layers.
  • TSC maintains a copy of those WACensus views and rebuilds its internal taxonomy from this copy of WACensus data.

This workbook shows how to update TSC from KMI’s WACensus views.

gjprod is defined here as a shortcut to tscr::upsert_geojson for convenience.

library(tscr)
gjprod <- function(data, ser) upsert_geojson(
  data, serializer = ser, api_url = get_tsc_api_url(), chunksize = 1000)

Import a copy of WACensus into TSC

Run against local, UAT or production TSC instance. Adjust chunksize down when getting “504 gateway timeouts”.

"public:herbie_hbvsupra_public" %>% gs_getWFS() %>% gjprod("supra")
"public:herbie_hbvgroups_public" %>% gs_getWFS() %>% gjprod("groups")
"public:herbie_hbvnames_public" %>% gs_getWFS() %>% gjprod("names")
"public:herbie_hbvfamilies_public" %>% gs_getWFS() %>% gjprod("families")
"public:herbie_hbvgenera_public" %>% gs_getWFS() %>% gjprod("genera")
"public:herbie_hbvspecies_public" %>% gs_getWFS() %>% gjprod("species")
"public:herbie_hbvxrefs_public" %>% gs_getWFS() %>% gjprod("xrefs")
"public:herbie_hbtparents_public" %>% gs_getWFS() %>% gjprod("parents")
"public:herbie_hbvvernaculars_public" %>% gs_getWFS() %>% gjprod("vernaculars")

Rebuild TSC taxonomy

TSC > Curators > Update Taxon Names. After a few minutes, TSC Taxa will be updated.

Further examples

Update one Taxon

This section demonstrates how to update a single taxon in TSC.

hbv_groups <- gs_getWFS(layer_name = "public:herbie_hbvgroups_public")
groups_props <- purrr::map(hbv_groups[["features"]], "properties")
groups_props[[1]]
#> $ogc_fid
#> [1] 1
#> 
#> $class_id
#> [1] "MONOCOT"
#> 
#> $name_id
#> [1] 829
#> 
#> $updated_by
#> [1] "HERBIE"
#> 
#> $updated_on
#> [1] "2011-04-11Z"
#> 
#> $rank_name
#> [1] "Species"
#> 
#> $name
#> [1] "Eleocharis philippinensis"
#> 
#> $md5_rowhash
#> [1] "14265e1da8827c4262f1bac48b770e3d"

This is the format of the data expected by tsc_POST.

tsc_POST(groups_props[[1]], serializer = "group")

List taxonomic names

Similarly, we could extract the list of taxonomic names from the KMS GeoServer layer public:herbie_hbvnames_public, which represents the WACensus view hbvnames.

We retain the fields used in TSC and limit the results to 100 names to keep the file size of this vignette small.

wace_names <- "public:herbie_hbvnames_public" %>% 
  gs_getWFS() %>% 
  magrittr::extract2("features") %>% 
  {tibble::tibble(
    name_id = purrr::map(., c("properties", "name_id")) %>% as.integer(),
    name = purrr::map(., c("properties", "name")) %>% as.character(),
    author = purrr::map(., c("properties", "author")) %>% as.character(),
    reference = purrr::map(., c("properties", "reference")) %>% as.character(),
    rank_name = purrr::map(., c("properties", "rank_name")) %>% as.character()
  )} %>% 
  head(100)

wace_names %>% 
  reactable::reactable(filterable = TRUE, sortable = TRUE, searchable = TRUE)