Skip to content

Querying REDCap database fails in targets pipeline #625

Closed Answered by wlandau
Scott-Coggeshall asked this question in Help
Discussion options

You must be logged in to vote

format = "url" is for when you have a specific file in mind at a URL, e.g. https://raw.githubusercontent.com/wlandau/targets-minimal/main/data/raw_data.csv. For APIs, I would recommend something like:

tar_target(
  name = data,
  command = redcap_read(token = Sys.getenv("YOUR_TOKEN")),
  format = "feather" # assuming data frame format
  cue = tarchetypes::tar_cue_force(redcap_changed(Sys.getenv("YOUR_TOKEN")))
)

where redcap_changed() is a function you write to check if the remote database changed (using the last modified time stamp or hash of the database table). tarchetypes has a bunch of alternatives for this sort of thing, such as tar_change(), tar_age(), and tar_cue_age().

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Scott-Coggeshall
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants