NHMDenmark / Mass-Digitizer

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

Verify that catalog number/barcode is validated depending on institution/collection. #356

Closed jlegind closed 1 year ago

jlegind commented 1 year ago

Issue

There needs to be a validation mechanism for Barcodes. Different collections might have different barcode requirements. The App must be prepared to take an institution name and a collection name and set a validation length on the barcode based on this combination.

Acceptable solution

The catalog number submitted must be 8 digits in case of 'NHMD Vascular Plants and have no alphabetic characters. The catalog number submitted must be 9 digits in case of 'NHMD Entomology and have no alphabetic characters. The catalog number submitted must be 9 digits in case of 'NHMA Entomology and have no alphabetic characters. Please implement in specimen_data_entry.py in "event == 'inpCatalogNumber':"

Remarks

The issue of barcode scanners delivering a stream of atomic values rather than a lump of data has been dealt with in issue #364. Having a stream of digits coming in as barcode prevents us from knowing when the complete barcode has been read. The current solution allows us to modify barcode validation and accept a _greaterthan length of characters/digits condition and allows for the option of prepending barcodes with collection abbreviations. This is future proof.

PipBrewer commented 1 year ago

This was already implemented and so we need to figure out why this is no longer the case.

jlegind commented 1 year ago

This was already implemented and so we need to figure out why this is no longer the case.

The version 1.1.0 has no automatic barcode save function and relies on [Enter] to be pressed ; This bypasses the while loop issue.

jlegind commented 1 year ago

If there are hard rules that the collections have uniform barcode formats within each collection, then this task becomes easy. Otherwise it is a difficult one.

Currently there are two solutions: ONE: Validation on barcode length presuming above condition. (8 digits for Entomology nad 9 digits for Vascular Plants) TWO: All barcode readers are set to append a return character to the end of the barcode. This allows for greaterThanOrEqual validation or repudiation of failed reads that return a barcode of less than the expected length. Solution two requires that all employed barcode readers have the option of adding a return character to the end of the barcode read. The Zebra LI2208 has that.

jlegind commented 1 year ago

Bhupjit and I have decided on implementing a "collection_catalogNumber_length" supplementary table so that we can move away from hardcoding catalog number format lengths in the App. Collection table will be joined to the length table through the 'spID' field. The new table will look like this:

"collection_catalogNumber_length" table

collection_name length prefix
NHMD Vascular Plants 8
NHMD Entomology 9
NHMA Entomologys 13 NHMA

Currently the app relies on a hardcoded logic block for each collection. This is not sustainable for all 21 collections. The goal is to have one lookup based on the globalSettings 'collectionName' which yields a barcode length that can be tested against the catalog number input, reducing the code to one single logic block.

jlegind commented 1 year ago

The comment above is not valid. The collection table was augmented with a "catalognrlength" field which states the length of the catalog number required.