Files
kima-hub/backend
chevron7 3216af18a5 feat: persist UMAP map positions to DB to skip recompute on cold Redis
The vibe map projection was only cached in Redis with a 24h TTL. On
every expiry (or container restart) the full UMAP worker ran again,
taking ~30s on an 8k-track library. Positions are deterministic once
the embedding set is fixed, so they belong in the DB.

Schema: add nullable map_x, map_y to track_embeddings. Metadata-only
ALTER on PG 11+, no table rewrite, zero downtime.

Service:
- doCompute() now persists positions via a single UPDATE ... FROM
  UNNEST(...) that handles 8-15k rows in one statement.
- computeMapProjection() tries Redis, then DB, then UMAP. When the DB
  has full coverage the UMAP worker is skipped entirely and the map
  hydrates from a single join in ~100ms.
- appendTrackToProjection() writes the new KNN-interpolated position
  to the DB so it survives Redis expiry.
- hydrateFromDb() returns null unless coverage is 100%, so a newly
  enriched track without a position still triggers full recompute.
2026-04-16 23:10:50 -05:00
..
2025-12-25 18:58:06 -06:00
2025-12-25 18:58:06 -06:00
2025-12-25 18:58:06 -06:00
2025-12-25 18:58:06 -06:00