#!/usr/bin/env python3 # Author: Simon-Pierre Boucher — contact@spboucher.ai """Step 01 — Build the estimation sample. Reads the raw matched transaction–roll snapshot (``data/raw/transactions_700k_avec_registre_foncier.parquet``), keeps residential arm's-length sales with a high-confidence roll match, constructs the assessment ratio and derived regressors, applies the trims, and writes ``data/processed/analysis.parquet``. Usage: python scripts/01_build_sample.py """ import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src")) from wp10 import sample # noqa: E402 def main() -> None: s = sample.build_and_save() print(f"\nEstimation sample written: {len(s):,} sales") print(f" municipalities : {s['muni'].nunique():,}") print(f" cells : {s['cell'].nunique():,}") print(f" classes : {s.groupby('prop_class').size().to_dict()}") print(f" median ratio : {s['ratio'].median():.3f}") if __name__ == "__main__": main()