diff --git a/.idea/Model.iml b/.idea/Model.iml
index 4413bb06..b0f9c00d 100644
--- a/.idea/Model.iml
+++ b/.idea/Model.iml
@@ -7,7 +7,7 @@
-
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 6f308057..1122b380 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,7 +3,7 @@
-
+
diff --git a/backend/Property.py b/backend/Property.py
index 736ab4f1..ee496552 100644
--- a/backend/Property.py
+++ b/backend/Property.py
@@ -88,6 +88,7 @@ class Property(Definitions):
}
self.solar_hot_water = {
"solar_hot_water": epc_record.get("solar_water_heating_flag"),
+ "solar_hot_water_boolean": epc_record.get("solar_water_heating_flag_bool"),
}
self.wind_turbine = {
"wind_turbine": epc_record.prepared_epc["wind_turbine_count"],
@@ -104,6 +105,7 @@ class Property(Definitions):
self.heat_loss_corridor = {
"heat_loss_corridor": epc_record.prepared_epc["heat_loss_corridor"],
"length": epc_record.prepared_epc["unheated_corridor_length"],
+ "heat_loss_corridor_boolean": epc_record.get("heat_loss_corridor_bool"),
}
self.mains_gas = epc_record.prepared_epc['mains_gas_flag']
self.floor_height = epc_record.prepared_epc['floor_height']
@@ -436,10 +438,10 @@ class Property(Definitions):
"mainfuel": self.main_fuel["clean_description"],
"ventilation": self.ventilation["ventilation"],
"solar_pv": self.solar_pv["solar_pv"],
- "solar_hot_water": self.solar_hot_water["solar_hot_water"],
+ "solar_hot_water": self.solar_hot_water["solar_hot_water_boolean"],
"wind_turbine": self.wind_turbine["wind_turbine"],
"floor_height": self.floor_height,
- "heat_loss_corridor": self.heat_loss_corridor["heat_loss_corridor"],
+ "heat_loss_corridor": self.heat_loss_corridor["heat_loss_corridor_boolean"],
"unheated_corridor_length": self.heat_loss_corridor["length"],
"number_of_open_fireplaces": self.number_of_open_fireplaces["number_of_open_fireplaces"],
"number_of_extensions": self.number_of_extensions["number_of_extensions"],
diff --git a/etl/epc/Record.py b/etl/epc/Record.py
index 1c6d694d..6fb4d5d9 100644
--- a/etl/epc/Record.py
+++ b/etl/epc/Record.py
@@ -102,6 +102,8 @@ class EPCRecord:
year_built: int = None
number_of_floors: int = None
number_of_open_fireplaces: int = None
+ heat_loss_corridor_bool: bool = None
+ solar_water_heating_flag_bool: bool = None
def __post_init__(self):
# We can have validation and cleaning steps for each of the fields
@@ -490,6 +492,12 @@ class EPCRecord:
"heated corridor"
]
+ boolean_map = {
+ "no corridor": False,
+ "unheated corridor": True,
+ "heated corridor": False
+ }
+
self.prepared_epc["heat-loss-corridor"] = (
"no corridor" if self.prepared_epc["heat-loss-corridor"] in DATA_ANOMALY_MATCHES else
self.prepared_epc["heat-loss-corridor"]
@@ -502,6 +510,9 @@ class EPCRecord:
self.prepared_epc["unheated-corridor-length"] not in ["", None] else None
)
+ # We create boolean versions of heat-loss-corridor
+ self.heat_loss_corridor_bool = boolean_map[self.prepared_epc["heat-loss-corridor"]]
+
def _clean_count_variables(self):
"""
This method will clean the count variables, if empty or invalid
@@ -555,8 +566,16 @@ class EPCRecord:
None: "N"
}
+ boolean_map = {
+ "Y": True,
+ "N": False,
+ }
+
self.prepared_epc['solar-water-heating-flag'] = value_map[self.prepared_epc['solar-water-heating-flag']]
+ # Create a boolean version for storage in the database
+ self.solar_water_heating_flag_bool = boolean_map[self.prepared_epc['solar-water-heating-flag']]
+
def _clean_solar_pv(self):
"""
This method will clean the solar pv, if empty or invalid
diff --git a/recommendations/tests/test_data/wall_uvalue_test_cases.py b/recommendations/tests/test_data/wall_uvalue_test_cases.py
index e0c6ebe3..87f1ad3f 100644
--- a/recommendations/tests/test_data/wall_uvalue_test_cases.py
+++ b/recommendations/tests/test_data/wall_uvalue_test_cases.py
@@ -76,5 +76,33 @@ wall_uvalue_test_cases = [
"is_granite_or_whinstone": False,
"is_sandstone_or_limestone": False,
"uvalue": 0
+ },
+ {
+ "clean_description": "Cavity wall, as built, insulated",
+ "age_band": "F",
+ "is_granite_or_whinstone": False,
+ "is_sandstone_or_limestone": False,
+ "uvalue": 0.4
+ },
+ {
+ "clean_description": "Cavity wall, as built, insulated",
+ "age_band": "D",
+ "is_granite_or_whinstone": False,
+ "is_sandstone_or_limestone": False,
+ "uvalue": 0.7
+ },
+ {
+ "clean_description": "Cavity wall, filled cavity",
+ "age_band": "E",
+ "is_granite_or_whinstone": False,
+ "is_sandstone_or_limestone": False,
+ "uvalue": 0.7
+ },
+ {
+ "clean_description": "Cavity wall, as built, no insulation",
+ "age_band": "E",
+ "is_granite_or_whinstone": False,
+ "is_sandstone_or_limestone": False,
+ "uvalue": 1.5
}
]