From b63de79043b2b7a1e9498754621944315aaa76f7 Mon Sep 17 00:00:00 2001 From: Michael Duong Date: Wed, 3 Jul 2024 23:35:02 +0100 Subject: [PATCH] add cost to EPCRecord, Difference record and pipeline --- etl/epc/Pipeline.py | 4 +++- etl/epc/Record.py | 12 ++++++++++++ etl/epc/settings.py | 6 ++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/etl/epc/Pipeline.py b/etl/epc/Pipeline.py index 47cddeb0..bc3bfd91 100644 --- a/etl/epc/Pipeline.py +++ b/etl/epc/Pipeline.py @@ -22,6 +22,7 @@ from etl.epc.settings import ( EFFICIENCY_FEATURES, POTENTIAL_COLUMNS, ROOM_FEATURES, + COST_FEATURES, ) # TODO: change in setting file @@ -42,6 +43,7 @@ VARIABLE_DATA_FEATURES = ( # + POTENTIAL_COLUMNS + ["lodgement_date", RDSAP_RESPONSE, HEAT_DEMAND_RESPONSE, CARBON_RESPONSE] ) +COST_FEATURES = [x.lower() for x in COST_FEATURES] def get_cleaned_description_mapping(): @@ -278,7 +280,7 @@ class EPCPipeline: # We include the lodgement date here as we probably need to factor time into the # model, since EPC standards and rigour have changed over time - variable_data = property_data[VARIABLE_DATA_FEATURES] + variable_data = property_data[VARIABLE_DATA_FEATURES + COST_FEATURES] uprn = str(uprn) epc_records = [ diff --git a/etl/epc/Record.py b/etl/epc/Record.py index 9b69c33a..b8471ccf 100644 --- a/etl/epc/Record.py +++ b/etl/epc/Record.py @@ -76,6 +76,9 @@ class EPCRecord: mainheat_energy_eff: str = None mainheatc_energy_eff: str = None lighting_energy_eff: str = None + lighting_cost_current: float = None + heating_cost_current: float = None + hot_water_cost_current: float = None # potential_energy_efficiency: float = None # environment_impact_potential: float = None # energy_consumption_potential: float = None @@ -249,6 +252,9 @@ class EPCRecord: self.mainheat_energy_eff: str = self.prepared_epc["mainheat_energy_eff"] self.mainheatc_energy_eff: str = self.prepared_epc["mainheatc_energy_eff"] self.lighting_energy_eff: str = self.prepared_epc["lighting_energy_eff"] + self.lighting_cost_current: float = self.prepared_epc["lighting_cost_current"] + self.heating_cost_current: float = self.prepared_epc["heating_cost_current"] + self.hot_water_cost_current: float = self.prepared_epc["hot_water_cost_current"] # self.potential_energy_efficiency: float = float( # self.prepared_epc["potential_energy_efficiency"] # ) @@ -1044,6 +1050,12 @@ class EPCDifferenceRecord: "heat_demand_ending": self.record2.get(HEAT_DEMAND_RESPONSE), "carbon_starting": self.record1.get(CARBON_RESPONSE), "carbon_ending": self.record2.get(CARBON_RESPONSE), + "lighting_cost_starting": self.record1.get("lighting_cost_current"), + "lighting_cost_ending": self.record2.get("lighting_cost_current"), + "heating_cost_starting": self.record1.get("heating_cost_current"), + "heating_cost_ending": self.record2.get("heating_cost_current"), + "hot_water_cost_starting": self.record1.get("hot_water_cost_current"), + "hot_water_cost_ending": self.record2.get("hot_water_cost_current"), # "potential_energy_efficiency": self.earliest_record.get( # "potential_energy_efficiency" # ), diff --git a/etl/epc/settings.py b/etl/epc/settings.py index 18dbaa7c..a814750f 100644 --- a/etl/epc/settings.py +++ b/etl/epc/settings.py @@ -110,6 +110,12 @@ DEPLOYMENT_FOLDER = "deployment" TOTAL_FLOOR_AREA_NATIONAL_AVERAGE = 70 FLOOR_HEIGHT_NATIONAL_AVERAGE = 2.45 +COST_FEATURES = [ + "LIGHTING_COST_CURRENT", + "HEATING_COST_CURRENT", + "HOT_WATER_COST_CURRENT", +] + AVERAGE_FIXED_FEATURES = [ "TOTAL_FLOOR_AREA", "FLOOR_HEIGHT",