Giter VIP home page Giter VIP logo

rcax's People

Contributors

eeholmes avatar katiebarnas avatar mari-williams avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

rcax's Issues

load packages

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()

Add some notes about using the CAX data and things to know

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

Review the "terms" message on library loading. Sufficient?

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.

v1.0.0-beta ready for review

@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

Idea/Plan for including API key in the package

@mari-williams

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

https://nwfsc-math-bio.github.io/rCAX/articles/basics.html

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.

Delete rcax_hli.r, not needed

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).

Write tests to check the internal data for each release.

That way it stays up to date:

  • caxtabs should match ca/tables
  • cax_column_definitions should match what is in the API table
  • all the table names in rcax_table_name should be in ca/tables
  • figure out how to download a Excel table and check that rcax_hli_xport tables are the same

create filter function

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)))

Figure out how to update the internal data

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.

Code up retrieving the colname name definitions from zwq_FieldDefinitions

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

return single column from a table

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.

change and clean up the GET funs

  • probably get rid of rcax_base() and set in rcax_GET via a parameter GETarg$url. That way the user can change it. not really needed
  • in the ua put rCAX first don't do
  • rcax_parse() remove the parse arg. not used. don't do; maybe will need later
  • when reffing the rredlist fun be specific re the function
  • remove rcax_key() not needed. Info is in rcax_package()
  • remove reference to rredlist on the readme. Once clean up is done the code from rredlist is very minimal.
    .

write tests

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"))

get column descriptions for the tables

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?

Image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.