FHIR Chat · Logical Models and Inheritance · implementers

Stream: implementers

Topic: Logical Models and Inheritance


view this post on Zulip Chris Moesel (Mar 20 2018 at 16:10):

Is it possible for a Logical Model to inherit from another Logical Model -- and add new elements without using extensions (e.g., first-class elements)?
If so, would this work in the same way that resources inherit from DomainResource (via the structdef's baseDefinition element)?
Lastly, if so, is it legal to repeat inherited elements in the child Logical Model? I want the child's structdef (and IG documentation) to show the inherited elements (so you don't have to click through to the parent to see them).

view this post on Zulip Chris Moesel (Mar 20 2018 at 16:11):

Also, if this is the type of question that should be asked in #committers, please let me know. I'm still trying to figure out what goes where.

view this post on Zulip Grahame Grieve (Mar 20 2018 at 19:17):

  • it's valid to inherit
  • it's not valid to repeat
  • it would be wrong to repeat in order to solve a presentation issue
  • this issue sits on the borders between here, and IG Creation

view this post on Zulip Chris Moesel (Mar 20 2018 at 19:39):

Thanks @Grahame Grieve. While it's not valid to repeat, I imagine it would be valid within the context of constraining something? For example it I wanted to change an inherited element from 0..1 to 1..1 or apply a value set?

view this post on Zulip Grahame Grieve (Mar 20 2018 at 19:44):

yes you can only repeat when constraining. And you can only constrain or specialise, you can't do both in a single structure definition

view this post on Zulip Chris Moesel (Mar 20 2018 at 19:54):

Thanks, Grahame!

view this post on Zulip Chris Moesel (May 27 2021 at 19:28):

Grahame Grieve said:

yes you can only repeat when constraining. And you can only constrain or specialise, you can't do both in a single structure definition

Followup question (more than 3 years later)... You said "you can only constrain or specialise..." We interpreted that to mean that a logical model cannot constrain an element it inherited from its parent.

But... can a logical model constrain a subpath of an element it introduced? For example, let's say a logical model (PersonModel) introduces an element PersonModel.name that has type HumanName. Can we constrain PersonModel.name.given to 1..1 in the logical model?

view this post on Zulip Elliot Silver (May 27 2021 at 19:56):

(Side comment: If I recall correctly, last year I found you that if my logical model had a HumanName element in it, I couldn't do a mapping to the HumanName.given element.)

view this post on Zulip Grahame Grieve (May 28 2021 at 10:35):

@Chris Moesel yes I think you can. You can't slice, though, unless it's a constraint. but it can be

view this post on Zulip Grahame Grieve (May 28 2021 at 10:35):

@Elliot Silver I need more context for that

view this post on Zulip Chris Moesel (May 28 2021 at 12:53):

Thanks, @Grahame Grieve. Based on http://hl7.org/fhir/R4/elementdefinition.html#interpretation, we understand that slicing and fixing values is completely prohibited in all elements in all specializations.

view this post on Zulip Elliot Silver (May 28 2021 at 17:11):

@Grahame Grieve , my recollection was off. The issue I was thinking about is Questionnaire definition mapping to logical model. Did you ever get a chance to look at it?

view this post on Zulip Grahame Grieve (May 30 2021 at 21:31):

@Chris Moesel it does say that, OK. But I'm not sure why - we could fix inherited properties in descendents. But is it common enough to justify reopening?

view this post on Zulip Chris Moesel (Jun 01 2021 at 13:06):

I don't know the answer to that question. For now, SUSHI will follow what the spec says (and disallow slicing and fixed values). We'll know how common it is (at least for our users) based on the feedback we receive about that!

view this post on Zulip Julian Carter (Jun 16 2021 at 19:14):

Grahame Grieve said:

Chris Moesel yes I think you can. You can't slice, though, unless it's a constraint. but it can be

Hello! I have one more follow-up question on this topic. If a logical model inherits a backbone element from its parent, is it legal for the child Logical Model to add new sub-elements to the original backbone element that it inherited? Something like the following:

Logical: LogicalParent
* food 1..1 BackboneElement "Food" "The foods a person ate in a day"
* food.breakfast 1..1 string "Breakfast" "The meal eaten in the morning"

Logical: LogicalChild
Parent: LogicalParent
* food.lunch 1..1 string "Lunch" "The second meal of the day"
* food.dinner 1..1 string "Dinner" "The final meal of the day"

view this post on Zulip Grahame Grieve (Jun 16 2021 at 19:58):

maybe? I'm not sure that the tools support it, and I don't think the spec rules one way or another on it

view this post on Zulip Julian Carter (Jun 16 2021 at 20:43):

Gotcha, thank you. I was trying to figure out if that should be allowed in sushi, but if it's not explicitly prohibited in the spec then I'll assume it's alright.

view this post on Zulip Chris Moesel (Jun 16 2021 at 20:47):

@Julian Carter - I would check to see how the IG Publisher handles it. If the publisher handles it, then I agree that SUSHI may as well allow it. But if the publisher does not handle it well, we may want to stop it at the SUSHI level.


Last updated: Apr 12 2022 at 19:14 UTC