Added more wall u-value tests

This commit is contained in:
Khalim Conn-Kowlessar 2024-01-19 16:51:49 +00:00
parent 807e6d5047
commit 24709b98d6
5 changed files with 53 additions and 4 deletions

2
.idea/Model.iml generated
View file

@ -7,7 +7,7 @@
<sourceFolder url="file://$MODULE_DIR$/open_uprn" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/open_uprn" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/recommendations" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/recommendations" isTestSource="false" />
</content> </content>
<orderEntry type="jdk" jdkName="Python 3.10 (backend)" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.10 (model_data)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
<component name="PyNamespacePackagesService"> <component name="PyNamespacePackagesService">

2
.idea/misc.xml generated
View file

@ -3,7 +3,7 @@
<component name="Black"> <component name="Black">
<option name="sdkName" value="Python 3.10 (backend)" /> <option name="sdkName" value="Python 3.10 (backend)" />
</component> </component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (backend)" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (model_data)" project-jdk-type="Python SDK" />
<component name="PythonCompatibilityInspectionAdvertiser"> <component name="PythonCompatibilityInspectionAdvertiser">
<option name="version" value="3" /> <option name="version" value="3" />
</component> </component>

View file

@ -88,6 +88,7 @@ class Property(Definitions):
} }
self.solar_hot_water = { self.solar_hot_water = {
"solar_hot_water": epc_record.get("solar_water_heating_flag"), "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 = { self.wind_turbine = {
"wind_turbine": epc_record.prepared_epc["wind_turbine_count"], "wind_turbine": epc_record.prepared_epc["wind_turbine_count"],
@ -104,6 +105,7 @@ class Property(Definitions):
self.heat_loss_corridor = { self.heat_loss_corridor = {
"heat_loss_corridor": epc_record.prepared_epc["heat_loss_corridor"], "heat_loss_corridor": epc_record.prepared_epc["heat_loss_corridor"],
"length": epc_record.prepared_epc["unheated_corridor_length"], "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.mains_gas = epc_record.prepared_epc['mains_gas_flag']
self.floor_height = epc_record.prepared_epc['floor_height'] self.floor_height = epc_record.prepared_epc['floor_height']
@ -436,10 +438,10 @@ class Property(Definitions):
"mainfuel": self.main_fuel["clean_description"], "mainfuel": self.main_fuel["clean_description"],
"ventilation": self.ventilation["ventilation"], "ventilation": self.ventilation["ventilation"],
"solar_pv": self.solar_pv["solar_pv"], "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"], "wind_turbine": self.wind_turbine["wind_turbine"],
"floor_height": self.floor_height, "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"], "unheated_corridor_length": self.heat_loss_corridor["length"],
"number_of_open_fireplaces": self.number_of_open_fireplaces["number_of_open_fireplaces"], "number_of_open_fireplaces": self.number_of_open_fireplaces["number_of_open_fireplaces"],
"number_of_extensions": self.number_of_extensions["number_of_extensions"], "number_of_extensions": self.number_of_extensions["number_of_extensions"],

View file

@ -102,6 +102,8 @@ class EPCRecord:
year_built: int = None year_built: int = None
number_of_floors: int = None number_of_floors: int = None
number_of_open_fireplaces: 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): def __post_init__(self):
# We can have validation and cleaning steps for each of the fields # We can have validation and cleaning steps for each of the fields
@ -490,6 +492,12 @@ class EPCRecord:
"heated corridor" "heated corridor"
] ]
boolean_map = {
"no corridor": False,
"unheated corridor": True,
"heated corridor": False
}
self.prepared_epc["heat-loss-corridor"] = ( self.prepared_epc["heat-loss-corridor"] = (
"no corridor" if self.prepared_epc["heat-loss-corridor"] in DATA_ANOMALY_MATCHES else "no corridor" if self.prepared_epc["heat-loss-corridor"] in DATA_ANOMALY_MATCHES else
self.prepared_epc["heat-loss-corridor"] self.prepared_epc["heat-loss-corridor"]
@ -502,6 +510,9 @@ class EPCRecord:
self.prepared_epc["unheated-corridor-length"] not in ["", None] else None 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): def _clean_count_variables(self):
""" """
This method will clean the count variables, if empty or invalid This method will clean the count variables, if empty or invalid
@ -555,8 +566,16 @@ class EPCRecord:
None: "N" None: "N"
} }
boolean_map = {
"Y": True,
"N": False,
}
self.prepared_epc['solar-water-heating-flag'] = value_map[self.prepared_epc['solar-water-heating-flag']] 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): def _clean_solar_pv(self):
""" """
This method will clean the solar pv, if empty or invalid This method will clean the solar pv, if empty or invalid

View file

@ -76,5 +76,33 @@ wall_uvalue_test_cases = [
"is_granite_or_whinstone": False, "is_granite_or_whinstone": False,
"is_sandstone_or_limestone": False, "is_sandstone_or_limestone": False,
"uvalue": 0 "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
} }
] ]