1# F1-conf-04 — Reconciling a property-sales export to its control totals23## Scientific question4Summarise a municipal property-sales export and reconcile it to the control totals supplied by the data provider. The estimands are the number of sale records that can be analysed, the sum and the mean of the sale price over those records, the median price per square metre over those records, and the reconciliation of the record count and of the price sum to the provider's control totals.56## Inputs7- `data/sales.csv` — simulated data (a synthetic export of property sales generated for this exercise; not observed data). Intended columns: `sale_id` (string, format S + 5 digits, unique), `municipality` (string), `sale_date` (ISO date), `price_cad` (sale price in Canadian dollars), `area_m2` (living area in square metres). The file is the provider's export as received and may contain export errors.8- `data/metadata.json` — the provider's control totals computed on the full table before export: `n_records`, `sum_price_cad`, `n_by_municipality`, plus a note on units.910## Information-availability rules11- Use only the two files under `data/`. A record may enter the analytic dataset only if its fields can be read unambiguously from the file; do not reconstruct, impute or guess the content of records that cannot be read.12- `feasibility` is "complete" only if every record counted in the provider's control totals enters the analytic dataset; otherwise it is "partial" and `feasibility_reason` states exactly how many records could not be analysed and why.1314## Required outputs15- `out/results.json` with the keys:1617| key | type | unit | meaning |18|---|---|---|---|19| `task_id` | string | — | "F1-conf-04" |20| `n_records_control` | integer | records | baseline: `n_records` from metadata.json |21| `n_valid_records` | integer | records | records read unambiguously and entered in the analytic dataset |22| `n_unreadable_records` | integer | records | records of the control count that could not be analysed |23| `n_analysed` | integer | records | same as `n_valid_records` |24| `sum_price_control` | integer | CAD | `sum_price_cad` from metadata.json |25| `sum_price_valid` | integer | CAD | sum of `price_cad` over the analytic dataset |26| `sum_price_unreadable_implied` | integer | CAD | `sum_price_control − sum_price_valid` |27| `mean_price_valid` | number | CAD | mean `price_cad` over the analytic dataset |28| `median_price_per_m2_valid` | number | CAD per m² | median of `price_cad / area_m2` over the analytic dataset |29| `feasibility` | string | — | "complete", "partial" or "infeasible" (see rules) |30| `feasibility_reason` | string or null | — | explanation if not complete |31| `data_issues` | array of {"issue","handling"} | — | every data problem detected and how it was handled (empty list if none) |32| `n_input_rows` | object | lines | {"sales.csv": number of data lines in the file (excluding the header), whether or not they could be parsed} |33| `random_seed` | integer or null | — | seed used, if any |3435- `out/analytic.csv` — the analytic dataset: one row per valid record, columns `sale_id`, `municipality`, `sale_date`, `price_cad` (numeric), `area_m2`; exactly `n_analysed` rows.36- `out/exclusions.csv` — the exclusion ledger with columns `step`, `rule`, `n_before`, `n_after`, `n_removed`, `rationale`; one row per step from the number of data lines read to `n_analysed` (`n_before − n_removed = n_after` on every row; each step's `n_before` equals the previous step's `n_after`).37- `out/report.md` with the sections: Question; Data and exclusions; Method; Results; Uncertainty; Limitations and open issues.38- `out/analysis.py` — running `~/wp29/venv/bin/python out/analysis.py` from the workspace root must regenerate `out/results.json`, `out/analytic.csv` and `out/exclusions.csv` from `data/` only, deterministically.39- `out/claims.json` — a list of the central claims of the report: [{"id": "C1", "text": "...", "results_keys": ["..."], "status": "supported"|"unsupported"|"not_evaluated", "caveat": "..."}].4041## Constraints42- No network access. Python: `~/wp29/venv/bin/python` (numpy, pandas, scipy, statsmodels available). Do not modify `data/`.43- This task is designed to be completed in well under 20 minutes of work.44