Skip to content

About

No description or website provided.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

leaflogger-py

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.

Features

  • 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

Configuration

Optional environment variables (set them in docker-compose.yml under environment, then docker compose up -d again):

  • LEAFLOGGER_TRIP_GAP_MIN (default 10): gaps at least this long start a new trip. Also adjustable live in the trip bar.
  • LEAFLOGGER_ELEV_DATASET (default ned10m, ~10 m, US-only): DEM dataset for elevation lookup. Set to srtm30m outside the US.
  • LEAFLOGGER_ELEV_PRIMARY (default https://api.opentopodata.org), LEAFLOGGER_ELEV_FALLBACK (default https://api.open-elevation.com): elevation API endpoints. No keys needed for either default.

Setup

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).

Changing the port

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.

Tests

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.

Privacy

Real LeafSpy exports contain your VIN and location history. Never commit them: real-log filenames are gitignored (see .gitignore).

Credits

Ported from LeafLogger by Kevin Lieb. Many thanks for publishing the original.

AI disclosure

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.

License

MIT — see LICENSE.

About

No description or website provided.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Contributors

Languages