mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
already installed working
This commit is contained in:
parent
3fe102c385
commit
1b3aa92671
4 changed files with 22 additions and 13 deletions
|
|
@ -469,10 +469,8 @@ class Property:
|
|||
# It means we've recommended HHR with electric immersion, and shouldn't overwrite
|
||||
# the hot water description
|
||||
continue
|
||||
# Set the new value otherwise as it's due to already installed measures - do nothing
|
||||
|
||||
raise NotImplementedError(
|
||||
"Already have this key in the phase_epc_transformation - implement me"
|
||||
)
|
||||
phase_epc_transformation[k] = v
|
||||
simulation_epc.update(phase_epc_transformation)
|
||||
self.simulation_epcs[rec["recommendation_id"]] = simulation_epc
|
||||
|
|
|
|||
|
|
@ -1073,7 +1073,6 @@ async def model_engine(body: PlanTriggerRequest):
|
|||
# We insert the innovation uplift
|
||||
measures_to_optimise_with_uplift = deepcopy(measures_to_optimise)
|
||||
|
||||
# TODO: Turn this into a function and store the innovaiton uplift
|
||||
for group in measures_to_optimise_with_uplift:
|
||||
for r in group:
|
||||
(r["partial_project_score"], r["partial_project_funding"], r["innovation_uplift"],
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ sustainability_data["double_glazing"] = sustainability_data["Glazing"].isin(
|
|||
["Double 2002 or later", "Double but age unknown", "Triple", "DoubleKnownData", "Secondary", "TripleKnownData"]
|
||||
)
|
||||
sustainability_data["secondary_glazing"] = sustainability_data["Glazing"].isin(
|
||||
["Double 2002 or later", "Double but age unknown", "Triple", "DoubleKnownData", "Secondary", "TripleKnownData"]
|
||||
["Secondary"]
|
||||
)
|
||||
|
||||
sustainability_data["suspended_floor_insulation"] = sustainability_data["Floor Insulation"].isin(
|
||||
|
|
@ -262,8 +262,9 @@ loft_conflicting["conflict_loft_insulation"] = True
|
|||
|
||||
# ------------ Windows ------------
|
||||
double_glazing_conflicting = comparison[
|
||||
(comparison["double_glazing"]) &
|
||||
(pd.isnull(comparison["double_glazing_from_recs"]) == False)
|
||||
(comparison["double_glazing"] | comparison["secondary_glazing"]) &
|
||||
(pd.isnull(comparison["double_glazing_from_recs"]) == False) &
|
||||
(pd.isnull(comparison["secondary_glazing_from_recs"]) == True)
|
||||
].copy()
|
||||
double_glazing_conflicting["conflict_double_glazing"] = True
|
||||
secondary_glazing_conflicting = comparison[
|
||||
|
|
@ -445,10 +446,10 @@ def add_mechanical_ventilation_for_fabric(installed_measures_df, recs_with_uprn)
|
|||
)
|
||||
|
||||
|
||||
installed_measures_df = add_mechanical_ventilation_for_fabric(
|
||||
installed_measures_df,
|
||||
recs_with_uprn
|
||||
)
|
||||
# installed_measures_df = add_mechanical_ventilation_for_fabric(
|
||||
# installed_measures_df,
|
||||
# recs_with_uprn
|
||||
# )
|
||||
|
||||
assert installed_measures_df[["uprn", "measure_type"]].duplicated().sum() == 0
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ from datatypes.enums import QuantityUnits
|
|||
from backend.Property import Property
|
||||
from backend.app.plan.schemas import MEASURE_MAP
|
||||
from BaseUtility import Definitions
|
||||
from etl.customers.vander_elliot.non_intrusives import already_installed
|
||||
from etl.epc_clean.epc_attributes.WallAttributes import WallAttributes
|
||||
from recommendations.recommendation_utils import (
|
||||
r_value_per_mm_to_u_value, calculate_u_value_uplift, is_diminishing_returns, update_lowest_selected_u_value,
|
||||
|
|
@ -641,8 +642,18 @@ class WallRecommendations(Definitions):
|
|||
# we separate the logic for for recommending them, therefore we don't
|
||||
# consider diminishing returns between the two as they are considered to be separate measures
|
||||
|
||||
prop_already_installed = self.property.already_installed
|
||||
# So, we'll end up with problems if e.g. an external wall insulation is already installed and we try and
|
||||
# recommend internal wall insulation. To avoid this, we check if either measure is already installed
|
||||
# and:
|
||||
# 1) If EWI is installed, we don't recommend IWI
|
||||
# 2) If IWI is installed, we don't recommend EWI
|
||||
# We only produce the recommendation for the moment, for the purpose of re-baselining
|
||||
|
||||
ewi_recommendations = []
|
||||
if self.ewi_valid() and "external_wall_insulation" in measures:
|
||||
if self.ewi_valid() and "external_wall_insulation" in measures and (
|
||||
"internal_wall_insulation" not in prop_already_installed
|
||||
):
|
||||
ewi_recommendations = self._find_insulation(
|
||||
u_value=u_value,
|
||||
insulation_materials=pd.DataFrame(
|
||||
|
|
@ -653,7 +664,7 @@ class WallRecommendations(Definitions):
|
|||
)
|
||||
|
||||
iwi_recommendations = []
|
||||
if "internal_wall_insulation" in measures:
|
||||
if "internal_wall_insulation" in measures and "external_wall_insulation" not in prop_already_installed:
|
||||
iwi_recommendations = self._find_insulation(
|
||||
u_value=u_value,
|
||||
insulation_materials=pd.DataFrame(self.internal_wall_insulation_materials),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue