FHIR Chat · profiling a transaction · IG creation

Stream: IG creation

Topic: profiling a transaction


view this post on Zulip John Moehrke (Jan 06 2020 at 19:51):

I have a problem that might be a tooling issue, but might also be a mistake in the way I have profiled a transaction. In my IG (IHE MHD profile), I have profiled a transaction Bundle as having 1 DocumentManifest, 0..* DocumentReference, 0..* List, 0..* Binary, and 0..1 Patient. The problem I have is with my examples. An example of this Bundle seems to not like having the profile indicated at the Bundle level, and also doesn't like Bundle.entity that are DocumentReference where that instance is a profile indicated.
IG is published http://build.fhir.org/ig/IHE/ITI.MHD/branches/master/index.html
all of my bundle examples have the problem, but most simple is http://build.fhir.org/ig/IHE/ITI.MHD/branches/master/qa.html#_scratch_ig-build-temp-NT2L2T_repo_input_examples_pdb-minimalSubmission

I can eliminate the first "information" by removing the profile declaration on that DocumentReference
Note I do not get these kind of "information" on DocumentManifest or List.... which leads me to think I have messed up, but can't figure out what the mess up is.

view this post on Zulip John Moehrke (Jan 08 2020 at 00:05):

@Lloyd McKenzie @Grahame Grieve @Eric Haas ?

view this post on Zulip Lloyd McKenzie (Jan 08 2020 at 16:47):

When you say "doesn't like", do you mean the "doesn't match any known slice" messages?

view this post on Zulip Sarah Gaunt (Jan 08 2020 at 22:29):

I was JUST about to start writing a post about a similar problem (I think)... Are you talking about the slicing of Bundle.entry?

We have this bundle: https://build.fhir.org/ig/HL7/bser/StructureDefinition-BSeR-ChildhoodNutritionReferralFeedbackSupportingInformation.html with a slice on entry. The slices are: 2 Observations and one MedicationStatement:

pasted image

I was getting an error on my example: Element matches more than one slice.

I tried every permutation and combination of discriminator.type and discrininator.value and they all had various errors, none worked.

I eventually went back to the original type=profile and path=resource and ended up having to change the Observations to get it to work.

I feel that this is a total hack though - what I had to do was to fix the value of Observation.meta.profile to the uri of the Observation profile. https://build.fhir.org/ig/HL7/bser/StructureDefinition-BSeR-EarlyChildhoodNutritionFeedbackObservation.html:

pasted image

I thought that maybe it wasn't able to differentiate between slices because Observation.code is bound to a value set (extensible). But I'm pretty sure the same pattern works in a Composition.section.entry slice and there isn't an issue. (ETA: It's not quite the same pattern with the Composition.section.entry.slice because the type is Reference there whereas in the Bundle.entry it's Resource)

So - not sure if this is the same issue, but it's similar?

view this post on Zulip John Moehrke (Jan 08 2020 at 22:57):

seems similar.

view this post on Zulip John Moehrke (Jan 08 2020 at 22:58):

I noticed today that @Rob Hausam has done something similar in the IPS implementation guide for a Composition Bundle. SO I am going to look into that. He doesn't get any informational or warnings.

view this post on Zulip Sarah Gaunt (Jan 08 2020 at 23:44):

Funny, I just looked at his IG too - saw a commit message that made me think it might be similar. But I can't see a Bundle profile in that IG. There is a Composition that slices on section.entry, but it's not quite the same - and the slicing there has always worked fine (reference vs resource maybe).

view this post on Zulip Rob Hausam (Jan 09 2020 at 00:04):

