From 2d46cf487e49e046f9ef88e19637907ef57ffac6 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Thu, 5 Jun 2025 13:23:58 +0000 Subject: [PATCH] pydantic done --- .devcontainer/devcontainer.json | 3 +- etl/transform/conditionReportTypes.py | 176 ++++++++++++++++++++++++-- 2 files changed, 164 insertions(+), 15 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 1ccb286..445d2e6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -22,7 +22,8 @@ "lindacong.vscode-book-reader", "4ops.terraform", "fabiospampinato.vscode-todo-plus", - "jgclark.vscode-todo-highlight" + "jgclark.vscode-todo-highlight", + "corentinartaud.pdfpreview" ] } } diff --git a/etl/transform/conditionReportTypes.py b/etl/transform/conditionReportTypes.py index 734c8ac..0b58628 100644 --- a/etl/transform/conditionReportTypes.py +++ b/etl/transform/conditionReportTypes.py @@ -1,27 +1,151 @@ from etl.transform.preSiteNoteTypes import BaseModel, Optional, List -class WC(BaseModel): - is_there_a_seperated_wc: bool +class AssessorDetails(BaseModel): + assessor_name_and_id: str + elmhurst_id: str -class Landing(BaseModel): - is_there_a_landing: bool +class InspectionAndProject(BaseModel): + inspection_date: str -class Bedroom(BaseModel): - double_or_single_bedroom: str - overall_condition_of_the_room: str - are_there_any_sloped_ceiling_areas: bool - does_the_room_have_any_defects: bool - does_the_room_have_any_windows: bool - condition_of_the_windows: str - does_the_windows_have_trickle_vents: bool - input_trickle_vent_product_code_located_on_the_trickle_vent_or_trickle_vent_measurment: int - are_the_windows_openable: bool +class TheProperty(BaseModel): + house_type: str + on_which_floor_is_the_flat_located: str + is_there_a_corridor: str + is_it_heated: bool + it_there_a_balcony: bool + classification_type: str + orientation_front_elevation: str + orientation_in_degrees_front_elevation: str + exposure_zone: str + main_wall_construction: str + + +class ElevationInfo(BaseModel): + elevation_type: str + cavity_wall_depth: str + is_insulation_present: bool + insulation_type: str + +class MainElevation(BaseModel): + elevation_info: ElevationInfo + +class Elevation(BaseModel): + info: List[ElevationInfo] + protected_conservatory_or_aonb: bool + material_type: str + are_there_any_visible_signs_of_existing_wall_insulation: str + does_the_existing_ground_level_on_any_elevation_bridge_the_dpc: bool + +class GeneralInformation(BaseModel): + assessor_details: AssessorDetails + inspection_and_project: InspectionAndProject + the_property: TheProperty + main_elevation: MainElevation + elevations: Elevation + +class PropertyAccess(BaseModel): + are_there_any_road_restriction_in_the_locality: bool + is_on_street_parking_available: bool + are_there_any_overhead_wires_or_cables: bool + is_the_access_gated: bool + is_there_restricted_space_for_contractors_to_access_the_wall_area: bool + is_there_restricted_space_for_contractors_to_access_the_roof_area: bool + is_there_more_than_1_point_5_meters_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_ginnel: bool + is_access_to_the_rear_provided_by_use_of_a_secured_alleyway: bool + +class ExternalElevation(BaseModel): + structural_defects_of_elevation: str + does_any_structural_defect_need_resolving_before_retrofit: bool + are_there_any_signs_of_water_penetration_caused_by_failed_rainwater_goods_or_pipework: bool + are_there_any_visible_signs_of_movement: bool + are_there_any_visible_signs_of_cracking_to_the_existing_external_finish: bool + +class ExternalElevationFront(BaseModel): + external_elevation: ExternalElevation + +class ExternalElevationGableOne(BaseModel): + do_all_answers_for_the_front_elevation_apply_to_this_wall: bool + external_elevation: Optional[ExternalElevation] + +class ExternalElevationRear(BaseModel): + do_all_answers_for_the_front_elevation_apply_to_this_wall: bool + external_elevation: Optional[ExternalElevation] + + +class ExternalElevationGableTwo(BaseModel): + is_there_a_fourth_external_elevation: bool + external_elevation: Optional[ExternalElevation] + + +class ConservatoryOrOutbuilding(BaseModel): + is_there_a_conservatory: bool + is_there_a_cellar_present: bool + is_there_an_outbuilding: bool + + +class AccessAndElevations(BaseModel): + property_access: PropertyAccess + external_elevation_front: ExternalElevationFront + external_elevation_back: ExternalElevationRear + external_elevation_gable_one: ExternalElevationGableOne + external_elevation_gable_two: ExternalElevationGableTwo + conservatory_or_out_building: ConservatoryOrOutbuilding + +class VentilationInfo(BaseModel): is_there_a_ventilation_system_present_in_the_room: bool 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 is_there_any_open_flue_heating_appliances_within_the_room: bool +class WindowsInfo(BaseModel): + does_the_room_have_any_windows: bool + condition_of_the_windows: str + do_the_windows_have_trickle_vents: bool + are_the_windows_openable: bool + trickle_vent_measurements: int + +class RoomInfo(BaseModel): + overall_condition_of_the_room: str + does_the_room_have_any_defects: str + are_there_any_sloped_ceiling_areas: Optional[bool] + windows_info: Optional[WindowsInfo] + ventilation_info: Optional[VentilationInfo] + +class Hallway(BaseModel): + is_there_a_hallway: bool + room_info: Optional[RoomInfo] + +class LivingRoom(BaseModel): + overall_condition_of_the_room: str + room_info: Optional[RoomInfo] + +class DiningRoom(BaseModel): + is_there_a_dining_room: bool + room_info: Optional[RoomInfo] + +class Kitchen(BaseModel): + room_info: Optional[RoomInfo] + is_there_a_cooker_hood_present_in_the_room: bool + + +class Utility(BaseModel): + is_there_a_utility_room: bool + room_info: Optional[RoomInfo] + +class WC(BaseModel): + is_there_a_seperated_wc: bool + room_info: Optional[RoomInfo] + +class Landing(BaseModel): + is_there_a_landing: bool + room_info: Optional[RoomInfo] + +class Bedroom(BaseModel): + double_or_single_bedroom: str + room_info: Optional[RoomInfo] class Bathroom(BaseModel): is_this_an_ensuit_bathroom: bool @@ -42,6 +166,19 @@ class LoftSpace(BaseModel): class RoomInRoof(BaseModel): is_there_a_room_in_roof: bool +class Rooms(BaseModel): + hallway: Hallway + living_room: LivingRoom + dining_room: DiningRoom + kitchen: Kitchen + utility: Utility + wash_chamber: WC + landing: Landing + bedrooms: List[Bedroom] + bathroomos: List[Bathroom] + loft_space: LoftSpace + room_in_roof: RoomInRoof + class GeneralConditionHeatingSystem(BaseModel): is_the_heating_system_in_working_order: bool does_the_occupant_have_a_smart_meter: bool @@ -144,3 +281,14 @@ class OccupantAssessment(BaseModel): fridge_and_freezers: FridgeAndFreezers cooker: Cooker tumble_dryer: TumbleDryer + +class OsmosisACDPas2035ConditionReport(BaseModel): + project_site_name: str + property_reference_code: str + property_address: str + postcode: str + general_information: GeneralInformation + access_and_elevations: AccessAndElevations + rooms: Rooms + heating_system: HeatingSystem + occupancy_assessment: OccupantAssessment \ No newline at end of file