Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ihfaz297/MND/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The MND backend uses three JSON data files to define the transportation network:- nodes.json - Locations, stops, and intersections
- edges.json - Connections between nodes (walking, bus, local transport)
- routes.json - Bus schedules and trip definitions
MND-backend/src/data/.
nodes.json
Defines all locations in the system.Structure
Node Fields
Unique identifier for the node. Use uppercase with underscores.Examples:
TILAGOR, SHAHI_EIDGAH, CAMPUSHuman-readable display name.Examples:
"Tilagor", "Shahi Eidgah", "Campus"Node classification.Valid types:
stop- Bus stop where passengers can boardintersection- Connection point between routesdestination- Final destination or landmark
Google Maps address for Distance Matrix API.Best practices:
- Use specific landmarks when possible
- Include city and country for accuracy
- Test addresses in Google Maps first
Adding a New Location
- Open
MND-backend/src/data/nodes.json - Add a new entry:
- Verify the address in Google Maps
- Add edges connecting this node (see next section)
edges.json
Defines connections between nodes.Structure
Edge Fields
Origin node ID (must exist in nodes.json).
Destination node ID (must exist in nodes.json).
Transportation mode.Valid modes:
bus- University bus servicewalk- Walking connectionlocal- Local transportation (rickshaw, CNG)
List of bus route IDs that serve this edge. Required for
mode: "bus".Example:Travel time in minutes.Note: Use realistic estimates. Walking speed: ~5 km/h, driving: ~20-30 km/h in city.
Distance in meters.
Cost in local currency (0 for bus and walking).Example costs:
- Bus:
0(free for students) - Walking:
0 - Local transport:
20-50BDT
Whether the edge is one-way only.If
false, the graph automatically creates a reverse edge.Data source for verification.Valid values:
distance_matrix- From Google Distance Matrix APIestimated- Manual estimationmeasured- GPS measurementdensified_local- Auto-generated local transportdensified_walk- Auto-generated walking
Adding a New Connection
- Open
MND-backend/src/data/edges.json - Add a new edge:
- If bidirectional, set
one_way: false - Add
route_idsif served by bus routes
Auto-Populating Edges with Distance Matrix API
Use the script to get accurate data from Google:- Reads nodes from
nodes.json - Calls Google Distance Matrix API
- Updates
edges.jsonwith real distances and times - Respects the 700/month API quota limit
routes.json
Defines bus routes and schedules.Structure
Route Fields
Unique route identifier. Must match IDs in edges.json.Examples:
"bus1", "bus2", "bus3"Display name for the route.Examples:
"Bus 1", "Express Route", "Campus Shuttle"List of scheduled trips for this route.
Trip Fields
Unique trip identifier.Convention:
{route_id}_{departure_time}Examples: "bus1_0825", "bus2_1310"Trip direction.Valid values:
to_campus- Inbound to campusfrom_campus- Outbound from campus
Ordered list of stop IDs the bus visits.Example:
Stops must exist in nodes.json and have corresponding edges in edges.json.
Departure time from first stop in HH:MM format (24-hour).Examples:
"08:25", "13:10", "17:30"Adding a New Bus Route
- Open
MND-backend/src/data/routes.json - Add a new route:
- Update edges.json to include
"bus8"in relevantroute_ids - Restart the backend server
Updating Bus Schedules
To change departure times:- Find the trip in routes.json
- Update the
departure_timefield - Update the
trip_idif needed (convention:{route}_{time}) - Restart the server
Validation
Check Data Integrity
The backend validates data on startup:Invalid node ID in edge: X -> YRoute references unknown node: ZTrip has no stops
Debug Scripts
Test the graph structure:Best Practices
Node IDs
- Use uppercase with underscores
- Keep IDs short but descriptive
- Don’t change IDs after deployment (breaks user favorites)
Google Maps Addresses
- Test in Google Maps first
- Use landmarks for better accuracy
- Include city/country to avoid ambiguity
Edges
- Add bidirectional edges unless truly one-way
- Use realistic travel times (factor in traffic)
- Set
cost: 0for free transportation - Update
sourcefield for tracking
Routes
- Use consistent naming (Bus 1, Bus 2, etc.)
- List stops in actual visit order
- Use 24-hour time format
- Add return trips for all routes
Testing Changes
- Edit JSON files
- Restart backend server
- Test API:
GET /api/routes?from=X&to=Y&time=08:30 - Verify in frontend/mobile app
Common Scenarios
Scenario 1: Add a New Stop to Existing Route
- Add node to
nodes.json - Add edges connecting it to adjacent stops
- Update route’s
stopsarray inroutes.json - Restart server
Scenario 2: Change Bus Schedule Times
- Edit
departure_timeinroutes.json - Update
trip_idto match new time - Restart server
Scenario 3: Add a New Bus Route
- Create edges in
edges.jsonwith newroute_id - Add route definition in
routes.json - Restart server
Scenario 4: Remove a Location
- Remove from
nodes.json - Remove all edges referencing it from
edges.json - Remove from route
stopsinroutes.json - Restart server