From 8e855f45dbaaa794e57b8103f7281daac16f2821 Mon Sep 17 00:00:00 2001 From: braykuka Date: Thu, 1 Aug 2024 09:59:48 +0200 Subject: [PATCH 1/2] SD: Add room to location --- scrapers/sd/events.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/scrapers/sd/events.py b/scrapers/sd/events.py index a77712f464..199b33482c 100644 --- a/scrapers/sd/events.py +++ b/scrapers/sd/events.py @@ -1,9 +1,11 @@ -from openstates.scrape import Scraper, Event +import re import pytz import lxml import scrapelib import dateutil.parser +from openstates.scrape import Scraper, Event + class SDEventScraper(Scraper): # chambers = {"lower": "House", "upper": "Senate", "joint": "Joint"} @@ -26,7 +28,8 @@ def scrape_schedule_file(self): com_name = row["InterimYearCommitteeName"] com = {"FullName": com_name} - event = self.create_event(com, row) + location = row["Room"] + event = self.create_event(com, row, location) self.scrape_agendas_and_bills(event, row["DocumentId"]) @@ -179,12 +182,16 @@ def scrape(self): for key in events_by_date: yield events_by_date[key] - def create_event(self, committee, agenda_document): + def create_event(self, committee, agenda_document, location=""): name = committee["FullName"] start_date = dateutil.parser.parse(agenda_document["DocumentDate"]) - location = "500 E Capitol Ave, Pierre, SD 57501" + base_loc = "500 E Capitol Ave, Pierre, SD 57501" + if location and re.match(r"Room \d+", location): + location = base_loc + ", " + location + + location = location or base_loc event = Event( name=name, From 174b0b8a165b271fbcedafe48f7b044b4facf680 Mon Sep 17 00:00:00 2001 From: braykuka Date: Sun, 4 Aug 2024 03:13:06 +0200 Subject: [PATCH 2/2] fix: issue --- scrapers/sd/events.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scrapers/sd/events.py b/scrapers/sd/events.py index 199b33482c..38ea4715f5 100644 --- a/scrapers/sd/events.py +++ b/scrapers/sd/events.py @@ -189,7 +189,7 @@ def create_event(self, committee, agenda_document, location=""): base_loc = "500 E Capitol Ave, Pierre, SD 57501" if location and re.match(r"Room \d+", location): - location = base_loc + ", " + location + location = location + ", " + base_loc location = location or base_loc