# da0xd-htn/gps-navigation-system architecture

> Architecture diagram of the GitHub repository da0xd-htn/gps-navigation-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/da0xd-htn/gps-navigation-system
- Repository: https://github.com/da0xd-htn/gps-navigation-system

## Overview

##### Main Components

A. Frontend Layer:
- Web Interface (templates/index.html)
- Static Assets (CSS/JS)
- Client-side Interactions

B. Backend Layer:
- Flask Web Server (app.py)
- Route Calculation Engine
- Data Processing Modules

C. Data Layer:
- OSM Data (Setifmap.osm)
- Processed Data Files (coordinates.csv, roads.csv)
- Graph Database (graph.pkl)

##### Component Relationships and Data Flow

**[Client Browser] ←→ [Flask Web Server] ←→ [Route Calculation Engine] ←→ [Data Storage]**

##### Detailed Component Breakdown

A. Client Layer (Top):

- Web Interface     |
- HTML (index.html)  |
- CSS (style.css)    |
- JS (script.js)     |

B. Application Layer (Middle):

- Flask Web Server    |
- (app.py)         |

- ↓

- Route Calculation Core |
- route_calculation.py |
- extract_roads.py     |
- inspect_graph.py     |

C. Data Layer (Bottom):

- Data Storage       |
- OpenStreetMap Data   |
- Coordinate Database  |
- Road Network Graph   |

##### Additional Elements

A. Processing Flows:
- Data preprocessing flow (OSM → roads.csv → graph.pkl)
- Real-time route calculation flow
- User interaction paths

B. System Boundaries:
- Clear separation between client and server
- Database access patterns
- External data source interactions

##### Technical Details to Highlight

- Flask REST API endpoints
- Graph processing algorithms
- Data format transformations
- Client-side rendering of routes
- Caching mechanisms (if any)

##### Notes for Implementation

- The separation between the web interface and processing engine
- The data flow from raw OSM data to processed graph structure
- The route calculation pipeline
- Real-time user interactions and responses

Remember to:
- Use consistent styling
- Version information
- Notes for any critical processes
- Document any assumptions or limitations

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef api fill:#e74c3c,stroke:#c0392b,color:white

    %% Frontend Layer
    subgraph Frontend
        WebUI["Web Interface"]:::frontend
        CSS["Frontend Styling"]:::frontend
        JS["Frontend Scripts"]:::frontend
    end

    %% Backend Layer
    subgraph Backend
        Flask["Flask Web Server"]:::backend
        RouteEngine["Route Calculation Engine"]:::backend
        GraphInspector["Graph Inspector"]:::backend
        RoadExtractor["Road Data Extractor"]:::backend
    end

    %% Data Layer
    subgraph Storage
        OSMData["OpenStreetMap Data"]:::data
        CoordDB["Coordinate Database"]:::data
        RoadDB["Road Network Database"]:::data
        GraphDB["Graph Database"]:::data
    end

    %% Relationships
    WebUI --> Flask
    CSS --> WebUI
    JS --> WebUI
    
    Flask --> RouteEngine
    Flask --> GraphInspector
    Flask --> RoadExtractor
    
    RouteEngine --> GraphDB
    GraphInspector --> GraphDB
    RoadExtractor --> OSMData
    RoadExtractor --> CoordDB
    RoadExtractor --> RoadDB
    
    %% Click events for component mapping
    click WebUI "https://github.com/da0xd-htn/GPS-Navigation-System/blob/main/templates/index.html"
    click CSS "https://github.com/da0xd-htn/GPS-Navigation-System/blob/main/static/css/style.css"
    click JS "https://github.com/da0xd-htn/GPS-Navigation-System/blob/main/static/js/script.js"
    click Flask "https://github.com/da0xd-htn/GPS-Navigation-System/blob/main/src/app.py"
    click RouteEngine "https://github.com/da0xd-htn/GPS-Navigation-System/blob/main/src/route_calculation.py"
    click GraphInspector "https://github.com/da0xd-htn/GPS-Navigation-System/blob/main/src/inspect_graph.py"
    click RoadExtractor "https://github.com/da0xd-htn/GPS-Navigation-System/blob/main/src/extract_roads.py"
    click OSMData "https://github.com/da0xd-htn/GPS-Navigation-System/blob/main/data/Setifmap.osm"
    click CoordDB "https://github.com/da0xd-htn/GPS-Navigation-System/blob/main/data/coordinates.csv"
    click RoadDB "https://github.com/da0xd-htn/GPS-Navigation-System/blob/main/data/roads.csv"
    click GraphDB "https://github.com/da0xd-htn/GPS-Navigation-System/blob/main/data/graph.pkl"

    %% Legend
    subgraph Legend
        Frontend_L["Frontend Component"]:::frontend
        Backend_L["Backend Component"]:::backend
        Data_L["Data Storage"]:::data
    end
```
