Judgments facade¶
The recommended default entry point. See the facade guide for the routing rules and worked examples.
Judgments¶
Judgments ¶
Federated facade over :class:ArchiveClient and :class:JudgmentSearchClient.
Example::
async with Judgments() as j:
# Free-text → live
hits = await j.find(text="right to privacy", limit=10)
# Structured → archive
hits = await j.find(judge="chandrachud", year=2020, court="sci")
# CNR → archive (auto-routed via prefix)
hits = await j.find(cnr="DLHC010230802020")
# Force a specific source
hits = await j.find(text="bail", source="live", limit=5)
# PDF fetch — handles archive judgments + CNR strings whose prefix
# resolves to an archive-supported court.
pdf = await j.fetch_pdf("DLHC010230802020")
Source code in src/bharat_courts/facade.py
find async ¶
find(
*,
text: str | None = None,
court: Court | str | None = None,
year: int | tuple[int, int] | None = None,
judge: str | None = None,
party: str | None = None,
citation: str | None = None,
cnr: str | None = None,
source: Source = "auto",
limit: int = 50
) -> list[Judgment]
Find judgments. See module docstring for routing rules.
Source code in src/bharat_courts/facade.py
fetch_pdf async ¶
fetch_pdf(
judgment_or_cnr: Judgment | str,
*,
language: str = "english"
) -> bytes
Fetch a judgment PDF.
- Archive judgments and CNR strings whose prefix maps to a known court → :meth:
ArchiveClient.fetch_pdf. - Live :class:
Judgmentobjects → not supported here yet; useJudgmentSearchClient.download_pdfdirectly (it needs the original :class:JudgmentResult+court_type).
Source code in src/bharat_courts/facade.py
live_to_judgment¶
live_to_judgment ¶
live_to_judgment(jr: JudgmentResult) -> Judgment
Map a live :class:JudgmentResult to the unified :class:Judgment.
Field mapping:
==================== ==================================================== JudgmentResult Judgment ==================== ==================================================== title title court_name court_name_raw; resolved into court via the courts registry if a match is found source_id cnr (the judgments portal uses CNR as its id) judges judges judgment_date decision_date citation citation (when non-empty) pdf_url pdf_path (raw path; live download needs the original JudgmentResult, not just the path) metadata["disposal_nature"] disposal_nature metadata["registration_date"] date_of_registration ==================== ====================================================