Overview
TheRouteOption model represents a complete route from origin to destination, including all legs (bus, local transport, walking), timing, transfers, and cost information.
Type Definition
/home/daytona/workspace/source/MND-backend/src/core/types.ts:86-97
Fields
Human-readable label describing this route option.Examples:
"Fastest Route""Least Local Transport""Bus 1 + Local""Best Option"
Route category based on optimization goal.
Route structure type.
Number of bus-to-bus transfers required.
0: Direct route or local only1: One transfer between buses2+: Multiple transfers (rare)
Total journey time in minutes, including:
- Wait time for buses
- Bus travel time
- Local transport time
- Walking time
- Transfer time between buses
Total cost in local currency (Bangladeshi Taka).
- Bus rides: 0 (free university service)
- Local transport (CNG/rickshaw): 15-50 BDT depending on distance
- Walking: 0
Time spent in paid local transport (CNG, rickshaw) in minutes.Used to differentiate routes that prefer free bus service over paid alternatives.
Distance traveled via local transport in meters.May be 0 if distance data is not available or route uses only buses/walking.
Whether this route used Google Distance Matrix API for calculations.
true: At least one leg used real-time distance/duration from Googlefalse: All calculations from pre-computed graph data
Array of route segments in order. See RouteLeg model.Each leg represents:
- A bus ride between stops
- A local transport segment
- A walking segment
Examples
Direct Bus Route
Simplest case: single bus from origin to destination.Bus + Local Transport
Combines bus ride with CNG/rickshaw to reach final destination faster.Local Only Route
No bus available; uses only CNG/rickshaw and walking.Transfer Route
Requires changing between bus routes.Category Selection Logic
The API returns multiple route options with different categories:Fastest
Selected whentotalTimeMin is minimal among all options.
Least Local
Selected whenlocalTimeMin is minimal (preferably 0).
Both
Selected when a route is both fastest AND uses least local transport.Cost Calculation
Bus Rides
Free university service:Local Transport
Based on pre-configured costs in graph data:- Short distance (< 2 km): 15-20 BDT
- Medium distance (2-5 km): 25-35 BDT
- Long distance (> 5 km): 40-50 BDT
Walking
Always free:Time Calculation
Total Time Components
- Wait Time: Time until next bus departure
- Bus Time: Actual bus travel time
- Local Transport Time: CNG/rickshaw time
- Walking Time: Pedestrian time
- Transfer Time: Time between buses (if applicable)
Example Calculation
Request at 08:15 for route with bus at 08:30:Distance Matrix Usage
WhenusesDistanceMatrix: true, at least one leg used real-time data:
Distance Matrix results are cached. Check
/api/health for cache statistics.Validation
Required Fields
All fields are required in the response. Missing fields indicate a server error.Constraints
transfers ≥ 0totalTimeMin > 0totalCost ≥ 0localTimeMin ≤ totalTimeMinlocalDistanceMeters ≥ 0legs.length > 0
Type Validation
Related Models
RouteLeg
Individual route segment
Route Response
Complete API response structure
Node
Location/stop information
Bus Schedule
Bus trip timing data