How susai23/fraud-detection-pipeline works
This repository combines a Streamlit insurance-claims investigation assistant with a scaffolded fraud-model pipeline. The user workflow is claim entry → fraud scoring → SHAP explanations → retrieval-grounded investigation note. Separately, the documented batch workflow loads raw data, preprocesses it, engineers features, trains a model, evaluates a holdout, and scores new data. The README calls the pipeline a scaffold, and feature wiring is explicitly unfinished. The app’s runtime integrations are visible in app.py; unsampled configuration and enrichment wiring is not inferred.
Main entry points: app.py Claim entry and results · config.py Pipeline configuration · trained_models.pkl Trained model artifacts · preprocessing.py Data preprocessing
Components 26
Investigation assistant
- Claim entry and results
app.py - Fraud scoring model
app.py - SHAP explanations
app.py - Guidance retrieval
app.py - In-memory guidance index
app.py - Investigation note
app.py
Model pipeline
- Pipeline configuration
src/config.py - Raw data loader
src/data_loader.py - Data preprocessing
src/preprocessing.py - Feature engineering
src/features.py - Model training
src/train.py - Holdout evaluation
src/evaluate.py - Batch prediction
src/predict.py
Claim context enrichment
- UK context generation
src/uk_context_generator.py - Claim enrichment
src/enrichment.py
Data and artifacts
- Raw transaction data
data/raw - Processed data
data/processed - Trained model artifacts
models/trained_models.pkl - Label encoder artifacts
models/label_encoders.pkl - Fraud guidance text
data/fraud_indicators_knowledge_base.txt - Holdout data
data/processed
Other components
- Claims investigator
- Groq generation API
- Postcode lookup
- Police crime data
- Weather archive
Connections 28
- Claims investigator → Claim entry and results: enters claim
app.py - Claim entry and results → Fraud scoring model: scores claim
app.py - Claim entry and results → SHAP explanations: explains score
app.py - Claim entry and results → Guidance retrieval: requests guidance
app.py - Guidance retrieval → In-memory guidance index: queries
app.py - Claim entry and results → Investigation note: renders note
app.py - Claim entry and results → Groq generation API: requests generation
app.py - Fraud guidance text → In-memory guidance index: indexes text
app.py - Trained model artifacts → Fraud scoring model: loads model
app.py - Label encoder artifacts → Claim entry and results: encodes inputs
app.py - Pipeline configuration → Raw data loader: configures
src/data_loader.py - Pipeline configuration → Data preprocessing: configures
src/preprocessing.py - Raw data loader → Raw transaction data: reads
src/data_loader.py - Data preprocessing → Raw data loader: loads raw data
src/preprocessing.py - Data preprocessing → Processed data: writes
src/preprocessing.py - Pipeline configuration → Model training: configures
src/train.py - Processed data → Model training: reads
src/train.py - Model training → Trained model artifacts: saves model
src/train.py - Model training → Holdout data: saves split
src/train.py - Pipeline configuration → Holdout evaluation: configures
src/evaluate.py - Holdout data → Holdout evaluation: reads
src/evaluate.py - Trained model artifacts → Holdout evaluation: loads model
src/evaluate.py - Pipeline configuration → Batch prediction: configures
src/predict.py - Batch prediction → Data preprocessing: calls preprocessing
src/predict.py - Trained model artifacts → Batch prediction: loads model
src/predict.py - Claim enrichment → Postcode lookup: looks up coordinates
src/enrichment.py - Claim enrichment → Police crime data: fetches crime data
src/enrichment.py - Claim enrichment → Weather archive: fetches weather
src/enrichment.py