lighting fitting extraction from summary report

This commit is contained in:
Khalim Conn-Kowlessar 2024-10-30 14:17:20 +00:00
parent f97bb7f127
commit bccf3c621b

View file

@ -73,7 +73,10 @@ def extract_summary_report(pdf_path):
'Total Ground Floor Area (m2)': None,
'RIR Floor Area': None,
'Main Building Wall Area (m2)': None,
'First Extension Wall Area (m2)': None
'First Extension Wall Area (m2)': None,
"Number of Light Fittings": None,
"Number of LEL Fittings": None,
"Number of fittings needing LEL": None
}
with open(pdf_path, "rb") as file:
@ -198,6 +201,10 @@ def extract_summary_report(pdf_path):
dimensions = extract_building_parts_summary(text)
data.update(dimensions)
data["Number of Light Fittings"] = int(re.search(r"Total number of light fittings\s*(\d+)", text).group(1))
data["Number of LEL Fittings"] = int(re.search(r"Total number of L.E.L. fittings\s*(\d+)", text).group(1))
data["Number of fittings needing LEL"] = data["Number of Light Fittings"] - data["Number of LEL Fittings"]
return data
@ -771,8 +778,6 @@ def main():
extracted_data["Current SAP Rating"] = extracted_data["Current SAP Rating"].astype(int)
extracted_data["Current EPC Band"] = extracted_data["Current SAP Rating"].apply(sap_to_epc)
# TODO: RIR floor area!!!
# Remove some definite duplicates
dupes = extracted_data[extracted_data["Address"].duplicated()]["Address"]
dupes = extracted_data[extracted_data["Address"].isin(dupes)]