Richer scan detail: mail phase, machine, and delivery ETA#7
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 10199After: each scan leads with the USPS mail phase, with op code / processing machine / location as a detail line, plus an expected-delivery ETA banner:
How
mailPhase+machineNameper scan and the piece-levelexpected_delivery_date(all already modeled, previously dropped at render) through the WS payload._merge_scan_sourceshelper (dedup by(timestamp, code), live wins) — unit-tested directly, and keepstrack_wsunder the statement limit.op N · machine · locationdetail 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
mailPhaseis the authoritative inline label. Easy to add a curated subset later if desired.Checks
_merge_scan_sourcesunit tests).checks.lint(ruff) +checks.typecheck(mypy) clean.