Segments Phase 3: detection algorithm, CLI, ingest hook, and efforts API

- detect.py: ActivityTrack + detect_one/detect_all (bbox pre-filter →
  start/end proximity 25m → path conformance 50m/30% → effort extraction
  with avg speed/HR/power and Coggan NP)
- cli.py: `bincio segments detect` for retroactive detection over stored
  timeseries JSONs, with optional --activity-id / --segment-id filters
- ingest.py: non-fatal hook at end of ingest_parsed runs detect_all
- server.py: GET /api/segments/{id}/efforts and POST /api/segments/{id}/detect
This commit is contained in:
Davide Scaini
2026-05-13 00:50:39 +02:00
parent 61db0734d2
commit 4d2df860ce
6 changed files with 673 additions and 0 deletions
+9
View File
@@ -74,6 +74,15 @@ def ingest_parsed(
pass
write_athlete_json(list(summaries.values()), data_dir, athlete_config)
# Detect segment efforts for this activity (non-fatal if it fails).
try:
from bincio.segments.detect import track_from_parsed, detect_all
track = track_from_parsed(parsed, activity_id)
if track is not None:
detect_all(track, data_dir.name, data_dir.parent)
except Exception:
pass
return activity_id