Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standardize parameters across functions #723

Closed
sckott opened this issue Dec 2, 2018 · 4 comments · Fixed by #829
Closed

Standardize parameters across functions #723

sckott opened this issue Dec 2, 2018 · 4 comments · Fixed by #829

Comments

@sckott
Copy link
Contributor

sckott commented Dec 2, 2018

the same types of inputs to functions are sometimes specified with different function param names. we should standarize them where possible. here's the candidates:

  • scientific names (aka taxonomic)
  • common names (aka vernacular)
  • taxon ids
  • ---: stays the same

new param names are:

  • sci: scientific name
  • com: common name
  • id: name identifier
  • sci_com: scientific name or common name
  • sci_id: scientific name or name identifier
  • For scientific name, common name, or name identifier - just leave as is

get functions

function param_current accepts proposed notes
get_uid sciname sci. or vern. sci_com modifier param toggles which
get_tsn searchterm sci. or vern. sci_com searchtype param toggles which
get_boldid searchterm sci. sci ---
get_eolid sciname sci. or vern. sci_com ---
get_tpsid sciname sci. sci ---
get_gbifid sciname sci. sci ---
get_tolid sciname sci. sci ---
get_iucn x sci. sci ---
get_natservid query sci. or vern. sci_com ---
get_nbnid name sci. or vern. sci_com ---
get_pow x sci. or vern. sci_com ---
get_wiki x sci. or vern. sci_com ---
get_wormsid query sci. or vern. sci_com ---
get_ids names sci, or vern. --- sci_com
get_colid --- --- --- removed fxn for now

search functions

function param_current accepts proposed notes
bold_search name sci. sci ---
col_search name sci. sci removed fxn for now
eol_search terms sci. sci ---
gni_search search_term sci. sci ---
nbn_search q sci. or vern. sci_com ---
tp_search name sci. sci ---
vascan_search q sci. or vern. or ids --- leave as is
pow_search q sci. or vern. sci_com ---

high level functions

function param_current accepts proposed
classification x sci. or ids sci_id
children x sci. or ids sci_id
downstream x sci. or ids sci_id
upstream x sci. or ids sci_id
lowest_common x sci. or id sci_id
tax_name query sci. sci
tax_rank x sci. or ids sci_id
id2name x ids id
sci2comm scinames sci. sci
comm2sci commnames vern. com
synonyms x sci. or ids sci_id
resolve query sci. sci

downstream functions

function param_current accepts proposed
downstream x sci. or ids ---
worms_downstream id ids ---
ncbi_downstream id ids ---
itis_downstream tsns ids id
gbif_downstream key ids id
bold_downstream id ids ---

resolve functions

function param_current accepts proposed
resolve query sci. sci
gnr_resolve names sci. sci
iplant_resolve query sci. sci
tnrs query sci. sci

  • in one release, add params, warn on usage of old
  • in next release, remove old params
@sckott sckott pinned this issue Dec 15, 2018
@sckott sckott unpinned this issue Dec 15, 2018
@sckott sckott added this to the v1.0 milestone Nov 9, 2019
@maelle
Copy link
Member

maelle commented Apr 24, 2020

I like the idea but wonder whether something like sci_ver_id could be annoying since it is long.

Some naive thoughts.

An alternative would be to have as many parameters as possible input: sci for sci names and ver for vernacular names within the same function (and you could only provide one of them, Not both a value for sci and a value for ver within a function call). Then the first argument could be called search and would accept all the names the function accepts, but its name wouldn't provide clarity.

Are there cases where people would feed a vector of both vernacular and scientific names to the function?

In a case where more than 50% of results are NA could the function message "many queries had no results, make sure you used the right input, refer to blabla vignette" 🤔

Your case reminds me a bit of https://r-hub.github.io/pkgsearch/reference/advanced_search.html where the user enters either named terms or a query string.

@sckott
Copy link
Contributor Author

sckott commented Apr 24, 2020

thanks @maelle !

You're right that sci_ver_id is quite long. Maybe just going with name for scientific or vernacular name and id when an identifier is expected, but if name or id can be given, then you'd need a 3rd option (i guess just x?)

Are there cases where people would feed a vector of both vernacular and scientific names to the function?

No, only one or the other.

In a case where more than 50% of results are NA

It could, but the search results are beyond my control - and I don't want to throw more messages, though that's a good idea to document more why users get results they get from different data sources.

Thanks for link to rhub fxn. I can see now that makes sense in that context.

@maelle
Copy link
Member

maelle commented Apr 27, 2020

but if name or id can be given, then you'd need a 3rd option (i guess just x?)

I don't understand this, can you explain to me what the input is in this case?

@sckott
Copy link
Contributor Author

sckott commented Apr 27, 2020

some functions can accept a taxonomic id or name - so name wouldn't be appropriate for that parameter and neither would id

@sckott sckott modified the milestones: v1.0, v0.9.97 May 15, 2020
sckott added a commit that referenced this issue May 21, 2020
updated docs of these functions and fixed their tests
started a new man file taxize-params with informaiton on standardized parameters
sckott added a commit that referenced this issue May 28, 2020
sckott added a commit that referenced this issue Jun 9, 2020
updated docs of these functions and fixed their tests
started a new man file taxize-params with informaiton on standardized parameters
sckott added a commit that referenced this issue Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants