Skip to contents

This function compares the data in the project object (new data) with the previous or reference data to identify differences. It returns a list of differences for upload. The function ensures that the new data matches the structure defined by the metadata and provides warnings when discrepancies are found.

Usage

find_upload_diff(to_be_uploaded, project, view_old = FALSE, n_row_view = 20)

Arguments

to_be_uploaded

a data.frame or list of data.frames to be uploaded

project

A validated project object containing REDCap project data and settings. Generated using load_project or setup_project

view_old

Logical. If TRUE, it will display a preview of the old data (default is FALSE).

n_row_view

Numeric. Defines how many rows of the old data to view (default is 20).

Value

A list of differences between the new and old data (upload_list).

Details

The function compares the data in project$data_updates (new data) with the current data in the database (project$data). If the form names in the new data do not match the project$metadata$forms$form_name, a warning is issued. The function goes through each table in the new data and compares it with the old data, recording the differences.

The compare and to parameters allow users to specify specific data choices to compare, though their exact usage will depend on how the function is fully implemented.