Balanced Random Forest pipeline for a DHS sibling-history maternal-mortality proxy (Nigeria 2024)
# Balanced Random Forest for a Maternal Mortality Proxy — Nigeria 2024 DHS
Imbalance-aware pipeline that predicts a **sibling-history maternal-mortality
proxy** from the Nigeria DHS Individual Recode (IR). The public-health goal is
**high sensitivity** on a rare event (~1.6%), not headline accuracy.
> **Critical limitation.** There is no VASA file and no clinical near-miss
> indicator. A woman is coded positive if she reported a **sister** death
> while pregnant, during delivery, after delivery, or within about six weeks
> postpartum (`mm9_*`). This is **not** the respondent's own death and **not**
> a Three Delays analysis. Use the model as triage / research support only.
The written analysis is in `docs/report.docx`.
## What the pipeline produces
| Stage | Module | Key outputs |
|------|--------|-------------|
| Data prep | `src/data_prep.py` | Analytic file, MM9 proxy, exclusion flow |
| Data quality | `src/data_quality.py` | Missingness, imbalance, recommendations |
| EDA | `src/eda.py` | Weighted proxy rates by subgroup |
| Modeling | `src/modeling.py` | Balanced logistic, Balanced RF, SMOTE-Tomek + BRF |
| Threshold | `src/threshold.py` | Sensitivity-first rule (recall ≥ 75%) |
| Evaluation | `src/evaluate.py` | AUROC / AUPRC, confusion matrices, cost |
| Interpretation | `src/interpret.py` | Tree feature importances |
| Report | `src/report.py` | Executive HTML report |
| Dashboard | `src/dashboard.py` | Streamlit explorer |
## Setup
```powershell
py -m venv .venv
.venv\Scripts\python.exe -m pip install -r requirements.txt
```
Place the Nigeria 2024 DHS download so that `NGIR8BDT/NGIR8BFL.dta` is
visible, or set `NDHS_2024_DIR` to that folder. Restricted microdata is
**not** committed.
## Run
```powershell
.venv\Scripts\python.exe src\run_pipeline.py
.venv\Scripts\streamlit run src\dashboard.py
```
Open `outputs/reports/maternal_mortality_report.html`.
## Locked analysis choices
- **Outcome:** MM9 sibling-history proxy; sister deaths only when `m …