How padmajaghute339-svg/fraud-detection-system works
This is a single-file real-time transaction fraud detection service. Its main workflow accepts a transaction over HTTP, updates per-user in-memory history, derives velocity and spend features, preprocesses them for a LightGBM prediction, and returns a fraud decision with explanations. The module also builds the model offline and includes a live API simulation. The excerpt does not show every training or response step, so the graph omits uncertain connections.
Main entry points: fraud_system.py Prediction endpoint
Components 10
Offline training
- Feature engineering
fraud_system.py - Mock transactions
fraud_system.py - Feature preprocessor
fraud_system.py - LightGBM model
fraud_system.py
Scoring service
- Prediction endpoint
fraud_system.py - Model bundle
fraud_system.py - SHAP reasons
fraud_system.py
Transaction state
- User history store
fraud_system.py
Live simulation
- Traffic simulation
fraud_system.py
Other components
- API client
Connections 11
- API client → Prediction endpoint: requests
fraud_system.py - Prediction endpoint → User history store: updates history
fraud_system.py - Prediction endpoint → User history store: computes features
fraud_system.py - Mock transactions → Feature engineering: feeds
fraud_system.py - Feature engineering → Feature preprocessor: configures
fraud_system.py - Feature preprocessor → LightGBM model: transforms training data
fraud_system.py - LightGBM model → Model bundle: bundles model
fraud_system.py - Prediction endpoint → Feature preprocessor: transforms payload
fraud_system.py - Prediction endpoint → LightGBM model: scores transaction
fraud_system.py - Prediction endpoint → SHAP reasons: builds reasons
fraud_system.py - Traffic simulation → Prediction endpoint: posts requests
fraud_system.py