285 lines
9.1 KiB
Python
285 lines
9.1 KiB
Python
"""System configuration for LogiFlow AI."""
|
|
import os
|
|
|
|
# Infrastructure Connections — values come from environment / .env file.
|
|
# Hardcoded strings are last-resort defaults; set the matching env var in production.
|
|
NATS_URL = os.getenv("NATS_URL", "nats://doormile:Package@321#@66.116.226.161:4223")
|
|
NATS_HOST = os.getenv("NATS_HOST", "66.116.226.161")
|
|
NATS_PORT = int(os.getenv("NATS_PORT", "4223"))
|
|
NATS_USER = os.getenv("NATS_USER", "doormile")
|
|
NATS_PASSWORD = os.getenv("NATS_PASSWORD", "Package@321#")
|
|
|
|
REDIS_HOST = os.getenv("REDIS_HOST", "66.116.226.255")
|
|
REDIS_PORT = int(os.getenv("REDIS_PORT", "6380"))
|
|
REDIS_PASSWORD = os.getenv("REDIS_PASSWORD", "Package@321#")
|
|
|
|
# Postgres — individual params to avoid @ in password breaking DSN parsing
|
|
DB_HOST = os.getenv("DB_HOST", "31.97.228.132")
|
|
DB_PORT = int(os.getenv("DB_PORT", "5433"))
|
|
DB_NAME = os.getenv("DB_NAME", "logistics")
|
|
DB_USER = os.getenv("DB_USER", "admin")
|
|
DB_PASSWORD = os.getenv("DB_PASSWORD", "Package@321#")
|
|
|
|
GO_API_BASE_URL = os.getenv("GO_API_BASE_URL", "http://localhost:8080")
|
|
INTERNAL_API_KEY = os.getenv("INTERNAL_API_KEY", "doormile-internal-2024")
|
|
|
|
# Agent Configuration
|
|
AGENT_CONFIG = {
|
|
"jarvis": {
|
|
"name": "JARVIS",
|
|
"type": "master",
|
|
"description": "Central orchestrator for all logistics operations",
|
|
"monitoring_interval": 5, # seconds
|
|
"decision_threshold": 0.8
|
|
},
|
|
"order_agent": {
|
|
"name": "ORDER_AGENT",
|
|
"type": "specialized",
|
|
"description": "Handles order intake, validation, and categorization",
|
|
"max_concurrent_orders": 100,
|
|
"validation_timeout": 30 # seconds
|
|
},
|
|
"dispatch_agent": {
|
|
"name": "DISPATCH_AGENT",
|
|
"type": "specialized",
|
|
"description": "Handles zone analysis, route assignment, and dispatch",
|
|
"zone_update_interval": 60, # seconds
|
|
"batch_size": 10
|
|
},
|
|
"fleet_agent": {
|
|
"name": "FLEET_AGENT",
|
|
"type": "specialized",
|
|
"description": "Manages vehicle fleet, capacity, and tracking",
|
|
"tracking_interval": 30, # seconds
|
|
"maintenance_check_interval": 3600 # 1 hour
|
|
},
|
|
"hub_agent": {
|
|
"name": "HUB_AGENT",
|
|
"type": "specialized",
|
|
"description": "Manages hub operations, transit flow, and capacity",
|
|
"capacity_warning_threshold": 0.85,
|
|
"processing_timeout": 120 # seconds
|
|
},
|
|
"customer_agent": {
|
|
"name": "CUSTOMER_AGENT",
|
|
"type": "specialized",
|
|
"description": "Handles notifications, tracking, and customer communication",
|
|
"notification_channels": ["sms", "email", "whatsapp", "push"],
|
|
"retry_attempts": 3
|
|
},
|
|
"exception_agent": {
|
|
"name": "EXCEPTION_AGENT",
|
|
"type": "specialized",
|
|
"description": "Handles delays, cancellations, rescheduling, and problems",
|
|
"sla_thresholds": {
|
|
"critical": 15, # minutes
|
|
"high": 30,
|
|
"medium": 60,
|
|
"low": 120
|
|
}
|
|
},
|
|
"route_optimizer": {
|
|
"name": "ROUTE_OPTIMIZER",
|
|
"type": "specialized",
|
|
"description": "Optimizes delivery routes based on zones and hubs",
|
|
"traffic_update_interval": 300, # 5 minutes
|
|
"cache_ttl": 600 # 10 minutes
|
|
}
|
|
}
|
|
|
|
# Zone Definitions
|
|
ZONES = {
|
|
"north_delhi": {
|
|
"pincode_range": ("100", "199"),
|
|
"hub": "DL-HUB-01",
|
|
"coordinates": (28.6139, 77.2090),
|
|
"coverage": ["Delhi NCR North"]
|
|
},
|
|
"south_delhi": {
|
|
"pincode_range": ("200", "299"),
|
|
"hub": "DL-HUB-02",
|
|
"coordinates": (28.5355, 77.2100),
|
|
"coverage": ["Delhi NCR South"]
|
|
},
|
|
"mumbai_west": {
|
|
"pincode_range": ("400", "449"),
|
|
"hub": "MU-HUB-01",
|
|
"coordinates": (19.0760, 72.8777),
|
|
"coverage": ["Mumbai West", "Andheri", "Juhu"]
|
|
},
|
|
"mumbai_east": {
|
|
"pincode_range": ("450", "499"),
|
|
"hub": "MU-HUB-02",
|
|
"coordinates": (19.1650, 72.8500),
|
|
"coverage": ["Mumbai East", "Thane", "Navi Mumbai"]
|
|
},
|
|
"bangalore": {
|
|
"pincode_range": ("200", "299"),
|
|
"hub": "BL-HUB-01",
|
|
"coordinates": (12.9716, 77.5946),
|
|
"coverage": ["Bangalore", "Electronic City"]
|
|
},
|
|
"hyderabad": {
|
|
"pincode_range": ("500", "599"),
|
|
"hub": "HY-HUB-01",
|
|
"coordinates": (17.3850, 78.4867),
|
|
"coverage": ["Hyderabad", "Hi-Tech City"]
|
|
},
|
|
"pune": {
|
|
"pincode_range": ("400", "499"),
|
|
"hub": "PU-HUB-01",
|
|
"coordinates": (18.5204, 73.8567),
|
|
"coverage": ["Pune", "Hinjewadi"]
|
|
},
|
|
"kolkata": {
|
|
"pincode_range": ("600", "699"),
|
|
"hub": "KL-HUB-01",
|
|
"coordinates": (22.5726, 88.3639),
|
|
"coverage": ["Kolkata", "Salt Lake"]
|
|
}
|
|
}
|
|
|
|
# Hub Configuration
|
|
HUBS = {
|
|
"DL-HUB-01": {
|
|
"name": "Delhi North Hub",
|
|
"zone": "north_delhi",
|
|
"capacity": 500,
|
|
"processing_rate": 100, # orders per hour
|
|
"spokes": ["DL-SP-01", "DL-SP-02", "DL-SP-03"],
|
|
"connected_hubs": ["DL-HUB-02", "MU-HUB-01", "KL-HUB-01"]
|
|
},
|
|
"DL-HUB-02": {
|
|
"name": "Delhi South Hub",
|
|
"zone": "south_delhi",
|
|
"capacity": 400,
|
|
"processing_rate": 80,
|
|
"spokes": ["DL-SP-04", "DL-SP-05"],
|
|
"connected_hubs": ["DL-HUB-01", "BL-HUB-01"]
|
|
},
|
|
"MU-HUB-01": {
|
|
"name": "Mumbai West Hub",
|
|
"zone": "mumbai_west",
|
|
"capacity": 600,
|
|
"processing_rate": 120,
|
|
"spokes": ["MU-SP-01", "MU-SP-02", "MU-SP-03", "MU-SP-04"],
|
|
"connected_hubs": ["MU-HUB-02", "DL-HUB-01", "PU-HUB-01"]
|
|
},
|
|
"MU-HUB-02": {
|
|
"name": "Mumbai East Hub",
|
|
"zone": "mumbai_east",
|
|
"capacity": 550,
|
|
"processing_rate": 90,
|
|
"spokes": ["MU-SP-05", "MU-SP-06"],
|
|
"connected_hubs": ["MU-HUB-01", "PU-HUB-01"]
|
|
},
|
|
"BL-HUB-01": {
|
|
"name": "Bangalore Hub",
|
|
"zone": "bangalore",
|
|
"capacity": 500,
|
|
"processing_rate": 100,
|
|
"spokes": ["BL-SP-01", "BL-SP-02", "BL-SP-03"],
|
|
"connected_hubs": ["HY-HUB-01", "DL-HUB-02"]
|
|
},
|
|
"HY-HUB-01": {
|
|
"name": "Hyderabad Hub",
|
|
"zone": "hyderabad",
|
|
"capacity": 450,
|
|
"processing_rate": 85,
|
|
"spokes": ["HY-SP-01", "HY-SP-02"],
|
|
"connected_hubs": ["BL-HUB-01", "KL-HUB-01"]
|
|
},
|
|
"PU-HUB-01": {
|
|
"name": "Pune Hub",
|
|
"zone": "pune",
|
|
"capacity": 400,
|
|
"processing_rate": 75,
|
|
"spokes": ["PU-SP-01", "PU-SP-02"],
|
|
"connected_hubs": ["MU-HUB-01", "MU-HUB-02"]
|
|
},
|
|
"KL-HUB-01": {
|
|
"name": "Kolkata Hub",
|
|
"zone": "kolkata",
|
|
"capacity": 350,
|
|
"processing_rate": 70,
|
|
"spokes": ["KL-SP-01", "KL-SP-02"],
|
|
"connected_hubs": ["DL-HUB-01", "HY-HUB-01"]
|
|
}
|
|
}
|
|
|
|
# Vehicle Types
|
|
VEHICLE_TYPES = {
|
|
"bike": {
|
|
"capacity_kg": 15,
|
|
"capacity_vol": 0.5, # cubic meters
|
|
"max_speed_kmh": 50,
|
|
"fuel_cost_per_km": 2.0,
|
|
"suitable_for": ["last_mile", "small_packages"]
|
|
},
|
|
"scooter": {
|
|
"capacity_kg": 20,
|
|
"capacity_vol": 0.7,
|
|
"max_speed_kmh": 45,
|
|
"fuel_cost_per_km": 1.5,
|
|
"suitable_for": ["last_mile", "documents"]
|
|
},
|
|
"van": {
|
|
"capacity_kg": 500,
|
|
"capacity_vol": 8,
|
|
"max_speed_kmh": 80,
|
|
"fuel_cost_per_km": 3.5,
|
|
"suitable_for": ["hub_to_spoke", "medium_packages"]
|
|
},
|
|
"truck": {
|
|
"capacity_kg": 2000,
|
|
"capacity_vol": 25,
|
|
"max_speed_kmh": 70,
|
|
"fuel_cost_per_km": 5.0,
|
|
"suitable_for": ["hub_to_hub", "heavy_cargo", "bulk"]
|
|
}
|
|
}
|
|
|
|
# SLA Configuration
|
|
SLA_CONFIG = {
|
|
"delivery_windows": {
|
|
"express": 4, # hours
|
|
"standard": 24, # hours
|
|
"economy": 72 # hours
|
|
},
|
|
"response_times": {
|
|
"critical_exception": 15, # minutes
|
|
"high_exception": 30,
|
|
"medium_exception": 60,
|
|
"low_exception": 120
|
|
}
|
|
}
|
|
|
|
# Notification Templates
|
|
NOTIFICATION_TEMPLATES = {
|
|
"order_confirmed": {
|
|
"sms": "Your order {order_id} has been confirmed! Estimated delivery: {eta}",
|
|
"email": "Hi {customer_name}, your order {order_id} is confirmed. Track at: {tracking_url}",
|
|
"whatsapp": "✅ Order {order_id} confirmed!\n📍 Delivery by {eta}\n🔗 Track: {tracking_url}"
|
|
},
|
|
"out_for_delivery": {
|
|
"sms": "Out for delivery! Driver: {driver_name}, Contact: {driver_phone}",
|
|
"email": "Your order is out for delivery!",
|
|
"whatsapp": "🏃 Out for delivery!\nDriver: {driver_name}\n📞 {driver_phone}"
|
|
},
|
|
"delivered": {
|
|
"sms": "Order {order_id} delivered successfully! Thank you.",
|
|
"email": "Your order has been delivered! We hope you enjoy your purchase.",
|
|
"whatsapp": "✅ Delivered!\nOrder {order_id}\nThank you!"
|
|
}
|
|
}
|
|
|
|
# System Settings
|
|
SYSTEM_CONFIG = {
|
|
"max_concurrent_orders": 1000,
|
|
"message_queue_size": 10000,
|
|
"agent_heartbeat_interval": 30, # seconds
|
|
"cleanup_interval": 3600, # 1 hour
|
|
"log_retention_days": 30,
|
|
"enable_monitoring": True,
|
|
"enable_metrics": True
|
|
} |