A friendly validation layer over the 'imuGAP' canonicalizers
(canonicalize_observations(), canonicalize_populations(), and
canonicalize_locations()). It reports problems in spreadsheet
terms – naming the offending sheet and, where 'imuGAP' provides it, the
offending column or row – and collects all problems it can find rather
than stopping at the first.
Problems detected include:
missing or renamed required columns (per IMURUN_SCHEMA);
non-numeric count columns (
positive,sample_n,year,age_min,age_max,dose);fractional age-span endpoints;
an inverted age span (
age_min > age_max);age spans outside an explicit
max_ageor too large to expand safely;loc_idvalues inobservationsbut absent fromlocations;dose,year, andagevalues out of range;structural location problems (duplicate or missing root, cycles).
The imuGAP populations are constructed from the observations
(build_populations()); there is no populations sheet.
On success TRUE is returned invisibly. On failure a
single error is raised whose message lists every problem found.
Arguments
- inputs
a named list with
obsandlocs(as returned byread_inputs()), or a path passed straight toread_inputs().- max_cohort, max_age
integer upper bounds for the derived
cohortandagevalues. Default to the largest value present in the populations built fromobservationsso that validation does not impose a model configuration; supply explicit bounds to enforce a particular schedule.- max_dose
integer; the maximum allowed
dose(default2).
Examples
wb <- system.file("extdata", "imurun_example.xlsx", package = "imuRUN")
if (nzchar(wb)) {
validate_inputs(read_inputs(wb))
}