Skip to content

Commit d37a85d

Browse files
authored
Merge branch 'main' into 1484-ca7-missing-information
2 parents 53e6497 + 08e4f0c commit d37a85d

File tree

6 files changed

+48
-11
lines changed

6 files changed

+48
-11
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The following changes are not yet released, but are code complete:
1616

1717
Features:
1818
- Add error handling for scrapers with expected results #1447
19+
- Add a check to verify ACMS user data is loaded before querying attachment pages #1495
1920

2021
Changes:
2122
- Expanded ACMS URL matching to support both HTTP and HTTPS protocols.
@@ -63,6 +64,7 @@ Changes:
6364
- Update `tenn` add backscraper #1425
6465

6566
Fixes:
67+
- Add "lower_court_ids" to fields returned by OpinionSite #1432
6668
- Fix `va` collecting bad docket_number values #1441
6769
- Fix `mich` change date expected key to `date_filed` #1445
6870

juriscraper/OpinionSite.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def __init__(self, *args, **kwargs):
2525
"docket_numbers",
2626
"judges",
2727
"lower_courts",
28+
"lower_court_ids",
2829
"lower_court_judges",
2930
"lower_court_numbers",
3031
"nature_of_suit",
@@ -104,6 +105,9 @@ def _get_parallel_citations(self):
104105
def _get_lower_courts(self):
105106
return None
106107

108+
def _get_lower_court_ids(self):
109+
return None
110+
107111
def _get_lower_court_judges(self):
108112
return None
109113

juriscraper/OpinionSiteLinear.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class OpinionSiteLinear(OpinionSite):
3333
"docket_attachment_number",
3434
"docket_document_number",
3535
"nature_of_suit",
36+
"lower_court_id",
3637
"lower_court_number",
3738
"lower_court_judge",
3839
"author",
@@ -112,6 +113,9 @@ def _get_child_courts(self):
112113
def _get_lower_courts(self):
113114
return self._get_optional_field_by_id("lower_court")
114115

116+
def _get_lower_court_ids(self):
117+
return self._get_optional_field_by_id("lower_court_id")
118+
115119
def _get_lower_court_judges(self):
116120
return self._get_optional_field_by_id("lower_court_judge")
117121

juriscraper/opinions/united_states/state/tex.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ def _process_html(self) -> None:
116116
author = ""
117117
per_curiam = True
118118

119-
lower_court, lower_court_number = self.parse_lower_court_info(
120-
title
119+
lower_court, lower_court_number, lower_court_id = (
120+
self.parse_lower_court_info(title)
121121
)
122122

123123
title_regex = r"^(?P<name>.*?)(?=; from|(?=\([^)]*\)$))"
@@ -138,22 +138,23 @@ def _process_html(self) -> None:
138138
"author": author,
139139
"lower_court": lower_court,
140140
"lower_court_number": lower_court_number,
141+
"lower_court_id": lower_court_id,
141142
}
142143
)
143144

144145
@staticmethod
145-
def parse_lower_court_info(title: str) -> tuple[str, str]:
146+
def parse_lower_court_info(title: str) -> tuple[str, str, str]:
146147
"""Parses lower court information from the title string
147148
148-
:param title string
149-
:return lower_court, lower_court_number
149+
:param title: a string with lower court information
150+
:return: values for lower_court, lower_court_number, lower_court_id
150151
"""
151152

152-
# format when appeal comes from texapp. Example:
153+
# Format when appeal comes from texapp districts. Example:
153154
# ' from Harris County; 1st Court of Appeals District (01-22-00182-CV, 699 SW3d 20, 03-23-23)'
154155
texapp_regex = r" from (?P<lower_court>.*)\s*\("
155156

156-
# Examples:
157+
# Format when appeal comes from other possible courts. Examples:
157158
# "(U.S. Fifth Circuit 23-10804)"
158159
# "(U.S. 5th Circuit 19-51012)"
159160
# "(BODA Cause No. 67623)"
@@ -162,16 +163,23 @@ def parse_lower_court_info(title: str) -> tuple[str, str]:
162163
if match := re.search(texapp_regex, title):
163164
lower_court = match.group("lower_court")
164165
lower_court_number = title[match.end() :].split(",")[0]
165-
return lower_court, lower_court_number
166+
return lower_court, lower_court_number, "texapp"
167+
166168
elif match := re.search(other_courts_regex, title):
167169
lower_court = match.group("lower_court")
168170
lower_court_number = match.group("lower_number")
169171

170-
if "BODA" in lower_court_number:
172+
if lower_court == "BODA":
171173
lower_court = "Board of Disciplinary Appeals"
174+
lower_court_id = "txboda"
175+
else:
176+
# if this is not a BODA match, then it can only be a
177+
# Fifth Circuit match. Update this if the regex above changes
178+
lower_court_id = "ca5"
179+
180+
return lower_court, lower_court_number, lower_court_id
172181

173-
return lower_court, lower_court_number
174-
return "", ""
182+
return "", "", ""
175183

176184
@staticmethod
177185
def extract_type(link: etree.Element) -> str:

