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

remote_dl requires /tmp directory #13

Open
mskoldSU opened this issue Apr 16, 2020 · 7 comments
Open

remote_dl requires /tmp directory #13

mskoldSU opened this issue Apr 16, 2020 · 7 comments

Comments

@mskoldSU
Copy link

remote_dl called by update_data tries to save a temporary file to /tmp. This will throw an error if the directory does not exist (e.g. on a Windows system unless you create it manually).

@thokall
Copy link
Member

thokall commented Apr 16, 2020

Should be enough to change the function from:

remote_dl <- function() {
	PUB_URL <- "http://fagel3.nrm.se/fagel/aterfynd/SQLDataExport.csv"
	DEST <- "/tmp/recoveries.csv"`
....

to:

remote_dl <- function(DEST = "/tmp/recoveries.csv") {

	PUB_URL <- "http://fagel3.nrm.se/fagel/aterfynd/SQLDataExport.csv"
	DEST <- DEST

This way there is an option to change directory of the temp folder for users that wants to write to specific place

@thokall
Copy link
Member

thokall commented Apr 16, 2020

Can make a pull request if this is seen as the way forward

@mskoldSU
Copy link
Author

update_data is the function you call, so that needs a DEST = "/tmp/recoveries.csv" argument while remote_dl (called from update_data) needs a simple DEST argument

@mskoldSU
Copy link
Author

But to be honest, saving a temporary file seems just a waste of time? Perhaps change

download.file(PUB_URL, DEST)

update_df <- read_csv(DEST, skip = 1, quote = "\"",
		locale = locale(decimal_mark = ","),
		col_types = "cccccccccDddcccccccDcccddccccccciiiiicccD")

to

update_df <- read_csv(PUB_URL, skip = 1, quote = "\"",
		locale = locale(decimal_mark = ","),
		col_types = "cccccccccDddcccccccDcccddccccccciiiiicccD")

(though if I remember correctly reading directly from url:s sometimes fails on Macs?)

@Inkimar
Copy link
Contributor

Inkimar commented Apr 16, 2020

short note: about tmp - right now this applicatio is deployed to a linux-container (see the Dockerfile) ... there will always be a tmp-available on linux ...

@mskoldSU
Copy link
Author

I guess the question is whether the purpose of the package is to distribute the data or serve the app. The app is fun to play with, but it is not a very useful tool for accessing the database.

@thokall
Copy link
Member

thokall commented Apr 22, 2020

We should probably clarify the structure of the code as well as the readme. In my eyes there are three parts:

  1. The swedishbirdrecoveries package
  2. The shiny app that use the package and other code to generate the webpage
  3. The code to deploy the shiny page using docker etc. on a given infrastructure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants