A Python data pipeline that turns medical-textbook PDFs into clean, structured, machine-readable data (sections, figures and tables) and publishes it as versioned packages for the search platform to load.
sushrutalgs.ai answers exam questions with citations back to standard textbooks, so the text behind every citation has to be intact and addressable down to the section, figure or table. The source material was print-layout PDFs, where tables are drawn rather than encoded and captions float near their figures. None of the retrieval work could start until that became structured data.
An extraction pipeline that parses, repairs and structures each book, then cleans and annotates the content and exports it as versioned, integrity-checked packages. Two principles shaped it: structure is decided by deterministic code that behaves the same way twice, and every stage reports what it dropped, because PDF extraction fails silently by returning a slightly smaller document rather than an error. Language models are used only at the edges, to describe figures and tables that the deterministic pass has already located.
It processes the full source library end to end, every exported package passes structural validation, and a clean rebuild from the source PDFs reproduces the same output. It feeds the retrieval backend behind the live product, and CI runs the pipeline so a parser change cannot quietly alter an export.