DacoTaco / BarcodeParserBuilder

BarcodeParserBuilder is a .Net ( standard 2.0 & 2.1 ) nuget package to help parse & build barcode strings
https://www.nuget.org/packages/BarcodeParserBuilder
GNU Lesser General Public License v2.1
11 stars 4 forks source link

GS1 DataMatrix support? #9

Closed agnespoodle closed 1 year ago

agnespoodle commented 1 year ago

This is slick, but not supporting GS1 DataMatrix (2D barcodes, pharma industry standard). I've started looking into modifying what you've got here, but if you're willing to incorporate it, you're no doubt faster than I am.

DacoTaco commented 1 year ago

wdym not supporting GS1 datamatrix? do you have an example that isn't working?

2D GS1 barcodes should work, specifically health care related ones :/

(EDIT : also, thank you for saying this is slick. there really was a need for this within the .net developer community. specially with barcodes becoming more and more a thing)

agnespoodle commented 1 year ago

I tried a couple 2D scans off some old (expired in 2021) drug boxes and it said invalid, and looking at the code I didn't see support for 414 GLN and 254 GLN Extension so I probably posted in a caffeinated haste. GS1 scans worked great. But it installed and worked well via Nuget, so kudos to you!

Edit: examples: 0100304720400301211006155205193317210228101012131 0100372266102010219CKEKYR6FC1X1721103110PG957

DacoTaco commented 1 year ago

you are correct that it is missing the 414 & 254 application identifiers. it has a rudimentary support but it just loads all data until it finds a <gs>. if it doesn't contain one, it loads everything into it hehe

i tried parsing 0100304720400301211006155205193317210228101012131 using one of the many unit tests and i saw it parsed the Product code. it detected the product code as 00304720400301, or a National drug code 0472040030. after that its trying to put 1006155205193317210228101012131 in application identifier 21. it fails there as segment 21 is set to have a max length of 20 characters (..21)

this is following the GS1 specs so seems like that barcode is invalid? is the copy paste missing a group separator somewhere?

the same thing happens with that second barcode too

agnespoodle commented 1 year ago

It may be these 2D codes are too outdated or otherwise just weird. 0100304720400301211006155205193317210228101012131 should break down into: 01 (GTIN) 00304720400301 21 (Serial Number) 10061552051933 17 (Exp Date) 210228 10 (Lot Number) 1012131

Based on the box and the human-readable format. But again, it's old, so maybe I'm working with crap codes. I'm not reading any group separators. Those codes I posted in the edit were direct scans.

DacoTaco commented 1 year ago

hm, a serial number should end with a group separator unless it is exactly 20 characters. maybe the scanner is dropping it ? some have this as a setting can you post an image of the barcodes themselves?

agnespoodle commented 1 year ago

clobetasol

DacoTaco commented 1 year ago

yup, your scanner seems to be discarding the group separators. my phone , using the scanbot sdk, read out gs01003047204003012110061552051933gs17210228101012131 which does parse correctly

can you check your scanner's settings?

agnespoodle commented 1 year ago

Sigh. Thanks. If I use the QR app on my phone, I see the separators. I'm using a TEEMI handheld scanner, so I'll try and see if there's a setting I can change. Thanks for the help, man. Turns out your code is fine and my scanner is the problem.

DacoTaco commented 1 year ago

haha, no problem. im going to close this issue, but if you ever come across an issue don't hesitate to report it!

this project exists to help everyone that uses it and it can only do so by getting issues reported or pull requests made to improve it