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 in longitudinal study issue #508

Closed
nadha25 opened this issue Jul 27, 2023 · 6 comments
Closed

redcap_download_file_oneshot in longitudinal study issue #508

nadha25 opened this issue Jul 27, 2023 · 6 comments
Assignees

Comments

@nadha25
Copy link

nadha25 commented Jul 27, 2023

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 several events within a record, and so I am running the function in a loop for all event + record iterations to download all files for each event

However, it appears that the function is only downloading the file when the event name is entered manually

Here's the code that I'm running:

# download report 2282 containing Redcap ID, and event name 
[...]

while (val < length(report$record_id) + 1) {
  record_reg <- paste0(report$record_id[val])
  
  pdf_file <-
    REDCapR:redcap_download_file_oneshot(
      redcap_uri = url,
      token      = reg_token,
      record     = record_reg, 
      field      = field_name, 
      event      = report$redcap_event_name[val]
    )

If it enter manually "event1_arm_1" this works fine but given the amount of files to download, I require this to work in the loop. Not sure if the issue sits in the loop or with the changes to the function

@wibeasley wibeasley self-assigned this Jul 27, 2023
@wibeasley
Copy link
Member

  1. @nadha25, I'll have time to look at this closer. Hopefully tonight. In the meantime, do you think this is related to @BlairCooper's redcap_download_file_oneshot() only downloads from instance 1 regardless of repeat_instance value #506 & Remove repeat_instrument param from redcap_file_download_oneshot #507?
  2. Can you further explain "the function is only downloading the file when the event name is entered manually"? When does it work and when does it not?
  3. Consider using a for loop instead of while when the size of the loop can be determined at the start.

@nadha25
Copy link
Author

nadha25 commented Jul 27, 2023

Hi @wibeasley , Just having a check with our IT department as they did a fix for us around the same time so might be on their end rather than an issue with the function. Will get back to you !

@wibeasley
Copy link
Member

Cool. And make sure you're using the most recent version from GitHub (remotes::install_github("OuhscBbmc/REDCapR")).

@BlairCooper
Copy link
Contributor

@nadha25 As it sounds like it never downloads a file when using report$redcap_event_name[val] it isn't the same as #506 which always downloaded the first instance of the file.

If it works when you use a constant event name but not the value from the report, my initial thought is that report$redcap_event_name[val] isn't evaluating to the event name. You might try putting it into a local variable as you are with record_reg to confirm it actually contains the event name.

@nadha25
Copy link
Author

nadha25 commented Aug 4, 2023

Hi, thanks for the help, turns out it was an issue on our server side of things; not related to the code itself. Apologies as I went into panic mode when I couldn't have my consent process working correctly on a live database

@nadha25
Copy link
Author

nadha25 commented Aug 4, 2023

Hi, thanks for the help, turns out it was an issue on our server side of things; not related to the code itself. Apologies as I went into panic mode when I couldn't have my consent process working correctly on a live database

@nadha25 nadha25 closed this as completed Aug 4, 2023
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