-
-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wayne_full_commission and wayne_building_authority - 457 wayne commis…
…sion aggregate (#463) * 457 aggregate currently ready wayne commission spiders and their tests * 457 Move location out of spiders and into mixin * 457 move parse method out of spiders and into mixin; add meeting_name to spiders * 457 wayne_commission, move yearStr into _parse_start method * 457 Update wayne_cow, wayne_audit, and wayne_ways_means spiders and their tests to use the wayne_commission mixin * 457 wayne spiders - add wayne_full_commission spider and test * 457 wayne_building_authority spider and test * 457 wayne_full_commission update description from diaholliday * 457 update wayne_commission mixin with more generic logic for status text, remove re dependency * 457 Remove descriptions, replace comment with different var name * 457 wayne_building_authority simplify parse_status method. * 457 wayne_building_authority take parse_status method from mixin instead of spider.
- Loading branch information
Showing
23 changed files
with
12,184 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# THIS SPIDER USES A MIXIN FOR SHARED FUNCTIONALITY. | ||
# MIXINS ARE STORED IN /city-scrapers/city-scrapers/mixins | ||
# YOU CAN OVERRIDE THE MIXIN HERE BY CREATING YOUR OWN DEFINITION. | ||
|
||
import re | ||
from datetime import datetime | ||
from dateutil.parser import parse as dateparse | ||
from city_scrapers.spider import Spider | ||
from city_scrapers.mixins.wayne_commission import Wayne_commission | ||
|
||
|
||
class Wayne_building_authoritySpider(Wayne_commission, Spider): | ||
name = 'wayne_building_authority' | ||
agency_id = 'Wayne County Building Authority' | ||
start_urls = ['https://www.waynecounty.com/boards/buildingauthority/meetings.aspx'] | ||
meeting_name = 'Wayne County Building Authority' | ||
|
||
# Override the mixin for any unique attributes. | ||
location = { | ||
'name': '6th Floor, Guardian Building', | ||
'address': '500 Griswold St, Detroit, MI 48226', | ||
'neighborhood': '', | ||
} | ||
|
||
def _parse_entries(self, response): | ||
current_year = datetime.now().year | ||
current_year_non_empty_rows = response.xpath('//section[contains(.,"%s")]//tbody/tr[child::td/text()]' %current_year) | ||
|
||
return current_year_non_empty_rows | ||
|
||
def _parse_start(self, item): | ||
""" | ||
Parse start date and time. | ||
""" | ||
# Strong text indicates a replacement meeting date | ||
strong_text = item.xpath('.//td[2]/strong/text()').extract_first() | ||
if strong_text is not None: | ||
date_str = strong_text | ||
else: | ||
date_str = item.xpath('.//td[2]/text()').extract_first() | ||
|
||
time_str = item.xpath('.//td[3]/text()').extract_first() | ||
date_time_str = dateparse('{0} {1}'.format(date_str, time_str)) | ||
|
||
return {'date': date_time_str.date(), 'time': date_time_str.time(), 'note': ''} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# THIS SPIDER USES A MIXIN FOR SHARED FUNCTIONALITY. | ||
# MIXINS ARE STORED IN /city-scrapers/city-scrapers/mixins | ||
# YOU CAN OVERRIDE THE MIXIN HERE BY CREATING YOUR OWN DEFINITION. | ||
|
||
from city_scrapers.spider import Spider | ||
from city_scrapers.mixins.wayne_commission import Wayne_commission | ||
|
||
|
||
class Wayne_full_commissionSpider(Wayne_commission, Spider): | ||
name = 'wayne_full_commission' | ||
agency_id = 'Wayne County Full Commission' | ||
start_urls = ['https://www.waynecounty.com/elected/commission/full-commission.aspx'] | ||
meeting_name = 'Wayne County Full Commission' | ||
|
||
# Override the mixin for any unique attributes. | ||
classification = 'Board' | ||
location = { | ||
'name': 'Mezzanine level, Guardian Building', | ||
'address': '500 Griswold St, Detroit, MI 48226', | ||
'neighborhood': '', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.