Fraud detection API with real-time drift monitoring, uncertainty-aware predictions, and retrain orchestration.
- Scores transactions with an XGBoost model
- Detects drift using PSI + KS signals
- Uses conformal prediction sets for uncertainty-aware decisions
- Emits retrain requests when drift thresholds are breached
- Serves a React dashboard and Prometheus metrics
The fastest way to run the full stack (API + Dashboard + Monitoring):
docker compose up --buildServices:
- Frontend: http://localhost:5173
- API Docs: http://localhost:8000/docs
- Grafana: http://localhost:3000/d/afe3285cd4xkwc/drift-shield (user/pass:
admin/admin) - Prometheus: http://localhost:9090
Note: The API container will bootstrap an initial model on startup. If you want to use your own data, place
creditcard.csvindata/raw/before starting.
If you prefer to run services manually:
-
Install Dependencies
pip install -r requirements.txt cd frontend_new && bun install
-
Start the Stack
./dev.sh
| Layer | Tech |
|---|---|
| API | FastAPI + Uvicorn |
| Model | XGBoost + scikit-learn |
| Drift | PSI + KS test |
| Uncertainty | Conformal prediction |
| Frontend | React + Vite + Tailwind (frontend_new/) |
| Metrics | Prometheus (+ optional Grafana) |
GET /health— liveness checkGET /ready— readiness check (confirms model is loaded)POST /predict— score a transactionGET /dashboard/stats— summary stats for the frontendGET /models/info— active/shadow model metadataGET /system/status— full system state (drift, retraining, promotion policy)POST /retrain— manually trigger a retrain requestGET /prometheus/{path}— proxied Prometheus metrics endpoint
The compose stack includes: API, watcher (Credit Card domain), watcher_ieee (IEEE domain), Credit Card + IEEE traffic loops, frontend, Prometheus, and Grafana.
docker compose up --buildThe traffic services:
ieee_traffic/ieee_native_traffic: continuously send transactions toPOST /predictso charts stay populatedieee_trafficuses the adapted CSV format;ieee_native_trafficuses the raw IEEE feature set- Both require
ieee-fraud-detection/train_transaction.csvto be present for the full demo
- If values are empty, ensure request traffic is flowing.
- In Docker, check
driftshield_ieee_trafficcontainer status.
src/fraud_service/ Backend package
scripts/ Training, retrain, and utility scripts
frontend_new/ Active React dashboard
ieee-fraud-detection/ IEEE-CIS source files for demo traffic
monitoring/ Prometheus and Grafana configs
config.yaml Runtime settings
compose.yml Docker Compose stack


