# \donttest{
# Create temporary directory for example
temp_dir <- tempfile()
dir.create(temp_dir)
# Initialise and import database
boilerplate_init(data_path = temp_dir, create_dirs = TRUE,
confirm = FALSE, quiet = TRUE)
db <- boilerplate_import(data_path = temp_dir, quiet = TRUE)
# Check database health
health <- boilerplate_check_health(db)
print(health)
# Generate text report
report_text <- boilerplate_check_health(db, report = "text")
cat(report_text)
# Save report to file
report_file <- file.path(temp_dir, "health_report.txt")
boilerplate_check_health(db, report = report_file)
# Check and fix issues
health <- boilerplate_check_health(db, fix = TRUE)
# Get the fixed database
if (health$summary$issues_fixed > 0) {
db <- attr(health, "fixed_db")
}
# Clean up
unlink(temp_dir, recursive = TRUE)
# }
Run the code above in your browser using DataLab