How thiennguyen62/map-search works
Map Search is a metro route-finding web app. A user selects source and destination stations, chooses Dijkstra or A*, requests a route, and views its route details on a map. The backend loads station and edge data into a graph, resolves station names, computes routes, and exposes JSON APIs. Separate account and admin capabilities include authentication, user management, login history, and admin-state storage. The README documents A* selection, but the sampled pathfinding service calls Dijkstra; unsampled frontend wiring and admin-data updates are not assumed.
Main entry points: app.py Web application · graph.py Graph loader · script.js Route search · routes.py JSON API
Components 20
Web interface
- Route search
frontend/js/script.js - Map display
frontend/js/diagram.js - Login and signup
frontend/js/login.js - User profile
frontend/js/user.js - Login history
frontend/js/user_history.js - Admin interface
frontend/html/admin.html
Route computation
- Web application
backend/app.py - JSON API
backend/api/routes.py - Route service
backend/services/pathfinding_service.py - Dijkstra search
backend/algorithms/dijkstra.py - A* search
backend/algorithms/astar.py
Accounts and admin
- User service
backend/services/user.py - User database
backend/users.db - Admin state
data/admin.json
Transit data
- Graph loader
backend/models/graph.py - Station model
backend/models/station.py - Edge model
backend/models/edge.py - Station records
data/stations.json - Connection records
data/edges.json
Other components
- Traveler
Connections 21
- Traveler → Route search: chooses stations
README.md - Route search → JSON API: requests route
README.md - JSON API → Route service: calls find_path
backend/api/routes.py - Route service → Graph loader: loads graph
backend/services/pathfinding_service.py - Route service → Dijkstra search: calls fallback
backend/services/pathfinding_service.py - JSON API → Route search: returns route JSON
README.md - Route search → Map display: displays route
README.md - Graph loader → Station records: reads stations
- Graph loader → Connection records: reads connections
- Graph loader → Station model: creates stations
backend/models/graph.py - Graph loader → Edge model: creates edges
backend/models/graph.py - Traveler → Login and signup: authenticates
README.md - Web application → JSON API: registers routes
backend/app.py - Web application → User service: uses account operations
backend/app.py - User service → User database: reads and writes
backend/services/user.py - Login and signup → Web application: uses auth API
- User profile → Web application: uses account API
- Login history → Web application: requests history
- Admin interface → Web application: uses admin API
- Admin interface → Admin state: admin state
- Traveler → A* search: can select A*