Stream: implementers
Topic: discriminator on entries in a bundle
Robin Bosman (Mar 23 2020 at 18:26):
I am searching for the right kind of discriminator to slice the entries in a bundle profile.
Let's say I want to be certain always one Patient and one Practitioner is given as an entry in a bundle: this means in my instance I would have an entry with <resource>/<Patient> and one with <resource>/<Practitioner> but how do choose the right discriminator for this?
Lloyd McKenzie (Mar 23 2020 at 19:18):
type=type, path=entry.resource
Robin Bosman (Mar 24 2020 at 08:49):
Thank you, that pointed me in the right direction! After some trial & error I ended with type=type and path=resource
Katarina (Apr 05 2020 at 21:21):
Would be the discriminator different when I have two different practitioners in the bundle? One practitioner with meta.profile=A and another with meta.profile=B.
Lloyd McKenzie (Apr 06 2020 at 00:50):
In general you should be cautious about relying on meta.profile - it's poor practice to reject an instance that meets your constraints but doesn't happen to specifically declare it meets them. That said, slicing based on resolve().meta.profile should work so long as the referenced resources are in the Bundle.
Rebecka Hansson (Jun 29 2020 at 09:11):
After finding this thread I tried the same with the Bundle profile I'm creating. However, I've encountered a few problems.
In Forge, there is no path for resource when selecting the descriminator. Tried to solve this by just typing the path instead and it seems to work for the discriminator. Next, I linked the resource to a profile, which was the only way I could figure out how to make sure the slices was of a specific resource type. This doesn't work, in the xml the value for entry.resource.type continues to be only a generic resource. This means that when implementing this with Hapi the validation of the profile fails.
Is there any other way to do this? I found examples where this seems to work and can't figure out where I go wrong.
Lloyd McKenzie (Jun 29 2020 at 14:08):
What exactly are you putting in the discriminator?
Rebecka Hansson (Jun 29 2020 at 17:32):
I am slicing the entry element with Path:resource, Type: type.
Lloyd McKenzie (Jun 29 2020 at 22:08):
Try Type: resource. (There is no 'type' element to check the type of...)
Rebecka Hansson (Jun 30 2020 at 06:07):
I tried that now, it is not possible to select or enter resource as the type in Forge at least.
image.png
Rebecka Hansson (Jul 01 2020 at 11:21):
The other question is how I set e.g. an Observation as data type for the entry.resource instead of 'Resoucre'. I've seen this in other bundle profiles but can't seem to manage in Forge.
image.png
Alexander Zautke (Jul 01 2020 at 11:30):
@Matthijs van der Wielen
Matthijs van der Wielen (Jul 01 2020 at 15:14):
Rebecka Hansson said:
I tried that now, it is not possible to select or enter resource as the type in Forge at least.
image.png
It is possible to do this in Forge, you would have to do this manually as you described.
It would end up look something like this:
<element id="Bundle.entry">
<path value="Bundle.entry" />
<slicing>
<discriminator>
<type value="type" />
<path value="resource" />
</discriminator>
<rules value="open" />
</slicing>
<min value="2" />
</element>
You could look at https://simplifier.net/NictizSTU3-Zib2017/Nictiz.IHE.MHD.ProvideDocumentBundle.Minimal/~xml as an example.
Rebecka Hansson (Jul 01 2020 at 21:18):
Yes! :) It works to do it manually. I think my biggest issue is how I get the type on the resource element do be set as observation or clinicalImpression instead of just resource. The fact that I can´t do this causes validation errors. Actually, I want to accomplish how it looks in the example you sent:
<element id="Bundle.entry:List.resource">
<path value="Bundle.entry.resource" />
<min value="1" />
<type>
<code value="List" />
<profile value="http://nictiz.nl/fhir/StructureDefinition/IHE.MHD.List" />
</type>
</element>
That code value says something else than resource (List). Currently, my profile looks like this:
<element id="Bundle.entry:clinicalImpression.resource">
<path value="Bundle.entry.resource" />
<short value="ClinicalImpression" />
<min value="1" />
<type>
<code value="Resource" />
<profile value="https://fhir.cambio.se/StructureDefinition/ClinicalImpressionTriageRetts/v1" />
</type>
Is that something I need to do manually as well?
Rebecka Hansson (Jul 02 2020 at 14:26):
@Matthijs van der Wielen Do you have an idea of how to solve my last question? :)
Matthijs van der Wielen (Jul 03 2020 at 07:51):
@Rebecka Hansson ,
I might be able to help. If you open a bundle, and slice it as in the Nictiz example, under resource you can select Type(s): image.png
You can select "List" here, or is your case "Observation". Is this what you are looking for?
Rebecka Hansson (Jul 03 2020 at 07:56):
Hi @Matthijs van der Wielen ! Yes that's what I'm looking for. However I see that you're working with Forge for STU3 - in which it looks like you can untick 'Resource'. I can't see where that is possible in Forge for R4. Then it only seems like it is possible to add profiles but not to specify the resource type further than 'Resource'.
image.png
Matthijs van der Wielen (Jul 10 2020 at 08:54):
Hi @Rebecka Hansson , with some help from one of my colleagues I found where you can do this in R4. Although it doesn't seem intuitive, you can specify the resource type by defining a "profile" on resource. Since all other core resources are technically profiles on resource. In the screenshot attached you can see how to define that you can only use "List" in this slice. You can add other canonical URLs to define other options, which can be core resources or local profiles.
image.png
Last updated: Apr 12 2022 at 19:14 UTC