Skip to content

Commit

Permalink
fix(ohioctapp): parse lower_court
Browse files Browse the repository at this point in the history
Will help solve freelawproject#1135

- Now parsing lower_court for disambiguating docket numbers across
ohioctapp dockets
- Now parsing per_curiam
- Now parsing parallel_citation for `ohio`
- Updated example files
- Refactored some xpaths
  • Loading branch information
grossir committed Sep 10, 2024
1 parent 745452f commit 7daf46c
Show file tree
Hide file tree
Showing 18 changed files with 2,653 additions and 2,120 deletions.
84 changes: 47 additions & 37 deletions juriscraper/opinions/united_states/state/ohio.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from datetime import date

from juriscraper.AbstractSite import logger
from juriscraper.OpinionSiteLinear import OpinionSiteLinear


Expand All @@ -24,17 +25,12 @@ def __init__(self, *args, **kwargs):
self.url = "https://www.supremecourtofohio.gov/rod/docs/"
self.court_id = self.__module__

def _set_parameters(
self,
event_validation: str,
view_state: str,
) -> None:
def _set_parameters(self) -> None:
"""Set the parameters for the search
:param: event_validation: the event validation token
:param: view_state: the view state token
:return: None
"""
event_validation = self.html.xpath("//input[@id='__EVENTVALIDATION']")
view_state = self.html.xpath("//input[@id='__VIEWSTATE']")
self.parameters = {
"__VIEWSTATEENCRYPTED": "",
"ctl00$MainContent$ddlCourt": f"{self.court_index}",
Expand All @@ -43,43 +39,57 @@ def _set_parameters(
"ctl00$MainContent$ddlCounty": "0",
"ctl00$MainContent$btnSubmit": "Submit",
"ctl00$MainContent$ddlRowsPerPage": "50",
"__EVENTVALIDATION": event_validation,
"__VIEWSTATE": view_state,
"__EVENTVALIDATION": event_validation[0].get("value"),
"__VIEWSTATE": view_state[0].get("value"),
}
self.url = "https://www.supremecourt.ohio.gov/rod/docs/"
self.method = "POST"

def _process_html(self) -> None:
"""Process the HTML and extract the data"""
if not self.test_mode_enabled():
event_validation = self.html.xpath(
"//input[@id='__EVENTVALIDATION']"
)[0].get("value")
view_state = self.html.xpath("//input[@id='__VIEWSTATE']")[0].get(
"value"
)
self._set_parameters(
event_validation,
view_state,
)
self._set_parameters()
self.html = self._download()

# Skip the header rows and the footer rows
for row in self.html.xpath(
".//table[@id='MainContent_gvResults']//tr"
)[3:-2]:
".//table[@id='MainContent_gvResults']//tr[not(.//a[contains(@href, 'javascript')])]"
):
# Filter out the case announcements and rulings (ie non-opinions)
if not row.xpath(".//td[2]//text()")[0].strip():
docket = row.xpath(".//td[2]//text()")[0].strip()
name = row.xpath(".//a/text()")[0]
if not docket:
logger.info("Skipping row with name '%s'", name)
continue
self.cases.append(
{
"judge": row.xpath(".//td[4]//text()")[0],
"docket": row.xpath(".//td[2]//text()")[0],
"date": row.xpath(".//td[6]//text()")[0],
"name": row.xpath(".//a/text()")[0],
"url": row.xpath(".//a")[0].get("href"),
"citation": row.xpath(".//td[8]//text()")[0],
"summary": row.xpath(".//td[3]//text()")[0],
"status": "Published",
}
)

judge = row.xpath(".//td[4]//text()")[0]
per_curiam = False
if "per curiam" in judge.lower():
judge = ""
per_curiam = True

citation_or_county = row.xpath(".//td[5]//text()")[0].strip()
web_cite = row.xpath(".//td[8]//text()")[0]
case = {
"docket": docket,
"name": name,
"judge": judge,
"per_curiam": per_curiam,
"summary": row.xpath(".//td[3]//text()")[0],
"date": row.xpath(".//td[6]//text()")[0],
"url": row.xpath(".//a")[0].get("href"),
"citation": web_cite,
"status": "Published",
}

# Looking for lagged citations like: '175 Ohio St.3d 155'
# For Supreme Court cases
if self.court_index == 0:
citation = ""
if web_cite not in citation_or_county:
citation = citation_or_county
case["parallel_citation"] = citation
elif "ohioctapp" in self.court_id:
# For ohioctapp cases. This will be important to disambiguate
# docket numbers, which may be repeated across districts
case["lower_court"] = f"{citation_or_county} County Court"

self.cases.append(case)
Loading

0 comments on commit 7daf46c

Please sign in to comment.