Skip to main content

centralia

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

Requires Python 3.12 or newer.

python -m pip install centralia
from centralia import read

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

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, each with its author, pages, html and text
r["headmatter"]    # the caption block: rows, by_role, text, html, footnotes, untinted
r["endmatter"]     # anything after the last writing, same shape as headmatter
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

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.

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_casebody, opinion_text, 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).

Metadata

Release files for centralia 0.0.3

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.3
File Size Uploaded Provenance Actions
centralia-0.0.3.tar.gz 26.3 MB With provenance Details for centralia-0.0.3.tar.gz

Built distribution (wheel)

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

Total release size: 28.4 MB

Release files / centralia-0.0.3.tar.gz

Download URL centralia-0.0.3.tar.gz
Size 26.3 MB
Tags Source
SHA-256 checksum
How to use checksums
578283cfb8bdb26c62616c9d5272afcf66a8ee876440a9b04b804f431eb984aa
BLAKE2b-256 checksum
How to use checksums
480bd4fb095e5162257918372da9e0485033499648087e224151593718f1c48e
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 24, 2026.

Transparency log

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

Download URL centralia-0.0.3-py3-none-any.whl
Size 2.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
99cbc029c8e2d9cf80382a06b69935160759053f7a7bd9f9814be906a60b6c12
BLAKE2b-256 checksum
How to use checksums
e0556e57b7e89559b6529a2a6c72c04069a1c71f32f935bbcf8d587717fa5abf
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 24, 2026.

Transparency log

Security for centralia 0.0.3

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.3.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 24, 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