How omar-khecharem/scriptvaultocr works
ScriptVault OCR is a local web application for extracting and reviewing examination-form fields from images. The main workflow is browser upload → FastAPI OCR endpoint → image decoding and OCR → form extraction and validation, with optional visual-model assistance → structured results for manual review. The repository also exposes batch, form, health, and document-export capabilities. The README documents the principal OCR stages; source excerpts and the source index support the internal call links. Some unsampled implementation details and wiring are intentionally not inferred.
Main entry points: app.py FastAPI app · App.jsx Review workspace · ocr_single.py Single-file OCR · core_ocr.py OCR engines
Components 27
Review interface
- Review workspace
web/src/App.jsx - API client
web/src/api/client.js - Field review
web/src/components/FormPanel.jsx - Page viewer
web/src/components/ImageCanvas.jsx - Batch table
web/src/components/BatchTable.jsx - Review helpers
web/src/utils/review.js
HTTP application
- FastAPI app
backend/api/app.py - OCR routes
backend/api/routes/ocr.py - Batch routes
backend/api/routes/batch.py - Form routes
backend/api/routes/form.py - Export routes
backend/api/routes/export.py - Health route
backend/api/routes/health.py
OCR and extraction
- Single-file OCR
backend/application/use_cases/ocr_single.py - Batch processing
backend/application/use_cases/ocr_batch.py - OCR engines
backend/exam_ocr/core_ocr.py - Paddle fallback
backend/exam_ocr/paddle_engine.py - Image processing
backend/exam_ocr/image_processing.py - Form analysis
backend/exam_ocr/form_analyzer.py - Character correction
backend/exam_ocr/char_corrector.py - Handwriting reader
backend/exam_ocr/htr_engine.py
AI and export
- Visual form reader
backend/infrastructure/vlm/reader.py - VLM providers
backend/infrastructure/vlm/providers.py - VLM configuration
backend/config/vlm_config.py - Document export
backend/infrastructure/exporter/document.py
Other components
- Reviewer
- Ollama
- Cloudflare AI
Connections 28
- Reviewer → Review workspace: reviews
README.md - Review workspace → API client: uploads files
web/src/App.jsx - Review workspace → Field review: renders fields
web/src/App.jsx - Review workspace → Page viewer: renders pages
web/src/App.jsx - Review workspace → Batch table: renders batches
web/src/App.jsx - Field review → Review helpers: uses review rules
- API client → OCR routes: sends OCR request
README.md - FastAPI app → OCR routes: registers routes
backend/api/app.py - FastAPI app → Batch routes: registers routes
backend/api/app.py - FastAPI app → Form routes: registers routes
backend/api/app.py - FastAPI app → Export routes: registers routes
backend/api/app.py - FastAPI app → Health route: registers routes
backend/api/app.py - OCR routes → Single-file OCR: dispatches OCR
- Batch routes → Single-file OCR: processes files
backend/api/routes/batch.py - Single-file OCR → OCR engines: recognizes images
backend/application/use_cases/ocr_single.py - Single-file OCR → Form analysis: extracts fields
backend/application/use_cases/ocr_single.py - Single-file OCR → Visual form reader: requests optional reading
backend/application/use_cases/ocr_single.py - OCR engines → Image processing: uses processing
backend/exam_ocr/core_ocr.py - OCR engines → Handwriting reader: uses HTR
backend/exam_ocr/core_ocr.py - OCR engines → Paddle fallback: selects fallback
README.md - Paddle fallback → Handwriting reader: optionally reads handwriting
backend/exam_ocr/paddle_engine.py - Form analysis → Character correction: corrects characters
backend/exam_ocr/form_analyzer.py - Visual form reader → VLM providers: creates provider
backend/infrastructure/vlm/reader.py - Visual form reader → VLM configuration: uses settings
backend/infrastructure/vlm/reader.py - VLM providers → Ollama: calls selected service
README.md - VLM providers → Cloudflare AI: calls selected service
README.md - Export routes → Document export: exports document
- Batch routes → Batch processing: dispatches batches