Audit a dataset
Use this skill before statistics, model training, or external publication. The
goal is a compact, machine-readable audit plus explicit decisions about every
issue that could invalidate downstream results.
Workflow
- Load records without silently coercing values. Preserve source row IDs.
- Call
audit_rows on a representative or complete list of row mappings.
- Inspect missingness and observed type mixtures column by column.
- Resolve duplicate records and non-unique identifiers deliberately.
- If a split column exists, check both stable IDs and grouping entities for
train/validation/test overlap.
- Record accepted exceptions, then rerun the audit and save the JSON result
next to the cleaned dataset.
Import and run
Hyphenated Skill directories are loaded with importlib:
from importlib import import_module
audit_rows = import_module("audit-dataset.kernel").audit_rows
report = audit_rows(
rows,
target="label",
id_columns=("sample_id",),
group_columns=("patient_id",),
split_column="split",
)
rows must be a sequence of mappings. The report contains row and column
counts, per-column missing/type/unique summaries, duplicate row and ID counts,
target frequencies, and split-leakage examples.
Interpretation
- Mixed numeric/string types usually indicate parsing or sentinel-value bugs.
- Missingness is a property of both the data and the collection process; do
not impute before checking whether it correlates with label, site, or time.
- Duplicate IDs are not automatically duplicate observations. Decide whether
repeated measures are expected and group them during splitting.
- Any patient, molecule scaffold, time series, or near-duplicate entity shared
across evaluation boundaries can inflate performance even when row IDs differ.
- A clean structural audit does not establish representativeness, label
validity, causal identifiability, or ethical suitability.
Required output
Report the checks performed, blocking findings, accepted exceptions, and the
exact source artifact/version. Never describe a dataset as clean without naming
the leakage keys and missing-value policy that were checked.
1---2name: audit-dataset3description: Audit tabular datasets before analysis or training for schema drift, missing values, duplicate rows or IDs, target imbalance, and entity or group leakage across splits using pure-stdlib helpers.4---56# Audit a dataset78Use this skill before statistics, model training, or external publication. The9goal is a compact, machine-readable audit plus explicit decisions about every10issue that could invalidate downstream results.1112## Workflow13141. Load records without silently coercing values. Preserve source row IDs.152. Call `audit_rows` on a representative or complete list of row mappings.163. Inspect missingness and observed type mixtures column by column.174. Resolve duplicate records and non-unique identifiers deliberately.185. If a split column exists, check both stable IDs and grouping entities for19 train/validation/test overlap.206. Record accepted exceptions, then rerun the audit and save the JSON result21 next to the cleaned dataset.2223## Import and run2425Hyphenated Skill directories are loaded with `importlib`:2627```python28from importlib import import_module2930audit_rows = import_module("audit-dataset.kernel").audit_rows31report = audit_rows(32 rows,33 target="label",34 id_columns=("sample_id",),35 group_columns=("patient_id",),36 split_column="split",37)38```3940`rows` must be a sequence of mappings. The report contains row and column41counts, per-column missing/type/unique summaries, duplicate row and ID counts,42target frequencies, and split-leakage examples.4344## Interpretation4546- Mixed numeric/string types usually indicate parsing or sentinel-value bugs.47- Missingness is a property of both the data and the collection process; do48 not impute before checking whether it correlates with label, site, or time.49- Duplicate IDs are not automatically duplicate observations. Decide whether50 repeated measures are expected and group them during splitting.51- Any patient, molecule scaffold, time series, or near-duplicate entity shared52 across evaluation boundaries can inflate performance even when row IDs differ.53- A clean structural audit does not establish representativeness, label54 validity, causal identifiability, or ethical suitability.5556## Required output5758Report the checks performed, blocking findings, accepted exceptions, and the59exact source artifact/version. Never describe a dataset as clean without naming60the leakage keys and missing-value policy that were checked.