debugging windows recommenddations integration

This commit is contained in:
Khalim Conn-Kowlessar 2023-12-20 17:25:28 +00:00
parent c5af2c23bb
commit fceb6a1d96
5 changed files with 25 additions and 3 deletions

View file

@ -18,6 +18,7 @@ class MaterialType(enum.Enum):
exposed_floor_insulation = "exposed_floor_insulation"
flat_roof_insulation = "flat_roof_insulation"
room_roof_insulation = "room_roof_insulation"
windows_glazing = "windows_glazing"
iwi_wall_demolition = "iwi_wall_demolition"
iwi_vapour_barrier = "iwi_vapour_barrier"

View file

@ -61,6 +61,7 @@ async def trigger_plan(body: PlanTriggerRequest):
logger.info("Getting the inputs")
epc_client = EpcClient(auth_token=get_settings().EPC_AUTH_TOKEN)
plan_input = read_csv_from_s3(bucket_name=get_settings().PLAN_TRIGGER_BUCKET, filepath=body.trigger_file_path)
uprn_filenames = read_dataframe_from_s3_parquet(
bucket_name=get_settings().DATA_BUCKET, file_key="spatial/filename_meta.parquet"
)
@ -126,6 +127,10 @@ async def trigger_plan(body: PlanTriggerRequest):
for p in input_properties:
# TODO: TEMP
if p.address1 == "The Hollies Farm House, Church Walk, Little Dalby":
continue
# Property recommendations
p.get_components(cleaned)

View file

@ -175,11 +175,20 @@ def create_recommendation_scoring_data(
scoring_dict["LOW_ENERGY_LIGHTING_ENDING"] = 100
scoring_dict["LIGHTING_ENERGY_EFF_STARTING"] = "Very Good"
if recommendation["type"] == "windows_glazing":
scoring_dict["MULTI_GLAZE_PROPORTION_ENDING"] = 100
scoring_dict["WINDOWS_ENERGY_EFF_ENDING"] = "Average"
if scoring_dict["glazing_type_ENDING"] == "multiple":
pass
else:
raise NotImplementedError("Implement me")
if recommendation["type"] not in [
"mechanical_ventilation", "sealing_open_fireplace", "low_energy_lighting",
"internal_wall_insulation", "external_wall_insulation", "cavity_wall_insulation",
"loft_insulation", "room_roof_insulation", "flat_roof_insulation",
"solid_floor_insulation", "suspended_floor_insulation", "exposed_floor_insulation"
"solid_floor_insulation", "suspended_floor_insulation", "exposed_floor_insulation",
"windows_glazing"
]:
raise NotImplementedError("Implement me")

View file

@ -6,6 +6,7 @@ from recommendations.RoofRecommendations import RoofRecommendations
from recommendations.VentilationRecommendations import VentilationRecommendations
from recommendations.FireplaceRecommendations import FireplaceRecommendations
from recommendations.LightingRecommendations import LightingRecommendations
from recommendations.WindowsRecommendations import WindowsRecommendations
from backend.ml_models.AnnualBillSavings import AnnualBillSavings
@ -35,6 +36,7 @@ class Recommendations:
)
self.fireplace_recommender = FireplaceRecommendations(property_instance=property_instance)
self.lighting_recommender = LightingRecommendations(property_instance=property_instance, materials=materials)
self.windows_recommender = WindowsRecommendations(property_instance=property_instance, materials=materials)
def recommend(self):
@ -77,6 +79,11 @@ class Recommendations:
if self.lighting_recommender.recommendation:
property_recommendations.append(self.lighting_recommender.recommendation)
# Windows recommendations
self.windows_recommender.recommend()
if self.windows_recommender.recommendation:
property_recommendations.append(self.windows_recommender.recommendation)
# We insert temporary ids into the recommendations which is important for the optimiser later
property_recommendations = self.insert_temp_recommendation_id(property_recommendations)

View file

@ -56,7 +56,7 @@ class WindowsRecommendations:
# We scale the number of windows based on the proportion of existing glazing
if self.property.data["multi-glaze-proportion"] != "":
n_windows_scalar = 1 - (self.property.data["multi-glaze-proportion"] / 100)
n_windows_scalar = 1 - (int(self.property.data["multi-glaze-proportion"]) / 100)
else:
n_windows_scalar = self.COVERAGE_MAP.get(self.property.windows["glazing_coverage"], 1)
@ -86,7 +86,7 @@ class WindowsRecommendations:
self.recommendation = [
{
"parts": [],
"type": "window_glazing",
"type": "windows_glazing",
"description": description,
"starting_u_value": None,
"new_u_value": None,