Skip to main content

centralia

Court PDF opinion extractor: a PDF plus a court id in, a typed document out.

Try it in your browser → No install, nothing uploaded — the real package runs client-side on Pyodide, and your PDF is parsed in the tab.

python -m pip install centralia      # Python 3.12+
from centralia import read

r = read("opinion.pdf", court_id="mont")   # path, bytes, or file object

r["cluster"]["docket_number"]              # 'DA 25-0040'
[o["author"] for o in r["opinions"]]
# ['Justice Laurie McKinnon delivered the Opinion of the Court.',
#  'Justice James Jeremiah Shea, concurring.',
#  'Justice Jim Rice, dissenting.']

Three writings, each with its own author, footnotes and text — recovered from a PDF that labels none of them.

The problem it solves

Getting the text out of a court PDF is easy; pdftotext does it. What is hard is that an opinion is a document with parts, and the PDF says nothing about them. Nothing marks which lines are the caption, where the syllabus ends and the opinion begins, which paragraphs belong to the dissent rather than the majority, whose footnote is whose, or which line is a page number instead of a sentence. All of it has to be recovered from how the page is set — position, size, leading, indentation, and the rules the printer drew.

And every court sets its pages differently. centralia reads 241 of them.

Thresholds are measured from each document's own geometry rather than tuned per court, and nothing is ever dropped silently: every row removed as furniture is returned in removed, with the page and box it came from, so "did we lose anything?" is arithmetic instead of a judgment call.

Of the 241 courts wired, 191 are released through this API — meaning every document in that court's test corpus has been read and checked by a human. The rest raise rather than quietly returning a worse reading (see Courts still being worked on).

What read returns

r["status"]        # valid | review | scanned | failed
r["court_id"]      # the id you passed, echoed back
r["cluster"]       # the case: citation, docket, dates (as printed + ISO), panel, parties
r["opinions"]      # one entry per writing: author, pages, footnotes, html and text
r["headmatter"]    # the caption block: rows, by_role, text, html, html_inline,
                   #   footnotes, untinted
r["endmatter"]     # anything after the last writing, same shape, minus the notes
r["sections"]      # named sections the court printed (syllabus, headnotes) where it did
r["removed"]       # every row taken out as furniture: kind, page, text, bbox
r["warnings"]      # what the reader wants you to know about the source
r["diagnostics"]   # page facts and anything unplaced — reported, never judged
r["html"]          # the document's text, without review furniture
r["review_html"]   # the reviewer's page: criteria box, Removed panel, role tints
r["casebody"]      # Harvard casebody XML
r["versions"]      # what produced this reading, centralia's own version first

headmatter and endmatter carry a by_role map — which rows the court's own reader claimed and as what (court, caption, docket, date, title, counsel, panel, citation, lower-court, syllabus, case-info, author) — and untinted, the rows no reader claimed. That second number is the honest measure of how much of a caption was actually read.

removed is the audit trail: nothing is dropped silently, so a running head, a folio, an e-filing stamp, a chambers letterhead or a caption-box graphic all appear here with the page and box they came from.

The HTML an ingest stores

A writing's html, and the cover's html_inline, are the portable renders: no chip a host page would print itself, nothing set in classes only this package's stylesheet knows, and the footnotes wired — each mark anchors to its note and each note links back, namespaced per writing (ref-o2-7 / fn-o2-7) so several writings shown on one host page, each restarting its numbering at 1, cannot collide. The cover's notes travel inside html_inline rather than beside it, so a substituted party's * is not a dangling mark. review_html is the other kind: the reviewer's page, which does assume our CSS.

versions names the centralia that wrote the payload alongside the pipeline's own versions, so a consumer decides payload shape by a number instead of sniffing the markup.

Courts still being worked on

from centralia import read, released_courts, CourtNotReleased, UnknownCourt

released_courts()                      # frozenset of ids that are finished
read("x.pdf", court_id="mad")          # raises CourtNotReleased
read("x.pdf", court_id="mad", allow_pending=True)   # read it anyway
read("x.pdf", court_id="typo")         # raises UnknownCourt

An unregistered id raises rather than falling back: core's generic reader would still return status: valid, just read worse, and a typo should not look like a thin court.

Lower level, for callers that want the objects

from centralia import extract, render_opinion

result = extract("opinion.pdf", court_id="mont")
result.document          # typed Document
result.trace             # per-decision evidence chains
render_opinion(result.document.opinions[0])

Also exported: render_html, render_body, render_headmatter, render_hm_inline, render_casebody, opinion_text, and render_opinion_ingest(op, ns, hm_sig="") — the portable form of a writing that read puts in opinions[].html, where render_opinion is the review page's own drawing. Plus the model types (Document, Criteria, Meta, Opinion) and the date helpers to_iso / all_iso. Pass include_document=True to read to get the typed Document alongside the dict.

Dates

Dates are returned twice: as the court printed them (date_filed) and as YYYY-MM-DD where that can be read without guessing (date_filed_iso, or None). diagnostics["dates_unparsed"] names the ones that did not parse.

Status is a report, not a gate

diagnostics carries the page-level facts a caller needs to decide for itself: which pages are a raster (scan_pages), which pages have no text layer at all so their words are absent (text_missing_pages), which carry unmapped glyphs (cid_pages), and what the extractor could not place (residual).

Contributing

DEVELOPMENT.md is the orientation: how the engine works and why it works that way, the eleven pipeline stages, a file-by-file map, when page geometry can be trusted and when it cannot, how a court is added, the five oracles that say whether a reading is right, and what is left to do.

The test corpus is ~10,000 real court PDFs. It is too large for git, so it lives as a list of links:

uv sync --dev
uv run python scripts/fetch_corpus.py               # fetch the corpus
uv run python harness/cli.py render $(ls assets)    # render every court
uv run python harness/cli.py serve                  # the review viewer

Metadata

Release files for centralia 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for centralia 0.0.5
File Size Uploaded Provenance Actions
centralia-0.0.5.tar.gz 26.6 MB With provenance Details for centralia-0.0.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for centralia 0.0.5
File Interpreter ABI Platform Actions
centralia-0.0.5-py3-none-any.whl Python 3 none any Details for centralia-0.0.5-py3-none-any.whl

Total release size: 28.7 MB

Release files / centralia-0.0.5.tar.gz

Download URL centralia-0.0.5.tar.gz
Size 26.6 MB
Tags Source
SHA-256 checksum
How to use checksums
a653e4c5f998ff0b838a1bc76f7279719cb6db46fac9c360506bd0221a20dc66
BLAKE2b-256 checksum
How to use checksums
694fa3e1ab0d7469905f59eb49ef7995f05080c389720dabc15bd74b6e8d6c30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Release files / centralia-0.0.5-py3-none-any.whl

Download URL centralia-0.0.5-py3-none-any.whl
Size 2.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
831ecffde79976cf1c231f96f402b80a07e981bc1ff4c907a442dd33da923e82
BLAKE2b-256 checksum
How to use checksums
beb780314b6ecbf9ccdc648e0bad8792f0eaa8357e9a344d17a6800f237a5a6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

Security for centralia 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for centralia-0.0.5.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page