mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-07-12 13:29:08 +00:00
236 lines
9.8 KiB
Python
236 lines
9.8 KiB
Python
# SQLModel mapping for ConditionReportModel using BaseModel
|
|
from sqlmodel import SQLModel, Field, Relationship
|
|
from typing import Optional, List
|
|
import uuid
|
|
from datetime import datetime
|
|
from etl.models.topLevel import BaseModel, Documents
|
|
|
|
class AssessorDetails(BaseModel, table=True):
|
|
assessor_name_and_id: str
|
|
elmhurst_id: str
|
|
|
|
class InspectionAndProject(BaseModel, table=True):
|
|
inspection_date: str
|
|
|
|
class TheProperty(BaseModel, table=True):
|
|
house_type: str
|
|
on_which_floor_is_the_flat_located: str
|
|
is_there_a_corridor: bool
|
|
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, table=True):
|
|
elevation_type: str
|
|
cavity_wall_depth: str
|
|
is_insulation_present: bool
|
|
insulation_type: str
|
|
|
|
main_elevation: Optional["MainElevation"] = Relationship(back_populates="elevation_info")
|
|
|
|
elevation_id: Optional[uuid.UUID] = Field(foreign_key="elevation.id")
|
|
elevation_table: Optional["Elevation"] = Relationship(back_populates="info")
|
|
|
|
|
|
class MainElevation(BaseModel, table=True):
|
|
elevation_info_id: uuid.UUID = Field(foreign_key="elevationinfo.id")
|
|
|
|
#SQLAlcemy things
|
|
elevation_info: ElevationInfo = Relationship(back_populates="main_elevation")
|
|
|
|
class Elevation(BaseModel, table=True):
|
|
protected_conservatory_or_aonb: bool
|
|
material_type: str
|
|
visible_signs_of_existing_wall_insulation: str
|
|
ground_level_bridge_the_dpc: bool
|
|
|
|
info: List["ElevationInfo"] = Relationship(back_populates="elevation_table")
|
|
|
|
class GeneralInformation(BaseModel, table=True):
|
|
assessor_detail_id: uuid.UUID = Field(foreign_key="assessordetails.id")
|
|
inspection_and_project_id: uuid.UUID = Field(foreign_key="inspectionandproject.id")
|
|
the_property_id: uuid.UUID = Field(foreign_key="theproperty.id")
|
|
main_elevation_id: uuid.UUID = Field(foreign_key="mainelevation.id")
|
|
elevations_id: uuid.UUID = Field(foreign_key="elevation.id")
|
|
|
|
assessor_details: AssessorDetails = Relationship()
|
|
inspection_and_project: InspectionAndProject = Relationship()
|
|
the_property: TheProperty = Relationship()
|
|
main_elevation: MainElevation = Relationship()
|
|
elevations: Elevation = Relationship()
|
|
|
|
class PropertyAccess(BaseModel, table=True):
|
|
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
|
|
more_than_1_5_meters_in_width_to_fence_or__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_alleyway: bool
|
|
|
|
|
|
class ExternalElevation(BaseModel, table=True):
|
|
structural_defects_of_elevation: str
|
|
does_any_structural_defect_need_resolving_before_retrofit: bool
|
|
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, table=True):
|
|
external_elevation_id: uuid.UUID = Field(foreign_key="externalelevation.id")
|
|
external_elevation: ExternalElevation = Relationship()
|
|
|
|
class ExternalElevationRear(BaseModel, table=True):
|
|
do_all_answers_for_the_front_elevation_apply_to_this_wall: bool
|
|
external_elevation_id: Optional[uuid.UUID] = Field(foreign_key="externalelevation.id")
|
|
external_elevation: Optional[ExternalElevation] = Relationship()
|
|
|
|
class ExternalElevationGableOne(BaseModel, table=True):
|
|
do_all_answers_for_the_front_elevation_apply_to_this_wall: bool
|
|
external_elevation_id: Optional[uuid.UUID] = Field(foreign_key="externalelevation.id")
|
|
external_elevation: Optional[ExternalElevation] = Relationship()
|
|
|
|
class ExternalElevationGableTwo(BaseModel, table=True):
|
|
is_there_a_fourth_external_elevation: bool
|
|
external_elevation_id: Optional[uuid.UUID] = Field(foreign_key="externalelevation.id")
|
|
|
|
class ConservatoryOrOutbuilding(BaseModel, table=True):
|
|
is_there_a_conservatory: bool
|
|
is_there_a_cellar_present: bool
|
|
is_there_an_outbuilding: bool
|
|
|
|
class AccessAndElevations(BaseModel, table=True):
|
|
property_access_id: uuid.UUID = Field(foreign_key="propertyaccess.id")
|
|
external_elevation_front_id: uuid.UUID = Field(foreign_key="externalelevationfront.id")
|
|
external_elevation_back_id: uuid.UUID = Field(foreign_key="externalelevationrear.id")
|
|
external_elevation_gable_one_id: uuid.UUID = Field(foreign_key="externalelevationgableone.id")
|
|
external_elevation_gable_two_id: uuid.UUID = Field(foreign_key="externalelevationgabletwo.id")
|
|
conservatory_or_out_building_id: uuid.UUID = Field(foreign_key="conservatoryoroutbuilding.id")
|
|
|
|
property_access: PropertyAccess = Relationship()
|
|
external_elevation_front: ExternalElevationFront = Relationship()
|
|
external_elevation_back: ExternalElevationRear = Relationship()
|
|
external_elevation_gable_one: ExternalElevationGableOne = Relationship()
|
|
external_elevation_gable_two: ExternalElevationGableTwo = Relationship()
|
|
conservatory_or_out_building: ConservatoryOrOutbuilding = Relationship()
|
|
|
|
class VentilationInfo(BaseModel, table=True):
|
|
is_there_a_ventilation_system_present_in_the_room: bool
|
|
any_damp_mould_or_excessive_condensation_within_the_room: bool
|
|
are_there_sufficient_undercuts_on_the_closed_door: str
|
|
is_there_any_open_flue_heating_appliances_within_the_room: bool
|
|
|
|
class WindowsInfo(BaseModel, table=True):
|
|
does_the_room_have_any_windows: bool
|
|
condition_of_the_windows: Optional[str] = None
|
|
do_the_windows_have_trickle_vents: Optional[bool] = None
|
|
are_the_windows_openable: Optional[bool] = None
|
|
input_trickle_vent_product_code_or_measurement: Optional[str] = None
|
|
|
|
class RoomInfo(BaseModel, table=True):
|
|
overall_condition_of_the_room: str
|
|
does_the_room_have_any_defects: str
|
|
are_there_any_sloped_ceiling_areas: Optional[bool] = None
|
|
|
|
windows_info_id: uuid.UUID = Field(foreign_key="windowsinfo.id")
|
|
ventilation_info_id: uuid.UUID = Field(foreign_key="ventilationinfo.id")
|
|
|
|
windows_info: WindowsInfo = Relationship()
|
|
ventilation_info: VentilationInfo = Relationship()
|
|
|
|
class Hallway(BaseModel, table=True):
|
|
is_there_a_hallway: bool
|
|
room_info_id: Optional[uuid.UUID] = Field(foreign_key="roominfo.id")
|
|
room_info: Optional[RoomInfo] = Relationship()
|
|
|
|
class LivingRoom(BaseModel, table=True):
|
|
room_info_id: Optional[uuid.UUID] = Field(foreign_key="roominfo.id")
|
|
room_info: Optional[RoomInfo] = Relationship()
|
|
|
|
class DiningRoom(BaseModel, table=True):
|
|
is_there_a_dining_room: bool
|
|
room_info_id: Optional[uuid.UUID] = Field(foreign_key="roominfo.id")
|
|
room_info: Optional[RoomInfo] = Relationship()
|
|
|
|
class Kitchen(BaseModel, table=True):
|
|
room_info_id: Optional[uuid.UUID] = Field(foreign_key="roominfo.id")
|
|
room_info: Optional[RoomInfo] = Relationship()
|
|
is_there_a_cooker_hood_present_in_the_room: bool
|
|
|
|
class Utility(BaseModel, table=True):
|
|
is_there_a_utility_room: bool
|
|
room_info_id: Optional[uuid.UUID] = Field(foreign_key="roominfo.id")
|
|
room_info: Optional[RoomInfo] = Relationship()
|
|
|
|
class WC(BaseModel, table=True):
|
|
is_there_a_seperated_wc: bool
|
|
room_info_id: Optional[uuid.UUID] = Field(foreign_key="roominfo.id")
|
|
room_info: Optional[RoomInfo] = Relationship()
|
|
|
|
class Landing(BaseModel, table=True):
|
|
is_there_a_landing: bool
|
|
room_info_id: Optional[uuid.UUID] = Field(foreign_key="roominfo.id")
|
|
room_info: Optional[RoomInfo] = Relationship()
|
|
|
|
class LoftSpace(BaseModel, table=True):
|
|
is_the_main_loft_space_accessible: str
|
|
is_there_more_than_one_loft_space: bool
|
|
|
|
class RoomInRoof(BaseModel, table=True):
|
|
is_there_a_room_in_roof: bool
|
|
room_info_id: Optional[uuid.UUID] = Field(foreign_key="roominfo.id")
|
|
room_info: Optional[RoomInfo] = Relationship()
|
|
|
|
class Bedroom(BaseModel, table=True):
|
|
double_or_single_bedroom: str
|
|
room_info_id: Optional[uuid.UUID] = Field(foreign_key="roominfo.id")
|
|
room_info: Optional[RoomInfo] = Relationship()
|
|
rooms_id: uuid.UUID = Field(foreign_key="rooms.id")
|
|
rooms: Optional["Rooms"] = Relationship(back_populates="bedrooms")
|
|
|
|
|
|
class Bathroom(BaseModel, table=True):
|
|
is_this_an_ensuite_bathroom: bool
|
|
room_info_id: Optional[uuid.UUID] = Field(foreign_key="roominfo.id")
|
|
room_info: Optional[RoomInfo] = Relationship()
|
|
|
|
rooms_id: uuid.UUID = Field(foreign_key="rooms.id")
|
|
rooms: Optional["Rooms"] = Relationship(back_populates="bathrooms")
|
|
|
|
|
|
class Rooms(BaseModel, table=True):
|
|
hallway_id: uuid.UUID = Field(foreign_key="hallway.id")
|
|
hallway: Hallway = Relationship()
|
|
|
|
living_room_id: uuid.UUID = Field(foreign_key="livingroom.id")
|
|
living_room: LivingRoom = Relationship()
|
|
|
|
dining_room_id: uuid.UUID = Field(foreign_key="diningroom.id")
|
|
dining_room: DiningRoom = Relationship()
|
|
|
|
kitchen_id: uuid.UUID = Field(foreign_key="kitchen.id")
|
|
kitchen: Kitchen = Relationship()
|
|
|
|
utility_id: uuid.UUID = Field(foreign_key="utility.id")
|
|
utility: Utility = Relationship()
|
|
|
|
wash_chamber_id: uuid.UUID = Field(foreign_key="wc.id")
|
|
wash_chamber: WC = Relationship()
|
|
|
|
landing_id: uuid.UUID = Field(foreign_key="landing.id")
|
|
landing: Landing = Relationship()
|
|
|
|
loft_space_id: uuid.UUID = Field(foreign_key="loftspace.id")
|
|
loft_space: LoftSpace = Relationship()
|
|
|
|
room_in_roof_id: uuid.UUID = Field(foreign_key="roominroof.id")
|
|
room_in_roof: RoomInRoof = Relationship()
|
|
|
|
bedrooms: List[Bedroom] = Relationship(back_populates="rooms")
|
|
bathrooms: List[Bathroom] = Relationship(back_populates="rooms")
|