feat: add disney_area column and resort area mapping
- Add DISNEY_AREA_MAP in parser.py mapping 40+ Disney properties to 8 resort areas - Add disney_area to parse_customer() output, resolver after disney_park - Update db_writer.py schema: ORDERED_COLUMNS, AUTO_COLUMNS, COLUMN_TYPES - Add /api/status endpoint query for by_disney_area distribution - Add area row to web dashboard UI - Auto-migration adds column to existing databases
This commit is contained in:
+4
-1
@@ -212,6 +212,9 @@ async def status():
|
||||
cur.execute("SELECT COALESCE(NULLIF(make,''),'Unknown') as mk, COUNT(*) as c FROM assets GROUP BY mk ORDER BY c DESC")
|
||||
result["by_make"] = {r["mk"]: r["c"] for r in cur.fetchall()}
|
||||
|
||||
cur.execute("SELECT COALESCE(NULLIF(disney_area,''),'Non-Disney') as area, COUNT(*) as c FROM assets GROUP BY area ORDER BY c DESC")
|
||||
result["by_disney_area"] = {r["area"]: r["c"] for r in cur.fetchall()}
|
||||
|
||||
cur.execute("SELECT COALESCE(NULLIF(priority,''),'None') as pri, COUNT(*) as c FROM assets GROUP BY pri ORDER BY pri")
|
||||
result["by_priority"] = {r["pri"]: r["c"] for r in cur.fetchall()}
|
||||
|
||||
@@ -300,7 +303,7 @@ async def upload(file: UploadFile = File(...)):
|
||||
preview_cols = [
|
||||
"machine_id", "serial_number", "name", "class", "make", "model",
|
||||
"company", "place", "building_name", "floor", "zone",
|
||||
"priority", "telemetry_provider", "disney_park", "is_disney",
|
||||
"priority", "telemetry_provider", "disney_park", "disney_area", "is_disney",
|
||||
"yearly_sales", "has_cashless", "alerts_summary",
|
||||
]
|
||||
preview = []
|
||||
|
||||
@@ -930,6 +930,7 @@
|
||||
<div><span style="color:var(--text2);">Top makes:</span> ${makes || '—'}</div>
|
||||
<div><span style="color:var(--text2);">GPS:</span> <span class="badge-db ${gpsClass}">${gps}/${total} (${pct}%)</span></div>
|
||||
<div><span style="color:var(--text2);">Priority:</span> ${Object.entries(d.by_priority || {}).map(([k,v]) => `${k}: ${v}`).join(', ')}</div>
|
||||
<div><span style="color:var(--text2);">🏰 Area:</span> ${Object.entries(d.by_disney_area || {}).map(([k,v]) => `${k}: ${v}`).join(', ')}</div>
|
||||
</div>
|
||||
${d.last_modified ? `<div style="font-size:11px;color:var(--text3)">Last modified: ${d.last_modified.slice(0,19)}</div>` : ''}
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user