mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-08 11:17:29 +00:00
121 lines
5.4 KiB
Python
121 lines
5.4 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()
|