Machine Replacements History View #15

Closed
opened 2026-05-28 00:26:55 +00:00 by shawn · 0 comments
Owner

Summary

Added a Replacements page to the Admin App showing historical machine replacement events at the same location.

What was built

Backend: /api/admin/replacements/history

  • Scans sync batch diff_summaries for inline replacements and cross-references new vs removed assets
  • Detects replacements from live asset data by grouping machines at the same location (same building name) where one is active and another is inactive
  • Returns sorted list with old MID, new MID, location, statuses, confidence level

Frontend: Replacements page (sidebar nav item 🔄)

  • Table: Date | Location | Old MID | Old Name | Old Status | → | New MID | New Name | New Status | Confidence
  • Clickable MID links that navigate to asset detail with search
  • Search/filter box
  • Status badges (green On, red Incompatible, yellow Action Required)

Replacement detection methods

  1. Sync batch inline — detected at import time by detect_replacements()
  2. Batch crossref — parsing new_assets vs removed_assets by location name similarity
  3. Location group — same building_name at a small location (2-5 machines) with one active, one inactive

Currently detecting 146 historical replacement events from the existing data.

Files changed

  • admin_server.py — new endpoint (+200 lines)
  • static/index.html — nav item, page div, JS load+render+search (+195 lines)

Commit: 2cafe68

## Summary Added a **Replacements** page to the Admin App showing historical machine replacement events at the same location. ## What was built ### Backend: `/api/admin/replacements/history` - Scans sync batch diff_summaries for inline replacements and cross-references new vs removed assets - Detects replacements from live asset data by grouping machines at the same location (same building name) where one is active and another is inactive - Returns sorted list with old MID, new MID, location, statuses, confidence level ### Frontend: Replacements page (sidebar nav item 🔄) - Table: Date | Location | Old MID | Old Name | Old Status | → | New MID | New Name | New Status | Confidence - Clickable MID links that navigate to asset detail with search - Search/filter box - Status badges (green On, red Incompatible, yellow Action Required) ## Replacement detection methods 1. **Sync batch inline** — detected at import time by `detect_replacements()` 2. **Batch crossref** — parsing new_assets vs removed_assets by location name similarity 3. **Location group** — same building_name at a small location (2-5 machines) with one active, one inactive Currently detecting **146 historical replacement events** from the existing data. ## Files changed - `admin_server.py` — new endpoint (+200 lines) - `static/index.html` — nav item, page div, JS load+render+search (+195 lines) Commit: 2cafe68
shawn closed this issue 2026-05-28 00:27:01 +00:00
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shawn/canteen-admin-server#15