Identified 1.8M underserved people across Morocco's 12 regions. KMeans model recommending optimal health facility locations. Python, Streamlit,
# Morocco Healthcare Optimization
> A geospatial healthcare access analysis and optimization platform for Morocco.
> Built for data scientists, GIS analysts, and public health professionals.
---
## What This Project Does
HealthAccess Morocco maps **where healthcare facilities exist**, measures **how accessible they are** to the population, identifies **underserved regions**, and simulates the impact of **adding new facilities or mobile health units**.
| Layer | What it answers |
|---|---|
| **Facility Map** | Where are hospitals, clinics, pharmacies, and doctors in Morocco? |
| **Access Metrics** | What % of the population lives within 5 / 10 / 20 km of a facility? |
| **Optimization** | Where should new facilities be placed to maximize coverage? |
| **Triage Bot** | Can a safe, rule-based AI help patients know when to seek emergency care? |
---
## Quick Start
```bash
# 1. Clone the repository
git clone
github.com
cd morocco-healthcare-optimization
# 2. Set up Python 3.10 virtual environment
python3.10 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Fetch facility data for Morocco (optional — processed data is included)
python scripts/fetch_osm_facilities.py
python -c "from src.data_prep import run_pipeline; run_pipeline()"
# 5. Run the Streamlit dashboard
streamlit run webapp/streamlit_app.py
```
---
## Project Structure
```
morocco-healthcare-optimization/
├── src/
│ ├── data_prep.py # Facility & population data cleaning
│ ├── access_metrics.py # KD-tree nearest-neighbor, coverage ratios
│ ├── kmeans_placement.py # Weighted KMeans optimization
│ ├── scenario_simulator.py # Scenario runner & output
│ ├── facility_locator.py # Nearest-facility lookup (triage bot)
│ ├── spatial_utils.py # Morocco boundary & spatial integrity
│ └── triage_engine.py # Safe …