Add basis workspace filters, stale-on-reimport, and variant usage metrics
This commit is contained in:
@@ -155,6 +155,39 @@ class Item(Base):
|
||||
nullable=True,
|
||||
comment="Original item ID (for AI variants)",
|
||||
)
|
||||
generation_run_id: Mapped[Union[int, None]] = mapped_column(
|
||||
ForeignKey("ai_generation_runs.id", ondelete="SET NULL", onupdate="CASCADE"),
|
||||
nullable=True,
|
||||
index=True,
|
||||
comment="AI generation run ID",
|
||||
)
|
||||
source_snapshot_question_id: Mapped[Union[int, None]] = mapped_column(
|
||||
ForeignKey("tryout_snapshot_questions.id", ondelete="SET NULL", onupdate="CASCADE"),
|
||||
nullable=True,
|
||||
index=True,
|
||||
comment="Source snapshot question ID",
|
||||
)
|
||||
variant_status: Mapped[str] = mapped_column(
|
||||
String(50),
|
||||
nullable=False,
|
||||
default="active",
|
||||
comment="Lifecycle status (active/draft/approved/rejected/archived/stale)",
|
||||
)
|
||||
reviewed_by: Mapped[Union[str, None]] = mapped_column(
|
||||
String(255),
|
||||
nullable=True,
|
||||
comment="Reviewer username",
|
||||
)
|
||||
reviewed_at: Mapped[Union[datetime, None]] = mapped_column(
|
||||
DateTime(timezone=True),
|
||||
nullable=True,
|
||||
comment="Review timestamp",
|
||||
)
|
||||
review_notes: Mapped[Union[str, None]] = mapped_column(
|
||||
Text,
|
||||
nullable=True,
|
||||
comment="Review notes",
|
||||
)
|
||||
|
||||
# Timestamps
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
@@ -187,6 +220,11 @@ class Item(Base):
|
||||
lazy="selectin",
|
||||
cascade="all, delete-orphan",
|
||||
)
|
||||
generation_run: Mapped[Union["AIGenerationRun", None]] = relationship(
|
||||
"AIGenerationRun",
|
||||
back_populates="generated_items",
|
||||
lazy="selectin",
|
||||
)
|
||||
|
||||
# Constraints and indexes
|
||||
__table_args__ = (
|
||||
@@ -203,10 +241,11 @@ class Item(Base):
|
||||
"website_id",
|
||||
"slot",
|
||||
"level",
|
||||
unique=True,
|
||||
unique=False,
|
||||
),
|
||||
Index("ix_items_calibrated", "calibrated"),
|
||||
Index("ix_items_basis_item_id", "basis_item_id"),
|
||||
Index("ix_items_variant_status", "variant_status"),
|
||||
# IRT b parameter constraint [-3, +3]
|
||||
CheckConstraint(
|
||||
"irt_b IS NULL OR (irt_b >= -3 AND irt_b <= 3)",
|
||||
|
||||
Reference in New Issue
Block a user