Skip to content

Commit

Permalink
Merge pull request #1156 from grossir/vt_neutral_citation
Browse files Browse the repository at this point in the history
  • Loading branch information
flooie authored Sep 4, 2024
2 parents 16a441b + cad2802 commit 76c1fe8
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 23 deletions.
11 changes: 11 additions & 0 deletions juriscraper/opinions/united_states/state/vt.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
She's very responsive.
"""

import re
from datetime import date, datetime
from typing import Optional, Tuple
from urllib.parse import urlencode
Expand Down Expand Up @@ -112,3 +113,13 @@ def set_url(
params["facet_to_date"] = end.strftime("%m/%d/%Y")

self.url = f"{self.base_url}?{urlencode(params)}"

def extract_from_text(self, scraped_text: str):
match = re.search(
r"(?P<volume>\d{4}) (?P<reporter>VT) (?P<page>\d+)",
scraped_text[:1000],
)
if match:
return {"Citation": {"type": 8, **match.groupdict()}}

return {}
13 changes: 8 additions & 5 deletions juriscraper/opinions/united_states/state/vtsuperct_civil.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,16 @@
Court Contact: submit form here https://www.vermontjudiciary.org/website-feedback-form
"""

from . import vt
from juriscraper.opinions.united_states.state import vt
from juriscraper.OpinionSite import OpinionSite


class Site(vt.Site):
division = 1
days_interval = 100

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.court_id = self.__module__
# Deactivate extract_from_text from parent class
# and avoid triggering the example requirement from
# tests.local.test_ScraperExtractFromTextTest
# Other vtsuperct_* scrapers will inherit from this one
# to inherit the same behaviour
extract_from_text = OpinionSite.extract_from_text
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@
Court Contact: submit form here https://www.vermontjudiciary.org/website-feedback-form
"""

from . import vt
from juriscraper.opinions.united_states.state import vtsuperct_civil


class Site(vt.Site):
class Site(vtsuperct_civil.Site):
division = 3
days_interval = 90

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.court_id = self.__module__
8 changes: 2 additions & 6 deletions juriscraper/opinions/united_states/state/vtsuperct_family.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@
Court Contact: submit form here https://www.vermontjudiciary.org/website-feedback-form
"""

from . import vt
from juriscraper.opinions.united_states.state import vtsuperct_civil


class Site(vt.Site):
class Site(vtsuperct_civil.Site):
division = 4
days_interval = 360

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.court_id = self.__module__
8 changes: 2 additions & 6 deletions juriscraper/opinions/united_states/state/vtsuperct_probate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@
Court Contact: submit form here https://www.vermontjudiciary.org/website-feedback-form
"""

from . import vt
from juriscraper.opinions.united_states.state import vtsuperct_civil


class Site(vt.Site):
class Site(vtsuperct_civil.Site):
division = 6
days_interval = 200

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.court_id = self.__module__
28 changes: 28 additions & 0 deletions tests/local/test_ScraperExtractFromTextTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,34 @@ class ScraperExtractFromText(unittest.TestCase):
},
),
],
"juriscraper.opinions.united_states.state.vt": [
(
# https://www.courtlistener.com/api/rest/v3/opinions/10566596/
"""NOTICE: This opinion is subject to motions for reargument under V.R.A.P. 40 as well as formal\nrevision before publication in the Vermont Reports. Readers are requested to notify the Reporter\nof Decisions by email at: [email protected] or by mail at: Vermont Supreme Court, 109\nState Street, Montpelier, Vermont 05609-0801, of any errors in order that corrections may be made\nbefore this opinion goes to press.\n\n\n 2024 VT 52\n\n No. 23-AP-226\n\nState of Vermont """,
{
"Citation": {
"volume": "2024",
"reporter": "VT",
"page": "52",
"type": 8,
}
},
)
],
"juriscraper.opinions.united_states.state.vt_criminal": [
(
# https://www.courtlistener.com/api/rest/v3/clusters/7854285/
"""NOTICE: This opinion is subject to motions for reargument under V.R.A.P. 40 as well as formal\nrevision before publication in the Vermont Reports. Readers are requested to notify the Reporter\nof Decisions by email at: [email protected] or by mail at: Vermont Supreme Court, 109\nState Street, Montpelier, Vermont 05609-0801, of any errors in order that corrections may be made\nbefore this opinion goes to press.\n\n\n 2022 VT 35\n\n No. 2021-059\n\nState of Vermont Supreme Court\n\n On Appeal from\n v. Superior Court, Chittenden Unit,\n Criminal Division\n\nRandy F. Therrien """,
{
"Citation": {
"volume": "2022",
"reporter": "VT",
"page": "35",
"type": 8,
}
},
)
],
}

def test_extract_from_text(self):
Expand Down

0 comments on commit 76c1fe8

Please sign in to comment.