Skip to contents

Updates the REDCap database (`DB` object) by fetching the latest data from the REDCap server.

Usage

update_DB(
  DB,
  set_token_if_fails = T,
  force = F,
  day_of_log = 10,
  labelled = T,
  get_files = F,
  original_file_names = F,
  entire_log = F,
  metadata_only = F,
  ask_about_overwrites = T,
  save_to_dir = T,
  batch_size = 2000
)

Arguments

DB

A validated `DB` object containing REDCap project data and settings. Generated using load_DB or setup_DB

set_token_if_fails

Logical (TRUE/FALSE). If TRUE, prompts the user to set the REDCap API token if the update fails. Default is `TRUE`.

force

Logical (TRUE/FALSE). If TRUE, forces a fresh update. Default is `FALSE`.

day_of_log

Integer. Number of days to be checked in the log. Default is `10`.

labelled

Logical (TRUE/FALSE). If TRUE, returns labelled REDCap data. If FALSE, returns raw data. Default is `TRUE`.

get_files

Logical (TRUE/FALSE). If TRUE, retrieves files from REDCap. Default is `FALSE`.

original_file_names

Logical (TRUE/FALSE). If TRUE, uses original file names for retrieved files. Default is `FALSE`.

entire_log

Logical (TRUE/FALSE). If TRUE, retrieves the entire log. Default is `FALSE`.

metadata_only

Logical (TRUE/FALSE). If TRUE, updates only the metadata. Default is `FALSE`.

ask_about_overwrites

Logical (TRUE/FALSE). If TRUE, prompts the user before overwriting existing data. Default is `TRUE`.

save_to_dir

Logical (TRUE/FALSE). If TRUE, saves the updated data to the directory. Default is `TRUE`.

batch_size

Integer. Number of records to process in each batch. Default is `2000`.

Value

Messages for confirmation.

Details

This function updates the REDCap database by fetching the latest data from the REDCap server. It supports various options such as forcing a fresh update, checking logs for a specified number of days, and retrieving files from REDCap. The function can also handle metadata-only updates and batch processing.

See also

setup_DB for initializing the `DB` object.

Other db_functions: rmarkdown_DB(), summarize_DB(), transform_DB()