added ecr for kwh models

This commit is contained in:
Khalim Conn-Kowlessar 2024-07-22 14:47:24 +01:00
parent 9ea6858a80
commit 8c8dd3fb00
4 changed files with 27 additions and 2 deletions

View file

@ -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

View file

@ -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

View file

@ -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)

View file

@ -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
##############################################