feat(scoring): composite recency decay and severity weights persisted in DB [FASE-5.1]
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
"""ScoringConfig — single-row table for persisted scoring weights.
|
||||
|
||||
Replaces the mutable-settings approach where PATCH /scores/config
|
||||
mutated the in-process ``Settings`` object (lost on restart).
|
||||
"""
|
||||
"""ScoringConfig — single-row table for persisted scoring weights."""
|
||||
|
||||
import uuid
|
||||
|
||||
from sqlalchemy import Column, Float, DateTime, func
|
||||
from sqlalchemy import Column, Float, DateTime, ForeignKey, func
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
|
||||
from app.database import Base
|
||||
@@ -17,8 +13,13 @@ class ScoringConfig(Base):
|
||||
|
||||
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||
weight_tests = Column(Float, nullable=False, default=40.0)
|
||||
weight_detection_rules = Column(Float, nullable=False, default=20.0)
|
||||
weight_detection_rules = Column(Float, nullable=False, default=25.0)
|
||||
weight_d3fend = Column(Float, nullable=False, default=15.0)
|
||||
weight_freshness = Column(Float, nullable=False, default=15.0)
|
||||
weight_platform_diversity = Column(Float, nullable=False, default=10.0)
|
||||
weight_recency = Column(Float, nullable=False, default=10.0)
|
||||
weight_severity = Column(Float, nullable=False, default=10.0)
|
||||
updated_by = Column(
|
||||
UUID(as_uuid=True),
|
||||
ForeignKey("users.id", ondelete="SET NULL"),
|
||||
nullable=True,
|
||||
)
|
||||
updated_at = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
|
||||
|
||||
Reference in New Issue
Block a user