Stream: implementers
Topic: FHIR JSON formatting
Tim Berezny (Mar 10 2018 at 14:15):
If I constrain something in my profile from 0..* to 0..1, in my JSON payload should i still include the array square brackets [] or leave them out?
Lloyd McKenzie (Mar 10 2018 at 16:03):
The schema (and thus whether something is an array or not) is determined by the resource, not the profile. So it should definitely have the brackets. That said, be cautious about constraining the upper cardinality. Never constrain the upper cardinality when you can instead slice and set an expectation for a lower number of elements that meet your criteria. For example, don't limit Patient.name to 0..1, instead set an expectation that there is no more than one legal name with no end date. That way systems with multiple names can continue to send what they have - to you and everyone else - while you can find the data you need. That means that client systems won't need to create a custom interface to talk to you whose only purpose is to strip out elements you might ignore. (If there's no 'core' way to filter to the element you need, then define an extension. For example, add an "address for use in secondary billing to hospital XYZ" flag and require that extension to appear on exactly one address. There's a bit of extra work for your client systems to populate the flag, but they can then still send the same set of addresses to everyone - and other servers will just ignore your special extension.)
Tim Berezny (Mar 10 2018 at 17:20):
Ok great, thanks Lloyd.
Note: @Shamhad Abdi , @Joel Francis , @Smita Kachroo @Tue @John Wills
Lilian Minne (Mar 19 2018 at 15:27):
Interesting topic! Here at Firely, we always strive to create open models to make them as generic and reusable as possible. We avoid the upper cardinality, but we didn't yet take it as far as using slices. I personally believe this is a very interesting approach that can be very useful in many use cases, especially at a higher (e.g. national) level. Please note that we added a section on open versus closed modeling in the Best-Practices module of our Profiling Academy as well.
Last updated: Apr 12 2022 at 19:14 UTC