NHMDenmark / Mass-Digitizer

Common repo for the DaSSCo team
Apache License 2.0
1 stars 0 forks source link

Barcode validation: Only numeric characters allowed and within a certain range #364

Closed PipBrewer closed 10 months ago

PipBrewer commented 1 year ago

What is the issue ?

The app accepts barcodes (catalog numbers) that are of arbitrary length and have non-numeric characters. Related to #272

Description

Ideally the barcodes should conform to one standard format per collection. For NHMD Vascular Plants the barcode length must be eight digits . For most other collections it is nine digits. Should the barcode fall short of this standard there needs to be a warning and a stop to saving the record.

Why is it needed/relevant

The existence of non compliant barcodes is undesirable for many reasons. The barcode value 12345 is not the same as 00012345 even though you could make a case for this being a duplicate. Testing for duplicate barcodes becomes much harder if the format is diverse. The app would be inclined to accept bad reads from the barcode label.

Effort required

Difficult

What is the expected acceptable result.

Depending on collection, the barcode format is specific. Entering an incorrect format should launch a warning prompt. Record is not saved until a well formatted barcode is entered.

How to approach it?

From #272:

The barcode scanners can be programmed to add a newline character at the end of the read. This is done by scanning the appropriate barcode from the user manual.
For the Zebra barcode scanners it is not a problem. In the case of another brand it might be necessary to find that particular programming barcode online.

The paragraph above deals with the issue of barcode readers delivering a stream of digits(or characters as the case may be). The problem here is that the App has no idea when the read is finished. When the barcode scanner is programmed to end the barcode stream with a newline character, the App code can be updated to accept and test such a barcode. Once in place, this code can be updated to accept characters in cases collections request it - say they want to prepend a collection abbreviation or so.

Remarks

Certain barcode scanners do not have a 'new-line' barcode programmer in the user manual. In those cases there is a good chance that the programmer barcode for this feature can be found on the web.

bhsi-snm commented 10 months ago

duplicate of #386, partially #368 and #356