juriscraper/pacer/acms_attachment_page.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ def query(self, case_id: str, entry_id: str):
9595
:param entry_id: The unique identifier of the specific docket entry to
9696
retrieve.
9797
"""
98+
# Ensure ACMS user data is available before fetching attachments.
99+
# Attachment requests include user-specific data in the request body,
100+
# so the session must have the necessary authentication data
101+
# initialized beforehand.
102+
if not self.session.acms_user_data:
103+
self.session.get_acms_auth_object(self.court_id)
104+
98105
# Fetch Docket Entry Details
99106
docket_info = self.api_client.get_docket_entries(case_id)
100107

tests/examples/opinions/united_states/tex_example.compare.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"docket_numbers": "23-0808",
1111
"judges": "Blacklock",
1212
"lower_courts": "Harris County; 14th Court of Appeals District",
13+
"lower_court_ids": "texapp",
1314
"lower_court_numbers": "14-22-00013-CV",
1415
"case_name_shorts": "",
1516
"authors": "Blacklock",
@@ -27,6 +28,7 @@
2728
"docket_numbers": "23-0607",
2829
"judges": "Bland, Blacklock, Devine",
2930
"lower_courts": "Hidalgo County; 13th Court of Appeals District",
31+
"lower_court_ids": "texapp",
3032
"lower_court_numbers": "13-22-00374-CV",
3133
"case_name_shorts": "",
3234
"authors": "Bland",
@@ -44,6 +46,7 @@
4446
"docket_numbers": "23-0607",
4547
"judges": "Busby",
4648
"lower_courts": "Hidalgo County; 13th Court of Appeals District",
49+
"lower_court_ids": "texapp",
4750
"lower_court_numbers": "13-22-00374-CV",
4851
"case_name_shorts": "",
4952
"authors": "Busby",
@@ -61,6 +64,7 @@
6164
"docket_numbers": "23-0460",
6265
"judges": "Bland, Devine",
6366
"lower_courts": "Tarrant County; 2nd Court of Appeals District",
67+
"lower_court_ids": "texapp",
6468
"lower_court_numbers": "02-22-00319-CV",
6569
"case_name_shorts": "",
6670
"authors": "Bland",
@@ -78,6 +82,7 @@
7882
"docket_numbers": "23-0460",
7983
"judges": "Huddle, Blacklock, Lehrmann, Boyd, Busby, Young, Sullivan",
8084
"lower_courts": "Tarrant County; 2nd Court of Appeals District",
85+
"lower_court_ids": "texapp",
8186
"lower_court_numbers": "02-22-00319-CV",
8287
"case_name_shorts": "",
8388
"authors": "Huddle",
@@ -95,6 +100,7 @@
95100
"docket_numbers": "23-1035",
96101
"judges": "",
97102
"lower_courts": "Dallas County; 5th Court of Appeals District",
103+
"lower_court_ids": "texapp",
98104
"lower_court_numbers": "05-23-00984-CV",
99105
"case_name_shorts": "",
100106
"authors": "",
@@ -112,6 +118,7 @@
112118
"docket_numbers": "23-0927",
113119
"judges": "Sullivan",
114120
"lower_courts": "Loving County; 8th Court of Appeals District",
121+
"lower_court_ids": "texapp",
115122
"lower_court_numbers": "08-22-00129-CV",
116123
"case_name_shorts": "",
117124
"authors": "Sullivan",
@@ -129,6 +136,7 @@
129136
"docket_numbers": "24-0428",
130137
"judges": "",
131138
"lower_courts": "Harris County; 14th Court of Appeals District",
139+
"lower_court_ids": "texapp",
132140
"lower_court_numbers": "14-23-00087-CV",
133141
"case_name_shorts": "",
134142
"authors": "",
@@ -146,6 +154,7 @@
146154
"docket_numbers": "24-0616",
147155
"judges": "Lehrmann",
148156
"lower_courts": "U.S. Fifth Circuit",
157+
"lower_court_ids": "ca5",
149158
"lower_court_numbers": "23-10072",
150159
"case_name_shorts": "",
151160
"authors": "Lehrmann",
@@ -163,6 +172,7 @@
163172
"docket_numbers": "24-0759",
164173
"judges": "Sullivan",
165174
"lower_courts": "U.S. Fifth Circuit",
175+
"lower_court_ids": "ca5",
166176
"lower_court_numbers": "23-10804",
167177
"case_name_shorts": "",
168178
"authors": "Sullivan",
@@ -180,6 +190,7 @@
180190
"docket_numbers": "23-0384",
181191
"judges": "Sullivan",
182192
"lower_courts": "Harris County; 1st Court of Appeals District",
193+
"lower_court_ids": "texapp",
183194
"lower_court_numbers": "01-20-00055-CV",
184195
"case_name_shorts": "",
185196
"authors": "Sullivan",
@@ -197,6 +208,7 @@
197208
"docket_numbers": "24-0273",
198209
"judges": "Bland",
199210
"lower_courts": "Harris County; 14th Court of Appeals District",
211+
"lower_court_ids": "texapp",
200212
"lower_court_numbers": "14-23-00090-CV",
201213
"case_name_shorts": "",
202214
"authors": "Bland",

0 commit comments

Comments
 (0)