Expand tracker analytics and dashboard UX
Test and publish / publish (push) Successful in 4m27s
Test and publish / test (push) Successful in 9m45s

This commit is contained in:
2026-10-23 20:16:50 +01:00
parent e0f8399ff7
commit 667091efb0
17 changed files with 1140 additions and 81 deletions
+16 -5
View File
@@ -9,7 +9,7 @@ A self-hosted service that records where your time goes: desktop apps, browser t
tracker (Go, container) ── PostgreSQL
```
Every source is stored as an interval in a single `activities` table, with columns `source, kind, label, started_at, ended_at, attrs`. The `samples` table for point metrics (step counts and so on) has no collector at the moment. Collectors generate an `id` for each event, so re-uploading a batch never creates duplicates.
Every source is stored as an interval in a single `activities` table, with columns `source, kind, label, started_at, ended_at, attrs`. The `samples` table stores point metrics such as step counts. Collectors generate an `id` for each event, so re-uploading a batch never creates duplicates.
## Status
@@ -19,7 +19,9 @@ Every source is stored as an interval in a single `activities` table, with colum
| iPhone location (Shortcuts → `/location/{arrive,leave}`) | ✅ built; configure the automations |
| Browser (Violentmonkey userscript, `/tracker.user.js`) | ✅ built |
| Webcam presence (`/presence/events`) | endpoint ready, agent not yet written |
| AI analysis (`reports` table) | planned |
| Samples API and range summaries | ✅ available |
| AI analysis (`reports` table) | ✅ storage API; job remains external |
| ntfy goal notification configuration | ✅ configuration/status API |
## Running the server
@@ -98,11 +100,20 @@ Collectors never use the site login. Each one sends its own bearer key.
| POST | `/api/v1/browser/events` | key | `tab_focus`, `idle` |
| POST | `/api/v1/presence/events` | key | `at_desk`, `in_bed`, `away` |
| POST | `/api/v1/manual/events` | key | any |
| POST | `/api/v1/samples` | key | point metrics in `{"samples":[{"id","source","metric","ts","value","unit"}]}` |
| GET | `/api/v1/samples?from=&to=&source=&metric=&limit=&cursor=` | key or admin | point samples, defaults to the last 24h |
| POST | `/api/v1/location/{arrive,leave}[/{place}]` | key | place from the path, `?place=`, or optional `{"place","at"}`; defaults to `home` and now. Builds `place` intervals (see [iPhone location](#iphone-location)) |
| GET | `/api/v1/activities?from=&to=&source=&kind=&limit=` | key or admin | RFC3339 times; defaults to the last 24h |
| GET | `/api/v1/activities?from=&to=&source=&kind=&limit=&cursor=` | key or admin | RFC3339 times; defaults to the last 24h; returns clipped intervals and `next_cursor` when more rows exist |
| GET | `/api/v1/activities/export?from=&to=&source=&kind=&format=csv` | admin | Downloads the filtered activity data as CSV, or JSON with `format=json` |
| GET | `/api/v1/summary/daily?date=YYYY-MM-DD` | key or admin | totals per label and kind, plus goal results |
| GET | `/api/v1/summary/range?from=&to=` | key or admin | interval totals and metric min/max/average/count for a range |
| GET, POST, PUT, DELETE | `/api/v1/goals[/{id}]` | admin | List, create, update, or delete daily goals |
| GET, POST | `/api/v1/devices` | admin | list devices; create one with `{"name","kind"}`, which returns its key once |
| DELETE | `/api/v1/devices/{name}` | admin | revoke a device's key |
| GET, POST | `/api/v1/reports` | admin | list or store nightly/weekly report output (`period_start`, `period_end`, `model`, `prompt_hash`, `body`) |
| GET | `/api/v1/notifications/status` | admin | ntfy configuration and whether nudges are configured |
| PUT | `/api/v1/notifications/config` | admin | set ntfy server/topic, enabled flag, and optional retention days |
| POST | `/api/v1/privacy/purge?before=RFC3339` | admin | permanently delete old activities, samples, and reports |
| GET | `/`, `/setup` | admin | the dashboard app |
| GET | `/tracker.user.js`, `/assets/*`, `/healthz`, `/readyz` | none | the userscript and the app's scripts hold no secrets |
@@ -203,5 +214,5 @@ Layout: `cmd/tracker` (server and admin CLI), `cmd/hypr-agent`, `internal/{api,a
## Roadmap
1. Webcam presence agent. Detection will run on the device and only intervals will be uploaded; frames never leave the machine.
2. Nudges: push notifications through ntfy when a goal is at risk during the day.
3. AI analysis: a nightly or weekly job will send the daily summaries (not raw rows) to the Claude API and store the result in `reports`.
2. Nudges: send goal-risk notifications through the configured ntfy topic.
3. AI analysis: a nightly or weekly job will send the daily summaries (not raw rows) to the Claude API and store the result through `POST /api/v1/reports`.