Example #1
0
		if street:
			city = city_re.findall(csz)[0].strip()
			address_state = state_re.findall(csz)[0].strip()
			zip_code = zip_re.findall(csz)[0].strip()
		po_city = city_re.findall(csz)[0].strip()
		po_state = state_re.findall(csz)[0].strip()
		po_zip_code = zip_re.findall(csz)[0].strip()
	else:
		city = city_re.findall(csz)[0].strip()
		address_state = state_re.findall(csz)[0].strip()
		zip_code = zip_re.findall(csz)[0].strip()

	print "_______________________________________________________"


	website = dogcatcher.find_website(website_re, county)
	print website

	if county_name == "Genesee":
		po_street = "P.O. Box 284"

	fips = dogcatcher.find_fips(county_name, voter_state)

	result.append([authority_name, first_name, last_name, county_name, fips,
	street, city, address_state, zip_code,
	po_street, po_city, po_state, po_zip_code,
	reg_authority_name, reg_first, reg_last,
	reg_street, reg_city, reg_state, reg_zip_code,
	reg_po_street, reg_po_city, reg_po_state, reg_po_zip_code,
	reg_phone, reg_fax, reg_email, reg_website, reg_hours,
	phone, fax, email, website, hours, voter_state, source, review])
Example #2
0
county_data = county_data_re.findall(data)

for county in county_data:

    authority_name, first_name, last_name, county_name, town_name, fips, street, city, address_state, zip_code, po_street, po_city, po_state, po_zip_code, reg_authority_name, reg_first, reg_last, reg_street, reg_city, reg_state, reg_zip_code, reg_po_street, reg_po_city, reg_po_state, reg_po_zip_code, reg_phone, reg_fax, reg_email, reg_website, reg_hours, phone, fax, email, website, hours, review = dogcatcher.begin(
        voter_state)

    county_name = county_name_re.findall(county)[0].replace(" County", "")

    county_data_item = county_data_item_re.findall(county)

    links = links_re.findall(county)

    email = dogcatcher.find_emails(email_re, county)

    website = dogcatcher.find_website(website_re, county)

    phone = dogcatcher.find_phone(phone_re, county)

    fax = dogcatcher.find_phone(fax_re, county)

    #fixing an edge case in Baltimore City
    if county_name == "Baltimore City":
        if "for Absentee Ballots Only" and "410-727-1775" in county:
            reg_fax = fax
            fax = "410-727-1775"
        else:
            print "Something's changed in Baltimore City."
            sys.exit()

    print "_______________________________________"
Example #3
0
	authority_name, first_name, last_name, county_name, town_name, fips, street, city, address_state, zip_code, po_street, po_city, po_state, po_zip_code, reg_authority_name, reg_first, reg_last, reg_street, reg_city, reg_state, reg_zip_code, reg_po_street, reg_po_city, reg_po_state, reg_po_zip_code, reg_phone, reg_fax, reg_email, reg_website, reg_hours, phone, fax, email, website, hours, review = dogcatcher.begin(voter_state)


	county_name = county_name_re.findall(county)[0]

	#This isolates the county clerk data from the complete county.
	clerk = clerk_re.findall(county)[0]

	clerk_name = name_re.findall(clerk)[0]
	first_name, last_name, review = dogcatcher.split_name(clerk_name, review)

	phone = dogcatcher.find_phone(phone_re, clerk)

	fax = dogcatcher.find_phone(fax_re, clerk)

	website = dogcatcher.find_website(website_re, clerk)

	hours = " ".join(hours_re.findall(clerk)[0].replace("<br>\n"," ").split())

	#It's hard to get the address without also getting the clerk's name.
	#So we first find the address, remove the clerk's name, and clean up a few html tags.
	#That can leave a mess of commas, so we clean that up.
	#We then extract the City, State, and Zip (CSZ) and check for a PO Box.
	#We then remove the CSZ and PO box from the address to form the street, and check whether it exists.
	#We then check whether there's anything left to be a street address. If there is, we clean it and trim it down to one line.
	#Based on whether there's a street address and a PO Box at this point, we assign the city, state, and zip accordingly.


	address = address_re.findall(clerk)[0].replace(clerk_name,"").replace("<br>",", ")
	address = address.replace("</b>","").replace("<br />","").replace("</font>","")
	for item in comma_fix_re.findall(address):
  authority_name, first_name, last_name, county_name, town_name, fips, street, city, address_state, zip_code, po_street, po_city, po_state, po_zip_code, reg_authority_name, reg_first, reg_last, reg_street, reg_city, reg_state, reg_zip_code, reg_po_street, reg_po_city, reg_po_state, reg_po_zip_code, reg_phone, reg_fax, reg_email, reg_website, reg_hours, phone, fax, email, website, hours, review = dogcatcher.begin(voter_state)

  town_data_item = town_data_item_re.findall(town)

  town_name = town_name_re.findall(town)[0].title().strip()

  #The MA data is highly variable in what it includes per state. So the code makes an attempt at grabbing all of the possible secondary pieces of info available, but recognizes that it may not be able to get everything.

  fax = dogcatcher.find_phone(fax_re, town)
  phone = dogcatcher.find_phone(phone_re, town)
  try:
    email = email_re.findall(town)[0].lower()
  except:
  	email = ""
  try:
    website = dogcatcher.find_website(website_re, town)
  except:
  	website = ""


  if town_name == "Ware":
    town_data_item.insert(0, "TOWN CLERK")

  authority_name = town_data_item[0].title().replace("'S","'s").replace(town_name.upper(),"").strip(", ")

  #This section generates the address.
  #MA addresses are formatted "Street\nAdditional namep--i.e., Town Clerk (maybe)\nMailing(If it exists)\nCity, State (If city isn't the town name)\nZip"
  #It first sees whether there is a mailing adddress, and if so, stores that address.
  #It next removes every line break to get the entire address into one line.
  #It then sees whether there is a city/state combination.
  #It then follows the normal procedure: generating the street address by removing everything else, identifying the city and state, and so forth.
Example #5
0
        voter_state)

    town_data_item = town_data_item_re.findall(town)

    town_name = town_name_re.findall(town)[0].title().strip()

    #The MA data is highly variable in what it includes per state. So the code makes an attempt at grabbing all of the possible secondary pieces of info available, but recognizes that it may not be able to get everything.

    fax = dogcatcher.find_phone(fax_re, town)
    phone = dogcatcher.find_phone(phone_re, town)
    try:
        email = email_re.findall(town)[0].lower()
    except:
        email = ""
    try:
        website = dogcatcher.find_website(website_re, town)
    except:
        website = ""

    if town_name == "Ware":
        town_data_item.insert(0, "TOWN CLERK")

    authority_name = town_data_item[0].title().replace("'S", "'s").replace(
        town_name.upper(), "").strip(", ")

    #This section generates the address.
    #MA addresses are formatted "Street\nAdditional namep--i.e., Town Clerk (maybe)\nMailing(If it exists)\nCity, State (If city isn't the town name)\nZip"
    #It first sees whether there is a mailing adddress, and if so, stores that address.
    #It next removes every line break to get the entire address into one line.
    #It then sees whether there is a city/state combination.
    #It then follows the normal procedure: generating the street address by removing everything else, identifying the city and state, and so forth.