From bb9fd5880da3da6703a165cf99df4daa0749593c Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Wed, 4 Jun 2025 13:29:46 +0000 Subject: [PATCH] lstrip --- etl/pdfReader/sitenotes.py | 2 +- etl/transform/conditionReportTypes.py | 272 +++++--------------------- 2 files changed, 50 insertions(+), 224 deletions(-) diff --git a/etl/pdfReader/sitenotes.py b/etl/pdfReader/sitenotes.py index 3995248..2e5232e 100644 --- a/etl/pdfReader/sitenotes.py +++ b/etl/pdfReader/sitenotes.py @@ -143,7 +143,7 @@ class QuidosSiteNotesExtractor(SiteNotesExtractor): self.survey_information = PreSiteNotesSummaryInfo( reference_number = get_value('Reference Number'), epc_language = get_value('EPC Language'), - uprn = get_value('UPRN'), + uprn = get_value('UPRN').lstrip('0'), postcode = get_value('Postcode'), region = get_value('Region'), address = ','.join(get_value('Address').split(',')[:-1]).strip(), diff --git a/etl/transform/conditionReportTypes.py b/etl/transform/conditionReportTypes.py index ca74a6a..0019933 100644 --- a/etl/transform/conditionReportTypes.py +++ b/etl/transform/conditionReportTypes.py @@ -1,240 +1,66 @@ from etl.transform.preSiteNoteTypes import BaseModel, Optional, List -class AssessorInformation(BaseModel): - assessor_name_and_id: str - elmhurst_id: str - -class InspectionAndProject(BaseModel): - inspection_date: str - risk_assessment_pathway: str - -class TheProperty(BaseModel): - classification_type: str - orientation_front_elevation: str - orientation_in_degrees_front_elevation: str - house_type: str - exposure_zone: str - main_wall_constructions: str - -class GeneralInformation(BaseModel): - assessor: AssessorInformation - inspection_and_project: InspectionAndProject - property: TheProperty - -class PropertyAccess(BaseModel): - are_there_any_road_restrictions_in_the_locality: bool - is_on_street_parking_avalible: bool - is_the_access_gated: bool - is_there_restricted_space_for_contractors_to_access_the_wall_area: bool - is_there_restrcited_space_for_contractors_to_access_the_roof_area: bool - is_there_more_than_2_dot_5_mm_in_width_to_fence_or_neighbouring_boundary_along_the_full_gable_elevation: bool - is_access_to_the_rear_provided_by_use_of_a_ginnel: bool - is_access_to_the_rear_provided_by_use_of_a_secured_alleway: bool - -class ExternalElevationGableOne(BaseModel): - do_all_answers_for_the_front_elevation_also_apply_to_this_wall: bool - -class ExternalElevationGableTwo(BaseModel): - is_there_a_fourth_external_elevation: bool - -class ExternalElevationRear(BaseModel): - do_all_answers_for_the_front_elevation_also_apply_to_this_wall: bool - -class ExternalElevationFront(BaseModel): - general_condition_of_the_elevation: str - are_there_any_visible_signs_of_existing_wall_insulation: str - are_there_any_signs_of_water_penetration_caused_by_failed_rainwater_goods_or_pipework: bool - are_there_any_visible_signs_of_movement: str - are_there_any_visible_signs_of_cracking_to_the_existing_external_finish: bool - -class ConservatoryOrOutbuilding(BaseModel): - is_there_a_conservatory_and_or_outbuilding: bool - -class ExternalElevations(BaseModel): - front: ExternalElevationFront - rear: ExternalElevationRear - gable_one: ExternalElevationGableOne - gable_two: ExternalElevationGableTwo - -class AccessAndElevations(BaseModel): - property_access: PropertyAccess - conservatory_and_or_outbuilding: ConservatoryOrOutbuilding - external_elevations: ExternalElevations - -class RoomDetail(BaseModel): - overall_condition_of_the_room: str - does_the_room_have_any_defects: str - does_the_room_have_any_windows: bool - condition_of_windows: Optional[str] - are_the_windows_openable: Optional[bool] - do_the_windows_have_trickle_vents: Optional[bool] - is_there_ventilation_system_present_in_the_room: str - is_the_ventilation_system_in_good_working_order: Optional[str] - extract_ventilation_rate_measured: Optional[float] - are_there_any_visible_or_reported_signs_of_damp_mould_or_excessive_condensation_within_the_room: bool - are_there_sufficient_undercuts_on_the_closed_door: bool - -class Conservatory(BaseModel): - is_there_a_conservatory_and_or_outbuilding: bool - -class Hallway(BaseModel): - is_there_a_hallway: bool - room_detail: RoomDetail - -class LivingRoom(BaseModel): - room_detail: RoomDetail - -class DiningRoom(BaseModel): - is_there_a_dining_room: bool - room_detail: RoomDetail - -class Kitchen(BaseModel): - room_detail: RoomDetail - -class WC(BaseModel): - is_there_a_seperated_wc: bool - room_detail: RoomDetail - -class Utilty(BaseModel): - is_there_a_utility_room: bool - room_detail: RoomDetail - -class Landing(BaseModel): - room_detail: RoomDetail - is_there_a_landing: bool - -class Bathroom(BaseModel): - is_this_an_ensuite_bathroom: bool - room_detail: RoomDetail - -class Bedroom(BaseModel): - room_detail: RoomDetail - double_or_single_bedroom: str - -class LoftSpace(BaseModel): - is_the_loft_space_accessible: bool - overall_condition_of_the_loft_space: str - does_the_loft_space_have_any_defects: bool - existing_depth_of_loft_insulation: str - is_the_insulation_layer_even_across_the_loft: bool - is_the_loft_boarded_in_any_area: bool - boarded_m2_area: Optional[float] - condition_of_existing_roof_lining: str - is_there_an_existing_heating_system_or_plumbing_located_in_the_loft: bool - -class RoomInRoof(BaseModel): - is_there_a_room_in_roof: bool - -class Rooms(BaseModel): - hallway: Hallway - living_room: LivingRoom - dining_room: DiningRoom - kitchen: Kitchen - utility: Utilty - WC: WC - landing: Landing - Bathroom: List[Bathroom] - Bedroom: List[Bedroom] - loft_space: LoftSpace - room_in_roof: RoomInRoof - -class HeatingSystemGeneralCondition(BaseModel): - is_the_heating_system_in_working_order: bool - does_the_occupant_have_a_smart_meter: bool - are_there_any_smart_monitoring_devices: bool - are_the_gas_and_electricity_meters_accessible: bool - -class Heating(BaseModel): - as_define_by: str - fuel: str - -class MainHeating1(BaseModel): - heatingDetail: Heating - -class SecondaryHeating(BaseModel): - is_there_a_secondary_heating: bool - heatingDetail: Heating - -class HeatingByRoom(BaseModel): - rooms_heated_by_main_system_1: str - rooms_heated_by_secondary_heating: str - partially_heated_rooms: str - unheated_rooms: str - which_other_rooms: Optional[str] - -class Renewable(BaseModel): +class Renewables(BaseModel): is_there_any_renewable_energy_system_in_place: bool suitable_roof_orientation_for_solar_pv_water: str + is_there_a_water_tank: bool + type: str + size: str + tank_location: str + is_the_tank_insulated: bool + type_of_insulation: str + -class HeatingSystem(BaseModel): - general_condition: HeatingSystemGeneralCondition - main_heating_1: MainHeating1 - secondary_heating: SecondaryHeating - heating_by_room: HeatingByRoom - renewable: Renewable - - -class Occupants(BaseModel): +class Occupant(BaseModel): + name: str + have_evidence_of_12_months_of_fuel_bill_data: bool total_number_of_occupants: int - number_of_adult_occupants: int - number_of_child_occupants: int - are_there_vulnerable_people: bool - anyone_with_disability: bool - name_of_occupant: str + no_of_adult_occupants: int + no_of_child_occupants: int + no_of_occupant_of_a_pensionable_age: int + are_there_any_vulnerable_people: bool + is_there_anyone_with_a_disability: bool status_of_occupant: str landlord_has_written_confirmation_that_the_tenent_agrees_to_the_assessment_been_supplied: bool -class EnergyUse(BaseModel): - property_tenure: str - electricity_bill_payer: str +class TumbleDryer(BaseModel): + percentage_of_annual_use: int -class OccupantHeating(BaseModel): - room_stat_temperture_in_celsius: float - root_stat_location: str - is_heating_pattern_known: bool - heating_pattern: str - number_of_alternative_days: int +class Cooker(BaseModel): + range_fuel: str + normal_large_range: str + cooker_type: str - -class ShowerAndBath(BaseModel): - do_you_know_the_number_of_showers_per_day_or_per_week: str - do_you_know_the_number_of_baths_per_day_or_per_week: str - shower_type: str - per_day_or_per_week: str +class FridgeAndFreezers(BaseModel): + no_of_stand_alone_seperate_fridges: int + no_of_stand_alone_seperate_freezers: int + no_of_stand_alone_or_integrated_fridge_freezers: int class Appliances(BaseModel): - no_of_fridges: int - no_of_freezers: int - no_of_fridge_freezers: int - cooker_type: str - cooker_normal_or_large: str - cooker_range_fuel: str - tumble_dryer: str - tumble_dryer_percentage_of_annual_use: int - space_for_outdoor_drying: bool - evidence_of_twelve_months_of_fuel_bill_data: bool + find_out_with_one_in: str -class OccupancyAssessment(BaseModel): - occupants: Occupants +class ShowerAndBath(BaseModel): + shower_type: str + do_you_know_the_no_of_showers_per_day_per_week: bool + please_input_no_of_showers_and_specify_a_day_or_a_week: str + +class Heating(BaseModel): + # TODO find one with an example of this one + room_stat_in_temperature_in_celsius: str + room_stat_location: str + is_the_heating_pattern_known: str + +class EnergyUse(BaseModel): + property_tenure: str + who_is_the_electricity_payer: str + +class OccupantAssessment(BaseModel): + occupant: Occupant energy_use: EnergyUse - heating: OccupantHeating + heating: Heating shower_and_bath: ShowerAndBath - appliances: Appliances - -class VentilationChecklist(BaseModel): - intermittent_extract_ventilation: bool - continous_mechanical_extract_ventilation: bool - mechanical_ventilation_with_heat_recovery: bool - -class ConditionReport(BaseModel): - property_reference_code: str - property_site_name: str - property_address: str - postcode: str - general_information: GeneralInformation - access_and_elevation: AccessAndElevations - rooms: List[Rooms] - heating_system: HeatingSystem - occupancy_assessment: OccupancyAssessment - ventilation_checklist: VentilationChecklist \ No newline at end of file + appliances: Optional[Appliances] + fridge_and_freezers: FridgeAndFreezers + cooker: Cooker + tumble_dryer: TumbleDryer