Justice
Classes
Justice
Bases: Bio
Source code in corpus_base/justice.py
Python | |
---|---|
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
|
Functions
get_active_on_date(c, target_date)
classmethod
Get list of justices that have been appointed before the target date
and have not yet become inactive.
Source code in corpus_base/justice.py
get_justice_on_date(c, target_date, cleaned_name)
classmethod
Based on get_active_on_date()
, match the cleaned_name to either the alias of the justice or the justice's last name; on match, determine whether the designation should be 'C.J.' or 'J.'
Source code in corpus_base/justice.py
init_justices_tbl(c, p=JUSTICE_LOCAL)
classmethod
Add a table containing names and ids of justices; alter the original decision's table for it to include a justice id.
Source code in corpus_base/justice.py
set_local_from_api(local=JUSTICE_LOCAL)
classmethod
Create a local .yaml file containing the list of validated Justices.
Source code in corpus_base/justice.py
view_chiefs(c)
classmethod
Get general information of the chief justices and their dates of appointment.
Source code in corpus_base/justice.py
Insert records
Can add all pydantic validated records from the local copy of justices to the database.
>>> from corpus_base import Justice
>>> Justice.init_justices_tbl(c) # c = instantiated Connection
<Table justices_tbl (first_name, last_name, suffix, full_name, gender, id, alias, start_term, end_term, chief_date, birth_date, retire_date, inactive_date)>
Clean raw ponente string
Each ponente
name stored in decisions_tbl
of the database has been made uniform, e.g.:
>>> from corpus_base import RawPonente
>>> RawPonente.clean("REYES , J.B.L, Acting C.J.") # sample name 1
"reyes, j.b.l."
>>> RawPonente.clean("REYES, J, B. L. J.") # sample name 2
"reyes, j.b.l."
We can see most common names in the ponente
field and the covered dates, e.g. from 1954 to 1972 (dates found in the decisions), there have been 1053 decisions marked with jbl
(as cleaned):
>>> from corpus_base.helpers import most_popular
>>> [i for i in most_popular(c, db)] # excluding per curiams and unidentified cases
[
('1994-07-04', '2017-08-09', 'mendoza', 1297), # note multiple personalities named mendoza, hence long range from 1994-2017
('1921-10-22', '1992-07-03', 'paras', 1287), # note multiple personalities named paras, hence long range from 1921-1992
('2009-03-17', '2021-03-24', 'peralta', 1243),
('1998-06-18', '2009-10-30', 'quisumbing', 1187),
('1999-06-28', '2011-06-02', 'ynares-santiago', 1184),
('1956-04-28', '2008-04-04', 'panganiban', 1102),
('1936-11-19', '2009-11-05', 'concepcion', 1058), # note multiple personalities named concepcion, hence long range from 1936-2009
('1954-07-30', '1972-08-18', 'reyes, j.b.l.', 1053),
('1903-11-21', '1932-03-31', 'johnson', 1043),
('1950-11-16', '1999-05-23', 'bautista angelo', 1028), # this looks like bad data
('2001-11-20', '2019-10-15', 'carpio', 1011),
...
]
Isolate active justices on date
When selecting a ponente or voting members, create a candidate list of justices based on date:
>>> from corpus_base import Justice
>>> Justice.get_active_on_date(c, 'Dec. 1, 1995') # target date
[
{
'id': 137,
'surname': 'panganiban',
'alias': None,
'start_term': '1995-10-05', # since start date is greater than target date, record is included
'inactive_date': '2006-12-06',
'chief_date': '2005-12-20'
},
{
'id': 136,
'surname': 'hermosisima',
'alias': 'hermosisima jr.',
'start_term': '1995-01-10',
'inactive_date': '1997-10-18',
'chief_date': None
},
]
Designation as chief or associate
Since we already have candidates, we can cleaning desired option to get the id
and designation
:
>>> from corpus_base import RawPonente
>>> RawPonente.clean('Panganiban, Acting Cj')
'panganiban'
>>> Justice.get_justice_on_date(c, '2005-09-08', 'panganiban')
{
'id': 137,
'surname': 'Panganiban',
'start_term': '1995-10-05',
'inactive_date': '2006-12-06',
'chief_date': '2005-12-20',
'designation': 'J.' # note variance
}
Note that the raw information above contains 'Acting Cj' and thus the designation is only 'J.'
At present we only track 'C.J.' and 'J.' titles.
With a different date, we can get the 'C.J.' designation.:
>>> Justice.get_justice_on_date('2006-03-30', 'panganiban')
{
'id': 137,
'surname': 'Panganiban',
'start_term': '1995-10-05',
'inactive_date': '2006-12-06',
'chief_date': '2005-12-20',
'designation': 'C.J.' # corrected
}
View chief justice dates
>>> from corpus_base import Justice
>>> Justice.view_chiefs(c)
[
{
'id': 178,
'last_name': 'Gesmundo',
'chief_date': '2021-04-05',
'max_end_chief_date': None,
'actual_inactive_as_chief': None,
'years_as_chief': None
},
{
'id': 162,
'last_name': 'Peralta',
'chief_date': '2019-10-23',
'max_end_chief_date': '2021-04-04',
'actual_inactive_as_chief': '2021-03-27',
'years_as_chief': 2
},
{
'id': 163,
'last_name': 'Bersamin',
'chief_date': '2018-11-26',
'max_end_chief_date': '2019-10-22',
'actual_inactive_as_chief': '2019-10-18',
'years_as_chief': 1
},
{
'id': 160,
'last_name': 'Leonardo-De Castro',
'chief_date': '2018-08-28',
'max_end_chief_date': '2018-11-25',
'actual_inactive_as_chief': '2018-10-08',
'years_as_chief': 0
}...
]