Single-user Python app for viewing Nissan LEAF logs collected with Leaf Spy Pro. Upload a CSV, pick a trip, and explore it: map, SOC and thermal charts, and a point-by-point data table. No login, no registration.
Stack: Python + FastAPI + SQLite on the backend; Leaflet/OpenStreetMap plus Plotly and vanilla JS (no jQuery) on the frontend.
- Trip list with summary bar (distance, average speed, SOC change, SOH)
- Map with Start/End markers and per-segment efficiency colouring in quintile bands with a live legend (grey dot when parked, dashed grey when the power data is unusable)
- SOC chart with cumulative energy used, plus thermal chart; hovering a chart highlights the table row and pinpoints the map
- Data table with trip-absolute node numbers, cumulative miles, seg/trip mi/kWh and Wh used, GPS/DEM elevation, per-row ignore; clicking a row pins its point on the map, and map hover highlights rows back
- Trip editing: split at the pinned row, merge with the next trip, adjustable gap threshold, per-trip energy and dwell in the picker
- DEM elevation lookup per trip (OpenTopoData, Open-Elevation fallback), shown as GPS/DEM in the table next to the raw GPS value
- Delete one trip (with confirm) or all records (double confirm)
- Dark mode
- US/SI units toggle
Optional environment variables (set them in docker-compose.yml under
environment, then docker compose up -d again):
LEAFLOGGER_TRIP_GAP_MIN(default10): gaps at least this long start a new trip. Also adjustable live in the trip bar.LEAFLOGGER_ELEV_DATASET(defaultned10m, ~10 m, US-only): DEM dataset for elevation lookup. Set tosrtm30moutside the US.LEAFLOGGER_ELEV_PRIMARY(defaulthttps://api.opentopodata.org),LEAFLOGGER_ELEV_FALLBACK(defaulthttps://api.open-elevation.com): elevation API endpoints. No keys needed for either default.
Prerequisites: git and
Docker (with the Compose plugin —
standard in Docker Desktop and in docker-compose-plugin packages).
git clone https://github.com/EpicGazel/leaflogger-py.git
cd leaflogger-py
docker compose up --build -d
Then open http://localhost:8084/ (or http://<host>:8084/ from another
machine on your LAN) and upload a LeafSpy CSV to get started.
Data lives in ./data/leaflogger.db (SQLite, created on first start).
The app listens on 8084 by default. To change it, edit the ports
mapping in docker-compose.yml — the left side is the host port:
ports:
- "9090:8000"
then docker compose up -d again. Leave the right side (8000, the port
inside the container) unless you also change the Dockerfile CMD.
Stdlib unittest only, no test dependencies:
PYTHONPATH=src python3 -m unittest discover -s tests -v
The main fixture (tests/fixtures/real_format.csv) is a genuine
LeafSpy export with GPS/dates shifted and the VIN replaced — see
tools/anonymize_csv.py.
Real LeafSpy exports contain your VIN and location history. Never commit
them: real-log filenames are gitignored (see .gitignore).
Ported from LeafLogger by Kevin Lieb. Many thanks for publishing the original.
Most of the code here was written by an AI coding assistant working from the original LeafLogger, with supervision, testing feedback, and debugging help from the maintainer.
MIT — see LICENSE.