R/peekds_validators.R
ds.validate_for_db_import.Rdcheck all csv files against database schema for database import
ds.validate_for_db_import(
dir_csv,
cdi_expected,
file_ext = ".csv",
is_null_field_required = TRUE,
suppress_warnings = c()
)the folder directory containing all the csv files, the path should end in "processed_data"
specifies whether cdi_data is to be expected to be present in the imported data
the default is ".csv"
by default is set to TRUE which means that all the columns in the json file are required; when set to FALSE, fields that are allowed null values are not required
character vector of warning IDs to silence.
Currently supported: "cdi_collision".
A list with two elements:
Character vector of validation errors (blocking), or NULL if none.
Character vector of validation warnings (suppressible), or NULL if none.
Warnings matching suppress_warnings are excluded.
if (FALSE) { # \dontrun{
result <- ds.validate_for_db_import(dir_csv = "./processed_data", cdi_expected = TRUE)
result$errors # blocking issues
result$warnings # warnings that can be opted out of on a case by case basis
# suppress known warnings for a specific dataset
result <- ds.validate_for_db_import(dir_csv = "./processed_data", cdi_expected = TRUE,
suppress_warnings = c("cdi_collision"))
} # }