How anhquannguyen1/ttnt works
Project type and purpose
• Pathfinder is a domain-specific navigational tool (not a full-stack web app or microservice mesh)
• Purpose: compute and display the shortest path on a local map of the Tran Hung Dao area in Hanoi
• Key features: A*-based pathfinding, multiple traffic/flood constraint modes, interactive map interface
File structure
• Top level
– README.md (overview, usage)
– data/ (all static map data and generated HTML)
– src/ (all Python modules)
• data/ contains:
– map.osm, graphml/xml files, border.txt, blocked_edges.txt (map inputs)
– map2.html, map2_flood.html, map2_traffic.html (frontend views)
– out4.txt (intermediate or logging output)
• src/ contains:
– backend.py (entry point, likely runs a simple server or CLI orchestrator)
– getInput.py, extract.py, preprocessingMap.py, getBorder.py (data-prep pipeline)
– astar.py, astar_flood.py, astar_traffic.py (pathfinding algorithms)
– test.py (unit/integration tests)
README for additional insights
• Then open data/map2.html in a browser
• Implies: the Python backend processes map data and writes/serves an interactive HTML frontend
Main components & interactions
a. Components
1. User (Browser / Map UI)
2. Frontend View (data/map2.html + embedded JavaScript)
3. Backend Service (src/backend.py)
• Data-prep pipeline
• Pathfinding engine
• Visualization module
4. Data Layer (data/*.osm, *.txt, *.graphml.xml)
b. Relationships & data flow
• User clicks start/end in map2.html → HTTP request / file-based IPC to backend.py
• backend.py invokes preprocessingMap → extract → getBorder → getInput
• Pathfinding engine module (selects astar.py, astar_flood.py or astar_traffic.py)
• Frontend loads/refreshes with the computed path overlay
c. Architectural patterns & design principles
• Modular pipeline: clear separation of data extraction, preprocessing, algorithm, rendering
• Strategy pattern for selecting different A* variants (flood, traffic, vanilla)
• File-based I/O versus in-memory data flow
d. Technologies & libraries
• Python 3 scripts
• OSM/GraphML for map data
• A* algorithm implementations
• Simple HTML/JS for map interface
Detail is key
• Major Python scripts as discrete components or subcomponents
• How map2.html is both an input (template) and an output (rendered view)