# koharani-2011/graph-fraud-analysis architecture

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

- Interactive diagram: https://gitdiagram.com/koharani-2011/graph-fraud-analysis
- Repository: https://github.com/koharani-2011/graph-fraud-analysis

## Overview

Graph Fraud Analytics combines a browser-based upload/results dashboard, a FastAPI analysis endpoint, and graph-model training and evaluation code. The demonstrated upload path accepts CSV/Excel, sends it through the frontend API boundary, constructs graph data in the backend service, runs EvolveGCN inference, and returns summary counts and a time series for display. Separate temporal training code prepares time-step snapshots and evaluates future steps; custom GAT and benchmark models provide documented alternatives. The frontend API’s HTTP target is not shown, so that integration is marked unverified.

Main entry points: [`frontend/src/App.jsx`](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/frontend/src/App.jsx) (Dashboard app), [`frontend/src/components/UploadSection.jsx`](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/frontend/src/components/UploadSection.jsx) (Dataset upload), [`train_temporal.py`](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/train_temporal.py) (Temporal training), [`backend/main.py`](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/backend/main.py) (FastAPI endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Analysis dashboard"]
  node_upload["Dataset upload<br/>[UploadSection.jsx]"]
  node_client_api["Frontend API<br/>[api.jsx]"]
  node_dashboard["Results dashboard"]
  node_app["Dashboard app<br/>[App.jsx]"]
  node_logo["Graph logo<br/>[Logo.jsx]"]
end

subgraph group_api["Inference service"]
  node_http_api["FastAPI endpoint<br/>[main.py]"]
  node_fraud_service["File analysis<br/>[services.py]"]
end

subgraph group_learning["Models and training"]
  node_evolve_model["EvolveGCN inference<br/>[evolvegcn.py]"]
  node_temporal_data["Temporal snapshots<br/>[train_temporal.py]"]
  node_temporal_training["Temporal training<br/>[train_temporal.py]"]
  node_gat_model["Custom GAT<br/>[model.py]"]
  node_gat_layer["Attention layer<br/>[layer.py]"]
  node_benchmarks["GNN benchmarks<br/>[models.py]"]
  node_training_runner["Training runner<br/>[train.py]"]
end

subgraph group_evaluation["Evaluation outputs"]
  node_evaluation["Model evaluation"]
  node_plots["Metric plotting<br/>[plot_results.py]"]
end

node_analyst(("Analyst"))

node_analyst -->|"selects file"| node_upload
node_upload -->|"calls analysis"| node_client_api
node_client_api -.->|"submits file"| node_http_api
node_http_api -->|"calls analysis"| node_fraud_service
node_fraud_service -->|"runs inference"| node_evolve_model
node_http_api -.->|"returns results"| node_client_api
node_app -->|"renders"| node_upload
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_logo
node_upload -->|"sets results"| node_app
node_dashboard -->|"shows summary"| node_analyst
node_temporal_training -->|"uses snapshots"| node_temporal_data
node_temporal_training -->|"trains or evaluates"| node_evolve_model
node_temporal_training -->|"trains baseline"| node_gat_model
node_gat_model -->|"composes layers"| node_gat_layer
node_training_runner -->|"imports model"| node_gat_model
node_evaluation -->|"uses model"| node_evolve_model
node_evaluation -.->|"produces plots"| node_plots

click node_upload "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/frontend/src/components/UploadSection.jsx"
click node_client_api "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/frontend/src/api.jsx"
click node_dashboard "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/frontend/src/components/DashboardResults.jsx"
click node_app "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/frontend/src/App.jsx"
click node_logo "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/frontend/src/components/Logo.jsx"
click node_http_api "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/backend/main.py"
click node_fraud_service "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/backend/services.py"
click node_evolve_model "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/models/evolvegcn.py"
click node_temporal_data "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/train_temporal.py"
click node_temporal_training "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/train_temporal.py"
click node_gat_model "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/custom_gat/model.py"
click node_gat_layer "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/custom_gat/layer.py"
click node_benchmarks "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/models/models.py"
click node_training_runner "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/train.py"
click node_evaluation "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/evaluate_and_plot.py"
click node_plots "https://github.com/koharani-2011/graph-fraud-analysis/blob/master/plot_results.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_upload,node_client_api,node_dashboard,node_app,node_logo toneBlue
class node_http_api,node_fraud_service toneAmber
class node_evolve_model,node_temporal_data,node_temporal_training,node_gat_model,node_gat_layer,node_benchmarks,node_training_runner toneMint
class node_evaluation,node_plots toneRose
class node_analyst toneIndigo
```

## Components

### Analysis dashboard

- [Dataset upload](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/frontend/src/components/UploadSection.jsx): `frontend/src/components/UploadSection.jsx`
- [Frontend API](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/frontend/src/api.jsx): `frontend/src/api.jsx`
- [Results dashboard](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/frontend/src/components/DashboardResults.jsx): `frontend/src/components/DashboardResults.jsx`
- [Dashboard app](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Graph logo](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/frontend/src/components/Logo.jsx): `frontend/src/components/Logo.jsx`

### Inference service

- [FastAPI endpoint](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/backend/main.py): `backend/main.py`
- [File analysis](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/backend/services.py): `backend/services.py`

### Models and training

- [EvolveGCN inference](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/models/evolvegcn.py): `models/evolvegcn.py`
- [Temporal snapshots](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/train_temporal.py): `train_temporal.py`
- [Temporal training](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/train_temporal.py): `train_temporal.py`
- [Custom GAT](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/custom_gat/model.py): `custom_gat/model.py`
- [Attention layer](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/custom_gat/layer.py): `custom_gat/layer.py`
- [GNN benchmarks](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/models/models.py): `models/models.py`
- [Training runner](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/train.py): `train.py`

### Evaluation outputs

- [Model evaluation](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/evaluate_and_plot.py): `evaluate_and_plot.py`
- [Metric plotting](https://github.com/koharani-2011/graph-fraud-analysis/blob/master/plot_results.py): `plot_results.py`

### Other components

- **Analyst**

## Connections

- Analyst → Dataset upload: selects file (evidence: `frontend/src/components/UploadSection.jsx`)
- Dataset upload → Frontend API: calls analysis (evidence: `frontend/src/components/UploadSection.jsx`)
- Frontend API → FastAPI endpoint: submits file
- FastAPI endpoint → File analysis: calls analysis (evidence: `backend/main.py`)
- File analysis → EvolveGCN inference: runs inference (evidence: `backend/services.py`)
- FastAPI endpoint → Frontend API: returns results
- Dashboard app → Dataset upload: renders (evidence: `frontend/src/App.jsx`)
- Dashboard app → Results dashboard: renders (evidence: `frontend/src/App.jsx`)
- Dashboard app → Graph logo: renders (evidence: `frontend/src/App.jsx`)
- Dataset upload → Dashboard app: sets results (evidence: `frontend/src/App.jsx`)
- Results dashboard → Analyst: shows summary (evidence: `frontend/src/components/DashboardResults.jsx`)
- Temporal training → Temporal snapshots: uses snapshots (evidence: `train_temporal.py`)
- Temporal training → EvolveGCN inference: trains or evaluates (evidence: `train_temporal.py`)
- Temporal training → Custom GAT: trains baseline (evidence: `train_temporal.py`)
- Custom GAT → Attention layer: composes layers (evidence: `custom_gat/model.py`)
- Training runner → Custom GAT: imports model (evidence: `train.py`)
- Model evaluation → EvolveGCN inference: uses model (evidence: `evaluate_and_plot.py`)
- Model evaluation → Metric plotting: produces plots
