From 867f086e1e487a860bc84f6cff96fdcad9fc6d40 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Tue, 17 Jun 2025 10:30:59 +0000 Subject: [PATCH] condition report saved --- etl/pdfReader/sitenotes.py | 51 ++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 11 deletions(-) diff --git a/etl/pdfReader/sitenotes.py b/etl/pdfReader/sitenotes.py index d3d74f8..568d0e6 100644 --- a/etl/pdfReader/sitenotes.py +++ b/etl/pdfReader/sitenotes.py @@ -14,7 +14,8 @@ from etl.transform.conditionReportTypes import ( ExternalElevationGableOne, ExternalElevationGableTwo, ExternalElevationRear, ConservatoryOrOutbuilding, AccessAndElevations, Hallway, RoomInfo, WindowsInfo, VentilationInfo, LivingRoom, DiningRoom, Kitchen, Rooms, Utility, WC, Landing, Bedroom, Bathroom, LoftSpace, RoomInRoof, HeatingSystem, GeneralConditionHeatingSystem, - MainHeatingOne, MainHeatingTwo, SecondaryHeating, HeatingByRoom, Renewables, Occupant, EnergyUse, Heating, ShowerAndBath, FridgeAndFreezers, Cooker, TumbleDryer + MainHeatingOne, MainHeatingTwo, SecondaryHeating, HeatingByRoom, Renewables, Occupant, EnergyUse, Heating, ShowerAndBath, FridgeAndFreezers, Cooker, TumbleDryer, + GeneralInformation, OccupantAssessment ) from datetime import datetime from pprint import pprint @@ -92,25 +93,29 @@ class ConditionReport(SiteNotesExtractor): def __init__(self, data_list): super().__init__(data_list) self.type = ReportType.OSMOSIS_CONDITION_PAS_2035_REPORT - self.setup_condition_report() + _ = self.setup_condition_report() + pprint(_) def setup_condition_report(self): - assesor_details, inspection_and_project, the_property, main_elevation, elevations = self.get_section_1() + general_information = self.get_section_1() access_and_elevations = self.get_section_2() rooms = self.get_section_3() - general_condition_of_heating_system, main_heating_one, main_heating_two, secondary_heating, heating_by_room, renewables = self.get_section_4() - occupants, energy_use, heating, shower_and_bath, appliances, fridge_and_freezers, cooker, tumble_dryer = self.get_section_5() + heating_system = self.get_section_4() + occupant_assessment = self.get_section_5() site_name, reference_code, address, postcode = self.get_section_0() + return ConditionReportModel( project_site_name=site_name, property_reference_code=reference_code, property_address=address, postcode=postcode, - - + general_information=general_information, + access_and_elevations=access_and_elevations, + rooms=rooms, + heating_system=heating_system, + occupancy_assessment=occupant_assessment, ) - def get_section_0(self): data = self.get_data_between("Project Site Name", "1. General Information") site_name = self.get_next_value(data, "Project Site Name") @@ -127,7 +132,14 @@ class ConditionReport(SiteNotesExtractor): the_property = self.get_the_property() main_elevation = self.get_main_elevation() elevations = self.get_all_elevations() - return assessor_details, inspection_and_project, the_property, main_elevation, elevations + + return GeneralInformation( + assessor_details=assessor_details, + inspection_and_project=inspection_and_project, + the_property=the_property, + main_elevation=main_elevation, + elevations=elevations + ) def get_assessor_details(self): data = self.get_data_between("1.1 Assessor details","1.2 Inspection & Project") @@ -501,7 +513,15 @@ class ConditionReport(SiteNotesExtractor): secondary_heating = self.get_secondary_heating() heating_by_room = self.get_heating_by_room() renewables = self.get_renewables() - return general_condition_of_heating_system, main_heating_one, main_heating_two, secondary_heating, heating_by_room, renewables + + return HeatingSystem( + general_condition=general_condition_of_heating_system, + main_heating_one=main_heating_one, + main_heating_two=main_heating_two, + secondary_heating=secondary_heating, + heating_by_room=heating_by_room, + renewables=renewables + ) def get_main_heating_one(self): data = self.get_data_between("Main Heating 1", "Main Heating 2") @@ -589,7 +609,16 @@ class ConditionReport(SiteNotesExtractor): fridge_and_freezers = self.get_fridge_and_freezers() cooker = self.get_cooker() tumble_dryer = self.get_tumble_dryer() - return occupants, energy_use, heating, shower_and_bath, appliances, fridge_and_freezers, cooker, tumble_dryer + return OccupantAssessment( + occupant=occupants, + energy_use=energy_use, + heating=heating, + shower_and_bath=shower_and_bath, + appliances=appliances, + fridge_and_freezers=fridge_and_freezers, + cooker=cooker, + tumble_dryer=tumble_dryer + ) def get_occupants(self): data = self.get_data_between("Occupants", "Energy use")