mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
66 lines
1.8 KiB
Python
66 lines
1.8 KiB
Python
import enum
|
|
|
|
from sqlalchemy import (
|
|
Column,
|
|
Integer,
|
|
Float,
|
|
Enum,
|
|
TIMESTAMP,
|
|
BigInteger,
|
|
ForeignKey,
|
|
)
|
|
from sqlalchemy.sql import func
|
|
from backend.app.db.base import Base
|
|
from backend.app.db.models.recommendations import PlanModel
|
|
from backend.app.db.models.materials import MaterialType, Material
|
|
|
|
|
|
class SchemeEnum(enum.Enum):
|
|
eco4 = "eco4"
|
|
gbis = "gbis"
|
|
whlg = "whlg"
|
|
none = "none"
|
|
|
|
|
|
class FundingPackage(Base):
|
|
__tablename__ = "funding_package"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
plan_id = Column(BigInteger, ForeignKey(PlanModel.id), nullable=False)
|
|
scheme = Column(
|
|
Enum(
|
|
SchemeEnum,
|
|
values_callable=lambda x: [e.value for e in x],
|
|
create_constraint=False,
|
|
),
|
|
nullable=False,
|
|
)
|
|
created_at = Column(TIMESTAMP, nullable=False, server_default=func.now())
|
|
project_funding = Column(Float)
|
|
total_uplift = Column(Float)
|
|
full_project_score = Column(Float)
|
|
partial_project_score = Column(Float)
|
|
uplift_project_score = Column(Float)
|
|
|
|
|
|
class FundingPackageMeasures(Base):
|
|
__tablename__ = "funding_package_measures"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
funding_package_id = Column(
|
|
BigInteger, ForeignKey(FundingPackage.id), nullable=False
|
|
)
|
|
measure = Column(
|
|
Enum(
|
|
MaterialType,
|
|
values_callable=lambda x: [e.value for e in x],
|
|
create_constraint=False,
|
|
),
|
|
nullable=False,
|
|
)
|
|
material_id = Column(
|
|
BigInteger, ForeignKey(Material.id), nullable=False
|
|
) # Assuming material table exists
|
|
innovation_uplift = Column(Float)
|
|
partial_project_score = Column(Float)
|
|
uplift_project_score = Column(Float)
|