From aae55d8f800beb36b8e489e79acdb10fe56e7406 Mon Sep 17 00:00:00 2001 From: Tim Showers Date: Wed, 14 Sep 2016 21:49:27 -0400 Subject: [PATCH 1/4] Added UT special sessions --- openstates/ut/__init__.py | 17 +++++++++++++++-- openstates/ut/bills.py | 8 +++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/openstates/ut/__init__.py b/openstates/ut/__init__.py index 941bfb3fdb..1d47107c24 100644 --- a/openstates/ut/__init__.py +++ b/openstates/ut/__init__.py @@ -35,7 +35,7 @@ 'name': '2015-2016', 'start_year': 2015, 'end_year': 2016, - 'sessions': ['2015', '2015s1', '2016'], + 'sessions': ['2015', '2015s1', '2016', '2016S2', '2016S3'], }, ], 'session_details': { @@ -110,7 +110,20 @@ 'start_date': datetime.date(2016, 1, 25), 'display_name': '2016 General Session', '_scraped_name': '2016 General Session', - } + }, + #Note: There is no 2016s1, it's 2015s1 + '2016S2': { + 'type': 'special', + 'start_date': datetime.date(2016, 1, 25), + 'display_name': '2016 2nd Special Session', + '_scraped_name': '2016 2nd Special Session', + }, + '2016S3': { + 'type': 'special', + 'start_date': datetime.date(2016, 1, 25), + 'display_name': '2016 3rd Special Session', + '_scraped_name': '2016 3rd Special Session', + } }, 'feature_flags': ['events', 'subjects', 'influenceexplorer'], '_ignored_scraped_sessions': [ diff --git a/openstates/ut/bills.py b/openstates/ut/bills.py index 6415ec2478..5c3749906d 100644 --- a/openstates/ut/bills.py +++ b/openstates/ut/bills.py @@ -34,13 +34,19 @@ def scrape(self, session, chambers): session_search_text = session if "s" not in session.lower() and "h" not in session.lower(): session_search_text += "GS" - + + print session_search_text sessions = sessions.xpath( '//p/a[contains(@href, "{}")]'.format(session_search_text)) session_url = '' + + print sessions + for elem in sessions: + + print re.sub(r'\s+', " ", elem.xpath('text()')[0]) if re.sub(r'\s+', " ", elem.xpath('text()')[0]) == \ self.metadata['session_details'][session]['_scraped_name']: session_url = elem.xpath('@href')[0] From 7950abced4ec09085a71c08cfa39c76d5cece698 Mon Sep 17 00:00:00 2001 From: Tim Showers Date: Wed, 14 Sep 2016 21:51:06 -0400 Subject: [PATCH 2/4] Removed debug statements --- openstates/ut/bills.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/openstates/ut/bills.py b/openstates/ut/bills.py index 5c3749906d..32e02e5776 100644 --- a/openstates/ut/bills.py +++ b/openstates/ut/bills.py @@ -35,18 +35,13 @@ def scrape(self, session, chambers): if "s" not in session.lower() and "h" not in session.lower(): session_search_text += "GS" - print session_search_text - sessions = sessions.xpath( '//p/a[contains(@href, "{}")]'.format(session_search_text)) session_url = '' - - print sessions - + for elem in sessions: - print re.sub(r'\s+', " ", elem.xpath('text()')[0]) if re.sub(r'\s+', " ", elem.xpath('text()')[0]) == \ self.metadata['session_details'][session]['_scraped_name']: session_url = elem.xpath('@href')[0] From f69ed2e935431b94a3e45adcd74c35df246f292d Mon Sep 17 00:00:00 2001 From: Tim Showers Date: Wed, 14 Sep 2016 21:51:33 -0400 Subject: [PATCH 3/4] Whitespace cleanup --- openstates/ut/bills.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/openstates/ut/bills.py b/openstates/ut/bills.py index 32e02e5776..e85b23d06b 100644 --- a/openstates/ut/bills.py +++ b/openstates/ut/bills.py @@ -34,14 +34,13 @@ def scrape(self, session, chambers): session_search_text = session if "s" not in session.lower() and "h" not in session.lower(): session_search_text += "GS" - + sessions = sessions.xpath( '//p/a[contains(@href, "{}")]'.format(session_search_text)) - + session_url = '' - + for elem in sessions: - if re.sub(r'\s+', " ", elem.xpath('text()')[0]) == \ self.metadata['session_details'][session]['_scraped_name']: session_url = elem.xpath('@href')[0] From d8abb9a88558e8e1cbd39ffb4663bdb71f45187a Mon Sep 17 00:00:00 2001 From: Tim Showers Date: Wed, 14 Sep 2016 21:53:53 -0400 Subject: [PATCH 4/4] Add start dates to new special sessions --- openstates/ut/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openstates/ut/__init__.py b/openstates/ut/__init__.py index 1d47107c24..35a0c7a01a 100644 --- a/openstates/ut/__init__.py +++ b/openstates/ut/__init__.py @@ -114,13 +114,13 @@ #Note: There is no 2016s1, it's 2015s1 '2016S2': { 'type': 'special', - 'start_date': datetime.date(2016, 1, 25), + 'start_date': datetime.date(2016, 5, 18), 'display_name': '2016 2nd Special Session', '_scraped_name': '2016 2nd Special Session', }, '2016S3': { 'type': 'special', - 'start_date': datetime.date(2016, 1, 25), + 'start_date': datetime.date(2016, 7, 13), 'display_name': '2016 3rd Special Session', '_scraped_name': '2016 3rd Special Session', }