Explore automated loan eligibility analysis in Kenya. Project covers distribution across counties, borrower demographics, temporal evolution, clustering, and machine learning predictions. Gain insights from segmentation analysis by income and age.
# Kenya Loan Analysis
> A reproducible, testable microloan analysis pipeline for Kenyan loan applications with interactive visualization and robust data handling.
## Overview
This project provides a complete pipeline for analyzing microloan application data with emphasis on:
- **Defensive data handling** — Robust numeric coercion with comprehensive diagnostics
- **Modular architecture** — Clear separation between ETL, modeling, analytics, and UI
- **Reproducibility** — Test coverage and deterministic results
- **Interactive exploration** — Streamlit UI for dynamic analysis and visualization
## Table of Contents
- Features
- Installation
- Quick Start
- Data Schema
- Project Structure
- Usage
- Testing
- Diagnostics
- Contributing
- License
## Features
- ✅ **Data Processing** — ETL pipeline with feature engineering (EMI, DTI ratios)
- ✅ **Machine Learning** — Model training with cross-validation and persistence
- ✅ **Advanced Analytics** — Clustering, temporal patterns, and risk analysis
- ✅ **Interactive UI** — Streamlit dashboard with Plotly visualizations
- ✅ **Comprehensive Testing** — Unit tests for core functionality
- ✅ **Quality Diagnostics** — Detailed reporting on data quality issues
## Installation
### Prerequisites
- Python 3.8 or higher
- pip package manager
### Setup
1. **Clone the repository**
```bash
git clone
cd kenya-loan-analysis
```
2. **Create and activate virtual environment**
```bash
python -m venv .venv
# On macOS/Linux
source .venv/bin/activate
# On Windows
.venv\Scripts\activate
```
3. **Install dependencies**
```bash
pip install -r requirements.txt
```
## Quick Start
Launch the Streamlit application:
```bash
streamlit run src/app.py
```
Then:
1. Upload an Excel or CSV file matching the expected schema
2. Explore data quality diagnostics
3. Train models and view performance metrics
4. Run advanced analytics (clustering, temporal analysis, risk scoring)
5. Generate and download insights reports
## Data Schema
The pi …