Edit on GitHub

ecourts.entities.hearing

 1from dataclasses import dataclass
 2from datetime import datetime
 3from typing import Optional, Dict
 4from parsers.utils import parse_date
 5
 6class UnexpandableHearing(Exception):
 7    pass
 8
 9@dataclass
10class Hearing:
11    cause_list_type: Optional[str] = None
12    """The type of cause list."""
13
14    judge: Optional[str] = None
15    """The judge associated with the hearing."""
16
17    purpose: Optional[str] = None
18    """The purpose of the hearing."""
19
20    details: Optional[Dict[str, str]] = None
21    """Additional details as a dict"""
22
23    date: Optional[datetime.date] = None
24    """The date of the case hearing."""
25
26    next_date: Optional[datetime.date] = None
27    """The date of the next scheduled hearing."""
28
29    court_no: Optional[str] = None
30    """4 digit court number,which can differ between hearings"""
31    
32    srno: Optional[int] = None
33    """2-3 digit serial number for this hearing within the case"""
34
35    def __post_init__(self):
36        if isinstance(self.date, str):
37            self.date = parse_date(self.date[0:10])
38        if isinstance(self.next_date, str):
39            self.next_date = parse_date(self.next_date[0:10])
40        if isinstance(self.srno, str) and len(self.srno) > 0:
41            self.srno = int(self.srno)
42        else:
43            self.srno = None
44
45    # Additional params required
46    # caseNumber1: CASE_No
47    # state_code, dist_code, court_code(If present)
48    def expandParams(self):
49        return {
50            "court_no": self.court_no,
51            "businessDate": self.date.strftime("%d-%m-%Y"),
52            "srno": self.srno,
53        }
class UnexpandableHearing(builtins.Exception):
7class UnexpandableHearing(Exception):
8    pass

Common base class for all non-exit exceptions.

@dataclass
class Hearing:
10@dataclass
11class Hearing:
12    cause_list_type: Optional[str] = None
13    """The type of cause list."""
14
15    judge: Optional[str] = None
16    """The judge associated with the hearing."""
17
18    purpose: Optional[str] = None
19    """The purpose of the hearing."""
20
21    details: Optional[Dict[str, str]] = None
22    """Additional details as a dict"""
23
24    date: Optional[datetime.date] = None
25    """The date of the case hearing."""
26
27    next_date: Optional[datetime.date] = None
28    """The date of the next scheduled hearing."""
29
30    court_no: Optional[str] = None
31    """4 digit court number,which can differ between hearings"""
32    
33    srno: Optional[int] = None
34    """2-3 digit serial number for this hearing within the case"""
35
36    def __post_init__(self):
37        if isinstance(self.date, str):
38            self.date = parse_date(self.date[0:10])
39        if isinstance(self.next_date, str):
40            self.next_date = parse_date(self.next_date[0:10])
41        if isinstance(self.srno, str) and len(self.srno) > 0:
42            self.srno = int(self.srno)
43        else:
44            self.srno = None
45
46    # Additional params required
47    # caseNumber1: CASE_No
48    # state_code, dist_code, court_code(If present)
49    def expandParams(self):
50        return {
51            "court_no": self.court_no,
52            "businessDate": self.date.strftime("%d-%m-%Y"),
53            "srno": self.srno,
54        }
Hearing( cause_list_type: Optional[str] = None, judge: Optional[str] = None, purpose: Optional[str] = None, details: Optional[Dict[str, str]] = None, date: Optional[<method 'date' of 'datetime.datetime' objects>] = None, next_date: Optional[<method 'date' of 'datetime.datetime' objects>] = None, court_no: Optional[str] = None, srno: Optional[int] = None)
cause_list_type: Optional[str] = None

The type of cause list.

judge: Optional[str] = None

The judge associated with the hearing.

purpose: Optional[str] = None

The purpose of the hearing.

details: Optional[Dict[str, str]] = None

Additional details as a dict

date: Optional[<method 'date' of 'datetime.datetime' objects>] = None

The date of the case hearing.

next_date: Optional[<method 'date' of 'datetime.datetime' objects>] = None

The date of the next scheduled hearing.

court_no: Optional[str] = None

4 digit court number,which can differ between hearings

srno: Optional[int] = None

2-3 digit serial number for this hearing within the case

def expandParams(self):
49    def expandParams(self):
50        return {
51            "court_no": self.court_no,
52            "businessDate": self.date.strftime("%d-%m-%Y"),
53            "srno": self.srno,
54        }