extract lighting fittings from epr

This commit is contained in:
Khalim Conn-Kowlessar 2024-10-30 14:14:40 +00:00
parent d0cf88af64
commit f97bb7f127

View file

@ -461,7 +461,10 @@ def extract_epr(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:
@ -573,6 +576,13 @@ def extract_epr(pdf_path):
building_parts = extract_building_parts_epr(text)
data.update(building_parts)
# Get number of lighting outlets and number of fittings needing LEL
lighting_fittings_match = re.search(r"Total number of light fittings\s*(\d+)", text)
data["Number of Light Fittings"] = int(lighting_fittings_match.group(1))
lel_fittings_match = re.search(r"Total number of L.E.L. fittings\s*(\d+)", text)
data["Number of LEL Fittings"] = int(lel_fittings_match.group(1))
data["Number of fittings needing LEL"] = data["Number of Light Fittings"] - data["Number of LEL Fittings"]
return data