# mahendra64/multi-fraud-detection-system architecture

> Architecture diagram of the GitHub repository mahendra64/multi-fraud-detection-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mahendra64/multi-fraud-detection-system
- Repository: https://github.com/mahendra64/multi-fraud-detection-system

## Overview

This is a Streamlit transaction-fraud analysis dashboard. Users upload a transaction CSV or use the bundled sample, review input metrics, and trigger analysis. The app calls a detection engine that always runs an unsupervised Isolation Forest and conditionally adds supervised predictions when sufficiently complete labeled data is available. Results are filtered and displayed in a table and chart, with a CSV download. The graph follows the sampled app and engine code; it does not assume additional storage or integrations.

Main entry points: [`fraud_engine.py`](https://github.com/mahendra64/multi-fraud-detection-system/blob/main/fraud_engine.py) (Fraud Detection Engine), [`app.py`](https://github.com/mahendra64/multi-fraud-detection-system/blob/main/app.py) (CSV Intake), [`data/sample_transactions.csv`](https://github.com/mahendra64/multi-fraud-detection-system/blob/main/data/sample_transactions.csv) (Sample Transactions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_intake["Data Intake"]
  node_csv_intake["CSV Intake<br/>[app.py]"]
  node_sample_data["Sample Transactions"]
  node_validation["Input Validation<br/>[app.py]"]
  node_overview["Transaction Overview<br/>[app.py]"]
end

subgraph group_analysis["Fraud Analysis"]
  node_analysis_request["Analysis Request<br/>[app.py]"]
  node_fraud_engine["Fraud Detection Engine<br/>[fraud_engine.py]"]
  node_unsupervised["Unsupervised Detection<br/>[fraud_engine.py]"]
  node_supervised["Supervised Detection<br/>[fraud_engine.py]"]
end

subgraph group_results["Results Review"]
  node_results_view["Results Review<br/>[app.py]"]
  node_csv_export["CSV Export<br/>[app.py]"]
end

node_user(("Dashboard User"))

node_user -->|"uploads CSV"| node_csv_intake
node_csv_intake -->|"reads by default"| node_sample_data
node_csv_intake -->|"checks columns"| node_validation
node_validation -->|"validates for display"| node_overview
node_user -->|"starts analysis"| node_analysis_request
node_analysis_request -->|"calls detect_fraud"| node_fraud_engine
node_fraud_engine -->|"runs by default"| node_unsupervised
node_fraud_engine -->|"runs when labels qualify"| node_supervised
node_fraud_engine -->|"returns results"| node_results_view
node_results_view -->|"exports results"| node_csv_export

click node_csv_intake "https://github.com/mahendra64/multi-fraud-detection-system/blob/main/app.py"
click node_sample_data "https://github.com/mahendra64/multi-fraud-detection-system/blob/main/data/sample_transactions.csv"
click node_validation "https://github.com/mahendra64/multi-fraud-detection-system/blob/main/app.py"
click node_overview "https://github.com/mahendra64/multi-fraud-detection-system/blob/main/app.py"
click node_analysis_request "https://github.com/mahendra64/multi-fraud-detection-system/blob/main/app.py"
click node_fraud_engine "https://github.com/mahendra64/multi-fraud-detection-system/blob/main/fraud_engine.py"
click node_unsupervised "https://github.com/mahendra64/multi-fraud-detection-system/blob/main/fraud_engine.py"
click node_supervised "https://github.com/mahendra64/multi-fraud-detection-system/blob/main/fraud_engine.py"
click node_results_view "https://github.com/mahendra64/multi-fraud-detection-system/blob/main/app.py"
click node_csv_export "https://github.com/mahendra64/multi-fraud-detection-system/blob/main/app.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_csv_intake,node_sample_data,node_validation,node_overview,node_user toneBlue
class node_analysis_request,node_fraud_engine,node_unsupervised,node_supervised toneAmber
class node_results_view,node_csv_export toneMint
```

## Components

### Data Intake

- [CSV Intake](https://github.com/mahendra64/multi-fraud-detection-system/blob/main/app.py): `app.py`
- [Sample Transactions](https://github.com/mahendra64/multi-fraud-detection-system/blob/main/data/sample_transactions.csv): `data/sample_transactions.csv`
- [Input Validation](https://github.com/mahendra64/multi-fraud-detection-system/blob/main/app.py): `app.py`
- [Transaction Overview](https://github.com/mahendra64/multi-fraud-detection-system/blob/main/app.py): `app.py`

### Fraud Analysis

- [Analysis Request](https://github.com/mahendra64/multi-fraud-detection-system/blob/main/app.py): `app.py`
- [Fraud Detection Engine](https://github.com/mahendra64/multi-fraud-detection-system/blob/main/fraud_engine.py): `fraud_engine.py`
- [Unsupervised Detection](https://github.com/mahendra64/multi-fraud-detection-system/blob/main/fraud_engine.py): `fraud_engine.py`
- [Supervised Detection](https://github.com/mahendra64/multi-fraud-detection-system/blob/main/fraud_engine.py): `fraud_engine.py`

### Results Review

- [Results Review](https://github.com/mahendra64/multi-fraud-detection-system/blob/main/app.py): `app.py`
- [CSV Export](https://github.com/mahendra64/multi-fraud-detection-system/blob/main/app.py): `app.py`

### Other components

- **Dashboard User**

## Connections

- Dashboard User → CSV Intake: uploads CSV (evidence: `app.py`)
- CSV Intake → Sample Transactions: reads by default (evidence: `app.py`)
- CSV Intake → Input Validation: checks columns (evidence: `app.py`)
- Input Validation → Transaction Overview: validates for display (evidence: `app.py`)
- Dashboard User → Analysis Request: starts analysis (evidence: `app.py`)
- Analysis Request → Fraud Detection Engine: calls detect_fraud (evidence: `app.py`)
- Fraud Detection Engine → Unsupervised Detection: runs by default (evidence: `fraud_engine.py`)
- Fraud Detection Engine → Supervised Detection: runs when labels qualify (evidence: `fraud_engine.py`)
- Fraud Detection Engine → Results Review: returns results (evidence: `fraud_engine.py`)
- Results Review → CSV Export: exports results (evidence: `app.py`)
