Performs comprehensive health checks on a boilerplate database to identify potential issues such as orphaned variables, empty entries, and structural problems. Can optionally generate a detailed report.
Arguments
- db
List. The database to check (can be unified or single category).
- fix
Logical. If TRUE, attempts to fix issues where possible. Default FALSE.
- report
Character or NULL. If a file path is provided, saves a detailed report. If "text", returns the report as a character string. If NULL (default), returns the health check object.
- quiet
Logical. If TRUE, suppresses non-critical messages. Default FALSE.
Value
Depends on the report
parameter:
If
report = NULL
: A list with class "boilerplate_health" containing summary, issues, stats, and fixed itemsIf
report = "text"
: A character string containing the detailed reportIf
report
is a file path: Invisibly returns the file path after saving report
Examples
if (FALSE) { # \dontrun{
# 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
boilerplate_check_health(db, report = "health_report.txt")
# 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")
}
} # }