Conversation
…e DoclingDocument PageParser Protocol, ParseTask/ParsePlan, ParserService.plan (pages_needing_ocr -> liteparse+OCR; else pymupdf if installed, else liteparse without OCR; pdf_inspector explicit-only) and ParserService.parse (per-page merge by (top, left), region tasks filtered by containment). build_document lays merged blocks through the existing docling_builder; page sizes come from pdf_inspector.page_sizes. Checked docling_builder.append_blocks/register_page and reused them; no new DoclingDocument walking. Parsers are injected: pymupdf/pdf_inspector do not yet implement PageParser (separate task), so the registry is untouched.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThis change adds an OCR parser service. It plans page routing, executes registered parsers, filters and merges layout blocks, and builds a ChangesOCR parser service
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Feature Sequence Diagram(s)sequenceDiagram
participant ParserService
participant triage
participant PageParser
participant build_document
ParserService->>triage: derive page routing metadata
ParserService->>PageParser: parse planned pages with OCR flag
PageParser-->>ParserService: return page blocks
ParserService->>build_document: merge blocks and register pages
build_document-->>ParserService: return DoclingDocument
Merge Risk: ⚪ Minimal · up to The OCR parser routing and document assembly changes have no identified merge-blocking issue. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Warning Git: CodeRabbit could not clone the repository, so clone-backed analysis was skipped and this review may be incomplete. Verify repository clone access, such as SSH credentials, before requesting another full review. If clone access is intentionally unavailable, use Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Phase 1 task from the retrieval plan:
contexts/ocr/parsers/service.py.PageParserProtocol:parse_pages(pdf_bytes, pages, *, ocr) -> dict[int, list[LayoutBlock]]ParseTask(pages, parser, ocr, bbox=None),ParsePlan(+pages_by_parser,ocr_pagesfor the laterLayoutMetadatawrite)ParserService.plan(): triagepages_needing_ocr→ liteparse with OCR; other pages → pymupdf if installed, else liteparse without OCR. pdf_inspector is explicit-only.ParserService.parse(): runs each task, merges blocks per page by(top, left); region tasks (bbox) keep only blocks mostly contained in the region (CONTAINMENT_THRESHOLD).build_document(blocks, page_sizes=…)→DoclingDocumentvia the existingdocling_builder.Parsers are injected as a mapping;
pymupdf.py/pdf_inspector.py/registry.pyare unchanged (theirPageParserrefactor andliteparse.pyare separate tasks).ocr_jobs.pyuntouched.Test plan
tests/unit/contexts/ocr/test_parser_service.py: routing table (scanned / digital / no-pymupdf / fully scanned / unknown triage / page allowlist), task dispatch with ocr flag, cross-task per-page merge order, region containment filter, unknown parser error,build_documentprovenance and empty-page registration.uv run pytest tests/unit/contexts/ocr --noconftest(storage/layout_store lance tests deselected; known-failing locally): 112 passed, 1 skipped.Summary by CodeRabbit