Start fixing forecast service 21

This commit is contained in:
Urtzi Alfaro
2025-07-30 09:31:42 +02:00
parent e200e03b1c
commit 19d73f6227

View File

@@ -260,6 +260,7 @@ class PredictionService:
df['is_friday'] = int(day_of_week == 4)
df['is_saturday'] = int(day_of_week == 5)
df['is_sunday'] = int(day_of_week == 6)
df['is_working_day'] = int(day_of_week < 5) # Working days (Mon-Fri)
# Season-based features (match training service)
df['is_spring'] = int(df['season'].iloc[0] == 2)
@@ -394,6 +395,13 @@ class PredictionService:
df['congestion_temp_interaction'] = congestion * temperature
df['congestion_weekend_interaction'] = congestion * is_weekend
# Add after the existing day-of-week features:
df['is_peak_bakery_day'] = int(day_of_week in [4, 5, 6]) # Friday, Saturday, Sunday
# Add after the month features:
df['is_high_demand_month'] = int(forecast_date.month in [6, 7, 8, 12]) # Summer and December
df['is_warm_season'] = int(forecast_date.month in [4, 5, 6, 7, 8, 9]) # Spring/summer months
logger.debug("Complete Prophet features prepared",
feature_count=len(df.columns),
date=features['date'],