Purpose
Create traceable cleaned data and one reusable profile. Do not repeat the same data inspection separately for every candidate method.
Preconditions
- Problem parse and subquestion IDs exist.
- Raw files are available under
workspace/data_raw/ or the workspace's documented legacy raw-data path.
- Required outputs and known field needs are available.
Stop rather than fabricate a missing attachment, unit, field meaning, or label.
Workflow
Map attachments before cleaning.
- List each attachment with name, size, sheet names, headers, and a small preview.
- Map it to Qx or mark it shared.
- Ask the user only when two mappings remain materially plausible.
Preserve raw data.
- Treat raw files as read-only.
- Record hashes or stable file metadata when practical.
- Write cleaned copies under
workspace/data_clean/.
Audit structure and semantics.
- Rows, columns, keys, types, units, categories, time granularity, and encoding.
- Missing values, duplicates, impossible values, outliers, discontinuities, and leakage risks.
- Field-to-subquestion and field-to-required-output mapping.
Compute reusable risk-profile statistics.
- Effective sample size and rows usable per Qx.
- Missingness by field and row.
- Numeric distribution summaries and extreme-value rates.
- Category/class counts, imbalance ratios, rare levels, and cardinality.
- Time coverage, gaps, sampling interval, and chronological split constraints.
- Correlation/redundancy warnings where relevant.
- Target or score concentration indicators when a target exists.
- Record facts; do not convert them into a final method verdict.
Plan and apply cleaning.
- Separate safe normalization of representation from assumption-bearing imputations or removals.
- Explain and record every assumption-bearing operation.
- Keep reproducible cleaning code only when transformations are nontrivial.
Assess readiness per Qx.
ready, ready_with_warnings, or blocked.
- Name missing fields and risks precisely.
- Hand the profile to
method-selector for method-specific risk probes.
Canonical Outputs
workspace/data/data_report.md
workspace/data/data_profile.json
workspace/data_clean/<cleaned files>
workspace/code/scripts/<cleaning script> # only when needed
Accept legacy workspace/data/data_clean/ as an input/output location during migration.
Data Profile Contract
data_profile.json contains:
{
"schema_version": 1,
"raw_files": [],
"attachment_mapping": [],
"fields": [],
"quality": {
"missingness": {},
"duplicates": {},
"impossible_values": {},
"outliers": {}
},
"coverage": {
"rows": 0,
"effective_sample_size": null,
"time_range": null,
"time_gaps": null
},
"distribution_risks": {
"class_imbalance": null,
"rare_categories": [],
"high_cardinality": [],
"redundancy_warnings": [],
"concentration_metrics": {}
},
"per_question_readiness": {},
"cleaned_files": [],
"unresolved_risks": []
}
Use null with an explanation when a field is not applicable; do not invent a value to fill the schema.
Rules
- Do not select the model.
- Do not overwrite raw data.
- Do not silently delete, impute, winsorize, rescale, or recode.
- Do not produce decorative EDA.
- Reuse one profile downstream instead of regenerating statistics.
- Store detailed row-level change logs only when changes occurred; successful no-op checks need only summary counts.
Verification
- Attachment mapping is unambiguous or human-confirmed.
- Raw files remain untouched.
- Cleaned files trace to raw sources and transformation rules.
- Profile includes effective sample size, imbalance/cardinality, and concentration evidence when applicable.
- Readiness is reported per subquestion.
- Downstream handoff points to paths rather than pasting the full report.
1---2name: data-auditor-cleaner3description: Map contest attachments to subquestions, audit and clean raw data, and emit one reusable data profile with quality, coverage, imbalance, concentration, and method-readiness evidence for downstream risk screening.4---56# Purpose78Create traceable cleaned data and one reusable profile. Do not repeat the same data inspection separately for every candidate method.910# Preconditions1112- Problem parse and subquestion IDs exist.13- Raw files are available under `workspace/data_raw/` or the workspace's documented legacy raw-data path.14- Required outputs and known field needs are available.1516Stop rather than fabricate a missing attachment, unit, field meaning, or label.1718# Workflow19201. **Map attachments before cleaning.**21 - List each attachment with name, size, sheet names, headers, and a small preview.22 - Map it to Qx or mark it shared.23 - Ask the user only when two mappings remain materially plausible.24252. **Preserve raw data.**26 - Treat raw files as read-only.27 - Record hashes or stable file metadata when practical.28 - Write cleaned copies under `workspace/data_clean/`.29303. **Audit structure and semantics.**31 - Rows, columns, keys, types, units, categories, time granularity, and encoding.32 - Missing values, duplicates, impossible values, outliers, discontinuities, and leakage risks.33 - Field-to-subquestion and field-to-required-output mapping.34354. **Compute reusable risk-profile statistics.**36 - Effective sample size and rows usable per Qx.37 - Missingness by field and row.38 - Numeric distribution summaries and extreme-value rates.39 - Category/class counts, imbalance ratios, rare levels, and cardinality.40 - Time coverage, gaps, sampling interval, and chronological split constraints.41 - Correlation/redundancy warnings where relevant.42 - Target or score concentration indicators when a target exists.43 - Record facts; do not convert them into a final method verdict.44455. **Plan and apply cleaning.**46 - Separate safe normalization of representation from assumption-bearing imputations or removals.47 - Explain and record every assumption-bearing operation.48 - Keep reproducible cleaning code only when transformations are nontrivial.49506. **Assess readiness per Qx.**51 - `ready`, `ready_with_warnings`, or `blocked`.52 - Name missing fields and risks precisely.53 - Hand the profile to `method-selector` for method-specific risk probes.5455# Canonical Outputs5657```text58workspace/data/data_report.md59workspace/data/data_profile.json60workspace/data_clean/<cleaned files>61workspace/code/scripts/<cleaning script> # only when needed62```6364Accept legacy `workspace/data/data_clean/` as an input/output location during migration.6566# Data Profile Contract6768`data_profile.json` contains:6970```json71{72 "schema_version": 1,73 "raw_files": [],74 "attachment_mapping": [],75 "fields": [],76 "quality": {77 "missingness": {},78 "duplicates": {},79 "impossible_values": {},80 "outliers": {}81 },82 "coverage": {83 "rows": 0,84 "effective_sample_size": null,85 "time_range": null,86 "time_gaps": null87 },88 "distribution_risks": {89 "class_imbalance": null,90 "rare_categories": [],91 "high_cardinality": [],92 "redundancy_warnings": [],93 "concentration_metrics": {}94 },95 "per_question_readiness": {},96 "cleaned_files": [],97 "unresolved_risks": []98}99```100101Use `null` with an explanation when a field is not applicable; do not invent a value to fill the schema.102103# Rules104105- Do not select the model.106- Do not overwrite raw data.107- Do not silently delete, impute, winsorize, rescale, or recode.108- Do not produce decorative EDA.109- Reuse one profile downstream instead of regenerating statistics.110- Store detailed row-level change logs only when changes occurred; successful no-op checks need only summary counts.111112# Verification113114- Attachment mapping is unambiguous or human-confirmed.115- Raw files remain untouched.116- Cleaned files trace to raw sources and transformation rules.117- Profile includes effective sample size, imbalance/cardinality, and concentration evidence when applicable.118- Readiness is reported per subquestion.119- Downstream handoff points to paths rather than pasting the full report.