
Validate a feature table against a feature contract
Source:R/feature_contract.R
validate_feature_frame.RdCatches train/serve drift before a model scores garbage. Mirror of
omop_etl.feature_contract.validate_feature_frame. Missing columns, dtype mismatches and unit suspicion
(for example creatinine in umol/L) always raise; out-of-bounds values raise under on_violation = "raise", are
clipped to the nearest bound under "clip" and set to NA under "nullify".
Usage
validate_feature_frame(
df,
feature_spec,
on_violation = "raise",
bounds = NULL,
allow_extra = TRUE
)Value
An object of class feature_validation_report (a list): frame (spec-ordered, repaired features),
missing, extra, dtype_mismatch, out_of_bounds, unit_suspicion, n_clipped, n_nullified, ok.
On a violation that raises, the error carries the report in $report.
Details
Bounds come from the spec's bounds, then bounds, then DEFAULT_PHYSIOLOGIC_BOUNDS.