Skip to content

Commit

Permalink
LA: Bills: Fix for assumed year in action dates (#4789)
Browse files Browse the repository at this point in the history
  • Loading branch information
showerst authored Jan 10, 2024
1 parent 2d47c0c commit 1fae34b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions scrapers/la/bills.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class LABillScraper(Scraper, LXMLMixin):
"2024s2": "242ES",
}

_start_year = ""

def pdf_to_lxml(self, filename, type="html"):
text = convert_pdf(filename, type)
return lxml.html.fromstring(text)
Expand Down Expand Up @@ -122,6 +124,12 @@ def scrape_bare_page(self, url):
return []

def scrape(self, chamber=None, session=None):
# LA doesn't provide the year in action dates,
# so assume it's the year of the active session
for i in self.jurisdiction.legislative_sessions:
if i["identifier"] == session:
self.start_year = i["start_date"][0:4]

chambers = [chamber] if chamber else ["upper", "lower"]
session_id = self._session_ids[session]
# Scan bill abbreviation list if necessary.
Expand Down Expand Up @@ -335,10 +343,9 @@ def sbp(x):

for action in these_actions:
date, chamber, page, text = [x.text for x in action.xpath(".//td")]
session_year = self.jurisdiction.legislative_sessions[-1]["start_date"][0:4]
# Session is April -> June. Prefiles look like they're in
# January at earliest.
date += "/{}".format(session_year)
date += "/{}".format(self.start_year)
date = dt.datetime.strptime(date, "%m/%d/%Y")
chamber = self._chambers[chamber]

Expand Down

0 comments on commit 1fae34b

Please sign in to comment.