Files
bakery-ia/shared/demo/fixtures/professional/11-orchestrator.json
Urtzi Alfaro 9f3b39bd28 Add comprehensive documentation and final improvements
Documentation Added:
- AI_INSIGHTS_DEMO_SETUP_GUIDE.md: Complete setup guide for demo sessions
- AI_INSIGHTS_DATA_FLOW.md: Architecture and data flow diagrams
- AI_INSIGHTS_QUICK_START.md: Quick reference guide
- DEMO_SESSION_ANALYSIS_REPORT.md: Detailed analysis of demo session d67eaae4
- ROOT_CAUSE_ANALYSIS_AND_FIXES.md: Complete analysis of 8 issues (6 fixed, 2 analyzed)
- COMPLETE_FIX_SUMMARY.md: Executive summary of all fixes
- FIX_MISSING_INSIGHTS.md: Forecasting and procurement fix guide
- FINAL_STATUS_SUMMARY.md: Status overview
- verify_fixes.sh: Automated verification script
- enhance_procurement_data.py: Procurement data enhancement script

Service Improvements:
- Demo session cleanup worker: Use proper settings for Redis configuration with TLS/auth
- Procurement service: Add Redis initialization with proper error handling and cleanup
- Production fixture: Remove duplicate worker assignments (cleaned 56 duplicates)
- Orchestrator fixture: Add purchase order metadata for better tracking

Impact:
- Complete documentation for troubleshooting and setup
- Improved Redis connection handling across services
- Clean production data without duplicates
- Better error handling and logging

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-16 11:32:45 +01:00

291 lines
9.0 KiB
JSON

