From 32b053e7db3b08445b1649d6c418f33c5b235647 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 30 Jan 2025 00:54:56 +0000 Subject: [PATCH] extracting bills --- survey_report/extraction/quidos.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/survey_report/extraction/quidos.py b/survey_report/extraction/quidos.py index f11ffcb1..ae66dd0d 100644 --- a/survey_report/extraction/quidos.py +++ b/survey_report/extraction/quidos.py @@ -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