Pulls the transcription-block state (load, save, delete, reviewToggle,
markAllReviewed, createFromDraw, toggleTrainingLabel, deleteAnnotation
+ derived blockNumbers / hasBlocks / lastEditedAt / annotationReloadKey)
out of documents/[id]/+page.svelte into a reusable factory in
lib/document/transcription/useTranscriptionBlocks.svelte.ts.
The page now reads transcription.blocks / .blockNumbers / .hasBlocks /
.lastEditedAt / .annotationReloadKey reactively and delegates writes
to transcription.{load, save, delete, reviewToggle, markAllReviewed,
createFromDraw, toggleTrainingLabel, deleteAnnotation,
findByAnnotationId, bumpAnnotationReloadKey}. The confirm-then-delete
dialog stays in the page; the hook only handles the data ops.
24 unit tests cover initial state, load (success / non-OK / network /
empty-id), derived state (blockNumbers in sortOrder, lastEditedAt
recent-pick, lastEditedAt-null fallback), delete (success bumps key /
non-OK throws), reviewToggle (success updates / non-OK no-op), markAll
(success / non-OK), createFromDraw (success / non-OK / network all
return correct shape), toggleTrainingLabel (200 / 500), deleteAnnotation
(linked-block path / orphan-annotation path / orphan-fail throw),
findByAnnotationId match + miss, bumpAnnotationReloadKey.
Also bumps the polling-loop test waits in useOcrJob.svelte.test.ts to
150-200ms (from 60-80ms) so the suite is reliable when run in parallel.
Refs #496.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ocr (frontend)
UI for OCR job management, progress display, and sender-model training in the admin/enrichment panel.
What this domain owns
Components: OcrProgress.svelte, OcrTrigger.svelte, OcrTrainingCard.svelte, SegmentationTrainingCard.svelte, TrainingHistory.svelte.
Utilities: translateOcrProgress.ts (progress-state → display-string mapping), training.ts (training API helpers).
What this domain does NOT own
- OCR processing — all text recognition runs in the Python
ocr-service/container. The frontend shows job state; it does not run OCR. - Transcription block display — rendered by
document/transcription/components.
Key components
| Component | Used in | Notes |
|---|---|---|
OcrProgress.svelte |
document header, enrich panel | Progress bar and status label for an active OCR job |
OcrTrigger.svelte |
enrich panel, document detail | Button to start an OCR job; disabled when one is running |
OcrTrainingCard.svelte |
/admin/ocr |
Trigger sender-model training; shows training history |
SegmentationTrainingCard.svelte |
/admin/ocr |
Trigger segmentation training |
TrainingHistory.svelte |
/admin/ocr |
List of past training runs with status |
Backend counterpart
backend/src/main/java/org/raddatz/familienarchiv/ocr/README.md