ArctosDB / arctos

Arctos is a museum collections management system
https://arctos.database.museum
61 stars 13 forks source link

Arctos Report Templates - Add barcodes? #7698

Open acdoll opened 7 months ago

acdoll commented 7 months ago

I've been wondering if we could print barcodes right out of Arctos for our labels and reports (e.g., https://arctos.database.museum/Reports/reporter.cfm?action=edit&report_id=57, https://arctos.database.museum/Reports/reporter.cfm?action=edit&report_id=190). It seems like this is a more difficult problem than I would have expected. The most common solution I have found is something like 'generate images server side to generate the bar codes' and then insert the png into your html. I don't imagine that is something Arctos wants to be responsible for (or is it?). Anyway, I stumbled upon this GitHub: https://github.com/zingl/2D-Barcode/blob/master/barcode.html and am wondering if there is something useful in there for maybe making this work. It appears (?) to utilize another webpage (http://www.w3.org/2000/svg) to encode the text, but that page appears to be retired.
I've been shooting for using data matrix barcodes because they can be printed pretty small and still be readable by our scanners. If there is a more simple solution to get 1d barcodes, that would probably work fine for most of our needs. I would appreciate any suggestions or advice.

dustymc commented 7 months ago

more difficult problem than I would have expected

Yes it is.

something Arctos wants to be responsible for

Not really, the normal pathway (installing some java-bits) it would mean a more complicated recipe for building servers and some security stuff to worry about (and the thing that many of those libraries use had a HUGE incident kinda-recently). That's definitely not "no" but it would be enough of a sustainability impact that I think we'd need to discuss with The Community and TACC.

I googled 'barcode api' or something of the sort, that lead me to https://barcodeapi.org/index.html, I built https://arctos-test.tacc.utexas.edu/Reports/reporter.cfm?action=edit&report_id=191 --> https://arctos-test.tacc.utexas.edu/Reports/reporter.cfm?action=view&report_id=191&table_name=whatever - not a clue if they want $$ at some level or if that's still there or anything else, but I was able to make my browser display something that sorta looks like a barcode in a couple minutes....

acdoll commented 7 months ago

Awesome - that looks really promising! So i just need to get the part barcode to feed into that url and then place that output image into my label. That sounds do-able; I'll give it a try. Thanks D.

campmlc commented 7 months ago

What kind of barcode are you generating? We generate our series in Excel using base10to base36 conversion formula to make a barcode that will fit on top of a cryovial. I've been having these printed at EIM, but looking into using our datamatrix printer.

acdoll commented 7 months ago

We're looking to print data matrix barcodes. They can print pretty small and are still readable by our scanners. They also can contain a lot of information; its not that we need that now, but want capacity for that in the future. After getting a little help on this, it seems like integrating that API call is going to work. @dustymc Can you help me with some SQL to pull the barcode for a specific part, e.g., skeleton? Seems like we need to first grab the collection_object_id from the specimen_part table, but I don't see how to then grab the barcode (from the container table?).

dustymc commented 7 months ago

@acdoll I need

  1. A report I can add to (or I can start with blank)
  2. A query/appropriate records
  3. To know if you want to return only records with barcodes, or if they'd be optional.
acdoll commented 7 months ago
  1. https://arctos.database.museum/Reports/reporter.cfm?action=edit&report_id=196
  2. https://arctos.database.museum/search.cfm?guid_prefix=DMNS%3ABird&species=Buteo%20jamaicensis&collector=RMRP&part_search=skeleton&began_date=2018-01-01&ended_date=2018-12-31
  3. I could go either way, but if it's not too much trouble, I think optional would be preferred - we should have barcodes entered before we print, but there might a case where we just need labels regardless of barcode.

I've added

to the r1 div

acdoll commented 7 months ago

Oops; i added: image

dustymc commented 7 months ago

Oops; i added:

Whoa, that's way nicer than the mess I was making, thanks!

I can work this into your label if you want me to, but I think maybe a standalone template-thingee is more useful for all of us. (Or: that's pretty complex code, I don't wanna muck it up!)

https://arctos.database.museum/Reports/reporter.cfm?action=edit&report_id=197

Screenshot 2024-04-30 at 14 31 22

Let me know if you want me to do something else.

acdoll commented 6 months ago

@dustymc this is great - thank you!! I've been struggling to find time to work on this, but I'll let you know how it goes.

acdoll commented 6 months ago

