Overview
Overall strategy
Like citation-reports, there is a problem involving inconsistent use of values citations. We address it the same way by dissecting the component parts and generating a uniform citation.
The component parts of a Supreme Court decision citation:
flowchart TB
cite(citation)---docket
cite---report
docket---d1(docket category)
docket---d2(docket serial)
docket---d3(docket date)
report---r1(phil)
report---r2(scra)
report---r3(offg)
Sample citation, typically found in the body and the footnotes section of a decision:
Bagong Alyansang Makabayan v. Zamora, G.R. Nos. 138570, 138572, 138587, 138680, 138698, October 10, 2000, 342 SCRA 449
Dissecting the above yields
case title | docket category | docket serial | docket date | report phil | report scra | report offg |
---|---|---|---|---|---|---|
Bagong Alyansang... | gr |
138570 | 2000-10-10 | - | 342 SCRA 449 | - |
Citation
The Report
Model from citation-report is only one part of a Philippine Supreme Court citation. This library will handle the patterns involved with respect to the Docket, for the purpose of creating a Citation.
Bases: BaseModel
A Philippine Supreme Court Citation
consists of:
Docket
includes:- category,
- serial number, and
- date.
Report
- as defined in citation-report - includes:- volume number,
- identifying acronym of the reporter/publisher,
- page of the reported volume.
It is typical to see a Docket
combined with a Report
:
Bagong Alyansang Makabayan v. Zamora, G.R. Nos. 138570, 138572, 138587, 138680, 138698, October 10, 2000, 342 SCRA 449
Taken together (and using Bagong Alyansang Makabayan as an example) the text above can be extracted into fields:
Example | Field | Type | Description |
---|---|---|---|
GR | docket_category |
optional (ShortDocketCategory ) |
See shorthand |
138570 | docket_serial |
optional (str) | See serialized identifier |
datetime.date(2000, 10, 10) | docket_date |
optional (date) | When docket serial issued |
GR 138570, Oct. 10, 2000 | docket |
optional (str) | Combined docket_category docket_serial docket_date |
None | phil |
optional (str) | combined volume Phil. page |
342 SCRA 449 | scra |
optional (str) | combined volume SCRA page |
None | offg |
optional (str) | combined volume O.G. page |
Source code in citation_utils/citation.py
Python | |
---|---|
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 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 |
|
Functions
extract_citation(text)
classmethod
Thin wrapper over cls.extract_citations()
.
Examples:
>>> Citation.extract_citation('Hello World') is None
True
>>> next(Citation.extract_citations('12 Phil. 24'))
<Citation: 12 Phil. 24>
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
str
|
Text to evaluate |
required |
Returns:
Type | Description |
---|---|
Self | None
|
Self | None: First item found from |
Source code in citation_utils/citation.py
extract_citations(text)
classmethod
Find citations and parse resulting strings to determine whether they are:
Docket
+Report
objects (in which case,_set_docket_report()
will be used); orReport
objects (in which case_set_report()
will be used)
Then processing each object so that they can be structured in a uniform format.
Examples:
>>> text = "<em>Gatchalian Promotions Talent Pool, Inc. v. Atty. Naldoza</em>, 374 Phil. 1, 10-11 (1999), citing: <em>In re Almacen</em>, 31 SCRA 562, 600 (1970).; People v. Umayam, G.R. No. 147033, April 30, 2003; <i>Bagong Alyansang Makabayan v. Zamora,</i> G.R. Nos. 138570, 138572, 138587, 138680, 138698, October 10, 2000, 342 SCRA 449; Villegas <em>v.</em> Subido, G.R. No. 31711, Sept. 30, 1971, 41 SCRA 190;"
>>> len(list(Citation.extract_citations(text)))
5
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
str
|
Text to evaluate |
required |
Yields:
Type | Description |
---|---|
Self
|
Iterator[Self]: Itemized citations pre-processed via |
Source code in citation_utils/citation.py
CountedCitation
Bases: Citation
Source code in citation_utils/citation.py
Python | |
---|---|
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 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
Functions
counted_docket_reports(text)
classmethod
Detect dockets with reports from source text
by first converting
raw citations into a Citation
object to take advantage of __eq__
in
a seen
list. This will also populate the the unique records with missing
values.
Source code in citation_utils/citation.py
counted_reports(text)
classmethod
Detect reports only from source text
by first converting
raw citations into a Citation
object to take advantage of __eq__
in
a seen
list. This will also populate the the unique records with missing
values.
Source code in citation_utils/citation.py
from_repr_format(repr_texts)
classmethod
Generate their pydantic counterparts from <cat> <id>: <mentions>
format.
Examples:
>>> repr_texts = ['BM No. 412, Jan 01, 2000, 1111 SCRA 1111: 3', 'GR No. 147033, Apr 30, 2003, 374 Phil. 1: 3']
>>> results = list(CountedCitation.from_repr_format(repr_texts))
>>> len(results)
2
Parameters:
Name | Type | Description | Default |
---|---|---|---|
repr_texts |
str
|
list of texts having |
required |
Yields:
Type | Description |
---|---|
Self
|
Iterator[Self]: Instances of CountedCitation. |
Source code in citation_utils/citation.py
from_source(text)
classmethod
Computes mentions of counted_dockets()
vis-a-vis counted_reports()
and
count the number of unique items, taking into account the Citation
structure and the use of eq re: what is considered unique.
Examples:
>>> source = "374 Phil. 1, 10-11 (1999) 1111 SCRA 1111; G.R. No. 147033, April 30, 2003; G.R. No. 147033, April 30, 2003, 374 Phil. 1, 600; ABC v. XYZ, G.R. Nos. 138570, 138572, 138587, 138680, 138698, October 10, 2000, 342 SCRA 449; XXX, G.R. No. 31711, Sept. 30, 1971, 35 SCRA 190; Hello World, 1111 SCRA 1111; Y v. Z, 35 SCRA 190; 1 Off. Gaz. 41 Bar Matter No. 803, Jan. 1, 2000 Bar Matter No. 411, Feb. 1, 2000 Bar Matter No. 412, Jan. 1, 2000, 1111 SCRA 1111; 374 Phil. 1"
>>> list(CountedCitation.from_source(source))
[BM No. 412, Jan 01, 2000, 1111 SCRA 1111: 3, GR No. 147033, Apr 30, 2003, 374 Phil. 1: 3, GR No. 138570, Oct 10, 2000, 342 SCRA 449: 1, GR No. 31711, Sep 30, 1971, 35 SCRA 190: 2, 1 Off. Gaz. 41: 1]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
str
|
Text to Evaluate. |
required |
Returns:
Type | Description |
---|---|
list[Self]
|
list[Self]: Unique citations with their counts. |