Last active
March 24, 2019 16:36
-
-
Save talfco/2fdf98466693150fc45b299529e51120 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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