Skip to contents

Removes or masks identifying information from the REDCap database (`DB`). This can be done either based on the `identifier` field in the metadata or by specifying custom identifiers.

Usage

deidentify_DB(DB, identifiers, drop_free_text = F)

Arguments

DB

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

identifiers

Optional character vector of column names that should be excluded from the `DB`. If not provided, fields where `DB$metadata$fields$identifier == "y"` will be used as the default.

drop_free_text

Logical. If `TRUE`, columns containing free text will also be excluded from the `DB`. Default is `FALSE`.

Value

A `DB` object with deidentified forms.

Details

This function modifies the `DB` object to exclude specified identifiers or any columns flagged as identifiers in the metadata. Free-text fields can also be optionally removed, ensuring the resulting dataset complies with deidentification standards.

See also

save_DB for saving the modified database.