# niladri990/ai-based-fake-identity-document-screening-system-sih26188 architecture

> Architecture diagram of the GitHub repository niladri990/ai-based-fake-identity-document-screening-system-sih26188, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188
- Repository: https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188

## Overview

DocVerify AI is a prototype for officer-led identity-document screening. Officers authenticate, upload a document and optional live portrait, review the screening dossier, and record a determination. The screening API orchestrates extraction, ICAO MRZ parsing, rule validation, tampering and face analysis, registry checks, risk scoring, and report generation. The React application also supports dashboard, history, alerts, registry administration, settings, and audit review. The README documents these capabilities; some service-level links are supported by the screening module’s SOURCE INDEX references rather than sampled service implementations.

Main entry points: [`backend/app/api/screenings.py`](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/screenings.py) (Screening API), [`frontend/src/services/api.ts`](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/services/api.ts) (API Client), [`frontend/src/App.tsx`](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/App.tsx) (App Navigation), [`backend/app/main.py`](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/main.py) (FastAPI App)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Officer Workspace"]
  node_app["App Navigation<br/>[App.tsx]"]
  node_authui["Auth State<br/>[AuthContext.tsx]"]
  node_screeningui["New Screening<br/>[NewScreening.tsx]"]
  node_caseui["Case Inspector<br/>[CaseInspector.tsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.tsx]"]
  node_history["History<br/>[History.tsx]"]
  node_alerts["Alerts<br/>[Alerts.tsx]"]
  node_settingsui["Settings<br/>[Settings.tsx]"]
  node_apiclient["API Client<br/>[api.ts]"]
end

subgraph group_api["Backend API"]
  node_main["FastAPI App<br/>[main.py]"]
  node_documents["Document Upload<br/>[documents.py]"]
  node_screenings["Screening API<br/>[screenings.py]"]
  node_registries["Registry API<br/>[registries.py]"]
  node_audit["Audit API<br/>[audit.py]"]
  node_settingsapi["Risk Settings API<br/>[settings.py]"]
end

subgraph group_analysis["Screening Analysis"]
  node_ocr["OCR Extraction<br/>[ocr_service.py]"]
  node_mrz["MRZ Engine<br/>[mrz_service.py]"]
  node_validation["Document Validation"]
  node_forensics["ELA Forensics"]
  node_face["Face Matching<br/>[face_service.py]"]
  node_registrycheck["Registry Checks"]
  node_risk["Risk Scoring<br/>[risk_engine.py]"]
  node_report["PDF Dossier<br/>[report_service.py]"]
end

subgraph group_persistence["Data and Storage"]
  node_database[("PostgreSQL<br/>[models.py]")]
  node_dbsession["DB Session<br/>[session.py]"]
  node_storage[("Document Storage<br/>[config.py]")]
end

subgraph group_identity["Identity and Access"]
  node_security["JWT Security<br/>[security.py]"]
  node_authapi["Auth API<br/>[auth.py]"]
  node_deps["Access Dependencies<br/>[deps.py]"]
end

node_officer(("Security Officer"))

node_officer -->|"uses"| node_app
node_app -->|"provides auth"| node_authui
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_screeningui
node_app -->|"routes to"| node_caseui
node_app -->|"routes to"| node_history
node_app -->|"routes to"| node_alerts
node_app -->|"routes to"| node_settingsui
node_screeningui -->|"submits screening"| node_apiclient
node_caseui -->|"loads dossier"| node_apiclient
node_dashboard -->|"loads metrics"| node_apiclient
node_history -->|"loads cases"| node_apiclient
node_alerts -->|"loads alerts"| node_apiclient
node_settingsui -->|"loads settings"| node_apiclient
node_authui -->|"authenticates"| node_apiclient
node_apiclient -->|"uploads document"| node_documents
node_apiclient -->|"requests screening"| node_screenings
node_apiclient -->|"manages records"| node_registries
node_apiclient -->|"updates weights"| node_settingsapi
node_main -->|"mounts router"| node_documents
node_main -->|"mounts router"| node_screenings
node_main -->|"mounts router"| node_registries
node_main -->|"mounts router"| node_audit
node_main -->|"mounts router"| node_settingsapi
node_screenings -->|"extracts fields"| node_ocr
node_screenings -->|"parses MRZ"| node_mrz
node_screenings -->|"validates document"| node_validation
node_screenings -->|"checks tampering"| node_forensics
node_screenings -->|"matches portrait"| node_face
node_screenings -->|"checks watchlists"| node_registrycheck
node_screenings -->|"calculates risk"| node_risk
node_screenings -->|"generates dossier"| node_report
node_screenings -.->|"persists results"| node_database
node_documents -.->|"stores uploads"| node_storage
node_documents -->|"records metadata"| node_database
node_registries -->|"reads and writes"| node_database
node_audit -->|"reads audit log"| node_database
node_settingsapi -->|"reads weights"| node_database
node_screenings -->|"requires access"| node_deps
node_documents -->|"requires access"| node_deps
node_authapi -->|"issues tokens"| node_security
node_deps -->|"decodes token"| node_security
node_deps -->|"gets database session"| node_dbsession
node_dbsession -->|"connects ORM"| node_database
node_main -->|"creates tables"| node_dbsession
node_report -.->|"writes dossier"| node_storage

