Skip to contents

This function is designed to upload changes from a locally modified `DB` object to REDCap. It should be run after using `DB_import <- read_from_REDCap_upload(DB)`. The function compares the imported data (`DB_import`) to the existing data in `DB` and only uploads new or changed data. It will not directly delete any data. This function has the potential to modify your data, so it should be used cautiously. Any changes made through this function will be logged in the REDCap log.

Usage

upload_DB_to_REDCap(
  DB,
  batch_size = 500,
  ask = T,
  view_old = T,
  n_row_view = 20
)

Arguments

DB

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

batch_size

Numeric. The number of records to upload in each batch. Default is 500.

ask

Logical. If TRUE, the function will prompt you to preview the data that will be uploaded before proceeding. Defaults to TRUE.

view_old

Logical. If TRUE, the function will show a preview of the old records before upload. Defaults to TRUE.

n_row_view

Numeric. The number of rows to display when previewing old data. Default is 20.

Value

A series of messages indicating the progress and status of the upload.

Details

This function uploads changes to a REDCap project, based on the differences between the locally imported data (`DB_import`) and the existing data (`DB`). It uploads changes in batches as specified by `batch_size` and allows you to preview the changes before the upload if `ask` is set to TRUE. It will not delete any data from REDCap, and it is intended to only upload new or modified records. This function is not fully ready for production use and should be used with caution. Any issues during the upload will be logged in the REDCap system log.