User:Agamyasamuel/Project - Indic Book Metadata Extractor/Updates
Appearance
Month 1 — May 2026
[edit]Status: On track
Goals for this month
[edit]- Foundation and vertical slice — get a single PDF through the entire pipeline end-to-end
- Scaffold monorepo with Docker Compose (7 services: postgres, redis, backend, worker, ollama, flower, frontend)
- Implement core workflow: upload → page select → preprocessing → OCR review → LLM extraction → metadata review → library
What shipped
[edit]- Project scaffolding & infrastructure — FastAPI backend with async SQLAlchemy, Celery worker, Next.js frontend with TypeScript and Tailwind, Docker Compose orchestration, Alembic migrations for 7 database tables
- PDF upload & page extraction — multipart upload endpoint, PyMuPDF-based PDF service (300 DPI thumbnails, full-resolution rendering), page selection UI with thumbnail grid
- Image preprocessing & OCR pipeline — OpenCV/Pillow preprocessing (grayscale, brightness, contrast, binarization, deskew) with per-page tuning sliders; Tesseract OCR for Telugu, Hindi, and English scripts with bounding box output
- OCR review UI — side-by-side bounding box canvas (react-konva) and editable text editor, click-to-highlight, page navigation, job polling with progress tracking
- LLM metadata extraction — Ollama + Instructor integration with Airavata 7B, 52-field Pydantic schema grouped into extraction batches, Jinja2 prompt template system, Celery task with batched sequential calls and progress tracking
- LLM config & metadata review UI — model selection, temperature/top_p/max_tokens sliders, editable prompts, job queue dashboard with status badges; 52-field metadata form with collapsible sections, low-confidence highlighting, inline editing
- Library & search — pg_trgm fuzzy search across title/author/publisher/description, paginated book listing with filters (language, genre, year, publisher), Fuse.js client-side instant search, book detail page with metadata and page gallery
- Workflow stepper & polish — 7-step persistent navigation (Zustand with server hydration), toast notifications (sonner), global and workflow error boundaries, dark mode, skeleton loading states, responsive layout, skip-to-content and prefers-reduced-motion accessibility
- English language support — added English as a third upload/OCR language alongside Telugu and Hindi, with language name utility
- Airavata model management — Modelfile.airavata for HuggingFace GGUF import, Docker entrypoint builds from Modelfile instead of registry pull
- Test suite — pytest backend infrastructure with async support and SQLite fixtures; Vitest frontend infrastructure with React/Next.js mocks; Playwright E2E tests for full workflow
- Documentation — README with architecture diagram, user guide, developer guide, API reference, changelog, known issues, and local development setup guide
- Bug fixes & hardening — Celery event loop fixes, OCR job cancellation, image cache-busting, library thumbnail URL generation, instructor API compatibility, workflow step type casting
Screenshots
[edit]-
Step 2 — Page selection with thumbnail grid
-
Step 4 — OCR review with bounding boxes
-
Step 6 — 52-field metadata review form
Metrics
[edit]- Commits: 115
- Tests passing: 155 backend / 132 frontend / 11 E2E
- Backend modules: 9 services, 5 API routers, 5 schemas, 5 task modules, 9 models
- Frontend source files: 36 TypeScript/TSX files
- OCR accuracy (clean scans): ~70–85% (Tesseract on Telugu/Hindi)
Blockers / risks
[edit]- Tesseract OCR accuracy on Indic scripts — the critical risk identified in planning. Clean scans achieve ~70–85% accuracy; degraded scans are lower. Mitigation: preprocessing tuning sliders, OCR correction as a core workflow step (not nice-to-have), bilingual `tel+eng`/`hin+eng` language parameters
- Airavata 7B on CPU-only — 5–15 tokens/sec means 10–20 minutes per full 52-field extraction. Mitigation: background Celery task with progress polling, clear status indication in UI
- Instructor + Ollama compatibility — required updating to deprecated API path for structured output. Resolved in Month 1
Next month's plan
[edit]- Infrastructure hardening — Docker resource limits, Redis hardening, rate limiting, CORS, deep health checks
- Observability — New Relic APM integration (backend, frontend, Celery workers, browser RUM)
- Security audit — path traversal hardening, rate limiter spoofing fixes, storage service lockdown
- Production deployment — Dokploy deployment configuration, production Docker Compose, deployment scripts
- Performance — parallel OCR with Celery group/chord, lazy engine initialization, batch thumbnail generation, pagination for page selector
Month 2 — June 2026
[edit]Status: On track
Goals for this month
[edit]- Production readiness — harden infrastructure, add observability, secure the application
- Deployment — configure Dokploy for production deployment with automated scripts
- Extended capabilities — Wikibase integration and bulk operations for dataset management
What shipped
[edit]- Infrastructure hardening — Docker resource limits and optimized build context, Redis hardening, rate limiting with CORS configuration, lifespan handler with deep health checks, backup/restore/auto-migration scripts, Makefile backup targets
- Backend resilience — circuit breaker pattern for external services, async I/O improvements, LLM progress tracking fixes, parallelized OCR with Celery group/chord and queue routing, lazy engine initialization with NullPool for Celery workers
- New Relic APM integration — full-stack observability with structured JSON logging, slow query detection, function traces and custom business events on all services, Celery background task tracing, Node.js agent for frontend server-side monitoring, browser RUM (Real User Monitoring) for frontend
- Security hardening — storage service path traversal protection, removal of spoofable X-Forwarded-For header from rate limiter, environment variable injection for MediaWiki secret keys, Docker Ollama entrypoint reliability improvements
- Performance improvements — pg_trgm GIN indexes for fuzzy text search, batch PDF thumbnail generation as background task on upload, page selector pagination to avoid loading all thumbnails at once, thumbnail GET requests exempted from rate limiting
- Production deployment — production Docker Compose for Dokploy, deployment helper script, deployment guide with Makefile targets, internal service port exposure for container networking, .env.production configuration
- Test fixtures & sample data — sample PDF generation script, Telugu and Hindi fixture metadata populated with sample values, English sample fixture with expected metadata
- Wikibase & OpenRefine integration — Wikibase (MediaWiki-based) and OpenRefine 3.10.1 Docker services added to Docker Compose, OpenRefine HTTP API client, Wikibase architecture documentation explaining MediaWiki relationship
- Bulk operations — Pydantic schemas for bulk operations, REST API endpoints, dedicated bulk operations page with navigation, comprehensive documentation guide
- Bug fixes — SQL DISTINCT+ORDER BY error in library filters, Celery worker event loop fixes, LLM extraction on CPU-only Ollama, .gitattributes for LF line endings on shell scripts, chmod on read-only backup script mounts
Screenshots
[edit]-
Step 2 — Page selection with thumbnail grid
-
Step 4 — OCR review with bounding boxes
-
Step 6 — 52-field metadata review form
Metrics
[edit]- Commits: 70
- Pull requests merged: 2 (backend-resilience-and-infra-improvements, new-relic-integration)
- New Docker services: 2 (Wikibase, OpenRefine)
- Security fixes: 4 (path traversal, spoofable headers, secret keys, entrypoint reliability)
- Documentation added: deployment guide, bulk operations guide, monitoring guide, Wikibase/OpenRefine integration docs
Blockers / risks
[edit]- Wikibase complexity — Wikibase requires MediaWiki + Elasticsearch stack, adding significant Docker resource footprint. Mitigated by downgrading to mw1.44.0 for stability and fixing Elasticsearch healthchecks
- New Relic overhead — full APM instrumentation adds latency to every request. Mitigated by using function-level traces (not line-level) and sampling configuration
Next month's plan
[edit]- Final integration testing against production-like Docker Compose stack
- End-to-end workflow validation with real Telugu/Hindi PDFs
- Documentation polish and known-issues finalization
- Performance benchmarking and optimization pass
- Release v0.1.0 tagging and changelog
Month 3 — July 2026
[edit]Status: