def process_item(self, row): if not row["First Name"]: return name = "{} {}".format(row["First Name"], row["Last Name"]) party = PARTIES[row["Party"]] leg = Person( name=name, district=row["District"].lstrip("0"), party=party, state="mn", chamber="upper", image=self.extra_info[name]["image"], ) if "url" in self.extra_info[name]: leg.add_link(self.extra_info[name]["url"]) if "office_phone" in self.extra_info[name]: leg.capitol_office.voice = self.extra_info[name]["office_phone"] if "email" in self.extra_info[name]: leg.email = self.extra_info[name]["email"] row["Zipcode"] = row["Zipcode"].strip() if ( a in row["Address2"] for a in ["95 University Avenue W", "100 Rev. Dr. Martin Luther King"] ): address = "{Address}\n{Address2}\n{City}, {State} {Zipcode}".format(**row) if "Rm. Number" in row: address = "{0} {1}".format(row["Rm. Number"], address) leg.capitol_office.address = address leg.add_source(self.source.url) leg.add_source(SEN_HTML_URL) return leg
def process_item(self, item): chamber_id = item["district"]["chamberType"] p = Person( state="ga", chamber=self.chamber_types[chamber_id], district=str(item["district"]["number"]), name=item["fullName"], family_name=item["name"]["familyName"], given_name=item["name"]["first"], suffix=item["name"]["suffix"] or "", party=self.party_ids[item["party"]], ) # district address da = item["districtAddress"] p.email = da["email"] p.district_office.voice = da["phone"] p.district_office.fax = da["fax"] if da["address1"]: p.district_office.address = da["address1"] if da["address2"]: p.district_office.address += "; " + da["address2"] p.district_office.address += "; {city}, {state} {zip}".format(**da) p.district_office.address = p.district_office.address.strip() # photos if not item["photos"]: pass elif len(item["photos"]) == 1: p.image = item["photos"][0]["url"].split("?")[ 0] # strip off ?size=mpSm for full size else: raise Exception("unknown photos configuration: " + str(item["photos"])) # extras p.extras["residence"] = item["residence"] p.extras["city"] = item["city"] p.extras["georgia_id"] = item["id"] if item["dateVacated"]: p.end_date = item["dateVacated"] url = ( f"https://www.legis.ga.gov/members/{self.chamber_names[chamber_id]}/" f"{item['id']}?session={item['sessionId']}") p.add_source(url) p.add_link(url) return p