# smaranvelpula/explainable-ai-in-secure-financial-analytics architecture

> Architecture diagram of the GitHub repository smaranvelpula/explainable-ai-in-secure-financial-analytics, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/smaranvelpula/explainable-ai-in-secure-financial-analytics
- Repository: https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics

## Overview

SecureScan AI lets an analyst submit transaction details, receive a fraud-risk assessment, and inspect probability, feature contributions, and a human-readable explanation. The React dashboard calls a FastAPI prediction endpoint; the backend prepares features, applies the saved preprocessor and XGBoost model, and returns risk and SHAP results. The sampled backend and dashboard excerpts support this flow. The README documents the broader analytics capabilities, but no separate implementation modules for them appear in the supplied tree.

Main entry points: [`backend/app.py`](https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/backend/app.py) (Prediction Endpoint), [`frontend/src/App.jsx`](https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/frontend/src/App.jsx) (Transaction Dashboard), [`frontend/src/main.jsx`](https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/frontend/src/main.jsx) (React Entry), [`backend/preprocessor.pkl`](https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/backend/preprocessor.pkl) (Feature Preprocessor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Analyst Dashboard"]
  node_dashboard["Transaction Dashboard<br/>[App.jsx]"]
  node_app_entry["React Entry<br/>[main.jsx]"]
  node_risk_view["Risk Analytics View<br/>[App.jsx]"]
  node_explanation_view["Explanation Narrative<br/>[App.jsx]"]
end

subgraph group_service["Prediction Service"]
  node_predict_api["Prediction Endpoint<br/>[app.py]"]
  node_feature_prep["Transaction Feature Prep<br/>[app.py]"]
  node_risk_explanation["Risk and SHAP Results<br/>[app.py]"]
end

subgraph group_model["Model Assets"]
  node_model_transform["Feature Preprocessor<br/>[preprocessor.pkl]"]
  node_xgb_model["XGBoost Model<br/>[xgboost_model.json]"]
end

node_analyst(("Fraud Analyst"))

node_analyst -->|"enters transaction"| node_dashboard
node_app_entry -->|"renders"| node_dashboard
node_dashboard -->|"posts features"| node_predict_api
node_predict_api -->|"prepares input"| node_feature_prep
node_predict_api -->|"transforms features"| node_model_transform
node_predict_api -->|"predicts risk"| node_xgb_model
node_predict_api -->|"computes risk and SHAP"| node_risk_explanation
node_predict_api -->|"returns assessment"| node_dashboard
node_dashboard -->|"renders analytics"| node_risk_view
node_dashboard -->|"renders narrative"| node_explanation_view

click node_dashboard "https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/frontend/src/App.jsx"
click node_app_entry "https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/frontend/src/main.jsx"
click node_risk_view "https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/frontend/src/App.jsx"
click node_explanation_view "https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/frontend/src/App.jsx"
click node_predict_api "https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/backend/app.py"
click node_feature_prep "https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/backend/app.py"
click node_model_transform "https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/backend/preprocessor.pkl"
click node_xgb_model "https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/backend/xgboost_model.json"
click node_risk_explanation "https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/backend/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_dashboard,node_app_entry,node_risk_view,node_explanation_view toneBlue
class node_predict_api,node_feature_prep,node_risk_explanation toneAmber
class node_model_transform,node_xgb_model toneMint
class node_analyst toneIndigo
```

## Components

### Analyst Dashboard

- [Transaction Dashboard](https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [React Entry](https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/frontend/src/main.jsx): `frontend/src/main.jsx`
- [Risk Analytics View](https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Explanation Narrative](https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### Prediction Service

- [Prediction Endpoint](https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/backend/app.py): `backend/app.py`
- [Transaction Feature Prep](https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/backend/app.py): `backend/app.py`
- [Risk and SHAP Results](https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/backend/app.py): `backend/app.py`

### Model Assets

- [Feature Preprocessor](https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/backend/preprocessor.pkl): `backend/preprocessor.pkl`
- [XGBoost Model](https://github.com/smaranvelpula/explainable-ai-in-secure-financial-analytics/blob/main/backend/xgboost_model.json): `backend/xgboost_model.json`

### Other components

- **Fraud Analyst**

## Connections

- Fraud Analyst → Transaction Dashboard: enters transaction (evidence: `README.md`)
- React Entry → Transaction Dashboard: renders (evidence: `frontend/src/main.jsx`)
- Transaction Dashboard → Prediction Endpoint: posts features (evidence: `frontend/src/App.jsx`)
- Prediction Endpoint → Transaction Feature Prep: prepares input (evidence: `backend/app.py`)
- Prediction Endpoint → Feature Preprocessor: transforms features (evidence: `backend/app.py`)
- Prediction Endpoint → XGBoost Model: predicts risk (evidence: `backend/app.py`)
- Prediction Endpoint → Risk and SHAP Results: computes risk and SHAP (evidence: `backend/app.py`)
- Prediction Endpoint → Transaction Dashboard: returns assessment (evidence: `frontend/src/App.jsx`)
- Transaction Dashboard → Risk Analytics View: renders analytics (evidence: `frontend/src/App.jsx`)
- Transaction Dashboard → Explanation Narrative: renders narrative (evidence: `frontend/src/App.jsx`)
