handled flats for the moment

This commit is contained in:
Khalim Conn-Kowlessar 2024-07-25 12:25:53 +01:00
parent 791e22146e
commit 9a343db93b

View file

@ -198,7 +198,6 @@ class XmlParser:
# This file type contains just limited information compared to a regular EPR/EPC, and so we just exit
# unless we learn something else that determines that we need information from this file
return
self.get_property_type()
self.get_sap()
self.get_property_address()
self.get_dates()
@ -225,9 +224,20 @@ class XmlParser:
self.extract_epc()
def extract_epc(self):
# Property Summary
low_energy_fixed_light_count = None
construction_age_band = None
property_type = self.get_property_type()
if property_type == "Flat":
raise NotImplementedError(
"Need to handle: heat-loss-corridor, unheated-corridor-length, flat-storey-count, flat-top-storey, "
"floor-level"
)
heat_loss_corridor = "NO DATA!"
unheated_corridor_length = ""
flat_storey_count = ""
flat_top_storey = ""
floor_level = "NO DATA!"
self.epc = {
"low-energy-fixed-light-count": self.get_node_value('Low-Energy-Fixed-Lighting-Outlets-Count'),
# TODO: Needs to be done more carefully
@ -269,10 +279,9 @@ class XmlParser:
"inspection-date": self.get_node_value('Inspection-Date'),
"mains-gas-flag": self.get_node_value('Mains-Gas'),
"co2-emiss-curr-per-floor-area": self.get_energy_assessment_value('CO2-Emissions-Current-Per-Floor-Area'),
# TODO: Not included in the xml for houses - need an example of flats
# "heat-loss-corridor": self.get_node_value('Heat-Loss-Perimeter'),
# TODO: Need an example of flats
# "flat-storey-count": self.get_node_value('Flat-Storey-Count'),
"heat-loss-corridor": heat_loss_corridor,
"unheated-corridor-length": unheated_corridor_length,
"flat-storey-count": flat_storey_count,
"roof-energy-eff": self.RATINGS_MAP[
self.get_property_summary_value('Roof', 'Energy-Efficiency-Rating')
],
@ -316,8 +325,7 @@ class XmlParser:
],
"multi-glaze-proportion": self.get_node_value('Multiple-Glazed-Proportion'),
"main-heating-controls": self.get_property_summary_value('Main-Heating-Controls', 'Description'),
# TODO: NEdd an example of flats
# "flat-top-storey": self.get_node_value('Flat-Top-Storey'),
"flat-top-storey": flat_top_storey,
"secondheat-description": self.get_property_summary_value('Secondary-Heating', 'Description'),
"walls-env-eff": self.RATINGS_MAP[
self.get_property_summary_value('Wall', 'Environmental-Efficiency-Rating')
@ -330,8 +338,7 @@ class XmlParser:
"lmk-key": "", # Doesn't exist for non-EPC xmls
"wind-turbines-count": self.get_node_value('Wind-Turbines-Count'),
"tenure": self.TENURE_MAP[self.get_node_value('Tenure')],
# TODO: Need an example of flats
# "floor-level": self.get_node_value('Floor-Level'),
"floor-level": floor_level,
"potential-energy-efficiency": self.get_energy_assessment_value('Energy-Rating-Potential'),
"hot-water-energy-eff": self.RATINGS_MAP[
self.get_property_summary_value('Hot-Water', 'Energy-Efficiency-Rating')
@ -397,7 +404,7 @@ class XmlParser:
if not property_type:
property_type = self.xml.getElementsByTagName('PropertyType1')
self.property_type = PROPERTY_TYPE_LOOKUP[property_type[0].firstChild.nodeValue]
return PROPERTY_TYPE_LOOKUP[property_type[0].firstChild.nodeValue]
def get_sap(self):
sap_score = self.xml.getElementsByTagName('Energy-Rating-Current')