removed basic attributes that are in the epc

This commit is contained in:
Khalim Conn-Kowlessar 2024-07-25 12:50:13 +01:00
parent d3e7c60009
commit a32f479e10

View file

@ -205,13 +205,6 @@ class XmlParser:
self.get_detailed_heating_specs()
# Building fabric
self.get_walls()
self.get_roof()
self.get_floor()
self.get_windows()
self.get_heating()
self.get_hot_water()
self.get_lighting()
self.get_doors()
# Property dimensions
@ -472,159 +465,6 @@ class XmlParser:
self.heating_system = heating_system
self.heating_controls = heating_controls
def get_walls(self):
wall_xml_data = self.xml.getElementsByTagName('Property-Summary')[0].getElementsByTagName('Wall')[0]
self.walls_description = (
wall_xml_data
.getElementsByTagName("Description")[0]
.firstChild.nodeValue
)
self.walls_energy_rating = (
wall_xml_data
.getElementsByTagName("Energy-Efficiency-Rating")[0]
.firstChild.nodeValue
)
is_cavity = "cavity wall" in self.walls_description.lower()
is_empty = "no insulation" in self.walls_description.lower()
is_partial = "partial insulation" in self.walls_description.lower()
if not is_cavity:
self.walls_classification = "NON CAVITY"
return
if is_empty:
self.walls_classification = "EMPTY"
return
if is_partial:
self.walls_classification = "PARTIAL"
return
if is_cavity and not is_empty and not is_partial:
self.walls_classification = "FULL"
return
raise NotImplementedError("Implement me")
def get_roof(self):
room_xml_data = self.xml.getElementsByTagName('Property-Summary')[0].getElementsByTagName('Roof')[0]
self.roof_description = (
room_xml_data
.getElementsByTagName("Description")[0]
.firstChild.nodeValue
)
self.roof_energy_rating = (
room_xml_data
.getElementsByTagName("Energy-Efficiency-Rating")[0]
.firstChild.nodeValue
)
loft_recommendation_tag = self.xml.getElementsByTagName("Impact-Of-Loft-Insulation")
description_contains_loft = "loft" in self.roof_description.lower()
if not loft_recommendation_tag and not description_contains_loft:
self.is_loft = "No"
return
self.is_loft = "Yes"
return
def get_floor(self):
floor_xml_data = self.xml.getElementsByTagName('Property-Summary')[0].getElementsByTagName('Floor')[0]
self.floor_description = (
floor_xml_data
.getElementsByTagName("Description")[0]
.firstChild.nodeValue
)
self.floor_energy_rating = (
floor_xml_data
.getElementsByTagName("Energy-Efficiency-Rating")[0]
.firstChild.nodeValue
)
def get_windows(self):
windows_xml_data = self.xml.getElementsByTagName('Property-Summary')[0].getElementsByTagName('Window')[0]
self.windows_description = (
windows_xml_data
.getElementsByTagName("Description")[0]
.firstChild.nodeValue
)
self.windows_energy_rating = (
windows_xml_data
.getElementsByTagName("Energy-Efficiency-Rating")[0]
.firstChild.nodeValue
)
def get_heating(self):
"""
This function will retrieve the main heating and the main heating controls
:return:
"""
mainheating_xml_data = self.xml.getElementsByTagName('Main-Heating')[0]
self.main_heating_description = (
mainheating_xml_data.getElementsByTagName('Description')[0].firstChild.nodeValue
)
self.main_heating_energy_rating = (
mainheating_xml_data.getElementsByTagName('Energy-Efficiency-Rating')[0].firstChild.nodeValue
)
mainheating_controls_xml_data = self.xml.getElementsByTagName('Main-Heating-Controls')[0]
self.main_heating_controls_description = (
mainheating_controls_xml_data.getElementsByTagName('Description')[0].firstChild.nodeValue
)
self.main_heating_controls_energy_rating = (
mainheating_controls_xml_data.getElementsByTagName('Energy-Efficiency-Rating')[0].firstChild.nodeValue
)
second_heating_xml_data = self.xml.getElementsByTagName('Secondary-Heating')[0]
self.second_heating_description = (
second_heating_xml_data.getElementsByTagName('Description')[0].firstChild.nodeValue
)
self.second_heating_energy_rating = (
second_heating_xml_data.getElementsByTagName('Energy-Efficiency-Rating')[0].firstChild.nodeValue
)
def get_hot_water(self):
hot_water_xml_data = self.xml.getElementsByTagName('Hot-Water')[0]
self.hot_water_description = (
hot_water_xml_data.getElementsByTagName('Description')[0].firstChild.nodeValue
)
self.hot_water_energy_rating = (
hot_water_xml_data.getElementsByTagName('Energy-Efficiency-Rating')[0].firstChild.nodeValue
)
def get_lighting(self):
lighting_xml_data = self.xml.getElementsByTagName('Lighting')[0]
self.lighting_description = (
lighting_xml_data.getElementsByTagName('Description')[0].firstChild.nodeValue
)
self.lighting_energy_rating = (
lighting_xml_data.getElementsByTagName('Energy-Efficiency-Rating')[0].firstChild.nodeValue
)
def get_doors(self):
# Doors can be found in the SAP-Property-Details tag