Picture output from barcode scan?

Hi all,

I'm looking for a funny bit of functionality. The use case is this. I would like beneficiaries to display their QR card, I scan their card with my ODK Collect, and based on that scan, have a picture come up of the beneficiary. Obviously we would have previously gathered the picture and distributed the QR code.

So Based on the QR code scan, we can have a subsequent calculated field to execute SOMETHING... but could we somehow pass that as a parameter to display a picture?

Specifically we're considering using this functionality to ensure that the QR code is being presented by the proper person.

Is there any hope?

Have you tried using a QR code that returns a URL to the person's picture (assuming you have a data connection and website hosting jpegs), and then using a URL widget to open that URL, which would presumably then display their picture?

[disclaimer: I've not tried this myself but it might work. Please let me know if so.]

1 Like

Thanks @Xiphware, that's an awesome solution... except that I forgot to mention a major consideration. This has to work in the bush, no data connection, maybe no signal even. :-/

Maybe try something along these lines?:

picturecheck.xls (25.5 KB)

Basically, define a read-only note for each individual with their name and an embedded image (ie media::image), and use relevant logic to only show the one who's id matches the userid captured from your barcode/QR code scanner. See https://docs.opendatakit.org/form-styling/

1 Like

This solution works... kinda! Identified a bug, which I'm discussing here: https://github.com/opendatakit/collect/issues/1591

But yeah, this will work! I think we can even optimize a bit... instead of displaying notes for each possible case (which would get annoying for 100k beneficiaries) we can simply create the following page to display ALL THE MEDIA as a choose_one but with a parent to the previous screen. That way we can shove all the options into the choices page, and still retain the functionality!

Thanks for your help!

Yes, I had thought about instead making a long choice list with all the pictures and names (see https://docs.opendatakit.org/form-question-types/#select-widget-with-image-choices) and using a calculation to effectively programmatically select the option corresponding to the scanned id. But the issue is that it'll still show all the pictures (but only one will be selected).

So the multiple relevant note's seemed like a better approach, since the enumerator/user will only see one picture to verify.

The best approach may depend somewhat on how this is going to be deployed: if you have a relatively fixed set of targets that you wish to survey, then effectively hardcoding them into your form via notes may make sense. If, however, you may need to add/remove targets on a regular basis, then maintaining a (external?) choice-list may make more sense.

It's interesting. Can it be limited to 1( or n) times of scan? For example the Note will show that "the barcode is used" if it have been scanned before.

@dmtk41 Yes! If I understand you correctly, you're trying to figure out if there is anyway to know whether someone scanned has already been scanned DURING THAT SESSION, right? I think (and community, pls correct me if I"m wrong @yanokwa for example), but I think ODK-X was designed to accomplish this... to have a local store of records... but I don't think this is possible on normal ODK.

Also, I will caution you... and again, community let me know here: We have to be really careful if we have multiple enumerators. For example if we're distributing food to pregnant mothers, and one enumerator deals with them, how would we be able to know if that same woman goes to another enumerator?

1 Like

You're right @Amit_Kohli, I also try but not yet find a way to do it with normal ODK.
I'm trying to set up ODK-X sync end point but dont know how to run Docker in Swarm mode first.