How espoirdev22/smart-fraud-detection-platform works
Smart Fraud Detection is a mobile-money transaction fraud scoring application. A user enters or selects a transaction scenario; the frontend submits it for prediction, displays the risk score, and refreshes transaction history and aggregate statistics. The API prepares model features, applies a configured threshold, and persists predictions; history and statistics read the saved records. The frontend and API excerpts show these interactions. Training notebooks and the model artifact are not present in the tree, so the training workflow cannot be mapped further.
Main entry points: predict.py Prediction endpoint · database.py Database sessions · App.jsx Dashboard app · api.js API client
Components 18
Web interface
- Dashboard app
frontend/src/App.jsx - Transaction form
frontend/src/components/TransactionForm.jsx - Risk gauge
frontend/src/components/RiskGauge.jsx - Statistics chart
frontend/src/components/StatsChart.jsx - Transaction table
frontend/src/components/TransactionTable.jsx - API client
frontend/src/services/api.js
API and domain
- FastAPI entry
backend/app/main.py - Prediction endpoint
backend/app/routers/predict.py - Transaction history
backend/app/routers/transactions.py - Statistics endpoint
backend/app/routers/statistics.py - API schemas
backend/app/models/schemas.py - Runtime settings
backend/app/core/config.py
Fraud scoring
- Model scoring
backend/app/services/ml_service.py - Feature preprocessing
ml/src/preprocessing.py
Persistence
- Database sessions
backend/app/db/database.py - Transaction model
backend/app/db/models.py - SQL database
Other components
- Analyst
Connections 27
- Analyst → Transaction form: enters transaction
frontend/src/components/TransactionForm.jsx - Transaction form → API client: submits prediction
frontend/src/components/TransactionForm.jsx - API client → Prediction endpoint: POST /predict
frontend/src/services/api.js - API client → Transaction history: GET transactions
frontend/src/services/api.js - API client → Statistics endpoint: GET statistics
frontend/src/services/api.js - FastAPI entry → Prediction endpoint: registers route
backend/app/main.py - FastAPI entry → Transaction history: registers route
backend/app/main.py - FastAPI entry → Statistics endpoint: registers route
backend/app/main.py - Prediction endpoint → API schemas: validates payload
backend/app/routers/predict.py - Prediction endpoint → Model scoring: requests score
backend/app/routers/predict.py - Prediction endpoint → Runtime settings: reads threshold
backend/app/routers/predict.py - Model scoring → Runtime settings: reads model path
backend/app/services/ml_service.py - Model scoring → Feature preprocessing: matches features
backend/app/services/ml_service.py - Prediction endpoint → Database sessions: gets session
backend/app/routers/predict.py - Prediction endpoint → Transaction model: creates record
backend/app/routers/predict.py - Transaction history → Database sessions: gets session
backend/app/routers/transactions.py - Transaction history → Transaction model: queries records
backend/app/routers/transactions.py - Statistics endpoint → Database sessions: gets session
backend/app/routers/statistics.py - Statistics endpoint → Transaction model: counts records
backend/app/routers/statistics.py - Database sessions → SQL database: opens connection
backend/app/db/database.py - Transaction model → Database sessions: uses ORM base
backend/app/db/models.py - FastAPI entry → Database sessions: creates tables
backend/app/main.py - Dashboard app → Transaction form: renders
frontend/src/App.jsx - Dashboard app → Risk gauge: renders score
frontend/src/App.jsx - Dashboard app → Statistics chart: renders statistics
frontend/src/App.jsx - Dashboard app → Transaction table: renders history
frontend/src/App.jsx - Dashboard app → API client: loads dashboard data
frontend/src/App.jsx