Right. We do use Bundle in IPS, but it's the base and didn't see a need to profile it. The IPS Composition profile is working, as you both described. Is it possible to profile Composition (doesn't necessarily need to be a "document") for what you're doing, @John Moehrke?

view this post on Zulip John Moehrke (Jan 09 2020 at 00:49):

I have an equivalent in that I have in the MHD transaction (Bundle) there MUST be one and only one DocumentManifest, and that DocumentManifest is similar to Composition in that it links to everything else... However the IHE MHD specification requires that some of these references to within and some are allowed to be external..
I tried that with a "degenerate" profile and example -- see http://build.fhir.org/ig/IHE/ITI.MHD/branches/master/qa.html#_scratch_ig-build-temp-UN3UJS_repo_input_examples_pdb-degenerateSubmission

view this post on Zulip Grahame Grieve (Jan 13 2020 at 06:56):

I'm not sure I follow all this. Can you make a test case? E.g. a profile, and a bundle that fails the profile, with a reason why?

view this post on Zulip Sarah Gaunt (Jan 13 2020 at 07:07):

I'll create a test case tomorrow...

view this post on Zulip John Moehrke (Jan 13 2020 at 14:25):

@Grahame Grieve my MHD ig has this problem.

view this post on Zulip Grahame Grieve (Jan 13 2020 at 19:47):

where?

view this post on Zulip John Moehrke (Jan 15 2020 at 00:20):

I am trying to slice in a Bundle to assure that it has ONE DocumentManifest profiled according to a profile in my IG. I have the following slice in my profile on Bundle, but it doesn't seem to work.
<element id="Bundle.entry">
<path value="Bundle.entry" />
<slicing>
<discriminator>
<type value="profile" />
<path value="$this.resource" />
</discriminator>
<description value="Everything in a proper Bundle"/>
<ordered value="false"/>
<!-- TODO: This should be closed, but because of the warnings on DocumentReference not being found I need to leave it open -->
<rules value="open" />
</slicing>
</element>
<element id="Bundle.entry:ManifestSlice">
<path value="Bundle.entry" />
<sliceName value="ManifestSlice" />
<short value="Manifest Slice" />
<definition value="The DocumentManifest defining this submission."/>
<alias value="SubmissionSet" />
<min value="1" />
<max value="1" />
</element>
<element id="Bundle.entry:ManifestSlice.resource">
<path value="Bundle.entry.resource" />
<min value="1" />
<type>
<code value="Reference" />
<profile value="http://ihe.net/fhir/ihe.mhd.fhir/StructureDefinition/IHE.MHD.Minimal.DocumentManifest" />
</type>
</element>

view this post on Zulip Grahame Grieve (Jan 15 2020 at 00:46):

should be type=type, not type = profile

view this post on Zulip John Moehrke (Jan 15 2020 at 00:54):

tried that still not finding the DocumentManifest that is in the example

view this post on Zulip John Moehrke (Jan 15 2020 at 00:55):

http://build.fhir.org/ig/IHE/ITI.MHD/branches/master/qa.html#_scratch_ig-build-temp-OG2IBB_repo_input_examples_pdb-degenerateSubmission

view this post on Zulip Sarah Gaunt (Jan 15 2020 at 02:43):

Sorry @Grahame Grieve - I meant to create an example for this yesterday...

I tried every single permutation and combination of discriminator type and path and finally ended up wtih profile/resource.
And the only way that combination worked was if I hard coded meta.profile in the Observation profile that is referenced by the slice. (The code on the Observation comes from a value set that is extensibly bound).

This bundle profile works and the example doesn't error (with the meta.profile hack) http://build.fhir.org/ig/HL7/bser/branches/master/StructureDefinition-BSeR-TobaccoUseCessationReferralSupportingInformation.html
and here is the Observation that I put the meta.profile hard coded onto: http://build.fhir.org/ig/HL7/bser/branches/master/StructureDefinition-BSeR-TelcomCommunicationPreferences.html#tabs-diff
The example QA: http://build.fhir.org/ig/HL7/bser/branches/master/qa.html#_scratch_ig-build-temp-M7QR6H_repo_source_resources_bundle_bundle-bser-tobacco-referral-eve-everywoman

I've edited this bundle profile (http://build.fhir.org/ig/HL7/bser/branches/master/StructureDefinition-BSeR-DiabetesPreventionReferralFeedbackSupportingInformation.html#tabs-diff) to be type/$this.resource as you suggest, and removed the meta.profile constraint.
And the example errors: http://build.fhir.org/ig/HL7/bser/branches/master/qa.html#_scratch_ig-build-temp-M7QR6H_repo_source_resources_bundle_bundle-bser-diabetes-referral-feedback-eve-everywoman

view this post on Zulip Grahame Grieve (Jan 15 2020 at 06:21):

hmm. I'm working on this. I'm going to use this test profile:

view this post on Zulip Grahame Grieve (Jan 15 2020 at 06:21):

<?xml version="1.0" encoding="utf-8"?>
<StructureDefinition xmlns="http://hl7.org/fhir">
    <id value="bundle-slice-profile-master" />
    <url value="http://hl7.org/fhir/test/StructureDefinition/bundle-slice-profile-master" />
    <status value="active" />
    <experimental value="false" />
    <date value="2020-01-06" />

    <fhirVersion value="4.0.0" />
    <kind value="resource" />
    <abstract value="false" />
    <type value="Bundle" />
    <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Bundle" />
    <derivation value="constraint" />
    <differential>
<!-- slice definition for the Bundle content -->
        <element>
            <path value="Bundle.entry" />
            <slicing>
                <discriminator>
                    <type value="profile" />
                    <path value="$this.resource" />
                </discriminator>
                <ordered value="false"/>
                <rules value="closed" />
            </slicing>
        </element>
<!-- Patient - a simply profiled resource -->
        <element>
            <path value="Bundle.entry" />
            <sliceName value="Patient" />
            <min value="1"/>
            <max value="1"/>
        </element>
        <elemen>
            <path value="Bundle.entry.resource" />
            <min value="1" />
            <type>
                <code value="Resource" />
                <profile value="http://hl7.org/fhir/test/StructureDefinition/bundle-slice-profile-patient" />
            </type>
        </element>
<!-- Observation1 - make sure can differentiate same type but different profile -->
        <element>
            <path value="Bundle.entry" />
            <sliceName value="Obs1" />
            <min value="1"/>
            <max value="1"/>
        </element>
        <elemen>
            <path value="Bundle.entry.resource" />
            <min value="1" />
            <type>
                <code value="Resource" />
                <profile value="http://hl7.org/fhir/test/StructureDefinition/bundle-slice-profile-obs1" />
            </type>
        </element>
<!-- Observation2 - 2nd observation -->
        <element>
            <path value="Bundle.entry" />
            <sliceName value="Obs2" />
            <min value="1"/>
            <max value="1"/>
        </element>
        <elemen>
            <path value="Bundle.entry.resource" />
            <min value="1" />
            <type>
                <code value="Resource" />
                <profile value="http://hl7.org/fhir/test/StructureDefinition/bundle-slice-profile-obs2" />
            </type>
        </element>
<!-- Procedure (base resource) -->
        <element>
            <path value="Bundle.entry" />
            <sliceName value="Patient" />
            <min value="1"/>
            <max value="1"/>
        </element>
        <elemen>
            <path value="Bundle.entry.resource" />
            <min value="1" />
            <type>
                <code value="Resource" />
                <profile value="http://hl7.org/fhir/StructureDefinition/Procedure" />
            </type>
        </element>
    </differential>
</StructureDefinition>

view this post on Zulip Grahame Grieve (Jan 15 2020 at 06:21):

that tests out the range of things we need to test, I think?

view this post on Zulip Sarah Gaunt (Jan 15 2020 at 06:42):

You might want to fix typo in <elemen>
I think that will do it...
Though one of the reasons I think mine is failing is because Observation.code of one of the slices is bound to a value set and the binding is extensible. Not sure if that has anything to do with it - but it doesn't seem to fail if Observation.code is a fixed value - so if you could make one of your obs similar...

view this post on Zulip Grahame Grieve (Jan 15 2020 at 06:52):

no. profile testing simply didn't work on a direct resource boundary. I've been working on code and test cases for several hours now

view this post on Zulip Sarah Gaunt (Jan 15 2020 at 07:05):

Any ideas what is wrong? I've spent may hours trying to get it to work too...

view this post on Zulip Oliver Egger (Jan 15 2020 at 07:21):

we have slight variation on @Grahame Grieve testcase which works for document and I think should work also for a transaction

        <element id="Bundle.entry">
            <path value="Bundle.entry" />
            <slicing>
                <discriminator>
                    <type value="profile" />
                    <path value="resource" />
                </discriminator>
                <rules value="open" />
            </slicing>
        </element>
        <element id="Bundle.entry:Composition">
            <path value="Bundle.entry" />
            <sliceName value="Composition" />
            <short value="Composition" />
            <min value="1" />
            <max value="1" />
        </element>
        <element id="Bundle.entry:Composition.resource">
            <path value="Bundle.entry.resource" />
            <min value="1" />
            <type>
                <code value="Composition" />
                <profile value="http://fhir.ch/ig/ch-core/StructureDefinition/ch-core-composition" />
            </type>
        </element>

test sample is here: http://build.fhir.org/ig/hl7ch/ch-core/branches/master/qa.html#_scratch_ig-build-temp-ZH5SXM_repo_examples_bundle_1-ZuweisungZurRadiologischenDiagnostik-FHIR, entry[0] is matched

view this post on Zulip Oliver Egger (Jan 15 2020 at 07:23):

difference:

  • discriminator path: resource instead of $this.resource
  • type.code: resource name (Composition) instead of 'Resource'

view this post on Zulip Grahame Grieve (Jan 15 2020 at 11:47):

the validator will reject that now, after todays work .... code must be Resource

view this post on Zulip Michaela Ziegler (Oct 15 2020 at 08:14):

Grahame Grieve said:

the validator will reject that now, after todays work .... code must be Resource

With the latest publisher (v1.1.35), there is an error (Profile http://fhir.ch/ig/ch-core/StructureDefinition/ch-core-composition is for type Composition, but this element has type Resource) when we do it this way. Do we have to adjust our profile or is it an error in the publisher?

         <element id="Bundle.entry">
            <path value="Bundle.entry" />
            <slicing>
                <discriminator>
                    <type value="profile" />
                    <path value="resource" />
                </discriminator>
                <rules value="open" />
            </slicing>
        </element>
        <element id="Bundle.entry:Composition">
            <path value="Bundle.entry" />
            <sliceName value="Composition" />
            <short value="Composition" />
            <min value="1" />
            <max value="1" />
        </element>
        <element id="Bundle.entry:Composition.resource">
            <path value="Bundle.entry.resource" />
            <min value="1" />
            <type>
                <code value="Resource" />
                <profile value="http://fhir.ch/ig/ch-core/StructureDefinition/ch-core-composition" />
            </type>
        </element>

view this post on Zulip Grahame Grieve (Oct 15 2020 at 08:46):

oh dear I'm sorry

view this post on Zulip Michaela Ziegler (Oct 15 2020 at 14:09):

Grahame Grieve said:

oh dear I'm sorry

Does "oh dear" mean, that I have to change the profile?

  • The discriminator of the slice will stay
  • type.code will change from 'Resource' to 'Composition'

Will that be the correct way how to do it?

view this post on Zulip Grahame Grieve (Oct 15 2020 at 19:07):

no that's an oversight on my part. you don't need to change anything

view this post on Zulip Chris Moesel (Mar 29 2021 at 13:13):

the validator will reject that now, after todays work .... code must be Resource

Sorry for resurrecting an old thread, but it appears that this may have implications for SUSHI (SUSHI thread). If SUSHI sees a FSH rule like * entry.resource only MyObservationProfile, then it will a) set the type.code to Observation, and b) set the type.profile to the canonical for MyObservationProfile. If you only allow that profile, I don't see why you wouldn't also narrow the type.code to be more specific. This might be helpful to human reviewers if the profile name doesn't so obviously mark its resource type -- and also potentially allows for more efficient processing if mismatched types can be outright rejected before even getting into the profile definition.

But if I understand @Grahame Grieve correctly, he is saying that for some reason, narrowing Resource to Observation would fail validation of a slice that differentiates on type profile? I don't understand why since it does not affect the set of valid instances at all. Grahame, did I understand you correctly, and if so, can you explain why this is the case?

view this post on Zulip Grahame Grieve (Mar 29 2021 at 21:48):

I'm not sure, the details have slipped from my mind. What's the current state of play?


Last updated: Apr 12 2022 at 19:14 UTC