# ghosh-roni3342/financial-fraud-detection architecture

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

- Interactive diagram: https://gitdiagram.com/ghosh-roni3342/financial-fraud-detection
- Repository: https://github.com/ghosh-roni3342/financial-fraud-detection

## Overview

This is a local fraud-detection analysis workspace: supplied transaction datasets are prepared and benchmarked through optional training, then saved model results can be explored and transactions scored in a Streamlit dashboard or by CSV command. The graph separates data preparation, model training, saved outputs, and user-facing analysis. It reflects documented dashboard capabilities, but does not imply live bank feeds or external alerting. Evidence is limited to the README and sampled source excerpts; report generation is excluded as supporting documentation infrastructure.

Main entry points: [`app.py`](https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/app.py) (Streamlit dashboard), [`predict.py`](https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/predict.py) (CSV prediction), [`train.py`](https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/train.py) (Train and evaluate), [`src/data.py`](https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/src/data.py) (Load and features)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Data preparation"]
  node_datasets[("Transaction datasets")]
  node_prepare["Load and features<br/>[data.py]"]
end

subgraph group_modeling["Model training"]
  node_algorithms["Model candidates<br/>[models.py]"]
  node_training["Train and evaluate<br/>[train.py]"]
  node_model_scoring["Score models<br/>[models.py]"]
end

subgraph group_outputs["Saved outputs"]
  node_artifacts["Models and results"]
end

subgraph group_product["Fraud analysis"]
  node_dashboard["Streamlit dashboard<br/>[app.py]"]
  node_overview["Data overview<br/>[app.py]"]
  node_comparison["Model comparison<br/>[app.py]"]
  node_interactive_prediction["Transaction prediction<br/>[app.py]"]
  node_replay["Test-row replay<br/>[app.py]"]
  node_cli_prediction["CSV prediction<br/>[predict.py]"]
end

node_analyst(("Analyst"))
node_prediction_csv["CSV input"]

node_analyst -->|"uses"| node_dashboard
node_datasets -->|"loads"| node_prepare
node_training -->|"loads and prepares"| node_prepare
node_training -->|"builds candidates"| node_algorithms
node_training -->|"scores models"| node_model_scoring
node_training -->|"writes models and results"| node_artifacts
node_dashboard -->|"reads saved results"| node_artifacts
node_dashboard -->|"prepares inputs"| node_prepare
node_dashboard -->|"scores transactions"| node_model_scoring
node_dashboard -->|"renders"| node_overview
node_dashboard -->|"renders"| node_comparison
node_dashboard -->|"renders"| node_interactive_prediction
node_dashboard -->|"renders"| node_replay
node_analyst -->|"runs"| node_cli_prediction
node_prediction_csv -->|"provides rows"| node_cli_prediction
node_cli_prediction -->|"loads saved model"| node_artifacts
node_cli_prediction -->|"prepares features"| node_prepare
node_cli_prediction -->|"scores rows"| node_model_scoring

click node_datasets "https://github.com/ghosh-roni3342/financial-fraud-detection/tree/main/data"
click node_prepare "https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/src/data.py"
click node_algorithms "https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/src/models.py"
click node_training "https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/train.py"
click node_artifacts "https://github.com/ghosh-roni3342/financial-fraud-detection/tree/main/artifacts"
click node_model_scoring "https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/src/models.py"
click node_dashboard "https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/app.py"
click node_overview "https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/app.py"
click node_comparison "https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/app.py"
click node_interactive_prediction "https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/app.py"
click node_replay "https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/app.py"
click node_cli_prediction "https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/predict.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_datasets,node_prepare toneBlue
class node_algorithms,node_training,node_model_scoring toneAmber
class node_artifacts toneMint
class node_dashboard,node_overview,node_comparison,node_interactive_prediction,node_replay,node_cli_prediction toneRose
class node_analyst,node_prediction_csv toneIndigo
```

## Components

### Data preparation

- [Transaction datasets](https://github.com/ghosh-roni3342/financial-fraud-detection/tree/main/data): `data`
- [Load and features](https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/src/data.py): `src/data.py`

### Model training

- [Model candidates](https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/src/models.py): `src/models.py`
- [Train and evaluate](https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/train.py): `train.py`
- [Score models](https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/src/models.py): `src/models.py`

### Saved outputs

- [Models and results](https://github.com/ghosh-roni3342/financial-fraud-detection/tree/main/artifacts): `artifacts`

### Fraud analysis

- [Streamlit dashboard](https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/app.py): `app.py`
- [Data overview](https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/app.py): `app.py`
- [Model comparison](https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/app.py): `app.py`
- [Transaction prediction](https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/app.py): `app.py`
- [Test-row replay](https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/app.py): `app.py`
- [CSV prediction](https://github.com/ghosh-roni3342/financial-fraud-detection/blob/main/predict.py): `predict.py`

### Other components

- **Analyst**
- **CSV input**

## Connections

- Analyst → Streamlit dashboard: uses (evidence: `README.md`)
- Transaction datasets → Load and features: loads (evidence: `src/data.py`)
- Train and evaluate → Load and features: loads and prepares (evidence: `train.py`)
- Train and evaluate → Model candidates: builds candidates (evidence: `train.py`)
- Train and evaluate → Score models: scores models (evidence: `train.py`)
- Train and evaluate → Models and results: writes models and results (evidence: `train.py`)
- Streamlit dashboard → Models and results: reads saved results (evidence: `app.py`)
- Streamlit dashboard → Load and features: prepares inputs (evidence: `app.py`)
- Streamlit dashboard → Score models: scores transactions (evidence: `app.py`)
- Streamlit dashboard → Data overview: renders (evidence: `README.md`)
- Streamlit dashboard → Model comparison: renders (evidence: `README.md`)
- Streamlit dashboard → Transaction prediction: renders (evidence: `README.md`)
- Streamlit dashboard → Test-row replay: renders (evidence: `README.md`)
- Analyst → CSV prediction: runs (evidence: `README.md`)
- CSV input → CSV prediction: provides rows (evidence: `predict.py`)
- CSV prediction → Models and results: loads saved model (evidence: `predict.py`)
- CSV prediction → Load and features: prepares features (evidence: `predict.py`)
- CSV prediction → Score models: scores rows (evidence: `predict.py`)
