nwfsc-cb / rcax Goto Github PK
View Code? Open in Web Editor NEWrCAX R package: an R client to access the REST API for the StreamNet Coordinated Assessments tables
Home Page: https://nwfsc-cb.github.io/rCAX/
License: Other
rCAX R package: an R client to access the REST API for the StreamNet Coordinated Assessments tables
Home Page: https://nwfsc-cb.github.io/rCAX/
License: Other
Idea. We mostly have this in the cax vignette but perhaps adding a metadata section along the lines of
https://www.ncei.noaa.gov/resources/metadata#Intro
would be good
The tidycensus vignettes are also good https://walker-data.com/tidycensus/articles/other-datasets.html
install.packages("remotes") is needed for the next line
remotes::install_github("nwfsc-math-bio/rCAX@*release")
install.packages("usethis") is needed to get to the next line
edit_r_environ()
I started a template for you here.
https://github.com/nwfsc-math-bio/rCAX/blob/main/inst/cax.md
Nothing extensive just some basic notes about what these data are and things to be aware of.
You can edit within GiHub if that is easiest. Click the little edit icon and then you can Preview (preview tab) while you work. To save, click the 'commit' button at the bottom. Or move to Google Docs and I'll port the text back over the GitHub.
This will become a vignette here:
https://nwfsc-math-bio.github.io/rCAX/articles/index.html
Hi Mari,
The Populations table is also throwing the 'publish' column error. Can you let CAX folks know? table_id F37C744F-E1FC-46D7-A8DB-0AB6337A4024
Eli
sysdata.rda
from GitHub API for releases
packageVersion("rCAX")
library(rCAX)
Can we 'insert' this somewhere in the beginning and have an 'accept' box to click before proceeding? I really don't know what I'm asking for in terms of code, just looking to set up a small stumbling block where folks see this before they download data - as they would via the front end.
@mari-williams Ok a version of the package that we can share (to get feedback) is done. It no longer needs an API key as that is included in the package. But the text needs other eyes on it before we share. Nothing too in-depth, just make sure no typos and stuff is understandable.
Add issues for anything you see.
These are the things I think need a skim/review
I have a proposal for how to include an API key in the package so users don't have to go ask StreamNet for one.
The key would be stored in binary in the package in internal data. So although the package code is open source, the key is not in plain ASCII anywhere. Hopefully this would be an ok plan. This would make the rCAX R package just another way to do a CAX Tabular Query.
Can you run this by the CAX folks? I'd like to do this before we share since otherwise StreamNet will be getting hit with API Key requests from people.
Thx!
Eli
Should just have these extra colnames "species", "publish", "num",
#' "hli", "agency", "esudps", "hli_id"
https://f1000research.com/about
https://peerj.com/preprints/3304v1/
math-bio
this is good, I just want to think about some rewording. CAX has more than listed pops, not all listed pops, and I should give a bit of explanation to the superpops - this is data like the GSI data for steelhead past Lower Granite - the genetics doesn't split perfectly into the populations the TRTs developed so there is lumping happening.
to print
Honestly my gut says let's toss this version and only set up pulls from the XPORT table because it has the metadata we want (NMFS_popid) and I like metadata (a primary benefit of CAX).
to make more robust
That way it stays up to date:
rcax_table_name
should be in ca/tablesI want to edit some verbage on this like I did on the readme, but it wants me to branch to edit and I'm thinking I should come back to this.
here is how to set up the url
tab = httr::GET('https://api.streamnet.org/api/v1/ca.json?table_id=4EF09E86-2AA8-4C98-A983-A272C2C2C7E3&XApiKey=C4F5F084-EBE3-4ED6-8AF1-125EC54E6E52&filter=[{"field":"esu_dps","value":"Salmon,%20coho%20(Oregon%20Coast%20ESU)","type":"string"}]')
data = jsonlite::fromJSON(rawToChar((tab$content)))
https://nwfsc-math-bio.github.io/rCAX/articles/CAX_Tables.html
These are the ones from StreamNet https://www.streamnet.org/data/hli/?index=1&perpage=10
rcax_updata_sysdata
Or when the user does the first rcax_hli call or rcax_table_query, rcax_tables is called and _rcax_tables data is created. Then for subsequent calls it checks if that exists. If so it uses it, if not it doesn't. Might need to delete it on detaching or check creation date.
Thanks, Mike and Greg!
On Wed, Dec 7, 2022 at 1:08 PM Mike Banach <[email protected]> wrote:
Hi Mari.
Eli should now be able to directly access field definitions via the StreamNet API.
The GUID for the table is BD0C3244-B688-4C3E-BE18-21AF0E9E5FCB.
Table name is zwq_FieldDefinitions. The table has a few fields that are not
useful but she should be able to easily find and use what she's after.
Mike
Not sure if this is possible, but would be nice to be able to query what column values are available for filtering. As is, it is guesswork.
see how rredlist did this
use roxytest
Suggests: testthat, roxytest
Roxygen: list(roclets = c("namespace", "rd", "roxytest::testthat_roclet"))
Suggests: testthat, tinytest
BugReports: https://github.com/mikldk/roxytestdemo/issues
Encoding: UTF-8
Roxygen: list(roclets = c("namespace", "rd", "roxytest::testthat_roclet",
"roxytest::tinytest_roclet",
"roxytest::param_roclet",
"roxytest::return_roclet",
"roxytest::examples_roclet"))
In the 3 tab for the Excel files that are downloaded, there is a file with definitions of all the columns. I could not find that table in the API tables but I am guessing it might be somewhere in the database. I searched everywhere and couldn't find it. While we could just create it from the Excel file, it'd be best if I can download it from the API so it stays synced.
@mari-williams Can you ask the CAX folks where it might be?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.