Fix new services implementation 3

This commit is contained in:
Urtzi Alfaro
2025-08-14 16:47:34 +02:00
parent 0951547e92
commit 03737430ee
51 changed files with 657 additions and 982 deletions

View File

@@ -18,7 +18,7 @@ class Forecast(Base):
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
tenant_id = Column(UUID(as_uuid=True), nullable=False, index=True)
product_name = Column(String(255), nullable=False, index=True)
inventory_product_id = Column(UUID(as_uuid=True), nullable=False, index=True) # Reference to inventory service
location = Column(String(255), nullable=False, index=True)
# Forecast period
@@ -53,7 +53,7 @@ class Forecast(Base):
features_used = Column(JSON)
def __repr__(self):
return f"<Forecast(id={self.id}, product={self.product_name}, date={self.forecast_date})>"
return f"<Forecast(id={self.id}, inventory_product_id={self.inventory_product_id}, date={self.forecast_date})>"
class PredictionBatch(Base):
"""Batch prediction requests"""

View File

@@ -19,7 +19,7 @@ class ModelPerformanceMetric(Base):
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4)
model_id = Column(UUID(as_uuid=True), nullable=False, index=True)
tenant_id = Column(UUID(as_uuid=True), nullable=False, index=True)
product_name = Column(String(255), nullable=False)
inventory_product_id = Column(UUID(as_uuid=True), nullable=False) # Reference to inventory service
# Performance metrics
mae = Column(Float) # Mean Absolute Error
@@ -48,7 +48,7 @@ class PredictionCache(Base):
# Cached data
tenant_id = Column(UUID(as_uuid=True), nullable=False, index=True)
product_name = Column(String(255), nullable=False)
inventory_product_id = Column(UUID(as_uuid=True), nullable=False) # Reference to inventory service
location = Column(String(255), nullable=False)
forecast_date = Column(DateTime(timezone=True), nullable=False)
@@ -64,4 +64,4 @@ class PredictionCache(Base):
hit_count = Column(Integer, default=0)
def __repr__(self):
return f"<PredictionCache(key={self.cache_key}, product={self.product_name})>"
return f"<PredictionCache(key={self.cache_key}, inventory_product_id={self.inventory_product_id})>"