Repository navigation
feat: order numbers alongside tracking numbers, Stride Rite parser - #45
Merged
Merged
Conversation
Packages can now carry the retailer order they belong to: - order_number / order_link are optional package fields. tracking_number stays the key, so stored packages and hidden numbers are unaffected. - find_carrier() passes the order fields through (it used to drop every key except tracking_number/carrier/origin/link). - Dedup prefers a store's parser over a carrier's over generic, so a number seen in both a TCGplayer and a USPS email shows retailer TCGplayer. Order fields and the earliest first_seen are merged in. - An order-only entry (tracking_number == order_number) is dropped once the same order has a real tracking number, hidden ones included. - Order fields are kept from the previous scan after the store email ages out of the search window. - The generic parser only runs on an email when no specific parser found anything in it. TCGplayer: every package gets the order number and order-history link. USPS/UPS numbers link to the carrier instead of tcgp.shipment.co. Stride Rite: new parser for the Shopify shipping email (carrier tracking number, SR order number, "View your order" link). These emails were previously only caught by the generic parser. scripts/run_parsers.py mirrors the generic fallback, prints order numbers, and can check an expected order_number.
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.
Summary
A package can now carry the retailer order it belongs to, next to its tracking number:
order_numberandorder_linkare optional package fields.linkis still the carrier tracking page.tracking_numberstays the key, so stored packages, hidden numbers, services and live-status lookups are unchanged.Card support: ljmerza/tracking-number-card (branch
feat/order-numbers).Changes
parsers_list.py:find_carrier()passesorder_number/order_linkthrough. It used to drop every key except tracking number, carrier, origin and link. Also registers the Stride Rite parser before generic.coordinator.py:first_seenare merged in from the other duplicates.tracking_number == order_numberis dropped once the same order has a real tracking number. Hidden tracking numbers count, so hiding the tracking number also hides the order.''.parsers/tcgplayer.py:tcgp.shipment.co;shipment.cois kept for numbers no carrier pattern recognises.order_number, so they collapse into a tracking entry later.parsers/stride_rite.py(new): parses the Shopify shipping email ("A shipment from order SR… is on the way"). It extracts the carrier tracking number, theSRorder number and the "View your order" link. Before, only the generic parser picked these emails up, labelled "Generic".scripts/run_parsers.py: mirrors the generic fallback, prints order numbers, and checks an optionalexpected.order_number.retailer.Testing
python3 scripts/run_parsers.py→ 35/35 fixtures pass. The fixtures are kept locally in the gitignored.data/._fetch_and_parse_emailsand_convert_to_packages: 14/14 checks pass. Againstmain, 8 of the 14 fail.first_seenkept.ruff checkreports nothing new: the same 3 warnings asmain.