Skip to content

Instantly share code, notes, and snippets.

@talfco
Last active March 24, 2019 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talfco/2fdf98466693150fc45b299529e51120 to your computer and use it in GitHub Desktop.
Save talfco/2fdf98466693150fc45b299529e51120 to your computer and use it in GitHub Desktop.
def __calculate_name_matching(self, row):
name = row['Name']
name = (normalize_unicode_to_ascii(name)).strip()
tp = tuple(name.split(" "))
res = self.__gov_api.match_name(tp)
if res[0] is not None:
row['col_match1'] = res[0]
row['col_match2'] = str(res[1])
person = self.__gov_api.get_person_record(res[0])
row['party'] = person.get('party')
row['electedDate'] = person.get('electedDate')
row['gender'] = person.get('gender')
row['maritalStatus'] = person.get('maritalStatus')
row['birthDate'] = person.get('birthDate')
else:
row['col_match1'] = ""
row['col_match2'] = ""
row['party'] = ""
row['electedDate'] = ""
row['gender'] = ""
row['maritalStatus'] = ""
row['birthDate'] = ""
return row
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment