Extract Prior Authorization Data From Medical PDFs With Python
Extract request fields from a synthetic medical PDF and retain source citations for review.

A prior authorization packet may contain a request, provider information and supporting notes across several pages. Turning those pages into named fields can reduce manual transcription, but every field still needs to be checked against the source before it is used.
This guide extracts a fictional one-page request using Python and Unsiloed Extract. It does not determine coverage, clinical appropriateness or approval.
Generate and Extract the Fixture
Download the Python project, unpack it, and run:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python make_fixture.py
python -m unittest -v
export UNSILOED_API_KEY="your-api-key"
python extract.py prior-authorization.pdf authorization-schema.json authorization-result.json
The PDF contains a fictional patient name, member ID, requesting provider, requested service and date, plus a supporting note. The schema requests each as a string, preserving formatting such as leading zeroes. The saved sample response and offline test let you inspect the expected values without making another API call. The diagram uses a different illustrative packet to show a review workflow.

Retain Source Evidence
The script submits the PDF and schema to /v2/extract, enables citations, and polls the returned job ID. It saves the complete response, including field values, scores and available source coordinates. A result with status review needs attention before it is used. The job results reference describes the response structure.
In the sample run, the requested fields matched the fixture and the tested fields included page citations. A different document or run can produce different results. A citation points a reviewer to evidence; it does not establish that a field is correct or that the packet is complete.
Check Missing and Ambiguous Information
The example fixture supplies every requested field. Production packets can omit a date, contain several providers, mix requests or use dates with different meanings. Check each value and supporting passage, and send missing, conflicting or unclear information to a reviewer. Don't infer that an absent supporting note means a treatment did or did not happen.
Before processing sensitive documents, confirm that your deployment, data handling and agreements meet your organization's requirements. Use synthetic fixtures for development and keep patient data out of example code and logs. For a separate healthcare use case, see extracting lab results from medical PDFs.
Sign up for Unsiloed to explore the extraction API.
