How shubham-chhimpa/lucidity-route-optimizer works
Project type and purpose
• This is a standalone backend microservice (FastAPI) for computing the optimal delivery route.
• It solves a variant of the Traveling Salesperson Problem (TSP) with conditional wait‐time rules.
• Exposed as a /find-route HTTP POST endpoint returning the best path and total time.
File structure
Top-level:
• Dockerfile, docker-compose.yml, requirements.txt → containerization and deployment
• app/ → the application code
• tests/ → unit and fixture tests
Inside app/:
• main.py → FastAPI app factory, registration of routers & error handlers
• api/
• routers/routes.py → HTTP endpoints (/find-route, /healthz, /readyz)
• deps.py → dependency-injection wiring for services & adapters
• errors.py → centralized exception handling
• schemas/ → Pydantic DTOs (RouteRequest, RouteResponse)
• core/
• domain/entities.py → pure domain entities (Location, Order)
• domain/ports.py → interfaces (DistanceCalculator, SpeedEstimator, PathGenerator, CostCalculator)
• services/ → business logic components (path_generator, cost_calculator, route_optimizer)
• infrastructure/
• distance/ → HaversineCalculator + SpeedConfig adapters
• logging/config.py → logging setup
• settings.py → Pydantic Settings for env vars
• config.py, logging_config.py, models.py, services.py, utils.py → additional wiring & helpers
README for additional insights
• Confirms Clean/Hexagonal architecture (domain-services + ports/adapters).
• Highlights Docker usage, environment configuration (AVERAGE_SPEED_KMPH, EARTH_RADIUS_KM).
• Shows sample requests, expected responses, and project structure.