Transaction Fraud Detection for South African Banking
# 🇿🇦 sa-fraud-shield
### Production-Grade SA Fraud Detection — GNN + Streaming + Federated Learning + POPIA-Compliant XAI
---
## 🎯 Project Overview
**Business Problem:**
South African banks lost **R2.7 billion to financial crime in 2024**, with digital banking fraud surging 86% to ~98,000 incidents. Every R1 lost costs SA banks **R4.52** in total when factoring in investigation, recovery, and customer churn. Yet no SA bank has deployed graph neural networks, federated learning, or transformer-based models — they're still running FICO Falcon (circa 2011) and vendor-supplied solutions.
**Solution:**
A **production-grade fraud detection system** that demonstrates what SA banks actually need but haven't shipped yet:
- **AUC 0.9922** SIM swap detection model — SA's dominant fraud vector (60% of mobile breaches)
- **Graph Neural Network** fraud ring detector on heterogeneous transaction graphs
- **Real-time Kafka streaming** with sub-100ms scoring latency
- **Federated learning** across 5 simulated SA banks with differential privacy (POPIA-compliant)
- **LLM-generated explanations** in English and isiZulu — satisfying POPIA Section 71
**Why This Matters:**
SA banks plan to invest **R30M+ each in AI in 2026**. This project demonstrates the exact stack they need — and that no Kaggle notebook comes close to replicating.
---
## 📊 Key Results
| Metric | Value | Context |
|--------|-------|---------|
| **SIM swap AUC** | **0.9922** | Temporal cross-validation, 34 features |
| **GNN AUC** | 0.6450 | GraphSAGE on heterogeneous fraud graph |
| **API latency** | = 0.7"]
},
"latency_ms": 4.2
}
```
### Run Tests
```bash
pytest tests/
# 140 passed in 44s
```
---
## 📈 Build Phases
| Phase | Component | Highlight |
|-------|-----------|-----------|
| 1–2 | Scaffold + shared library | Pydantic schemas, SA validators, constants |
| 3 | Synthetic data generation | SA-locale Faker, PayShap IDs, load shedding injection |
| 4 | SIM swap model | LightGBM, 34 features, tempo …