How to print numerous TEI QR codes?

I was just thinking about how QR codes are often used to represent physical TEIs. It is common to see QR codes as a short cut for accessing a “thing’s” data out in the world. I know it is possible to print a single TEI’s QR code but is there a way to batch print or “export” TEIs in QR form?

Would using a third party service to render and print them make more sense? Is there an example of the data structure that DHIS2 encodes in it’s QR Codes?

Edit: I’ve refined my question to be: when “encapsulating” a TEI into a QR code, what system fields and attributes are included in the encoded string?

@tracker-backend
Also tagging my friends from @dhis2-android since the QR functionality seems more integrated into the daily process.

2 Likes

Hey @chase.freeman . Let’s hope someone from backend can provide a better response soon.

I know in the past the TEI > QR has been used in COVID where a COVID passport was generated with a QR that later was used a search string for Android phones. I am not sure I understand your usecase to have a batch “print” of the TEIs but I am thinking that it shouldn’t be difficult to do what was being done in the TEI program via the custom buttom of print TEI from an external program.

In the end the QR codes were just a specific TEI attribute (if I recall correctly) so I guess you could have something reading some attributes from the DB (directly or via API calls) and transform them if needed. For example:

get name, lastname, unique_identifier (API) from TEI where X
generate PDF with name, lastname, QR_generate(unique_identifier)
print PDF (and distribute to individuals)

In your program you could have those as search attributes, and if configured the render type properly, from Android, you could use that QR to search for the TEI.

1 Like

Hi @chase.freeman

I’m not sure I can answer your question preciesly because I also think that this depends on the configuration of the program itself and what metadata is used for searching. Here’s a use case from the docs that explains this:

… trigram indexes will also help if the system searches based on event data values. Nigeria had their QR code for completed vaccinations as an event data value which they searched on heavily (eg: passengers qr code checked before boarding). Depending on search patterns for the specific implementation’s configuration, this trigram index can also be applied. Not all implementations will need this. Assuming the extensions mentioned above are already created, an example index creation for a data element (uid=​​LavUrktwH5D, qrCode), attached to a programstage. The dataelementid=233047 and programstageid=64527 in this example.

create index concurrently in_gin_psi_edv_64527_233047 on > programstageinstance
using gin (lower(eventdatavalues #>> '{LavUrktwH5D, value}') gin_trgm_ops);

source: dhis2 docs - Tracker Performance

I guess then when you know which data to insert into the QR Code, you will be able to send an API request with the whole list and create QR codes in batches? @jaime.bosque explained that :arrow_up: better :slight_smile:

1 Like

Hello Chase,

There are two ways to use QR codes in the App.

  1. Render a TEI attribute as QR code. Usefull to use it for searching. If you configure that attribute as search, then you can just open the camera from the search form and scan a QR code to searh the TEI without typing. (This applies for bar codes too).

  2. Export TEI as QR code. If you export a TEI as QR code all the data related to the TEI will be exported in QR code(s). That Includes the TEI attributes, enrollment info, and events info and data. On another device, with the DHIS2 Android App, you should be able to scan the codes and import the TEI.

I think your question refered to this second use. We have not received much feedback on how that works in practice (happy to know if you test it). But we are aware that, if the enrollment/event info is big, we need many QR codes and it becomes a bit cumbersome to import one TEI, even worse if you are thinking of many. We do not have considered any batch export/import and also have not support for accessing it as a “thing” out in the world. We have played with the idea of improving the TEI import/export through NFC (we did a proof of concept and worked pretty well) and batch transfer via bluetooth. But none of those got really prioritised (yet ?).

Would be good to know about your use case to strengthen these two features (or a new one).

Thanks!

3 Likes

Hi @marta Thank you for your reply. The use case I’m thinking of is more about using a single TEI’s attribute (Text rendered as QR code) as an identifier for real physical entities (people with an ID card that used QR code, Assets with QR label/sticker, etc).

With the “QR sticker” use case in mind - it is key for an implementer like myself to figure out how to generate the QR codes – 1.) should the QR codes be created by DHIS2? 2.) Or should they be created by an external system and scanned into DHIS2 to be associate the sticker’s Id with the TEI?

I’m thinking it would be much easier to go with option two since there is no native support for batch printing of QR codes. There are some tools out there that can convert the QR codes to strings and vice-versa but I think it is more wise to try and sort that all out before DHIS2 is involved and just let DHIS2 “consume” the QR Codes data as a string and be done with it.

Hi Chase,

The use case you are describing is perfect for using QR codes combined with searchable attributes. In response to your questions: 1.) should the QR codes be created by DHIS2? 2.) Or should they be created by an external system and scanned into DHIS2 to be associate the sticker’s Id with the TEI?

The App supports both options. The App only stores the string associated to the QR code. That string can be entered through the scanner (camera) or manually (keyboard). Once the string is stored the QR code can be regerated (displayed) or replaced/updated (scan again).

Because of the logistics related to printing out stickers, I would also prefer to consume QR codes already generated and pre-printed.

You can find more details here Visual configurations - DHIS2 Documentation

3 Likes

Thanks @marta!

2 Likes