# hirdeshpal888527/graphsentinel architecture

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

- Interactive diagram: https://gitdiagram.com/hirdeshpal888527/graphsentinel
- Repository: https://github.com/hirdeshpal888527/graphsentinel

## Overview

GraphSentinel combines transaction-level fraud scoring, account-network analysis, interpretable rules and GraphSAGE experiments, then serves results through a FastAPI API and React investigation dashboard. The graph preserves the documented analytical stages and dashboard capabilities; several training and data-preparation links are documented in the README rather than shown in sampled implementation excerpts.

Main entry points: [`frontend/src/App.jsx`](https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/App.jsx) (Dashboard shell), [`backend/routes.py`](https://github.com/hirdeshpal888527/graphsentinel/blob/main/backend/routes.py) (API routes), [`backend/services.py`](https://github.com/hirdeshpal888527/graphsentinel/blob/main/backend/services.py) (Prediction services), [`src/data_processor.py`](https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/data_processor.py) (Feature engineering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_analysis["Fraud analysis"]
  node_clean["Data preparation<br/>[data_cleaner.py]"]
  node_features["Feature engineering<br/>[data_processor.py]"]
  node_classical["Transaction ML<br/>[train_ml_model.py]"]
  node_graph["Account graph<br/>[graph_builder.py]"]
  node_graph_analysis["Graph analysis"]
  node_rules["Rule detection<br/>[fraud_detector.py]"]
  node_gnn["GraphSAGE learning<br/>[train_gnn_model.py]"]
end

subgraph group_api["API and artifacts"]
  node_artifacts[("Model artifacts")]
  node_processed[("Analysis outputs")]
  node_api_app["FastAPI app<br/>[app.py]"]
  node_routes["API routes<br/>[routes.py]"]
  node_schemas["Request schemas<br/>[schemas.py]"]
  node_services["Prediction services<br/>[services.py]"]
end

subgraph group_dashboard["Analyst dashboard"]
  node_web["Dashboard shell<br/>[App.jsx]"]
  node_scoring["Transaction scoring"]
  node_queue["Risk queue<br/>[RiskQueue.jsx]"]
  node_details["Transaction detail"]
  node_cases["Case review<br/>[CaseReview.jsx]"]
  node_graph_ui["Graph intelligence"]
  node_performance["Model performance"]
  node_signals["Rules and signals<br/>[RulesSignals.jsx]"]
  node_overview["Overview<br/>[Overview.jsx]"]
end

node_analyst(("Analyst"))
node_transactions["Transaction data"]

node_transactions -->|"prepares"| node_clean
node_clean -->|"engineers features"| node_features
node_features -->|"trains"| node_classical
node_transactions -->|"builds network"| node_graph
node_graph -->|"analyzes structure"| node_graph_analysis
node_features -->|"supports learning"| node_gnn
node_classical -.->|"produces model"| node_artifacts
node_gnn -.->|"produces model"| node_artifacts
node_graph_analysis -->|"informs risk"| node_rules
node_transactions -->|"scores signals"| node_rules
node_artifacts -->|"loads models"| node_services
node_processed -->|"loads metrics"| node_services
node_api_app -->|"registers routes"| node_routes
node_api_app -->|"preloads artifacts"| node_services
node_routes -->|"validates requests"| node_schemas
node_routes -->|"calls prediction"| node_services
node_scoring -->|"requests scoring"| node_routes
node_web -->|"renders"| node_scoring
node_web -->|"renders"| node_queue
node_web -->|"renders"| node_graph_ui
node_web -->|"renders"| node_performance
node_web -->|"renders"| node_signals
node_web -->|"renders"| node_cases
node_web -->|"renders"| node_overview
node_queue -->|"opens details"| node_details
node_analyst -->|"investigates"| node_web
node_analyst -->|"reviews risk"| node_queue

click node_clean "https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/data_cleaner.py"
click node_features "https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/data_processor.py"
click node_classical "https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/train_ml_model.py"
click node_graph "https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/graph_builder.py"
click node_graph_analysis "https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/advanced_graph_analysis.py"
click node_rules "https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/fraud_detector.py"
click node_gnn "https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/train_gnn_model.py"
click node_artifacts "https://github.com/hirdeshpal888527/graphsentinel/tree/main/models"
click node_processed "https://github.com/hirdeshpal888527/graphsentinel/tree/main/data/processed"
click node_api_app "https://github.com/hirdeshpal888527/graphsentinel/blob/main/backend/app.py"
click node_routes "https://github.com/hirdeshpal888527/graphsentinel/blob/main/backend/routes.py"
click node_schemas "https://github.com/hirdeshpal888527/graphsentinel/blob/main/backend/schemas.py"
click node_services "https://github.com/hirdeshpal888527/graphsentinel/blob/main/backend/services.py"
click node_web "https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/App.jsx"
click node_scoring "https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/pages/TransactionScoring.jsx"
click node_queue "https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/pages/RiskQueue.jsx"
click node_details "https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/components/TransactionDetail.jsx"
click node_cases "https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/pages/CaseReview.jsx"
click node_graph_ui "https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/pages/GraphIntelligence.jsx"
click node_performance "https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/pages/ModelPerformance.jsx"
click node_signals "https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/pages/RulesSignals.jsx"
click node_overview "https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/pages/Overview.jsx"

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_clean,node_features,node_classical,node_graph,node_graph_analysis,node_rules,node_gnn toneBlue
class node_artifacts,node_processed,node_api_app,node_routes,node_schemas,node_services toneAmber
class node_web,node_scoring,node_queue,node_details,node_cases,node_graph_ui,node_performance,node_signals,node_overview toneMint
class node_analyst,node_transactions toneIndigo
```

## Components

### Fraud analysis

- [Data preparation](https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/data_cleaner.py): `src/data_cleaner.py`
- [Feature engineering](https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/data_processor.py): `src/data_processor.py`
- [Transaction ML](https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/train_ml_model.py): `src/train_ml_model.py`
- [Account graph](https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/graph_builder.py): `src/graph_builder.py`
- [Graph analysis](https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/advanced_graph_analysis.py): `src/advanced_graph_analysis.py`
- [Rule detection](https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/fraud_detector.py): `src/fraud_detector.py`
- [GraphSAGE learning](https://github.com/hirdeshpal888527/graphsentinel/blob/main/src/train_gnn_model.py): `src/train_gnn_model.py`

### API and artifacts

- [Model artifacts](https://github.com/hirdeshpal888527/graphsentinel/tree/main/models): `models`
- [Analysis outputs](https://github.com/hirdeshpal888527/graphsentinel/tree/main/data/processed): `data/processed`
- [FastAPI app](https://github.com/hirdeshpal888527/graphsentinel/blob/main/backend/app.py): `backend/app.py`
- [API routes](https://github.com/hirdeshpal888527/graphsentinel/blob/main/backend/routes.py): `backend/routes.py`
- [Request schemas](https://github.com/hirdeshpal888527/graphsentinel/blob/main/backend/schemas.py): `backend/schemas.py`
- [Prediction services](https://github.com/hirdeshpal888527/graphsentinel/blob/main/backend/services.py): `backend/services.py`

### Analyst dashboard

- [Dashboard shell](https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Transaction scoring](https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/pages/TransactionScoring.jsx): `frontend/src/pages/TransactionScoring.jsx`
- [Risk queue](https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/pages/RiskQueue.jsx): `frontend/src/pages/RiskQueue.jsx`
- [Transaction detail](https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/components/TransactionDetail.jsx): `frontend/src/components/TransactionDetail.jsx`
- [Case review](https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/pages/CaseReview.jsx): `frontend/src/pages/CaseReview.jsx`
- [Graph intelligence](https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/pages/GraphIntelligence.jsx): `frontend/src/pages/GraphIntelligence.jsx`
- [Model performance](https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/pages/ModelPerformance.jsx): `frontend/src/pages/ModelPerformance.jsx`
- [Rules and signals](https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/pages/RulesSignals.jsx): `frontend/src/pages/RulesSignals.jsx`
- [Overview](https://github.com/hirdeshpal888527/graphsentinel/blob/main/frontend/src/pages/Overview.jsx): `frontend/src/pages/Overview.jsx`

### Other components

- **Analyst**
- **Transaction data**

## Connections

- Transaction data → Data preparation: prepares (evidence: `README.md`)
- Data preparation → Feature engineering: engineers features (evidence: `README.md`)
- Feature engineering → Transaction ML: trains (evidence: `README.md`)
- Transaction data → Account graph: builds network (evidence: `README.md`)
- Account graph → Graph analysis: analyzes structure (evidence: `README.md`)
- Feature engineering → GraphSAGE learning: supports learning (evidence: `README.md`)
- Transaction ML → Model artifacts: produces model
- GraphSAGE learning → Model artifacts: produces model
- Graph analysis → Rule detection: informs risk (evidence: `README.md`)
- Transaction data → Rule detection: scores signals (evidence: `README.md`)
- Model artifacts → Prediction services: loads models (evidence: `backend/services.py`)
- Analysis outputs → Prediction services: loads metrics (evidence: `backend/services.py`)
- FastAPI app → API routes: registers routes (evidence: `backend/app.py`)
- FastAPI app → Prediction services: preloads artifacts (evidence: `backend/app.py`)
- API routes → Request schemas: validates requests (evidence: `backend/routes.py`)
- API routes → Prediction services: calls prediction (evidence: `backend/routes.py`)
- Transaction scoring → API routes: requests scoring (evidence: `README.md`)
- Dashboard shell → Transaction scoring: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Risk queue: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Graph intelligence: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Model performance: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Rules and signals: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Case review: renders (evidence: `frontend/src/App.jsx`)
- Dashboard shell → Overview: renders (evidence: `frontend/src/App.jsx`)
- Risk queue → Transaction detail: opens details (evidence: `frontend/src/pages/RiskQueue.jsx`)
- Analyst → Dashboard shell: investigates (evidence: `README.md`)
- Analyst → Risk queue: reviews risk (evidence: `README.md`)
