Courts registry¶
The static registry of every supported court and the helpers for resolving them by code, name, eCourts state code, or CNR prefix.
courts ¶
Registry of Indian courts with eCourts identifiers.
State codes are from the HC Services portal (hcservices.ecourts.gov.in). These were verified by probing the fillHCBench endpoint.
Judgment codes are from the judgments.ecourts.gov.in portal, verified against vanga/indian-high-court-judgments court-codes.json.
SUPREME_COURT module-attribute ¶
SUPREME_COURT = Court(
name="Supreme Court of India",
code="sci",
state_code="0",
court_type=CourtType.SUPREME_COURT,
)
get_court_by_state_code ¶
get_court_by_state_code(state_code: str) -> Court | None
Look up the principal court for a state code (bench variants excluded).
The archive bucket partitions HCs by state code; this resolves the canonical court for that partition. Returns None for state_code "0" (Supreme Court — use SUPREME_COURT directly).
Source code in src/bharat_courts/courts.py
infer_court_from_cnr ¶
infer_court_from_cnr(cnr: str | None) -> Court | None
Identify the court that issued a CNR from its 4-letter prefix.
The CNR's prefix is deterministic per court (verified against the AWS archive for all 25 HCs + SCI). Returns None for unknown / malformed inputs — never raises.
Useful for routing archive queries: passing the CNR alone scans every HC partition (slow), but infer_court_from_cnr(cnr) lets the caller narrow to one bucket / partition first.