Script cleanup / prepare for PR

This commit is contained in:
zandercymatics 2023-11-27 12:41:26 -07:00
parent a188137988
commit f40e71ca8b
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7
4 changed files with 11 additions and 49 deletions

View file

@ -107,6 +107,7 @@ def get_current_federal(request):
def serve_file(file_path):
"""Downloads a file based on a given filepath. Returns a 404 if not found."""
# TODO - #1403, grab from the S3 instance instead
if os.path.exists(file_path):
# Serve the CSV file
response = FileResponse(open(file_path, "rb"))

View file

@ -21,15 +21,12 @@ class Command(BaseCommand):
directory = os.path.join(options.get("directory"), "")
logger.info("Generating report...")
# TODO - Delete
current_directory = os.getcwd()
logger.info(f"Current working directory: {current_directory}")
self.generate_current_federal_report(directory)
logger.info(f"Success! Created {directory}current-federal.csv")
def generate_current_federal_report(self, directory):
"""Creates a current-full.csv file under the migrationdata/ directory"""
# TODO - #1403, push to the S3 instance instead
file_path = os.path.join(directory, "current-federal.csv")
with open(file_path, "w") as file:
csv_export.export_data_federal_to_csv(file)

View file

@ -21,15 +21,12 @@ class Command(BaseCommand):
directory = os.path.join(options.get("directory"), "")
logger.info("Generating report...")
# TODO - Delete
current_directory = os.getcwd()
logger.info(f"Current working directory: {current_directory}")
self.generate_current_full_report(directory)
logger.info(f"Success! Created {directory}current-full.csv")
def generate_current_full_report(self, directory):
"""Creates a current-full.csv file under the migrationdata/ directory"""
# TODO - #1403, push to the S3 instance instead
file_path = os.path.join(directory, "current-full.csv")
with open(file_path, "w") as file:
csv_export.export_data_full_to_csv(file)