SPB Git

spb/wp5_uqo Public

UQO Working Paper No. 5 — Airbnb, residential rents and housing market pressure.

TeX 53.4% Python 46.5%
2.0 KB · 54 lines python
Raw Blame History
1# Author: Simon-Pierre Boucher — contact@spboucher.ai2"""3Central configuration: project paths and pipeline constants.45Every path is derived from the repository root so the pipeline can run from6any working directory. Output directories are created on import.7"""89from pathlib import Path1011# ── repository layout ────────────────────────────────────────────────────────12ROOT = Path(__file__).resolve().parent.parent1314DATA_RAW = ROOT / "data" / "raw"15DATA_PROCESSED = ROOT / "data" / "processed"16FIG_DIR = ROOT / "figures"17TABLE_DIR = ROOT / "results" / "tables"18LOG_DIR = ROOT / "results" / "logs"1920# Raw inputs (not distributed with the repository; see data/raw/README.md)21AIRBNB_RAW = DATA_RAW / "airbnb.csv"22RENT_RAW = DATA_RAW / "rent.json"2324# Processed datasets25AIRBNB_CLEAN = DATA_PROCESSED / "airbnb_clean.parquet"26RENT_CLEAN = DATA_PROCESSED / "rent_clean.parquet"27MERGED_SPATIAL = DATA_PROCESSED / "merged_spatial.parquet"28MERGED_NEIGHBORHOOD = DATA_PROCESSED / "merged_neighborhood.parquet"29MERGED_ANALYSIS = DATA_PROCESSED / "merged_analysis.parquet"3031# ── pipeline constants ───────────────────────────────────────────────────────32# Buffer radii (km) for the spatial merge and robustness checks33BUFFER_KM = [0.25, 0.5, 1.0, 2.0]3435# Rental rows per chunk in the vectorised Haversine merge36CHUNK_SIZE = 5003738EARTH_RADIUS_KM = 6_371.03940# Random seed for the ML robustness models (train/test split and estimators)41RANDOM_STATE = 424243for _d in (DATA_PROCESSED, FIG_DIR, TABLE_DIR, LOG_DIR):44    _d.mkdir(parents=True, exist_ok=True)454647def require(path: Path, hint: str) -> Path:48    """Return *path* if it exists, otherwise abort with a clear message."""49    if not path.exists():50        raise SystemExit(51            f"Missing input: {path}\n{hint}"52        )53    return path54