Skip to content

Commit

Permalink
Merge pull request #107 from City-Bureau/fix-design-review
Browse files Browse the repository at this point in the history
🕷️ Fix spider: Cleveland Design Review Advisory Committees
  • Loading branch information
SimmonsRitchie committed May 7, 2024
2 parents 3bbc431 + 3bf6d76 commit 8302691
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
15 changes: 8 additions & 7 deletions city_scrapers/spiders/cle_design_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ class CleDesignReviewSpider(CityScrapersSpider):
start_urls = [
"https://planning.clevelandohio.gov/designreview/schedule.php" # noqa
]
description = "Due to Covid meetings are being held on WebEx rather than in person. For more information contact " # noqa
calculated_description = "This is an upcoming meeting - please verify it with staff if you want attend. Due to Covid meetings are being held on WebEx rather than in person. For more information contact " # noqa
description = "Cleveland Planning Commission conducts virtual meetings in a limited capacity using the WebEx Platform. To request access to WebEx meetings, email " # noqa

def parse(self, response):
"""
Expand Down Expand Up @@ -130,7 +129,7 @@ def parse(self, response):
start = self._parse_calculated_start(day, time_str)
meeting = Meeting(
title=title,
description=self.calculated_description + email_contact,
description=self.description + email_contact,
classification=ADVISORY_COMMITTEE,
start=start,
end=None,
Expand Down Expand Up @@ -166,6 +165,7 @@ def _parse_time_str(self, item):

def _parse_start(self, year_str, month_str, day_str, time_str):
"""Parse start datetime as a naive datetime object."""
print(year_str, month_str, day_str, time_str)
date_str = " ".join([year_str, month_str, day_str, time_str])
return datetime.strptime(date_str, "%Y %B %d %I:%M%p")

Expand Down Expand Up @@ -241,10 +241,11 @@ def _parse_meeting_schedule_info(self, committee_meta):
return weekday, chosen_ordinals, is_downtown

def _parse_weekday(self, weekday):
"""Parses weekday strings as their integer equivalent"""
# we cut off the last char of weekday, because it comes through with
# an 's' i.e. 'Tuesdays'
return time.strptime(weekday[:-1], "%A").tm_wday
"""Parses weekday strings as their integer equivalent.
Handles pluralization."""
if weekday.endswith("s"):
weekday = weekday[:-1]
return time.strptime(weekday, "%A").tm_wday

def _parse_ordinal(self, ordinal_str):
"""Parses ordinals as their integer equivalent beginning from 0"""
Expand Down
4 changes: 2 additions & 2 deletions tests/test_cle_design_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_title():
def test_description():
assert (
parsed_items[0]["description"]
== "Due to Covid meetings are being held on WebEx rather than in person. For more information contact asantora@clevelandohio.gov" # noqa
== CleDesignReviewSpider.description + "asantora@clevelandohio.gov" # noqa
)


Expand Down Expand Up @@ -102,7 +102,7 @@ def test_future_meeting_title():
def test_future_meeting_description():
assert (
parsed_items[-1]["description"]
== "This is an upcoming meeting - please verify it with staff if you want attend. Due to Covid meetings are being held on WebEx rather than in person. For more information contact mfields@clevelandohio.gov" # noqa
== CleDesignReviewSpider.description + "mfields@clevelandohio.gov" # noqa
)


Expand Down

0 comments on commit 8302691

Please sign in to comment.