Add job tracking with PostgreSQL, image storage, and review workflow

- Add PostgreSQL service to docker-compose with health check and postgres_data volume
- Mount ./ocr_images as bind volume for persistent image storage
- Add backend/database.py with schema init and get_db() context manager
- Add 5 new API endpoints: POST /api/jobs, GET /api/jobs (search), GET /api/jobs/{id},
  GET /api/jobs/{id}/image, PUT /api/jobs/{id}/review
- Jobs are saved with author/book/chapter/page metadata, auto UUID, and submitted_at timestamp
- Jobs start as 'unreviewed'; review captures edited text, reviewer name, and reviewed_at
- Add MetadataForm.jsx (author/book/chapter/page inputs) to the New Job panel
- Add JobsPanel.jsx with search/filter, paginated list, and detail pane with review form
- Add "Commit Job" button to ResultPanel (plain_ocr mode only) with success/error feedback
- Add "New Job" / "Browse Jobs" navigation to the app header

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Aaron Roberts
2026-06-09 16:48:12 +01:00
parent 68147eb97c
commit fd747e6c23
9 changed files with 1208 additions and 212 deletions

View File

@@ -1,4 +1,19 @@
services:
postgres:
image: postgres:16-alpine
container_name: deepseek-ocr-postgres
environment:
POSTGRES_USER: ${POSTGRES_USER:-ocr_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-ocr_password}
POSTGRES_DB: ${POSTGRES_DB:-ocr_db}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-ocr_user} -d ${POSTGRES_DB:-ocr_db}"]
interval: 5s
timeout: 5s
retries: 10
backend:
build: ./backend
container_name: deepseek-ocr-backend
@@ -10,8 +25,14 @@ services:
API_HOST: ${API_HOST:-0.0.0.0}
API_PORT: ${API_PORT:-8000}
MAX_UPLOAD_SIZE_MB: ${MAX_UPLOAD_SIZE_MB:-100}
DATABASE_URL: ${DATABASE_URL:-postgresql://ocr_user:ocr_password@postgres:5432/ocr_db}
OCR_IMAGES_DIR: ${OCR_IMAGES_DIR:-/data/ocr_images}
volumes:
- ./models:/models
- ./ocr_images:/data/ocr_images
depends_on:
postgres:
condition: service_healthy
deploy:
resources:
reservations:
@@ -22,8 +43,6 @@ services:
shm_size: "4g"
ports:
- "${API_PORT:-8000}:${API_PORT:-8000}"
networks:
- ocr-network
frontend:
build: ./frontend
@@ -32,9 +51,10 @@ services:
- "${FRONTEND_PORT:-3000}:80"
depends_on:
- backend
networks:
- ocr-network
volumes:
postgres_data:
networks:
ocr-network:
driver: bridge
default:
name: rw-research