Repository navigation
Add the made-to-order, Italian NHRN and person identifiers (193 -> 205) - #9
Merged
Merged
Conversation
MaximBelov
force-pushed
the
feat/person-and-mto-ais
branch
from
August 13, 2026 03:17
2b5852b to
3602e8d
Compare
MaximBelov
force-pushed
the
feat/person-and-mto-ais
branch
from
August 13, 2026 05:44
3602e8d to
ebc17ee
Compare
MaximBelov
force-pushed
the
feat/person-and-mto-ais
branch
from
August 13, 2026 06:05
ebc17ee to
bb5b2d0
Compare
Adds 03 MTO GTIN, 716 NHRN AIC and the person related block 7250-7259 that GS1 uses to identify a patient rather than a trade item, taking the coverage from 193 identifiers to 205. 7250 and 7251 are the first date elements here to carry a four digit year, so they get their own parser rather than reusing parseDate. Reading YYYYMMDD with the two digit parser is not merely inaccurate: it takes the first six digits as a date, so "725019850630" yields a date in 2026 and leaves "30" behind to be parsed as an AI of its own, and the barcode comes back with a spurious extra element rather than an error. The new parser reads the year as given, with no century to guess at, and validates month, day and, for 7251, hours and minutes. The identifier list was taken from guillaumegarcia13's fork, which added the same block; the date handling here is our own, since that fork routes 7250 through parseDate and hits the problem described above.
MaximBelov
force-pushed
the
feat/person-and-mto-ais
branch
from
August 13, 2026 06:09
bb5b2d0 to
cf91ca1
Compare
Merged
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.
Adds the identifiers @guillaumegarcia13's fork has been carrying since 2025, so this fork stops trailing it. The identifier list is theirs; the date handling is not, for the reason below.
Coverage goes from 193 to 205:
037167250725172527253–7259The
725xblock identifies a patient rather than a trade item, which is what makes it useful on a healthcare label alongside the GTIN, expiry and batch.Why the dates needed their own parser
7250and7251are the first date elements in this library to carry a four digit year. Every other date AI isYYMMDD, andparseDatereads exactly six digits.Routing
7250throughparseDateis not merely inaccurate, it corrupts the rest of the barcode:So this adds
parseLongDate, which reads the year as given — there is no century to guess at, and the sliding window thatparseDateapplies would be actively wrong here — and validates month, day, and for7251hours and minutes. A short or non-numeric date is rejected rather than silently truncated.That is the one place this deliberately diverges from the fork it takes the list from:
guillaumegarcia13/masterdeclaresparseDate("7250", "DOB")and reproduces the behaviour above.Tests
spec/ApplicationIdentifiersSpec.jsgrows from 193 to 205 entries, so every new identifier is covered by the table that checks each one comes back under its own AI.spec/PersonApplicationIdentifiersSpec.jsadds 17 specs for the parts a table cannot express: that7250reads a four digit year, that it consumes all eight digits and leaves no spurious element, that it does not slide1920into this century, that impossible months, days, hours and minutes are rejected, and a full healthcare barcode carrying GTIN, expiry, batch and patient together.232 specs, 0 failures. Existing specs are untouched.