extend to get dimensions from 2nd floor

This commit is contained in:
Khalim Conn-Kowlessar 2024-10-29 17:31:23 +00:00
parent 98ae672a61
commit d8e8b997a4

View file

@ -149,7 +149,8 @@ def extract_summary_report(pdf_path):
if data["Existing Secondary Heating System"] == "":
data["Secondary Heating Code"] = ""
else:
data["Secondary Heating Code"] = secondary_heating_code_match.group(1).strip()
data["Secondary Heating Code"] = secondary_heating_code_match.group(
1).strip() if secondary_heating_code_match else ""
data["Water Heating Code"] = water_heating_code_match.group(1).strip()
@ -236,7 +237,7 @@ def extract_building_parts_epr(text):
# Pattern to match each floor's measurements
floor_pattern = re.compile(
r"(Lowest floor|First floor)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)"
r"(Lowest floor|First floor|Second floor)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)"
)
# Extract floor details for each building part
@ -305,7 +306,7 @@ def extract_building_parts_summary(text):
# Pattern to extract floor details: Floor Level, Floor Area, Room Height, Perimeter, Party Wall Length
floor_pattern = re.compile(
r"(1st Floor|Lowest Floor):\s*([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)"
r"(1st Floor|Lowest Floor|Second floor):\s*([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)"
)
# Extract data for each floor within the building part
@ -634,6 +635,7 @@ def main():
extracted_data.append(summary_data)
extracted_data = pd.DataFrame(extracted_data)
# Save this as a csv
# extracted_data.to_csv("Wave 3 Summary Data - first 200 files.csv", index=False)