first commit
Some checks failed
Deploy / lint (push) Failing after 7s
Deploy / test (push) Has been skipped
Deploy / deploy (push) Has been skipped

This commit is contained in:
Dennis Thiessen
2026-02-20 17:31:01 +01:00
commit 61ab24490d
160 changed files with 17034 additions and 0 deletions

40
app/models/score.py Normal file
View File

@@ -0,0 +1,40 @@
from datetime import datetime
from sqlalchemy import Boolean, DateTime, Float, ForeignKey, String, Text
from sqlalchemy.orm import Mapped, mapped_column, relationship
from app.database import Base
class DimensionScore(Base):
__tablename__ = "dimension_scores"
id: Mapped[int] = mapped_column(primary_key=True)
ticker_id: Mapped[int] = mapped_column(
ForeignKey("tickers.id", ondelete="CASCADE"), nullable=False
)
dimension: Mapped[str] = mapped_column(String(50), nullable=False)
score: Mapped[float] = mapped_column(Float, nullable=False)
is_stale: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
computed_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True), nullable=False
)
ticker = relationship("Ticker", back_populates="dimension_scores")
class CompositeScore(Base):
__tablename__ = "composite_scores"
id: Mapped[int] = mapped_column(primary_key=True)
ticker_id: Mapped[int] = mapped_column(
ForeignKey("tickers.id", ondelete="CASCADE"), nullable=False
)
score: Mapped[float] = mapped_column(Float, nullable=False)
is_stale: Mapped[bool] = mapped_column(Boolean, nullable=False, default=False)
weights_json: Mapped[str] = mapped_column(Text, nullable=False)
computed_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True), nullable=False
)
ticker = relationship("Ticker", back_populates="composite_scores")