mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-30 13:10:56 +00:00
Merge pull request #73 from Hestia-Homes/feature/month_end_automation
Feature/month end automation
This commit is contained in:
commit
a2b2859395
14 changed files with 646 additions and 1666 deletions
|
|
@ -1,354 +0,0 @@
|
|||
"""Initial table
|
||||
|
||||
Revision ID: 427e65da69c1
|
||||
Revises:
|
||||
Create Date: 2025-05-14 15:36:08.611971
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '427e65da69c1'
|
||||
down_revision: Union[str, None] = None
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('buildings',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('address', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('postcode', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('UPRN', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('landlord_id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('domna_id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('companyinfo',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('address', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('trading_name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('post_code', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('fax_number', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('related_party_disclosure', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('door',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('no_of_doors', sa.Integer(), nullable=False),
|
||||
sa.Column('no_of_insulated_doors', sa.Integer(), nullable=False),
|
||||
sa.Column('u_value_w_m2_k', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('floors',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('floor_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('ground_floor_construction', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('ground_floor_insulation_type', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('floor_insulation_thickness_mm', sa.Float(), nullable=True),
|
||||
sa.Column('u_value_known', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('fluegasheatrecoverysystem',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('fghrs_present', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('heatingsystemcontrols',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('control_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('flue_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('fan_assisted_flue', sa.Boolean(), nullable=False),
|
||||
sa.Column('heat_emitter_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('electricity_meter_type', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('mains_gas_available', sa.Boolean(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('heatingtype',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('heating_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('fuel_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('hotwatercylinder',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('volume', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('insulation_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('insulation_thickness', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('thermostat', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('insulation',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('lighting',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('total_no_of_light_fittings', sa.Integer(), nullable=False),
|
||||
sa.Column('total_no_of_lel_fittings', sa.Integer(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('otherdetails',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('electricity_meter_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('main_gas_avalible', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('photovoltaicpanel',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('pvs_are_connected_to_dwelling_electricity_meter', sa.Boolean(), nullable=False),
|
||||
sa.Column('percentage_of_external_roof_area_with_pvs', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('presitenotessummaryinfo',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('reference_number', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('epc_language', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('uprn', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('postcode', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('region', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('address', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('town', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('county', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('property_tenure', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('transaction_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('inspection_date', sa.DateTime(), nullable=False),
|
||||
sa.Column('current_sap', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('potential_sap', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('current_ei', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('potential_ei', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('current_annual_emissions', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('current_annual_emission_including_0925_multiplayer', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('current_annual_energy_costs', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('roofs',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('construction', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('insulation_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('insulation_thickness', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('u_value_known', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('showerandbaths',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('no_of_rooms_with_baths_and_or_shower', sa.Integer(), nullable=False),
|
||||
sa.Column('no_of_rooms_with_mixer_shower_and_no_baths', sa.Integer(), nullable=False),
|
||||
sa.Column('no_of_rooms_with_mixer_shower_and_baths', sa.Integer(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('solarwaterheating',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('solar_water_heating_details_known', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('ventilationandcooling',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('no_of_open_fireplaces', sa.Integer(), nullable=False),
|
||||
sa.Column('ventilation_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('space_cooling_system_present', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('walls',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('construction', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('insulation', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('insulation_thickness_mm', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('wall_thickness_measured', sa.Boolean(), nullable=False),
|
||||
sa.Column('wall_thickness_mm', sa.Integer(), nullable=True),
|
||||
sa.Column('u_value_known', sa.Boolean(), nullable=False),
|
||||
sa.Column('u_value_w_m2_k', sa.Float(), nullable=True),
|
||||
sa.Column('dry_lining', sa.Boolean(), nullable=False),
|
||||
sa.Column('alternative_wall_present', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('waterheating',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('heating_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('fuel_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('windturbine',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('wind_turbine', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('assessorinfo',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('accreditation_number', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('phone_number', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('email_address', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('company_id', sa.Uuid(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['company_id'], ['companyinfo.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('heating',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('heating_source', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('efficiency_source', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('heating_fuel', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('brand_name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('model_name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('model_qualifer', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('sap_2009_table', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('percentage_of_heated_floor_area_served', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('controls_id', sa.Uuid(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['controls_id'], ['heatingsystemcontrols.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('propertydetail',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('age_band', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('wall_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('roof_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('floor_id', sa.Uuid(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['floor_id'], ['floors.id'], ),
|
||||
sa.ForeignKeyConstraint(['roof_id'], ['roofs.id'], ),
|
||||
sa.ForeignKeyConstraint(['wall_id'], ['walls.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('dimension',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('floor_area_m2', sa.Float(), nullable=False),
|
||||
sa.Column('room_height_m', sa.Float(), nullable=False),
|
||||
sa.Column('loss_perimeter_m', sa.Float(), nullable=False),
|
||||
sa.Column('party_wall_length_m', sa.Float(), nullable=False),
|
||||
sa.Column('property_detail_id', sa.Uuid(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['property_detail_id'], ['propertydetail.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('documents',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('assessor_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('created_at', sa.DateTime(), nullable=False),
|
||||
sa.Column('document_type', sa.Enum('QUIDOS_PRESITE_NOTE', 'CHARTED_SURVEYOR_REPORT', 'ENERGY_PERFORMANCE_REPORT', 'U_VALUE_CALCULATOR_REPORT', 'OVERWRITING_U_VALUE_DECLARATION_FORM', name='reporttype'), nullable=False),
|
||||
sa.Column('building_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('target_table', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('target_id', sa.Uuid(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['assessor_id'], ['assessorinfo.id'], ),
|
||||
sa.ForeignKeyConstraint(['building_id'], ['buildings.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('propertydescription',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('built_form', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('detachment_or_position', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('no_of_main_property', sa.Integer(), nullable=False),
|
||||
sa.Column('no_of_extension_1', sa.Integer(), nullable=True),
|
||||
sa.Column('no_of_extension_2', sa.Integer(), nullable=True),
|
||||
sa.Column('no_of_extension_3', sa.Integer(), nullable=True),
|
||||
sa.Column('no_of_extension_4', sa.Integer(), nullable=True),
|
||||
sa.Column('no_of_habitable_rooms', sa.Integer(), nullable=False),
|
||||
sa.Column('no_of_heated_rooms', sa.Integer(), nullable=False),
|
||||
sa.Column('heated_basement', sa.Boolean(), nullable=False),
|
||||
sa.Column('conservatory_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('percentage_of_draught_proofed', sa.Integer(), nullable=False),
|
||||
sa.Column('terrain_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('conservatory', sa.Boolean(), nullable=False),
|
||||
sa.Column('main_property_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('ex1_property_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('ex2_property_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('ex3_property_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('ex4_property_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('door_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('ventilation_and_cooling_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('lighting_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('water_heating_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('hot_water_cylinder_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('solar_water_heating_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('shower_and_baths_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('flue_gas_heat_recovery_system_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('photovoltaic_panel_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('wind_turbine_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('other_details_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('main_heating_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('main_heating2_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('secondary_heating_type_id', sa.Uuid(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['door_id'], ['door.id'], ),
|
||||
sa.ForeignKeyConstraint(['ex1_property_id'], ['propertydetail.id'], ),
|
||||
sa.ForeignKeyConstraint(['ex2_property_id'], ['propertydetail.id'], ),
|
||||
sa.ForeignKeyConstraint(['ex3_property_id'], ['propertydetail.id'], ),
|
||||
sa.ForeignKeyConstraint(['ex4_property_id'], ['propertydetail.id'], ),
|
||||
sa.ForeignKeyConstraint(['flue_gas_heat_recovery_system_id'], ['fluegasheatrecoverysystem.id'], ),
|
||||
sa.ForeignKeyConstraint(['hot_water_cylinder_id'], ['hotwatercylinder.id'], ),
|
||||
sa.ForeignKeyConstraint(['lighting_id'], ['lighting.id'], ),
|
||||
sa.ForeignKeyConstraint(['main_heating2_id'], ['heating.id'], ),
|
||||
sa.ForeignKeyConstraint(['main_heating_id'], ['heating.id'], ),
|
||||
sa.ForeignKeyConstraint(['main_property_id'], ['propertydetail.id'], ),
|
||||
sa.ForeignKeyConstraint(['other_details_id'], ['otherdetails.id'], ),
|
||||
sa.ForeignKeyConstraint(['photovoltaic_panel_id'], ['photovoltaicpanel.id'], ),
|
||||
sa.ForeignKeyConstraint(['secondary_heating_type_id'], ['heatingtype.id'], ),
|
||||
sa.ForeignKeyConstraint(['shower_and_baths_id'], ['showerandbaths.id'], ),
|
||||
sa.ForeignKeyConstraint(['solar_water_heating_id'], ['solarwaterheating.id'], ),
|
||||
sa.ForeignKeyConstraint(['ventilation_and_cooling_id'], ['ventilationandcooling.id'], ),
|
||||
sa.ForeignKeyConstraint(['water_heating_id'], ['waterheating.id'], ),
|
||||
sa.ForeignKeyConstraint(['wind_turbine_id'], ['windturbine.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('windows',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('glazing_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('area_m2', sa.Float(), nullable=False),
|
||||
sa.Column('roof_window', sa.Boolean(), nullable=False),
|
||||
sa.Column('orientation', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('u_value_w_m2_k', sa.Integer(), nullable=False),
|
||||
sa.Column('g_value', sa.Integer(), nullable=False),
|
||||
sa.Column('property_detail_id', sa.Uuid(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['property_detail_id'], ['propertydetail.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('presitenote',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('summary_info_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('assessor_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('pre_site_note_description_id', sa.Uuid(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['assessor_id'], ['assessorinfo.id'], ),
|
||||
sa.ForeignKeyConstraint(['pre_site_note_description_id'], ['propertydescription.id'], ),
|
||||
sa.ForeignKeyConstraint(['summary_info_id'], ['presitenotessummaryinfo.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('presitenote')
|
||||
op.drop_table('windows')
|
||||
op.drop_table('propertydescription')
|
||||
op.drop_table('documents')
|
||||
op.drop_table('dimension')
|
||||
op.drop_table('propertydetail')
|
||||
op.drop_table('heating')
|
||||
op.drop_table('assessorinfo')
|
||||
op.drop_table('windturbine')
|
||||
op.drop_table('waterheating')
|
||||
op.drop_table('walls')
|
||||
op.drop_table('ventilationandcooling')
|
||||
op.drop_table('solarwaterheating')
|
||||
op.drop_table('showerandbaths')
|
||||
op.drop_table('roofs')
|
||||
op.drop_table('presitenotessummaryinfo')
|
||||
op.drop_table('photovoltaicpanel')
|
||||
op.drop_table('otherdetails')
|
||||
op.drop_table('lighting')
|
||||
op.drop_table('insulation')
|
||||
op.drop_table('hotwatercylinder')
|
||||
op.drop_table('heatingtype')
|
||||
op.drop_table('heatingsystemcontrols')
|
||||
op.drop_table('fluegasheatrecoverysystem')
|
||||
op.drop_table('floors')
|
||||
op.drop_table('door')
|
||||
op.drop_table('companyinfo')
|
||||
op.drop_table('buildings')
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -1,166 +0,0 @@
|
|||
"""condition table from osmosis added as i didn't add
|
||||
|
||||
Revision ID: 42a19efef660
|
||||
Revises: 956c4ea39b29
|
||||
Create Date: 2025-06-17 12:45:14.976944
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '42a19efef660'
|
||||
down_revision: Union[str, None] = '956c4ea39b29'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('assessordetails',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('assessor_name_and_id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('elmhurst_id', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('conservatoryoroutbuilding',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('is_there_a_conservatory', sa.Boolean(), nullable=False),
|
||||
sa.Column('is_there_a_cellar_present', sa.Boolean(), nullable=False),
|
||||
sa.Column('is_there_an_outbuilding', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('elevation',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('protected_conservatory_or_aonb', sa.Boolean(), nullable=False),
|
||||
sa.Column('material_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('are_there_any_visible_signs_of_existing_wall_insulation', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('does_the_existing_ground_level_on_any_elevation_bridge_the_dpc', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('elevationinfo',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('elevation_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('cavity_wall_depth', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('is_insulation_present', sa.Boolean(), nullable=False),
|
||||
sa.Column('insulation_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('externalelevation',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('structural_defects_of_elevation', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('does_any_structural_defect_need_resolving_before_retrofit', sa.Boolean(), nullable=False),
|
||||
sa.Column('are_there_any_signs_of_water_penetration_caused_by_failed_rainwater_goods_or_pipework', sa.Boolean(), nullable=False),
|
||||
sa.Column('are_there_any_visible_signs_of_movement', sa.Boolean(), nullable=False),
|
||||
sa.Column('are_there_any_visible_signs_of_cracking_to_the_existing_external_finish', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('generalconditionheatingsystem',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('is_the_heating_system_in_working_order', sa.Boolean(), nullable=False),
|
||||
sa.Column('does_the_occupant_have_a_smart_meter', sa.Boolean(), nullable=False),
|
||||
sa.Column('are_there_any_smart_monitoring_devices', sa.Boolean(), nullable=False),
|
||||
sa.Column('are_the_gas_and_electricity_meters_accessible', sa.Boolean(), nullable=False),
|
||||
sa.Column('dual_or_single_electric_meter', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('heating_from_condition_report',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('room_stat_in_temperature_in_celsius', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('room_stat_location', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('is_the_heating_pattern_known', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('inspectionandproject',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('inspection_date', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('mainheatingone',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('as_defined_by', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('fuel', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('mainheatingtwo',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('is_there_a_main_heating_two', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('propertyaccess',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('are_there_any_road_restriction_in_the_locality', sa.Boolean(), nullable=False),
|
||||
sa.Column('is_on_street_parking_available', sa.Boolean(), nullable=False),
|
||||
sa.Column('are_there_any_overhead_wires_or_cables', sa.Boolean(), nullable=False),
|
||||
sa.Column('is_the_access_gated', sa.Boolean(), nullable=False),
|
||||
sa.Column('is_there_restricted_space_for_contractors_to_access_the_wall_area', sa.Boolean(), nullable=False),
|
||||
sa.Column('is_there_restricted_space_for_contractors_to_access_the_roof_area', sa.Boolean(), nullable=False),
|
||||
sa.Column('is_there_more_than_1_point_5_meters_in_width_to_fence_or_neighbouring_boundary_along_the_full_gable_elevation', sa.Boolean(), nullable=False),
|
||||
sa.Column('is_access_to_the_rear_provided_by_use_of_a_ginnel', sa.Boolean(), nullable=False),
|
||||
sa.Column('is_access_to_the_rear_provided_by_use_of_a_secured_alleyway', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('secondaryheating',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('is_there_a_secondary_heating', sa.Boolean(), nullable=False),
|
||||
sa.Column('fuel', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('electric_heating_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('gas_heating_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('theproperty',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('house_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('on_which_floor_is_the_flat_located', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('is_there_a_corridor', sa.Boolean(), nullable=False),
|
||||
sa.Column('is_it_heated', sa.Boolean(), nullable=False),
|
||||
sa.Column('it_there_a_balcony', sa.Boolean(), nullable=False),
|
||||
sa.Column('classification_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('orientation_front_elevation', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('orientation_in_degrees_front_elevation', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('exposure_zone', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('main_wall_construction', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_table('conditionreport',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('project_site_name', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('property_reference_code', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('property_address', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('postcode', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('assessor_details_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('inspection_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('property_id', sa.Uuid(), nullable=True),
|
||||
sa.Column('general_condition_id', sa.Uuid(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['assessor_details_id'], ['assessordetails.id'], ),
|
||||
sa.ForeignKeyConstraint(['general_condition_id'], ['generalconditionheatingsystem.id'], ),
|
||||
sa.ForeignKeyConstraint(['inspection_id'], ['inspectionandproject.id'], ),
|
||||
sa.ForeignKeyConstraint(['property_id'], ['theproperty.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('conditionreport')
|
||||
op.drop_table('theproperty')
|
||||
op.drop_table('secondaryheating')
|
||||
op.drop_table('propertyaccess')
|
||||
op.drop_table('mainheatingtwo')
|
||||
op.drop_table('mainheatingone')
|
||||
op.drop_table('inspectionandproject')
|
||||
op.drop_table('heating_from_condition_report')
|
||||
op.drop_table('generalconditionheatingsystem')
|
||||
op.drop_table('externalelevation')
|
||||
op.drop_table('elevationinfo')
|
||||
op.drop_table('elevation')
|
||||
op.drop_table('conservatoryoroutbuilding')
|
||||
op.drop_table('assessordetails')
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -1,132 +0,0 @@
|
|||
"""add elevation
|
||||
|
||||
Revision ID: 544f060f1eb8
|
||||
Revises: 881142a89edb
|
||||
Create Date: 2025-06-19 09:54:43.770068
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '544f060f1eb8'
|
||||
down_revision: Union[str, None] = '881142a89edb'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_table('secondaryheating')
|
||||
op.drop_table('heating_from_condition_report')
|
||||
op.drop_table('generalconditionheatingsystem')
|
||||
op.drop_table('conditionreport')
|
||||
op.drop_table('mainheatingtwo')
|
||||
op.drop_table('conservatoryoroutbuilding')
|
||||
op.drop_table('mainheatingone')
|
||||
op.drop_table('elevation')
|
||||
op.drop_table('generalinformation')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('elevation',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('protected_conservatory_or_aonb', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('material_type', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_there_any_visible_signs_of_existing_wall_insulation', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('does_the_existing_ground_level_on_any_elevation_bridge_the_dpc', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='elevation_pkey')
|
||||
)
|
||||
op.create_table('mainheatingone',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('as_defined_by', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('fuel', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('type', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='mainheatingone_pkey')
|
||||
)
|
||||
op.create_table('conservatoryoroutbuilding',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_a_conservatory', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_a_cellar_present', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_an_outbuilding', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='conservatoryoroutbuilding_pkey')
|
||||
)
|
||||
op.create_table('mainheatingtwo',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_a_main_heating_two', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='mainheatingtwo_pkey')
|
||||
)
|
||||
op.create_table('conditionreport',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('project_site_name', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('property_reference_code', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('property_address', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('postcode', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('general_information_id', sa.UUID(), autoincrement=False, nullable=True),
|
||||
sa.ForeignKeyConstraint(['general_information_id'], ['generalinformation.id'], name='conditionreport_general_information_id_fkey'),
|
||||
sa.PrimaryKeyConstraint('id', name='conditionreport_pkey')
|
||||
)
|
||||
op.create_table('generalconditionheatingsystem',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_the_heating_system_in_working_order', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('does_the_occupant_have_a_smart_meter', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_there_any_smart_monitoring_devices', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_the_gas_and_electricity_meters_accessible', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('dual_or_single_electric_meter', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='generalconditionheatingsystem_pkey')
|
||||
)
|
||||
op.create_table('heating_from_condition_report',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('room_stat_in_temperature_in_celsius', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('room_stat_location', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('is_the_heating_pattern_known', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.PrimaryKeyConstraint('id', name='heating_from_condition_report_pkey')
|
||||
)
|
||||
op.create_table('externalelevation',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('structural_defects_of_elevation', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('does_any_structural_defect_need_resolving_before_retrofit', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_there_any_signs_of_water_penetration_caused_by_failed_rainw', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_there_any_visible_signs_of_movement', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_there_any_visible_signs_of_cracking_to_the_existing_externa', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='externalelevation_pkey')
|
||||
)
|
||||
op.create_table('generalinformation',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('assessor_details_id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('inspection_and_project_id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('the_property_id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.ForeignKeyConstraint(['assessor_details_id'], ['assessordetails.id'], name='generalinformation_assessor_details_id_fkey'),
|
||||
sa.ForeignKeyConstraint(['inspection_and_project_id'], ['inspectionandproject.id'], name='generalinformation_inspection_and_project_id_fkey'),
|
||||
sa.ForeignKeyConstraint(['the_property_id'], ['theproperty.id'], name='generalinformation_the_property_id_fkey'),
|
||||
sa.PrimaryKeyConstraint('id', name='generalinformation_pkey')
|
||||
)
|
||||
op.create_table('secondaryheating',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_a_secondary_heating', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('fuel', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('electric_heating_type', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('gas_heating_type', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='secondaryheating_pkey')
|
||||
)
|
||||
op.create_table('propertyaccess',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_there_any_road_restriction_in_the_locality', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_on_street_parking_available', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_there_any_overhead_wires_or_cables', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_the_access_gated', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_restricted_space_for_contractors_to_access_the_wall_ar', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_restricted_space_for_contractors_to_access_the_roof_ar', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_more_than_1_point_5_meters_in_width_to_fence_or_neighb', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_access_to_the_rear_provided_by_use_of_a_ginnel', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_access_to_the_rear_provided_by_use_of_a_secured_alleyway', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='propertyaccess_pkey')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
"""add general information class
|
||||
|
||||
Revision ID: 771a2bc48ac2
|
||||
Revises: f2f205448dff
|
||||
Create Date: 2025-06-18 14:56:08.762223
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '771a2bc48ac2'
|
||||
down_revision: Union[str, None] = 'f2f205448dff'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('generalinformation',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('assessor_details_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('inspection_and_project_id', sa.Uuid(), nullable=False),
|
||||
sa.Column('the_property_id', sa.Uuid(), nullable=False),
|
||||
sa.ForeignKeyConstraint(['assessor_details_id'], ['assessordetails.id'], ),
|
||||
sa.ForeignKeyConstraint(['inspection_and_project_id'], ['inspectionandproject.id'], ),
|
||||
sa.ForeignKeyConstraint(['the_property_id'], ['theproperty.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.add_column('conditionreport', sa.Column('general_information_id', sa.Uuid(), nullable=True))
|
||||
op.drop_constraint('conditionreport_general_condition_id_fkey', 'conditionreport', type_='foreignkey')
|
||||
op.drop_constraint('conditionreport_assessor_details_id_fkey', 'conditionreport', type_='foreignkey')
|
||||
op.create_foreign_key(None, 'conditionreport', 'generalinformation', ['general_information_id'], ['id'])
|
||||
op.drop_column('conditionreport', 'general_condition_id')
|
||||
op.drop_column('conditionreport', 'assessor_details_id')
|
||||
op.add_column('externalelevation', sa.Column('are_there_any_signs_of_water_penetration_caused_by_failed_rainwater_goods_or_pipework', sa.Boolean(), nullable=False))
|
||||
op.add_column('externalelevation', sa.Column('are_there_any_visible_signs_of_cracking_to_the_existing_external_finish', sa.Boolean(), nullable=False))
|
||||
op.drop_column('externalelevation', 'water_penetration_from_failed_rainwater_goods')
|
||||
op.drop_column('externalelevation', 'cracking_to_external_finish_visible')
|
||||
op.add_column('propertyaccess', sa.Column('is_there_restricted_space_for_contractors_to_access_the_wall_area', sa.Boolean(), nullable=False))
|
||||
op.add_column('propertyaccess', sa.Column('is_there_restricted_space_for_contractors_to_access_the_roof_area', sa.Boolean(), nullable=False))
|
||||
op.add_column('propertyaccess', sa.Column('is_there_more_than_1_point_5_meters_in_width_to_fence_or_neighbouring_boundary_along_the_full_gable_elevation', sa.Boolean(), nullable=False))
|
||||
op.drop_column('propertyaccess', 'sufficient_boundary_width')
|
||||
op.drop_column('propertyaccess', 'restricted_wall_access')
|
||||
op.drop_column('propertyaccess', 'restricted_roof_access')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('propertyaccess', sa.Column('restricted_roof_access', sa.BOOLEAN(), autoincrement=False, nullable=False))
|
||||
op.add_column('propertyaccess', sa.Column('restricted_wall_access', sa.BOOLEAN(), autoincrement=False, nullable=False))
|
||||
op.add_column('propertyaccess', sa.Column('sufficient_boundary_width', sa.BOOLEAN(), autoincrement=False, nullable=False))
|
||||
op.drop_column('propertyaccess', 'is_there_more_than_1_point_5_meters_in_width_to_fence_or_neighbouring_boundary_along_the_full_gable_elevation')
|
||||
op.drop_column('propertyaccess', 'is_there_restricted_space_for_contractors_to_access_the_roof_area')
|
||||
op.drop_column('propertyaccess', 'is_there_restricted_space_for_contractors_to_access_the_wall_area')
|
||||
op.add_column('externalelevation', sa.Column('cracking_to_external_finish_visible', sa.BOOLEAN(), autoincrement=False, nullable=False))
|
||||
op.add_column('externalelevation', sa.Column('water_penetration_from_failed_rainwater_goods', sa.BOOLEAN(), autoincrement=False, nullable=False))
|
||||
op.drop_column('externalelevation', 'are_there_any_visible_signs_of_cracking_to_the_existing_external_finish')
|
||||
op.drop_column('externalelevation', 'are_there_any_signs_of_water_penetration_caused_by_failed_rainwater_goods_or_pipework')
|
||||
op.add_column('conditionreport', sa.Column('assessor_details_id', sa.UUID(), autoincrement=False, nullable=True))
|
||||
op.add_column('conditionreport', sa.Column('general_condition_id', sa.UUID(), autoincrement=False, nullable=True))
|
||||
op.drop_constraint(None, 'conditionreport', type_='foreignkey')
|
||||
op.create_foreign_key('conditionreport_assessor_details_id_fkey', 'conditionreport', 'assessordetails', ['assessor_details_id'], ['id'])
|
||||
op.create_foreign_key('conditionreport_general_condition_id_fkey', 'conditionreport', 'generalconditionheatingsystem', ['general_condition_id'], ['id'])
|
||||
op.drop_column('conditionreport', 'general_information_id')
|
||||
op.drop_table('generalinformation')
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -1,176 +0,0 @@
|
|||
"""delete everythign and start again
|
||||
|
||||
Revision ID: 881142a89edb
|
||||
Revises: 771a2bc48ac2
|
||||
Create Date: 2025-06-18 15:38:53.955796
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '881142a89edb'
|
||||
down_revision: Union[str, None] = '771a2bc48ac2'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.execute("DROP TABLE conditionreport CASCADE")
|
||||
op.execute("DROP TABLE generalinformation CASCADE")
|
||||
op.execute("DROP TABLE theproperty CASCADE")
|
||||
op.execute("DROP TABLE assessordetails CASCADE")
|
||||
op.execute("DROP TABLE inspectionandproject CASCADE")
|
||||
op.execute("DROP TABLE propertyaccess CASCADE")
|
||||
op.execute("DROP TABLE externalelevation CASCADE")
|
||||
op.execute("DROP TABLE generalconditionheatingsystem CASCADE")
|
||||
op.execute("DROP TABLE heating_from_condition_report CASCADE")
|
||||
op.execute("DROP TABLE mainheatingone CASCADE")
|
||||
op.execute("DROP TABLE mainheatingtwo CASCADE")
|
||||
op.execute("DROP TABLE secondaryheating CASCADE")
|
||||
op.execute("DROP TABLE conservatoryoroutbuilding CASCADE")
|
||||
op.execute("DROP TABLE elevation CASCADE")
|
||||
op.execute("DROP TABLE elevationinfo CASCADE")
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('inspectionandproject',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('inspection_date', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='inspectionandproject_pkey'),
|
||||
postgresql_ignore_search_path=False
|
||||
)
|
||||
op.create_table('elevation',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('protected_conservatory_or_aonb', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('material_type', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_there_any_visible_signs_of_existing_wall_insulation', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('does_the_existing_ground_level_on_any_elevation_bridge_the_dpc', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='elevation_pkey')
|
||||
)
|
||||
op.create_table('mainheatingone',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('as_defined_by', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('fuel', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('type', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='mainheatingone_pkey')
|
||||
)
|
||||
op.create_table('assessordetails',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('assessor_name_and_id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('elmhurst_id', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='assessordetails_pkey'),
|
||||
postgresql_ignore_search_path=False
|
||||
)
|
||||
op.create_table('elevationinfo',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('elevation_type', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('cavity_wall_depth', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_insulation_present', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('insulation_type', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='elevationinfo_pkey')
|
||||
)
|
||||
op.create_table('externalelevation',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('structural_defects_of_elevation', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('does_any_structural_defect_need_resolving_before_retrofit', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_there_any_signs_of_water_penetration_caused_by_failed_rainw', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_there_any_visible_signs_of_movement', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_there_any_visible_signs_of_cracking_to_the_existing_externa', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='externalelevation_pkey')
|
||||
)
|
||||
op.create_table('conditionreport',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('project_site_name', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('property_reference_code', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('property_address', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('postcode', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('inspection_id', sa.UUID(), autoincrement=False, nullable=True),
|
||||
sa.Column('property_id', sa.UUID(), autoincrement=False, nullable=True),
|
||||
sa.Column('general_information_id', sa.UUID(), autoincrement=False, nullable=True),
|
||||
sa.ForeignKeyConstraint(['inspection_id'], ['inspectionandproject.id'], name='conditionreport_inspection_id_fkey'),
|
||||
sa.ForeignKeyConstraint(['property_id'], ['theproperty.id'], name='conditionreport_property_id_fkey'),
|
||||
sa.PrimaryKeyConstraint('id', name='conditionreport_pkey')
|
||||
)
|
||||
op.create_table('theproperty',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('house_type', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('on_which_floor_is_the_flat_located', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_a_corridor', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_it_heated', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('it_there_a_balcony', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('classification_type', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('orientation_front_elevation', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('orientation_in_degrees_front_elevation', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('exposure_zone', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('main_wall_construction', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='theproperty_pkey'),
|
||||
postgresql_ignore_search_path=False
|
||||
)
|
||||
op.create_table('generalconditionheatingsystem',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_the_heating_system_in_working_order', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('does_the_occupant_have_a_smart_meter', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_there_any_smart_monitoring_devices', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_the_gas_and_electricity_meters_accessible', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('dual_or_single_electric_meter', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='generalconditionheatingsystem_pkey')
|
||||
)
|
||||
op.create_table('mainheatingtwo',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_a_main_heating_two', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='mainheatingtwo_pkey')
|
||||
)
|
||||
op.create_table('generalinformation',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('assessor_details_id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('inspection_and_project_id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('the_property_id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.ForeignKeyConstraint(['assessor_details_id'], ['assessordetails.id'], name='generalinformation_assessor_details_id_fkey'),
|
||||
sa.ForeignKeyConstraint(['inspection_and_project_id'], ['inspectionandproject.id'], name='generalinformation_inspection_and_project_id_fkey'),
|
||||
sa.ForeignKeyConstraint(['the_property_id'], ['theproperty.id'], name='generalinformation_the_property_id_fkey'),
|
||||
sa.PrimaryKeyConstraint('id', name='generalinformation_pkey')
|
||||
)
|
||||
op.create_table('heating_from_condition_report',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('room_stat_in_temperature_in_celsius', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('room_stat_location', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.Column('is_the_heating_pattern_known', sa.VARCHAR(), autoincrement=False, nullable=True),
|
||||
sa.PrimaryKeyConstraint('id', name='heating_from_condition_report_pkey')
|
||||
)
|
||||
op.create_table('propertyaccess',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_there_any_road_restriction_in_the_locality', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_on_street_parking_available', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('are_there_any_overhead_wires_or_cables', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_the_access_gated', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_restricted_space_for_contractors_to_access_the_wall_ar', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_restricted_space_for_contractors_to_access_the_roof_ar', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_more_than_1_point_5_meters_in_width_to_fence_or_neighb', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_access_to_the_rear_provided_by_use_of_a_ginnel', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_access_to_the_rear_provided_by_use_of_a_secured_alleyway', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='propertyaccess_pkey')
|
||||
)
|
||||
op.create_table('secondaryheating',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_a_secondary_heating', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('fuel', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('electric_heating_type', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.Column('gas_heating_type', sa.VARCHAR(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='secondaryheating_pkey')
|
||||
)
|
||||
op.create_table('conservatoryoroutbuilding',
|
||||
sa.Column('id', sa.UUID(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_a_conservatory', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_a_cellar_present', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.Column('is_there_an_outbuilding', sa.BOOLEAN(), autoincrement=False, nullable=False),
|
||||
sa.PrimaryKeyConstraint('id', name='conservatoryoroutbuilding_pkey')
|
||||
)
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
"""condition table from osmosis
|
||||
|
||||
Revision ID: 956c4ea39b29
|
||||
Revises: 427e65da69c1
|
||||
Create Date: 2025-06-17 10:49:55.213111
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '956c4ea39b29'
|
||||
down_revision: Union[str, None] = '427e65da69c1'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_foreign_key(None, 'documents', 'assessorinfo', ['assessor_id'], ['id'])
|
||||
op.create_foreign_key(None, 'presitenote', 'assessorinfo', ['assessor_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'presitenote', type_='foreignkey')
|
||||
op.drop_constraint(None, 'documents', type_='foreignkey')
|
||||
# ### end Alembic commands ###
|
||||
45
alembic/versions/a6e4562797e4_add_new_uploaded_file_table.py
Normal file
45
alembic/versions/a6e4562797e4_add_new_uploaded_file_table.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
"""add new uploaded file table
|
||||
|
||||
Revision ID: a6e4562797e4
|
||||
Revises:
|
||||
Create Date: 2025-08-14 14:44:40.992608
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'a6e4562797e4'
|
||||
down_revision: Union[str, None] = None
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('uploaded_files',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('s3_json_uri', sqlmodel.sql.sqltypes.AutoString(), nullable=True),
|
||||
sa.Column('s3_file_uri', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('doc_type', sa.Enum('QUIDOS_PRESITE_NOTE', 'CHARTED_SURVEYOR_REPORT', 'U_VALUE_CALCULATOR_REPORT', 'OVERWRITING_U_VALUE_DECLARATION_FORM', 'ECO_CONDITION_REPORT', 'WARM_HOMES_CONDITION_REPORT', 'ENERGY_PERFORMANCE_REPORT_WITH_DATA', 'ENERGY_PERFORMANCE_REPORT_SUMMARY_INFORMATION', 'LIG_XML', 'RDSAP_XML', 'FULLSAP_XML', name='reporttype'), nullable=False),
|
||||
sa.Column('s3_file_upload_timestamp', sa.DateTime(), nullable=False),
|
||||
sa.Column('s3_json_upload_timestamp', sa.DateTime(), nullable=True),
|
||||
sa.Column('uprn', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_uploaded_files_s3_file_uri'), 'uploaded_files', ['s3_file_uri'], unique=False)
|
||||
op.create_index(op.f('ix_uploaded_files_uprn'), 'uploaded_files', ['uprn'], unique=False)
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_index(op.f('ix_uploaded_files_uprn'), table_name='uploaded_files')
|
||||
op.drop_index(op.f('ix_uploaded_files_s3_file_uri'), table_name='uploaded_files')
|
||||
op.drop_table('uploaded_files')
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
"""is there an fourth external elevation
|
||||
|
||||
Revision ID: c373a9a083f1
|
||||
Revises: ceffde5b28ac
|
||||
Create Date: 2025-06-20 15:08:31.752580
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'c373a9a083f1'
|
||||
down_revision: Union[str, None] = 'ceffde5b28ac'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('externalelevationgabletwo', sa.Column('is_there_a_fourth_external_elevation', sa.Boolean(), nullable=False))
|
||||
op.drop_column('externalelevationgabletwo', 'do_all_answers_for_the_front_elevation_apply_to_this_wall')
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('externalelevationgabletwo', sa.Column('do_all_answers_for_the_front_elevation_apply_to_this_wall', sa.BOOLEAN(), autoincrement=False, nullable=False))
|
||||
op.drop_column('externalelevationgabletwo', 'is_there_a_fourth_external_elevation')
|
||||
op.add_column('externalelevation', sa.Column('are_there_any_visible_signs_of_cracking_to_the_existing_externa', sa.BOOLEAN(), autoincrement=False, nullable=False))
|
||||
op.add_column('externalelevation', sa.Column('any_signs_of_water_penetration_caused_by_failed_rainwater_goods', sa.BOOLEAN(), autoincrement=False, nullable=False))
|
||||
op.drop_column('externalelevation', 'are_there_any_visible_signs_of_cracking_to_the_existing_external_finish')
|
||||
op.drop_column('externalelevation', 'any_signs_of_water_penetration_caused_by_failed_rainwater_goods_or_pipework')
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
"""added new column
|
||||
|
||||
Revision ID: ceffde5b28ac
|
||||
Revises: 544f060f1eb8
|
||||
Create Date: 2025-06-19 10:23:37.567361
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'ceffde5b28ac'
|
||||
down_revision: Union[str, None] = '544f060f1eb8'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('elevation',
|
||||
sa.Column('id', sa.Uuid(), nullable=False),
|
||||
sa.Column('protected_conservatory_or_aonb', sa.Boolean(), nullable=False),
|
||||
sa.Column('material_type', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('visible_signs_of_existing_wall_insulation', sqlmodel.sql.sqltypes.AutoString(), nullable=False),
|
||||
sa.Column('ground_level_bridge_the_dpc', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.add_column('elevationinfo', sa.Column('elevation_id', sa.Uuid(), nullable=True))
|
||||
op.create_foreign_key(None, 'elevationinfo', 'elevation', ['elevation_id'], ['id'])
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_constraint(None, 'elevationinfo', type_='foreignkey')
|
||||
op.drop_column('elevationinfo', 'elevation_id')
|
||||
op.drop_table('elevation')
|
||||
# ### end Alembic commands ###
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
"""rename ntables
|
||||
|
||||
Revision ID: f2f205448dff
|
||||
Revises: 42a19efef660
|
||||
Create Date: 2025-06-18 10:09:39.973162
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
import sqlmodel
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = 'f2f205448dff'
|
||||
down_revision: Union[str, None] = '42a19efef660'
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
"""Upgrade schema."""
|
||||
# Drop foreign keys referencing 'heating'
|
||||
op.drop_constraint('propertydescription_main_heating_id_fkey', 'propertydescription', type_='foreignkey')
|
||||
op.drop_constraint('propertydescription_main_heating2_id_fkey', 'propertydescription', type_='foreignkey')
|
||||
|
||||
# Rename 'heating' table to 'heatingfrompresitenotes'
|
||||
op.rename_table('heating', 'heatingfrompresitenotes')
|
||||
|
||||
# Rename/re-add cleaned up columns (ensure you're within 63 char limit!)
|
||||
op.drop_column('externalelevation', 'are_there_any_visible_signs_of_cracking_to_the_existing_externa')
|
||||
op.drop_column('externalelevation', 'are_there_any_signs_of_water_penetration_caused_by_failed_rainw')
|
||||
op.add_column('externalelevation', sa.Column(
|
||||
'water_penetration_from_failed_rainwater_goods', sa.Boolean(), nullable=False))
|
||||
op.add_column('externalelevation', sa.Column(
|
||||
'cracking_to_external_finish_visible', sa.Boolean(), nullable=False))
|
||||
|
||||
# Update propertyaccess fields
|
||||
op.drop_column('propertyaccess', 'is_there_restricted_space_for_contractors_to_access_the_wall_ar')
|
||||
op.drop_column('propertyaccess', 'is_there_restricted_space_for_contractors_to_access_the_roof_ar')
|
||||
op.drop_column('propertyaccess', 'is_there_more_than_1_point_5_meters_in_width_to_fence_or_neighb')
|
||||
op.add_column('propertyaccess', sa.Column(
|
||||
'restricted_wall_access', sa.Boolean(), nullable=False))
|
||||
op.add_column('propertyaccess', sa.Column(
|
||||
'restricted_roof_access', sa.Boolean(), nullable=False))
|
||||
op.add_column('propertyaccess', sa.Column(
|
||||
'sufficient_boundary_width', sa.Boolean(), nullable=False))
|
||||
|
||||
# Create new foreign keys to heatingfrompresitenotes
|
||||
op.create_foreign_key('propertydescription_main_heating_id_fkey', 'propertydescription', 'heatingfrompresitenotes', ['main_heating_id'], ['id'])
|
||||
op.create_foreign_key('propertydescription_main_heating2_id_fkey', 'propertydescription', 'heatingfrompresitenotes', ['main_heating2_id'], ['id'])
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# Drop new foreign keys
|
||||
op.drop_constraint('propertydescription_main_heating_id_fkey', 'propertydescription', type_='foreignkey')
|
||||
op.drop_constraint('propertydescription_main_heating2_id_fkey', 'propertydescription', type_='foreignkey')
|
||||
|
||||
# Rename 'heatingfrompresitenotes' back to 'heating'
|
||||
op.rename_table('heatingfrompresitenotes', 'heating')
|
||||
|
||||
# Revert column changes
|
||||
op.drop_column('externalelevation', 'water_penetration_from_failed_rainwater_goods')
|
||||
op.drop_column('externalelevation', 'cracking_to_external_finish_visible')
|
||||
op.add_column('externalelevation', sa.Column('are_there_any_signs_of_water_penetration_caused_by_failed_rainw', sa.Boolean(), nullable=False))
|
||||
op.add_column('externalelevation', sa.Column('are_there_any_visible_signs_of_cracking_to_the_existing_externa', sa.Boolean(), nullable=False))
|
||||
|
||||
op.drop_column('propertyaccess', 'restricted_wall_access')
|
||||
op.drop_column('propertyaccess', 'restricted_roof_access')
|
||||
op.drop_column('propertyaccess', 'sufficient_boundary_width')
|
||||
op.add_column('propertyaccess', sa.Column('is_there_restricted_space_for_contractors_to_access_the_wall_ar', sa.Boolean(), nullable=False))
|
||||
op.add_column('propertyaccess', sa.Column('is_there_restricted_space_for_contractors_to_access_the_roof_ar', sa.Boolean(), nullable=False))
|
||||
op.add_column('propertyaccess', sa.Column('is_there_more_than_1_point_5_meters_in_width_to_fence_or_neighb', sa.Boolean(), nullable=False))
|
||||
|
||||
# Restore original foreign keys
|
||||
op.create_foreign_key('propertydescription_main_heating_id_fkey', 'propertydescription', 'heating', ['main_heating_id'], ['id'])
|
||||
op.create_foreign_key('propertydescription_main_heating2_id_fkey', 'propertydescription', 'heating', ['main_heating2_id'], ['id'])
|
||||
|
|
@ -1,386 +1,386 @@
|
|||
# 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
|
||||
# # 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 AssessorDetails(BaseModel, table=True):
|
||||
# assessor_name_and_id: str
|
||||
# elmhurst_id: str
|
||||
|
||||
class InspectionAndProject(BaseModel, table=True):
|
||||
inspection_date: 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 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
|
||||
# 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")
|
||||
# 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")
|
||||
# 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")
|
||||
# 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")
|
||||
# #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
|
||||
# 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")
|
||||
# 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")
|
||||
# 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()
|
||||
# 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 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 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 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 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 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 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 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")
|
||||
# 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()
|
||||
# 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 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 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
|
||||
# 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_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()
|
||||
# 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 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 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 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 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 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 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 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 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 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 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()
|
||||
# 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")
|
||||
# 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()
|
||||
# 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()
|
||||
# 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()
|
||||
# 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()
|
||||
# kitchen_id: uuid.UUID = Field(foreign_key="kitchen.id")
|
||||
# kitchen: Kitchen = Relationship()
|
||||
|
||||
utility_id: uuid.UUID = Field(foreign_key="utility.id")
|
||||
utility: Utility = 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()
|
||||
# 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()
|
||||
# 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()
|
||||
# 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()
|
||||
# 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")
|
||||
# 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 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 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 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 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 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 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()
|
||||
# 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_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()
|
||||
# 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()
|
||||
# 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()
|
||||
# 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()
|
||||
# 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
|
||||
# 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
|
||||
|
||||
|
||||
class EnergyUse(BaseModel, table=True):
|
||||
property_tenure: str
|
||||
who_is_the_electricity_payer: str
|
||||
# class EnergyUse(BaseModel, table=True):
|
||||
# property_tenure: str
|
||||
# who_is_the_electricity_payer: str
|
||||
|
||||
|
||||
class HeatingFromConditionReport(BaseModel, table=True):
|
||||
room_stat_in_temperature_in_celsius: Optional[str] = None
|
||||
room_stat_location: Optional[str] = None
|
||||
is_the_heating_pattern_known: Optional[str] = None
|
||||
# class HeatingFromConditionReport(BaseModel, table=True):
|
||||
# room_stat_in_temperature_in_celsius: Optional[str] = None
|
||||
# room_stat_location: Optional[str] = None
|
||||
# is_the_heating_pattern_known: Optional[str] = None
|
||||
|
||||
class ShowerAndBath(BaseModel, table=True):
|
||||
shower_type: str
|
||||
do_you_know_the_no_of_showers_per_day_per_week: bool
|
||||
please_input_no_of_showers_and_specify_a_day_or_a_week: str
|
||||
do_you_know_the_number_of_baths_per_day_or_per_week: str
|
||||
# class ShowerAndBath(BaseModel, table=True):
|
||||
# shower_type: str
|
||||
# do_you_know_the_no_of_showers_per_day_per_week: bool
|
||||
# please_input_no_of_showers_and_specify_a_day_or_a_week: str
|
||||
# do_you_know_the_number_of_baths_per_day_or_per_week: str
|
||||
|
||||
class FridgeAndFreezers(BaseModel, table=True):
|
||||
no_of_stand_alone_seperate_fridges: int
|
||||
no_of_stand_alone_seperate_freezers: int
|
||||
no_of_stand_alone_or_integrated_fridge_freezers: int
|
||||
# class FridgeAndFreezers(BaseModel, table=True):
|
||||
# no_of_stand_alone_seperate_fridges: int
|
||||
# no_of_stand_alone_seperate_freezers: int
|
||||
# no_of_stand_alone_or_integrated_fridge_freezers: int
|
||||
|
||||
class Cooker(BaseModel,table=True):
|
||||
range_fuel: str
|
||||
normal_large_range: str
|
||||
cooker_type: str
|
||||
# class Cooker(BaseModel,table=True):
|
||||
# range_fuel: str
|
||||
# normal_large_range: str
|
||||
# cooker_type: str
|
||||
|
||||
class TumbleDryer(BaseModel, table=True):
|
||||
percentage_of_annual_use: int
|
||||
space_for_outdoor_drying: bool
|
||||
# class TumbleDryer(BaseModel, table=True):
|
||||
# percentage_of_annual_use: int
|
||||
# space_for_outdoor_drying: bool
|
||||
|
||||
class OccupantAssessment(BaseModel, table=True):
|
||||
occupant_id: uuid.UUID = Field(foreign_key="occupant.id")
|
||||
occupant: Occupant = Relationship()
|
||||
# class OccupantAssessment(BaseModel, table=True):
|
||||
# occupant_id: uuid.UUID = Field(foreign_key="occupant.id")
|
||||
# occupant: Occupant = Relationship()
|
||||
|
||||
energy_use_id: uuid.UUID = Field(foreign_key="energyuse.id")
|
||||
energy_use: EnergyUse = Relationship()
|
||||
# energy_use_id: uuid.UUID = Field(foreign_key="energyuse.id")
|
||||
# energy_use: EnergyUse = Relationship()
|
||||
|
||||
heating_id: uuid.UUID = Field(foreign_key="heatingfromconditionreport.id")
|
||||
heating: HeatingFromConditionReport = Relationship()
|
||||
# heating_id: uuid.UUID = Field(foreign_key="heatingfromconditionreport.id")
|
||||
# heating: HeatingFromConditionReport = Relationship()
|
||||
|
||||
shower_and_bath_id: uuid.UUID = Field(foreign_key="showerandbath.id")
|
||||
shower_and_bath: ShowerAndBath = Relationship()
|
||||
# shower_and_bath_id: uuid.UUID = Field(foreign_key="showerandbath.id")
|
||||
# shower_and_bath: ShowerAndBath = Relationship()
|
||||
|
||||
# appliances: Optional[Appliances]
|
||||
# appliances_id
|
||||
# # appliances: Optional[Appliances]
|
||||
# # appliances_id
|
||||
|
||||
fridge_and_freezers_id: uuid.UUID = Field(foreign_key="fridgeandfreezers.id")
|
||||
fridge_and_freezers: FridgeAndFreezers = Relationship()
|
||||
# fridge_and_freezers_id: uuid.UUID = Field(foreign_key="fridgeandfreezers.id")
|
||||
# fridge_and_freezers: FridgeAndFreezers = Relationship()
|
||||
|
||||
cooker_id: uuid.UUID = Field(foreign_key="cooker.id")
|
||||
cooker: Cooker = Relationship()
|
||||
# cooker_id: uuid.UUID = Field(foreign_key="cooker.id")
|
||||
# cooker: Cooker = Relationship()
|
||||
|
||||
tumble_dryer_id: uuid.UUID = Field(foreign_key="tumbledryer.id")
|
||||
tumble_dryer: TumbleDryer = Relationship()
|
||||
# tumble_dryer_id: uuid.UUID = Field(foreign_key="tumbledryer.id")
|
||||
# tumble_dryer: TumbleDryer = Relationship()
|
||||
|
||||
class ConditionReportModel(BaseModel, table=True):
|
||||
project_site_name: str
|
||||
property_reference_code: str
|
||||
property_address: str
|
||||
postcode: str
|
||||
# class ConditionReportModel(BaseModel, table=True):
|
||||
# project_site_name: str
|
||||
# property_reference_code: str
|
||||
# property_address: str
|
||||
# postcode: str
|
||||
|
||||
general_information_id: uuid.UUID = Field(foreign_key="generalinformation.id")
|
||||
general_information: GeneralInformation = Relationship()
|
||||
# general_information_id: uuid.UUID = Field(foreign_key="generalinformation.id")
|
||||
# general_information: GeneralInformation = Relationship()
|
||||
|
||||
access_and_elevations_id: uuid.UUID = Field(foreign_key="accessandelevations.id")
|
||||
access_and_elevations: AccessAndElevations = Relationship()
|
||||
# access_and_elevations_id: uuid.UUID = Field(foreign_key="accessandelevations.id")
|
||||
# access_and_elevations: AccessAndElevations = Relationship()
|
||||
|
||||
rooms_id: uuid.UUID = Field(foreign_key="rooms.id")
|
||||
rooms: Rooms = Relationship()
|
||||
# rooms_id: uuid.UUID = Field(foreign_key="rooms.id")
|
||||
# rooms: Rooms = Relationship()
|
||||
|
||||
heating_system_id: uuid.UUID = Field(foreign_key="heatingsystem.id")
|
||||
heating_system: HeatingSystem = Relationship()
|
||||
# heating_system_id: uuid.UUID = Field(foreign_key="heatingsystem.id")
|
||||
# heating_system: HeatingSystem = Relationship()
|
||||
|
||||
occupancy_assessment_id: uuid.UUID = Field(foreign_key="occupantassessment.id")
|
||||
occupancy_assessment: OccupantAssessment = Relationship()
|
||||
# occupancy_assessment_id: uuid.UUID = Field(foreign_key="occupantassessment.id")
|
||||
# occupancy_assessment: OccupantAssessment = Relationship()
|
||||
|
|
|
|||
|
|
@ -1,335 +1,335 @@
|
|||
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
|
||||
# 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
|
||||
)
|
||||
# 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")
|
||||
# summary_info: Optional["PreSiteNotesSummaryInfo"] = Relationship(back_populates="pre_site_notes")
|
||||
|
||||
|
||||
# Assessor Info
|
||||
assessor_id: uuid.UUID = Field(
|
||||
foreign_key="assessorinfo.id",
|
||||
nullable=False
|
||||
)
|
||||
# # Assessor Info
|
||||
# assessor_id: uuid.UUID = Field(
|
||||
# foreign_key="assessorinfo.id",
|
||||
# nullable=False
|
||||
# )
|
||||
|
||||
assessor: Optional["AssessorInfo"] = Relationship(back_populates="pre_site_notes")
|
||||
# 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_id: uuid.UUID = Field(
|
||||
# foreign_key="propertydescription.id",
|
||||
# nullable=True
|
||||
# )
|
||||
|
||||
pre_site_note_description: Optional["PropertyDescription"] = Relationship(back_populates="pre_site_notes")
|
||||
# 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 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 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 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 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 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")
|
||||
# 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")
|
||||
# # 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]
|
||||
# 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")
|
||||
# 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
|
||||
# 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")
|
||||
# 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
|
||||
# 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")
|
||||
# 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 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")
|
||||
# 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]"}
|
||||
)
|
||||
# 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
|
||||
# class HeatingType(BaseModel, table=True):
|
||||
# heating_type: str
|
||||
# fuel_type: str
|
||||
|
||||
property_description: Optional["PropertyDescription"] = Relationship(back_populates="secondary_heating_type")
|
||||
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="secondary_heating_type")
|
||||
|
||||
|
||||
class WaterHeating(BaseModel, table=True):
|
||||
heating_type: str
|
||||
fuel_type: str
|
||||
# class WaterHeating(BaseModel, table=True):
|
||||
# heating_type: str
|
||||
# fuel_type: str
|
||||
|
||||
property_description: Optional["PropertyDescription"] = Relationship(back_populates="water_heating")
|
||||
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="water_heating")
|
||||
|
||||
|
||||
|
||||
class HotWaterCylinder(BaseModel, table=True):
|
||||
volume: str
|
||||
insulation_type: str
|
||||
insulation_thickness: str
|
||||
thermostat: bool
|
||||
# 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")
|
||||
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="hot_water_cylinder")
|
||||
|
||||
|
||||
|
||||
class SolarWaterHeating(BaseModel, table=True):
|
||||
solar_water_heating_details_known: bool
|
||||
# class SolarWaterHeating(BaseModel, table=True):
|
||||
# solar_water_heating_details_known: bool
|
||||
|
||||
property_description: Optional["PropertyDescription"] = Relationship(back_populates="solar_water_heating")
|
||||
# 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
|
||||
# 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")
|
||||
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="shower_and_baths")
|
||||
|
||||
|
||||
|
||||
class FlueGasHeatRecoverySystem(BaseModel, table=True):
|
||||
fghrs_present: bool
|
||||
# class FlueGasHeatRecoverySystem(BaseModel, table=True):
|
||||
# fghrs_present: bool
|
||||
|
||||
property_description: Optional["PropertyDescription"] = Relationship(back_populates="flue_gas_heat_recovery_system")
|
||||
# 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
|
||||
# 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")
|
||||
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="photovoltaic_panel")
|
||||
|
||||
|
||||
|
||||
class WindTurbine(BaseModel, table=True):
|
||||
wind_turbine: bool
|
||||
# class WindTurbine(BaseModel, table=True):
|
||||
# wind_turbine: bool
|
||||
|
||||
property_description: Optional["PropertyDescription"] = Relationship(back_populates="wind_turbine")
|
||||
# property_description: Optional["PropertyDescription"] = Relationship(back_populates="wind_turbine")
|
||||
|
||||
|
||||
|
||||
class OtherDetails(BaseModel, table=True):
|
||||
electricity_meter_type: str
|
||||
main_gas_avalible: bool
|
||||
# class OtherDetails(BaseModel, table=True):
|
||||
# electricity_meter_type: str
|
||||
# main_gas_avalible: bool
|
||||
|
||||
property_description: Optional["PropertyDescription"] = Relationship(back_populates="other_details")
|
||||
# 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
|
||||
# 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")
|
||||
# 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")
|
||||
# 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]"})
|
||||
# # 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")
|
||||
# # 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")
|
||||
# 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
|
||||
# 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()
|
||||
# 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()
|
||||
|
|
|
|||
|
|
@ -6,33 +6,62 @@ from pydantic import EmailStr
|
|||
from sqlalchemy import Column
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
from etl.fileReader.reportType import ReportType
|
||||
from enum import Enum
|
||||
|
||||
class BaseModel(SQLModel):
|
||||
id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True)
|
||||
|
||||
class Buildings(BaseModel, table=True):
|
||||
address: str
|
||||
postcode: str
|
||||
UPRN: str
|
||||
landlord_id: str
|
||||
domna_id: str
|
||||
# class Buildings(BaseModel, table=True):
|
||||
# address: str
|
||||
# postcode: str
|
||||
# UPRN: str
|
||||
# landlord_id: str
|
||||
# domna_id: str
|
||||
|
||||
documents: List["Documents"] = Relationship(back_populates="building")
|
||||
# documents: List["Documents"] = Relationship(back_populates="building")
|
||||
|
||||
class Documents(BaseModel, table=True):
|
||||
assessor_id: uuid.UUID = Field(
|
||||
foreign_key="assessorinfo.id",
|
||||
nullable=False
|
||||
# class Documents(BaseModel, table=True):
|
||||
# assessor_id: uuid.UUID = Field(
|
||||
# foreign_key="assessorinfo.id",
|
||||
# nullable=False
|
||||
# )
|
||||
# author: Optional["AssessorInfo"] = Relationship(back_populates="documents")
|
||||
# created_at: datetime
|
||||
# document_type: ReportType
|
||||
|
||||
# building_id: uuid.UUID = Field(foreign_key="buildings.id", nullable=False)
|
||||
# building: Optional["Buildings"] = Relationship(back_populates="documents")
|
||||
|
||||
# target_table: str
|
||||
# target_id: uuid.UUID
|
||||
|
||||
# class ReportType(str, Enum):
|
||||
# QUIDOS_PRESITE_NOTE = "QUIDOS_PRESITE_NOTE"
|
||||
# CHARTED_SURVEYOR_REPORT = "CHARTED_SURVEYOR_REPORT"
|
||||
# ENERGY_PERFORMANCE_REPORT = "ENERGY_PERFORMANCE_REPORT"
|
||||
# U_VALUE_CALCULATOR_REPORT = "U_VALUE_CALCULATOR_REPORT"
|
||||
# OVERWRITING_U_VALUE_DECLARATION_FORM = "OVERWRITING_U_VALUE_DECLARATION_FORM"
|
||||
# OSMOSIS_CONDITION_PAS_2035_REPORT = "OSMOSIS_CONDITION_PAS_2035_REPORT"
|
||||
# DOMNA_CONDITION_PAS_2035_REPORT = "DOMNA_CONDITION_PAS_2035_REPORT"
|
||||
|
||||
class uploaded_files(BaseModel, table=True):
|
||||
__tablename__ = "uploaded_files" # keeps it simple/snake_case
|
||||
|
||||
# URIs
|
||||
s3_json_uri: Optional[str] = None
|
||||
s3_file_uri: str = Field(index=True) # index helps lookups; make unique in migrations if needed
|
||||
|
||||
# Document type (uses your enum)
|
||||
doc_type: ReportType
|
||||
|
||||
# Timestamps
|
||||
s3_file_upload_timestamp: datetime = Field(
|
||||
default_factory=datetime.utcnow, nullable=False
|
||||
)
|
||||
author: Optional["AssessorInfo"] = Relationship(back_populates="documents")
|
||||
created_at: datetime
|
||||
document_type: ReportType
|
||||
s3_json_upload_timestamp: Optional[datetime] = None
|
||||
|
||||
building_id: uuid.UUID = Field(foreign_key="buildings.id", nullable=False)
|
||||
building: Optional["Buildings"] = Relationship(back_populates="documents")
|
||||
# UPRN
|
||||
uprn: str = Field(index=True)
|
||||
|
||||
target_table: str
|
||||
target_id: uuid.UUID
|
||||
|
||||
Documents.update_forward_refs()
|
||||
# Documents.update_forward_refs()
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#poetry run alembic revision --autogenerate -m "add utility"
|
||||
#poetry run alembic revision --autogenerate -m "add new uploaded file table "
|
||||
|
||||
poetry run alembic upgrade head
|
||||
#poetry run alembic upgrade head
|
||||
|
||||
# See which hash I'm at
|
||||
#poetry run alembic current
|
||||
poetry run alembic current
|
||||
|
||||
# downgrade one version
|
||||
#poetry run alembic upgrade head
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue