feat(upload): accept legacy .doc, convert via LibreOffice in container #53

Merged
chaim merged 1 commits from feat/doc-upload-support into main 2026-06-03 13:48:26 +00:00
Owner

רקע

קבצי .doc ישנים (פסיקה מ-nevo.co.il בקידוד CP1255 / OLE2) שמסומנים כפסיקה חסרה בקורפוס לא ניתנים להעלאה ישירה — ה-frontend כבר הציע .doc ב-accept, אבל ה-gate בבקאנד דחה אותם לפני שהגיעו ל-extractor.

שינויים

קובץ שינוי
web/app.py .doc נוסף ל-ALLOWED_EXTENSIONS — פותח את כל הנתיבים שחולקים את ה-set: ספריית פסיקה, missing-precedent, training
Dockerfile התקנת libreoffice-writer-nogui (בלי X11/Java) כדי שההמרה הקיימת ב-_extract_doc תעבוד בקונטיינר Coolify (היתה חסרה → כשל ב-runtime)
extractor.py הקשחה: פרופיל LibreOffice ייעודי לכל המרה, למניעת profile-lock בהמרות .doc מקבילות

אימות

  • ההמרה אומתה בתוך python:3.12-slim (image הבסיס של הפרודקשן): התקנה + .doc→.docx→text.
  • הטקסט המחולץ byte-identical לשמירת .docx מקורית מ-Word: 103 פסקאות, 24,341 תווים.
  • הזרימה: העלאה דרך UH (missing-precedent) → staging .docingest_precedent/ingest_internal_decisionextract_text ממיר אוטומטית → חילוץ הלכות ברקע + ניתוח.

🤖 Generated with Claude Code

## רקע קבצי `.doc` ישנים (פסיקה מ-nevo.co.il בקידוד CP1255 / OLE2) שמסומנים כ**פסיקה חסרה בקורפוס** לא ניתנים להעלאה ישירה — ה-frontend כבר הציע `.doc` ב-accept, אבל ה-gate בבקאנד דחה אותם לפני שהגיעו ל-extractor. ## שינויים | קובץ | שינוי | |------|-------| | `web/app.py` | `.doc` נוסף ל-`ALLOWED_EXTENSIONS` — פותח את כל הנתיבים שחולקים את ה-set: ספריית פסיקה, missing-precedent, training | | `Dockerfile` | התקנת `libreoffice-writer-nogui` (בלי X11/Java) כדי שההמרה הקיימת ב-`_extract_doc` תעבוד בקונטיינר Coolify (היתה חסרה → כשל ב-runtime) | | `extractor.py` | הקשחה: פרופיל LibreOffice ייעודי לכל המרה, למניעת profile-lock בהמרות `.doc` מקבילות | ## אימות - ההמרה אומתה בתוך `python:3.12-slim` (image הבסיס של הפרודקשן): התקנה + `.doc→.docx→text`. - הטקסט המחולץ **byte-identical** לשמירת `.docx` מקורית מ-Word: 103 פסקאות, 24,341 תווים. - הזרימה: העלאה דרך UH (missing-precedent) → staging `.doc` → `ingest_precedent`/`ingest_internal_decision` → `extract_text` ממיר אוטומטית → חילוץ הלכות ברקע + ניתוח. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chaim added 1 commit 2026-06-03 13:48:16 +00:00
Legacy Hebrew .doc precedents (e.g. nevo.co.il CP1255 OLE2) can now be
uploaded directly through the precedent-library, missing-precedent, and
training upload paths — the frontend already advertised .doc but the
backend gate rejected it before reaching the extractor.

- web/app.py: add .doc to ALLOWED_EXTENSIONS (covers all paths that share
  the set: precedent library, missing-precedent, training).
- Dockerfile: install libreoffice-writer-nogui (no X11/Java) so the
  extractor's existing _extract_doc LibreOffice conversion works in the
  Coolify container (was missing → would fail at runtime).
- extractor.py: isolate the LibreOffice user profile per call to avoid a
  profile-lock failure on concurrent .doc conversions.

Verified in python:3.12-slim (prod base): .doc→.docx→text yields text
byte-identical to a native Word .docx save (103 paragraphs, 24,341 chars).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chaim merged commit e25507f9ad into main 2026-06-03 13:48:26 +00:00
chaim deleted branch feat/doc-upload-support 2026-06-03 13:48:26 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ezer-mishpati/legal-ai#53