Skip to content

Commit

Permalink
debuggin api-bridge / changes on utils
Browse files Browse the repository at this point in the history
  • Loading branch information
alanabravo committed Jun 14, 2024
1 parent 2b0de24 commit 7136971
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,13 @@ def make_membership(dataset, parties_dict, abbreviations_dict, coalitions_dict,
contest_id = get_contest_id(data, contest_chambers, location_template)
role_id = get_role_id(roles, contest_id)
if data["country"] == "ar":
if data["party"].lower() in parties:
party = parties.index(data["party"].lower()) + 1
else:
fixedParty = data["party"].replace("LOS ","")
print("fixedParty",fixedParty)
party = parties.index(fixedParty.lower()) + 1
party_name = data["party"].lower()

if "y de trabajadores" in party_name:
party_name = party_name.replace("y de trabajadores","y de los trabajadores")

if party_name in parties:
party = parties.index(party_name) + 1

else:
party = abbreviations.index(data["abbreviation"].lower()) + 1
Expand All @@ -522,11 +523,11 @@ def make_membership(dataset, parties_dict, abbreviations_dict, coalitions_dict,
"date_changed_from_substitute": "0001-01-01" # TODO:
})
except ValueError:
print("make_membership parties error in line", i, "'",data["country"],data["abbreviation"].lower(),data["party"].lower(), "'","not found")
#print("parties",parties)
#print("abbreviations",abbreviations)
#print(data)
# sys.exit()
print("make_membership parties error in line", i, "'", "country: ", data["country"], "abbreviation:", data["abbreviation"].lower(), "party:", data["party"].lower(), "'","not found")
# print("parties",parties)
print("abbreviations",abbreviations)
print(data)
sys.exit()

return lines

Expand Down

0 comments on commit 7136971

Please sign in to comment.