Pfizer · Externship
Turning messy pharmaceutical documents into searchable data
An AI-powered document intelligence pipeline for Pfizer supply chain — ingesting scanned and digital documents, extracting structured fields, classifying document types, and making information searchable with RAG.

Role
Software Engineering Extern
Timeline
May 2026 - Present (3 months)
Team
Health Informatics
Stack
Python · OCR · RAG · Gemini
Overview
Document intelligence for pharmaceutical supply chains
Pharmaceutical supply chains depend on shipping labels, purchase orders, logistics forms, invoices, and regulatory records. These documents often carry the same kinds of information, but almost never in the same format — dates, tables, and key fields shift by vendor, template, and scan quality.
During my Pfizer Supply Chain Document Processing Externship, I worked on an AI-powered pipeline to ingest scanned pharmaceutical documents, extract important fields, classify document types, and make information searchable across large collections of files.

The Problem
Inconsistent documents break rule-based parsing
A date might appear as 07/12/26, 12 July 2026, or as a handwritten note. Important fields may sit inside tables, split across columns, print over noisy backgrounds, rotate on scanned pages, or land in different places depending on the vendor and document type.
Traditional rule-based software struggles here. A parser built for one layout can fail when a supplier changes a template, a scan is blurry, or a field shows up somewhere unexpected. Even after text is extracted, the system still has to decide what each value means, keep its relationship to nearby labels, and produce reliable structured data for supply-chain and compliance decisions.
That gap — between messy pharmaceutical documents and trustworthy structured data — is what this pipeline was built to close.
Approach
Parse, clean, extract, classify, then retrieve
Digitally generated PDFs go through PyMuPDF and pdfplumber to pull text and layout. Scanned or image-based pages are prepared with OpenCV and PIL — resizing, cropping, contrast adjustment, and noise reduction — before OCR engines like Tesseract, PaddleOCR, and EasyOCR are evaluated across layouts, scan qualities, and document types.
Extracted fields land in structured JSON, keeping both the recognized values and their page coordinates. Classification and routing decide how each document should be processed instead of forcing one extraction strategy onto every file — making the system more resilient across shipping records, labels, purchase orders, and other clinical supply documents.
Finally, content is indexed with a RAG pipeline. LlamaIndex, FAISS, and Chroma support vector retrieval; models such as Gemini, Mistral, or Phi-2 generate answers grounded in the most relevant sections. A Gradio or Streamlit interface lets users search the collection and ask natural-language questions without paging through thousands of documents by hand.

Tech Stack
What powered the pipeline
PDF & Extraction
- Python
- PyMuPDF + pdfplumber for digital PDF text and layout
- Structured JSON output with page coordinates
Vision & OCR
- OpenCV + PIL for resize, crop, contrast, and noise reduction
- Tesseract, PaddleOCR, and EasyOCR evaluated across layouts and scan quality
RAG & LLMs
- LlamaIndex for retrieval-augmented generation
- FAISS + Chroma for vector-based indexing
- Gemini, Mistral, or Phi-2 for grounded answers
Interface
- Gradio / Streamlit search UI for natural-language questions over the document collection
Impact
From inconsistent scans to searchable supply-chain data
OCR
Multi-engine extraction
JSON
Structured fields + coords
RAG
Searchable document index
E2E
Parse → retrieve → answer
- Built an end-to-end document intelligence pipeline — not a standalone OCR script — spanning PDF parsing, image preprocessing, OCR, structured extraction, classification, retrieval, and language models.
- Preserved field values with page coordinates in structured JSON so extracted data stayed tied to its source layout for validation and auditability.
- Used classification and routing so shipping records, labels, purchase orders, and other clinical supply documents could follow different extraction strategies instead of one brittle template.
- Indexed extracted content with a RAG stack so users could search large document collections and ask natural-language questions without manually reviewing hundreds or thousands of pages.