I think I've got this working pretty well: image

campmlc commented 6 months ago

This is really great -is it shareable? What do you encode in the part barcode - the DZTB number?

dustymc commented 3 months ago

I think this is resolved.

acdoll commented 2 months ago

@dustymc - I had to set this aside for a while, but now I'm trying again and the barcode images are not displaying properly. From my report they print out fuzzy and rectangular (not square). From your report (197), they seem crisp enough, but they are also rectangular. Could this be affected by the addition of the Report PDF Parameters options that were added?

dustymc commented 2 months ago

fuzzy

I wonder if they're reducing quality after so many calls or something?? I don't see anything like that - got a sample?

rectangular

That's just how datamatrix barcodes work see eg https://barcodeapi.org/api/dm/DMNSZT9C1VH

affected by the addition of the Report PDF Parameters

No, unless you're using them to generate PDF serverside (which could explain the fuzzy....).

acdoll commented 2 months ago

I haven't been using this and am only testing with small sets, so they shouldn't have caught on to this yet. I think I know why I'm getting rectangles. These skeleton barcodes had an extra digit as compared to the tissue sample barcodes I was using for testing. That generator site seems to have specific character limits that make it switch between square and rectangle. I found another site that does the same thing https://orcascan.com/guides/free-barcode-image-api-0e4a4fa6 and these still turn out as squares.

It seems like the fuzziness was the result of me trying to force the size and thus tweeking the image resolution.

I'm now having an issue with it not displaying barcodes that should be there. I'm looking at: Query: https://arctos.database.museum/search.cfm?guid=DMNS%3ABird%3A47782%20DMNS%3ABird%3A49144%20DMNS%3ABird%3A50625%20DMNS%3ABird%3A51207%20DMNS%3ABird%3A51393%20DMNS%3ABird%3A51967%20DMNS%3ABird%3A53615%20DMNS%3ABird%3A54519%20DMNS%3ABird%3A54638 Report: TEST_DMNS_skeleton box label image

Each of these has a skeleton and each skeleton has a barcode. However, when I look at the JSON Part on the results page several of them do not have the barcode listed in the part_barcode field: image Any idea on what's going on here?

dustymc commented 2 months ago

Hu!

https://barcode.orcascan.com/?type=datamatrix&data=HelloHelloHello https://barcodeapi.org/api/dm/HelloHelloHello

are different shapes, and https://barcode.orcascan.com/?type=datamatrix&data=HelloHelloHelloHelloHelloHello just keeps getting bigger, and https://barcodeapi.org/api/dm/HelloHelloHelloHelloHelloHello went back to square - and my phone can still understand both of them....

Hu!

do not have the barcode listed

The cache probably got out of whack. You can request a refresh, and please file an issue if you've got any idea how that might have happened (or if you don't, but I'm not sure how much luck I'll have going in blind - I suspect it's something involving the part/container/barcode link, and there are a LOT of ways to make that connection.)

acdoll commented 2 months ago

I like the square ones for aesthetics but as long as they scan properly and I can fit them on my labels, I guess it doesn't really matter.
As for the cache, do I have to request a refresh on each record that is behaving weird? We just loaded 50 of these barcodes yesterday, using Bulk Parts-->Containers, to test this out.

dustymc commented 2 months ago

Bulk Parts-->Containers

Thanks!

https://github.com/ArctosDB/dev/issues/57

each record

Screenshot 2024-09-18 at 15 48 53
acdoll commented 2 months ago

I do not seem to have permissions to request this refresh: image

Some of these still don't seem to be updated; some skeleton barcodes are still not displaying on the report or in the JSON Parts

dustymc commented 2 months ago

permissions

Try again. (I'm guessing you logged out, or your cache got reclaimed - big gap between the actions or a glitch in the matrix.)

acdoll commented 2 months ago

Still getting the same error on the refresh attempt.

dustymc commented 2 months ago

Thanks, I see the problem now. It might take me a while to address it, send me your search URL (please include guid_prefix) and I'll request the refresh for you.

acdoll commented 2 months ago

Just these for now. Thanks https://arctos.database.museum/search.cfm?guid_prefix=DMNS%3ABird%2CDMNS%3AEgg%2CDMNS%3AHerp%2CDMNS%3AInv%2CDMNS%3AMamm%2CDMNS%3APara&part_name=skeleton&barcode=NOTNULL

dustymc commented 2 months ago

done