feat: Core OCR API Integration (#65) #74

Merged
egullickson merged 1 commits from issue-65-core-ocr-api into main 2026-02-02 01:17:25 +00:00
Owner

Summary

  • Implements OCR service endpoints (POST /extract, POST /jobs, GET /jobs/{job_id})
  • Creates backend proxy routes with JWT authentication
  • Adds image preprocessing (deskew, denoise) for improved accuracy
  • Integrates Redis job queue for async processing of large files
  • Supports HEIC, JPEG, PNG, and PDF file formats

Changes

OCR Service (Python/FastAPI)

  • ocr/app/models/schemas.py - Pydantic models for request/response validation
  • ocr/app/services/preprocessor.py - Image preprocessing (deskew, denoise)
  • ocr/app/services/ocr_service.py - Core OCR logic with Tesseract and HEIC support
  • ocr/app/services/job_queue.py - Redis-based async job management
  • ocr/app/routers/extract.py - Sync extraction endpoint
  • ocr/app/routers/jobs.py - Async job submission and polling

Backend (Fastify)

  • backend/src/features/ocr/ - Complete feature capsule following project patterns
  • HTTP client for internal OCR service communication
  • Domain service with validation and business logic
  • Routes registered with JWT authentication

Infrastructure

  • Updated docker-compose.yml for Redis network access
  • Added form-data dependency to backend
  • Updated .gitignore for Python cache files

Test Plan

  • OCR service builds and starts successfully
  • Health check passes at /health
  • POST /api/ocr/extract accepts image and returns OCR result
  • Supports HEIC, JPEG, PNG formats
  • Async job submission and polling works
  • Authentication required for all endpoints
  • Processing time <3 seconds for typical photos

Fixes #65

## Summary - Implements OCR service endpoints (POST /extract, POST /jobs, GET /jobs/{job_id}) - Creates backend proxy routes with JWT authentication - Adds image preprocessing (deskew, denoise) for improved accuracy - Integrates Redis job queue for async processing of large files - Supports HEIC, JPEG, PNG, and PDF file formats ## Changes ### OCR Service (Python/FastAPI) - `ocr/app/models/schemas.py` - Pydantic models for request/response validation - `ocr/app/services/preprocessor.py` - Image preprocessing (deskew, denoise) - `ocr/app/services/ocr_service.py` - Core OCR logic with Tesseract and HEIC support - `ocr/app/services/job_queue.py` - Redis-based async job management - `ocr/app/routers/extract.py` - Sync extraction endpoint - `ocr/app/routers/jobs.py` - Async job submission and polling ### Backend (Fastify) - `backend/src/features/ocr/` - Complete feature capsule following project patterns - HTTP client for internal OCR service communication - Domain service with validation and business logic - Routes registered with JWT authentication ### Infrastructure - Updated docker-compose.yml for Redis network access - Added form-data dependency to backend - Updated .gitignore for Python cache files ## Test Plan - [ ] OCR service builds and starts successfully - [ ] Health check passes at /health - [ ] POST /api/ocr/extract accepts image and returns OCR result - [ ] Supports HEIC, JPEG, PNG formats - [ ] Async job submission and polling works - [ ] Authentication required for all endpoints - [ ] Processing time <3 seconds for typical photos Fixes #65
egullickson added 1 commit 2026-02-01 22:02:32 +00:00
feat: add core OCR API integration (refs #65)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 5m59s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 31s
Deploy to Staging / Verify Staging (pull_request) Successful in 2m19s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
852c9013b5
OCR Service (Python/FastAPI):
- POST /extract for synchronous OCR extraction
- POST /jobs and GET /jobs/{job_id} for async processing
- Image preprocessing (deskew, denoise) for accuracy
- HEIC conversion via pillow-heif
- Redis job queue for async processing

Backend (Fastify):
- POST /api/ocr/extract - authenticated proxy to OCR
- POST /api/ocr/jobs - async job submission
- GET /api/ocr/jobs/:jobId - job polling
- Multipart file upload handling
- JWT authentication required

File size limits: 10MB sync, 200MB async
Processing time target: <3 seconds for typical photos

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
egullickson merged commit 004940b013 into main 2026-02-02 01:17:25 +00:00
egullickson deleted branch issue-65-core-ocr-api 2026-02-02 01:17:25 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: egullickson/motovaultpro#74