Stream: conformance
Topic: Differential in Logical Models
Alexander Zautke (Jul 23 2019 at 07:35):
The other day I had a discussion with @Michel Rutten about the handling of the differential in logical models. Currently, Forge only populates the snapshot of a logical model and leaves the differential empty. I thought this was a bug in Forge, as I expected it to be closer aligned to a StructureDefinition of one of the core resources. Meaning that a differential as well as a snapshot is present. Could someone elaborate on the reasons for this implementation choice? I'm curious about it as I can't find an invariant mandating this behaviour as a rule?
Alexander Zautke (Jul 24 2019 at 06:26):
Or to ask the other way around: would anyone object to a new behaviour of Forge where Logical Models would also contain a differential? Would that break current tooling? Would the IG publisher be able to handle it?
Alexander Zautke (Jul 29 2019 at 10:13):
No objections? We really want to make sure that we don't break any existing stuff. The change would harmonise our current snapshot generation process and also help systems which rely on regenerating snapshots when receiving a StructureDefinition for Logical Model.
David Hay (Aug 13 2019 at 02:03):
What would the differential be from? Or - what's the source model that is being changed...
Oliver Egger (Aug 13 2019 at 05:51):
source model would be the base definition where the logical model is derived/constrained from
Oliver Egger (Aug 13 2019 at 05:53):
I would prefer to just develop the differential in a logical model and let the publishing stack handle the snapshot generation, this prevents inconsistencies between snapshot and differentials.
Oliver Egger (Aug 13 2019 at 06:00):
the ig publisher handles snapshot generation for specialization in logical models, I have created a pull request to support also constraint snapshot generation see https://github.com/hapifhir/org.hl7.fhir.core/pull/59
Michel Rutten (Aug 13 2019 at 08:38):
@Oliver Egger yes, that makes sense. Serializing logical model definitions to the differential component (instead of snapshot) would allow deriving models from Resource, DomainResource or another logical model.
Michel Rutten (Aug 13 2019 at 08:39):
@Grahame Grieve @Lloyd McKenzie ?
Sean McIlvenna (Aug 13 2019 at 17:27):
I'm still not sure what the "differential" is showing a difference compared to... I suppose if there is a baseDefinition, the differential is the difference from baseDefinition. But, if there is no baseDefinition, then it seems like snapshot is appropriate. I'd encourage a constraint indicating "if no baseDefinition, snapshot SHALL exist and differential SHALL NOT exist. otherwise, differential SHALL exist and snapshot MAY exist."
Michel Rutten (Aug 14 2019 at 09:00):
Hi @Sean McIlvenna, all FHIR types are derived from Resource
or Element
. Element
has a recursive definition: Element.extension
is of type Extension
, which is derived from... Element
! This implies that the child element Element.extension
(indirectly) inherits constraints from the root of Element
. So by expanding the snapshot of Element
, the profile actually pulls in constraints from itself. Pretty cool.
Grahame Grieve (Aug 15 2019 at 02:49):
right. Logical models are no different from the base types that we define in FHIR itself with a diff on Element or Resource, and then generating the snapshot
Michel Rutten (Aug 19 2019 at 09:18):
@Grahame Grieve does this mean that I should update Forge and implement @Alexander Zautke's proposed change? i.e. serialize logical models to differential component, instead of the snapshot component.
Grahame Grieve (Aug 19 2019 at 09:48):
yes, though you could serialise to both too
Michel Rutten (Aug 20 2019 at 16:12):
Great, thanks! @Alexander Zautke please take note
Last updated: Apr 12 2022 at 19:14 UTC