added detection of condition report

This commit is contained in:
Khalim Conn-Kowlessar 2024-10-28 17:16:27 +00:00
parent 1db4c4319e
commit 2a17831c72
2 changed files with 29 additions and 15 deletions

View file

@ -74,25 +74,26 @@ def main():
# The properties will still have "Very poor" ratings for their hot water
# TODO
# - AIH001-03 has a basement and so we should discount this area from the ground floor
# - AIH001-03 has a loft that is inaccessible - ask Chenai about why this property didn't have access to the loft
# [Can't remember, not clear - Chenai will check]
# - AIH001-03 instead of cylinder insulation, we could install an air source heat pump but it might not be the
# best option for this property due to it being extrememly large and the walls being uninsulated. It might not
# be performant enough in the winter, when COP will be more like 1.5.
# - AIH001-03 - can add additional 1.6kWp solar PV to flat roof to get close to EPC C. How many occupants are
# in the property? Does it make sense to have such a large solar PV system (5.6kWp)?
# - AIH001-04 why couldn't the cylinder be accessed? - treating this could get to the EPC C
# - Generally, should we consider insulated doors?
# - Potential measure - search for the cylinder and insulate it
# - AIH001-08 and AIH001-09, check if it's freehold - could solar work as both of these units are part of the same
# buulding
# - AIH001-09 - The extension is 1900-1929 but has a cavity wall
# - AIH001-09 - Is it not possible to install a loft hatch?
# - AIH001-09 - Why is there assumed secondary heating?
# buulding [Question for Lewis & Kevin]
# - AIH001-09 - Is it not possible to install a loft hatch? [IT IS NOT, NO ACCESS - would need to accessed from
# the other unit]
# - AIH001-09 - Why is there assumed secondary heating? [Question for Lewis & Kevin]
# - AIH001-09 - Is there definitely an immersion water heater? Is this definitely the case for the other units?
# - AIH001-11 - The layout of this unit is confusing, is there roof access?
# - AIH001-12 - Why was there not access to the cylinder?
# - AIH001-12 - Is the need to draught proofing due to the windows?
# - AIH001-04 - is the flat roof area correct?
# [Question for Lewis & Kevin]
# - AIH001-11 - The layout of this unit is confusing, is there roof access? [NO!!!! - It's a Sun room!!]
# - AIH001-12 - Why was there not access to the cylinder? [Sealed shut]
# - AIH001-12 - Is the need to draught proofing due to the windows? [This would be addressed by deailing with the
# windows]
recommended_measures = [
{
@ -113,7 +114,7 @@ def main():
},
{
"measure": "Solar PV",
"description": "4kWp Solar PV system",
"description": "5.6kWp Solar PV system",
"config": [
{
"size": "4kWp",
@ -497,6 +498,7 @@ def main():
{'item': '100mm flat roof insulation', 'unit_price': 195, 'unit': 'floor_m2'},
{'item': 'Switch to 24-hour tariff', 'unit_price': 0, 'unit': None},
{'item': '3.2kWp Solar PV system', 'unit_price': 3686, 'unit': 'unit_needs_scaffolding'},
{'item': '5.6kWp Solar PV system', 'unit_price': 5015, 'unit': 'unit_needs_scaffolding'},
{'item': 'Installation of double glazing', 'unit_price': 1074, 'unit': 'window'},
{'item': 'Ecoforest ecoAIR EVI 4-20 20kW air source heat pump', 'unit_price': 21189, 'unit': 'unit'},
{'item': '2kWp Solar PV system', 'unit_price': 3201, 'unit': 'unit_needs_scaffolding'},
@ -505,7 +507,7 @@ def main():
{'item': '4kWp Solar PV system', 'unit_price': 4009, 'unit': 'unit_needs_scaffolding'},
{'item': '300mm loft insulation', 'unit_price': 16.07, 'unit': 'floor_m2'},
{'item': 'Smart Thermostat', 'unit_price': 1200, 'unit': 'unit'},
{'item': '2x DMEV fans', 'unit_price': 1070, 'unit': 'unit'}
{'item': '2x DMEV fans', 'unit_price': 1070, 'unit': 'unit'},
]
pricing_data = pd.DataFrame(pricing_data)

View file

@ -126,7 +126,10 @@ def extract_retrofit_pdfs(data_folder_path):
for pdf_file in retrofit_files:
pdf_path = os.path.join(data_folder_path, pdf_file)
return detect_and_parse_report(pdf_path, pdf_file)
extracted = detect_and_parse_report(pdf_path, pdf_file)
if extracted is not None:
return extracted
continue
# If no relevant PDF is found, exit
return None
@ -165,10 +168,19 @@ def detect_and_parse_report(pdf_path, pdf_file):
elif "summary" in pdf_file.lower():
# Treat this as a Summary Report
return extract_summary_report(pdf_path)
elif is_condition_report(first_page_text):
return None
else:
raise NotImplementedError("Implement me")
def is_condition_report(text):
"""
Determines if the provided text indicates that the PDF is a Condition Report.
"""
return text.startswith("OsmosisACDNEWPAS2035ConditionReport")
def main():
"""
This code prepares the data for the Warm Homes: Social Housing Fund Wave 3, for Stonewater.
@ -191,7 +203,7 @@ def main():
if retrofit_folder:
retrofit_folder_path = os.path.join(survey_folder_path, retrofit_folder)
if os.listdir(retrofit_folder_path): # If not empty
summary_data = extract_retrofit_pdfs(retrofit_folder_path)
summary_data = extract_retrofit_pdfs(data_folder_path=retrofit_folder_path)
if summary_data:
summary_data = {
"survey_folder": survey_folder,
@ -204,7 +216,7 @@ def main():
continue
# If no retrofit folder or it was empty, check files in survey_folder
summary_data = extract_retrofit_pdfs(survey_folder_path)
summary_data = extract_retrofit_pdfs(data_folder_path=survey_folder_path)
if summary_data:
summary_data = {
"survey_folder": survey_folder,