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>
This commit is contained in:
Urtzi Alfaro
2025-12-16 11:32:45 +01:00
parent 4418ff0876
commit 9f3b39bd28
14 changed files with 3982 additions and 60 deletions

View File

@@ -244,15 +244,17 @@ async def run_cleanup_worker():
# Initialize Redis client
import os
from shared.redis_utils import initialize_redis
from app.core.config import Settings
redis_url = os.getenv("REDIS_URL", "redis://redis-service:6379/0")
settings = Settings()
redis_url = settings.REDIS_URL # Use proper configuration with TLS and auth
try:
# Initialize Redis with connection pool settings
await initialize_redis(redis_url, db=0, max_connections=10)
logger.info("Redis initialized successfully", redis_url=redis_url.split('@')[-1])
await initialize_redis(redis_url, db=settings.REDIS_DB, max_connections=settings.REDIS_MAX_CONNECTIONS)
logger.info("Redis initialized successfully", redis_url=redis_url.split('@')[-1], db=settings.REDIS_DB)
except Exception as e:
logger.error("Failed to initialize Redis", error=str(e))
logger.error("Failed to initialize Redis", error=str(e), redis_url=redis_url.split('@')[-1])
raise
redis = DemoRedisWrapper()