14 Commits

Author SHA1 Message Date
shawn 6fd9238f79 fix: GPS never from seed — only from real check-ins
GPS (latitude/longitude) and photo_path are now NEVER set by seed
import pipelines, even if empty. GPS comes only from field tech
check-ins via the main app.

- db_writer.py: FIELDS_NEVER_FROM_SEED set, GPS always None in
  _extract_row_values, skipped in update mode
- sync.py: latitude/longitude set to None in asset_data
- FIELD_MAP.md: updated policy table
2026-06-02 22:56:04 -04:00
shawn 186a9d03f3 fix: seed import update mode fills gaps only — MSFS is primary
Changes  behavior: ALL fields now use ONLY_IF_EMPTY
policy for existing assets. Previously, AUTO fields (name, make, model,
company, place, building_name, floor, etc.) always overwrote existing
data, clobbering MSFS-synced and manually-cleaned records.

- db_writer.py: update() treats every field as 'skip if existing
  value non-null' — same as old PRESERVE behavior but universal
- sync.py: UPDATE path now fetches current values and only sets
  fields that are currently NULL/empty
- New assets (not found by machine_id) still insert with full seed data
- sync.py docstring and stats output updated to reflect new policy

Closes #13 — seed import no longer overwrites MSFS data
2026-06-02 22:51:01 -04:00
shawn 9888601863 Add AGENTS.md for AI agent context 2026-05-25 20:18:58 -04:00
shawn 064740ef2e feat: config-driven environments (env vars + start scripts)
Add env var overrides matching main app pattern:
- CANTEEN_IMPORT_PORT — port override (default 8091)
- CANTEEN_IMPORT_DB_PATH — database path override
- CANTEEN_IMPORT_SEED_DIR — seed data directory override
- CANTEEN_IMPORT_UPLOAD_DIR — upload directory override

Create start scripts in repo:
- start.sh — production (default port 8091)
- start-dev.sh — development (port 8093, assets.dev.db)

Fix: dev clone now pulls from Gitea (not local prod dir)
2026-05-25 00:29:56 -04:00
shawn a0b0c7abac Add Push-to-Main-App button to seed import UI
- New card with Dev/Prod target selector + dry-run toggle
- Auto-refreshes target status (exists/not found)
- Results grid: assets created/updated/skipped, customers, locations
- Sample actions and error display
- Calls existing /api/sync endpoint
2026-05-25 00:11:58 -04:00
shawn bd3bfea37c Add sync module: push seed data to main app DB (dev/prod)
- New sync.py: reads seed import's 39-col schema, maps to main app's
  customers/locations/assets schema with foreign keys
- New POST /api/sync endpoint (target=dev|prod, dry_run=true/false)
- New GET /api/sync/targets endpoint
- Category mapping: Bev→Beverage, Snack→Snack, Food→Food, etc.
- Automatically creates customers and locations from company/place
- Idempotent: updates existing assets by machine_id
- Dry-run mode: preview changes without writing
2026-05-25 00:04:43 -04:00
shawn 0205866e7a 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
2026-05-24 23:36:41 -04:00
shawn af566bc368 Add suite/room/trailer extraction + ID-based class correction
Parser enhancements:
- Add SUITE_PATTERNS: extract Suite, Ste, STE (case-insensitive)
- Add ROOM_PATTERNS: extract Room, RM, Mailroom, Showroom, etc.
- Add TRAILER_PATTERNS: extract Trailer, TRLR, MASH, Safari, etc.
- Add _extract_suite(), _extract_room(), _extract_trailer() functions
- Update _parse_pattern_a() to extract and strip new fields
- Update parse_place() result dict to include suite/room/trailer
- Add correct_class_by_machine_id() post-processing:
  - Bev model in Bev ID range with Snack class → fix to Bev
  - Unknown class in 9x range → set to Bev
  - Unknown class in 6x-7x range → set to Snack
- Update parse_excel() to include new fields and apply correction

DB writer:
- Add suite, room, trailer to ALL_COLUMNS and COLUMN_TYPES
- Add ALTER TABLE migration for existing databases
2026-05-24 23:22:35 -04:00
shawn be9c34f51d Add GPS-only backup/restore and database wipe
- Fix backup.py PRESERVED_FIELDS column names (lat/lng -> latitude/longitude)
  to match actual DB schema (pre-existing bug)
- Add backup_gps() and restore_gps() dedicated GPS-only functions
- Add /api/gps/backup and /api/gps/restore API endpoints
- Add /api/gps/restore/upload for restoring from uploaded backup files
- Add /api/db/wipe endpoint to clear all asset records
- Update UI with GPS-only Backup button, Restore GPS from File picker,
  and Wipe All Assets with double-confirmation dialog
- Fix backup listing to scan both seed-data/ and project root
2026-05-24 23:07:12 -04:00
shawn 724104b750 Add web UX with dashboard, import wizard, backup management
- SPA frontend (static/index.html): 4-step wizard flow
  (Upload → Review → Import → Report) + Dashboard bar + Backup UI
- FastAPI server (server.py) with 14 API endpoints
- New endpoints: /api/status, /api/backups, /api/backup/restore
- Updated README with web UX usage
- Added web deps: fastapi, uvicorn, python-multipart
2026-05-24 22:57:11 -04:00
shawn 457e7794a0 🌱 Complete seed import tool — all 17 kanban tasks done
Modules:
- parser.py: Full Excel parser (1,848 machines, Disney mapping, Pattern A+B parsing)
- db_writer.py: SQLite writer with per-field update policy (seed + update modes)
- backup.py: GPS/photo backup, restore, and compare
- reporter.py: Comprehensive validation report generator
- main.py: CLI entry point

Database: assets.db with 1,848 machines across 36 columns
Handbook: reference_handbook.md v2.0 — all sections finalized
Report: validation_report.md — 184 OCR corrections, 143 unknown machines
2026-05-24 21:50:46 -04:00
shawn 6743df6859 Add reference handbook template with pre-filled data patterns and FILL_IN markers 2026-05-24 18:58:28 -04:00
shawn c91ab1f272 Add seed data files (headers_modified.csv, import_seed.csv) 2026-05-24 18:54:12 -04:00
shawn eaa165a43b Initial scaffold: project skeleton, README, requirements, main.py stub 2026-05-24 18:33:23 -04:00