Requirements
Functional Requirements
Image Ingestion
- Accept single images, folders of images, PDF documents, and nested document folders
- Support
.jpg, .jpeg, .png, .tif, .tiff, .pdf formats
- Assign batch ID and page number to each source item
Image Quality Assessment
- Detect: blur, low contrast, washed-out text, rotation, skew, noise, bleed-through, blank pages, damaged paper, poor resolution
- Assign quality levels and review flags
OCR Engine Evaluation
- Compare performance across: Docling, Unlimited-OCR, Qwen Vision, GLM-OCR
- Compare structuring engines: Docling native, NuExtract, LangExtract
- Evaluate against: printed books, typewritten documents, handwritten records, ledgers/tables, invoices/checks, letters, meeting minutes, forms, poor-quality scans
OCR and Layout Extraction
- Extract: page text, markdown, reading order, text regions, bounding boxes, tables, images, captions, layout structure
- Include OCR confidence indicators per region
Canonical JSON Generation
- Convert all OCR output to a single standardized format
- Preserve: source metadata, page info, OCR output, layout, regions, tables, images, classification, metadata, quality, processing info
Document Classification
- Classify each document/page by type: book page, letter, invoice, check, contract, church record, meeting minutes, school memo, ledger, form
- Use signals: OCR text, layout structure, number density, table presence, region patterns, headers/footers, keywords, VLM classification when needed
- Extract: dates, people, organizations, locations, document titles, subjects, monetary amounts, signatures, page numbers, topics
Quality Validation
- Determine whether extracted text is reliable enough for RAG
- Flag poor-quality pages for human review
Semantic Chunking
- Chunk by document type: paragraph/section (books), header/body/signature (letters), agenda/topic/motion/vote (minutes), row-based (ledgers), clause/section (contracts), field-group (forms)
Embedding Generation
- Generate vector embeddings for each chunk
- Attach metadata payload (document type, page number, source path, dates, people, etc.)
Qdrant Ingestion
- Store embeddings with metadata for filtered semantic search
- Support queries filtered by document type, date range, people, organizations, locations
RAG / LLM Search
- Accept natural language questions
- Retrieve relevant chunks via embedding similarity
- Generate answers grounded in archival context
- Include source citations and page references
- Flag answers derived from low-quality OCR
Non-Functional Requirements
- Swappable OCR backends without downstream changes
- Canonical JSON as the stable interface between pipeline stages
- Traceability from RAG answer back to original scan page
- Quality metadata preserved throughout the pipeline