Data framework for battery swap network optimization and PAYG default risk modelling in Kenya's electric motorcycle sector
# Kenya Boda Boda E-Mobility Viability Engine
### A Data-Driven Framework for Optimal Battery Swap Network Expansion and Credit Risk Management
**Live Cloud Dashboard:** boda-emobility.streamlit.app
---
## The Strategic Challenge
For electric mobility companies in Kenya — such as Ampersand, Spiro, and ARC Ride — the primary obstacle to scaling is not rider interest or vehicle performance. It is a classic network coordination problem (the chicken-and-egg paradox):
> *Riders cannot transition to electric motorcycles without a dense, reliable network of battery swap stations (BSS) to eliminate range anxiety. However, operators cannot justify the capital expenditure (CapEx) to build swap cabinets without a large, active rider base already generating swapping revenue.*
At the same time, asset financing companies (like Watu, Mogo, and M-KOPA) face significant credit risk. They deploy billions of shillings in pay-as-you-go (PAYG) motorcycle loans without understanding how physical infrastructure density directly impacts a rider's ability to make daily loan payments.
This project provides a replicable analytical engine that solves the data side of this problem. It is a decision-support tool that combines spatial optimization, demographic demand estimation, credit risk modeling, utility load balancing, and climate finance scenario planning into a single interactive enterprise dashboard.
---
## Project Structure
```text
boda-emobility-viability-engine/
├── .gitignore
├── README.md
├── app.py # Streamlit dashboard interface and Plotly visualizations
├── requirements.txt # Project dependencies
├── data/ # Compiled KNBS subcounty demographics and generated datasets
│ ├── existing_stations.csv
│ ├── nairobi_subcounties.csv
│ └── rider_loans.csv
└── src/ # Core analytical modules
├── data_processor.py # Data extraction, network compilation, and rider simulation
├── optimizer.py # Spatial gap analysis, K …