Phase 0: mygarmin package — library, importers, dedupe, dashboard, exports, CLI
Generalised from personal scripts: SQLite library with untouched originals, importers for FIT, TCX, GPX, AlpineQuest .trk, Strava and Garmin Connect exports, the Garmin Connect API and a USB watch; cross-source de-duplication; time zones from GPS; data-driven dashboard and GPX/.trk exports. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
57
docs/PLAN.md
Normal file
57
docs/PLAN.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# myGarmin app — plan
|
||||
|
||||
A local-first desktop app that collects a person's activity and health history from Garmin (watch, Connect export, Connect API),
|
||||
Strava (bulk export) and AlpineQuest (.trk), keeps the originals in one library folder, and builds a self-contained HTML
|
||||
dashboard plus GPX / AlpineQuest exports. Nothing leaves the user's PC; there is no server.
|
||||
|
||||
Grown out of a set of personal scripts (2026-10); this repo is the general, shareable version.
|
||||
|
||||
## Principles
|
||||
- **Local only.** Each user's data, settings and Garmin token stay on their machine. The repo never contains personal data.
|
||||
- **Originals are kept unchanged** in `originals/`; everything else (database, dashboard, exports) can be rebuilt from them.
|
||||
- **Import is idempotent.** Files are identified by content (md5); importing the same thing twice does nothing.
|
||||
- **Every source is optional.** The dashboard shows only the sections that have data.
|
||||
- **The unofficial Garmin API is optional** and may break when Garmin changes its login; export zips and the watch over USB always work.
|
||||
|
||||
## Library folder (one per user)
|
||||
```
|
||||
<library>/
|
||||
settings.json name, birth year, home time zone, units
|
||||
myGarmin.db SQLite: activities, tracks, daily health, series, imported files
|
||||
inbox/ drop zone (optional)
|
||||
originals/ garmin_fit/ garmin_export/ strava/ alpinequest/ tcx/ gpx/
|
||||
exports/ gpx/ trk/
|
||||
dashboard.html
|
||||
```
|
||||
|
||||
## Phases
|
||||
| Phase | Scope | Done when |
|
||||
|---|---|---|
|
||||
| 0 | Generalise the scripts into the `mygarmin` package: settings, SQLite, one importer per source with auto-detection, time zone from GPS/FIT, cross-source de-duplication, data-driven findings, exports. | Rebuilding the author's library from the original files reproduces the existing dashboard numbers. |
|
||||
| 1 | CLI: `mygarmin init / import / sync / build / export`. | A library can be built from scratch with the CLI only. |
|
||||
| 2 | UI: local web UI in its own window (pywebview): setup wizard, import (drag and drop), sync, dashboard, export. | Used for a week instead of the CLI. |
|
||||
| 3 | Windows installer (PyInstaller + Inno Setup), releases on Gitea. | Installs on a clean PC. |
|
||||
| 4 | Trial with 2–3 users on other devices. | Their data imports without code changes. |
|
||||
| later | Scheduled sync, macOS, Strava API, Apple Health / COROS / Polar exports. | |
|
||||
|
||||
## Sources
|
||||
| Source | Input | Gives |
|
||||
|---|---|---|
|
||||
| Garmin watch (USB, Windows MTP) | `GARMIN\Activity`, `Monitor`, … | activity FITs, health FITs |
|
||||
| Garmin Connect export | account export zip (`DI_CONNECT\…`, uploaded FIT zips) | daily health, VO2max, fitness age, BP, all activity FITs |
|
||||
| Garmin Connect API (unofficial, python-garminconnect) | login once, token kept locally | new activities (original FIT) and daily health |
|
||||
| Strava export | account export zip (`activities.csv`, `activities/*.fit.gz|gpx`) | activities with name, moving time |
|
||||
| AlpineQuest | `.trk` (and `.gpx`) | phone-recorded tracks; transport and very short tracks are flagged, not deleted |
|
||||
| Older Garmin / other | `.tcx`, `.gpx`, `.fit` | activities |
|
||||
|
||||
## De-duplication
|
||||
One outing is often recorded by several sources. All are imported; a later pass marks the lower-priority copies
|
||||
`dup_of` the best one. Priority: FIT > TCX > AlpineQuest > Strava > GPX. Two activities are the same outing when they start
|
||||
within 15 min of each other, or their time ranges overlap by more than half of the shorter one.
|
||||
|
||||
## Time zones
|
||||
Local time comes from the FIT `local_timestamp` where present, otherwise from the first GPS point (`timezonefinder`, offline),
|
||||
otherwise the home time zone in `settings.json`.
|
||||
|
||||
## Not in the repo
|
||||
Personal data, `*.db`, tokens, original files, generated dashboards. Tests use small synthetic files in `tests/data/`.
|
||||
Reference in New Issue
Block a user