Stream: implementers
Topic: Add sub-extensions to official extension
Maria Hu (Sep 18 2019 at 20:28):
Can I add sub-extensions to official extension?
e.g. Official extension 'http://hl7.org/fhir/StructureDefinition/patient-genderIdentity', can I add sub-extensions "genderIdentity" and "otherGenderIdentity" ?
Or do I have to create my own extensions? Please advise, thanks.
Grahame Grieve (Sep 18 2019 at 20:29):
you can add your own extensions but they have to have an absolute URI which is a reference to your extension definition
Maria Hu (Sep 18 2019 at 20:50):
you can add your own extensions but they have to have an absolute URI which is a reference to your extension definition
So it's not allowed to add sub-extensions to official extension, correct?
Maria Hu (Sep 18 2019 at 20:56):
Can I add sub-extensions to official extension?
e.g. Official extension 'http://hl7.org/fhir/StructureDefinition/patient-genderIdentity', can I add sub-extensions "genderIdentity" and "otherGenderIdentity" ?
Or do I have to create my own extensions? Please advise, thanks.
So it's not allowed to add sub-extension(s) to official extension, correct? Please confirm, thanks.
Lloyd McKenzie (Sep 18 2019 at 21:01):
Two things:
1. if the extension has a 'simple' type (string, code, etc.), then any extensions will have appear in the 'value' element (i.e. you're essentially extending the extension's value rather than the extension)
2. If it's a complex type, then you can add additional sibling child extensions, but anything 'extra' you add has to have a fully specified URL. I.e. you can't have an extension where url="someNewProperty", instead it needs to be url="http://some-organization/whatever/StructureDefinition/someNewProperty"
Maria Hu (Sep 18 2019 at 21:38):
Two things:
1. if the extension has a 'simple' type (string, code, etc.), then any extensions will have appear in the 'value' element (i.e. you're essentially extending the extension's value rather than the extension)
2. If it's a complex type, then you can add additional sibling child extensions, but anything 'extra' you add has to have a fully specified URL. I.e. you can't have an extension where url="someNewProperty", instead it needs to be url="http://some-organization/whatever/StructureDefinition/someNewProperty"
Thanks Lloyd, got it.
Michel Rutten (Sep 19 2019 at 08:46):
@Lloyd McKenzie thanks for clarifying. Forge currently supports (1) but not (2). I guess (2) is mainly intended when deriving from an existing extension definition. However is (2) also allowed for a complex extension definition itself? i.e. where a complex child extension element (NOT child extension of the value element) references an external extension definition via absolute url.
Grahame Grieve (Sep 19 2019 at 09:15):
yes that's allowed.
Michel Rutten (Sep 19 2019 at 09:17):
OK thanks for confirming
Grahame Grieve (Sep 19 2019 at 09:26):
it's not common ;-) - I think I've seen it a couple of times
Michel Rutten (Sep 19 2019 at 09:34):
I see how this could be useful, allowing to define a complex extension that combines several other existing extensions. I've added a feature request to the Forge issue tracker.
Lloyd McKenzie (Sep 19 2019 at 12:42):
It's sort of the difference between adding a new element to a backbone as opposed to extending one of the elements within the backbone.
Last updated: Apr 12 2022 at 19:14 UTC