# shreyakm21/fraud-detection-system architecture

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

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

## Overview

This is a Streamlit fraud-detection app: a user enters one transaction or uploads a CSV, the UI trains or retrieves the cached Random Forest workflow, requests predictions, and presents results and upload visualizations. The model module loads the training data, trains and evaluates the classifier, and handles record or file predictions. The graph reflects the shown calls and documented capabilities; it does not imply persistent model storage or inspect source beyond the provided excerpts.

Main entry points: [`Fraud_Detection_UI.py`](https://github.com/shreyakm21/fraud-detection-system/blob/main/Fraud_Detection_UI.py) (Streamlit UI), [`ML_model.py`](https://github.com/shreyakm21/fraud-detection-system/blob/main/ML_model.py) (Model training), [`FraudTrainData.csv`](https://github.com/shreyakm21/fraud-detection-system/blob/main/FraudTrainData.csv) (Labeled transactions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_streamlit_ui["Streamlit UI"]
  node_result_views["Result visualizations"]
end

subgraph group_engine["Detection engine"]
  node_training["Model training<br/>[ML_model.py]"]
  node_evaluation["Model evaluation<br/>[ML_model.py]"]
  node_prediction["Transaction prediction<br/>[ML_model.py]"]
end

subgraph group_data["Data and outputs"]
  node_training_data["Labeled transactions<br/>[FraudTrainData.csv]"]
  node_prediction_file["Prediction result CSV<br/>[ML_model.py]"]
end

node_user(("User"))

node_user -->|"enters or uploads"| node_streamlit_ui
node_streamlit_ui -->|"requests training"| node_training
node_training -->|"reads"| node_training_data
node_training -->|"evaluates predictions"| node_evaluation
node_streamlit_ui -->|"requests prediction"| node_prediction
node_prediction -->|"writes uploaded results"| node_prediction_file
node_prediction -->|"returns prediction results"| node_streamlit_ui
node_streamlit_ui -->|"renders upload charts"| node_result_views

click node_streamlit_ui "https://github.com/shreyakm21/fraud-detection-system/blob/main/Fraud_Detection_UI.py"
click node_result_views "https://github.com/shreyakm21/fraud-detection-system/blob/main/Fraud_Detection_UI.py"
click node_training "https://github.com/shreyakm21/fraud-detection-system/blob/main/ML_model.py"
click node_evaluation "https://github.com/shreyakm21/fraud-detection-system/blob/main/ML_model.py"
click node_prediction "https://github.com/shreyakm21/fraud-detection-system/blob/main/ML_model.py"
click node_training_data "https://github.com/shreyakm21/fraud-detection-system/blob/main/FraudTrainData.csv"
click node_prediction_file "https://github.com/shreyakm21/fraud-detection-system/blob/main/ML_model.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_streamlit_ui,node_result_views,node_user toneBlue
class node_training,node_evaluation,node_prediction toneAmber
class node_training_data,node_prediction_file toneMint
```

## Components

### User interface

- [Streamlit UI](https://github.com/shreyakm21/fraud-detection-system/blob/main/Fraud_Detection_UI.py): `Fraud_Detection_UI.py`
- [Result visualizations](https://github.com/shreyakm21/fraud-detection-system/blob/main/Fraud_Detection_UI.py): `Fraud_Detection_UI.py`

### Detection engine

- [Model training](https://github.com/shreyakm21/fraud-detection-system/blob/main/ML_model.py): `ML_model.py`
- [Model evaluation](https://github.com/shreyakm21/fraud-detection-system/blob/main/ML_model.py): `ML_model.py`
- [Transaction prediction](https://github.com/shreyakm21/fraud-detection-system/blob/main/ML_model.py): `ML_model.py`

### Data and outputs

- [Labeled transactions](https://github.com/shreyakm21/fraud-detection-system/blob/main/FraudTrainData.csv): `FraudTrainData.csv`
- [Prediction result CSV](https://github.com/shreyakm21/fraud-detection-system/blob/main/ML_model.py): `ML_model.py`

### Other components

- **User**

## Connections

- User → Streamlit UI: enters or uploads (evidence: `Fraud_Detection_UI.py`)
- Streamlit UI → Model training: requests training (evidence: `Fraud_Detection_UI.py`)
- Model training → Labeled transactions: reads (evidence: `ML_model.py`)
- Model training → Model evaluation: evaluates predictions (evidence: `ML_model.py`)
- Streamlit UI → Transaction prediction: requests prediction (evidence: `Fraud_Detection_UI.py`)
- Transaction prediction → Prediction result CSV: writes uploaded results (evidence: `ML_model.py`)
- Transaction prediction → Streamlit UI: returns prediction results (evidence: `Fraud_Detection_UI.py`)
- Streamlit UI → Result visualizations: renders upload charts (evidence: `Fraud_Detection_UI.py`)
