From 90614736f2a0c556f31eca5361b3c032f5f309f6 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Thu, 24 Sep 2026 08:37:33 +0200 Subject: Match official climbs against their recorded sample MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An official climb matched on endpoint coordinates alone. On a loop ridden the other way the route meets the climb's top before its bottom, so pairing each start with the first end inside its lap window credited a 5.9 km passage as the 850 m Chemin de la Tour Pey Blanc, and a 49 km one on another ride. Climbs now keep the sample of the segment they were created from: the recorded length and elevation gain of the selected route points, captured by the ride detail and preview handlers and stored NOT NULL. Matching takes the whole route and drops any candidate outside ±50% of that sample on either axis, and attempts are refreshed by upsert and prune so re-analyzing a ride keeps the recorded-at stamp of the passages that survive. The backfill leaves the web package: backfill.Run recomputes ride values then official climb attempts as a single `go run . backfill` command (climbs-backfill is gone), rideanalysis owns the attempt snapshot, and the mountain-pass loading margin is shared. Applied to the stored rides it stamps 78 samples, drops the four bogus attempts and leaves ride 800 with its three Pont Rout passages. --- README.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 3491395..69206ad 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ mise run build mise run dev-watch # Start the web server on http://localhost:8080 go run . fetch-osm # Download the France OSM PBF (resumable) go run . extract-osm france-latest.osm.pbf # Extract mountain passes from a France OSM PBF -go run . backfill # Recompute and persist all ride computed values +go run . backfill # Recompute ride values and official climb attempts for every stored ride go run . backtest # Benchmark computed vs stored ride values go run . -- -pprof # Expose pprof endpoints at `/debug/pprof` docker compose up -d pyroscope # Start the local Pyroscope server on http://localhost:4040 @@ -65,13 +65,14 @@ An OSM way is an ordered list of nodes; its `highway` tag describes the road typ - `geo` — coordinate distance, nearest-point, and shared `Interval` primitives; dependency-free - `climb` — climb detection and scoring. A `Route` is the geometry-only trace (distances, elevations, coords), and `Detect` returns `[]DetectedClimb` (a climb plus its ride-relative start index). Provides slope and Cotacol difficulty scoring. Deliberately decoupled from `ride` - `ride` — GPX parsing and the ride value (embeds `climb.Route` for geometry, adding timestamps and telemetry), moving-time metrics, and SQLite persistence for imported ride metadata and versioned computed values -- `official_climb` — matches official climbs against a route by endpoint coordinates +- `official_climb` — matches official climbs against a route by endpoint coordinates and the recorded sample of the segment the climb was created from: a candidate passage outside ±50% of that sample's length or elevation gain is not the climb - `mountain_pass` — OSM PBF extraction (`mountain_pass=yes` / `natural=mountain_pass` nodes), pass storage and querying, and crossings/climb matching on `climb.Climb` -- `rideanalysis` — orchestrates a ride into analyzed climbs and mountain-pass crossings +- `rideanalysis` — orchestrates a ride into analyzed climbs and mountain-pass crossings, and snapshots its official-climb attempts - `strava` — OAuth2 client returning activity metadata and GPX data - `config` — typed YAML configuration and atomic persistence - `web` — HTTP server, OAuth callback, sync orchestration, and templ pages -- `cli` — command handlers for data import, backfill, and benchmarking +- `backfill` — recomputes the data derived from stored rides: ride values first, then official climb attempts. The migration tool behind `go run . backfill` +- `cli` — command entry points: `main.go` dispatches, and command bodies live with the packages they drive (`ride` import/benchmarks, `backfill`, `mountain_pass` OSM) - test builders `internal/routetest`, `internal/ridetest`, `internal/dbtest` ```mermaid @@ -80,6 +81,7 @@ flowchart TB main["main (bootstrap: main.go)"] cli["cli (import, backfill, benchmark)"] + backfill["backfill (ride values, climb attempts)"] web["web (HTTP + templ, sync)"] rideanalysis["rideanalysis (climbs + crossings)"] ride["ride (GPX parsing, Ride value, metrics, persistence)"] @@ -96,6 +98,13 @@ flowchart TB cli --> ride cli --> mpass cli --> config + cli --> backfill + + backfill --> ride + backfill --> rideanalysis + backfill --> official_climb + backfill --> mpass + backfill --> config web --> rideanalysis web --> strava -- cgit v1.3