mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-07-22 08:48:39 +00:00
53 lines
1.7 KiB
Python
53 lines
1.7 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
|
|
|
|
class BaseModel(SQLModel):
|
|
id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
|
|
|
|
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")
|