Skip to content

NOMAD Field Desk v7.0.5

Choose a tag to compare

@SysAdminDoc SysAdminDoc released this 11 Apr 23:01
· 794 commits to master since this release

v7.0.5 — Print Routes Refactor + Cross-Module Dashboard

Third pass at the Top 20 design-review list. Two substantial tab-isolated items: Top 20 #20 (print refactor) and a brand-new operational-snapshot endpoint. 839 pytest tests pass locally (836 previous + 3 new).

Print routes refactor (Top 20 item #20)

print_routes.py (2179 lines) historically re-implemented the same contact query, burn-rate query, low-stock query, expiring-items query, and HTML table renderer inside every one of its 13 print routes. This release extracts them once:

Shared fetchers

  • _fetch_contacts(db, limit) — single source of truth for contact lists
  • _fetch_burn_summary(db) — computes min-days-per-category from inventory.daily_usage
  • _fetch_low_stock(db) — items at or below min_quantity
  • _fetch_expiring(db, within_days) — items with expiration <= today + N days

Shared HTML renderers

  • _render_contacts_table(contacts, include_radio=True) — produces the standard .doc-table-shell HTML
  • _render_burn_table(burn) — flags <7 days entries with doc-alert
  • _render_low_stock_table(low)
  • _render_expiring_table(expiring)
  • _render_standard_frequencies_table() — uses the new STANDARD_FREQUENCIES module constant so every print doc quotes the same channel reference
  • _render_empty(message) — consistent empty-state panel

First route refactored: api_preparedness_print collapses from 131 lines of inline HTML to ~40. Output is byte-equivalent (verified by existing print tests). The remaining 12 print routes can migrate to the same helpers in follow-up sprints without changing visual output, further reducing the 2179-line file.

New /api/preparedness/dashboard endpoint

The Preparedness design review flagged "no unified daily-standup view — users must tab-hop to see full field state." This endpoint returns a single JSON payload with every section the operator needs:

{
  "generated_at": "2026-04-11T10:00:00Z",
  "inventory": {"total": 42, "low_stock": 3, "expiring_30d": 5, "categories": {"food": 12, ...}},
  "medical":   {"patients": 2, "with_allergies": 1, "expiring_meds": 0},
  "power":     {"devices": 3, "latest_soc_pct": 78},
  "garden":    {"plots": 5, "active_plantings": 4},
  "contacts":  {"total": 8, "with_callsign": 5, "with_skills": 6},
  "tasks":     {"total": 12, "overdue": 2, "due_today": 1},
  "incidents": {"total": 4, "last_24h": 1, "open_critical": 0},
  "alerts":    {"active": 2, "critical": 0},
  "readiness_hint": "needs-attention"
}

Design choices

  • Every section is wrapped in a helper _safe_count() and a try/except so a partial schema (fresh install, optional table missing, migration gap) returns HTTP 200 with {"error": "unavailable"} on that section rather than 500 on the whole request.
  • Coarse readiness_hint flips to needs-attention when any of: low stock > 0, expiring_30d > 0, overdue tasks > 0, critical alerts > 0, or open critical incidents > 0. Home and Preparedness Overview can use this for an at-a-glance badge without running the full readiness score computation.
  • power_log.soc_pct (latest battery SOC) and medical_supplies.expiration are optional tables — the endpoint handles their absence gracefully.

Tests: 3 new integration tests in tests/test_incidents.py::TestPreparednessDashboard

  • test_dashboard_returns_expected_sections — all 10 top-level keys present on a fresh DB
  • test_dashboard_reflects_incident_activity — creating a critical incident flips readiness_hint to needs-attention
  • test_dashboard_survives_missing_optional_tables — endpoint returns 200 even on partial schemas

Design-review false positive

Library tier installed indicator (design review finding): Already implemented. loadWikipediaTiers() at _app_workspace_memory.js:2468 already renders a ✓ Installed badge on every installed tier. No fix needed.

Parallel-agent convergence

The benchmark concurrent-run guard and the situation-room skeleton re-wipe fix I carried as uncommitted working-tree diffs after v7.0.4 were independently shipped by the Codex agent as commit 595baef "Audit round 2". My stash unwound cleanly because those changes were already upstream when I rebased. Good convergence.

Design review progress

  • v7.0.3: 6 Top 20 items (4 CRITICAL security + 2 MAJOR discoverability)
  • v7.0.4: 4 Top 20 items (Benchmark rebrand, SR skeletons, media search, inventory mobile)
  • v7.0.5: 1 Top 20 item (#20 print refactor, partial) + cross-module dashboard
  • Total: 11 of 20 shipped across three releases

Downloads

  • Windows: NOMADFieldDesk-Windows.exe (portable) or NOMAD-Setup.exe (installer)
  • Linux: NOMADFieldDesk-Linux (portable)
  • macOS: NOMADFieldDesk-macOS

All binaries verified via SHA256SUMS.txt.