Skip to content

Commit

Permalink
fix(ky): make date range smaller
Browse files Browse the repository at this point in the history
Solves #1151

Date range of 30 days for regular scraper made the page return stale results; even when not exceeding the page size limit. Using a smaller range returns current results

Also, refactor disposition parsing to exclude placeholder values
  • Loading branch information
grossir committed Nov 21, 2024
1 parent 2567793 commit ed8ed8a
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions juriscraper/opinions/united_states/state/ky.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class Site(OpinionSiteLinear):
# Home: https://appellatepublic.kycourts.net/login
first_opinion_date = datetime(1982, 2, 18).date()
days_interval = 10 # page size of 25
days_interval = 7 # page size of 25

api_court = "Kentucky Supreme Court"
api_url = (
Expand Down Expand Up @@ -62,7 +62,7 @@ def set_url(
"""
if not start:
end = datetime.now()
start = end - timedelta(30)
start = end - timedelta(7)

logger.info("Date range %s %s", start, end)
params = {
Expand All @@ -73,8 +73,8 @@ def set_url(
"searchFields[1].operation": "<=",
"searchFields[1].values[0]": end.strftime("%m/%d/%Y"),
"searchFields[1].indexFieldName": "filedDate",
"searchFilters[0].indexFieldName": "caseHeader.court",
"searchFilters[0].operation": "=",
"searchFilters[0].indexFieldName": "caseHeader.court",
"searchFilters[0].values[0]": self.api_court,
}
self.url = f"{self.api_url}{urlencode(params)}"
Expand Down Expand Up @@ -119,6 +119,12 @@ def _process_html(self) -> None:
# May contain the case name
disposition = re.split(self.judge_regex, disposition)[0]

if disposition.upper() in [
"OPINION OF THE COURT",
"OPINION AND ORDER",
]:
disposition = ""

if self.test_mode_enabled():
# detail request has been manually nested in the test file
doc_json = result["detailJson"]
Expand Down

0 comments on commit ed8ed8a

Please sign in to comment.