purgeRestoreProject {redcapAPI} | R Documentation |
Purge and Restore Project Data
Description
These functions are primarily intended to assist with testing
features of redcapAPI
. Purging and restoring project data permits
us to perform tests on different project structures without having to
manage multiple projects or API tokens.
When purging project data, many of these actions may only be performed with a project in development status, as they are potentially destructive and may result in data loss. It is a good practice to back up your data and project structure before purging a project.
Usage
purgeProject(object, ...)
## S3 method for class 'redcapApiConnection'
purgeProject(
object,
arms = FALSE,
events = FALSE,
users = FALSE,
user_roles = FALSE,
dags = FALSE,
records = FALSE,
purge_all = FALSE,
flush = TRUE,
...,
error_handling = getOption("redcap_error_handling"),
config = list()
)
restoreProject(object, ...)
## S3 method for class 'redcapApiConnection'
restoreProject(
object,
project_information = NULL,
arms = NULL,
events = NULL,
meta_data = NULL,
mappings = NULL,
repeating_instruments = NULL,
users = NULL,
user_roles = NULL,
user_role_assignments = NULL,
dags = NULL,
dag_assignments = NULL,
records = NULL,
flush = TRUE,
...,
error_handling = getOption("redcap_error_handling"),
config = list()
)
## S3 method for class 'list'
restoreProject(
object,
rcon,
...,
error_handling = getOption("redcap_error_handling"),
config = list()
)
Arguments
object , rcon |
A |
... |
Arguments to pass to other methods |
arms |
Either |
events |
Either |
users |
Either |
user_roles |
Either |
dags |
Either |
records |
Either |
purge_all |
|
flush |
|
error_handling |
|
config |
A named |
project_information |
|
meta_data |
A |
mappings |
A |
repeating_instruments |
A |
user_role_assignments |
A |
dag_assignments |
A |
Details
When restoring a project, all arguments are optional. Any argument
that is NULL
will result in no import being made. The order of
reconstructing the project is (purging data occurs in the reverse order):
Update project information
Import Arms Data
Import Events Data
Import Meta Data
Import Mappings
Import Repeating Instruments
Import Users
Import User Roles
Import User-Role Assignments
Import Data Access Groups
Import Data Access Group Assignments
Import Records
Examples
## Not run:
unlockREDCap(connections = c(rcon = "project_alias"),
url = "your_redcap_url",
keyring = "API_KEYs",
envir = globalenv())
# Preserve a project
preserveProject(rcon)
# Purge a project
purgeProject(rcon,
purge_all = TRUE)
# Restore a project
restoreProject(rcon)
## End(Not run)