Skip to content

Commit

Permalink
Merge pull request #1273 from freelawproject/fix_author_str_per_curia…
Browse files Browse the repository at this point in the history
…m_value

fix(ca7, ala, tenn, nmariana): do not return "per curiam" as value for author_str or judges field
  • Loading branch information
flooie authored Dec 12, 2024
2 parents 91f3a05 + 0421259 commit 406f85a
Show file tree
Hide file tree
Showing 15 changed files with 15,294 additions and 142 deletions.
6 changes: 6 additions & 0 deletions juriscraper/opinions/united_states/federal_appellate/ca7.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ def _process_html(self):
docket = parts[parts.index("case#") + 1]
name = item["summary"].split(docket)[1].split("(")[0]
author = item["summary"].split("{")[1].split("}")[0]
per_curiam = False
if "curiam" in author.lower():
per_curiam = True
author = ""

self.cases.append(
{
"url": item["link"],
Expand All @@ -31,5 +36,6 @@ def _process_html(self):
"status": "Published",
"judge": author,
"author": author,
"per_curiam": per_curiam,
}
)
13 changes: 11 additions & 2 deletions juriscraper/opinions/united_states/state/ala.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,24 @@ def _process_html(self):

url = f"https://publicportal-api.alappeals.gov/courts/{self.court_str}/cms/case/{publicationItem['caseInstanceUUID']}/docketentrydocuments/{publicationItem['documents'][0]['documentLinkUUID']}"
docket = publicationItem["caseNumber"]
author = publicationItem["groupName"]
name = publicationItem["title"]
judge = publicationItem["groupName"]
if judge == "On Rehearing":
judge = ""

per_curiam = False
if "curiam" in judge.lower():
judge = ""
per_curiam = True

self.cases.append(
{
"date": date_filed,
"name": name,
"docket": docket,
"status": "Published",
"url": url,
"judge": author,
"judge": judge,
"per_curiam": per_curiam,
}
)
10 changes: 9 additions & 1 deletion juriscraper/opinions/united_states/state/tenn.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,22 @@ def _process_html(self):
row.strip()
for row in section.text_content().strip().split("\n", 4)
]

judge = rows[2].split(": ")[1]
per_curiam = False
if "curiam" in judge.lower():
judge = ""
per_curiam = True

