A reproducible pipeline for turning CRMLS real-estate exports into analysis-ready listing and sold datasets. The project combines monthly CRMLS CSVs with FRED 30-year mortgage rates, validates and enriches the data, and produces feature tables for Tableau and exploratory analysis.
- Residential listing and sold datasets for downstream analysis.
- Monthly mortgage-rate context from FRED's
MORTGAGE30USseries. - Timeline, price, geographic, and school-district features.
- Tableau workbooks in
workbooks/.
Raw and generated CSVs are intentionally excluded from Git. See
data/processed/README.md for the output contract.
.
├── data/
│ ├── raw/ # CRMLS exports, FRED rates, and DistrictAreas.geojson
│ └── processed/ # generated pipeline outputs
├── scripts/
│ ├── run_pipeline.sh # execute the complete workflow
│ ├── preprocessing/ # FTP/FRED downloads and stage 0–2 processing
│ ├── null_analysis.ipynb # stage 1: remove high-null columns
│ ├── validation.ipynb # stage 3: clean and validate records
│ ├── school_districting.ipynb # stage 4: spatial school-district join
│ ├── features.py # stage 5: derived analysis features
│ ├── iqr_filter.py # stage 6: sequential IQR outlier filtering
│ ├── tools/ # reusable distribution-analysis helpers
│ └── extra/ # archived exploratory notebooks
└── workbooks/ # Tableau workbooks
More detailed documentation is available in scripts/README.md,
scripts/preprocessing/README.md, and
scripts/tools/README.md.
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtTo execute notebook stages, also install Jupyter and the notebook-only packages:
pip install jupyter geopandas foliumCopy the template and fill in the FTP values:
cp .env.example .envThe downloader reads FTP_HOST, FTP_USER, FTP_PASS, LOCAL_DIR, and
REMOTE_DIR. LOCAL_DIR defaults to data/raw/; REMOTE_DIR defaults to
/csv. Keep .env private.
From the repository root:
scripts/run_pipeline.shUse existing files in data/raw/ and skip both download steps with:
scripts/run_pipeline.sh --skip-fetchThe complete run executes the stages in order:
- Download CRMLS listing/sold exports and monthly FRED rates.
- Combine monthly exports and retain residential records.
- Remove columns with more than 50% missing values.
- Merge monthly mortgage rates.
- Apply type, timeline, and California geographic checks.
- Join school-district attributes using
data/raw/DistrictAreas.geojson. - Add derived features and filter IQR outliers.
The pipeline runs from scripts/, so paths and notebook imports work regardless
of the directory from which the shell script is launched.
python scripts/preprocessing/fetch_data.py
python scripts/preprocessing/mortgage/fred.py
python scripts/preprocessing/preprocess.py # listings and sold
python scripts/preprocessing/preprocess.py listings # listings only
python scripts/preprocessing/preprocess.py sold # sold only
python scripts/features.py
python scripts/iqr_filter.pyStages 1–4 are notebooks and must be run in the order documented in
scripts/README.md. The notebooks, features.py, and
iqr_filter.py modify or remove intermediate outputs, so keep a copy of any
dataset that must be preserved.
The reusable plotting and summary functions in scripts/tools/util/ are
documented in scripts/tools/README.md. Open
distribution_tool.ipynb for a working example.