Skip to contents

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_age or too large to expand safely;

  • loc_id values in observations but absent from locations;

  • dose, year, and age values 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.

Usage

validate_inputs(inputs, max_cohort = NULL, max_age = NULL, max_dose = 2L)

Arguments

inputs

a named list with obs and locs (as returned by read_inputs()), or a path passed straight to read_inputs().

max_cohort, max_age

integer upper bounds for the derived cohort and age values. Default to the largest value present in the populations built from observations so that validation does not impose a model configuration; supply explicit bounds to enforce a particular schedule.

max_dose

integer; the maximum allowed dose (default 2).

Value

Invisibly, TRUE on success.

Examples

wb <- system.file("extdata", "imurun_example.xlsx", package = "imuRUN")
if (nzchar(wb)) {
  validate_inputs(read_inputs(wb))
}