Stream: implementers
Topic: CBOR
Josh Mandel (Apr 21 2021 at 22:57):
Has anyone done work with FHIR in CBOR? Should we standardize a CBOR serialization?
Vassil Peytchev (Apr 22 2021 at 14:40):
That looks very interesting. I hadn't heard about it before, thanks for bringing it up!
David Pyke (Apr 22 2021 at 14:54):
While interesting for projects such as SMART Health Cards, I'm not sure that the byte savings is terribly necessary for FHIR as a whole. Where do you see a need for bandwidth conservation for health data otherwise?
Josh Mandel (Apr 22 2021 at 20:14):
It's not necessarily about byte savings (and we're not using CBOR in Health Cards). It's more about idiomatic use of FHIR in contexts where exchange is already happening with CBOR. I recently saw my first example of a spec based on CBOR with "insert FHIR Bundle as CBOR here" and I realized... that's pretty under-specified statement.
Josh Mandel (Apr 22 2021 at 20:27):
For an example of a context where CBOR is the default for exchange, see https://github.com/18013-5/micov/blob/main/ISO_IEC_18013_5_for_eHealth.pdf (and probably more generally in the IOT world this will be increasingly common).
Josh Mandel (Apr 22 2021 at 20:30):
With judicious use of CBOR tags, specific datetime types, etc, it'd be possible to do a better job of representing several FHIR datatypes than we do in our JSON syntax (e.g., exact representation of decimals; not to mention directly-embedded binary data for Attachment.data
).
Grahame Grieve (Apr 22 2021 at 20:49):
I haven't looked at it, but if it's JSON based, then it would have the same problems with decimals?
Josh Mandel (Apr 22 2021 at 20:52):
It's not JSON based.
Josh Mandel (Apr 22 2021 at 20:53):
I mean, "based on the wildly successful JSON data model" is true but not the full story.
Josh Mandel (Apr 22 2021 at 20:55):
There are defined tags for things like decimal fractions (https://www.rfc-editor.org/rfc/rfc8949.html#fractions)
Josh Mandel (Apr 22 2021 at 20:57):
C4 -- Tag 4
82 -- Array of length 2
21 -- -2
19 6ab3 -- 27315
This is a "tagged array" -- Tag 4 indicates the array should be treated as a decimal fraction; following the tag is an array of length 2 containing [-2, 27315]
, which all together tells you "take 10^-2 * 27315 === 273.14".
Josh Mandel (Apr 22 2021 at 20:59):
Of course, in our FHIR mapping we could say to use tagged arrays like this; or heck we could say "use a string with the decimal inside". These are the kinds of decisions a CBOR implementation of FHIR would need to make (and the kinds of things likely to vary if we don't standardize it).
Josh Mandel (Apr 22 2021 at 20:59):
Sounds like there's not a vast community interest in this yet though, and I'm certainly no expert (I've spent maybe 90min reading the spec).
Grahame Grieve (Apr 22 2021 at 21:05):
well, we've also talked about BSON, ASN.1 and a couple of others that all appear to do pretty much the same thing, but none of them have roused enough interest to get work
Grahame Grieve (Apr 22 2021 at 21:07):
I suggest that you write a one page recommending a set of decisions, maybe on confluence? Then if there's enough interest we can elevate it
Josh Mandel (Apr 22 2021 at 21:54):
I was hoping to find someone else who wanted to do this, or (better still) had already gone through this exercise ;-) But I'll put this on my list of "spare time" projects.
John Moehrke (Apr 22 2021 at 22:40):
lets just use HL7 MLLP
David Pyke (Apr 22 2021 at 23:22):
@John Moehrke Have you been fired today?
John Moehrke (Apr 22 2021 at 23:24):
It is very compact.
Paul Church (Apr 23 2021 at 00:43):
Minimalism is trendy these days.
Last updated: Apr 12 2022 at 19:14 UTC