bcgov / bcdata

An R package for searching & retrieving data from the B.C. Data Catalogue
https://bcgov.github.io/bcdata
Apache License 2.0
81 stars 12 forks source link

Add full XML get capabilities into pkg env to access object description #259

Closed boshek closed 3 years ago

boshek commented 3 years ago

This could be useful for many things. What we now have access to is a list of all warehouse layers available at package load. @ateucher wrote the xml parsing code.

This will close #144 and #241

boshek commented 3 years ago

So now this works:

library(bcdata)
#> 
#> Attaching package: 'bcdata'
#> The following object is masked from 'package:stats':
#> 
#>     filter

bcdc_describe_feature("regional-districts-legally-defined-administrative-areas-of-bc")
#> Warning: It is advised to use the permanent id ('d1aff64e-dbfe-45a6-af97-582b7f6418b9') rather than the name of the record ('regional-districts-legally-defined-administrative-areas-of-bc') to guard against future name changes.
#> # A tibble: 21 x 5
#>    col_name     sticky remote_col_type local_col_type column_comments           
#>    <chr>        <lgl>  <chr>           <chr>          <chr>                     
#>  1 id           FALSE  xsd:string      character       <NA>                     
#>  2 LGL_ADMIN_A~ FALSE  xsd:decimal     numeric        "An operationally-generat~
#>  3 ADMIN_AREA_~ TRUE   xsd:string      character      "The authoritative, offic~
#>  4 ADMIN_AREA_~ TRUE   xsd:string      character      "A short form or commonly~
#>  5 ADMIN_AREA_~ TRUE   xsd:string      character      "BOUNDARY TYPE is a high-~
#>  6 ADMIN_AREA_~ TRUE   xsd:string      character      "The name given to the la~
#>  7 CHANGE_REQU~ TRUE   xsd:string      character      "The government acronym o~
#>  8 UPDATE_TYPE  TRUE   xsd:string      character      "A short description of t~
#>  9 WHEN_UPDATED TRUE   xsd:date        date           "The date and time the re~
#> 10 MAP_STATUS   TRUE   xsd:string      character      "That the digital map has~
#> # ... with 11 more rows
bcdc_describe_feature("76b1b7a3-2112-4444-857a-afccf7b20da8")
#> # A tibble: 42 x 5
#>    col_name     sticky remote_col_type local_col_type column_comments           
#>    <chr>        <lgl>  <chr>           <chr>          <chr>                     
#>  1 id           FALSE  xsd:string      character      <NA>                      
#>  2 CUSTODIAN_O~ FALSE  xsd:string      character      CUSTODIAN_ORG_DESCRIPTION~
#>  3 BUSINESS_CA~ FALSE  xsd:string      character      BUSINESS_CATEGORY_CLASS d~
#>  4 BUSINESS_CA~ FALSE  xsd:string      character      BUSINESS_CATEGORY_DESCRIP~
#>  5 OCCUPANT_TY~ FALSE  xsd:string      character      OCCUPANT_TYPE_DESCRIPTION~
#>  6 SOURCE_DATA~ FALSE  xsd:string      character      SOURCE_DATA_ID is a uniqu~
#>  7 SUPPLIED_SO~ FALSE  xsd:string      character      SUPPLIED_SOURCE_ID_IND is~
#>  8 AIRPORT_NAME FALSE  xsd:string      character      AIRPORT_NAME is a busines~
#>  9 DESCRIPTION  TRUE   xsd:string      character      DESCRIPTION describes the~
#> 10 PHYSICAL_AD~ TRUE   xsd:string      character      PHYSICAL_ADDRESS contains~
#> # ... with 32 more rows
bcdc_describe_feature("WHSE_IMAGERY_AND_BASE_MAPS.GSR_AIRPORTS_SVW")
#> # A tibble: 42 x 5
#>    col_name     sticky remote_col_type local_col_type column_comments           
#>    <chr>        <lgl>  <chr>           <chr>          <chr>                     
#>  1 id           FALSE  xsd:string      character      <NA>                      
#>  2 CUSTODIAN_O~ FALSE  xsd:string      character      CUSTODIAN_ORG_DESCRIPTION~
#>  3 BUSINESS_CA~ FALSE  xsd:string      character      BUSINESS_CATEGORY_CLASS d~
#>  4 BUSINESS_CA~ FALSE  xsd:string      character      BUSINESS_CATEGORY_DESCRIP~
#>  5 OCCUPANT_TY~ FALSE  xsd:string      character      OCCUPANT_TYPE_DESCRIPTION~
#>  6 SOURCE_DATA~ FALSE  xsd:string      character      SOURCE_DATA_ID is a uniqu~
#>  7 SUPPLIED_SO~ FALSE  xsd:string      character      SUPPLIED_SOURCE_ID_IND is~
#>  8 AIRPORT_NAME FALSE  xsd:string      character      AIRPORT_NAME is a busines~
#>  9 DESCRIPTION  TRUE   xsd:string      character      DESCRIPTION describes the~
#> 10 PHYSICAL_AD~ TRUE   xsd:string      character      PHYSICAL_ADDRESS contains~
#> # ... with 32 more rows

Created on 2021-03-31 by the reprex package (v1.0.0)

boshek commented 3 years ago

/document