mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-08 11:17:29 +00:00
335 lines
13 KiB
Python
335 lines
13 KiB
Python
# from sqlmodel import Field, SQLModel, Relationship
|
|
# import uuid
|
|
# from typing import Optional, List
|
|
# from datetime import datetime
|
|
# from pydantic import EmailStr
|
|
# from sqlalchemy import Column
|
|
# from sqlalchemy.dialects.postgresql import UUID
|
|
# # from etl.models.topLevel import BaseModel, Documents
|
|
|
|
|
|
# class PreSiteNote(BaseModel, table=True):
|
|
# summary_info_id: uuid.UUID = Field(
|
|
# foreign_key="presitenotessummaryinfo.id",
|
|
# nullable=False
|
|
# )
|
|
|
|
# summary_info: Optional["PreSiteNotesSummaryInfo"] = Relationship(back_populates="pre_site_notes")
|
|
|
|
|
|
# # Assessor Info
|
|
# assessor_id: uuid.UUID = Field(
|
|
# foreign_key="assessorinfo.id",
|
|
# nullable=False
|
|
# )
|
|
|
|
# assessor: Optional["AssessorInfo"] = Relationship(back_populates="pre_site_notes")
|
|
|
|
# pre_site_note_description_id: uuid.UUID = Field(
|
|
# foreign_key="propertydescription.id",
|
|
# nullable=True
|
|
# )
|
|
|
|
# pre_site_note_description: Optional["PropertyDescription"] = Relationship(back_populates="pre_site_notes")
|
|
|
|
|
|
# class Dimension(BaseModel, table=True):
|
|
# floor_area_m2: float
|
|
# room_height_m: float
|
|
# loss_perimeter_m: float
|
|
# party_wall_length_m: float
|
|
# property_detail_id: Optional[uuid.UUID] = Field(default=None, foreign_key="propertydetail.id")
|
|
# property_detail: Optional["PropertyDetail"] = Relationship(back_populates="dimensions")
|
|
|
|
|
|
# class Walls(BaseModel, table=True):
|
|
# construction: str
|
|
# insulation: str
|
|
# insulation_thickness_mm: str
|
|
# wall_thickness_measured: bool
|
|
# wall_thickness_mm: Optional[int]
|
|
# u_value_known: bool
|
|
# u_value_w_m2_k: Optional[float]
|
|
# dry_lining: bool
|
|
# alternative_wall_present: bool
|
|
|
|
|
|
# class Roofs(BaseModel, table=True):
|
|
# construction: str
|
|
# insulation_type: str
|
|
# insulation_thickness: str
|
|
# u_value_known: bool
|
|
|
|
|
|
# class Floors(BaseModel, table=True):
|
|
# floor_type: str
|
|
# ground_floor_construction: str
|
|
# ground_floor_insulation_type: Optional[str] = ""
|
|
# floor_insulation_thickness_mm: Optional[float] = -1
|
|
# u_value_known: bool
|
|
|
|
|
|
# class Windows(BaseModel, table=True):
|
|
# glazing_type: str
|
|
# area_m2: float
|
|
# roof_window: bool
|
|
# orientation: str
|
|
# u_value_w_m2_k: int
|
|
# g_value: int
|
|
# property_detail_id: Optional[uuid.UUID] = Field(default=None, foreign_key="propertydetail.id")
|
|
# property_detail: Optional["PropertyDetail"] = Relationship(back_populates="windows")
|
|
|
|
|
|
|
|
# class PropertyDetail(BaseModel, table=True):
|
|
# age_band: str
|
|
# wall_id: Optional[uuid.UUID] = Field(default=None, foreign_key="walls.id")
|
|
# roof_id: Optional[uuid.UUID] = Field(default=None, foreign_key="roofs.id")
|
|
# floor_id: Optional[uuid.UUID] = Field(default=None, foreign_key="floors.id")
|
|
|
|
# # Relationships
|
|
# dimensions: List[Dimension] = Relationship(back_populates="property_detail")
|
|
# windows: List[Windows] = Relationship(back_populates="property_detail")
|
|
|
|
|
|
|
|
|
|
# class Door(BaseModel, table=True):
|
|
# no_of_doors: int
|
|
# no_of_insulated_doors: int
|
|
# u_value_w_m2_k: Optional[str]
|
|
|
|
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="door")
|
|
|
|
# class VentilationAndCooling(BaseModel, table=True):
|
|
# no_of_open_fireplaces: int
|
|
# ventilation_type: str
|
|
# space_cooling_system_present: bool
|
|
|
|
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="ventilation_and_cooling")
|
|
|
|
|
|
|
|
# class Lighting(BaseModel, table=True):
|
|
# total_no_of_light_fittings: int
|
|
# total_no_of_lel_fittings: int
|
|
|
|
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="lighting")
|
|
|
|
|
|
|
|
# class HeatingSystemControls(BaseModel, table=True):
|
|
# control_type: str
|
|
# flue_type: str
|
|
# fan_assisted_flue: bool
|
|
# heat_emitter_type: str
|
|
# electricity_meter_type: Optional[str] = ""
|
|
# mains_gas_available: Optional[bool] = False
|
|
|
|
|
|
# class HeatingFromPreSiteNotes(BaseModel, table=True):
|
|
# type: str
|
|
# heating_source: str
|
|
# efficiency_source: str
|
|
# heating_fuel: str
|
|
# brand_name: str
|
|
# model_name: str
|
|
# model_qualifer: str
|
|
# sap_2009_table: Optional[str] = ""
|
|
# percentage_of_heated_floor_area_served: Optional[str] = ""
|
|
# controls_id: Optional[uuid.UUID] = Field(default=None, foreign_key="heatingsystemcontrols.id")
|
|
|
|
# property_description: Optional["PropertyDescription"] = Relationship(
|
|
# back_populates="main_heating", sa_relationship_kwargs={"foreign_keys": "[PropertyDescription.main_heating_id]"}
|
|
# )
|
|
# property_description2: Optional["PropertyDescription"] = Relationship(
|
|
# back_populates="main_heating2", sa_relationship_kwargs={"foreign_keys": "[PropertyDescription.main_heating2_id]"}
|
|
# )
|
|
|
|
|
|
|
|
# class HeatingType(BaseModel, table=True):
|
|
# heating_type: str
|
|
# fuel_type: str
|
|
|
|
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="secondary_heating_type")
|
|
|
|
|
|
# class WaterHeating(BaseModel, table=True):
|
|
# heating_type: str
|
|
# fuel_type: str
|
|
|
|
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="water_heating")
|
|
|
|
|
|
|
|
# class HotWaterCylinder(BaseModel, table=True):
|
|
# volume: str
|
|
# insulation_type: str
|
|
# insulation_thickness: str
|
|
# thermostat: bool
|
|
|
|
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="hot_water_cylinder")
|
|
|
|
|
|
|
|
# class SolarWaterHeating(BaseModel, table=True):
|
|
# solar_water_heating_details_known: bool
|
|
|
|
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="solar_water_heating")
|
|
|
|
|
|
|
|
# class ShowerAndBaths(BaseModel, table=True):
|
|
# no_of_rooms_with_baths_and_or_shower: int
|
|
# no_of_rooms_with_mixer_shower_and_no_baths: int
|
|
# no_of_rooms_with_mixer_shower_and_baths: int
|
|
|
|
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="shower_and_baths")
|
|
|
|
|
|
|
|
# class FlueGasHeatRecoverySystem(BaseModel, table=True):
|
|
# fghrs_present: bool
|
|
|
|
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="flue_gas_heat_recovery_system")
|
|
|
|
|
|
|
|
# class PhotovoltaicPanel(BaseModel, table=True):
|
|
# pvs_are_connected_to_dwelling_electricity_meter: bool
|
|
# percentage_of_external_roof_area_with_pvs: str
|
|
|
|
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="photovoltaic_panel")
|
|
|
|
|
|
|
|
# class WindTurbine(BaseModel, table=True):
|
|
# wind_turbine: bool
|
|
|
|
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="wind_turbine")
|
|
|
|
|
|
|
|
# class OtherDetails(BaseModel, table=True):
|
|
# electricity_meter_type: str
|
|
# main_gas_avalible: bool
|
|
|
|
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="other_details")
|
|
|
|
|
|
|
|
# class PropertyDescription(BaseModel, table=True):
|
|
# built_form: str
|
|
# detachment_or_position: str
|
|
# no_of_main_property: int
|
|
# no_of_extension_1: Optional[int] = 0
|
|
# no_of_extension_2: Optional[int] = 0
|
|
# no_of_extension_3: Optional[int] = 0
|
|
# no_of_extension_4: Optional[int] = 0
|
|
# no_of_habitable_rooms: int
|
|
# no_of_heated_rooms: int
|
|
# heated_basement: bool
|
|
# conservatory_type: str
|
|
# percentage_of_draught_proofed: int
|
|
# terrain_type: str
|
|
# conservatory: bool
|
|
|
|
# main_property_id: uuid.UUID = Field(foreign_key="propertydetail.id")
|
|
# ex1_property_id: Optional[uuid.UUID] = Field(default=None, foreign_key="propertydetail.id")
|
|
# ex2_property_id: Optional[uuid.UUID] = Field(default=None, foreign_key="propertydetail.id")
|
|
# ex3_property_id: Optional[uuid.UUID] = Field(default=None, foreign_key="propertydetail.id")
|
|
# ex4_property_id: Optional[uuid.UUID] = Field(default=None, foreign_key="propertydetail.id")
|
|
|
|
# door_id: Optional[uuid.UUID] = Field(default=None, foreign_key="door.id")
|
|
# ventilation_and_cooling_id: Optional[uuid.UUID] = Field(default=None, foreign_key="ventilationandcooling.id")
|
|
# lighting_id: Optional[uuid.UUID] = Field(default=None, foreign_key="lighting.id")
|
|
# water_heating_id: Optional[uuid.UUID] = Field(default=None, foreign_key="waterheating.id")
|
|
# hot_water_cylinder_id: Optional[uuid.UUID] = Field(default=None, foreign_key="hotwatercylinder.id")
|
|
# solar_water_heating_id: Optional[uuid.UUID] = Field(default=None, foreign_key="solarwaterheating.id")
|
|
# shower_and_baths_id: Optional[uuid.UUID] = Field(default=None, foreign_key="showerandbaths.id")
|
|
# flue_gas_heat_recovery_system_id: Optional[uuid.UUID] = Field(default=None, foreign_key="fluegasheatrecoverysystem.id")
|
|
# photovoltaic_panel_id: Optional[uuid.UUID] = Field(default=None, foreign_key="photovoltaicpanel.id")
|
|
# wind_turbine_id: Optional[uuid.UUID] = Field(default=None, foreign_key="windturbine.id")
|
|
# other_details_id: Optional[uuid.UUID] = Field(default=None, foreign_key="otherdetails.id")
|
|
# main_heating_id: Optional[uuid.UUID] = Field(default=None, foreign_key="heatingfrompresitenotes.id")
|
|
# main_heating2_id: Optional[uuid.UUID] = Field(default=None, foreign_key="heatingfrompresitenotes.id")
|
|
# secondary_heating_type_id: Optional[uuid.UUID] = Field(default=None, foreign_key="heatingtype.id")
|
|
|
|
# # Relationships
|
|
# main_property: Optional["PropertyDetail"] = Relationship(sa_relationship_kwargs={"foreign_keys": "[PropertyDescription.main_property_id]"})
|
|
# ex1_property: Optional["PropertyDetail"] = Relationship(sa_relationship_kwargs={"foreign_keys": "[PropertyDescription.ex1_property_id]"})
|
|
# ex2_property: Optional["PropertyDetail"] = Relationship(sa_relationship_kwargs={"foreign_keys": "[PropertyDescription.ex2_property_id]"})
|
|
# ex3_property: Optional["PropertyDetail"] = Relationship(sa_relationship_kwargs={"foreign_keys": "[PropertyDescription.ex3_property_id]"})
|
|
# ex4_property: Optional["PropertyDetail"] = Relationship(sa_relationship_kwargs={"foreign_keys": "[PropertyDescription.ex4_property_id]"})
|
|
|
|
# # Related Models
|
|
# door: Optional["Door"] = Relationship(back_populates="property_description")
|
|
# ventilation_and_cooling: Optional["VentilationAndCooling"] = Relationship(back_populates="property_description")
|
|
# lighting: Optional["Lighting"] = Relationship(back_populates="property_description")
|
|
# water_heating: Optional["WaterHeating"] = Relationship(back_populates="property_description")
|
|
# hot_water_cylinder: Optional["HotWaterCylinder"] = Relationship(back_populates="property_description")
|
|
# solar_water_heating: Optional["SolarWaterHeating"] = Relationship(back_populates="property_description")
|
|
# shower_and_baths: Optional["ShowerAndBaths"] = Relationship(back_populates="property_description")
|
|
# flue_gas_heat_recovery_system: Optional["FlueGasHeatRecoverySystem"] = Relationship(back_populates="property_description")
|
|
# photovoltaic_panel: Optional["PhotovoltaicPanel"] = Relationship(back_populates="property_description")
|
|
# wind_turbine: Optional["WindTurbine"] = Relationship(back_populates="property_description")
|
|
# other_details: Optional["OtherDetails"] = Relationship(back_populates="property_description")
|
|
# main_heating: Optional["HeatingFromPreSiteNotes"] = Relationship(back_populates="property_description", sa_relationship_kwargs={"foreign_keys": "[PropertyDescription.main_heating_id]"})
|
|
# main_heating2: Optional["HeatingFromPreSiteNotes"] = Relationship(back_populates="property_description", sa_relationship_kwargs={"foreign_keys": "[PropertyDescription.main_heating2_id]"})
|
|
# secondary_heating_type: Optional["HeatingType"] = Relationship(back_populates="property_description")
|
|
|
|
# pre_site_notes: Optional["PreSiteNote"] = Relationship(back_populates="pre_site_note_description")
|
|
|
|
# class AssessorInfo(BaseModel, table=True):
|
|
# accreditation_number: str
|
|
# name: str
|
|
# phone_number: Optional[str] = None
|
|
# email_address: Optional[EmailStr] = None
|
|
|
|
# company_id: Optional[uuid.UUID] = Field(default=None, foreign_key="companyinfo.id")
|
|
# company: Optional["CompanyInfo"] = Relationship(back_populates="assessors")
|
|
|
|
# pre_site_notes: List["PreSiteNote"] = Relationship(back_populates="assessor")
|
|
# documents: List["Documents"] = Relationship(back_populates="author")
|
|
|
|
|
|
# class PreSiteNotesSummaryInfo(BaseModel, table=True):
|
|
# reference_number: str
|
|
# epc_language: str
|
|
# uprn: Optional[str] = ""
|
|
# postcode: str
|
|
# region: str
|
|
# address: str
|
|
# town: str
|
|
# county: Optional[str] = ""
|
|
# property_tenure: str
|
|
# transaction_type: str
|
|
# inspection_date: datetime
|
|
# current_sap: str
|
|
# potential_sap: str
|
|
# current_ei: str
|
|
# potential_ei: str
|
|
# current_annual_emissions: str
|
|
# current_annual_emission_including_0925_multiplayer: str
|
|
# current_annual_energy_costs: str
|
|
|
|
# pre_site_notes: List["PreSiteNote"] = Relationship(back_populates="summary_info")
|
|
|
|
# class CompanyInfo(BaseModel, table=True):
|
|
# address: str
|
|
# trading_name: str
|
|
# post_code: str
|
|
# fax_number: Optional[str] = None
|
|
# related_party_disclosure: Optional[str] = None
|
|
|
|
# assessors: List[AssessorInfo] = Relationship(back_populates="company")
|
|
|
|
|
|
# class Insulation(BaseModel, table=True):
|
|
# type: str
|
|
|
|
|
|
|
|
# PreSiteNote.update_forward_refs()
|
|
# AssessorInfo.update_forward_refs()
|