# prchkadam/sih26 architecture

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

- Interactive diagram: https://gitdiagram.com/prchkadam/sih26
- Repository: https://github.com/prchkadam/sih26

## Overview

CIRAS is an investigative intelligence workspace: investigators import crime data, which is structured into entities and relationships, then explore cases, networks, alerts, and an integrity audit trail. The React app routes users to these workflows and calls a FastAPI backend. The backend combines relational records with a graph store and analysis engines. The README documents OCR, similarity search, and several analysis capabilities, but sampled implementation excerpts do not establish every internal connection; those branches are represented only where documented or indexed.

Main entry points: [`backend/app/main.py`](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/main.py) (FastAPI application), [`frontend/src/api/client.js`](https://github.com/prchkadam/sih26/blob/DIVYA/frontend/src/api/client.js) (HTTP API client), [`frontend/src/App.jsx`](https://github.com/prchkadam/sih26/blob/DIVYA/frontend/src/App.jsx) (App routing), [`backend/app/routers/ingest_router.py`](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/ingest_router.py) (Data ingestion routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_investigator_ui["Investigator workspace"]
  node_app_routes["App routing<br/>[App.jsx]"]
  node_workspace_pages["Case and dashboard pages"]
  node_import_page["Data import page<br/>[DataImport.jsx]"]
  node_network_page["Network explorer"]
  node_entity_page["Entity profile<br/>[EntityProfile.jsx]"]
  node_case_context["Active case context<br/>[CaseContext.jsx]"]
  node_api_client["HTTP API client<br/>[client.js]"]
end

subgraph group_api_access["API and ingestion"]
  node_api_app["FastAPI application<br/>[main.py]"]
  node_auth_routes["Authentication routes<br/>[auth_router.py]"]
  node_auth["Token authentication<br/>[auth.py]"]
  node_ingest_routes["Data ingestion routes<br/>[ingest_router.py]"]
  node_entity_extraction["Entity extraction"]
  node_entity_resolution["Entity resolution"]
  node_case_routes["Case management routes<br/>[cases_router.py]"]
end

subgraph group_analysis["Intelligence analysis"]
  node_analysis_routes["Analysis routes<br/>[analysis_router.py]"]
  node_network_analysis["Network analysis"]
  node_temporal_analysis["Temporal analysis"]
  node_anomaly_detection["Anomaly detection"]
  node_alerts_routes["Alert routes<br/>[alerts_router.py]"]
  node_search_routes["Similarity and search routes<br/>[search_router.py]"]
  node_graph_routes["Graph routes<br/>[graph_router.py]"]
end

subgraph group_records_integrity["Records and integrity"]
  node_graph_store[("Knowledge graph store<br/>[graph_store.py]")]
  node_relational_store[("Relational records<br/>[database.py]")]
  node_trust_chain["Hash-chained audit trail<br/>[trust_chain.py]"]
  node_blockchain_routes["Blockchain routes"]
end

node_investigator(("Investigator"))

node_investigator -->|"uses"| node_app_routes
node_app_routes -->|"routes to"| node_workspace_pages
node_app_routes -->|"routes to"| node_import_page
node_app_routes -->|"routes to"| node_network_page
node_app_routes -->|"routes to"| node_entity_page
node_workspace_pages -->|"requests data"| node_api_client
node_import_page -->|"submits imports"| node_api_client
node_network_page -->|"requests graph"| node_api_client
node_entity_page -->|"requests entity"| node_api_client
node_case_context -->|"loads cases"| node_api_client
node_api_client -->|"calls API"| node_api_app
node_api_app -->|"registers"| node_auth_routes
node_api_app -->|"registers"| node_ingest_routes
node_api_app -->|"registers"| node_case_routes
node_api_app -->|"registers"| node_analysis_routes
node_api_app -->|"registers"| node_alerts_routes
node_api_app -->|"registers"| node_search_routes
node_api_app -->|"registers"| node_graph_routes
node_api_app -->|"registers"| node_blockchain_routes
node_auth_routes -->|"verifies credentials"| node_auth
node_ingest_routes -->|"extracts entities"| node_entity_extraction
node_ingest_routes -->|"resolves entities"| node_entity_resolution
node_ingest_routes -->|"writes graph"| node_graph_store
node_ingest_routes -->|"stores datasets"| node_relational_store
node_case_routes -->|"reads and writes"| node_relational_store
node_case_routes -->|"uses graph"| node_graph_store
node_case_routes -->|"records events"| node_trust_chain
node_analysis_routes -->|"dispatches analysis"| node_network_analysis
node_analysis_routes -->|"dispatches analysis"| node_temporal_analysis
node_alerts_routes -->|"uses detection"| node_anomaly_detection
node_alerts_routes -->|"reads graph"| node_graph_store
node_alerts_routes -->|"records events"| node_trust_chain
node_graph_routes -->|"queries graph"| node_graph_store
node_search_routes -->|"searches graph"| node_graph_store
node_blockchain_routes -->|"verifies audit"| node_trust_chain

click node_app_routes "https://github.com/prchkadam/sih26/blob/DIVYA/frontend/src/App.jsx"
click node_workspace_pages "https://github.com/prchkadam/sih26/tree/DIVYA/frontend/src/pages"
click node_import_page "https://github.com/prchkadam/sih26/blob/DIVYA/frontend/src/pages/DataImport.jsx"
click node_network_page "https://github.com/prchkadam/sih26/blob/DIVYA/frontend/src/pages/NetworkExplorer.jsx"
click node_entity_page "https://github.com/prchkadam/sih26/blob/DIVYA/frontend/src/pages/EntityProfile.jsx"
click node_case_context "https://github.com/prchkadam/sih26/blob/DIVYA/frontend/src/CaseContext.jsx"
click node_api_client "https://github.com/prchkadam/sih26/blob/DIVYA/frontend/src/api/client.js"
click node_api_app "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/main.py"
click node_auth_routes "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/auth_router.py"
click node_auth "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/auth.py"
click node_ingest_routes "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/ingest_router.py"
click node_entity_extraction "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/entity_extraction.py"
click node_entity_resolution "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/entity_resolution.py"
click node_case_routes "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/cases_router.py"
click node_analysis_routes "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/analysis_router.py"
click node_network_analysis "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/network_analysis.py"
click node_temporal_analysis "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/temporal_analysis.py"
click node_anomaly_detection "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/anomaly_detection.py"
click node_alerts_routes "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/alerts_router.py"
click node_search_routes "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/search_router.py"
click node_graph_routes "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/graph_router.py"
click node_graph_store "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/graph_store.py"
click node_relational_store "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/database.py"
click node_trust_chain "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/trust_chain.py"
click node_blockchain_routes "https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/blockchain_router.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_app_routes,node_workspace_pages,node_import_page,node_network_page,node_entity_page,node_case_context,node_api_client toneBlue
class node_api_app,node_auth_routes,node_auth,node_ingest_routes,node_entity_extraction,node_entity_resolution,node_case_routes toneAmber
class node_analysis_routes,node_network_analysis,node_temporal_analysis,node_anomaly_detection,node_alerts_routes,node_search_routes,node_graph_routes toneMint
class node_graph_store,node_relational_store,node_trust_chain,node_blockchain_routes toneRose
class node_investigator toneIndigo
```

## Components

### Investigator workspace

- [App routing](https://github.com/prchkadam/sih26/blob/DIVYA/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Case and dashboard pages](https://github.com/prchkadam/sih26/tree/DIVYA/frontend/src/pages): `frontend/src/pages`
- [Data import page](https://github.com/prchkadam/sih26/blob/DIVYA/frontend/src/pages/DataImport.jsx): `frontend/src/pages/DataImport.jsx`
- [Network explorer](https://github.com/prchkadam/sih26/blob/DIVYA/frontend/src/pages/NetworkExplorer.jsx): `frontend/src/pages/NetworkExplorer.jsx`
- [Entity profile](https://github.com/prchkadam/sih26/blob/DIVYA/frontend/src/pages/EntityProfile.jsx): `frontend/src/pages/EntityProfile.jsx`
- [Active case context](https://github.com/prchkadam/sih26/blob/DIVYA/frontend/src/CaseContext.jsx): `frontend/src/CaseContext.jsx`
- [HTTP API client](https://github.com/prchkadam/sih26/blob/DIVYA/frontend/src/api/client.js): `frontend/src/api/client.js`

### API and ingestion

- [FastAPI application](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/main.py): `backend/app/main.py`
- [Authentication routes](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/auth_router.py): `backend/app/routers/auth_router.py`
- [Token authentication](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/auth.py): `backend/app/auth.py`
- [Data ingestion routes](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/ingest_router.py): `backend/app/routers/ingest_router.py`
- [Entity extraction](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/entity_extraction.py): `backend/app/entity_extraction.py`
- [Entity resolution](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/entity_resolution.py): `backend/app/entity_resolution.py`
- [Case management routes](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/cases_router.py): `backend/app/routers/cases_router.py`

### Intelligence analysis

- [Analysis routes](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/analysis_router.py): `backend/app/routers/analysis_router.py`
- [Network analysis](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/network_analysis.py): `backend/app/network_analysis.py`
- [Temporal analysis](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/temporal_analysis.py): `backend/app/temporal_analysis.py`
- [Anomaly detection](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/anomaly_detection.py): `backend/app/anomaly_detection.py`
- [Alert routes](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/alerts_router.py): `backend/app/routers/alerts_router.py`
- [Similarity and search routes](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/search_router.py): `backend/app/routers/search_router.py`
- [Graph routes](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/graph_router.py): `backend/app/routers/graph_router.py`

### Records and integrity

- [Knowledge graph store](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/graph_store.py): `backend/app/graph_store.py`
- [Relational records](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/database.py): `backend/app/database.py`
- [Hash-chained audit trail](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/trust_chain.py): `backend/app/trust_chain.py`
- [Blockchain routes](https://github.com/prchkadam/sih26/blob/DIVYA/backend/app/routers/blockchain_router.py): `backend/app/routers/blockchain_router.py`

### Other components

- **Investigator**

## Connections

- Investigator → App routing: uses (evidence: `frontend/src/App.jsx`)
- App routing → Case and dashboard pages: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Data import page: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Network explorer: routes to (evidence: `frontend/src/App.jsx`)
- App routing → Entity profile: routes to (evidence: `frontend/src/App.jsx`)
- Case and dashboard pages → HTTP API client: requests data (evidence: `frontend/src/pages/CaseDetail.jsx`)
- Data import page → HTTP API client: submits imports (evidence: `frontend/src/pages/DataImport.jsx`)
- Network explorer → HTTP API client: requests graph (evidence: `frontend/src/pages/NetworkExplorer.jsx`)
- Entity profile → HTTP API client: requests entity (evidence: `frontend/src/pages/EntityProfile.jsx`)
- Active case context → HTTP API client: loads cases (evidence: `frontend/src/CaseContext.jsx`)
- HTTP API client → FastAPI application: calls API (evidence: `frontend/src/api/client.js`)
- FastAPI application → Authentication routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Data ingestion routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Case management routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Analysis routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Alert routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Similarity and search routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Graph routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Blockchain routes: registers (evidence: `backend/app/main.py`)
- Authentication routes → Token authentication: verifies credentials (evidence: `backend/app/routers/auth_router.py`)
- Data ingestion routes → Entity extraction: extracts entities (evidence: `backend/app/routers/ingest_router.py`)
- Data ingestion routes → Entity resolution: resolves entities (evidence: `backend/app/routers/ingest_router.py`)
- Data ingestion routes → Knowledge graph store: writes graph (evidence: `backend/app/routers/ingest_router.py`)
- Data ingestion routes → Relational records: stores datasets (evidence: `backend/app/routers/ingest_router.py`)
- Case management routes → Relational records: reads and writes (evidence: `backend/app/routers/cases_router.py`)
- Case management routes → Knowledge graph store: uses graph (evidence: `backend/app/routers/cases_router.py`)
- Case management routes → Hash-chained audit trail: records events (evidence: `backend/app/routers/cases_router.py`)
- Analysis routes → Network analysis: dispatches analysis (evidence: `backend/app/routers/analysis_router.py`)
- Analysis routes → Temporal analysis: dispatches analysis (evidence: `backend/app/routers/analysis_router.py`)
- Alert routes → Anomaly detection: uses detection (evidence: `backend/app/routers/alerts_router.py`)
- Alert routes → Knowledge graph store: reads graph (evidence: `backend/app/routers/alerts_router.py`)
- Alert routes → Hash-chained audit trail: records events (evidence: `backend/app/routers/alerts_router.py`)
- Graph routes → Knowledge graph store: queries graph (evidence: `backend/app/routers/graph_router.py`)
- Similarity and search routes → Knowledge graph store: searches graph (evidence: `backend/app/routers/search_router.py`)
- Blockchain routes → Hash-chained audit trail: verifies audit (evidence: `backend/app/routers/blockchain_router.py`)
