diff --git a/lib_afc_mosaic/universe_map_file.py b/lib_afc_mosaic/universe_map_file.py index eacc3d1..5fc6c03 100644 --- a/lib_afc_mosaic/universe_map_file.py +++ b/lib_afc_mosaic/universe_map_file.py @@ -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 diff --git a/setup.py b/setup.py index be1e86a..08b20b1 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ with open('README.md', 'r') as f: setup( name='lib_afc_mosaic', - version='0.1.6', + version='0.1.7', author='', author_email='', description='',