feat: API skeleton, SSE, staffing and tests

This commit is contained in:
Noel Sabia committed 2026-11-14 04:23:43 +01:00
1 parent 907164f972
commit f284969a4b
14 files changed
+1355 -54

No files matched your search

+19 -19
View File
@@ -6,9 +6,9 @@ import "time"
// Horizons and enums from CONTRACT.md §1.
var (
Horizons = []string{"15m", "1h", "48h", "7d"}
Scenarios = []string{"base", "sunny-saturday-market", "rainy-saturday", "weekday-event"}
Standards = []string{"relaxed", "standard", "premium"}
Horizons = []string{"15m", "1h", "48h", "7d"}
Scenarios = []string{"base", "sunny-saturday-market", "rainy-saturday", "weekday-event"}
Standards = []string{"relaxed", "standard", "premium"}
)
// Contains reports whether v is in list.
@@ -56,12 +56,12 @@ type Coverage struct {
// Metrics is the model card headline block exposed by GET /api/meta.
type Metrics struct {
Model string `json:"model"`
MAE float64 `json:"mae"`
WAPE float64 `json:"wape"`
R2 float64 `json:"r2"`
BaselineMAE float64 `json:"baseline_mae"`
BaselineWAPE float64 `json:"baseline_wape"`
Model string `json:"model"`
MAE float64 `json:"mae"`
WAPE float64 `json:"wape"`
R2 float64 `json:"r2"`
BaselineMAE float64 `json:"baseline_mae"`
BaselineWAPE float64 `json:"baseline_wape"`
}
// Meta is GET /api/meta.
@@ -196,11 +196,11 @@ type StoreHoursSpec struct {
// StaffingHour is one hour of the plan.
type StaffingHour struct {
T time.Time `json:"t"`
Footfall float64 `json:"footfall"`
RequiredStaff int `json:"required_staff"`
ScheduledStaff int `json:"scheduled_staff"`
Coverage string `json:"coverage"`
T time.Time `json:"t"`
Footfall float64 `json:"footfall"`
RequiredStaff int `json:"required_staff"`
ScheduledStaff int `json:"scheduled_staff"`
Coverage string `json:"coverage"`
}
// Shift is one contiguous shift block.
@@ -213,11 +213,11 @@ type Shift struct {
// StaffingSummary is the plan headline block.
type StaffingSummary struct {
CoveragePct float64 `json:"coverage_pct"`
CostEUR int `json:"cost_eur"`
FlatScheduleCostEUR int `json:"flat_schedule_cost_eur"`
OverstaffedHours int `json:"overstaffed_hours"`
UnderstaffedHours int `json:"understaffed_hours"`
CoveragePct float64 `json:"coverage_pct"`
CostEUR int `json:"cost_eur"`
FlatScheduleCostEUR int `json:"flat_schedule_cost_eur"`
OverstaffedHours int `json:"overstaffed_hours"`
UnderstaffedHours int `json:"understaffed_hours"`
}
// StaffingResponse is GET /api/staffing.