Skip to content

Commit

Permalink
Update readme with new tracking number support
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeen committed Nov 5, 2022
1 parent 13ce3e1 commit 0d3ce55
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 42 deletions.
3 changes: 0 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
source 'http://rubygems.org'

gem 'activesupport', '>= 5.2.4.3'
gem 'minitest', '~> 5.5'
gem 'minitest-reporters'
gem 'rake', '>= 12.3.3'
gem 'shoulda'
gem 'tracking_number', '>= 1.1.2'
gem "byebug"
gem 'rspec'
17 changes: 0 additions & 17 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,13 @@ GEM
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
ansi (1.5.0)
builder (3.2.4)
byebug (11.1.3)
concurrent-ruby (1.1.10)
diff-lcs (1.5.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
json (2.6.2)
minitest (5.16.3)
minitest-reporters (1.5.0)
ansi
builder
minitest (>= 5.0)
ruby-progressbar
rake (13.0.6)
rspec (3.12.0)
rspec-core (~> 3.12.0)
Expand All @@ -34,13 +27,6 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
ruby-progressbar (1.11.0)
shoulda (4.0.0)
shoulda-context (~> 2.0)
shoulda-matchers (~> 4.0)
shoulda-context (2.0.0)
shoulda-matchers (4.5.1)
activesupport (>= 4.2.0)
tracking_number (1.1.2)
activesupport (>= 4.2.5)
json (>= 1.8.3)
Expand All @@ -53,11 +39,8 @@ PLATFORMS
DEPENDENCIES
activesupport (>= 5.2.4.3)
byebug
minitest (~> 5.5)
minitest-reporters
rake (>= 12.3.3)
rspec
shoulda
tracking_number (>= 1.1.2)

BUNDLED WITH
Expand Down
57 changes: 35 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
[![Build Status](https://travis-ci.org/jkeen/tracking_number_data.svg?branch=master)](https://travis-ci.org/jkeen/tracking_number_data)

# About this Repo
# About

This repository contains json files that programatically describe how to detect, validate, and decode the following types of tracking numbers:


## Supported Tracking Numbers

Carrier / Type | Length | Example | Data
----------- | ------- | ----------------- | -------------
UPS | 18 | `1Z5R89390357567127` | `SerialNumber` `CheckDigit` `ShipperId` `ServiceType` `PackageId`
Multiple / S10 International Standard | 13 | `RB123456785GB` | `SerialNumber` `CheckDigit` `CountryCode` `ServiceType`
FedEx / Ground 15 | 15 | `0414 4176 0228 964` | `SerialNumber` `CheckDigit`
FedEx / Ground (SSCC 18) | 18 | `00 0123 4500 0000 0027` | `SerialNumber` `CheckDigit` `ShippingContainerType`
FedEx / Ground (96) | 22 | `9611020987654312345672` | `SerialNumber` `CheckDigit` `ApplicationIdentifier` `SCNC` `ServiceType` `ShipperID` `PackageId`
Fedex / Ground (GSN) | 34 | `9622 0015 6 000 123 4567 1 00 7948 0839 0594` | `SerialNumber` `CheckDigit` `ApplicationIdentifier` `SCNC` `GSN`
FedEx / Express 12 | 12 | `986578788855` | `SerialNumber` `CheckDigit`
FedEx / Express Saver | 34 | `1001921334250001000300779017972697` | `SerialNumber` `CheckDigit` `DestinationZip`
FedEx / SmartPost | 22 | `61299998820821171811` | `ApplicationIdentifier``SerialNumber`, `CheckDigit`, `ServiceType`, `ShipperId`, `PackageId`
USPS 20 | 20 | `0307 1790 0005 2348 3741` | `SerialNumber` `CheckDigit` `ServiceType` `MailerId` `PackageId`
USPS 91 | 25-34 | `420 221539101026837331000039521` `9361 2898 7870 0317 6337 95` `7196 9010 7560 0307 7385` | `SerialNumber` `CheckDigit` `RoutingApplicationId` `DestinationZip` `SCNC` `ServiceType` `ShipperId` `PackageId`
OnTrac | 15 | `C11031500001879` | `SerialNumber` `CheckDigit`
DHL Express | 10 | `3318810025` | `SerialNumber` `CheckDigit`
DHL Express Air | 10 | `73891051146` | `SerialNumber` `CheckDigit`
Amazon Logistics | 15 | `TBA 487064622 000` | `SerialNumber`

| Carrier / Type | Length | Example | Data |
| ------------------------------------- | ------ | ------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- |
| UPS | 18 | `1Z5R89390357567127` | `SerialNumber` `CheckDigit` `ShipperId` `ServiceType` `PackageId` |
| UPS Waybill | 11 | `K2479825491` | `ServiceType` `SerialNumber` `CheckDigit` |
| Multiple / S10 International Standard | 13 | `RB123456785GB` | `SerialNumber` `CheckDigit` `CountryCode` `ServiceType` |
| FedEx / Ground 15 | 15 | `0414 4176 0228 964` | `SerialNumber` `CheckDigit` |
| FedEx / Ground (SSCC 18) | 18 | `00 0123 4500 0000 0027` | `SerialNumber` `CheckDigit` `ShippingContainerType` |
| FedEx / Ground (96) | 22 | `9611020987654312345672` | `SerialNumber` `CheckDigit` `ApplicationIdentifier` `SCNC` `ServiceType` `ShipperID` `PackageId` |
| Fedex / Ground (GSN) | 34 | `9622 0015 6 000 123 4567 1 00 7948 0839 0594` | `SerialNumber` `CheckDigit` `ApplicationIdentifier` `SCNC` `GSN` |
| FedEx / Express 12 | 12 | `986578788855` | `SerialNumber` `CheckDigit` |
| FedEx / Express Saver | 34 | `1001921334250001000300779017972697` | `SerialNumber` `CheckDigit` `DestinationZip` |
| FedEx / SmartPost | 22 | `61299998820821171811` | `ApplicationIdentifier` `SerialNumber` `CheckDigit` `ServiceType` `ShipperId` `PackageId` |
| USPS 20 | 20 | `0307 1790 0005 2348 3741` | `SerialNumber` `CheckDigit` `ServiceType` `MailerId` `PackageId` |
| Canada Post | 20 | `0073938000549297` | `OriginId` `SerialNumber` `CheckDigit` |
| USPS 91 | 25-34 | `420 221539101026837331000039521` `9361 2898 7870 0317 6337 95` `7196 9010 7560 0307 7385` | `SerialNumber` `CheckDigit` `RoutingApplicationId` `DestinationZip` `SCNC` `ServiceType` `ShipperId` `PackageId` |
| OnTrac | 15 | `C11031500001879` | `SerialNumber` `CheckDigit` |
| OnTrac (D) | 15 | `D11031500001879` | `SerialNumber` `CheckDigit` |
| DHL Express | 10 | `3318810025` | `SerialNumber` `CheckDigit` |
| DHL Express Air | 10 | `73891051146` | `SerialNumber` `CheckDigit` |
| DHL E-Commerce | 18-20 | `GM2951173225174494` | `SerialNumber` |
| Amazon Logistics | 15 | `TBA 487064622 000` | `SerialNumber` |
| Landmark Global LTN | 13 | `LTN74207623N1` | `SerialNumber` |
| Lasership LX | 10 | `LX17635036` | `SerialNumber` |
| Lasership 1LS7 (15) | 15 | `1LS717793482164` | `SerialNumber` |
| Lasership 1LS7 (18) | 18 | `1LS7119013618127-1` | `SerialNumber` |
## JSON Format

- **couriers/*.json** - identifies the standard couriers that might send mail
Expand All @@ -37,7 +43,7 @@ Amazon Logistics | 15 | `TBA 487064622 000`
- Each tracking number type is defined by a json hash with the following keys:
- `name` - A name to identify this type of tracking number. Usually includes the carrier in the name, i.e. `FedExGround`

- `regex` - A pcre compatible regular expression that identifies the tracking number regardless of spaces in-between characters.
- `regex` - A pcre compatible regular expression that identifies the tracking number regardless of spaces in-between characters.

Every regex must contain the named groups `SerialNumber` and `CheckDigit` and depending on the tracking number can optionally contain the following common attributes:

Expand All @@ -48,7 +54,7 @@ Amazon Logistics | 15 | `TBA 487064622 000`

- `validation` - Specifies how the tracking number is validated
- `checksum`: if the tracking number has a checksum, include a `checksum` key with the details.
- `name`: specifies the algorithm. Supported algorithms and parameters are `mod10`, `mod7`, `s10`, and `sum_product_with_weightings_and_modulo`. Look at existing examples for parameters.
- `name`: specifies the algorithm. Supported algorithms and parameters are `mod10` `mod7` `s10`, and `sum_product_with_weightings_and_modulo`. Look at existing examples for parameters.
```JSON
"validation": {
"checksum": {
Expand Down Expand Up @@ -99,6 +105,13 @@ Amazon Logistics | 15 | `TBA 487064622 000`

Each hash in the `lookup` array should contain a key called `matches` or `matces_regex`, specifying how the value of `regex_group_name` should be compared.



### Making a contribution
- Modify or add definitions in the couriers/*.json files. Take a look at the existing ones, and follow the guidance above.
- Run the tests locally. `bundle exec rake` If they pass, it's good, submit a PR!


### Standard implementations of

- [Check digit algorithms](https://github.com/adgaudio/MysteryTrackingNumber/blob/master/src/main/java/com/adgaudio/mysterytrackingnumber/CheckDigitAlgorithms.java)
Expand Down

0 comments on commit 0d3ce55

Please sign in to comment.