FHIR Chat · Walking into a contained resource · conformance

Stream: conformance

Topic: Walking into a contained resource


view this post on Zulip Ewout Kramer (Jul 04 2017 at 09:30):

I found a subtle bug in my validator, that I think is of interest to a broader audience.

My base assumption is that the snapshot is always complete. To be more precise, I have an assumption in my validator that if an element has children in a StructureDefinition, it has all of the children for that element. E.g. although in a differential you would just have Patient.name.family, the snapshot would have all the other siblings (like given) too. That seemed a fair assumption, until I met a profile that constrained Bundle.entry.resource.Meta.

This highlighed a problem: the snapshot generator only knows that Bundle.entry.resource is of type Resource, so while walking into this element, it will expand it and add the elements of Resource under Bundle.entry.resource. However, in a real instance Bundle.entry.resource will contain more elements than those of Resource (say, Patient.name). Since my validator assumes a snapshot is "complete", it will now complain about the extra elements (all of them - except the ones from Resource) found in the instance.

It's not insurmountable, but I thought I'd share the fact that snapshots are thus "mostly complete", but need some extra intelligence when dealing with "contained", Bundle.entry.resource and Parameters.parameter.resource, and maybe others.

view this post on Zulip Lloyd McKenzie (Jul 04 2017 at 15:30):

Make sure you add a test-case to the shared test cases :)

view this post on Zulip Brian Postlethwaite (Jul 05 2017 at 05:32):

Great find!

view this post on Zulip Grahame Grieve (Jul 05 2017 at 05:42):

under what conditions does the snapshot generator walk into Bundle.Entry.resource?

view this post on Zulip Ewout Kramer (Jul 06 2017 at 14:56):

Noted!

view this post on Zulip Ewout Kramer (Jul 06 2017 at 14:57):

You walk into it when you add constraints to Bundle.entry.resource.meta or Bundle.entry.resource.profile for example....

view this post on Zulip Ewout Kramer (Jul 06 2017 at 14:57):

(esoteric, ok, but possible)

view this post on Zulip Grahame Grieve (Jul 07 2017 at 11:42):

I don't even know what the java snapshot generator will do in that case


Last updated: Apr 12 2022 at 19:14 UTC