Start fixing forecast service API 3

This commit is contained in:
Urtzi Alfaro
2025-07-29 15:08:55 +02:00
parent dfb619a7b5
commit 84ed4a7a2e
14 changed files with 1607 additions and 447 deletions

View File

@@ -569,28 +569,22 @@ echo ""
log_step "5.1. Testing basic dashboard functionality"
# Test basic forecasting capability (if training completed)
if [ -n "$TRAINING_TASK_ID" ]; then
# Use a real product name from our CSV for forecasting
FIRST_PRODUCT=$(echo "$REAL_PRODUCTS" | sed 's/"//g' | cut -d',' -f1)
# Use a real product name from our CSV for forecasting
FIRST_PRODUCT=$(echo "$REAL_PRODUCTS" | sed 's/"//g' | cut -d',' -f1)
FORECAST_RESPONSE=$(curl -s -X POST "$API_BASE/api/v1/forecasting/predict" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "X-Tenant-ID: $TENANT_ID" \
-d "{
\"products\": [\"$FIRST_PRODUCT\"],
\"forecast_days\": 7,
\"date\": \"2024-01-15\"
FORECAST_RESPONSE=$(curl -s -X POST "$API_BASE/api/v1/tenants/$TENANT_ID/forecast/single" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d "{
\"products\": [\"$FIRST_PRODUCT\"],
\"forecast_days\": 7,
\"date\": \"2025-09-15\"
}")
if echo "$FORECAST_RESPONSE" | grep -q '"predictions"\|"forecast"'; then
log_success "Forecasting service is accessible"
else
log_warning "Forecasting may not be ready yet (model training required)"
fi
if echo "$FORECAST_RESPONSE" | grep -q '"predictions"\|"forecast"'; then
log_success "Forecasting service is accessible"
else
log_warning "Skipping forecast test - no training task ID available"
log_warning "Forecasting may not be ready yet (model training required)"
fi
echo ""