FHIR Chat · Extensions w/ externally defined sub-extensions · implementers

Stream: implementers

Topic: Extensions w/ externally defined sub-extensions


view this post on Zulip Chris Moesel (Jan 26 2017 at 22:44):

Complex extensions use sub-extensions to define their parts. In the examples I've found, those sub-extensions are always fully defined inline with their parent complex extension. I, however, would like to define a complex extension with sub-extensions that are fully defined externally (rather than inline). Is this possible?

For example, I want to define complex extension http://example.org/foo with two sub-extensions: http://example.org/bar (which is a code) and http://example.org/baz (which is a boolean). If I were to define the sub-extensions inline, then my complex extension would specify the http://example.org/bar extension with a valueCode element and the http://example.org/baz extension with a valueBoolean element. But suppose that the two sub-extensions are already defined externally for re-use. Then I just want to reference them by their uri without re-specifying their value[x] elements -- but I think this would fail validation... Am I right?

view this post on Zulip Lloyd McKenzie (Jan 27 2017 at 23:01):

In principle, you can define an extension that prohibits value and allows child extensions but doesn't define what those can be. And it's perfectly possible to define an extension that has as its context another extension. The child extensions would have to list their full URL though - they couldn't use a "relative" URL like complex extensions would typically use. Also, whether the validator will support extensions that have, as their context, another extension, I don't know. I don't know anyone's done it so it's unlikely it's been well tested and may not have been built in yet.

view this post on Zulip Chris Moesel (Jan 30 2017 at 13:08):

Yes, I think I was getting confused about where and when the invariant applies. Since invariants apply to the *data*, I see now that I can just reference other extensions (as sub-extensions) in my StructureDefinition -- although I'll take note that it may not be well-tested. Thanks again!


Last updated: Apr 12 2022 at 19:14 UTC