mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-07-22 08:48:39 +00:00
309 lines
No EOL
12 KiB
Python
309 lines
No EOL
12 KiB
Python
# SQLModel mapping for ConditionReportModel using BaseModel
|
|
from sqlmodel import SQLModel, Field, Relationship, Column, JSON
|
|
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")
|
|
|
|
class GeneralConditionHeatingSystem(BaseModel, table=True):
|
|
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
|
|
dual_or_single_electric_meter: str
|
|
|
|
class MainHeatingOne(BaseModel, table=True):
|
|
as_defined_by: str
|
|
fuel: str
|
|
type: str
|
|
|
|
class MainHeatingTwo(BaseModel, table=True):
|
|
is_there_a_main_heating_two: bool
|
|
|
|
class SecondaryHeating(BaseModel, table=True):
|
|
is_there_a_secondary_heating: bool
|
|
fuel: str
|
|
electric_heating_type: str
|
|
gas_heating_type: str
|
|
|
|
class HeatingByRoom(BaseModel, table=True):
|
|
rooms_heated_by_main_system_one: List[str] = Field(sa_column=Column(JSON))
|
|
rooms_heated_by_main_system_two: List[str] = Field(sa_column=Column(JSON))
|
|
rooms_heated_by_secondary_heating: List[str] = Field(sa_column=Column(JSON))
|
|
are_there_any_partially_heated_rooms: bool
|
|
partially_heated_rooms: Optional[List[str]] = Field(sa_column=Column(JSON))
|
|
are_there_any_unheated_rooms: bool
|
|
unheated_rooms: List[str] = Field(sa_column=Column(JSON))
|
|
|
|
|
|
class Renewables(BaseModel, table=True):
|
|
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
|
|
thickness_of_insulation_in_mm: int
|
|
|
|
class HeatingSystem(BaseModel, table=True):
|
|
general_condition_id: uuid.UUID = Field(foreign_key="generalconditionheatingsystem.id")
|
|
general_condition: GeneralConditionHeatingSystem = Relationship()
|
|
|
|
main_heating_one_id: uuid.UUID = Field(foreign_key="mainheatingone.id")
|
|
main_heating_one: MainHeatingOne = Relationship()
|
|
|
|
main_heating_two_id: uuid.UUID = Field(foreign_key="mainheatingtwo.id")
|
|
main_heating_two: MainHeatingTwo = Relationship()
|
|
|
|
secondary_heating_id: uuid.UUID = Field(foreign_key="secondaryheating.id")
|
|
secondary_heating: SecondaryHeating = Relationship()
|
|
|
|
heating_by_room_id: uuid.UUID = Field(foreign_key="heatingbyroom.id")
|
|
heating_by_room: HeatingByRoom = Relationship()
|
|
|
|
renewables_id: uuid.UUID = Field(foreign_key="renewables.id")
|
|
renewables: Renewables = Relationship()
|
|
|
|
class Occupant(BaseModel, table=True):
|
|
name: str
|
|
have_evidence_of_12_months_of_fuel_bill_data: bool
|
|
total_number_of_occupants: int
|
|
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_wrote_that_the_tenent_agrees_assessment_been_supplied: bool |