ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
β βββββββ βββββββββ βββββββ ββββββββ β
β βββββββββββββββββββββββββ ββββββββ β
β ββββββββ βββ βββ ββββββββββββ β
β ββββββββ βββ βββ βββββββββββ β
β βββ βββ βββ βββββββββββββββββ β
β βββ βββ βββ βββββββ ββββββββ β
β β
β π Real-Time Gross Settlement Risk Analysis β
β π§ AI-Powered β’ π Cloud-Native β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
graph TD
A[Traditional Banking Systems] -->|Limited Visibility| B[Money Laundering]
A -->|Manual Review| C[Delayed Detection]
A -->|Isolated Analysis| D[Missed Patterns]
B --> E[Financial Crime]
C --> E
D --> E
E -->|Estimated Loss| F[$2 Trillion Annually]
style A fill:#f5f5f5,stroke:#333,stroke-width:2px
style E fill:#000,stroke:#333,stroke-width:3px,color:#fff
style F fill:#666,stroke:#333,stroke-width:2px,color:#fff
graph TB
subgraph Input["π₯ Data Sources"]
T1[RTGS Transactions]
T2[Account Information]
T3[Historical Data]
end
subgraph Processing["βοΈ Processing Layer"]
S1[Apache Spark Jobs]
S2[Graph Analytics]
S3[ML Clustering]
S4[Risk Scoring]
end
subgraph Storage["πΎ Data Storage"]
DB[DataStax Astra DB<br/>Mumbai Region]
end
subgraph Backend["π§ Backend Services"]
API[Node.js REST API]
Auth[Authentication]
Logic[Business Logic]
end
subgraph Frontend["π₯οΈ User Interface"]
D[Dashboard]
C[Chains View]
A[Account Analysis]
G[Graph Visualization]
end
Input --> Processing
Processing --> Storage
Storage --> Backend
Backend --> Frontend
style Input fill:#f9f9f9,stroke:#333,stroke-width:2px
style Processing fill:#e8e8e8,stroke:#333,stroke-width:2px
style Storage fill:#d4d4d4,stroke:#333,stroke-width:3px
style Backend fill:#c0c0c0,stroke:#333,stroke-width:2px
style Frontend fill:#a8a8a8,stroke:#333,stroke-width:2px
flowchart LR
A[Transaction Stream] --> B{Pattern Analysis}
B -->|Multi-hop| C[Chain Detection]
B -->|Single| D[Normal Flow]
C --> E{Circular?}
E -->|Yes| F[HIGH RISK]
E -->|No| G{Layering?}
G -->|Yes| H[MEDIUM RISK]
G -->|No| I{Rapid?}
I -->|Yes| J[SUSPICIOUS]
I -->|No| K[LOW RISK]
F --> L[Alert System]
H --> L
J --> L
K --> M[Archive]
D --> M
style A fill:#f5f5f5,stroke:#333,stroke-width:2px
style F fill:#000,stroke:#333,stroke-width:3px,color:#fff
style H fill:#666,stroke:#333,stroke-width:2px,color:#fff
style J fill:#999,stroke:#333,stroke-width:2px
style L fill:#333,stroke:#000,stroke-width:3px,color:#fff
graph TB
subgraph Frontend["Frontend Layer"]
UI1[index.html<br/>Dashboard]
UI2[chains.html<br/>Risk Chains]
UI3[account.html<br/>Account Profile]
UI4[graph.html<br/>Network Graph]
CSS[style.css<br/>Glassmorphism UI]
JS[JavaScript ES6+<br/>Chart.js + vis-network]
end
subgraph API["API Gateway"]
REST[Express.js Server<br/>Port 3000]
CORS[CORS Handler]
ROUTES[Route Controllers]
end
subgraph Database["DataStax Astra DB"]
KS[Keyspace: rtgs_risk]
T1[chains table]
T2[accounts table]
T3[risk_features table]
T4[clustering_results table]
T5[audit_log table]
end
subgraph Spark["Apache Spark Cluster"]
J1[Ingestion Job]
J2[Feature Engineering]
J3[ML Clustering]
J4[Chain Detection]
J5[Risk Scoring]
end
Frontend --> API
API --> Database
Spark --> Database
style Frontend fill:#f5f5f5,stroke:#333,stroke-width:2px
style API fill:#e0e0e0,stroke:#333,stroke-width:2px
style Database fill:#c0c0c0,stroke:#333,stroke-width:3px
style Spark fill:#a0a0a0,stroke:#333,stroke-width:2px
sequenceDiagram
participant User
participant Frontend
participant API
participant Cache
participant Astra DB
participant Spark
User->>Frontend: Request Dashboard
Frontend->>API: GET /api/summary
API->>Cache: Check Cache
alt Cache Hit
Cache-->>API: Return Cached Data
else Cache Miss
API->>Astra DB: Query Statistics
Astra DB-->>API: Return Data
API->>Cache: Update Cache
end
API-->>Frontend: JSON Response
Frontend-->>User: Render Dashboard
Note over Spark,Astra DB: Background Processing
Spark->>Astra DB: Batch Write<br/>Detected Chains
User->>Frontend: Search Account
Frontend->>API: GET /api/account/:id
API->>Astra DB: Query Account Data
Astra DB-->>API: Account + Chains
API-->>Frontend: JSON Response
Frontend-->>User: Display Profile
graph TD
START[Transaction Chain Input] --> F1[Factor 1:<br/>Circular Pattern<br/>Weight: 30%]
START --> F2[Factor 2:<br/>Rapid Succession<br/>Weight: 25%]
START --> F3[Factor 3:<br/>Layering Complexity<br/>Weight: 20%]
START --> F4[Factor 4:<br/>Structuring Pattern<br/>Weight: 15%]
START --> F5[Factor 5:<br/>Time Compression<br/>Weight: 10%]
F1 --> C1{Circular?}
C1 -->|Yes| S1[Score: 30]
C1 -->|No| S1B[Score: 0]
F2 --> C2{<1 hour?}
C2 -->|Yes| S2[Score: 25]
C2 -->|No| S2B[Score: 0]
F3 --> C3{5+ Hops?}
C3 -->|Yes| S3[Score: 20]
C3 -->|No| S3B[Score: 0]
F4 --> C4{Below Threshold?}
C4 -->|Yes| S4[Score: 15]
C4 -->|No| S4B[Score: 0]
F5 --> C5{High Frequency?}
C5 -->|Yes| S5[Score: 10]
C5 -->|No| S5B[Score: 0]
S1 --> SUM[Weighted Sum]
S1B --> SUM
S2 --> SUM
S2B --> SUM
S3 --> SUM
S3B --> SUM
S4 --> SUM
S4B --> SUM
S5 --> SUM
S5B --> SUM
SUM --> RISK{Risk Score}
RISK -->|0-40| LOW[LOW RISK]
RISK -->|41-70| MED[MEDIUM RISK]
RISK -->|71-90| HIGH[HIGH RISK]
RISK -->|91-100| CRIT[CRITICAL]
style START fill:#f5f5f5,stroke:#333,stroke-width:2px
style SUM fill:#e0e0e0,stroke:#333,stroke-width:2px
style CRIT fill:#000,stroke:#333,stroke-width:3px,color:#fff
style HIGH fill:#666,stroke:#333,stroke-width:2px,color:#fff
style MED fill:#999,stroke:#333,stroke-width:2px
style LOW fill:#ccc,stroke:#333,stroke-width:2px
graph LR
A[Account A<br/>Origin<br/>βΉ50 Cr] -->|2 min<br/>βΉ48 Cr| B[Account B<br/>Layer 1]
B -->|5 min<br/>βΉ46 Cr| C[Account C<br/>Layer 2]
C -->|8 min<br/>βΉ44 Cr| D[Account D<br/>Layer 3]
D -->|12 min<br/>βΉ42 Cr| E[Account E<br/>Layer 4]
E -->|15 min<br/>βΉ40 Cr| A
style A fill:#000,stroke:#333,stroke-width:3px,color:#fff
style B fill:#666,stroke:#333,stroke-width:2px,color:#fff
style C fill:#888,stroke:#333,stroke-width:2px,color:#fff
style D fill:#aaa,stroke:#333,stroke-width:2px
style E fill:#ccc,stroke:#333,stroke-width:2px
π¨ ALERT: Circular Pattern Detected
Risk Score: 94.5% | Total Time: 15 minutes | Loss: βΉ10 Cr
graph TD
START[Start Installation] --> CLONE[Clone Repository]
CLONE --> ASTRA[Setup Astra DB]
ASTRA --> BUNDLE[Download Secure Bundle]
BUNDLE --> TOKEN[Generate Token]
TOKEN --> DEPS[Install Dependencies]
DEPS --> ENV[Configure Environment]
ENV --> SCHEMA[Initialize Schema]
SCHEMA --> DATA[Insert Sample Data]
DATA --> TEST[Test Connection]
TEST --> BACKEND[Start Backend Server]
BACKEND --> FRONTEND[Start Frontend Server]
FRONTEND --> SUCCESS[π Application Running]
style START fill:#f5f5f5,stroke:#333,stroke-width:2px
style SUCCESS fill:#000,stroke:#333,stroke-width:3px,color:#fff
# 1. Clone Repository
git clone https://github.com/yourusername/rtgs-analyzer.git
cd rtgs-analyzer
# 2. Backend Setup
cd backend
npm install
# 3. Configure Environment
cat > .env << EOF
PORT=3000
ASTRA_CLIENT_ID=your_client_id
ASTRA_CLIENT_SECRET=your_client_secret
ASTRA_KEYSPACE=rtgs_risk
SECURE_CONNECT_BUNDLE=./secure-connect-vyaapti.zip
EOF
# 4. Test Connection
node test-astra-connection.js
# 5. Start Backend
node server.js
# 6. Start Frontend (New Terminal)
cd frontend
python3 -m http.server 8080graph LR
API[REST API<br/>localhost:3000] --> SUMMARY[/api/summary<br/>Dashboard Stats]
API --> CHAINS[/api/chains<br/>All Chains]
API --> CHAIN[/api/chain/:id<br/>Chain Details]
API --> ACCOUNT[/api/account/:id<br/>Account Profile]
API --> TOP[/api/accounts/top<br/>Top Risky Accounts]
API --> CHARTS[/api/charts/data<br/>Chart Data]
style API fill:#000,stroke:#333,stroke-width:3px,color:#fff
style SUMMARY fill:#e0e0e0,stroke:#333,stroke-width:2px
style CHAINS fill:#e0e0e0,stroke:#333,stroke-width:2px
style CHAIN fill:#e0e0e0,stroke:#333,stroke-width:2px
style ACCOUNT fill:#e0e0e0,stroke:#333,stroke-width:2px
style TOP fill:#e0e0e0,stroke:#333,stroke-width:2px
style CHARTS fill:#e0e0e0,stroke:#333,stroke-width:2px
sequenceDiagram
participant C as Client
participant API as Express API
participant DB as Astra DB
C->>API: GET /api/chains?risk_level=high
API->>API: Validate Parameters
API->>DB: SELECT * FROM chains<br/>WHERE risk_score > 70
DB-->>API: ResultSet[10 chains]
API->>API: Transform Data
API-->>C: JSON Response<br/>{chains: [...], count: 10}
Note over C,DB: Response Time: ~89ms
erDiagram
CHAINS ||--o{ ACCOUNT_CHAINS : contains
ACCOUNTS ||--o{ ACCOUNT_CHAINS : participates
ACCOUNTS ||--o{ RISK_FEATURES : has
ACCOUNTS ||--o{ CLUSTERING_RESULTS : belongs_to
CHAINS {
uuid chain_id PK
float risk_score
int hop_count
decimal total_value
timestamp detected_at
boolean is_circular
}
ACCOUNTS {
text account_id PK
float suspicion_index
int cluster_id
decimal total_inflow
decimal total_outflow
timestamp last_activity
}
ACCOUNT_CHAINS {
text account_id PK
uuid chain_id PK
int position_in_chain
decimal amount_transferred
}
RISK_FEATURES {
text account_id PK
float velocity_score
float frequency_score
float amount_variance
int network_degree
}
CLUSTERING_RESULTS {
int cluster_id PK
text account_id PK
float distance_to_centroid
timestamp clustered_at
}
graph TD
RAW[Raw Transaction CSV] --> ING[Ingestion Job<br/>ingest_transactions.py]
ING --> CLEAN[Cleaned Data in Astra]
CLEAN --> FEAT[Feature Engineering<br/>extract_features.py]
FEAT --> FEATURES[risk_features table]
FEATURES --> CLUSTER[Clustering Job<br/>cluster_accounts.py]
CLUSTER --> GROUPS[clustering_results table]
FEATURES --> CHAIN[Chain Detection<br/>detect_chains.py]
CHAIN --> CHAINS[chains table]
CHAINS --> RISK[Risk Scoring<br/>calculate_risk.py]
RISK --> FINAL[Updated Risk Scores]
style RAW fill:#f5f5f5,stroke:#333,stroke-width:2px
style FINAL fill:#000,stroke:#333,stroke-width:3px,color:#fff
sequenceDiagram
participant Admin
participant Spark
participant Astra DB
participant Alert System
Admin->>Spark: spark-submit detect_chains.py
Spark->>Astra DB: Read transactions_processed
Astra DB-->>Spark: Transaction Data
Note over Spark: Graph Analysis<br/>NetworkX Processing
Spark->>Spark: Build Transaction Graph
Spark->>Spark: Detect Circular Paths
Spark->>Spark: Calculate Risk Scores
Spark->>Astra DB: Write to chains table
Astra DB-->>Spark: Confirm Write
alt High Risk Detected
Spark->>Alert System: Trigger Alert
Alert System-->>Admin: Email Notification
end
Spark-->>Admin: Job Complete<br/>15 chains detected
graph TD
LANDING[Landing Page] --> DASHBOARD[π Dashboard]
DASHBOARD --> CHAINS_VIEW[π Chains View]
DASHBOARD --> ACCOUNT_VIEW[π€ Account Analysis]
DASHBOARD --> GRAPH_VIEW[πΈοΈ Network Graph]
CHAINS_VIEW --> FILTER[Filter by Risk Level]
CHAINS_VIEW --> SORT[Sort by Date/Risk/Value]
CHAINS_VIEW --> DETAIL[Chain Detail View]
DETAIL --> GRAPH_VIEW
ACCOUNT_VIEW --> SEARCH[Search by Account ID]
ACCOUNT_VIEW --> METRICS[View Metrics]
ACCOUNT_VIEW --> HISTORY[Transaction History]
METRICS --> RELATED_CHAINS[Related Chains]
RELATED_CHAINS --> CHAINS_VIEW
GRAPH_VIEW --> INTERACTIVE[Interactive Controls]
INTERACTIVE --> ZOOM[Zoom & Pan]
INTERACTIVE --> NODE_CLICK[Click Node Details]
INTERACTIVE --> EXPORT[Export PNG]
style LANDING fill:#000,stroke:#333,stroke-width:3px,color:#fff
style DASHBOARD fill:#333,stroke:#333,stroke-width:2px,color:#fff
style CHAINS_VIEW fill:#666,stroke:#333,stroke-width:2px,color:#fff
style ACCOUNT_VIEW fill:#666,stroke:#333,stroke-width:2px,color:#fff
style GRAPH_VIEW fill:#666,stroke:#333,stroke-width:2px,color:#fff
graph TB
subgraph Throughput["β‘ Processing Throughput"]
T1[10,000 TPS<br/>Peak Load]
T2[8,000 TPS<br/>Average Load]
T3[5,000 TPS<br/>Normal Load]
end
subgraph Latency["β±οΈ Response Times"]
L1[45ms<br/>/api/summary]
L2[89ms<br/>/api/chains]
L3[67ms<br/>/api/account]
L4[112ms<br/>/api/chain/:id]
end
subgraph Scale["π Scalability"]
S1[100M+<br/>Transactions]
S2[1,000+<br/>Concurrent Users]
S3[99.9%<br/>Uptime]
S4[95.2%<br/>Accuracy]
end
style T1 fill:#000,stroke:#333,stroke-width:2px,color:#fff
style L1 fill:#666,stroke:#333,stroke-width:2px,color:#fff
style S1 fill:#999,stroke:#333,stroke-width:2px
graph TB
USER[User Browser] --> HTTPS[HTTPS/TLS Layer]
HTTPS --> AUTH[Authentication]
AUTH --> RBAC[Role-Based Access Control]
RBAC --> API[API Gateway]
API --> VALID[Request Validation]
VALID --> RATE[Rate Limiting]
RATE --> BACKEND[Backend Logic]
BACKEND --> ENCRYPT[Data Encryption]
ENCRYPT --> ASTRA[Astra DB<br/>Secure Connection]
AUDIT[Audit Logger] --> LOG_DB[(Audit Logs)]
BACKEND --> AUDIT
style HTTPS fill:#000,stroke:#333,stroke-width:3px,color:#fff
style AUTH fill:#333,stroke:#333,stroke-width:2px,color:#fff
style ENCRYPT fill:#666,stroke:#333,stroke-width:2px,color:#fff
graph LR
DATA[Transaction Data] --> PREPROCESS[Preprocessing<br/>Cleaning & Normalization]
PREPROCESS --> EXTRACT[Feature Extraction<br/>30+ Features]
EXTRACT --> CLUSTER[K-Means Clustering<br/>k=5 clusters]
CLUSTER --> LABEL[Labeled Accounts]
LABEL --> RISK[Risk Score Calculation]
RISK --> OUTPUT[Classified Chains]
EXTRACT --> FEATURES[Features:<br/>- Velocity<br/>- Frequency<br/>- Amount Variance<br/>- Network Degree<br/>- Time Patterns]
style DATA fill:#f5f5f5,stroke:#333,stroke-width:2px
style OUTPUT fill:#000,stroke:#333,stroke-width:3px,color:#fff
style FEATURES fill:#e0e0e0,stroke:#333,stroke-width:2px
graph TB
subgraph Production["π Production Environment"]
LB[Load Balancer<br/>Nginx]
APP1[Node.js Instance 1<br/>Port 3000]
APP2[Node.js Instance 2<br/>Port 3001]
APP3[Node.js Instance 3<br/>Port 3002]
end
subgraph Cloud["βοΈ DataStax Astra"]
ASTRA[Astra DB Cluster<br/>Mumbai Region<br/>3 Replicas]
end
subgraph Processing["βοΈ Spark Cluster"]
MASTER[Spark Master]
WORKER1[Worker Node 1]
WORKER2[Worker Node 2]
WORKER3[Worker Node 3]
end
subgraph Monitoring["π Monitoring"]
LOGS[Centralized Logging]
METRICS[Metrics Collection]
ALERTS[Alert Manager]
end
LB --> APP1
LB --> APP2
LB --> APP3
APP1 --> ASTRA
APP2 --> ASTRA
APP3 --> ASTRA
MASTER --> WORKER1
MASTER --> WORKER2
MASTER --> WORKER3
WORKER1 --> ASTRA
WORKER2 --> ASTRA
WORKER3 --> ASTRA
APP1 --> LOGS
APP2 --> LOGS
APP3 --> LOGS
ASTRA --> METRICS
Processing --> METRICS
METRICS --> ALERTS
style LB fill:#000,stroke:#333,stroke-width:3px,color:#fff
style ASTRA fill:#333,stroke:#333,stroke-width:3px,color:#fff
graph LR
COMMIT[Git Commit] --> TRIGGER[GitHub Actions]
TRIGGER --> TEST[Run Tests<br/>Jest + Mocha]
TEST --> LINT[Code Linting<br/>ESLint]
LINT --> BUILD[Build Application]
BUILD --> SECURITY[Security Scan<br/>npm audit]
SECURITY --> DEPLOY_STAGE[Deploy to Staging]
DEPLOY_STAGE --> SMOKE[Smoke Tests]
SMOKE --> APPROVE{Manual Approval}
APPROVE -->|Yes| DEPLOY_PROD[Deploy to Production]
APPROVE -->|No| ROLLBACK[Rollback]
DEPLOY_PROD --> MONITOR[Monitor Metrics]
style COMMIT fill:#f5f5f5,stroke:#333,stroke-width:2px
style DEPLOY_PROD fill:#000,stroke:#333,stroke-width:3px,color:#fff
graph TB
subgraph Charts["π Dashboard Charts"]
C1[Risk Distribution<br/>Pie Chart]
C2[Volume Trends<br/>Line Chart]
C3[Top Accounts<br/>Bar Chart]
C4[Activity Feed<br/>Timeline]
end
subgraph Network["πΈοΈ Network Graph"]
N1[vis-network.js<br/>Interactive Graph]
N2[Node Clustering]
N3[Edge Weights]
N4[Physics Simulation]
end
subgraph Tables["π Data Tables"]
T1[Chains Listing<br/>Sortable]
T2[Account Details<br/>Paginated]
T3[Transaction History<br/>Filterable]
end
API[REST API] --> Charts
API --> Network
API --> Tables
style API fill:#000,stroke:#333,stroke-width:3px,color:#fff
graph TD
REQUEST[API Request] --> VALIDATE{Valid?}
VALIDATE -->|No| ERROR_400[400 Bad Request]
VALIDATE -->|Yes| AUTH{Authenticated?}
AUTH -->|No| ERROR_401[401 Unauthorized]
AUTH -->|Yes| RATE{Rate Limit OK?}
RATE -->|No| ERROR_429[429 Too Many Requests]
RATE -->|Yes| PROCESS[Process Request]
PROCESS --> DB{DB Connection?}
DB -->|Fail| ERROR_503[503 Service Unavailable]
DB -->|Success| QUERY{Query Success?}
QUERY -->|Fail| ERROR_500[500 Internal Error]
QUERY -->|Success| RESPONSE[200 OK]
ERROR_400 --> LOG[Log Error]
ERROR_401 --> LOG
ERROR_429 --> LOG
ERROR_500 --> LOG
ERROR_503 --> LOG
LOG --> CLIENT[Return to Client]
RESPONSE --> CLIENT
style REQUEST fill:#f5f5f5,stroke:#333,stroke-width:2px
style RESPONSE fill:#000,stroke:#333,stroke-width:3px,color:#fff
style LOG fill:#666,stroke:#333,stroke-width:2px,color:#fff
RTGS-RiskChain/
β
βββ frontend/
β βββ index.html # Dashboard home page
β βββ chains.html # Risk chains listing
β βββ account.html # Account analysis
β βββ graph.html # Network visualization
β βββ style.css # Glassmorphic styling
β βββ scripts/
β βββ main.js # Dashboard logic
β βββ chains.js # Chains page logic
β βββ account.js # Account page logic
β βββ graph.js # Graph visualization
β
βββ backend/
β βββ server.js # Express API server
β βββ .env # Environment configuration
β βββ test-astra-connection.js # Connection testing
β βββ package.json # Dependencies
β βββ secure-connect-vyaapti.zip # Astra secure bundle
β βββ routes/
β β βββ summary.js # Dashboard routes
β β βββ chains.js # Chain routes
β β βββ accounts.js # Account routes
β βββ controllers/
β β βββ chainController.js # Chain business logic
β β βββ accountController.js # Account business logic
β βββ utils/
β βββ cassandra.js # DB connection utilities
β βββ validator.js # Input validation
β
βββ spark-jobs/
β βββ ingestion/
β β βββ ingest_transactions.py # Data ingestion
β βββ features/
β β βββ extract_features.py # Feature engineering
β βββ clustering/
β β βββ cluster_accounts.py # ML clustering
β βββ chain-builder/
β β βββ detect_chains_astra.py # Chain detection
β βββ risk-scoring/
β βββ calculate_risk.py # Risk calculation
β
βββ cassandra/
β βββ schema-astra.cql # Database schema
β
βββ docs/
β βββ diagrams/ # Architecture diagrams
β βββ report/ # Technical documentation
β βββ patent/ # Patent application
β
βββ README.md # This file
mindmap
root((RTGS Analyzer))
Banking Sector
AML Compliance
Fraud Detection
Transaction Monitoring
Regulatory Reporting
Financial Institutions
Risk Management
Customer Due Diligence
Suspicious Activity Reports
Internal Auditing
Regulatory Bodies
SEBI Oversight
RBI Monitoring
Compliance Checks
Investigation Support
Fintech Companies
Payment Gateways
Digital Wallets
Peer-to-Peer Platforms