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

redcap_download_file_oneshot() only downloads from instance 1 regardless of repeat_instance value #506

Closed
nathhenry3 opened this issue Jul 21, 2023 · 3 comments · Fixed by #531

Comments

@nathhenry3
Copy link

I am trying to use the redcap_download_file_oneshot() function to extract files for specific variables from a large REDCap project. This project has repeating instruments, and so I am running the function in a loop for multiple values of 'instance' to download all files for each repeated instance.

However, it appears that the function is only downloading the file from the first instance of the repeating instrument, regardless of the value of repeat_instance.

Here's the code that I'm running:

file_download <- REDCapR::redcap_download_file_oneshot(redcap_uri = uri, token = api_token, record = record_id, field = field_name, event = event_name, repeat_instance = instance, directory = directory, overwrite = TRUE, verbose = TRUE )

where 'instance' changes with each iteration.

Desktop:

  • OS: Windows 10
  • REDCap version 13.1.28
  • REDCapR Version 1.1.0

Thanks a lot!

@BlairCooper
Copy link
Contributor

Looks like you need to also provide the repeat_instrument parameter.

@nathhenry3
Copy link
Author

nathhenry3 commented Jul 21, 2023

Ahh that's working now, thank you. However this was not immediately obvious on first sight.

Is it possible to include some sort of error message if repeat_instance is modified, but repeat_instrument is not included? Currently the download silently reverts to the first instance, which is easy to miss.

@wibeasley
Copy link
Member

@nathhenry3, I finally pulled @BlairCooper's improvements and added the tests. I'm pulling it into the main branch in a few minutes. Tell me if this doesn't fix you scenario. Or if you'd like to change the documentation.

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

Successfully merging a pull request may close this issue.

3 participants