Production-grade automotive fleet management platform with real-time telematics (OBD-II, CAN Bus, GPS)
Project description
๐ Fleet Management System โ Automotive Telematics
A comprehensive Python-based fleet management platform with real-time vehicle telematics, designed for the automotive sector.
Built with: Python 3.10+ ยท FastAPI ยท SQLAlchemy ยท OBD-II ยท CAN Bus ยท GPS/GNSS
๐ธ Live Dashboard Preview
Real-time fleet dashboard showing vehicle tracking, engine telemetry, fuel levels, and active alerts.
๐บ๏ธ Live Fleet Map
Interactive Leaflet.js map with real-time vehicle positions, status-coded markers, search, and filtering.
๐ About
This system provides end-to-end fleet management for automotive companies, logistics operators, and transportation businesses. It connects directly to vehicles via OBD-II, CAN bus, and GPS to collect real-time telemetry data, enabling fleet operators to:
- Monitor every vehicle in real-time โ location, speed, engine health, fuel levels
- Detect and diagnose faults instantly โ 600+ Diagnostic Trouble Codes with severity analysis
- Improve driver safety โ automatic detection of harsh braking, speeding, aggressive driving
- Reduce operational costs โ fuel consumption analytics, predictive maintenance scheduling
- Ensure compliance โ geofence monitoring, trip logging, driver behavior scoring
The platform is designed following automotive industry standards (SAE J1979, ISO 11898, NMEA 0183) and is compatible with any vehicle manufactured after 1996 (OBD-II mandatory).
๐ฏ Use Cases
1. ๐ Logistics & Delivery Fleet
Track delivery vehicles across cities in real-time. Monitor route adherence, delivery times, and fuel consumption. Get alerts when vehicles deviate from geofenced zones or when drivers speed.
Key features used: GPS Tracking, Geofencing, Trip Logging, Fuel Analytics
2. ๐ข Corporate Fleet Management
Manage a company's vehicle fleet โ from sales team cars to executive vehicles. Track maintenance schedules, ensure vehicles are serviced on time, and monitor driver behavior for insurance compliance.
Key features used: Maintenance Scheduling, Driver Safety Scores, Vehicle CRUD, Alerts
3. ๐ Taxi & Ride-Hailing Operations
Monitor cab fleets in real-time. Track idle time, trip distances, fuel efficiency per driver, and identify underperforming vehicles. Automate maintenance alerts based on mileage and engine diagnostics.
Key features used: Trip Tracking, Fuel Analytics, OBD-II Diagnostics, Driver Scoring
4. ๐๏ธ Construction & Heavy Equipment
Track construction vehicles and heavy machinery across job sites. Monitor engine hours, overheating, and excessive idling. Schedule preventive maintenance to avoid costly breakdowns.
Key features used: Engine Health Monitoring, Idle Alerts, Maintenance Records, CAN Bus Data
5. ๐ Public Transportation
Monitor buses, shuttles, and municipal vehicles. Ensure route compliance, track real-time passenger vehicle locations, and maintain vehicle health across a large fleet.
Key features used: GPS Tracking, Geofencing, Fleet Dashboard, Alert Engine
6. ๐ง Vehicle Diagnostics Workshop
Use the DTC Analyzer as a diagnostic tool. Connect to customer vehicles via OBD-II, read fault codes, get severity assessments, and generate repair recommendations with cost estimates.
Key features used: OBD-II Reader, DTC Analyzer, Maintenance Suggestions
7. ๐ Insurance Telematics (UBI)
Implement Usage-Based Insurance by collecting driving behavior data โ speed patterns, braking habits, acceleration profiles. Generate driver safety scores for premium calculations.
Key features used: Driver Behavior Monitoring, Safety Scores, Trip Analytics, Telemetry History
8. ๐ EV Fleet Management
Monitor electric vehicle fleets with battery level tracking (via fuel_level), charging patterns, and range estimation. Track energy consumption efficiency across the fleet.
Key features used: Battery Monitoring, Fuel/Energy Analytics, Vehicle Status Tracking
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Web Dashboard (Jinja2) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ FastAPI REST API โ
โโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโโโโโโค
โ Vehicle โ Fleet โ Telematicsโ Alert โ Diagnostics โ
โ Manager โ Manager โ Engine โ Engine โ (DTC) โ
โโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโโโโโโค
โ SQLAlchemy ORM + SQLite/PostgreSQL โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ OBD-II โ GPS โ CAN Bus โ MQTT โ Simulator โ
โ Reader โ Tracker โ Decoder โ (opt) โ (testing) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ Project Structure
FLEETMANAGMENT/
โโโ main.py # Application entry point
โโโ cli.py # CLI tool (fleet-management command)
โโโ pyproject.toml # Python package configuration
โโโ Dockerfile # Multi-stage production Docker image
โโโ docker-compose.yml # One-command deployment
โโโ gunicorn_config.py # Production ASGI server config
โโโ simulator.py # Telemetry data simulator
โโโ requirements.txt # Python dependencies
โโโ .env.production # Production environment template
โ
โโโ .github/workflows/ # CI/CD Pipelines
โ โโโ ci-cd.yml # Auto test, build, publish
โ โโโ release.yml # Manual release trigger
โ
โโโ config/
โ โโโ settings.py # Centralized configuration
โ
โโโ models/ # Database models (SQLAlchemy)
โ โโโ database.py # DB engine & session
โ โโโ vehicle.py # Vehicle model (VIN, make, model, status)
โ โโโ telemetry.py # Time-series telemetry data
โ โโโ driver.py # Driver profiles & safety scores
โ โโโ alert.py # Alert records (speeding, DTC, etc.)
โ โโโ trip.py # Trip tracking (start/end, distance)
โ โโโ maintenance.py # Maintenance records & scheduling
โ โโโ geofence.py # Virtual geographic boundaries
โ
โโโ telematics/ # Vehicle communication modules
โ โโโ obd_reader.py # OBD-II protocol (SAE J1979)
โ โโโ gps_tracker.py # GPS/GNSS via NMEA 0183
โ โโโ can_decoder.py # CAN bus frame decoding
โ โโโ dtc_analyzer.py # Diagnostic Trouble Code analysis
โ โโโ alert_engine.py # Real-time alert evaluation
โ
โโโ services/
โ โโโ tracking_service.py # Vehicle tracking orchestrator
โ
โโโ api/ # FastAPI REST endpoints
โ โโโ vehicles.py # Vehicle CRUD
โ โโโ telemetry.py # Telemetry ingest & query
โ โโโ alerts.py # Alert management
โ โโโ dashboard.py # Web dashboard
โ
โโโ templates/
โ โโโ dashboard.html # Fleet dashboard UI
โ โโโ fleet_map.html # Leaflet.js live fleet map
โ
โโโ data/ # SQLite database (auto-created)
๐ Quick Start
Choose your preferred deployment method:
Option A: Docker (Recommended for Production)
# Clone the repo
git clone https://github.com/santoshiimind/fleet-management-system.git
cd fleet-management-system
# Start production server
docker compose up -d
# Seed sample data
docker compose exec fleet-api python cli.py seed
# Start with simulator (demo mode)
docker compose --profile demo up -d
Option B: pip Install from PyPI
# Install as a Python package (live on PyPI!)
pip install fleet-management-system
# Seed sample data & start server
fleet-management seed
fleet-management run
# Or run in development mode with hot-reload
fleet-management run --dev
Option C: From Source
cd FLEETMANAGMENT
pip install -r requirements.txt
python main.py --seed
Open the Dashboard
- Dashboard: http://localhost:8000/
- API Docs: http://localhost:8000/docs
- Health Check: http://localhost:8000/health
Run the Simulator (separate terminal)
python simulator.py
๐ณ Docker Deployment
Production
# Build and start
docker compose up -d --build
# View logs
docker compose logs -f fleet-api
# Check health
docker compose ps
# Stop
docker compose down
Environment Configuration
Copy .env.production to .env and customize:
cp .env.production .env
Key settings:
| Variable | Default | Description |
|---|---|---|
API_PORT |
8000 |
Server port |
API_SECRET_KEY |
โ | Change in production! |
GUNICORN_WORKERS |
4 |
Worker processes |
DB_DB_URL |
sqlite:///data/fleet.db |
Database URL |
LOG_LEVEL |
info |
Log verbosity |
CLI Commands
fleet-management run # Start production server
fleet-management run --dev # Dev mode with hot-reload
fleet-management run --port 9000 # Custom port
fleet-management seed # Seed sample data
fleet-management seed --force # Clear & re-seed
fleet-management check # Health check running server
fleet-management version # Show version info
Release & Publishing
The project includes CI/CD pipelines that automatically:
- Test across Python 3.10โ3.13 on every push
- Build Python package (wheel + sdist) and Docker image
- Publish to PyPI and GitHub Container Registry on tag push
- Create GitHub Release with artifacts
# Create a release (triggers full CI/CD โ PyPI + Docker + GitHub Release)
git tag v1.1.0
git push --tags
Or use the manual Release workflow from GitHub Actions UI.
๐ Telematics Features
OBD-II Diagnostics (telematics/obd_reader.py)
Reads real-time data from the vehicle's ECU via the OBD-II port:
- Engine RPM, vehicle speed, throttle position
- Coolant temperature, oil temperature
- Fuel level, fuel consumption rate
- Battery voltage
- Diagnostic Trouble Codes (DTCs)
Protocols supported: SAE J1850, ISO 9141, ISO 14230 (KWP), ISO 15765 (CAN)
GPS Tracking (telematics/gps_tracker.py)
Real-time vehicle positioning via NMEA 0183 protocol:
- Latitude/Longitude/Altitude
- Speed and heading from GPS
- Satellite count for fix quality
- Geofence boundary checking (Haversine formula)
CAN Bus Decoding (telematics/can_decoder.py)
Direct vehicle network data access:
- Engine data (RPM, torque, temperatures)
- Wheel speeds, brake pressure, ABS status
- Transmission data (gear, temp)
- Fuel system data
- Battery and electrical system
DTC Analysis (telematics/dtc_analyzer.py)
Intelligent diagnostic trouble code interpretation:
- 600+ DTC codes in the database (P, C, B, U codes)
- Severity assessment (critical โ low)
- Safety recommendations
- Maintenance suggestions with cost estimates
- Supports SAE J2012 standard codes
Alert Engine (telematics/alert_engine.py)
Real-time monitoring with configurable thresholds:
- ๐จ Speeding โ Warning at 120 km/h, critical at 150 km/h
- ๐ก๏ธ Engine overheat โ Warning at 100ยฐC, critical at 115ยฐC
- โฝ Low fuel โ Warning at 15%, critical at 5%
- ๐ Low battery โ Warning below 11.5V
- ๐ Harsh braking โ Deceleration > 8 m/sยฒ
- ๐๏ธ Harsh acceleration โ Acceleration > 5 m/sยฒ
- ๐ Geofence violations โ Entry/exit alerts
- ๐ง DTC detection โ Automatic fault alerts
๐ก API Endpoints
Dashboard
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Main dashboard page |
| GET | /map |
Live fleet map (Leaflet.js) |
| GET | /api/v1/dashboard/fleet-map |
Vehicle locations (JSON) |
| GET | /api/v1/dashboard/fleet-map/geojson |
Vehicle locations (GeoJSON) |
| GET | /api/v1/dashboard/stats |
Fleet statistics |
Vehicles
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/vehicles/ |
Register a new vehicle |
| GET | /api/v1/vehicles/ |
List all vehicles |
| GET | /api/v1/vehicles/{id} |
Get vehicle details |
| PUT | /api/v1/vehicles/{id} |
Update vehicle |
| DELETE | /api/v1/vehicles/{id} |
Deactivate vehicle |
| GET | /api/v1/vehicles/{id}/location |
Get GPS location |
| GET | /api/v1/vehicles/fleet/summary |
Fleet statistics |
Telemetry
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/telemetry/ingest |
Ingest telemetry data |
| GET | /api/v1/telemetry/{id}/latest |
Latest reading |
| GET | /api/v1/telemetry/{id}/history |
Historical data |
| GET | /api/v1/telemetry/{id}/diagnostics |
DTC analysis |
| GET | /api/v1/telemetry/{id}/fuel-analytics |
Fuel stats |
Alerts
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/alerts/ |
List alerts (filtered) |
| PUT | /api/v1/alerts/{id}/acknowledge |
Acknowledge alert |
| GET | /api/v1/alerts/summary |
Alert statistics |
๐ง Configuration
All settings are in config/settings.py and can be overridden via environment variables:
# Database
DB_DB_URL=postgresql://user:pass@localhost/fleet
# OBD-II
TELEM_OBD_PORT=COM3
TELEM_OBD_BAUDRATE=9600
# GPS
TELEM_GPS_PORT=COM4
# CAN Bus
TELEM_CAN_INTERFACE=pcan
TELEM_CAN_CHANNEL=PCAN_USBBUS1
# Alert Thresholds
ALERT_SPEED_LIMIT_WARNING=120
ALERT_ENGINE_TEMP_CRITICAL=115
# API
API_PORT=8000
API_DEBUG=true
๐ญ Hardware Integration (Production)
For real vehicle connectivity, install the optional packages:
pip install obd # ELM327 OBD-II adapter
pip install python-can # CAN bus (PCAN, Vector, Kvaser)
pip install pyserial # GPS serial communication
pip install paho-mqtt # MQTT for IoT messaging
Recommended hardware:
- OBD-II: ELM327 Bluetooth/USB adapter
- GPS: u-blox M8N/M9N GNSS module
- CAN: PEAK PCAN-USB adapter
- Telematics unit: Raspberry Pi + CAN HAT + GPS module
๐ Tech Stack
| Component | Technology |
|---|---|
| Language | Python 3.10+ |
| Web Framework | FastAPI |
| Database ORM | SQLAlchemy 2.0 |
| Database | SQLite (dev) / PostgreSQL (prod) |
| Dashboard | Jinja2 + HTML/CSS |
| OBD-II | python-obd |
| CAN Bus | python-can |
| GPS | pyserial + NMEA parser |
| Server (dev) | Uvicorn (ASGI) |
| Server (prod) | Gunicorn + Uvicorn Workers |
| Containerization | Docker + Docker Compose |
| CI/CD | GitHub Actions |
| Package | PyPI (pip installable) |
๐ Automotive Standards Referenced
- OBD-II: SAE J1979 (diagnostic services), SAE J2012 (DTCs)
- CAN Bus: ISO 11898 (physical/data link layer)
- GPS: NMEA 0183 (sentence protocol)
- VIN: ISO 3779 (vehicle identification number)
- DTC: SAE J2012 (P, C, B, U codes)
๐บ๏ธ Roadmap
- Leaflet.js live fleet map with real-time tracking
- WebSocket support for real-time dashboard updates
- Driver mobile app (React Native)
- PDF report generation (daily/weekly fleet reports)
- Machine Learning-based predictive maintenance
- Multi-tenant support for fleet management SaaS
- Integration with fuel card providers
- OTA (Over-The-Air) firmware updates for telematics devices
- REST API authentication (JWT/OAuth2)
- Docker & Docker Compose production deployment
- PyPI package (pip installable)
- CI/CD pipeline (GitHub Actions)
- Kubernetes (Helm chart) deployment
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ License
Copyright 2026 Santosh Kumar
This project is licensed under the Apache License 2.0 โ see the LICENSE and NOTICE files for details.
Attribution Required: If you use, modify, or distribute this software, you must give appropriate credit to the original author. See the NOTICE file for attribution requirements.
Built with โค๏ธ by Santosh Kumar for the Automotive Industry
Fleet Management System โ Real-time Telematics for Smarter Fleets
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fleet_management_system-1.1.0.tar.gz.
File metadata
- Download URL: fleet_management_system-1.1.0.tar.gz
- Upload date:
- Size: 60.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bbba23e7953e106ffa767bfbe1a475c1e003d9b256d9e8ca6f41c83e48ca51c
|
|
| MD5 |
460ec664cf7f67736b24250a3df774fa
|
|
| BLAKE2b-256 |
d57053d5555fbd6fbf8c05e93e800ab2963ed70bdbeb9c96c4f65631c363f944
|
Provenance
The following attestation bundles were made for fleet_management_system-1.1.0.tar.gz:
Publisher:
ci-cd.yml on santoshiimind/fleet-management-system
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fleet_management_system-1.1.0.tar.gz -
Subject digest:
7bbba23e7953e106ffa767bfbe1a475c1e003d9b256d9e8ca6f41c83e48ca51c - Sigstore transparency entry: 952599351
- Sigstore integration time:
-
Permalink:
santoshiimind/fleet-management-system@e47a7d0ad36196d56933743842f76e2e616624a2 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/santoshiimind
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@e47a7d0ad36196d56933743842f76e2e616624a2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file fleet_management_system-1.1.0-py3-none-any.whl.
File metadata
- Download URL: fleet_management_system-1.1.0-py3-none-any.whl
- Upload date:
- Size: 53.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cc668befc049266c9e3dd553df3f8796188b5091fa0e49763505330e75bf513
|
|
| MD5 |
527ed6ffc21b6c2ef876e84890b0ec3f
|
|
| BLAKE2b-256 |
4fbee3c117a2810ba7923c0c74e362658d07f755083a9169d37ba8dde5974d9e
|
Provenance
The following attestation bundles were made for fleet_management_system-1.1.0-py3-none-any.whl:
Publisher:
ci-cd.yml on santoshiimind/fleet-management-system
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fleet_management_system-1.1.0-py3-none-any.whl -
Subject digest:
0cc668befc049266c9e3dd553df3f8796188b5091fa0e49763505330e75bf513 - Sigstore transparency entry: 952599357
- Sigstore integration time:
-
Permalink:
santoshiimind/fleet-management-system@e47a7d0ad36196d56933743842f76e2e616624a2 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/santoshiimind
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci-cd.yml@e47a7d0ad36196d56933743842f76e2e616624a2 -
Trigger Event:
push
-
Statement type: