feat: import Seed (mycantaloupe.com) data — 1,655 assets enriched

- Added import_seed.py — reads Machine List(8).xlsx, matches by Asset ID → machine_id
- 51 new columns on assets table (route, barcode, sales, contact info, etc.)
- seed_data table with full 62-field JSON per asset for detail enrichment
- Seed data card in frontend asset detail view
- GET /api/assets/{id} now returns result.seed and result.seed_imported_at
- GPS columns from Seed ignored per request
- 1,654 matched, 199 unmatched (Seed-only assets not in MSFS)

Refs #47
This commit is contained in:
2026-05-28 23:28:08 -04:00
parent 908c67a26c
commit ae3b114ebc
3 changed files with 371 additions and 2 deletions
+13 -2
View File
@@ -1138,8 +1138,6 @@ def get_asset(asset_id: int):
).fetchone()
result["location_name"] = loc["name"] if loc else None
conn.close()
# Enrich with MSFS data (from Dynamics 365 Field Service)
msfs = _MSFS_LOOKUP.get(result.get("machine_id", "")) or _MSFS_BY_ID.get(asset_id)
if msfs:
@@ -1158,6 +1156,19 @@ def get_asset(asset_id: int):
"work_order_count": msfs.get("work_order_count", 0),
}
# Enrich with Seed data (from mycantaloupe.com)
seed_row = conn.execute(
"SELECT raw_data, imported_at FROM seed_data WHERE asset_id = ?",
(asset_id,),
).fetchone()
if seed_row:
try:
result["seed"] = _json.loads(seed_row["raw_data"])
result["seed_imported_at"] = seed_row["imported_at"]
except Exception:
result["seed"] = None
conn.close()
return result