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

Error in Running KoboConnect.R Script #11

Open
moloscripts opened this issue Sep 15, 2022 · 1 comment
Open

Error in Running KoboConnect.R Script #11

moloscripts opened this issue Sep 15, 2022 · 1 comment

Comments

@moloscripts
Copy link

When I run the code chunks separately, the data finally downloads. However, when I put the script on Shiny apps or in a similar environment, and run the R-script, the download fails.

Any reason for this? (See screenshot)
Screenshot 2022-09-15 at 14 32 49

@asitav-sen
Copy link
Owner

Hi @moloscripts ,
Thanks for your continued support.
It is difficult for me to identify the exact issue. However, I feel that this is happening because the download URL takes a while to generate and R does not wait for the function to return value before executing the next line. In which case, there could be several approaches to take. For example, asynchronous. Or, have a look at some of the ways at
https://stackoverflow.com/questions/25297489/accept-http-request-in-r-shiny-application
https://stackoverflow.com/questions/25283736/r-shiny-rest-api-communication/71064046#71064046
https://shiny.rstudio.com/gallery/selectize-rendering-methods.html and
https://www.rdocumentation.org/packages/shinyhttr/versions/1.1.0

For the sake of simplicity, I would take another approach. I would run a cron job that downloads data at regular intervals and feed the downloaded data to the shiny app. This way, the shiny app will not execute the API call, but will use the downloaded data.
Hope this helps.

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

2 participants