
Validate a herald_spec against Define-XML rules (DD0001–DD0085)
Source:R/val-define.R
validate_spec_define.RdLoads the 85 Define-XML validation rules from the herald-rules repository
and runs them against the spec slots. Returns a herald_validation
object with findings. Rules are loaded from the local cache at
~/.cache/R/herald/herald-rules/engines/herald/define/.
See also
write_define_xml() which calls this automatically,
validate() for dataset validation.
Other conformance:
adam_rules(),
build_anchor_index(),
clear_ct(),
fda_rules(),
fetch_core_rules(),
fetch_herald_rules(),
herald_rules_cache_dir(),
list_ct(),
load_herald_config(),
new_herald_context(),
pmda_rules(),
register_ct(),
register_operator(),
rule_catalog(),
rule_config(),
update_core_rules(),
validate(),
validate_spec(),
validation_report(),
verify_html_report()
Examples
spec <- herald_spec(
ds_spec = data.frame(dataset = "DM", label = "Demographics",
stringsAsFactors = FALSE),
var_spec = data.frame(dataset = "DM", variable = "STUDYID",
label = "Study Identifier", data_type = "text",
length = "12", stringsAsFactors = FALSE)
)
result <- validate_spec_define(spec)
result
#>
#> ── herald validation ──
#>
#> Datasets checked: 1
#> ℹ Spec checks only -- no conformance rules evaluated
#> Findings: 0 reject, 8 high, 0 medium, 0 low
#>
#> ── Reject / High Impact
#> ✖ [DD0006] [High] spec.dataset: Dataset name is missing. Each row in the Datasets sheet must have a dataset name.
#> ✖ [DD0007] [High] spec.label: Dataset label is missing. Description is required for all ItemGroupDef in regulatory submissions.
#> ✖ [DD0011] [High] spec.structure: Structure description is missing. def:Structure is required for all datasets.
#> ✖ [DD0017] [High] spec.keys: Key Variables is missing. In regulatory submissions, a key must be provided for each dataset.
#> ✖ [DD0021] [High] spec.variable: Variable name is missing. Each row in the Variables sheet must have a variable name.
#> ✖ [DD0022] [High] spec.label: Variable label is missing. Description is required for all ItemDef corresponding to Variable definitions in regulatory submissions.
#> ✖ [DD0026] [High] spec.data_type: Significant Digits is missing but required when Data Type is float.
#> ✖ [DD0030] [High] spec.origin: Origin is missing. For regulatory submissions, def:Origin metadata must be provided for all variables at either the variable or value level.