{
"orchestration_run": {
"id": "90000000-0000-0000-0000-000000000001",
"tenant_id": "a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6",
"run_number": "ORCH-20250114-001",
"status": "completed",
"run_type": "daily",
"started_at": "BASE_TS - 1d 16h",
"completed_at": "BASE_TS - 1d 15h45m",
"duration_seconds": 900,
"trigger_type": "scheduled",
"trigger_source": "system",
"created_at": "BASE_TS - 1d 16h",
"updated_at": "BASE_TS - 1d 15h45m",
"notes": "Nightly orchestration run - Last successful execution before demo session"
},
"orchestration_results": {
"production_batches_created": 18,
"production_batches_completed": 15,
"production_batches_in_progress": 3,
"purchase_orders_created": 6,
"purchase_orders_approved": 4,
"purchase_orders_pending_approval": 2,
"inventory_updates": 25,
"stock_alerts_generated": 3,
"quality_checks_performed": 12,
"delivery_schedules_updated": 4,
"forecasts_generated": 10,
"ai_insights_posted": 5,
"notifications_sent": 8,
"errors_encountered": 0,
"warnings_generated": 2
},
"run_metadata": {
"purchase_orders": [
{
"id": "50000000-0000-0000-0000-000000000001",
"status": "completed",
"delivery_date": "BASE_TS - 2d",
"items": [
{
"ingredient_id": "10000000-0000-0000-0000-000000000001",
"product_name": "Harina de Trigo T55",
"quantity": 500.0,
"unit": "kilograms"
},
{
"ingredient_id": "10000000-0000-0000-0000-000000000002",
"product_name": "Harina de Trigo T65",
"quantity": 200.0,
"unit": "kilograms"
},
{
"ingredient_id": "10000000-0000-0000-0000-000000000005",
"product_name": "Harina de Centeno",
"quantity": 100.0,
"unit": "kilograms"
},
{
"ingredient_id": "10000000-0000-0000-0000-000000000031",
"product_name": "Sal Marina Fina",
"quantity": 50.0,
"unit": "kilograms"
}
]
},
{
"id": "50000000-0000-0000-0000-000000000002",
"status": "completed",
"delivery_date": "BASE_TS - 1d",
"items": [
{
"ingredient_id": "10000000-0000-0000-0000-000000000011",
"product_name": "Mantequilla sin Sal 82% MG",
"quantity": 80.0,
"unit": "kilograms"
}
]
},
{
"id": "50000000-0000-0000-0000-000000000004",
"status": "confirmed",
"delivery_date": "BASE_TS + 1d",
"items": [
{
"ingredient_id": "10000000-0000-0000-0000-000000000001",
"product_name": "Harina de Trigo T55",
"quantity": 1000.0,
"unit": "kilograms"
},
{
"ingredient_id": "10000000-0000-0000-0000-000000000021",
"product_name": "Levadura Fresca de Panadería",
"quantity": 50.0,
"unit": "kilograms"
}
]
}
],
"production_batches": [
{
"id": "40000000-0000-0000-0000-000000000001",
"product_id": "20000000-0000-0000-0000-000000000001",
"product_name": "Baguette Francesa Tradicional",
"status": "COMPLETED",
"scheduled_date": "BASE_TS - 1d 16h",
"quantity": 98.0,
"unit": "units"
},
{
"id": "40000000-0000-0000-0000-000000000002",
"product_id": "20000000-0000-0000-0000-000000000002",
"product_name": "Croissant de Mantequilla Artesanal",
"status": "COMPLETED",
"scheduled_date": "BASE_TS - 1d 15h",
"quantity": 115.0,
"unit": "units"
},
{
"id": "40000000-0000-0000-0000-000000000003",
"product_id": "20000000-0000-0000-0000-000000000003",
"product_name": "Pan de Pueblo con Masa Madre",
"status": "COMPLETED",
"scheduled_date": "BASE_TS - 1d 14h",
"quantity": 80.0,
"unit": "units"
}
]
},
"production_coordination": {
"batches_synchronized": [
{
"batch_id": "40000000-0000-0000-0000-000000000001",
"product_name": "Baguette Francesa Tradicional",
"quantity": 98.0,
"status": "COMPLETED",
"coordinated_with_po": "50000000-0000-0000-0000-000000000001",
"flour_consumed": 50.0,
"yeast_consumed": 2.0,
"butter_consumed": 1.5
},
{
"batch_id": "40000000-0000-0000-0000-000000000002",
"product_name": "Croissant de Mantequilla Artesanal",
"quantity": 115.0,
"status": "COMPLETED",
"coordinated_with_po": "50000000-0000-0000-0000-000000000002",
"flour_consumed": 30.0,
"yeast_consumed": 1.5,
"butter_consumed": 15.0
},
{
"batch_id": "40000000-0000-0000-0000-000000000003",
"product_name": "Pan de Pueblo con Masa Madre",
"quantity": 80.0,
"status": "COMPLETED",
"coordinated_with_po": "50000000-0000-0000-0000-000000000001",
"flour_consumed": 40.0,
"yeast_consumed": 1.0
}
],
"production_alerts": [
{
"alert_type": "LOW_STOCK",
"product_id": "10000000-0000-0000-0000-000000000001",
"product_name": "Harina de Trigo T55",
"current_stock": 150.0,
"threshold": 200.0,
"severity": "WARNING",
"related_po": "50000000-0000-0000-0000-000000000004"
},
{
"alert_type": "DELAYED_DELIVERY",
"product_id": "10000000-0000-0000-0000-000000000001",
"product_name": "Harina de Trigo T55",
"expected_delivery": "BASE_TS - 1d 4h",
"actual_delivery": "BASE_TS - 1d 8h",
"delay_hours": 4,
"severity": "CRITICAL",
"related_po": "50000000-0000-0000-0000-000000000004",
"impacted_batches": [
"40000000-0000-0000-0000-0000000000a3"
]
}
]
},
"procurement_coordination": {
"purchase_orders_processed": [
{
"po_id": "50000000-0000-0000-0000-000000000001",
"supplier_id": "40000000-0000-0000-0000-000000000001",
"supplier_name": "Harinas del Norte",
"status": "completed",
"total_amount": 1053.5,
"items_received": 3,
"items_pending": 0,
"delivery_status": "on_time"
},
{
"po_id": "50000000-0000-0000-0000-000000000002",
"supplier_id": "40000000-0000-0000-0000-000000000002",
"supplier_name": "Lácteos Gipuzkoa",
"status": "completed",
"total_amount": 402.2,
"items_received": 1,
"items_pending": 0,
"delivery_status": "on_time"
},
{
"po_id": "50000000-0000-0000-0000-000000000004",
"supplier_id": "40000000-0000-0000-0000-000000000001",
"supplier_name": "Harinas del Norte",
"status": "confirmed",
"total_amount": 1427.0,
"items_received": 0,
"items_pending": 2,
"delivery_status": "delayed",
"delay_hours": 4,
"urgency": "high"
}
],
"procurement_alerts": [
{
"alert_type": "PO_APPROVAL_ESCALATION",
"po_id": "50000000-0000-0000-0000-000000000003",
"supplier_name": "Eco-Proveedores",
"status": "pending_approval",
"age_hours": 72,
"severity": "WARNING",
"reason": "Auto-approval threshold not met"
}
]
},
"inventory_synchronization": {
"stock_updates": 25,
"low_stock_alerts": 3,
"expiration_alerts": 1,
"stock_movements": 15,
"inventory_accuracy": 98.5
},
"ai_insights": {
"yield_improvement_suggestions": 2,
"waste_reduction_opportunities": 1,
"demand_forecasting_updates": 3,
"procurement_optimization": 2,
"production_scheduling": 1
},
"system_state": {
"last_successful_run": "BASE_TS - 1d 16h",
"next_scheduled_run": "BASE_TS + 16h",
"system_health": "healthy",
"api_availability": 100.0,
"database_performance": "optimal",
"integration_status": "all_connected"
},
"results": {
"ingredients_created": 25,
"stock_entries_created": 25,
"batches_created": 0,
"sales_created": 44,
"forecasts_created": 28,
"consumptions_calculated": 81,
"critical_stock_items": 8,
"active_alerts": 8,
"forecasting_accuracy": 90.5,
"cross_reference_errors": 0,
"cross_reference_warnings": 0
},
"alerts": [
{
"alert_type": "OVERDUE_BATCH",
"severity": "high",
"message": "Production should have started 2 hours ago - BATCH-LATE-0001",
"created_at": "BASE_TS"
},
{
"alert_type": "DELAYED_DELIVERY",
"severity": "high",
"message": "Supplier delivery 4 hours late - PO-LATE-0001",
"created_at": "BASE_TS"
},
{
"alert_type": "CRITICAL_STOCK",
"severity": "critical",
"message": "Harina T55 below reorder point with NO pending PO",
"created_at": "BASE_TS"
}
],
"completed_at": "BASE_TS",
"status": "completed"
}