# shey66830-blip/bfsi-intelligence-risk-analyzer- architecture

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

- Interactive diagram: https://gitdiagram.com/shey66830-blip/bfsi-intelligence-risk-analyzer-
- Repository: https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-

## Overview

Context Guard is a synthetic-data financial investigation platform, not a fraud-verdict system. Analysts sign in, monitor transactions, and open cases when anomaly thresholds are met; investigators can expand case scope across linked entities, request consent-scoped bank context, correlate structured reports, review an explainable assessment, and record an attributed decision. The React dashboard calls a Flask API backed by MongoDB, with simulated bank services. The graph preserves documented workflow and product areas; some route and service wiring is based on the README or source-index references rather than inspected implementation excerpts.

Main entry points: [`backend/routes/cases.py`](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/routes/cases.py) (Case routes), [`backend/routes/pipeline.py`](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/routes/pipeline.py) (Pipeline routes), [`frontend/src/api.js`](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/api.js) (API client), [`backend/app.py`](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/app.py) (Flask application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Investigator dashboard"]
  node_dashboard["Dashboard shell<br/>[App.jsx]"]
  node_role["Role session<br/>[RoleContext.jsx]"]
  node_clientapi["API client<br/>[api.js]"]
  node_pipelineui["Pipeline view<br/>[PipelinePanel.jsx]"]
  node_loginui["Login view<br/>[LoginPage.jsx]"]
  node_caseui["Case workspace<br/>[CaseDetail.jsx]"]
  node_graphui["Network graph view<br/>[GraphView.jsx]"]
end

subgraph group_api["API and access"]
  node_flask["Flask application<br/>[app.py]"]
  node_authroutes["Authentication routes<br/>[auth.py]"]
  node_caseroutes["Case routes<br/>[cases.py]"]
  node_ingestroutes["Transaction ingestion<br/>[ingest.py]"]
end

subgraph group_investigation["Investigation workflow"]
  node_pipelineroutes["Pipeline routes<br/>[pipeline.py]"]
  node_graph["Behavioral graph<br/>[graph_engine.py]"]
  node_gateway["Bank gateway<br/>[bank_gateway.py]"]
  node_mockbanks["Simulated banks<br/>[mock_banks.py]"]
  node_bankreview["Bank report review<br/>[bank_review.py]"]
  node_reports["Investigation reports<br/>[reports.py]"]
end

subgraph group_support["Governance and evidence"]
  node_evidence["Evidence service<br/>[evidence.py]"]
  node_access["Restricted access<br/>[access.py]"]
  node_policy["Security policy<br/>[policy.py]"]
  node_middleware["Request authorization<br/>[middleware.py]"]
  node_users["Users and sessions<br/>[users.py]"]
  node_audit["Audit trail<br/>[audit.py]"]
end

subgraph group_state["Persistent state"]
  node_mongo[("MongoDB<br/>[config.py]")]
  node_models["Document operations<br/>[__init__.py]"]
end

node_investigator(("Investigator"))

node_investigator -->|"signs in"| node_loginui
node_investigator -->|"uses"| node_dashboard
node_dashboard -->|"provides session"| node_role
node_loginui -->|"authenticates through"| node_role
node_role -->|"requests session"| node_clientapi
node_dashboard -->|"fetches dashboard data"| node_clientapi
node_pipelineui -->|"runs pipeline"| node_clientapi
node_caseui -.->|"loads case"| node_clientapi
node_graphui -.->|"loads graph"| node_clientapi
node_clientapi -->|"calls API"| node_flask
node_flask -->|"registers routes"| node_authroutes
node_flask -->|"registers routes"| node_caseroutes
node_flask -->|"registers routes"| node_ingestroutes
node_flask -->|"registers routes"| node_pipelineroutes
node_authroutes -->|"authenticates"| node_users
node_caseroutes -->|"guards requests"| node_middleware
node_ingestroutes -->|"guards requests"| node_middleware
node_pipelineroutes -->|"expands entities"| node_graph
node_pipelineroutes -->|"sends bank requests"| node_gateway
node_gateway -->|"uses simulated banks"| node_mockbanks
node_pipelineroutes -.->|"reviews responses"| node_bankreview
node_pipelineroutes -.->|"drafts report"| node_reports
node_caseroutes -->|"manages evidence"| node_evidence
node_caseroutes -->|"checks access"| node_access
node_middleware -->|"resolves session"| node_users
node_middleware -.->|"enforces policy"| node_policy
node_authroutes -->|"records actions"| node_audit
node_caseroutes -->|"records actions"| node_audit
node_pipelineroutes -->|"records actions"| node_audit
node_models -->|"reads and writes"| node_mongo
node_caseroutes -->|"uses documents"| node_models
node_ingestroutes -->|"uses documents"| node_models
node_graph -->|"queries entities"| node_mongo

click node_dashboard "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/App.jsx"
click node_role "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/context/RoleContext.jsx"
click node_clientapi "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/api.js"
click node_pipelineui "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/components/PipelinePanel.jsx"
click node_loginui "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/components/LoginPage.jsx"
click node_caseui "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/components/CaseDetail.jsx"
click node_graphui "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/components/GraphView.jsx"
click node_flask "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/app.py"
click node_authroutes "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/routes/auth.py"
click node_caseroutes "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/routes/cases.py"
click node_ingestroutes "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/routes/ingest.py"
click node_pipelineroutes "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/routes/pipeline.py"
click node_graph "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/graph_engine.py"
click node_gateway "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/bank_gateway.py"
click node_mockbanks "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/mock_banks.py"
click node_bankreview "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/bank_review.py"
click node_reports "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/reports.py"
click node_evidence "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/evidence.py"
click node_access "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/access.py"
click node_policy "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/security/policy.py"
click node_middleware "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/middleware.py"
click node_users "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/users.py"
click node_audit "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/audit.py"
click node_mongo "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/config.py"
click node_models "https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/models/__init__.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_role,node_clientapi,node_pipelineui,node_loginui,node_caseui,node_graphui toneBlue
class node_flask,node_authroutes,node_caseroutes,node_ingestroutes toneAmber
class node_pipelineroutes,node_graph,node_gateway,node_mockbanks,node_bankreview,node_reports toneMint
class node_evidence,node_access,node_policy,node_middleware,node_users,node_audit toneRose
class node_mongo,node_models,node_investigator toneIndigo
```

## Components

### Investigator dashboard

- [Dashboard shell](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Role session](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/context/RoleContext.jsx): `frontend/src/context/RoleContext.jsx`
- [API client](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/api.js): `frontend/src/api.js`
- [Pipeline view](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/components/PipelinePanel.jsx): `frontend/src/components/PipelinePanel.jsx`
- [Login view](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/components/LoginPage.jsx): `frontend/src/components/LoginPage.jsx`
- [Case workspace](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/components/CaseDetail.jsx): `frontend/src/components/CaseDetail.jsx`
- [Network graph view](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/frontend/src/components/GraphView.jsx): `frontend/src/components/GraphView.jsx`

### API and access

- [Flask application](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/app.py): `backend/app.py`
- [Authentication routes](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/routes/auth.py): `backend/routes/auth.py`
- [Case routes](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/routes/cases.py): `backend/routes/cases.py`
- [Transaction ingestion](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/routes/ingest.py): `backend/routes/ingest.py`

### Investigation workflow

- [Pipeline routes](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/routes/pipeline.py): `backend/routes/pipeline.py`
- [Behavioral graph](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/graph_engine.py): `backend/services/graph_engine.py`
- [Bank gateway](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/bank_gateway.py): `backend/services/bank_gateway.py`
- [Simulated banks](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/mock_banks.py): `backend/services/mock_banks.py`
- [Bank report review](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/bank_review.py): `backend/services/bank_review.py`
- [Investigation reports](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/reports.py): `backend/services/reports.py`

### Governance and evidence

- [Evidence service](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/evidence.py): `backend/services/evidence.py`
- [Restricted access](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/access.py): `backend/services/access.py`
- [Security policy](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/security/policy.py): `backend/security/policy.py`
- [Request authorization](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/middleware.py): `backend/middleware.py`
- [Users and sessions](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/users.py): `backend/services/users.py`
- [Audit trail](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/services/audit.py): `backend/services/audit.py`

### Persistent state

- [MongoDB](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/config.py): `backend/config.py`
- [Document operations](https://github.com/shey66830-blip/bfsi-intelligence-risk-analyzer-/blob/main/backend/models/__init__.py): `backend/models/__init__.py`

### Other components

- **Investigator**

## Connections

- Investigator → Login view: signs in
- Investigator → Dashboard shell: uses
- Dashboard shell → Role session: provides session (evidence: `frontend/src/App.jsx`)
- Login view → Role session: authenticates through (evidence: `frontend/src/context/RoleContext.jsx`)
- Role session → API client: requests session (evidence: `frontend/src/context/RoleContext.jsx`)
- Dashboard shell → API client: fetches dashboard data (evidence: `frontend/src/App.jsx`)
- Pipeline view → API client: runs pipeline (evidence: `frontend/src/components/PipelinePanel.jsx`)
- Case workspace → API client: loads case
- Network graph view → API client: loads graph
- API client → Flask application: calls API
- Flask application → Authentication routes: registers routes (evidence: `backend/app.py`)
- Flask application → Case routes: registers routes (evidence: `backend/app.py`)
- Flask application → Transaction ingestion: registers routes (evidence: `backend/app.py`)
- Flask application → Pipeline routes: registers routes (evidence: `backend/app.py`)
- Authentication routes → Users and sessions: authenticates (evidence: `backend/routes/auth.py`)
- Case routes → Request authorization: guards requests (evidence: `backend/routes/cases.py`)
- Transaction ingestion → Request authorization: guards requests (evidence: `backend/routes/ingest.py`)
- Pipeline routes → Behavioral graph: expands entities (evidence: `backend/routes/pipeline.py`)
- Pipeline routes → Bank gateway: sends bank requests (evidence: `backend/routes/pipeline.py`)
- Bank gateway → Simulated banks: uses simulated banks (evidence: `backend/services/bank_gateway.py`)
- Pipeline routes → Bank report review: reviews responses
- Pipeline routes → Investigation reports: drafts report
- Case routes → Evidence service: manages evidence (evidence: `backend/routes/cases.py`)
- Case routes → Restricted access: checks access (evidence: `backend/routes/cases.py`)
- Request authorization → Users and sessions: resolves session (evidence: `backend/middleware.py`)
- Request authorization → Security policy: enforces policy
- Authentication routes → Audit trail: records actions (evidence: `backend/routes/auth.py`)
- Case routes → Audit trail: records actions (evidence: `backend/routes/cases.py`)
- Pipeline routes → Audit trail: records actions (evidence: `backend/routes/pipeline.py`)
- Document operations → MongoDB: reads and writes (evidence: `backend/config.py`)
- Case routes → Document operations: uses documents (evidence: `backend/routes/cases.py`)
- Transaction ingestion → Document operations: uses documents (evidence: `backend/routes/ingest.py`)
- Behavioral graph → MongoDB: queries entities (evidence: `backend/services/graph_engine.py`)
