FHIR Chat · StructureDefinition with slice on choice · implementers

Stream: implementers

Topic: StructureDefinition with slice on choice


view this post on Zulip Sean McIlvenna (Nov 29 2016 at 18:14):

StructureDefinition/ElementDefinition has this rule about slicing:
"An element with a cardinality of 0..1 and a choice of multiple types can be sliced by type. This is in order to specify different constraints for different types. In this case, the discriminator SHALL be "@type""
Does anyone know any examples of how this is represented?
Ex: Trying to figure out if the element with "slicing" should have a path of "Observation.effective[x]" and a discriminator of "@type". Then does that mean that children of the slice should have a path of "Observation.effective[x].effectiveDateTime"?

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 18:14):

that doesn't seem right to me... but not sure what is

view this post on Zulip Grahame Grieve (Nov 29 2016 at 18:39):

there is an example in US Lab Diagnostic Order

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 18:41):

where is that at? not seeing it under "Examples" of StructureDefinition

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 18:45):

Ok. Maybe I found it... I see this:

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 18:45):

<element>
  <path value="DiagnosticOrder.extension.valueReference"/>
  <short value="Value of extension"/>
  <definition value="Value of extension - may be a resource or one of a constrained set of the data types (see
   Extensibility in the spec for list)."/>
  <min value="1"/>
  <max value="1"/>
  <base>
    <path value="Extension.value[x]"/>
    <min value="0"/>
    <max value="1"/>
  </base>
  <type>
    <code value="Reference"/>
    <profile value="http://hl7.org/fhir/StructureDefinition/uslab-pract"/>
  </type>
  <mustSupport value="true"/>
  <mapping>
    <identity value="rim"/>
    <map value="N/A"/>
  </mapping>
</element>

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 18:45):

But I see nothing about slicing in this example...

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 18:45):

is it just the use of <base> that makes this work?

view this post on Zulip Grahame Grieve (Nov 29 2016 at 18:47):

in the R2 version, you can find @type used as a descriminator

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 18:48):

what about STU3?

view this post on Zulip Grahame Grieve (Nov 29 2016 at 18:53):

STU3 is hard to search because the IGs have been moved out of the spec. I see if on DAF2 condition on onset[x] though

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 19:07):

ok

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 19:07):

I think I see what you're talking about

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 19:07):

having multiple <type> for each type supported

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 19:07):

but that rule about slicing in my first post confuses me then

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 19:07):

it seems to indicate that I should use slicing

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 19:07):

not type

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 19:08):

further-more, how do I say valueCodeableConcept should be bound to a value set

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 19:08):

<type> doesn't seem to include any binding information

view this post on Zulip Grahame Grieve (Nov 29 2016 at 19:11):

that's when you have to slice by @type - so you can make different constraints for different types

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 19:12):

tell me if you think this pseudo structuredefn is correct:

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 19:14):

<element>
<path value="Observation.extension.value[x]" />
<min value="1" />
<max value="2" />
<slicing>
<discriminator value="@type" />
</slicing>
</element>
<element>
<path value="Observation.extension.valueCodeableConcept" />
... bindings ...
</element>

view this post on Zulip Grahame Grieve (Nov 29 2016 at 19:18):

yes I think so

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 19:19):

ok. good enough for me, for now, then

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 19:19):

:)

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 19:20):

wish I knew why zulip code-blocked by first xml, but not the second

view this post on Zulip Sean McIlvenna (Nov 29 2016 at 19:21):

oh... maybe because of the "...bindings..."

view this post on Zulip Eric Haas (Dec 04 2016 at 08:56):

For a slicing example check out http://healthedatainc.com/go-ftp/US-Core/structuredefinition-us-core-observationresults.html. Did it to specify the bindings. Although having tried to use this core profile, I wound up having to reslice which I'd rather avoid. Would creating an invariant to avoid reslicing work here? e.g if type a then bind to A if type b then bind to B.


Last updated: Apr 12 2022 at 19:14 UTC