import datetime from sqlalchemy import Column, String, DateTime, JSON, Float, Integer, func from sqlalchemy.orm import Mapped, mapped_column from .base import Base from typing import Dict, Any class Calculation(Base): __tablename__ = "calculations" id: Mapped[int] = mapped_column(primary_key=True, index=True) input_params: Mapped[Dict[str, Any]] = mapped_column(JSON, nullable=False) output_results: Mapped[Dict[str, Any] | None] = mapped_column(JSON, nullable=True) timestamp: Mapped[datetime.datetime] = mapped_column( DateTime(timezone=True), server_default=func.now() ) model_name: Mapped[str | None] = mapped_column(String(100), nullable=True) objective_score: Mapped[float | None] = mapped_column(Float, nullable=True) def __repr__(self): return f""