mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
implemented number open fireplaces
This commit is contained in:
parent
253c118d2c
commit
77a7035167
4 changed files with 82 additions and 7 deletions
|
|
@ -31,6 +31,7 @@ from etl.epc.DataProcessor import DataProcessor
|
|||
from etl.epc.settings import COLUMNS_TO_MERGE_ON
|
||||
from recommendations.FloorRecommendations import FloorRecommendations
|
||||
from recommendations.VentilationRecommendations import VentilationRecommendations
|
||||
from recommendations.FireplaceRecommendations import FireplaceRecommendations
|
||||
from recommendations.optimiser.CostOptimiser import CostOptimiser
|
||||
from recommendations.optimiser.GainOptimiser import GainOptimiser
|
||||
from recommendations.optimiser.optimiser_functions import prepare_input_measures
|
||||
|
|
@ -168,6 +169,15 @@ async def trigger_plan(body: PlanTriggerRequest):
|
|||
if ventilation_recomender.recommendation:
|
||||
property_recommendations.append(ventilation_recomender.recommendation)
|
||||
|
||||
# Fireplace sealing recommendations
|
||||
fireplace_recommender = FireplaceRecommendations(
|
||||
property_instance=p
|
||||
)
|
||||
fireplace_recommender.recommend()
|
||||
|
||||
if fireplace_recommender.recommendation:
|
||||
property_recommendations.append(fireplace_recommender.recommendation)
|
||||
|
||||
# We insert temporary ids into the recommendations which is important for the optimiser later
|
||||
property_recommendations = insert_temp_recommendation_id(property_recommendations)
|
||||
|
||||
|
|
|
|||
|
|
@ -168,7 +168,12 @@ def create_recommendation_scoring_data(
|
|||
if recommendation["type"] == "mechanical_ventilation":
|
||||
scoring_dict["MECHANICAL_VENTILATION_ENDING"] = 'mechanical, extract only'
|
||||
|
||||
if recommendation["type"] not in ["wall_insulation", "floor_insulation", "mechanical_ventilation"]:
|
||||
if recommendation["type"] == "sealing_open_fireplace":
|
||||
scoring_dict["NUMBER_OPEN_FIREPLACES_ENDING"] = 0
|
||||
|
||||
if recommendation["type"] not in [
|
||||
"wall_insulation", "floor_insulation", "mechanical_ventilation", "sealing_open_fireplace"
|
||||
]:
|
||||
raise NotImplementedError("Implement me")
|
||||
|
||||
# Fill missing roof u-values - this fill is not based on recommended upgrades
|
||||
|
|
|
|||
|
|
@ -9,13 +9,25 @@ import pytest
|
|||
from utils.s3 import read_dataframe_from_s3_parquet
|
||||
from tqdm import tqdm
|
||||
|
||||
|
||||
# Handy code for selecting testin data
|
||||
# import pickle
|
||||
#
|
||||
# with open("sap_change_dataset.pickle", "rb") as f:
|
||||
# sap_change_dataset = pickle.load(f)
|
||||
#
|
||||
import pickle
|
||||
|
||||
with open("sap_change_dataset.pickle", "rb") as f:
|
||||
sap_change_dataset = pickle.load(f)
|
||||
|
||||
sap_change_dataset.columns.tolist()
|
||||
z = sap_change_dataset[(sap_change_dataset["NUMBER_OPEN_FIREPLACES_ENDING"] > 0) & (
|
||||
sap_change_dataset["NUMBER_OPEN_FIREPLACES_STARTING"] > 0)].head(2).tail(1)
|
||||
z["UPRN"]
|
||||
z["SAP_STARTING"]
|
||||
z["SAP_ENDING"]
|
||||
z["NUMBER_OPEN_FIREPLACES_STARTING"]
|
||||
z["NUMBER_OPEN_FIREPLACES_ENDING"]
|
||||
|
||||
|
||||
# 10002083298
|
||||
|
||||
# m
|
||||
# search_from = sap_change_dataset[
|
||||
# (sap_change_dataset["walls_thermal_transmittance_ENDING"] == sap_change_dataset["walls_thermal_transmittance"])
|
||||
# ]
|
||||
|
|
|
|||
48
recommendations/FireplaceRecommendations.py
Normal file
48
recommendations/FireplaceRecommendations.py
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
import pandas as pd
|
||||
from BaseUtility import Definitions
|
||||
from backend.Property import Property
|
||||
|
||||
|
||||
class FireplaceRecommendations(Definitions):
|
||||
"""
|
||||
For properties that have open fireplaces, we recommend sealing the fireplaces
|
||||
"""
|
||||
|
||||
# This is our base assumption for the cost of the work
|
||||
COST_OF_WORK = 300
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
property_instance: Property,
|
||||
):
|
||||
self.property = property_instance
|
||||
|
||||
self.has_ventilaion = None
|
||||
self.recommendation = None
|
||||
|
||||
def recommend(self):
|
||||
"""
|
||||
Based on the number of open fireplcaes found, we recommend sealing each one at a cost of
|
||||
around £500
|
||||
:return:
|
||||
"""
|
||||
|
||||
number_open_fireplaces = int(self.property.data["number-open-fireplaces"])
|
||||
|
||||
if number_open_fireplaces == 0:
|
||||
return
|
||||
|
||||
estimated_cost = number_open_fireplaces * self.COST_OF_WORK
|
||||
|
||||
# We recommend installing two mechanical ventilation systems
|
||||
self.recommendation = [
|
||||
{
|
||||
"parts": [],
|
||||
"type": "sealing_open_fireplace",
|
||||
"description": "Seal %s open fireplaces" % str(number_open_fireplaces),
|
||||
"starting_u_value": None,
|
||||
"new_u_value": None,
|
||||
"sap_points": None,
|
||||
"cost": estimated_cost,
|
||||
}
|
||||
]
|
||||
Loading…
Add table
Reference in a new issue