extracting bills

This commit is contained in:
Khalim Conn-Kowlessar 2025-01-30 00:54:56 +00:00
parent b4296db52d
commit 32b053e7db

View file

@ -89,11 +89,23 @@ class SiteNotesExtractor:
"heat_loss_area": sum([part["Heat Loss Area (m2)"] for part in building_parts]),
}
def extract_bills_estimate(self):
"""
Extracts the estimated annual energy costs (£) from the report.
"""
pattern = re.search(r"Current annual energy costs £\s*([\d,.]+)", self.text)
if not pattern:
raise ValueError("No bills estimate found in the report")
self.data["Estimated Annual Energy Cost (£)"] = float(pattern.group(1).replace(",", ""))
def extract_all(self):
"""
Runs all extraction methods and returns a dictionary with extracted data.
"""
self.extract_sap_rating()
self.extract_carbon_emissions()
self.extract_bills_estimate()
self.extract_building_dimensions()
return self.data