Extract structured property data from assessment card PDFs using LLM-powered text extraction
Project description
landrecords-card-reader
Extract structured property data from assessment card PDFs using LLM-powered text extraction.
Property cards (also called land cards or assessment cards) are PDF documents produced by county tax assessors.
Installation
pip install landrecords-card-reader
With optional extras:
# LangGraph wiring (only needed if you want to use the graph node)
pip install landrecords-card-reader[graph]
# Everything
pip install landrecords-card-reader[all]
System dependencies
- Ollama running locally or on a remote host with a text model loaded
(e.g.
gemma4:26b-a4b-it-q8_0) - wkhtmltopdf for HTML→PDF conversion of property pages that aren't
served as PDFs:
# macOS brew install --cask wkhtmltopdf # Debian/Ubuntu sudo apt-get install wkhtmltopdf
OCR (docTR + PyTorch) ships as a Python dependency; the model weights
(~100MB) are downloaded to ~/.cache/doctr/ on first call.
Quick start
from landrecords_card_reader import read_property_card
data, photo = read_property_card("https://example.com/card.pdf")
print(data["ownername"]) # "SMITH, JOHN A"
print(data["totalvalue"]) # 285000
print(data["parceladdr"]) # "123 MAIN ST"
# photo is raw image bytes of the first property photo, or None
if photo:
with open("photo.jpg", "wb") as f:
f.write(photo)
Use analyze_photo=True to send the property photo (if it exists) to the
vision model, filling in missing building details (exterior walls, roof
style, number of floors, etc.):
data, photo = read_property_card(url, analyze_photo=True)
If you already have the PDF bytes, pass them directly to skip the download:
data, photo = read_property_card(url, pdf_bytes=raw_bytes)
For URLs that might be HTML property report pages (e.g. Beacon, Tyler,
or other county assessment sites), use read_property_card_from_url.
It fetches the URL, detects whether the response is a PDF or HTML, and
converts HTML pages to PDF via pdfkit (wkhtmltopdf) automatically:
from landrecords_card_reader import read_property_card_from_url
data, photo = read_property_card_from_url(
"https://www.webgis.net/LinkedFiles/va/pulaski/pc/cards/PC17759.htm"
)
CLI
landrecords-card-reader https://example.com/card.pdf --dry-run -v
Configuration
Set via environment variables or a .env file:
| Variable | Default | Description |
|---|---|---|
CARD_READER_OLLAMA_HOST |
http://localhost:11434 |
Ollama server URL |
CARD_READER_EXTRACTION_MODEL |
gemma4:26b-a4b-it-q8_0 |
Model for structured extraction |
CARD_READER_PHOTO_CLASSIFICATION_MODEL |
gemma4:e2b |
Lightweight vision model for photo classification |
Extracted fields
The extraction prompt maps over 80 property card fields including:
- Identity: parcelid, taxacctnum, taxyear
- Owner: ownername, owneraddr, ownercity, ownerstate, ownerzip
- Location: parceladdr, parcelcity, parcelstate, parcelzip, legaldesc
- Valuation: landvalue, imprvalue, totalvalue, assessedvalue, appraisedvalue
- Building: yearbuilt, bldgsqft, bedrooms, fullbaths, halfbaths, bldgtype
- Construction: foundation, roofcover, extwall, heating, heatfuel, cooling
- Sale: saleamt, saledate
- Zoning: zoningcode, zoningdesc, zoningtype
How it works
- Download the PDF (or accept pre-downloaded bytes)
- In parallel:
- OCR every page via docTR — PDF bytes are passed straight to
DocumentFile.from_pdf(rasterised internally via pypdfium2) and run through docTR's deep-learning detection + recognition models in a single batched inference call. The predictor usesassume_straight_pages=Trueand runs on CUDA when available - Extract & classify property photos — candidate images are filtered by size/aspect ratio, then sent to a vision model to keep only actual photographs (discarding sketches, floorplans, maps, etc.)
- OCR every page via docTR — PDF bytes are passed straight to
- Extract structured data by sending the raw OCR text to an Ollama LLM
- Reconcile values — verifies
landvalue + imprvalue == totalvalueand computes any single missing value arithmetically - Targeted retries — if
parcelidis too short, re-asks; if a heat-fuel label is present butheatfuelis empty, runs a deterministic regex fallback then a focused LLM retry; if any registered field's label is in the OCR text but the value is empty, batches them into one LLM retry
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file landrecords_card_reader-0.3.1.tar.gz.
File metadata
- Download URL: landrecords_card_reader-0.3.1.tar.gz
- Upload date:
- Size: 31.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b324b304dfeef889d981dcce13eefa13a7755c5dffd3bd841af7ab3d226f39dc
|
|
| MD5 |
0d634be07a1b9d29726fe53966476d32
|
|
| BLAKE2b-256 |
2d5d5edb43008adbdad89c6a4b9d56956b3b56ed201e2d962c4ca697c2d43894
|
File details
Details for the file landrecords_card_reader-0.3.1-py3-none-any.whl.
File metadata
- Download URL: landrecords_card_reader-0.3.1-py3-none-any.whl
- Upload date:
- Size: 37.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62e119266eade6f4217a5d1d8009c6fbc35aa4a46407c3ba7b62047283ddb0a7
|
|
| MD5 |
f3a469b30e99ed3f4c772bb96aefabcd
|
|
| BLAKE2b-256 |
9a0e6c18eed5fcfb00ddae802dedc8105f813c3a9ea140dc9c009a69bd0467b0
|