# akblaster967-afk/akhilchaturvedi architecture

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

- Interactive diagram: https://gitdiagram.com/akblaster967-afk/akhilchaturvedi
- Repository: https://github.com/akblaster967-afk/akhilchaturvedi

## Overview

DrishtiAI is an AI-assisted identity-document screening prototype with a React interface and FastAPI backend. The user-facing flow is to submit a document for analysis, inspect the screening and identity evidence, and optionally retain results in a document vault; the README also highlights OCR, field extraction, consistency checks, and risk assessment. The graph includes those documented stages and the separate AI fake-document screening capability. Some frontend-to-analysis wiring and unsampled backend behavior are not visible in the excerpts, so those links are marked unverified or omitted.

Main entry points: [`backend/app/main.py`](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/main.py) (FastAPI routes), [`backend/app/services/ai_fake_screener.py`](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/ai_fake_screener.py) (Fake-document screener), [`src/App.jsx`](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/src/App.jsx) (React app routing), [`app.py`](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/app.py) (Forensic screening UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["User interface"]
  node_react_app["React app routing<br/>[App.jsx]"]
  node_screen_workspace["Screening workspace"]
  node_analysis_report["Analysis report<br/>[AnalysisResult.jsx]"]
  node_audit_view["Audit logs<br/>[AuditLogs.jsx]"]
  node_portal["User portal<br/>[UserPortal.jsx]"]
end

subgraph group_api["API and persistence"]
  node_api_entry["FastAPI routes<br/>[main.py]"]
  node_screen_routes["AI screening routes"]
  node_database[("Application database<br/>[database.py]")]
end

subgraph group_analysis["Document analysis"]
  node_ocr["OCR processing<br/>[ocr.py]"]
  node_field_extract["Field extraction<br/>[field_extractor.py]"]
  node_document_extract["Document extraction"]
  node_aadhaar_extract["Aadhaar extraction"]
  node_identity_check["Identity checks"]
  node_consistency["Document consistency"]
  node_cross_consistency["Cross-document checks"]
  node_risk["Risk assessment<br/>[risk_engine.py]"]
  node_verification["Document verification"]
end

subgraph group_screening["Forensic screening"]
  node_fake_screener["Fake-document screener"]
  node_c2pa["C2PA credentials<br/>[c2pa_checker.py]"]
  node_deep_learning["Image detector"]
  node_exif["EXIF analysis<br/>[exif_checker.py]"]
  node_ela["ELA analysis<br/>[forensics_ela.py]"]
  node_ocr_forensics["OCR forensics<br/>[ocr_forensics.py]"]
  node_streamlit_ui["Forensic screening UI<br/>[app.py]"]
end

node_user(("User"))

node_user -->|"uses"| node_react_app
node_react_app -->|"routes to"| node_screen_workspace
node_react_app -->|"routes to"| node_analysis_report
node_react_app -->|"routes to"| node_audit_view
node_react_app -->|"routes to"| node_portal
node_screen_workspace -.->|"submits screening"| node_api_entry
node_api_entry -->|"uses"| node_database
node_api_entry -->|"calls"| node_ocr
node_api_entry -->|"calls"| node_field_extract
node_api_entry -->|"calls"| node_identity_check
node_api_entry -->|"calls"| node_consistency
node_api_entry -->|"calls"| node_cross_consistency
node_api_entry -->|"calls"| node_risk
node_api_entry -->|"calls"| node_verification
node_api_entry -->|"calls"| node_document_extract
node_api_entry -->|"registers router"| node_screen_routes
node_screen_routes -->|"runs"| node_fake_screener
node_screen_routes -->|"computes heatmap"| node_ela
node_fake_screener -->|"checks"| node_c2pa
node_fake_screener -->|"checks"| node_deep_learning
node_fake_screener -->|"checks"| node_exif
node_fake_screener -->|"checks"| node_ela
node_fake_screener -->|"checks"| node_ocr_forensics
node_document_extract -->|"delegates to"| node_aadhaar_extract
node_analysis_report -.->|"loads results"| node_api_entry
node_streamlit_ui -->|"displays evidence"| node_c2pa
node_streamlit_ui -->|"displays evidence"| node_exif
node_streamlit_ui -->|"displays evidence"| node_ela

click node_react_app "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/src/App.jsx"
click node_screen_workspace "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/src/Pages/ForensicDeepDive.jsx"
click node_analysis_report "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/src/Pages/AnalysisResult.jsx"
click node_audit_view "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/src/Pages/AuditLogs.jsx"
click node_portal "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/src/Pages/UserPortal.jsx"
click node_api_entry "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/main.py"
click node_screen_routes "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/ai_screening_routes.py"
click node_database "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/database.py"
click node_ocr "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/ocr.py"
click node_field_extract "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/field_extractor.py"
click node_document_extract "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/document_specific_extractor.py"
click node_aadhaar_extract "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/aadhaar_extractor.py"
click node_identity_check "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/identity_checker.py"
click node_consistency "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/document_consistency.py"
click node_cross_consistency "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/cross_document_consistency.py"
click node_risk "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/risk_engine.py"
click node_verification "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/document_verification_engine.py"
click node_fake_screener "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/ai_fake_screener.py"
click node_c2pa "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/c2pa_checker.py"
click node_deep_learning "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/deep_learning_detector.py"
click node_exif "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/exif_checker.py"
click node_ela "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/forensics_ela.py"
click node_ocr_forensics "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/ocr_forensics.py"
click node_streamlit_ui "https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/app.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_react_app,node_screen_workspace,node_analysis_report,node_audit_view,node_portal,node_user toneBlue
class node_api_entry,node_screen_routes,node_database toneAmber
class node_ocr,node_field_extract,node_document_extract,node_aadhaar_extract,node_identity_check,node_consistency,node_cross_consistency,node_risk,node_verification toneMint
class node_fake_screener,node_c2pa,node_deep_learning,node_exif,node_ela,node_ocr_forensics,node_streamlit_ui toneRose
```

## Components

### User interface

- [React app routing](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/src/App.jsx): `src/App.jsx`
- [Screening workspace](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/src/Pages/ForensicDeepDive.jsx): `src/Pages/ForensicDeepDive.jsx`
- [Analysis report](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/src/Pages/AnalysisResult.jsx): `src/Pages/AnalysisResult.jsx`
- [Audit logs](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/src/Pages/AuditLogs.jsx): `src/Pages/AuditLogs.jsx`
- [User portal](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/src/Pages/UserPortal.jsx): `src/Pages/UserPortal.jsx`

### API and persistence

- [FastAPI routes](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/main.py): `backend/app/main.py`
- [AI screening routes](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/ai_screening_routes.py): `backend/app/ai_screening_routes.py`
- [Application database](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/database.py): `backend/app/database.py`

### Document analysis

- [OCR processing](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/ocr.py): `backend/app/services/ocr.py`
- [Field extraction](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/field_extractor.py): `backend/app/services/field_extractor.py`
- [Document extraction](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/document_specific_extractor.py): `backend/app/services/document_specific_extractor.py`
- [Aadhaar extraction](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/aadhaar_extractor.py): `backend/app/services/aadhaar_extractor.py`
- [Identity checks](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/identity_checker.py): `backend/app/services/identity_checker.py`
- [Document consistency](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/document_consistency.py): `backend/app/services/document_consistency.py`
- [Cross-document checks](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/cross_document_consistency.py): `backend/app/services/cross_document_consistency.py`
- [Risk assessment](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/risk_engine.py): `backend/app/services/risk_engine.py`
- [Document verification](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/document_verification_engine.py): `backend/app/services/document_verification_engine.py`

### Forensic screening

- [Fake-document screener](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/ai_fake_screener.py): `backend/app/services/ai_fake_screener.py`
- [C2PA credentials](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/c2pa_checker.py): `backend/app/services/c2pa_checker.py`
- [Image detector](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/deep_learning_detector.py): `backend/app/services/deep_learning_detector.py`
- [EXIF analysis](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/exif_checker.py): `backend/app/services/exif_checker.py`
- [ELA analysis](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/forensics_ela.py): `backend/app/services/forensics_ela.py`
- [OCR forensics](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/backend/app/services/ocr_forensics.py): `backend/app/services/ocr_forensics.py`
- [Forensic screening UI](https://github.com/akblaster967-afk/akhilchaturvedi/blob/main/app.py): `app.py`

### Other components

- **User**

## Connections

- User → React app routing: uses (evidence: `README.md`)
- React app routing → Screening workspace: routes to (evidence: `src/App.jsx`)
- React app routing → Analysis report: routes to (evidence: `src/App.jsx`)
- React app routing → Audit logs: routes to (evidence: `src/App.jsx`)
- React app routing → User portal: routes to (evidence: `src/App.jsx`)
- Screening workspace → FastAPI routes: submits screening
- FastAPI routes → Application database: uses (evidence: `backend/app/main.py`)
- FastAPI routes → OCR processing: calls (evidence: `backend/app/main.py`)
- FastAPI routes → Field extraction: calls (evidence: `backend/app/main.py`)
- FastAPI routes → Identity checks: calls (evidence: `backend/app/main.py`)
- FastAPI routes → Document consistency: calls (evidence: `backend/app/main.py`)
- FastAPI routes → Cross-document checks: calls (evidence: `backend/app/main.py`)
- FastAPI routes → Risk assessment: calls (evidence: `backend/app/main.py`)
- FastAPI routes → Document verification: calls (evidence: `backend/app/main.py`)
- FastAPI routes → Document extraction: calls (evidence: `backend/app/main.py`)
- FastAPI routes → AI screening routes: registers router (evidence: `backend/app/main.py`)
- AI screening routes → Fake-document screener: runs (evidence: `backend/app/ai_screening_routes.py`)
- AI screening routes → ELA analysis: computes heatmap (evidence: `backend/app/ai_screening_routes.py`)
- Fake-document screener → C2PA credentials: checks (evidence: `backend/app/services/ai_fake_screener.py`)
- Fake-document screener → Image detector: checks (evidence: `backend/app/services/ai_fake_screener.py`)
- Fake-document screener → EXIF analysis: checks (evidence: `backend/app/services/ai_fake_screener.py`)
- Fake-document screener → ELA analysis: checks (evidence: `backend/app/services/ai_fake_screener.py`)
- Fake-document screener → OCR forensics: checks (evidence: `backend/app/services/ai_fake_screener.py`)
- Document extraction → Aadhaar extraction: delegates to (evidence: `backend/app/services/document_specific_extractor.py`)
- Analysis report → FastAPI routes: loads results
- Forensic screening UI → C2PA credentials: displays evidence (evidence: `app.py`)
- Forensic screening UI → EXIF analysis: displays evidence (evidence: `app.py`)
- Forensic screening UI → ELA analysis: displays evidence (evidence: `app.py`)
