ropensci / taxizedb

Tools for Working with Taxonomic SQL Databases
Other
30 stars 7 forks source link

Add parameter to download functions to optionally update #34

Closed sckott closed 3 years ago

sckott commented 6 years ago

that is, force overwrite a new download even if it was previously downloaded

sckott commented 6 years ago

@noamross okay, thoughts.

remotes::install_github("ropensci/taxizedb@update-download")

x <- db_download_ncbi(overwrite = TRUE)

@arendsee @cboettig any thoughts on the change here?

All download functions get a new parameter overwrite. Internally, I added type checking for verboseand overwrite parameters to make sure they're logical - and the if statement that checked if file was already there now checks if its there and what overwrite is set to. last, I added a line for deleting the final_file no matter what since if we are downloading for the first time that line don't do anything, and if the user is updating, then we don't want the old final_file

noamross commented 6 years ago

I think this makes sense as-is These are bigger questions, but if one expands the idea here: how would the user know if there were a new version available, and could one specify a version to download?

sckott commented 6 years ago

haha, you're so optimistic. there's i think for all sources just one version - the current version, available for download. we can i think get the date the most recent dump was created on at least. does it make sense to have a sep. function to ask for dates that all remote dumps were updated?

noamross commented 6 years ago

So I do a thing in a package of mine where, on package startup (when interactive), I check the last dates updated locally, ping remote sources for its last updated if internet is available, and print a startup message indicating if any are out of date. This is all in a function like check_db_status() that the use can call as needed.

sckott commented 6 years ago

hmm, i'm reticent to run something that does http requests on startup. has that ever led to problems for users?

noamross commented 6 years ago

No, but we limit to interactive sessions and check for internet connectivity first, skipping if there's not one.

sckott commented 6 years ago

right, can just check if internet is avail, and only on interactive