# sarathygit/ieee architecture

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

- Interactive diagram: https://gitdiagram.com/sarathygit/ieee
- Repository: https://github.com/sarathygit/ieee

## Overview

FinGuard is a UPI payment switch with inline fraud scoring and a monitoring dashboard. The main workflow is dashboard payment submission, switch-side account checks and ledger locking, synchronous ML scoring, then either settlement or fraud blocking with an audit record. The Python service serves a hybrid rules-and-anomaly model; separate training and evaluation modules support that scoring capability. Source excerpts establish the principal calls, but do not expose all HTTP client or model-training wiring, so uncertain links are omitted or marked dashed.

Main entry points: [`switch-service/src/main/java/com/finguard/switchsvc/service/PaymentService.java`](https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/service/PaymentService.java) (Payment Orchestrator), [`switch-service/src/main/java/com/finguard/switchsvc/controller/UpiPaymentController.java`](https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/controller/UpiPaymentController.java) (UPI REST API), [`switch-service/src/main/java/com/finguard/switchsvc/repository/UserRepository.java`](https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/repository/UserRepository.java) (User Repository), [`switch-service/src/main/java/com/finguard/switchsvc/repository/TransactionLogRepository.java`](https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/repository/TransactionLogRepository.java) (Audit Repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["UPI Dashboard"]
  node_dashboard["Payment Dashboard<br/>[App.jsx]"]
  node_client_api["Dashboard API<br/>[api.js]"]
  node_telemetry["Client Telemetry<br/>[telemetry.js]"]
end

subgraph group_switch["Payment Switch"]
  node_controller["UPI REST API"]
  node_payment["Payment Orchestrator"]
  node_fraud_client["Scoring Client"]
  node_security["Fraud Account Lock"]
end

subgraph group_storage["Accounts And Audit"]
  node_users[("User Accounts<br/>[User.java]")]
  node_balances[("Balance Ledger<br/>[Balance.java]")]
  node_audit[("Transaction Audit")]
  node_user_repo["User Repository"]
  node_balance_repo["Balance Repository"]
  node_audit_repo["Audit Repository"]
end

subgraph group_scoring["Fraud Scoring"]
  node_ml_api["Scoring API<br/>[app.py]"]
  node_hybrid["Hybrid Risk Engine<br/>[hybrid.py]"]
end

subgraph group_modelops["Model Development"]
  node_trainer["Model Training<br/>[train_hybrid.py]"]
  node_baseline_train["Baseline Training<br/>[train.py]"]
  node_evaluation["Fraud Evaluation<br/>[evaluate.py]"]
  node_extended_eval["Extended Evaluation"]
  node_hybrid_eval["Hybrid Evaluation<br/>[evaluate_hybrid.py]"]
end

node_user(("Payment Operator"))
node_database[("Relational Database")]

node_user -->|"submits payment"| node_dashboard
node_dashboard -->|"calls"| node_client_api
node_dashboard -->|"collects"| node_telemetry
node_client_api -.->|"HTTP requests"| node_controller
node_controller -->|"processes payment"| node_payment
node_controller -->|"reads account"| node_user_repo
node_controller -->|"reads balance"| node_balance_repo
node_controller -->|"lists transactions"| node_audit_repo
node_payment -->|"resolves payer"| node_user_repo
node_payment -->|"locks balances"| node_balance_repo
node_payment -->|"requests score"| node_fraud_client
node_payment -->|"records outcome"| node_audit_repo
node_payment -->|"records fraud block"| node_security
node_security -->|"locks account"| node_user_repo
node_security -->|"saves blocked audit"| node_audit_repo
node_user_repo -->|"reads and writes"| node_users
node_balance_repo -->|"reads and writes"| node_balances
node_audit_repo -->|"reads and writes"| node_audit
node_users -.->|"persists"| node_database
node_balances -.->|"persists"| node_database
node_audit -.->|"persists"| node_database
node_fraud_client -.->|"sends score request"| node_ml_api
node_ml_api -->|"scores transaction"| node_hybrid
node_trainer -->|"uses scoring engine"| node_hybrid
node_evaluation -->|"supports evaluation"| node_extended_eval
node_evaluation -->|"supports evaluation"| node_hybrid_eval
node_baseline_train -.->|"shares model conventions"| node_evaluation

click node_dashboard "https://github.com/sarathygit/ieee/blob/main/upi-client/src/App.jsx"
click node_client_api "https://github.com/sarathygit/ieee/blob/main/upi-client/src/api.js"
click node_telemetry "https://github.com/sarathygit/ieee/blob/main/upi-client/src/telemetry.js"
click node_controller "https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/controller/UpiPaymentController.java"
click node_payment "https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/service/PaymentService.java"
click node_fraud_client "https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/service/FraudScoringClient.java"
click node_security "https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/service/AccountSecurityService.java"
click node_users "https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/entity/User.java"
click node_balances "https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/entity/Balance.java"
click node_audit "https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/entity/TransactionLog.java"
click node_user_repo "https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/repository/UserRepository.java"
click node_balance_repo "https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/repository/BalanceRepository.java"
click node_audit_repo "https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/repository/TransactionLogRepository.java"
click node_ml_api "https://github.com/sarathygit/ieee/blob/main/ml-service/app.py"
click node_hybrid "https://github.com/sarathygit/ieee/blob/main/ml-service/hybrid.py"
click node_trainer "https://github.com/sarathygit/ieee/blob/main/ml-service/train_hybrid.py"
click node_baseline_train "https://github.com/sarathygit/ieee/blob/main/ml-service/train.py"
click node_evaluation "https://github.com/sarathygit/ieee/blob/main/ml-service/evaluate.py"
click node_extended_eval "https://github.com/sarathygit/ieee/blob/main/ml-service/evaluate_extended.py"
click node_hybrid_eval "https://github.com/sarathygit/ieee/blob/main/ml-service/evaluate_hybrid.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_client_api,node_telemetry toneBlue
class node_controller,node_payment,node_fraud_client,node_security,node_database toneAmber
class node_users,node_balances,node_audit,node_user_repo,node_balance_repo,node_audit_repo toneMint
class node_ml_api,node_hybrid toneRose
class node_trainer,node_baseline_train,node_evaluation,node_extended_eval,node_hybrid_eval,node_user toneIndigo
```

## Components

### UPI Dashboard

- [Payment Dashboard](https://github.com/sarathygit/ieee/blob/main/upi-client/src/App.jsx): `upi-client/src/App.jsx`
- [Dashboard API](https://github.com/sarathygit/ieee/blob/main/upi-client/src/api.js): `upi-client/src/api.js`
- [Client Telemetry](https://github.com/sarathygit/ieee/blob/main/upi-client/src/telemetry.js): `upi-client/src/telemetry.js`

### Payment Switch

- [UPI REST API](https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/controller/UpiPaymentController.java): `switch-service/src/main/java/com/finguard/switchsvc/controller/UpiPaymentController.java`
- [Payment Orchestrator](https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/service/PaymentService.java): `switch-service/src/main/java/com/finguard/switchsvc/service/PaymentService.java`
- [Scoring Client](https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/service/FraudScoringClient.java): `switch-service/src/main/java/com/finguard/switchsvc/service/FraudScoringClient.java`
- [Fraud Account Lock](https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/service/AccountSecurityService.java): `switch-service/src/main/java/com/finguard/switchsvc/service/AccountSecurityService.java`

### Accounts And Audit

- [User Accounts](https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/entity/User.java): `switch-service/src/main/java/com/finguard/switchsvc/entity/User.java`
- [Balance Ledger](https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/entity/Balance.java): `switch-service/src/main/java/com/finguard/switchsvc/entity/Balance.java`
- [Transaction Audit](https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/entity/TransactionLog.java): `switch-service/src/main/java/com/finguard/switchsvc/entity/TransactionLog.java`
- [User Repository](https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/repository/UserRepository.java): `switch-service/src/main/java/com/finguard/switchsvc/repository/UserRepository.java`
- [Balance Repository](https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/repository/BalanceRepository.java): `switch-service/src/main/java/com/finguard/switchsvc/repository/BalanceRepository.java`
- [Audit Repository](https://github.com/sarathygit/ieee/blob/main/switch-service/src/main/java/com/finguard/switchsvc/repository/TransactionLogRepository.java): `switch-service/src/main/java/com/finguard/switchsvc/repository/TransactionLogRepository.java`

### Fraud Scoring

- [Scoring API](https://github.com/sarathygit/ieee/blob/main/ml-service/app.py): `ml-service/app.py`
- [Hybrid Risk Engine](https://github.com/sarathygit/ieee/blob/main/ml-service/hybrid.py): `ml-service/hybrid.py`

### Model Development

- [Model Training](https://github.com/sarathygit/ieee/blob/main/ml-service/train_hybrid.py): `ml-service/train_hybrid.py`
- [Baseline Training](https://github.com/sarathygit/ieee/blob/main/ml-service/train.py): `ml-service/train.py`
- [Fraud Evaluation](https://github.com/sarathygit/ieee/blob/main/ml-service/evaluate.py): `ml-service/evaluate.py`
- [Extended Evaluation](https://github.com/sarathygit/ieee/blob/main/ml-service/evaluate_extended.py): `ml-service/evaluate_extended.py`
- [Hybrid Evaluation](https://github.com/sarathygit/ieee/blob/main/ml-service/evaluate_hybrid.py): `ml-service/evaluate_hybrid.py`

### Other components

- **Payment Operator**
- **Relational Database**

## Connections

- Payment Operator → Payment Dashboard: submits payment (evidence: `upi-client/src/App.jsx`)
- Payment Dashboard → Dashboard API: calls (evidence: `upi-client/src/App.jsx`)
- Payment Dashboard → Client Telemetry: collects (evidence: `upi-client/src/App.jsx`)
- Dashboard API → UPI REST API: HTTP requests
- UPI REST API → Payment Orchestrator: processes payment (evidence: `switch-service/src/main/java/com/finguard/switchsvc/controller/UpiPaymentController.java`)
- UPI REST API → User Repository: reads account (evidence: `switch-service/src/main/java/com/finguard/switchsvc/controller/UpiPaymentController.java`)
- UPI REST API → Balance Repository: reads balance (evidence: `switch-service/src/main/java/com/finguard/switchsvc/controller/UpiPaymentController.java`)
- UPI REST API → Audit Repository: lists transactions (evidence: `switch-service/src/main/java/com/finguard/switchsvc/controller/UpiPaymentController.java`)
- Payment Orchestrator → User Repository: resolves payer (evidence: `switch-service/src/main/java/com/finguard/switchsvc/service/PaymentService.java`)
- Payment Orchestrator → Balance Repository: locks balances (evidence: `switch-service/src/main/java/com/finguard/switchsvc/service/PaymentService.java`)
- Payment Orchestrator → Scoring Client: requests score (evidence: `switch-service/src/main/java/com/finguard/switchsvc/service/PaymentService.java`)
- Payment Orchestrator → Audit Repository: records outcome (evidence: `switch-service/src/main/java/com/finguard/switchsvc/service/PaymentService.java`)
- Payment Orchestrator → Fraud Account Lock: records fraud block (evidence: `switch-service/src/main/java/com/finguard/switchsvc/service/PaymentService.java`)
- Fraud Account Lock → User Repository: locks account (evidence: `switch-service/src/main/java/com/finguard/switchsvc/service/AccountSecurityService.java`)
- Fraud Account Lock → Audit Repository: saves blocked audit (evidence: `switch-service/src/main/java/com/finguard/switchsvc/service/AccountSecurityService.java`)
- User Repository → User Accounts: reads and writes (evidence: `switch-service/src/main/java/com/finguard/switchsvc/repository/UserRepository.java`)
- Balance Repository → Balance Ledger: reads and writes (evidence: `switch-service/src/main/java/com/finguard/switchsvc/repository/BalanceRepository.java`)
- Audit Repository → Transaction Audit: reads and writes (evidence: `switch-service/src/main/java/com/finguard/switchsvc/repository/TransactionLogRepository.java`)
- User Accounts → Relational Database: persists
- Balance Ledger → Relational Database: persists
- Transaction Audit → Relational Database: persists
- Scoring Client → Scoring API: sends score request
- Scoring API → Hybrid Risk Engine: scores transaction (evidence: `ml-service/app.py`)
- Model Training → Hybrid Risk Engine: uses scoring engine (evidence: `ml-service/train_hybrid.py`)
- Fraud Evaluation → Extended Evaluation: supports evaluation (evidence: `ml-service/evaluate_extended.py`)
- Fraud Evaluation → Hybrid Evaluation: supports evaluation (evidence: `ml-service/evaluate_hybrid.py`)
- Baseline Training → Fraud Evaluation: shares model conventions
