From d032263857aef4bc1b74ed1b2a652bb98bfb8813 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 9 Aug 2024 12:37:32 +0100 Subject: [PATCH] remove missing costs --- backend/Property.py | 4 ++-- backend/app/plan/router.py | 41 ++++++++++++++++++++++++-------------- 2 files changed, 28 insertions(+), 17 deletions(-) diff --git a/backend/Property.py b/backend/Property.py index 96e3a308..062dcc14 100644 --- a/backend/Property.py +++ b/backend/Property.py @@ -728,8 +728,8 @@ class Property: } unadjusted_heating_costs = { - "heating": float(todays_heating_cost), - "hot_water": float(todays_hot_water_cost), + "heating": None, + "hot_water": None, "lighting": float(todays_lighting_cost), "appliances": float(appliances_kwh) * AnnualBillSavings.ELECTRICITY_PRICE_CAP } diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py index d0922a2b..d4dc3054 100644 --- a/backend/app/plan/router.py +++ b/backend/app/plan/router.py @@ -286,6 +286,31 @@ def create_epc_records(epc_searcher: SearchEpc, energy_assessment: dict): }, energy_assessment_is_newer +def get_on_site_data(body: PlanTriggerRequest): + """ + This function will read in the on-site data from the S3 bucket + :param body: The request body + :return: + """ + patches = [] + if body.patches_file_path: + patches = read_csv_from_s3(bucket_name=get_settings().PLAN_TRIGGER_BUCKET, filepath=body.patches_file_path) + + already_installed = [] + if body.already_installed_file_path: + already_installed = read_csv_from_s3( + bucket_name=get_settings().PLAN_TRIGGER_BUCKET, filepath=body.already_installed_file_path + ) + + non_invasive_recommendations = [] + if body.non_invasive_recommendations_file_path: + non_invasive_recommendations = read_csv_from_s3( + bucket_name=get_settings().PLAN_TRIGGER_BUCKET, filepath=body.non_invasive_recommendations_file_path + ) + + return patches, already_installed, non_invasive_recommendations + + router = APIRouter( prefix="/plan", tags=["plan"], @@ -307,21 +332,7 @@ async def trigger_plan(body: PlanTriggerRequest): logger.info("Getting the inputs") plan_input = read_csv_from_s3(bucket_name=get_settings().PLAN_TRIGGER_BUCKET, filepath=body.trigger_file_path) # If we have patches or overrides, we should read them in here - patches = [] - if body.patches_file_path: - patches = read_csv_from_s3(bucket_name=get_settings().PLAN_TRIGGER_BUCKET, filepath=body.patches_file_path) - - already_installed = [] - if body.already_installed_file_path: - already_installed = read_csv_from_s3( - bucket_name=get_settings().PLAN_TRIGGER_BUCKET, filepath=body.already_installed_file_path - ) - - non_invasive_recommendations = [] - if body.non_invasive_recommendations_file_path: - non_invasive_recommendations = read_csv_from_s3( - bucket_name=get_settings().PLAN_TRIGGER_BUCKET, filepath=body.non_invasive_recommendations_file_path - ) + patches, already_installed, non_invasive_recommendations = get_on_site_data(body) cleaning_data = read_dataframe_from_s3_parquet( bucket_name=get_settings().DATA_BUCKET, file_key="sap_change_model/cleaning_dataset.parquet",