Stream: IG creation
Topic: Contained resources in PlanDefinition
David Hay (Jul 28 2020 at 22:52):
I'm wanting to contain a couple of ActivityDefinition resources in a PlanDefinition, but as the reference from the PlanDefinition.actiondefinition[x] is a canonical datatype rather than a Reference, the IG publisher is complaining. Example is here
Grahame Grieve (Jul 28 2020 at 23:59):
are you referring to this?
dom-3: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource ( (unmatched: ActTragacanth)) [contained.where(((('#' + id) in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(canonical) = '#').exists()).not()).trace('unmatched', id).empty()]
David Hay (Jul 29 2020 at 01:59):
yep
Grahame Grieve (Jul 29 2020 at 02:33):
do you think it's wrong?
Lloyd McKenzie (Jul 29 2020 at 02:53):
Yes, it's wrong. I don't think we can write an invariant that enforces our genuine rule, which is "every contained resource must be connected via a reference path to the containing resource". That path could involve container pointing to containedA which points to containedB which is pointed to by containedC. That would still meet our fundamental need - and there are situations where a direct connection between container and contained isn't appropriate. But we can't write an invariant that would do that - anymore than we could write one that said that all message resources need to connect somehow to the MessageHeader. We had to write that one in code (and it took a while to get it right).
Grahame Grieve (Jul 29 2020 at 03:02):
it doesn't prevent two contained resources from referring to each other but not referring to the container or vice versa, yes. but it's not clear to me how how it's wrong in regards to canonical resources
David Hay (Aug 01 2020 at 03:02):
Is it OK for a resource to have contained resources where the 'reference' from the parent to the contained is a canonical url - in this case PlanDefinition.action.definitionCanonical? If it is OK, then it is being incorrectly marked as an error by the IG publisher. I can hide the error of course, but wanted to be sure I have the right behaviour...
Lloyd McKenzie (Aug 01 2020 at 03:21):
@Grahame Grieve
Grahame Grieve (Aug 02 2020 at 21:32):
yes- see http://hl7.org/fhir/references.html#canonical-fragments
Last updated: Apr 12 2022 at 19:14 UTC