brunobrr / bdc

Check out the vignettes with detailed documentation on each module of the bdc package
https://brunobrr.github.io/bdc
GNU General Public License v3.0
23 stars 7 forks source link

taxa db versioning issues within bdc_query_names_taxadb #228

Closed mfidino closed 1 year ago

mfidino commented 2 years ago

The `bdc_query_names_taxadb() function hardcodes database versions here:

https://github.com/brunobrr/bdc/blob/31215823c4cba5e47c22cefef27d88663a329047/R/bdc_query_names_taxadb.R#L210-L237

However, downstream in this function there are calls to the function taxadb::taxa_tbl() which has the default argument ofs:

taxa_tbl(
  provider = getOption("taxadb_default_provider", "itis"),
  schema = c("dwc", "common"),
  version = latest_version(),
  db = td_connect()
)

When latest_version() != db_version, bdc_query_names_taxadb() says that all species names were not found in the DB. This can be illustrated with the iucn database (hardcoded to 2019, but the 2022 version is available).

test <- bdc::bdc_query_names_taxadb(
 sci_name = "Sus scrofa", 
  db = "iucn"
)

test

 data.frame(test)
  original_search suggested_name distance    notes taxonID
1      Sus scrofa             NA       NA notFound    <NA>
  scientificName taxonRank acceptedNameUsageID taxonomicStatus
1           <NA>      <NA>                <NA>            <NA>
  kingdom phylum class order family genus specificEpithet
1    <NA>   <NA>  <NA>  <NA>   <NA>  <NA>            <NA>
  vernacularName infraspecificEpithet
1           <NA>                 <NA>

I'm working off the GitHub installation of bdc

kguidonimartins commented 2 years ago

Thanks for reporting @mfidino, and sorry for the late response. GitHub didn't notify me about this issue :/

However, downstream in this function there are calls to the function taxadb::taxa_tbl() which has the default argument ofs:

Nice catch! I included the argument now. Can you test the latest version of {bdc}?

remotes::install_github("brunobrr/bdc", force = TRUE)

We're aware of the latest version of the IUCN database. However, {taxadb} cannot return the latest version in a fit-for-use way yet (see here). That's the only reason to keep the hard-coded database versions.

kguidonimartins commented 1 year ago

Databases are hardcoded for a while in the new bdc release, and the following databases are not available: "tpl", "fb", "slb", "wd", and "iucn". I'm closing this issue due to inactivity. Please feel free to reopen it whenever you need to.