Skip to contents

Renders a herald_validation object in multiple formats. HTML reports are self-contained interactive files with filtering, sorting, and search. Excel reports match the P21 5-sheet structure. JSON reports are machine-readable for CI/CD pipelines. CSV provides flat export.

Usage

validation_report(validation, path, title = "herald Validation Report")

Arguments

validation

A herald_validation object from validate().

path

Output file path. Extension determines format: .html for interactive HTML, .xlsx for Excel, .json for CI/CD JSON, .csv for flat CSV.

title

Report title. Default "herald Validation Report".

Value

The output path, invisibly.

Examples

spec <- herald_spec(
  ds_spec = data.frame(dataset = "DM", label = "Demographics",
                       stringsAsFactors = FALSE),
  var_spec = data.frame(dataset = "DM", variable = "STUDYID",
                        label = "Study ID", data_type = "text",
                        length = "12", stringsAsFactors = FALSE)
)
dm  <- data.frame(STUDYID = "S1", stringsAsFactors = FALSE)
dir <- tempfile()
dir.create(dir)
write_xpt(dm, file.path(dir, "dm.xpt"), dataset = "DM")
result <- validate(dir, spec = spec)
unlink(dir, recursive = TRUE)

## -- CSV report -----------------------------------------------------------
tmp <- tempfile(fileext = ".csv")
validation_report(result, tmp)
#>  Wrote validation report to /tmp/RtmpB1uFfd/file3fd5194fd78e.csv
unlink(tmp)