homelab-codex-ws/jobs/documents-ingest/src/documents_ingest
oskar f7b61f7da9 feat(documents-ingest): PDF attachment extractor — mail archive -> Paperless consume/
Module 5 phase 1 (docs/kb/modules/05-documents-ingest.md): pulls a sample of
PDF attachments (>50KB, last year, LIMIT 150) out of the Gmail .eml archive
and drops them into Paperless consume/ for OCR, so the RAG layer has real
documents to work with before the full Paperless/Nextcloud envelope adapter
is built. sha256-first attachment matching (manifest filenames can carry raw
RFC 2047 encoded-word artifacts that don't byte-match what email.policy.default
decodes today — confirmed against live data, ~10% of candidates were affected).
Idempotent via a sha256-keyed JSON registry; dry-run by default, --apply to write.

Verified end-to-end on PIHA: dry-run + --apply both run against live
kb-postgres/archive, 185/222 candidate PDFs written to consume/ (37 in-run
duplicates correctly deduped), Paperless picked them up and started OCR
immediately.
2026-07-13 20:03:57 +02:00
..
__init__.py feat(documents-ingest): PDF attachment extractor — mail archive -> Paperless consume/ 2026-07-13 20:03:57 +02:00
extractor.py feat(documents-ingest): PDF attachment extractor — mail archive -> Paperless consume/ 2026-07-13 20:03:57 +02:00