# solunkepranav/sentinai architecture

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

- Interactive diagram: https://gitdiagram.com/solunkepranav/sentinai
- Repository: https://github.com/solunkepranav/sentinai

## Overview

SentinAI turns transaction data into AML anomaly findings, regulatory mappings, and an evidence-linked Suspicious Activity Report (SAR). The principal flow runs from the browser through the API and orchestrator to detection, compliance analysis, and narrative generation; audit records and report export support review. The frontend also retrieves masked transactions and presents an audit trail. The README documents dashboard charts and optional local Ollama support. Sampled source confirms the main API, detection, masking, compliance, audit, and export behavior; unsampled details are represented only where documented.

Main entry points: [`backend/api/routes.py`](https://github.com/solunkepranav/sentinai/blob/main/backend/api/routes.py) (HTTP API), [`backend/agents/orchestrator.py`](https://github.com/solunkepranav/sentinai/blob/main/backend/agents/orchestrator.py) (Pipeline Orchestrator), [`frontend/app.js`](https://github.com/solunkepranav/sentinai/blob/main/frontend/app.js) (Dashboard & Forensics), [`backend/modules/report_exporter.py`](https://github.com/solunkepranav/sentinai/blob/main/backend/modules/report_exporter.py) (Report Exporter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Analyst Experience"]
  node_dashboard["Dashboard &amp; Forensics<br/>[app.js]"]
  node_sar["Printable SAR"]
end

subgraph group_service["API Service"]
  node_api["HTTP API<br/>[routes.py]"]
  node_server["Web Server<br/>[main.py]"]
end

subgraph group_analysis["SAR Analysis"]
  node_pipeline["Pipeline Orchestrator<br/>[orchestrator.py]"]
  node_detector["Anomaly Detector"]
  node_investigator["Investigator Agent<br/>[investigator.py]"]
  node_compliance["Compliance Agent<br/>[compliance.py]"]
  node_lawbase["AML Law Base<br/>[aml_laws.json]"]
  node_scribe["SAR Narrative Writer<br/>[writer.py]"]
  node_exporter["Report Exporter<br/>[report_exporter.py]"]
end

subgraph group_records["Privacy &amp; Audit"]
  node_transactions["Transaction Dataset"]
  node_masker["PII Masker<br/>[pii_masking.py]"]
  node_audit["Audit Logger<br/>[audit_logger.py]"]
  node_auditdb[("Audit Database<br/>[audit.db]")]
end

node_analyst(("Compliance Analyst"))
node_ollama["Local Ollama"]

node_analyst -->|"uses"| node_dashboard
node_dashboard -->|"requests pages"| node_server
node_server -->|"routes API"| node_api
node_dashboard -->|"requests analysis"| node_api
node_api -->|"runs pipeline"| node_pipeline
node_api -->|"reads data"| node_transactions
node_api -->|"masks transactions"| node_masker
node_api -->|"fetches logs"| node_audit
node_api -->|"generates report"| node_exporter
node_pipeline -->|"runs checks"| node_detector
node_detector -->|"reads data"| node_transactions
node_pipeline -->|"maps findings"| node_compliance
node_compliance -->|"retrieves provisions"| node_lawbase
node_pipeline -->|"generates narrative"| node_scribe
node_pipeline -->|"logs decisions"| node_audit
node_audit -->|"writes and reads"| node_auditdb
node_api -->|"reads transactions"| node_auditdb
node_api -->|"passes report inputs"| node_exporter
node_exporter -->|"returns HTML"| node_sar
node_api -->|"returns results"| node_dashboard
node_dashboard -->|"shows findings"| node_analyst
node_scribe -.->|"optional local generation"| node_ollama

click node_dashboard "https://github.com/solunkepranav/sentinai/blob/main/frontend/app.js"
click node_api "https://github.com/solunkepranav/sentinai/blob/main/backend/api/routes.py"
click node_server "https://github.com/solunkepranav/sentinai/blob/main/backend/main.py"
click node_pipeline "https://github.com/solunkepranav/sentinai/blob/main/backend/agents/orchestrator.py"
click node_transactions "https://github.com/solunkepranav/sentinai/blob/main/backend/data/sample_transactions.csv"
click node_masker "https://github.com/solunkepranav/sentinai/blob/main/backend/modules/pii_masking.py"
click node_detector "https://github.com/solunkepranav/sentinai/blob/main/backend/modules/anomaly_detector.py"
click node_investigator "https://github.com/solunkepranav/sentinai/blob/main/backend/agents/investigator.py"
click node_compliance "https://github.com/solunkepranav/sentinai/blob/main/backend/agents/compliance.py"
click node_lawbase "https://github.com/solunkepranav/sentinai/blob/main/backend/data/aml_laws.json"
click node_scribe "https://github.com/solunkepranav/sentinai/blob/main/backend/agents/writer.py"
click node_audit "https://github.com/solunkepranav/sentinai/blob/main/backend/modules/audit_logger.py"
click node_auditdb "https://github.com/solunkepranav/sentinai/blob/main/backend/data/audit.db"
click node_exporter "https://github.com/solunkepranav/sentinai/blob/main/backend/modules/report_exporter.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_sar toneBlue
class node_api,node_server toneAmber
class node_pipeline,node_detector,node_investigator,node_compliance,node_lawbase,node_scribe,node_exporter toneMint
class node_transactions,node_masker,node_audit,node_auditdb toneRose
class node_analyst,node_ollama toneIndigo
```

## Components

### Analyst Experience

- [Dashboard & Forensics](https://github.com/solunkepranav/sentinai/blob/main/frontend/app.js): `frontend/app.js`
- **Printable SAR**

### API Service

- [HTTP API](https://github.com/solunkepranav/sentinai/blob/main/backend/api/routes.py): `backend/api/routes.py`
- [Web Server](https://github.com/solunkepranav/sentinai/blob/main/backend/main.py): `backend/main.py`

### SAR Analysis

- [Pipeline Orchestrator](https://github.com/solunkepranav/sentinai/blob/main/backend/agents/orchestrator.py): `backend/agents/orchestrator.py`
- [Anomaly Detector](https://github.com/solunkepranav/sentinai/blob/main/backend/modules/anomaly_detector.py): `backend/modules/anomaly_detector.py`
- [Investigator Agent](https://github.com/solunkepranav/sentinai/blob/main/backend/agents/investigator.py): `backend/agents/investigator.py`
- [Compliance Agent](https://github.com/solunkepranav/sentinai/blob/main/backend/agents/compliance.py): `backend/agents/compliance.py`
- [AML Law Base](https://github.com/solunkepranav/sentinai/blob/main/backend/data/aml_laws.json): `backend/data/aml_laws.json`
- [SAR Narrative Writer](https://github.com/solunkepranav/sentinai/blob/main/backend/agents/writer.py): `backend/agents/writer.py`
- [Report Exporter](https://github.com/solunkepranav/sentinai/blob/main/backend/modules/report_exporter.py): `backend/modules/report_exporter.py`

### Privacy & Audit

- [Transaction Dataset](https://github.com/solunkepranav/sentinai/blob/main/backend/data/sample_transactions.csv): `backend/data/sample_transactions.csv`
- [PII Masker](https://github.com/solunkepranav/sentinai/blob/main/backend/modules/pii_masking.py): `backend/modules/pii_masking.py`
- [Audit Logger](https://github.com/solunkepranav/sentinai/blob/main/backend/modules/audit_logger.py): `backend/modules/audit_logger.py`
- [Audit Database](https://github.com/solunkepranav/sentinai/blob/main/backend/data/audit.db): `backend/data/audit.db`

### Other components

- **Compliance Analyst**
- **Local Ollama**

## Connections

- Compliance Analyst → Dashboard & Forensics: uses
- Dashboard & Forensics → Web Server: requests pages
- Web Server → HTTP API: routes API
- Dashboard & Forensics → HTTP API: requests analysis
- HTTP API → Pipeline Orchestrator: runs pipeline
- HTTP API → Transaction Dataset: reads data
- HTTP API → PII Masker: masks transactions
- HTTP API → Audit Logger: fetches logs
- HTTP API → Report Exporter: generates report
- Pipeline Orchestrator → Anomaly Detector: runs checks
- Anomaly Detector → Transaction Dataset: reads data
- Pipeline Orchestrator → Compliance Agent: maps findings
- Compliance Agent → AML Law Base: retrieves provisions
- Pipeline Orchestrator → SAR Narrative Writer: generates narrative
- Pipeline Orchestrator → Audit Logger: logs decisions
- Audit Logger → Audit Database: writes and reads
- HTTP API → Audit Database: reads transactions
- HTTP API → Report Exporter: passes report inputs
- Report Exporter → Printable SAR: returns HTML
- HTTP API → Dashboard & Forensics: returns results
- Dashboard & Forensics → Compliance Analyst: shows findings
- SAR Narrative Writer → Local Ollama: optional local generation
