From c8c3ab9379b83df7018ccdd92e496f387f0f81b1 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Tue, 17 Jun 2025 09:39:35 +0000 Subject: [PATCH] merge this to main --- etl/dimitra_hubspot_notes_gather.py | 6 ++---- etl/pdfReader/sitenotes.py | 23 ++++++++++------------- etl/transform/conditionReportTypes.py | 2 +- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/etl/dimitra_hubspot_notes_gather.py b/etl/dimitra_hubspot_notes_gather.py index ec364e0..6d1dcc7 100644 --- a/etl/dimitra_hubspot_notes_gather.py +++ b/etl/dimitra_hubspot_notes_gather.py @@ -157,10 +157,8 @@ for pipeline, deals in notes_data.items(): # Generate file name with next Monday’s date -days_ahead = (7 - today.weekday()) % 7 -days_ahead = 7 if days_ahead == 0 else days_ahead -next_monday = today + timedelta(days=days_ahead) -formatted = next_monday.strftime("%d-%m-%Y Monday") +monday = previous_monday() +formatted = monday.strftime("%d-%m-%Y Monday") file_name = f"{formatted} DEAL_NOTES_FROM_HUBSPOT.xlsx" output_path = os.path.abspath(file_name) wb.save(output_path) diff --git a/etl/pdfReader/sitenotes.py b/etl/pdfReader/sitenotes.py index 1c9f532..d3d74f8 100644 --- a/etl/pdfReader/sitenotes.py +++ b/etl/pdfReader/sitenotes.py @@ -9,7 +9,7 @@ from etl.transform.preSiteNoteTypes import ( HeatingType, Insulation ) from etl.transform.conditionReportTypes import ( - ConditionReport, AssessorDetails, InspectionAndProject, TheProperty, + ConditionReportModel, AssessorDetails, InspectionAndProject, TheProperty, MainElevation, Elevation, ElevationInfo, PropertyAccess, ExternalElevation, ExternalElevationFront, ExternalElevationGableOne, ExternalElevationGableTwo, ExternalElevationRear, ConservatoryOrOutbuilding, AccessAndElevations, Hallway, RoomInfo, WindowsInfo, VentilationInfo, LivingRoom, DiningRoom, Kitchen, Rooms, @@ -92,27 +92,24 @@ class ConditionReport(SiteNotesExtractor): def __init__(self, data_list): super().__init__(data_list) self.type = ReportType.OSMOSIS_CONDITION_PAS_2035_REPORT - self.setup() + self.setup_condition_report() - def setup(self): + def setup_condition_report(self): assesor_details, inspection_and_project, the_property, main_elevation, elevations = 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() site_name, reference_code, address, postcode = self.get_section_0() - - # TODO: Complete this function - self.make_condition_report_object( - assesor_details, - inspection_and_project, - the_property, - main_elevation, - elevations, - access_and_elevations, - rooms, + return ConditionReportModel( + project_site_name=site_name, + property_reference_code=reference_code, + property_address=address, + postcode=postcode, + ) + def get_section_0(self): data = self.get_data_between("Project Site Name", "1. General Information") diff --git a/etl/transform/conditionReportTypes.py b/etl/transform/conditionReportTypes.py index f51e575..e2c6c55 100644 --- a/etl/transform/conditionReportTypes.py +++ b/etl/transform/conditionReportTypes.py @@ -272,7 +272,7 @@ class OccupantAssessment(BaseModel): tumble_dryer: TumbleDryer -class ConditionReport(BaseModel): +class ConditionReportModel(BaseModel): project_site_name: str property_reference_code: str property_address: str