FHIR Chat · Validation error for slicing with Exists in derived profile · conformance

Stream: conformance

Topic: Validation error for slicing with Exists in derived profile


view this post on Zulip Morten Ernebjerg (Dec 13 2018 at 10:37):

I am seeing a curious validation error with the latest Java JAR validator when using slicing with an Exists-discriminator in a derived profile:

Here is what I did (working in Forge):
1. Create a new derived profile from the following profile (German base profile for Patient): http://fhir.de/StructureDefinition/patient-de-basis/0.2 . This Profile does not itself slice name field, but it does specify a custom profile for it (viz. http://fhir.de/StructureDefinition/humanname-de-basis/0.2)
2. Slice the namefield, with a discriminator of type "Exists" on period.end
3. Add a slice and in this slice, set the cardinality of period.endto 0..0
4. Validate using the latest Java JAR validator against a Patient example that contains the namefield with only name.given filled in (at least the namefield has to be there)

This gives the following error (despite step 3):

*FAILURE* validating examples\patient-example-minimal.xml:  error:1 warn:0 info:0
  Error @ Patient.name (line 6, col11) : Discriminator (period.end) is based on element existence, but slice Patient.name:sliceName neither sets min>=1 or max=0

Curiously, if I do exactly the same, but base my profile on the standard STU3 Patient resource, it works. Doe slicing in derived field somehow work differently?

view this post on Zulip Ewout Kramer (Dec 18 2018 at 10:13):

I sort of understand the error - does it make sense to have a discriminator on an element that has set it's cardinality to 0..0. It seems the error should say: "but slice ........ EITHER sets min>=1 or max=0" - so maybe I just don't understand what's going on.

That said, the german profile on humanname does not make any changes to the period element, so there should not be changes in behaviour. @Grahame Grieve @Michel Rutten ?

view this post on Zulip Michel Rutten (Dec 18 2018 at 10:29):

Forge helps users to design valid StructureDefinitions, but ultimately verification is left up to the validator. I don't fully understand the warning message from the Java validator...

view this post on Zulip Morten Ernebjerg (Dec 18 2018 at 11:35):

In this case, I am not restricting the cardinality of period.endin general, only in a particular slice where I removed it (0..0). This was based on my understanding that to use the Exists-discriminator, one needs to fix the "existence status" of the corresponding element to either "never" (cardinality = 0) or "always" (cardinality > 1) in slices. But if I read the error message right, it seems to tell me that I failed to do exactly that, which is what confused me.

view this post on Zulip Brian Postlethwaite (Dec 18 2018 at 11:35):

That's constraining to 0..0 could be to validate that this slice isn't to be used.

view this post on Zulip Morten Ernebjerg (Dec 18 2018 at 11:40):

(BTW, the usecase background is that I want to define a slice that picks out a name entry for which(among other properties) no end-date has been specified so that this name is guaranteed to still be valid)

view this post on Zulip Lloyd McKenzie (Dec 18 2018 at 14:59):

If you're using "exists", you expect one slice to be 1..x and one to be 0..0.


Last updated: Apr 12 2022 at 19:14 UTC