Stream: implementers
Topic: Self referencing complex extension
Jonny Rylands (Mar 11 2016 at 12:36):
Is it possible for a complex extension to reference itself? For example an extension with two elements of 'name' and 'value' where 'value' could be a CodeableConcept or could be the whole extension? (I realise this is a poor example but wondered whether it was possible.)
Jason Walonoski (Mar 11 2016 at 12:39):
Extensions can contain extensions. Nothing says the extension can't contain itself, and in fact you could create the StructureDefinition for an Extension that does that. So yes, it is possible.
Jonny Rylands (Mar 11 2016 at 12:41):
How do you do that? Do you constraint one of the value[x] elements to be of type Reference, referencing the extensions URI?
Jason Walonoski (Mar 11 2016 at 12:45):
No, but I haven't done this... you could either have an element in your StructureDefinition with the path Extension.extension.url
that is mapped to your extension URI... or you could use a "primitive extension" -- so the path would be Extension.valueCodeableConcept.extension
I think... I haven't played too much with primitive extensions though, because I hate that they even exist.
Jason Walonoski (Mar 11 2016 at 12:48):
By the way, if you have comments about how complex extensions work, you may want to add your thoughts to the "Representing Extensions" topic
Jonny Rylands (Mar 11 2016 at 12:57):
OK, thanks - I will have a read through this thread later and see if I can contribute.
Ewout Kramer (Mar 14 2016 at 09:30):
Johnny, I think you want to use the extension as the actual value, not as an extension on the value? Extensions on extensions are always done as extensions on the Extension.value. You could use Extension.valueExtension, though http://hl7.org/fhir/datatypes.html#open suggests this is not (yet) allowed. Extension.extension is used to represent nested complex extensions, so that's probably not what you're looking for.
Jonny Rylands (Mar 14 2016 at 12:22):
Ewout - thanks. I think need to re-run though my example, Extension.extension may do the job.
Last updated: Apr 12 2022 at 19:14 UTC