FHIR Chat · QR code generation · smart/health-cards

Stream: smart/health-cards

Topic: QR code generation


view this post on Zulip Michele Mottini (May 19 2021 at 18:45):

Is this right? (should correspond to https://smarthealth.cards/examples/example-00-a-fhirBundle.json)
image.png

view this post on Zulip Daniel Lee (May 19 2021 at 18:47):

I scanned it into the microsoft validator tool(https://demo-portals.smarthealth.cards/VerifierPortal.html) and it says the QR code is using version 29(should be 22)

view this post on Zulip Daniel Lee (May 19 2021 at 18:49):

The payload does have a FHIR bundle with a Patient resource and 2 Immunization resources.

view this post on Zulip Josh Mandel (May 19 2021 at 18:49):

Likely a problem with numeric encoding here.

view this post on Zulip Josh Mandel (May 19 2021 at 18:50):

Though if that's the case I'd expect two validation errors: one for V29 code (>22) and one for non-numeric encoding (if that's what's happening).

view this post on Zulip Michele Mottini (May 19 2021 at 18:52):

Thanks Daniel and Josh
I checked the numeric encoding and it matched the https://smarthealth.cards/examples/example-00-f-qr-code-numeric-value-0.txt

view this post on Zulip Josh Mandel (May 19 2021 at 18:53):

So, the string of digits is right, but you're not creating a QR with a numeric-mode segment (I'm guessing).

view this post on Zulip Josh Mandel (May 19 2021 at 18:54):

It's like what I'd get if I changed this line of the example generator to say mode: "bytes" (not sure if this helps you, but just want to give you a concrete sense of what may be happening).

view this post on Zulip Michele Mottini (May 19 2021 at 18:54):

Thanks, yes, probably that's the issue. It seems that the library I am using does not have that option, let me check

view this post on Zulip Josh Mandel (May 19 2021 at 18:55):

What language are you using?

view this post on Zulip Michele Mottini (May 19 2021 at 18:55):

JavaScript

view this post on Zulip Michele Mottini (May 19 2021 at 18:55):

Using http://davidshimjs.github.io/qrcodejs/

view this post on Zulip Daniel Lee (May 19 2021 at 18:55):

https://www.npmjs.com/package/qrcode , this library is what most of us are using, it allows you to mix and match modes

view this post on Zulip Michele Mottini (May 19 2021 at 18:56):

Thanks, I'll try that one

view this post on Zulip Josh Mandel (May 19 2021 at 18:56):

+1 for https://www.npmjs.com/package/qrcode if you're writing in JS -- and https://github.com/nayuki/QR-Code-generator has a high quality set of libraries in multiple languages (including JS, python, Java, and C)

view this post on Zulip Josh Mandel (May 19 2021 at 18:57):

Lack of support for multi-segment QR generation is a common "gotcha" is less-than-full-featured QR generation libraries.

view this post on Zulip Josh Mandel (May 19 2021 at 18:58):

(On the plus side, all reader libraries we've found can read these QRs.)

view this post on Zulip Michele Mottini (May 19 2021 at 21:15):

Small follow up: I looked into moving the QR code generation server-side (we have iOS / Android / Web front-end, so that would make things easier), but cannot find a C# library that support specifying multiple segments and the mode to use for each (or even the mode to use for everything - seems to use always byte)

view this post on Zulip Josh Mandel (May 19 2021 at 21:37):

https://codecrete.net/QrCodeGenerator/api/Net.Codecrete.QrCodeGenerator.QrCode.html seems to allow a List of segments, each with a mode.

Mid level: Custom-make a list of QrSegment instances

This is from https://www.nuget.org/packages/Net.Codecrete.QrCodeGenerator/

view this post on Zulip Michele Mottini (May 19 2021 at 22:24):

Thanks (again!) Josh, I'll try that

view this post on Zulip Michele Mottini (May 20 2021 at 13:44):

Got this now:
qrcode.png
...that scans ok and looks to be of the right size, but it still not identical to https://smarthealth.cards/examples/example-00-g-qr-code-0.svg

view this post on Zulip Josh Mandel (May 20 2021 at 16:30):

If you've got this right data encoded, and the right segments (one with bytes mode for the prefix, and one with numeric mode for the main content) then you should be good to go. There are a couple of underlying reasons why your output might differ from someone else's even for the same data: you may be applying a higher level of error correction (which is okay as long as you fit within a v22 symbol) or your library may be choosing masking patterns differently (this shouldn't happen as far as I know, but I could imagine libraries might be less than perfect on this).

view this post on Zulip Abbie Watson (May 21 2021 at 16:41):

John Anyperson for the first QR code, and Ashley Goodwin for the second.

IMG_8006.PNG IMG_8005.PNG

view this post on Zulip Mahesh V S (May 25 2021 at 15:52):

Michele Mottini said:

Got this now:
qrcode.png
...that scans ok and looks to be of the right size, but it still not identical to https://smarthealth.cards/examples/example-00-g-qr-code-0.svg

One thing I noticed is that the health card you shared doesn't have an issuer. See the out put from a scanner app.

image.png
image.png

view this post on Zulip Michele Mottini (May 25 2021 at 15:59):

Yes, the sample I was using does not have an issuer


Last updated: Apr 12 2022 at 19:14 UTC