FHIR Chat · nested slices and validation · implementers

Stream: implementers

Topic: nested slices and validation


view this post on Zulip Eric Haas (Feb 23 2018 at 05:05):

working on the vitals profile and replacing some invariant with slicing and discovering that the nested slices like in this profile

cause the following error when validating instances...
"Error in discriminator at Observation.component:foo2.code.coding: slicing found"

so is this a limitation of slicing or of the validator?

my goal is have at one coding in one component to contain a code.

view this post on Zulip Eric Haas (Feb 23 2018 at 17:50):

also one category to contain one coding with a fixed code and system for Obs.category

@Lloyd McKenzie or @Grahame Grieve looking at past posts I'm guessing is not prohibited and is a validation issue.

view this post on Zulip Lloyd McKenzie (Feb 23 2018 at 17:55):

Without seeing the spreadsheet, it's hard to know what you're doing.

view this post on Zulip Eric Haas (Feb 24 2018 at 00:32):

here you go and thanks ( this is not the vitals profile , but a simplified version to test it out in ig-pub - gets same errors)Screen-Shot-2018-02-23-at-4.30.10-PM.png

view this post on Zulip Eric Haas (Feb 24 2018 at 00:33):

slice foo1 is nested under slice foo , and slice foo4 is nested under slicefoo4 (should be slice foo3 and slice foo4 in the image above)

view this post on Zulip Lloyd McKenzie (Feb 24 2018 at 01:04):

Why not slice by pattern? Then you can specify a pattern on the coding and be done (and you can include the code system too - slicing by code alone is not safe)

view this post on Zulip Eric Haas (Feb 24 2018 at 01:12):

well I simplified it and did not include system - my reason for not using pattern is easier to read this way.

view this post on Zulip Eric Haas (Feb 24 2018 at 01:12):

and I think easier to reslice

view this post on Zulip Eric Haas (Feb 24 2018 at 01:13):

but my question really is whether you can nest a slice like this or not.

view this post on Zulip Eric Haas (Feb 24 2018 at 01:15):

if yes then whether the validator should handle that - at least one layer deep

unless I am way off base I think this is common case:

  • at least one code value pair needs to exist in a coding in a repeating element of type CodeableConcept - like Obs,category

view this post on Zulip Lloyd McKenzie (Feb 24 2018 at 01:16):

I have nested slices like that before. However, I've had some issues with doing it in spreadsheets.

view this post on Zulip Lloyd McKenzie (Feb 24 2018 at 01:16):

I don't remember the specifics though.

view this post on Zulip Lloyd McKenzie (Feb 24 2018 at 01:16):

I went to patterns because it was cleaner.

view this post on Zulip Eric Haas (Feb 24 2018 at 01:17):

k

but I have to use the spreadsheet for the build right

view this post on Zulip Eric Haas (Feb 24 2018 at 01:18):

and your profile instances validated using the build or ig validator?

view this post on Zulip Eric Haas (Feb 24 2018 at 01:20):

I guess I'll use patterns. I can pattern a coding but had no success patterning a CodeabeConcept. Can you send me an example

view this post on Zulip Eric Haas (Feb 24 2018 at 01:20):

pattern

view this post on Zulip Lloyd McKenzie (Feb 24 2018 at 01:22):

pasted image

view this post on Zulip Eric Haas (Feb 24 2018 at 01:26):

ty

view this post on Zulip Rob Hausam (Feb 24 2018 at 02:33):

Can you point me to where there is documentation (presuming that there is some) and I can get up to date on the details for slicing by pattern? I haven't done that, but I believe it's what I'm going to be needing to do. I appreciate the image from Lloyd, but I don't think that's enough to be comfortable with how it works and how to do it.

view this post on Zulip Lloyd McKenzie (Feb 24 2018 at 02:37):

If you're slicing by pattern, in the slicing path you declare the path to the note that will have a pattern and say "@pattern". In the slices, for those nodes, you fill in the pattern element with the pattern that needs to be matched by nodes. The patterns need to be mutually exclusive across all of the declared slices.

view this post on Zulip Rob Hausam (Feb 24 2018 at 02:40):

OK, that seems to make sense. And if I look at an example I think that should make it clear. Thanks.

view this post on Zulip Eric Haas (Feb 25 2018 at 21:33):

OK so the patterns didn't validate either and I can't get over how opaque they look. I don't need to publish as a spreadsheet in the build so that is not the issue - but in XML doesn't work either. Here is what I want. One code to be "foo" in one instance of one coding in category.

but still getting the instance vaildation error (in Ig-publisher but assuming will be same in the build.) " Error in discriminator at Observation.category:foo.coding: slicing found"

my question is again is this an issue with my slicing or an issue with the validation getting stuck on a nested slice.

here is the xml

  <differential>
    <element id="Observation">
      <path value="Observation"/>
      <definition value="This is a simple example Template."/>
      <mustSupport value="false"/>
      <isModifier value="false"/>
    </element>
    <element id="Observation.category">
      <path value="Observation.category"/>
      <slicing>
        <discriminator>
          <type value="value"/>
          <path value="coding.code"/>
        </discriminator>
        <rules value="open"/>
      </slicing>
      <min value="1"/>
      <max value="*"/>
      <type>
        <code value="CodeableConcept"/>
      </type>

    </element>
    <element id="Observation.category:foo">
      <path value="Observation.category"/>
      <sliceName value="foo"/>
      <min value="1"/>
      <max value="1"/>
      <type>
        <code value="CodeableConcept"/>
      </type>
    </element>
    <element id="Observation.category:foo.coding">
      <path value="Observation.category.coding"/>
      <slicing>
        <discriminator>
          <type value="value"/>
          <path value="code"/>
        </discriminator>
        <rules value="open"/>
      </slicing
      <type>
        <code value="Coding"/>
      </type>
    </element>
    <element id="Observation.category:foo.coding:foo1">
      <path value="Observation.category.coding"/>
      <sliceName value="foo1"/>
      <min value="1"/>
      <max value="1"/>
      <type>
        <code value="Coding"/>
      </type>

    </element>
    <element id="Observation.category:foo.coding:foo1.code">
      <path value="Observation.category.coding.code"/>
      <min value="1"/>
      <max value="1"/>
      <type>
        <code value="code"/>
      </type>
      <fixedCode value="81260-2"/>
    </element>
  </differential>
</StructureDefinition>

view this post on Zulip Lloyd McKenzie (Feb 25 2018 at 22:28):

That should work. Though you really need to include 'system' too.

view this post on Zulip Eric Haas (Feb 26 2018 at 16:36):

Well yes if this worked then I would add system to ... i am trying to debug why is not working.


Last updated: Apr 12 2022 at 19:14 UTC