self.cases.append(
{
"date": date,
"lower_court": lower_court,
"url": url,
"name": name,
"docket": rows[1],
"judge": rows[2].split(": ")[1],
"judge": judge,
"summary": rows[-1],
"per_curiam": per_curiam,
}
)
6 changes: 4 additions & 2 deletions juriscraper/opinions/united_states/territories/nmariana.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _fetch_author(self, judges: str) -> str:
:return: The author
"""
if "*" not in judges:
author = "Per Curiam"
author = ""
else:
author = [j for j in judges.split(",") if "*" in j][0].strip("*")
return author
Expand All @@ -55,13 +55,15 @@ def _process_html(self):
for s in self.html.xpath(".//td/a/@href[contains(., 'pdf')]/../../.."):
cells = s.xpath(".//td")
judge_text = cells[3].text_content()
author = self._fetch_author(judge_text)
self.cases.append(
{
"name": cells[0].text_content(),
"citation": cells[1].text_content(),
"date": cells[2].text_content(),
"judge": ", ".join(self._cleanup_judge_names(judge_text)),
"author": self._fetch_author(judge_text),
"author": author,
"per_curiam": not author,
"url": s.xpath(".//td/a/@href")[0],
"docket": "",
}
Expand Down
46 changes: 28 additions & 18 deletions tests/examples/opinions/united_states/ala_example.compare.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1230",
"judges": "Fridy, J.",
"case_name_shorts": ""
"case_name_shorts": "",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -18,8 +19,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1284",
"judges": "On Rehearing",
"case_name_shorts": "M.G."
"judges": "",
"case_name_shorts": "M.G.",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -29,8 +31,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1283",
"judges": "On Rehearing",
"case_name_shorts": "M.G."
"judges": "",
"case_name_shorts": "M.G.",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -40,8 +43,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1177",
"judges": "Per Curiam",
"case_name_shorts": "K.D.S."
"judges": "",
"case_name_shorts": "K.D.S.",
"per_curiam": true
},
{
"case_dates": "2023-11-09",
Expand All @@ -51,8 +55,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1176",
"judges": "Per Curiam",
"case_name_shorts": "K.D.S."
"judges": "",
"case_name_shorts": "K.D.S.",
"per_curiam": true
},
{
"case_dates": "2023-11-09",
Expand All @@ -63,7 +68,8 @@
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1265",
"judges": "Fridy, J.",
"case_name_shorts": ""
"case_name_shorts": "",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -73,8 +79,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1095",
"judges": "On Rehearing",
"case_name_shorts": "D.H."
"judges": "",
"case_name_shorts": "D.H.",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -84,8 +91,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1282",
"judges": "On Rehearing",
"case_name_shorts": "D.G."
"judges": "",
"case_name_shorts": "D.G.",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -95,8 +103,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1281",
"judges": "On Rehearing",
"case_name_shorts": "D.G."
"judges": "",
"case_name_shorts": "D.G.",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -106,7 +115,8 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2023-0255",
"judges": "On Rehearing",
"case_name_shorts": "B.W."
"judges": "",
"case_name_shorts": "B.W.",
"per_curiam": false
}
]
4,740 changes: 4,739 additions & 1 deletion tests/examples/opinions/united_states/ala_example.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1230",
"judges": "Fridy, J.",
"case_name_shorts": ""
"case_name_shorts": "",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -18,8 +19,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1284",
"judges": "On Rehearing",
"case_name_shorts": "M.G."
"judges": "",
"case_name_shorts": "M.G.",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -29,8 +31,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1283",
"judges": "On Rehearing",
"case_name_shorts": "M.G."
"judges": "",
"case_name_shorts": "M.G.",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -40,8 +43,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1177",
"judges": "Per Curiam",
"case_name_shorts": "K.D.S."
"judges": "",
"case_name_shorts": "K.D.S.",
"per_curiam": true
},
{
"case_dates": "2023-11-09",
Expand All @@ -51,8 +55,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1176",
"judges": "Per Curiam",
"case_name_shorts": "K.D.S."
"judges": "",
"case_name_shorts": "K.D.S.",
"per_curiam": true
},
{
"case_dates": "2023-11-09",
Expand All @@ -63,7 +68,8 @@
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1265",
"judges": "Fridy, J.",
"case_name_shorts": ""
"case_name_shorts": "",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -73,8 +79,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1095",
"judges": "On Rehearing",
"case_name_shorts": "D.H."
"judges": "",
"case_name_shorts": "D.H.",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -84,8 +91,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1282",
"judges": "On Rehearing",
"case_name_shorts": "D.G."
"judges": "",
"case_name_shorts": "D.G.",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -95,8 +103,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2022-1281",
"judges": "On Rehearing",
"case_name_shorts": "D.G."
"judges": "",
"case_name_shorts": "D.G.",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -106,7 +115,8 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CL-2023-0255",
"judges": "On Rehearing",
"case_name_shorts": "B.W."
"judges": "",
"case_name_shorts": "B.W.",
"per_curiam": false
}
]
4,740 changes: 4,739 additions & 1 deletion tests/examples/opinions/united_states/alacivapp_example.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CR-2023-0461",
"judges": "On Rehearing",
"case_name_shorts": "S.M."
"judges": "",
"case_name_shorts": "S.M.",
"per_curiam": false
},
{
"case_dates": "2023-11-09",
Expand All @@ -18,7 +19,8 @@
"blocked_statuses": false,
"date_filed_is_approximate": false,
"docket_numbers": "CR-2022-1020",
"judges": "On Rehearing",
"case_name_shorts": ""
"judges": "",
"case_name_shorts": "",
"per_curiam": false
}
]
5,542 changes: 5,541 additions & 1 deletion tests/examples/opinions/united_states/alacrimapp_example.json

Large diffs are not rendered by default.

Loading

0 comments on commit 406f85a

Please sign in to comment.