Skip to content

Commit

Permalink
Merge pull request #1277 from freelawproject/fix_okla
Browse files Browse the repository at this point in the history
fix(okla): skip row with no docket number
  • Loading branch information
flooie authored Dec 17, 2024
2 parents 650e86a + 510ac09 commit dde9d68
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions juriscraper/opinions/united_states/state/okla.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from lxml import html

from juriscraper.AbstractSite import logger
from juriscraper.lib.html_utils import strip_bad_html_tags_insecure
from juriscraper.OpinionSiteLinear import OpinionSiteLinear

Expand All @@ -25,17 +26,18 @@ def _process_html(self):
for row in self.html.xpath(".//li[@class='decision']"):
name, citation = row.xpath(".//a/text()")
url = row.xpath(".//a/@href")[0]
date_filed_raw = row.xpath(".//span[@class='decidedDate']/text()")[
0
].strip()
docket_number_raw = row.xpath(
".//span[@class='caseNumber']/text()"
)[0].strip()
date_filed_raw = row.xpath(".//span[@class='decidedDate']/text()")
summary = row.xpath(".//p[@class='summaryParagraph']/text()")[0]

docket = row.xpath(".//span[@class='caseNumber']/text()")
if not docket:
logger.debug("Skipping row without docket number")
continue
docket_number_raw = docket[0].strip()

self.cases.append(
{
"date": date_filed_raw.split()[1],
"date": date_filed_raw[0].strip().split()[1],
"name": name,
"docket": docket_number_raw.split()[1],
"citation": citation,
Expand Down

0 comments on commit dde9d68

Please sign in to comment.