How sanjithsece/tamil-transcript- works
Purpose and Entry Points
OLA-AI is a manuscript-digitization MVP: it ingests Tamil palm-leaf images/documents, produces preserved/restored assets and text-derived metadata, exposes a searchable archive and grounded Q&A, and presents workflows in a React SPA. Backend startup is backend/app/main.py; frontend startup is frontend/src/main.tsx. Local multi-service execution is defined by docker-compose.yml.
Client Application
The Vite/React TypeScript frontend provides public, authenticated, researcher, and admin experiences. Routing/pages cover upload-digitization, archive browsing, manuscript detail, dashboard analytics, login/registration, and administration in frontend/src/pages/DigitizePage.tsx, frontend/src/pages/ArchivePage.tsx, and frontend/src/pages/ManuscriptPage.tsx. frontend/src/services/api.ts is the HTTP boundary to FastAPI; frontend/src/contexts/AuthContext.tsx owns client authentication state. The manuscript Q&A interaction is encapsulated in frontend/src/components/AskManuscript.tsx.
API, Auth, and Authorization
FastAPI composes health/API behavior and cross-origin access in backend/app/main.py. Route modules separate authentication, manuscript lifecycle, archive/search, and administrative controls: backend/app/api/auth.py, backend/app/api/manuscripts.py, backend/app/api/archive.py, and backend/app/api/admin.py. JWT issuance/validation and bcrypt password handling are centralized in backend/app/auth/security.py, placing authorization at the API boundary before protected upload and management actions.
Persistence and Asset Storage
SQLAlchemy configuration and domain entities establish the durable model boundary in backend/app/config/database.py and backend/app/models/entities.py. Manuscript-oriented reads/writes are isolated behind backend/app/repositories/manuscript_repository.py, while orchestration belongs in backend/app/services/manuscript_service.py. backend/app/services/storage_service.py abstracts original and restored file persistence: local storage supports demo development, while Supabase Storage is the deploy target. Database deployment can move from SQLite to Supabase PostgreSQL without changing API consumers.
Digitization Pipeline
Manuscript submission flows from the API/service layer through asset storage and a staged processing pipeline: image restoration/preprocessing, OCR, Tamil cleanup, AI interpretation/translation fallback, then searchable/indexable manuscript data. The concrete stage boundaries are backend/app/preprocessing/image_processor.py, backend/app/ocr/ocr_service.py, backend/app/services/tamil_text_processor.py, and backend/app/ai/providers.py. These replaceable service abstractions allow OpenCV/Pillow preprocessing, an optional Tamil-capable OCR engine, and provider-backed or fallback AI behavior without coupling routes to implementations.
Retrieval and Archive Flow
Archive endpoints search Tamil Unicode content across manuscript fields, returning persisted records through repository/service layers. For “Ask the Manuscript,” backend/app/rag/rag_service.py retrieves manuscript text chunks and constrains answers to that retrieved context; the API exposes this capability through backend/app/api/manuscripts.py and the frontend consumes it via frontend/src/components/AskManuscript.tsx. This creates a distinct retrieval boundary from generative/interpretive AI processing.
Runtime and External Services
The backend is Python/FastAPI with SQLAlchemy and configured environment settings in backend/app/config/settings.py; the frontend is React/Vite. backend/Dockerfile, frontend/Dockerfile, and docker-compose.yml support containerized local operation. Material external integrations are Supabase PostgreSQL and object storage, optional OCR/Tesseract Tamil data, and configurable AI providers. Demo mode seeds representative records through backend/app/services/demo_data.py and sample assets under sample-data/.
Main entry points: manuscripts.py Route Modules · manuscript_service.py Manuscript Service · api.ts API Client · manuscript_repository.py Manuscript Repository
Components 20
React Client
- React SPA · Public, researcher, and admin workflows.
frontend/src/main.tsx - Workflow Pages · Digitization, archive, and manuscript detail views.
frontend/src/pages/DigitizePage.tsx - API Client
frontend/src/services/api.ts - Auth State
frontend/src/contexts/AuthContext.tsx - Ask Manuscript
frontend/src/components/AskManuscript.tsx
FastAPI Backend
- FastAPI App · Hosts health, API routes, and CORS.
backend/app/main.py - Route Modules · Authentication, manuscript, archive, and admin endpoints.
backend/app/api/manuscripts.py - JWT Security · Issues and validates JWTs and hashes passwords.
backend/app/auth/security.py - Manuscript Service · Orchestrates lifecycle, processing, and persistence.
backend/app/services/manuscript_service.py
Digitization & Retrieval
- Image Restoration · Prepares palm-leaf imagery for OCR.
backend/app/preprocessing/image_processor.py - Tamil OCR · Uses an optional Tamil-capable OCR engine.
backend/app/ocr/ocr_service.py - Tamil Text Cleanup
backend/app/services/tamil_text_processor.py - AI Interpretation · Provider-backed translation/interpretation with fallback behavior.
backend/app/ai/providers.py - Grounded RAG · Answers only from retrieved manuscript text chunks.
backend/app/rag/rag_service.py
Persistence & Integrations
- Manuscript Repository
backend/app/repositories/manuscript_repository.py - Domain Entities
backend/app/models/entities.py - SQL Database · Durable manuscript records and searchable fields.
backend/app/config/database.py - Asset Storage Service · Persists original and restored files.
backend/app/services/storage_service.py - Object Storage
- Local Containers · Runs frontend and backend services locally.
docker-compose.yml
Connections 22
- React SPA → Workflow Pages: renders
- Workflow Pages → API Client: calls
- Auth State → API Client: supplies JWT
- Ask Manuscript → API Client: submits questions
- API Client → FastAPI App: HTTP
- FastAPI App → Route Modules: mounts
- Route Modules → JWT Security: authenticates
- Route Modules → Manuscript Service: lifecycle and archive requests
- Route Modules → Grounded RAG: Ask Manuscript
- Manuscript Service → Asset Storage Service: stores assets
- Asset Storage Service → Object Storage: persists files
- Manuscript Service → Image Restoration: processes uploads
- Image Restoration → Tamil OCR: prepared image
- Tamil OCR → Tamil Text Cleanup: raw text
- Tamil Text Cleanup → AI Interpretation: cleaned Tamil text
- Manuscript Service → Manuscript Repository: reads and writes
- AI Interpretation → Manuscript Repository: derived metadata
- Manuscript Repository → Domain Entities: maps
- Domain Entities → SQL Database: persists
- Grounded RAG → Manuscript Repository: retrieves text chunks
- Local Containers → React SPA: runs
- Local Containers → FastAPI App: runs