Closed JohnMoehrke closed 5 months ago
is this invariant only intended to be used in an ITI-65 Transaction Bundle?
is this invariant only intended to be used in an ITI-65 Transaction Bundle?
Based on https://build.fhir.org/ig/IHE/ITI.MHD/ITI-65.html#23654123-replace-transform-signs-and-append-associations I'd agree with what you're suggesting here. It looks like the invariant should be on the bundle. I'm not sure of how you'd do the fhirpath to find the correct entry, but it seems the invariant should be related to the 2 DocumentReference entries in the Bundle instead of on DocumentReference directly.
I found something so perhaps like this? I haven't done any validation on this, but maybe it's close. I'm not sure we can really rely on the id though.
entry.resource.where(is(DocumentReference) and status = 'superseded').id = entry.resource.where(is(DocumentReference) and relatesTo.code = 'replaces').relatesTo.target.reference.replace('DocumentReference/','')
lloyd did give me the right code.. but then said that we should NOT do that.
Discussed in committee and will resolve by removing the invariant as stated today as it is redundant.
@lukeaduncan why is it redundant?
Because the fhir core already requires them to be populated
I had to fixup the invariant with a newer IG publisher, but during the fixing of it to make the publisher happy, I came to the realization that the logic was not matching the fhirpath expression. And it was not complete.
today:
Yet the invariant should actually be checking deeper. It really says that if the .code is
replaces
that the .target must point at a DocumentReference that issuperceded
but if we had this, we really should be checking that all the others are pointing at
current
DocumentReference.Then, I find out that it is generally not recommended to include resolve() in an invariant.
see zulip chat https://chat.fhir.org/#narrow/stream/179266-fhirpath/topic/help.20with.20code.20is