""" This scipt prepares the data, required for us to perform funding calculations. The starting data should be stored on the machine this is being run on, and this will prepare the information and upload if """ import pandas as pd from utils.s3 import save_csv_to_s3 STAGE = "dev" DATA_BUCKET = "retrofit-data-{stage}" PROJECTS_SCORES_MATRIX_LOCATION = "/Users/khalimconn-kowlessar/Downloads/ECO4 Full Project Scores Matrix.csv" WHLG_ELIGIBLE_POSTCODES = "/Users/khalimconn-kowlessar/Downloads/WHLG-eligible-postcodes.xlsx" def app(): # Read in the project scores matrix project_scores_matrix = pd.read_csv(PROJECTS_SCORES_MATRIX_LOCATION) # Store in AWS S3 save_csv_to_s3( dataframe=project_scores_matrix, bucket_name=DATA_BUCKET.format(stage=STAGE), file_name="funding/ECO4 Full Project Scores Matrix.csv" ) # Read in the Warm Homes Local Grant eligible postcodes data whlg_eligible_postcodes = pd.read_excel(WHLG_ELIGIBLE_POSTCODES, sheet_name="Eligible postcodes", header=1) # We tidy up the data before we store whlg_eligible_postcodes = whlg_eligible_postcodes[["Postcode"]] whlg_eligible_postcodes["Postcode"] = whlg_eligible_postcodes["Postcode"].str.lower() save_csv_to_s3( dataframe=whlg_eligible_postcodes, bucket_name=DATA_BUCKET.format(stage=STAGE), file_name="funding/whlg eligible postcodes.csv" )