add new functions
This commit is contained in:
parent
cc5e509e7d
commit
2695ad5c69
|
|
@ -269,7 +269,7 @@ class AFCMUniverseMapFile:
|
|||
# Evaluate this row has a valid phone number
|
||||
try:
|
||||
parsed_number = phonenumbers.parse(cell_phone_num,'US')
|
||||
except Exception: # pylint: disable=broad-exception-caught
|
||||
except Exception: # pylint: disable=broad-except
|
||||
r['afc_error'] = f"bad row #{i} in {voterset_filename}; reason='could not parse phone number'"
|
||||
removed_rows.append(r)
|
||||
if "could not parse phone number" in self.stats["removed_details"]:
|
||||
|
|
@ -369,7 +369,7 @@ class AFCMUniverseMapFile:
|
|||
if len(amplify_rows) > 0:
|
||||
try:
|
||||
write_csv_file(prep_full_pathname, amplify_rows[0].keys(), amplify_rows)
|
||||
except Exception as ex:
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
print(f"[WRITING {prep_file_name}] [{str(ex)}]")
|
||||
|
||||
# write S3
|
||||
|
|
@ -389,7 +389,7 @@ class AFCMUniverseMapFile:
|
|||
if len(removed_rows) > 0:
|
||||
try:
|
||||
write_csv_file(removed_full_pathname, removed_rows[0].keys(), removed_rows)
|
||||
except Exception as ex:
|
||||
except Exception as ex: # pylint: disable=broad-except
|
||||
print(f"[WRITING {removed_file_name}] [{str(ex)}]")
|
||||
|
||||
# write S3
|
||||
|
|
@ -430,6 +430,9 @@ class AFCMUniverseMapFile:
|
|||
write_final_file Writes the final CSV to S3
|
||||
"""
|
||||
|
||||
# Set the length of the final file
|
||||
self.metadata["total_rows"] = len(self.final_rows)
|
||||
|
||||
# Need to write the FINAL file
|
||||
if len(self.final_rows) > 0:
|
||||
final_filename = self.metadata.get('mosaic_filename', 'MOSAIC.csv')
|
||||
|
|
@ -460,6 +463,19 @@ class AFCMUniverseMapFile:
|
|||
data=json_data)
|
||||
|
||||
|
||||
def get_mosaic_map_dict(self) -> dict:
|
||||
"""
|
||||
get_mosaic_map_dict Generate the dictionary for the VoterSet mosaic map json
|
||||
|
||||
:return A generated dict
|
||||
"""
|
||||
return {
|
||||
"mosaic": self.mosaic_head,
|
||||
"metadata": self.metadata,
|
||||
"files": self.mosaic_file_list
|
||||
}
|
||||
|
||||
|
||||
def get_voter_object(self) -> dict:
|
||||
"""
|
||||
get_voter_object Get the voter to the API object
|
||||
|
|
|
|||
Loading…
Reference in New Issue