# Nigeria's Fraud Conviction Records Explorer
A production-ready FastAPI backend for processing and analyzing publicly available fraud conviction records from Nigeria's federal courts.
## 🎯 Features
- **CSV Data Loading**: Automatically loads and processes conviction records
- **Data Cleaning**: Handles messy, inconsistent data with smart preprocessing
- **Search & Filter**: Search by defendant name, offense type, or court
- **Analytics**: Generate statistics on conviction patterns
- **Pagination**: All endpoints support limit/offset pagination
- **Type Safety**: Full Pydantic models and type hints
- **API Documentation**: Auto-generated OpenAPI/Swagger docs
## 📂 Project Structure
```
efcc-convictions-explorer/
├── main.py # FastAPI application & endpoints
├── models.py # Pydantic data models
├── data_cleaning.py # Data preprocessing utilities
├── requirements.txt # Python dependencies
├── efcc_convictions.csv # Input data (you provide this)
└── README.md # This file
```
## 🧹 Data Cleaning Features
The system automatically:
- ✅ Converts all text to uppercase
- ✅ Splits multiple defendants (e.g., "John Doe & ANOR" → separate records)
- ✅ Removes ₦ symbols, commas from monetary values
- ✅ Standardizes prison terms (e.g., "5 YEARS" → 60 months)
- ✅ Handles missing values safely
- ✅ Removes duplicate records
## 🚀 Quick Start
### 1. Setup
```bash
# Navigate to project directory
cd efcc-convictions-explorer
# Create Python virtual environment (recommended)
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate
# Install dependencies
pip install -r requirements.txt
```
### 2. Add Data
Place your CSV file in the project root:
```bash
# Copy your CSV file
cp /path/to/efcc_convictions.csv .
```
**Expected CSV columns:**
- `name` - Defendant name(s)
- `offense` - Offense type
- `prison_term` - Prison sentence
- `fine` - Fine amount …