poissonconsulting / fish-passage-22

0 stars 1 forks source link

`bcdata` column names and Column Comments #2

Open NewGraphEnvironment opened 1 year ago

NewGraphEnvironment commented 1 year ago

Not sure about pulling comments out of pg_featureserv yet but bcdata can quite nicely pull down Column Comments and other parameter details (ex. Freshwater Atlas Glaciers) that perhaps could be used for cross-referencing DAG parameters.

There is an example of some R commands to parse bcdata catalougue table data to a data.frame here https://github.com/NewGraphEnvironment/dff-2022/issues/81 however since updating R and all packages reticulate::use_condaenv does not want to find the bcdata installation. Using the command-line still works:

cmd within the bcfishpass conda env which includes bcdata :

conda activate bcfishpass
bcdata info WHSE_BASEMAPPING.FWA_GLACIERS_POLY > data/test.json

R:

schema <- jsonlite::fromJSON('data/test.json', flatten = T) %>% 
  purrr::pluck('schema') %>% 
  dplyr::mutate(column_name = stringr::str_to_lower(column_name))

produces schema data.frame:

image