2022-11-03 12:49:39 -04:00
|
|
|
"""
|
|
|
|
Model representation of a building
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2022 Concordia CERC group
|
|
|
|
Project Coder Peter Yefi peteryefi@gmail.com
|
|
|
|
"""
|
|
|
|
|
|
|
|
from sqlalchemy import Column, Integer, String, Sequence, Float, ForeignKey
|
|
|
|
from sqlalchemy.dialects.postgresql import JSONB
|
2022-11-03 15:29:09 -04:00
|
|
|
from persistence.db_config import Base
|
2022-11-03 12:49:39 -04:00
|
|
|
|
|
|
|
|
|
|
|
class Building(Base):
|
2022-11-03 15:29:09 -04:00
|
|
|
"""A model representation of a building
|
|
|
|
|
|
|
|
Attributes:
|
|
|
|
city_id A reference to the city which has this building.
|
|
|
|
name The name of the building.
|
|
|
|
construction_year The year of construction of the building.
|
|
|
|
function The function (e.g. residential) of the building.
|
|
|
|
floor_area The computed area of the floor of the building.
|
|
|
|
data A JSON object which contain other data (like roof, walls, zones, etc) of the building
|
|
|
|
"""
|
2022-11-03 12:49:39 -04:00
|
|
|
__tablename__ = "building"
|
|
|
|
id = Column(Integer, Sequence('building_id_seq'), primary_key=True)
|
2022-11-03 15:29:09 -04:00
|
|
|
city_id = Column(Integer, ForeignKey('city.id'), nullable=False)
|
2022-11-03 12:49:39 -04:00
|
|
|
name = Column(String, nullable=False)
|
|
|
|
construction_year = Column(Integer, nullable=False)
|
|
|
|
function = Column(String, nullable=False)
|
|
|
|
floor_area = Column(Float, nullable=False)
|
|
|
|
data = Column(JSONB, nullable=False)
|