# ali26m/vehicle-trajectory-tracking architecture

> Architecture diagram of the GitHub repository ali26m/vehicle-trajectory-tracking, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ali26m/vehicle-trajectory-tracking
- Repository: https://github.com/ali26m/vehicle-trajectory-tracking

## Overview

##### Project type and purpose
- This is a full-stack vehicle-trajectory tracking and prediction system.

##### File structure analysis
- Top-level directories:
- Data – raw and preprocessed datasets (CSV, JSON text files).
- Machine_Learning_Model – offline model-training notebook, encoders, and serialized model artifacts.
- Route_Tracking – Python scripts to stream and track live vehicle locations.
- Tree_API – a Flask (app.py) microservice exposing the trained models for inference.
- web – frontend and supporting scripts: authentication (auth.py/html), adding cars (add_cars.py), map UIs (main_map.html, predict.html, powerbi.html), plus two Dockerized services for real-time location ingest (`get_real_location`) and map data (`map_docker`).
- Configuration files: two Dockerfiles under web/get_real_location and web/map_docker, plus Python requirements.

##### README insights
- The README only lists the project name, but the structure implies:
- Offline ML pipeline (model training & saving).
- Real-time data ingestion and tracking.
- REST API for model inference.
- Web frontend for user interaction and visualization.

##### Final advice
- Every distinct logical component—don’t lump the tracker and ingestion logic with the API.
- Be explicit about offline vs. real-time paths so stakeholders see the end-to-end flow at a glance.

## Diagram (Mermaid)

```mermaid
graph TB
    %% External Data Source
    Vehicle("Vehicle GPS Stream"):::external

    %% Data Layer
    DataStorage[(Data Storage)]:::storage

    %% Offline ML Pipeline
    subgraph "Offline ML Pipeline"
        direction TB
        ModelTraining["Model Training Notebook"]:::offline
        Encoders["Encoders"]:::offline
        Models["Serialized Models"]:::offline
    end

    %% Real-Time Ingestion Layer
    subgraph "Real-Time Ingestion Layer"
        direction TB
        LocationStreamer["Location Streamer"]:::service
        Tracker["Tracker Service"]:::service
    end

    %% Inference API Layer
    Api["Flask Inference API"]:::api

    %% Dockerized Microservices
    subgraph "Docker Services"
        direction TB
        Ingestor["Real-Time Location Ingestor"]:::container
        MapProvider["Map Data Provider"]:::container
    end

    %% Frontend Layer
    subgraph "Web Frontend UI"
        direction TB
        AuthHTML["auth.html"]:::frontend
        AuthLogic["auth.py"]:::frontend
        AddCars["add_cars.py"]:::frontend
        MainMap["main_map.html"]:::frontend
        PredictHTML["predict.html"]:::frontend
        PowerBI["powerbi.html"]:::frontend
        CSSAuth["css/auth.css"]:::frontend
        CSSPredict["css/predict.css"]:::frontend
        CSSGlobal["css/style.css"]:::frontend
    end

    %% Data Flow Arrows
    DataStorage -->|feeds| ModelTraining
    ModelTraining -->|trains & exports| Encoders
    Encoders -->|encodes features| Models
    Models -->|loaded by| Api

    Vehicle -->|streams GPS| LocationStreamer
    LocationStreamer -->|prepares payload| Tracker
    Tracker -->|HTTP/JSON| Api

    Ingestor -->|HTTP/JSON| Frontend
    MapProvider -->|HTTP/JSON| Frontend
    Api -->|HTTP/JSON| Frontend

    %% Click Events
    click DataStorage "https://github.com/ali26m/vehicle-trajectory-tracking/tree/main/Data/"
    click ModelTraining "https://github.com/ali26m/vehicle-trajectory-tracking/blob/main/Machine_Learning_Model/Model Training.ipynb"
    click Encoders "https://github.com/ali26m/vehicle-trajectory-tracking/tree/main/Machine_Learning_Model/Encoders/"
    click Models "https://github.com/ali26m/vehicle-trajectory-tracking/tree/main/Machine_Learning_Model/Models/"
    click LocationStreamer "https://github.com/ali26m/vehicle-trajectory-tracking/blob/main/Route_Tracking/location_streamer.py"
    click Tracker "https://github.com/ali26m/vehicle-trajectory-tracking/blob/main/Route_Tracking/tracker.py"
    click Api "https://github.com/ali26m/vehicle-trajectory-tracking/blob/main/Tree_API/app.py"
    click AuthHTML "https://github.com/ali26m/vehicle-trajectory-tracking/blob/main/web/auth.html"
    click AuthLogic "https://github.com/ali26m/vehicle-trajectory-tracking/blob/main/web/auth.py"
    click CSSAuth "https://github.com/ali26m/vehicle-trajectory-tracking/blob/main/web/css/auth.css"
    click AddCars "https://github.com/ali26m/vehicle-trajectory-tracking/blob/main/web/add_cars.py"
    click MainMap "https://github.com/ali26m/vehicle-trajectory-tracking/blob/main/web/main_map.html"
    click PredictHTML "https://github.com/ali26m/vehicle-trajectory-tracking/blob/main/web/predict.html"
    click CSSPredict "https://github.com/ali26m/vehicle-trajectory-tracking/blob/main/web/css/predict.css"
    click CSSGlobal "https://github.com/ali26m/vehicle-trajectory-tracking/blob/main/web/css/style.css"
    click PowerBI "https://github.com/ali26m/vehicle-trajectory-tracking/blob/main/web/powerbi.html"
    click Ingestor "https://github.com/ali26m/vehicle-trajectory-tracking/tree/main/web/get_real_location/"
    click MapProvider "https://github.com/ali26m/vehicle-trajectory-tracking/tree/main/web/map_docker/"

    %% Styles
    classDef storage fill:#B3E5FC,stroke:#0288D1,stroke-width:2px;
    classDef offline fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef service fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px;
    classDef api fill:#F8BBD0,stroke:#C2185B,stroke-width:2px;
    classDef container fill:#FFCDD2,stroke:#D32F2F,stroke-width:2px;
    classDef frontend fill:#E0E0E0,stroke:#616161,stroke-width:2px;
    classDef external fill:#ECEFF1,stroke:#90A4AE,stroke-width:2px,stroke-dasharray: 5 5;
```
