diff --git a/backend/app/db/models/materials.py b/backend/app/db/models/materials.py index 9f8abbf4..617ea0ac 100644 --- a/backend/app/db/models/materials.py +++ b/backend/app/db/models/materials.py @@ -38,12 +38,27 @@ class MaterialType(enum.Enum): flat_roof_preparation = "flat_roof_preparation" flat_roof_vapour_barrier = "flat_roof_vapour_barrier" flat_roof_waterproofing = "flat_roof_waterproofing" + trickle_vent = "trickle_vent" + door_undercut = "door_undercut" + solar_pv = "solar_pv" + solar_battery = "solar_battery" + scaffolding = "scaffolding" + high_heat_retention_storage_heaters = "high_heat_retention_storage_heaters" + sealing_fireplace = "sealing_fireplace" class DepthUnit(enum.Enum): mm = "mm" +class SizeUnit(enum.Enum): + # ["kWp", "kW", "watt", "storey"] + kWp = "kWp" + kW = "kW" + watt = "watt" + storey = "storey" + + class CostUnit(enum.Enum): gbp_sq_meter = "gbp_sq_meter" gbp_per_unit = "gbp_per_unit" @@ -90,3 +105,11 @@ class Material(Base): total_cost = Column(Float) notes = Column(String) is_installer_quote = Column(Boolean, nullable=False, default=False) + innovation_rate = Column(Float, default=0.0) + size = Column(Float) + size_unit = Column( + Enum(SizeUnit, values_callable=lambda x: [e.value for e in x]), nullable=True + ) + includes_scaffolding = Column(Boolean, default=False) + includes_battery = Column(Boolean, default=False) + battery_size = Column(Float) diff --git a/etl/costs/app.py b/etl/costs/app.py index f2bf365b..03c1813d 100644 --- a/etl/costs/app.py +++ b/etl/costs/app.py @@ -11,7 +11,7 @@ import inspect src_file_path = inspect.getfile(lambda: None) -DATA_DIRECTORY = Path(src_file_path).parent / "local_data" / "20250316 Domna Materials.xlsx" +DATA_DIRECTORY = Path(src_file_path).parent / "local_data" / "20250815 Domna Materials.xlsx" # Environment file is at the same level as this file ENV_FILE = Path(src_file_path).parent / "etl" / "costs" / ".env" dotenv.load_dotenv(ENV_FILE) @@ -92,6 +92,10 @@ def app(): flat_roof_costs = pd.read_excel(DATA_DIRECTORY, sheet_name="flat_roof_insulation", header=0) window_costs = pd.read_excel(DATA_DIRECTORY, sheet_name="window_glazing", header=0) rir_insulation_costs = pd.read_excel(DATA_DIRECTORY, sheet_name="room_roof_insulation", header=0) + solar_pv = pd.read_excel(DATA_DIRECTORY, sheet_name="solar_pv", header=0) + hhrsh = pd.read_excel(DATA_DIRECTORY, sheet_name="hhrsh", header=0) + scaffolding = pd.read_excel(DATA_DIRECTORY, sheet_name="scaffolding", header=0) + fireplaces = pd.read_excel(DATA_DIRECTORY, sheet_name="fireplaces", header=0) # Form a single table to be uploaded costs = pd.concat( @@ -107,6 +111,10 @@ def app(): flat_roof_costs, window_costs, rir_insulation_costs, + solar_pv, + hhrsh, + scaffolding, + fireplaces ] ) diff --git a/recommendations/WallRecommendations.py b/recommendations/WallRecommendations.py index 3a2815bc..78ed8072 100644 --- a/recommendations/WallRecommendations.py +++ b/recommendations/WallRecommendations.py @@ -142,46 +142,6 @@ class WallRecommendations(Definitions): return True - def mds_recommend_cavity_wall_insulation(self, phase=None): - # Function specifically for cavity wall insulation, for usage in the mds report - self.recommendations = [] - insulation_thickness = self.property.walls["insulation_thickness"] - - u_value = get_wall_u_value( - clean_description=self.property.walls["clean_description"], - age_band=self.property.age_band, - is_granite_or_whinstone=self.property.walls["is_granite_or_whinstone"], - is_sandstone_or_limestone=self.property.walls["is_sandstone_or_limestone"], - ) - - # Test filling cavity - self.find_cavity_insulation(u_value, insulation_thickness, phase, measures) - - return self.recommendations - - def mds_recommend_ewi(self, phase=None): - # Function specifically for external wall insulation, for usage in the mds report - self.recommendations = [] - - u_value = self.property.walls["thermal_transmittance"] - - if u_value is None: - u_value = get_wall_u_value( - clean_description=self.property.walls["clean_description"], - age_band=self.property.age_band, - is_granite_or_whinstone=self.property.walls["is_granite_or_whinstone"], - is_sandstone_or_limestone=self.property.walls["is_sandstone_or_limestone"], - ) - - # EWI - ewi_recommendations = self._find_insulation( - u_value=u_value, - insulation_materials=pd.DataFrame(self.external_wall_insulation_materials), - phase=phase - ) - - return ewi_recommendations - def recommend(self, phase=0, measures=None, default_u_values=False): # if building built after 1990 + we're able to identify U-value + # U-value less than 0.18 and if in or close to a conversation area, @@ -478,7 +438,8 @@ class WallRecommendations(Definitions): "walls-energy-eff": "Good" }, **cost_result, - "survey": non_invasive_recommendations.get("survey", False) + "survey": non_invasive_recommendations.get("survey", False), + "innovation_rate": material.to_dict()["innovation_rate"] } ) @@ -658,7 +619,8 @@ class WallRecommendations(Definitions): "walls-energy-eff": simulation_config["walls_energy_eff_ending"] }, **cost_result, - "survey": survey + "survey": survey, + "innovation_rate": material.to_dict()["innovation_rate"] } )