diff --git a/backend/app/config.py b/backend/app/config.py index ef48c317..f80da387 100644 --- a/backend/app/config.py +++ b/backend/app/config.py @@ -9,9 +9,14 @@ class Settings(BaseSettings): ENVIRONMENT: str DATA_BUCKET: str PLAN_TRIGGER_BUCKET: str + + # Third parties EPC_AUTH_TOKEN: str ORDNANCE_SURVEY_API_KEY: str GOOGLE_SOLAR_API_KEY: str + FARADAY_API_KEY: str + + # Database settings DB_HOST: str DB_PASSWORD: str DB_USERNAME: str diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py index 00e73b56..8e6bc3b1 100644 --- a/backend/app/plan/router.py +++ b/backend/app/plan/router.py @@ -488,6 +488,13 @@ async def trigger_plan(body: PlanTriggerRequest): "carbon_ending"] ) + from utils.s3 import save_dataframe_to_s3_parquet + save_dataframe_to_s3_parquet( + bucket_name="retrofit-datalake-dev", + file_key="recommendations_scoring_data_11th_july.parquet", + df=recommendations_scoring_data + ) + model_api = ModelApi(portfolio_id=body.portfolio_id, timestamp=created_at) all_predictions = model_api.predictions_template() @@ -503,6 +510,8 @@ async def trigger_plan(body: PlanTriggerRequest): for key, scored in predictions_dict.items(): all_predictions[key] = pd.concat([all_predictions[key], scored]) + prediction_df = all_predictions["heating_cost_predictions"] + # Insert the predictions into the recommendations and run the optimiser # TODO: If a recommendation has a negative impact on SAP, we should remove it - this seems to have become a # possibility with heating system diff --git a/etl/bill_savings/data_collection.py b/etl/bill_savings/data_collection.py index be141c01..35498037 100644 --- a/etl/bill_savings/data_collection.py +++ b/etl/bill_savings/data_collection.py @@ -128,12 +128,12 @@ def app(): epc_directories = [entry for entry in EPC_DIRECTORY.iterdir() if entry.is_dir()] - sample_size = 100 + sample_size = 500 energy_consumption_data = [] for i, directory in tqdm(enumerate(epc_directories), total=len(epc_directories)): # Skip the first 50 - if i < 110: + if i < 127: continue data = pd.read_csv(directory / "certificates.csv", low_memory=False) diff --git a/infrastructure/terraform/main.tf b/infrastructure/terraform/main.tf index b90c73a8..51b4d87d 100644 --- a/infrastructure/terraform/main.tf +++ b/infrastructure/terraform/main.tf @@ -220,6 +220,17 @@ module "lambda_hot_water_cost_prediction_ecr" { source = "./modules/ecr" } +# For heating and hot water kwh models +module "lambda_heating_kwh_prediction_ecr" { + ecr_name = "heating-kwh-prediction-${var.stage}" + source = "./modules/ecr" +} + +module "lambda_hotwater_kwh_prediction_ecr" { + ecr_name = "hotwater-kwh-prediction-${var.stage}" + source = "./modules/ecr" +} + ############################################## # CDN - Cloudfront ##############################################