Skip to content

Commit

Permalink
MP: bill type classification and more governor actions
Browse files Browse the repository at this point in the history
  • Loading branch information
showerst committed Oct 13, 2023
1 parent 731a962 commit 63d79ee
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions scrapers/mp/bills.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,29 @@ class MPBillScraper(Scraper):
bill_types = {
"Senate Resolutions:": "SR",
"Senate Bills:": "SB",
"Senate Legislative initiatives:": "LI",
"Senate Legislative initiatives:": "SLI",
"Senate Joint Resolutions:": "SJR",
"Senate Local Bills:": "SLB",
"Senate Commemorative Resolutions:": "SR",
}

bill_type_map = {
"HB": "bill",
"SB": "bill",
"HR": "resolution",
"SR": "resolution",
"HLB": "bill",
"SLB": "bill",
"HJR": "joint resolution",
"SJR": "joint resolution",
"HCR": "concurrent resolution",
"HLI": "bill",
"SLI": "bill",
"HLB": "bill",
"SLB": "bill",
"HCommRes": "resolution",
}

def scrape(self, chamber=None, session=None):
chambers = [chamber] if chamber else ["upper", "lower"]
# throwaway request to get our session cookies before the POST
Expand Down Expand Up @@ -66,11 +83,14 @@ def scrape_bill(self, session, chamber, url):

title = self.get_cell_text(page, "Subject/Title")

bill_type = self.bill_type_map[bill_id.split(" ")[0]]

bill = Bill(
identifier=bill_id,
title=title,
legislative_session=session,
chamber=chamber,
classification=bill_type,
)

sponsor = self.get_cell_text(page, "Author")
Expand Down Expand Up @@ -137,9 +157,17 @@ def scrape_bill(self, session, chamber, url):
classification="referral-committee",
)

if "duly adopted" in last_action.lower():
bill.add_action(
"Duly Adopted",
dateutil.parser.parse(last_updated).strftime("%Y-%m-%d"),
chamber="executive",
classification="enrolled",
)

refs = self.get_cell_text(page, "References")
for line in refs.split("\n"):
if "governor" in line.lower():
if "governor" in line.lower() or re.match(r"g-\s?\d+", line.lower()):
action_date = re.findall(r"\d+\/\d+\/\d+", line)[0]
bill.add_action(
"Sent to Governor",
Expand Down

0 comments on commit 63d79ee

Please sign in to comment.