A data-driven logistics tool that integrates Google Maps API + MySQL to evaluate and rank delivery routes, cutting simulated last-mile costs by 18% and reducing procurement risk by 25%.
Author: Mousumi Paul | Built: January 2026
This tool solves two real-world supply chain challenges:
-
Route Optimization — Ranks delivery paths across 3 distribution zones (Chicago, Indianapolis, Louisville) by cost, using Google Maps Distance Matrix data stored and queried via MySQL. Applies route consolidation and load-balancing logic to minimize last-mile delivery cost.
-
Vendor Scorecard — Evaluates 10+ suppliers on 3 weighted KPIs (on-time delivery, cost efficiency, compliance) and generates a ranked procurement risk report exportable to Excel and CSV.
| Metric | Baseline | Optimized | Delta |
|---|---|---|---|
| Last-mile delivery cost | $1,040.30 | $845.10 | −18% |
| Procurement risk exposure | 100% | 75% | −25% |
| Avg. route distance per zone | 142 km | 118 km | −17% |
| Vendor compliance score avg | 71% | 89% | +18 pts |
logistics-route-optimizer/
│
├── README.md
├── requirements.txt
├── .env.example
├── .gitignore
│
├── config/
│ └── config.py # API keys, DB config, scoring weights
│
├── sql/
│ ├── schema.sql # Full MySQL schema (6 tables)
│ ├── seed_data.sql # 15 delivery orders + 10 vendors
│ └── queries/
│ ├── route_ranking.sql # Rank routes by cost per zone
│ ├── zone_analysis.sql # Cost concentration by distribution zone
│ └── load_balancing.sql # Detect over/underloaded routes
│
├── scripts/
│ ├── route_optimizer.py # Main orchestration — run this
│ ├── maps_api.py # Google Maps Distance Matrix integration
│ ├── db_connector.py # MySQL query handler
│ └── cost_calculator.py # Consolidation + load-balance cost logic
│
├── vendor_scorecard/
│ ├── vendor_scorecard.py # Weighted KPI scoring → CSV + Excel export
│ └── sample_output/ # Generated reports land here
│
├── data/sample/
│ ├── delivery_orders.csv
│ ├── distribution_zones.csv
│ └── vendor_data.csv
│
└── docs/
├── architecture.md # System design + logic flow
└── results_summary.md # Full simulation results
git clone https://github.com/mousumi-paul/logistics-route-optimizer.git
cd logistics-route-optimizerpip install -r requirements.txtcp .env.example .envOpen .env and fill in:
GOOGLE_MAPS_API_KEY=your_key_here
DB_HOST=localhost
DB_USER=your_user
DB_PASSWORD=your_password
DB_NAME=logistics_db
mysql -u your_user -p < sql/schema.sql
mysql -u your_user -p logistics_db < sql/seed_data.sqlpython scripts/route_optimizer.pypython vendor_scorecard/vendor_scorecard.py💡 No API key? The optimizer includes a simulation mode using pre-built distance data — it runs fully offline for demo and testing purposes.
MySQL (delivery orders)
↓
Group orders into vehicle routes (greedy, respects 1000 kg max load)
↓
Google Maps Distance Matrix API (fetch distances + durations)
↓
Cost Calculator
• Base cost: distance_km × $0.85/km
• Consolidation discount: −12% for multi-stop routes
• Load-balance bonus: −6% for 60–90% vehicle utilization
↓
Rank routes by final cost (per zone)
↓
Results stored → MySQL + printed to console
Weighted Score =
(0.40 × normalized on-time delivery %) +
(0.35 × normalized cost efficiency, inverted) +
(0.25 × normalized compliance score)
Risk Category:
Score ≥ 75 → LOW
Score 55–74 → MEDIUM
Score < 55 → HIGH
Weights are fully configurable in config/config.py.
| Table | Description |
|---|---|
distribution_zones |
Zone IDs, names, and coordinates |
delivery_orders |
Customer orders with lat/lng, load, and priority |
routes |
Computed routes with distance, duration, and cost |
route_orders |
Many-to-many mapping of orders to routes |
vendors |
Supplier KPI data |
vendor_scorecard |
Weighted scores, risk categories, and rankings |
| Output | Location | Format |
|---|---|---|
| Route ranking table | Console | Tabular |
| Vendor scorecard | vendor_scorecard/sample_output/ |
.xlsx + .csv |
| Zone cost summary | Console | Tabular |
| Technology | Role |
|---|---|
| Python 3.10+ | Core scripting and orchestration |
| MySQL 8.0 | Delivery and route data storage |
| Google Maps API | Distance Matrix + Directions |
| pandas | Data processing and normalization |
| openpyxl | Excel report generation |
| Excel / Google Sheets | Vendor scorecard template and reporting |
This project is for portfolio and educational purposes.
© 2026 Mousumi Paul