click node_app "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/App.tsx"
click node_authui "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/context/AuthContext.tsx"
click node_screeningui "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/pages/NewScreening.tsx"
click node_caseui "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/pages/CaseInspector.tsx"
click node_dashboard "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/pages/Dashboard.tsx"
click node_history "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/pages/History.tsx"
click node_alerts "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/pages/Alerts.tsx"
click node_settingsui "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/pages/Settings.tsx"
click node_apiclient "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/services/api.ts"
click node_main "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/main.py"
click node_documents "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/documents.py"
click node_screenings "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/screenings.py"
click node_registries "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/registries.py"
click node_audit "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/audit.py"
click node_settingsapi "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/settings.py"
click node_ocr "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/ocr_service.py"
click node_mrz "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/mrz_service.py"
click node_validation "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/validation_service.py"
click node_forensics "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/forensics_service.py"
click node_face "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/face_service.py"
click node_registrycheck "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/registry_service.py"
click node_risk "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/risk_engine.py"
click node_report "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/report_service.py"
click node_database "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/models/models.py"
click node_dbsession "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/db/session.py"
click node_storage "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/core/config.py"
click node_security "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/core/security.py"
click node_authapi "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/auth.py"
click node_deps "https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/deps.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,node_authui,node_screeningui,node_caseui,node_dashboard,node_history,node_alerts,node_settingsui,node_apiclient toneBlue
class node_main,node_documents,node_screenings,node_registries,node_audit,node_settingsapi toneAmber
class node_ocr,node_mrz,node_validation,node_forensics,node_face,node_registrycheck,node_risk,node_report toneMint
class node_database,node_dbsession,node_storage toneRose
class node_security,node_authapi,node_deps,node_officer toneIndigo
```

## Components

### Officer Workspace

- [App Navigation](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Auth State](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [New Screening](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/pages/NewScreening.tsx): `frontend/src/pages/NewScreening.tsx`
- [Case Inspector](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/pages/CaseInspector.tsx): `frontend/src/pages/CaseInspector.tsx`
- [Dashboard](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [History](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/pages/History.tsx): `frontend/src/pages/History.tsx`
- [Alerts](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/pages/Alerts.tsx): `frontend/src/pages/Alerts.tsx`
- [Settings](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/pages/Settings.tsx): `frontend/src/pages/Settings.tsx`
- [API Client](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`

### Backend API

- [FastAPI App](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/main.py): `backend/app/main.py`
- [Document Upload](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/documents.py): `backend/app/api/documents.py`
- [Screening API](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/screenings.py): `backend/app/api/screenings.py`
- [Registry API](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/registries.py): `backend/app/api/registries.py`
- [Audit API](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/audit.py): `backend/app/api/audit.py`
- [Risk Settings API](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/settings.py): `backend/app/api/settings.py`

### Screening Analysis

- [OCR Extraction](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/ocr_service.py): `backend/app/services/ocr_service.py`
- [MRZ Engine](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/mrz_service.py): `backend/app/services/mrz_service.py`
- [Document Validation](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/validation_service.py): `backend/app/services/validation_service.py`
- [ELA Forensics](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/forensics_service.py): `backend/app/services/forensics_service.py`
- [Face Matching](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/face_service.py): `backend/app/services/face_service.py`
- [Registry Checks](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/registry_service.py): `backend/app/services/registry_service.py`
- [Risk Scoring](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/risk_engine.py): `backend/app/services/risk_engine.py`
- [PDF Dossier](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/services/report_service.py): `backend/app/services/report_service.py`

### Data and Storage

- [PostgreSQL](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/models/models.py): `backend/app/models/models.py`
- [DB Session](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/db/session.py): `backend/app/db/session.py`
- [Document Storage](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/core/config.py): `backend/app/core/config.py`

### Identity and Access

