FHIR Chat · 'Inline extensions should only be defined in Extensions.' · shorthand

Stream: shorthand

Topic: 'Inline extensions should only be defined in Extensions.'


view this post on Zulip Yannick Börner (Nov 05 2021 at 17:48):

I am running into the 'Inline extensions should only be defined in Extensions.' error and can not figure out how to do the following properly:

...
* address ..*
  * ^slicing.discriminator.type = #pattern
  * ^slicing.discriminator.path = "$this"
  * ^slicing.rules = #open
* address contains
    Strassenanschrift 0..* and
    Postfach 0..1
* address
  * type 1..
  * city 1..
  * postalCode 1..
  * country 1..
  * extension ^slicing.discriminator.type = #value
    * ^slicing.discriminator.path = "url"
    * ^slicing.rules = #open
  * extension contains Stadtteil 0..1 MS // -> ERROR
  * line 1.. MS
    * extension ^slicing.discriminator.type = #value
      * ^slicing.discriminator.path = "url"
      * ^slicing.rules = #open
* address[Strassenanschrift] only AddressDeBasis
  * ^patternAddress.type = #both
  * type = #both (exactly)
  * line 1.. MS
    * extension contains
        Strasse 0..1 MS and // Cardinalities are different here -> ERROR
        Hausnummer 0..1 MS and // Cardinalities are different here -> ERROR
        Adresszusatz 0..1 MS and // Cardinalities are different here -> ERROR
        Postfach 0..0 // Cardinalities are different here -> ERROR
* address[Postfach] only AddressDeBasis
  * ^patternAddress.type = #postal
  * type = #postal (exactly)
  * line 1.. MS
    * extension contains
        Strasse 0..0 and // Cardinalities are different here
        Hausnummer 0..0 and // Cardinalities are different here
        Adresszusatz 0..0 and // Cardinalities are different here
        Postfach 0..1 MS // Cardinalities are different here
...

What I want to achieve is to have different cardinalities for the extension slices within the different address slices but I receive the aforementioned error for the lines I marked above with ERROR. This is the farthest I've gotten but I can't seem to solve the remaining issues. The way I understand this error (and judging by the way it was answered before) would be to define an extension. But would I need two (or even three) in this case and if so, on what level?

view this post on Zulip David Pyke (Nov 05 2021 at 19:00):

It's telling you that you need to define this as an external extension with inline extensions added, not just inline with inline extensions. Are you defining this outside of a profile using the Extension definition:
Extension:
Id:
Title: ""
Description: ""

view this post on Zulip Chris Moesel (Nov 09 2021 at 13:50):

Right, to further elaborate on @David Pyke's answer, are Stadtteil, Strasse, Hausnummer, Adresszusatz, and Postfach standalone extensions (either defined by you or in a dependency IG)? If no, then you need to define them first.

If those are defined as standalone extensions, then you need to change the syntax of how you include them. When you include extensions into a profile, you need to also provide a local name for them (which becomes the slice name). For example:

* extension contains Stadtteil named stadtteil 0..1 MS

See: https://build.fhir.org/ig/HL7/fhir-shorthand/reference.html#contains-rules-for-extensions

view this post on Zulip Yannick Börner (Nov 11 2021 at 11:30):

Thanks @Chris Moesel, that cleared up things quite a lot. Previously, I got slightly confused on how to express these three in shorthand: inline extensions, standalone extensions, inherited slices. However, it is now clear where I need to use which and I was able to solve all errors, thank you!


Last updated: Apr 12 2022 at 19:14 UTC