← work
data · 2025

Docling-based PDF extraction pipeline

Airflow-orchestrated extraction over zoning PDFs using Docling for layout-aware parsing. Outputs structured chunks ready for embedding, with provenance preserved (page, bbox, section).

roleData Engineer at AIAEC
timespan2025
stackpythonairflowdockerdocling
statusoperational

Problem

Zoning PDFs are a worst case for naïve text extraction:

PyPDF2 and pdfminer gave garbled output on ~30% of the test corpus. Docling gave usable output on all of them.

Pipeline

MinIO (raw PDFs) → Airflow DAG → Docling → structured chunks → MinIO (JSON) → embedding DAG

The Airflow DAG:

  1. Polls MinIO for new PDFs (by modified-time watermark)
  2. Passes each PDF to a Docling worker container
  3. Docling returns a JSON document with page-level structure, bounding boxes, and section hierarchy
  4. A post-processing step normalizes section numbering across jurisdictions (each city has its own numbering scheme)
  5. Chunks are sized for the embedding model's context window, with section headers prepended for context

Provenance

Every chunk carries:

This provenance is what makes the citation verifier in the RAG pipeline possible.

Performance

~40 PDFs/hour on the VPS (single Docling worker). Not fast, but the pipeline runs nightly and the backlog is manageable. A second worker would double throughput but the VPS RAM is the constraint.