- [JWT Security](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/core/security.py): `backend/app/core/security.py`
- [Auth API](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Access Dependencies](https://github.com/niladri990/ai-based-fake-identity-document-screening-system-sih26188/blob/main/backend/app/api/deps.py): `backend/app/api/deps.py`

### Other components

- **Security Officer**

## Connections

- Security Officer → App Navigation: uses (evidence: `README.md`)
- App Navigation → Auth State: provides auth (evidence: `frontend/src/App.tsx`)
- App Navigation → Dashboard: routes to (evidence: `frontend/src/App.tsx`)
- App Navigation → New Screening: routes to (evidence: `frontend/src/App.tsx`)
- App Navigation → Case Inspector: routes to (evidence: `frontend/src/App.tsx`)
- App Navigation → History: routes to (evidence: `frontend/src/App.tsx`)
- App Navigation → Alerts: routes to (evidence: `frontend/src/App.tsx`)
- App Navigation → Settings: routes to (evidence: `frontend/src/App.tsx`)
- New Screening → API Client: submits screening (evidence: `frontend/src/services/api.ts`)
- Case Inspector → API Client: loads dossier (evidence: `frontend/src/pages/CaseInspector.tsx`)
- Dashboard → API Client: loads metrics (evidence: `frontend/src/pages/Dashboard.tsx`)
- History → API Client: loads cases (evidence: `frontend/src/pages/History.tsx`)
- Alerts → API Client: loads alerts (evidence: `frontend/src/pages/Alerts.tsx`)
- Settings → API Client: loads settings (evidence: `frontend/src/pages/Settings.tsx`)
- Auth State → API Client: authenticates (evidence: `frontend/src/context/AuthContext.tsx`)
- API Client → Document Upload: uploads document (evidence: `frontend/src/services/api.ts`)
- API Client → Screening API: requests screening (evidence: `frontend/src/services/api.ts`)
- API Client → Registry API: manages records (evidence: `frontend/src/services/api.ts`)
- API Client → Risk Settings API: updates weights (evidence: `frontend/src/services/api.ts`)
- FastAPI App → Document Upload: mounts router (evidence: `backend/app/main.py`)
- FastAPI App → Screening API: mounts router (evidence: `backend/app/main.py`)
- FastAPI App → Registry API: mounts router (evidence: `backend/app/main.py`)
- FastAPI App → Audit API: mounts router (evidence: `backend/app/main.py`)
- FastAPI App → Risk Settings API: mounts router (evidence: `backend/app/main.py`)
- Screening API → OCR Extraction: extracts fields (evidence: `backend/app/api/screenings.py`)
- Screening API → MRZ Engine: parses MRZ (evidence: `backend/app/api/screenings.py`)
- Screening API → Document Validation: validates document (evidence: `backend/app/api/screenings.py`)
- Screening API → ELA Forensics: checks tampering (evidence: `backend/app/api/screenings.py`)
- Screening API → Face Matching: matches portrait (evidence: `backend/app/api/screenings.py`)
- Screening API → Registry Checks: checks watchlists (evidence: `backend/app/api/screenings.py`)
- Screening API → Risk Scoring: calculates risk (evidence: `backend/app/api/screenings.py`)
- Screening API → PDF Dossier: generates dossier (evidence: `backend/app/api/screenings.py`)
- Screening API → PostgreSQL: persists results (evidence: `backend/app/api/screenings.py`)
- Document Upload → Document Storage: stores uploads (evidence: `backend/app/api/documents.py`)
- Document Upload → PostgreSQL: records metadata (evidence: `backend/app/api/documents.py`)
- Registry API → PostgreSQL: reads and writes (evidence: `backend/app/api/registries.py`)
- Audit API → PostgreSQL: reads audit log (evidence: `backend/app/api/audit.py`)
- Risk Settings API → PostgreSQL: reads weights (evidence: `backend/app/api/settings.py`)
- Screening API → Access Dependencies: requires access (evidence: `backend/app/api/screenings.py`)
- Document Upload → Access Dependencies: requires access (evidence: `backend/app/api/documents.py`)
- Auth API → JWT Security: issues tokens (evidence: `backend/app/api/auth.py`)
- Access Dependencies → JWT Security: decodes token (evidence: `backend/app/api/deps.py`)
- Access Dependencies → DB Session: gets database session (evidence: `backend/app/api/deps.py`)
- DB Session → PostgreSQL: connects ORM (evidence: `backend/app/db/session.py`)
- FastAPI App → DB Session: creates tables (evidence: `backend/app/main.py`)
- PDF Dossier → Document Storage: writes dossier
