Skip to content

Richer scan detail: mail phase, machine, and delivery ETA#7

Merged
ak2k merged 1 commit into
mainfrom
feat/richer-scans
Jun 5, 2026
Merged

Richer scan detail: mail phase, machine, and delivery ETA#7
ak2k merged 1 commit into
mainfrom
feat/richer-scans

Conversation

@ak2k

@ak2k ak2k commented Jun 5, 2026

Copy link
Copy Markdown
Owner

What

Scan events showed only the raw IV-MTR operation code (e.g. 919 @ NEW YORK NY 10199), discarding the human-readable fields USPS already sends in the same payload.

Before: 5/30/2026, 2:02:04 AM — 919 @ NEW YORK NY 10199

After: each scan leads with the USPS mail phase, with op code / processing machine / location as a detail line, plus an expected-delivery ETA banner:

Expected delivery: Saturday, May 30, 2026

5/30/2026, 2:02:04 AM — Phase 3c - Destination Sequenced Carrier Sortation
op 919 · DBCS-051 · NEW YORK NY 10199

How

  • Forward mailPhase + machineName per scan and the piece-level expected_delivery_date (all already modeled, previously dropped at render) through the WS payload.
  • Extract the live+stored merge into a pure _merge_scan_sources helper (dedup by (timestamp, code), live wins) — unit-tested directly, and keeps track_ws under the statement limit.
  • Frontend: phase as the headline (fallback to op code), op N · machine · location detail line, ETA banner under Status.

Not included

The numeric op-code → prose table (e.g. "919" → a sentence) is deliberately not vendored: it's a 170+ entry USPS spreadsheet updated weekly, and mailPhase is the authoritative inline label. Easy to add a curated subset later if desired.

Checks

  • Full suite 290 passed (enriched IV-MTR fixture + 2 new _merge_scan_sources unit tests).
  • checks.lint (ruff) + checks.typecheck (mypy) clean.

Each scan event rendered only the raw IV-MTR operation code (e.g. "919 @
NEW YORK NY"), discarding the human-readable fields USPS already sends.

Surface them: each scan now leads with the mail phase (e.g. "Phase 3c -
Destination Sequenced Carrier Sortation"), with the op code, processing
machine, and facility location as a secondary detail line. The piece-level
expected-delivery date is forwarded as an ETA banner.

The numeric op-code -> prose table is deliberately not vendored — it's a
170+ entry USPS spreadsheet updated weekly, and `mailPhase` is the
authoritative inline label.

Extract the live+stored merge into `_merge_scan_sources` (pure, unit-
tested) so track_ws stays small and the dedup/field-mapping is covered
directly.
@ak2k ak2k merged commit 8d09ce1 into main Jun 5, 2026
4 checks passed
@ak2k ak2k deleted the feat/richer-scans branch June 5, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant