lists.arthurdejong.org
RSS feed

Re: Parsing GS1-128

[Date Prev][Date Next] [Thread Prev][Thread Next]

Re: Parsing GS1-128



Thank you for your GTIN PR!

On Wed, 2019-05-22 at 17:52 +0200, Sergi Almacellas Abellana wrote:
> We are interested on parsing a code and obtaining the correct data
> types on python. So for example, parsing:
> 01 12345678901234 11 190102 17 190104  
> (Note that I included spaces for clarification but GS1-128 does not
> include spaces)
> 
> We want to obtain something like:
> 
> data = {
>  '01': '12345678901234',
>  '11': datetime.date(2019, 01, 02),
>  '17': datetime.date(2019, 01, 04),
> }
> Do you think this will fit into python-stdnum library?

I think so, feel free to make a PR.

Other modules that provide something like the above are called info()
or split() in python-stdnum.

From my understanding GS1-128 embeds a various numbers with an
application identifier prefix. If these numbers are interesting in
their own right (e.g. GTIN/EAN) having them in their own module would
be really nice (especially if extra validation there would be useful).
Parts that only handle a date or size should probably be part of the
gs1_128 module.

It would be really nice if you could provide an implementation for
this.

Thanks!

-- 
-- arthur - arthur@arthurdejong.org - https://arthurdejong.org/ --