How ravindra4158/sih_2026 works
Purpose and entry points
This is an AI-assisted identity-document screening MVP. A React/Vite officer interface submits document uploads to a FastAPI backend, which produces explainable screening evidence rather than authenticity proof. Backend startup is backend/app/main.py; frontend bootstrap is frontend/src/main.jsx with UI composition in frontend/src/App.jsx.
HTTP/API boundary
Versioned FastAPI routes separate document processing, biometrics, forensics, checksum, and screening concerns. The document routes own upload/process/verification-facing interactions; request and report contracts are centralized in model modules.
• backend/app/api/v1/document.py
• backend/app/api/v1/screening.py
• backend/app/models/request_models.py
• backend/app/models/response_models.py
Document-processing orchestration
The primary flow is: multipart upload validation and temporary handling → image/PDF preparation → OCR and extraction → structural/forensic checks → deterministic screening/risk result. The orchestration service should coordinate stages rather than route handlers embedding processing logic. Shared case/report shapes support metadata-only history and results.
• backend/app/services/orchestration_service.py
• backend/app/services/ocr_service.py
• backend/app/services/layout_validation_service.py
• backend/app/models/case_models.py
Evidence and verification stages
Independent service boundaries allow screening signals to be reported separately and replaced later with trained models or integrations. OCR supports document data recovery; Aadhaar QR and barcode services add machine-readable evidence; checksum, cross-reference, ELA, and biometric services contribute validation or forensic signals.
• backend/app/services/aadhaar_qr_service.py
• backend/app/services/barcode_service.py
• backend/app/services/checksum_service.py
• backend/app/services/cross_reference_service.py
• backend/app/services/ela_service.py
• backend/app/services/biometrics_service.py
Client workflow
The frontend is a dashboard-style review application: upload and preview documents, inspect OCR/validation/forensics/biometric results, and review case-level risk and alerts. API access is isolated from view components; useCaseData is the likely client-side case state boundary. Some UI data may remain mock-backed during MVP development.
• frontend/src/services/api.js
• frontend/src/hooks/useCaseData.js
• frontend/src/pages/CaseDetails/index.jsx
• frontend/src/components/DocumentUpload/index.jsx
• frontend/src/components/RiskScore/index.jsx
Runtime, storage, and integration boundaries
Backend runtime is Python/FastAPI; frontend runtime is Node-based React/Vite. Docker Compose provides local container orchestration. Configuration controls CORS, upload limits, and temporary storage. MongoDB has a dedicated adapter boundary, while document database, external API, and watchlist integrations are intentionally empty extension points. Raw uploads are intended to be short-lived rather than durable records.
• backend/app/config/settings.py
• backend/app/database/mongodb.py
• backend/app/integrations/document_database/.gitkeep
• backend/app/integrations/external_apis/.gitkeep
• docker-compose.yml
ML lifecycle and external dependencies
The live backend uses service adapters; model development is separately organized for face, morphing, and tampering detection. Preprocessing includes image cleaning, ELA generation, and MRZ cropping. Operational capabilities depend on local OCR/PDF tooling (Tesseract and PyMuPDF) and optional MRZ-reader/DeepFace runtimes or weights; model source/weights are isolated under third-party and model directories.
• ml/preprocessing/image_cleaning.py
• ml/preprocessing/ela_generation.py
• ml/training/tampering/train.py
• third_party/mrz_model/source
• third_party/face_model/source
Main entry points: orchestration_service.py Screening orchestrator · document.py Versioned API routes · useCaseData.js Case data state · index.jsx Case review UI
Components 22
FastAPI backend
Document screening and evidence pipeline.
- Backend startup
backend/app/main.py - Versioned API routes · Document and screening endpoints expose processing and report workflows.
backend/app/api/v1/document.py - Request/report contracts
backend/app/models/request_models.py - Screening orchestrator · Coordinates upload preparation, evidence stages, and deterministic risk output.
backend/app/services/orchestration_service.py - OCR and extraction
backend/app/services/ocr_service.py - Layout validation
backend/app/services/layout_validation_service.py - QR and barcode evidence
backend/app/services/aadhaar_qr_service.py - Verification signals · Checksum, cross-reference, ELA, and biometric signals remain independently replaceable.
backend/app/services/checksum_service.py - Case and report shapes · Supports metadata-only history and screening results.
backend/app/models/case_models.py - Runtime settings · Controls CORS, upload limits, and temporary storage.
backend/app/config/settings.py - MongoDB adapter
backend/app/database/mongodb.py - Future integrations · Document database and external API adapters are intentionally empty.
backend/app/integrations/document_database/.gitkeep
Officer client
React/Vite case review workflow.
- Client bootstrap
frontend/src/main.jsx - Case data state
frontend/src/hooks/useCaseData.js - API client · Keeps API access outside view components.
frontend/src/services/api.js - Case review UI · Shows upload, document preview, evidence, alerts, and risk.
frontend/src/pages/CaseDetails/index.jsx - Document upload
frontend/src/components/DocumentUpload/index.jsx - Risk score view
frontend/src/components/RiskScore/index.jsx
ML lifecycle
Separately organized model development and assets.
- ML preprocessing · Image cleaning, ELA generation, and MRZ cropping prepare model inputs.
ml/preprocessing/image_cleaning.py - Tampering training
ml/training/tampering/train.py - Third-party model assets · MRZ and face model source and weights are isolated from live service code.
third_party/mrz_model/source
Other components
- Local containers · Runs the local frontend and backend environment.
docker-compose.yml
Connections 22
- Local containers → Backend startup: runs
- Local containers → Client bootstrap: runs
- Backend startup → Versioned API routes: mounts
- Versioned API routes → Request/report contracts: uses
- Versioned API routes → Screening orchestrator: submits processing
- Screening orchestrator → OCR and extraction: extracts text
- Screening orchestrator → Layout validation: checks structure
- Screening orchestrator → QR and barcode evidence: reads codes
- Screening orchestrator → Verification signals: collects signals
- Screening orchestrator → Case and report shapes: produces case report
- Screening orchestrator → MongoDB adapter: persists metadata/results
- Runtime settings → Screening orchestrator: configures limits/temp files
- Future integrations → Screening orchestrator: future evidence sources
- Client bootstrap → Case data state: initializes
- Case data state → API client: loads/submits cases
- API client → Versioned API routes: HTTP requests
- Case data state → Case review UI: supplies case data
- Case review UI → Document upload: composes
- Case review UI → Risk score view: composes
- ML preprocessing → Tampering training: prepares training inputs
- Tampering training → Third-party model assets: uses model assets
- Third-party model assets → Verification signals: optional runtime models