Motivation-and-Behaviour / tidyMB

Templates, utilities, and style guides for use in Motivation and Behaviour Research Program
Other
0 stars 0 forks source link

data workflow helpers #15

Open pdparker opened 3 years ago

pdparker commented 3 years ago

I think it is worth setting up some data workflows for cloudstor and REDCap. Ultimately, I think, data should be persistent only on a secure cloud and not on personal computers. In addition, we want everyone working from the same data (single source of truth). So principals are:

  1. Data should be located in a secure location only
  2. Data should only be located on a personal computer for as long as the R session lasts
  3. Everyone should work from a single source of truth

To get things going I think this works nicely for loading data from cloudstor in txt sas stata spss and csv form:

cloud_get <- function(user, password, cloud_address, dest){
  require(curl)
  p = file.path(tempdir(), dest)
  h = new_handle()
  handle_setopt(h, username = user)
  handle_setopt(h, password = password) 

  curl_download(cloud_address, p, handle = h)

  d = readit::readit(p)

  return(d)

}
tarensanders commented 3 years ago

Do you mean workflows on Notion, or as wrapper functions (or both)?

Agree we should add these to Notion. I don't think we need a wrapper function for Redcap - REDCapR's redcap_read() function is already pretty straightforward and I don't think we want another dependency that might not be used. I added some notes on this here: https://www.notion.so/motivationbehaviour/Using-REDCap-from-R-56cde1dc1a824b48aaa8e26451b5fd24