FHIR Chat · Slicing problem in BP profile · conformance

Stream: conformance

Topic: Slicing problem in BP profile


view this post on Zulip Grahame Grieve (May 21 2019 at 23:54):

if you look at the snapshot in http://hl7.org/fhir/bp.html, you'll see that Observation.component is sliced with a discriminator which is value:code.coding.code, value:code.coding.system

view this post on Zulip Grahame Grieve (May 21 2019 at 23:55):

but the code.coding is also sliced, by code, and system

view this post on Zulip Grahame Grieve (May 21 2019 at 23:58):

the validator doesn't know how to deal with this - it goes looking for the fixed value for the outer slicing, and runs into the inner slicing.

view this post on Zulip Grahame Grieve (May 22 2019 at 00:03):

it's not clear to me, as I consider how to make the validator work, what the rules are for an element that is in the path of a slicing target that is itself sliced. Do we say that it has to have a 1..1 slice itself that meets the slicing requirements? (this case does)

view this post on Zulip Lloyd McKenzie (May 22 2019 at 00:36):

I think that's reasonable

view this post on Zulip Ewout Kramer (May 22 2019 at 08:44):

What does "Do we say that it has to have a 1..1 slice itself that meets the slicing requirements?" mean?

view this post on Zulip Michel Rutten (May 22 2019 at 09:25):

The outer discriminator specifies to match component slices by inspecting a complex child element (code.coding). The slicing on the child element itself further constraints the list of allowed options for coding.

However the inner slice does not influence the behavior of the outer slice? For all components should still specify a unique combination for { code.coding.code and code.coding.system }.

This suggests that a validator can evaluate the outer slice and match individual components to slices w/o having to inspect the internal slice?

view this post on Zulip Grahame Grieve (May 22 2019 at 12:51):

I don’t know how to ignore the inner slice. I have to iterate it somehow. For now, I can only deal with inner slicing that has a fixed 1..1 slice

view this post on Zulip Chris Grenz (May 29 2019 at 19:54):

Yeah, I'd agree with @Grahame Grieve (I think) - if you slice by value, then the target of that can only be a single, fixed value. In this case, the better option would be to slice component by pattern at code - that would leave the inner slice reasonable.

view this post on Zulip Grahame Grieve (May 29 2019 at 20:09):

well, I deal with it now

view this post on Zulip Chris Grenz (May 29 2019 at 20:12):

How?

view this post on Zulip Grahame Grieve (May 29 2019 at 20:13):

if there's a fixed 1..1 slice, I can deal with it

view this post on Zulip Lloyd McKenzie (May 29 2019 at 20:44):

What about patterns?

view this post on Zulip Simone Heckmann (Aug 08 2019 at 11:58):

I have a similar problem: I want to slice Identifier (by Identifier.type) to check for existence of two distinct types of Identifiers. Both Identifiers are defined as Identifier-Profiles which each have a slicing on Identifier.type to require one specific coding (fixed value) for Identifier.type but leave it open to use alternative codings additionally. The (.NET-)validator doesn't get it...

Here's the profile: https://simplifier.net/Basisprofil-DE-R4/PractitionerDeBasis/~overview
and an example (that doesn't validate): https://simplifier.net/basisprofil-de-r4/practitioner-example/$validate

I would like to understand how to us patterns to fix this....

view this post on Zulip Oliver Egger (Aug 08 2019 at 13:13):

@Simone Heckmann , see http://build.fhir.org/ig/hl7ch/ch-core/StructureDefinition-ch-core-patient.html as an example how to use pattern to slice the identifier on type.

view this post on Zulip Simone Heckmann (Aug 08 2019 at 13:18):

Ok, apparently not the solution for the .NET validator...

NotSupported : Slicing with a discriminator of type 'Pattern' is not yet supported by this validator

Thanks, though!

view this post on Zulip Simone Heckmann (Aug 08 2019 at 14:03):

Maybe if I use Pattern to fix the Identifier.types in the Profiles instead of slicing them...?
What's the semantical difference between
a) slicing Identifier.type.coding by system (unordered, open) and define a 1..1 slice with fixed values for system and code
and
b) define a pattern on Identifier.type.coding with fixed values for system and code

I assume that other than slicing, pattern would still match even if system matched in one slice and code in another...?
Not sure though... I'm still struggling trying to wrap my head around pattern...

view this post on Zulip Simone Heckmann (Aug 08 2019 at 14:07):

But I don't think so. Wouldn't pattern make it even harder for the validator to find the fixed values in the slice...

view this post on Zulip Rob Hausam (Aug 08 2019 at 17:58):

I thought I would give it a try validating with the Java validator, but it needs some additional fhir.de profiles (like http://fhir.de/StructureDefinition/identifier-lanr and http://fhir.de/StructureDefinition/identifier-zanr, etc.). Is there a package?

view this post on Zulip Brian Postlethwaite (Aug 08 2019 at 21:00):

Which version of the dotnet client are you using, I was pretty sure it does pattern.. My fork definitely does it, and I thought that change went into core.

view this post on Zulip Simone Heckmann (Aug 09 2019 at 06:08):

@Rob Hausam I created a package: https://simplifier.net/packages/de.basisprofil.r4/0.9.0

view this post on Zulip Simone Heckmann (Aug 09 2019 at 06:09):

Which version of the dotnet client are you using, I was pretty sure it does pattern.. My fork definitely does it, and I thought that change went into core.

@Brian Postlethwaite I was running the validation on Simplifier. Here's the example: https://simplifier.net/basisprofil-de-r4/practitioner-example
Press the "validate" button and you'll see the resulting error.

view this post on Zulip Simone Heckmann (Aug 09 2019 at 06:09):

oh wait. you can't validate unless you're a project member I suppose...

view this post on Zulip Rob Hausam (Aug 09 2019 at 14:17):

@Simone Heckmann I expanded and re-organized the package a bit and then validated and got this:

RHausamMacbookPro:fhir-ips rhausam$ java -jar ~/Downloads/org.hl7.fhir.validator.jar ~/Downloads/Practitioner-example.xml -ig ~/Downloads/de.basisprofil.r4-0.9.0
FHIR Validation tool Version 3.8.24-SNAPSHOT - Built 2019-08-09T04:44:53.224+10:00 - Git 2a234a81c24f
Arguments: /Users/rhausam/Downloads/Practitioner-example.xml -ig /Users/rhausam/Downloads/de.basisprofil.r4-0.9.0
  .. connect to tx server @ http://tx.fhir.org
  .. definitions from hl7.fhir.core#current
    (v4.0.0)
+  .. load IG from /Users/rhausam/Downloads/de.basisprofil.r4-0.9.0
  .. validate [/Users/rhausam/Downloads/Practitioner-example.xml]
Terminology server: Check for supported code systems for http://fhir.de/CodeSystem/identifier-type-de-basis
Success...validating /Users/rhausam/Downloads/Practitioner-example.xml:  error:0 warn:3 info:0
  Warning @ Practitioner.identifier[0].type (line 7, col11) : None of the codes provided are in the value set http://hl7.org/fhir/ValueSet/identifier-type (http://hl7.org/fhir/ValueSet/identifier-type, and a code should come from this value set unless it has no suitable code) (codes = http://terminology.hl7.org/CodeSystem/v2-0203#LANR)
  Warning @ Practitioner.identifier[1].type (line 17, col11) : None of the codes provided are in the value set http://hl7.org/fhir/ValueSet/identifier-type (http://hl7.org/fhir/ValueSet/identifier-type, and a code should come from this value set unless it has no suitable code) (codes = http://fhir.de/CodeSystem/identifier-type-de-basis#ZANR)
  Warning @ Practitioner.meta.profile[0] (line 2, col43) : StructureDefinition reference "http://fhir.de/StructureDefinition/practitioner-de-basis" could not be resolved

Getting "Success" is nice! :) But the warning that 'StructureDefinition reference "http://fhir.de/StructureDefinition/practitioner-de-basis" could not be resolved' certainly means something isn't right, and I haven't looked at that yet.

view this post on Zulip Simone Heckmann (Aug 09 2019 at 14:25):

The warning about the Type Code is justified! I accidentially used the old STU3 URL (fixed it!)
But I guess the fact that the Profile URL didn't resolve means that your validation just ran the example against the core spec...

view this post on Zulip Rob Hausam (Aug 09 2019 at 14:35):

I assume that's the case. Can try to figure out what the issue is there.

view this post on Zulip Rob Hausam (Aug 09 2019 at 15:21):

I had to explicitly include each profile, rather than the package (not sure why), but this is what I get now:

RHausamMacbookPro:fhir-ips rhausam$ java -jar ~/Downloads/org.hl7.fhir.validator.jar ~/Downloads/Practitioner-example.xml -ig ~/Downloads/de.basisprofil.r4-0.9.0/package/Practitioner-de-basis.json -ig ~/Downloads/de.basisprofil.r4-0.9.0/package/Profile-identifier-lanr.json -ig ~/Downloads/de.basisprofil.r4-0.9.0/package/Profile-identifier-zanr.json
FHIR Validation tool Version 3.8.24-SNAPSHOT - Built 2019-08-09T04:44:53.224+10:00 - Git 2a234a81c24f
Arguments: /Users/rhausam/Downloads/Practitioner-example.xml -ig /Users/rhausam/Downloads/de.basisprofil.r4-0.9.0/package/Practitioner-de-basis.json -ig /Users/rhausam/Downloads/de.basisprofil.r4-0.9.0/package/Profile-identifier-lanr.json -ig /Users/rhausam/Downloads/de.basisprofil.r4-0.9.0/package/Profile-identifier-zanr.json
  .. connect to tx server @ http://tx.fhir.org
  .. definitions from hl7.fhir.core#current
    (v4.0.0)
+  .. load IG from /Users/rhausam/Downloads/de.basisprofil.r4-0.9.0/package/Practitioner-de-basis.json
+  .. load IG from /Users/rhausam/Downloads/de.basisprofil.r4-0.9.0/package/Profile-identifier-lanr.json
+  .. load IG from /Users/rhausam/Downloads/de.basisprofil.r4-0.9.0/package/Profile-identifier-zanr.json
  .. validate [/Users/rhausam/Downloads/Practitioner-example.xml]
Terminology server: Check for supported code systems for http://fhir.de/CodeSystem/identifier-type-de-basis
*FAILURE* validating /Users/rhausam/Downloads/Practitioner-example.xml:  error:4 warn:2 info:2
  Error @ Practitioner.identifier[0] (line 6, col15) : Could not match discriminator ([$this]) for slice Practitioner.identifier:LANR in profile http://fhir.de/StructureDefinition/practitioner-de-basis - the discriminator [$this] does not have fixed value, binding or existence assertions
  Error @ Practitioner.identifier[0] (line 6, col15) : Could not match discriminator ([$this]) for slice Practitioner.identifier:ZANR in profile http://fhir.de/StructureDefinition/practitioner-de-basis - the discriminator [$this] does not have fixed value, binding or existence assertions
  Error @ Practitioner.identifier[1] (line 16, col15) : Could not match discriminator ([$this]) for slice Practitioner.identifier:LANR in profile http://fhir.de/StructureDefinition/practitioner-de-basis - the discriminator [$this] does not have fixed value, binding or existence assertions
  Error @ Practitioner.identifier[1] (line 16, col15) : Could not match discriminator ([$this]) for slice Practitioner.identifier:ZANR in profile http://fhir.de/StructureDefinition/practitioner-de-basis - the discriminator [$this] does not have fixed value, binding or existence assertions
  Information @ Practitioner (line 2, col43) : Profile http://fhir.de/StructureDefinition/practitioner-de-basis, Element 'Practitioner.identifier[LANR]'': Unable to check minimum required (1) due to lack of slicing validation
  Information @ Practitioner (line 2, col43) : Profile http://fhir.de/StructureDefinition/practitioner-de-basis, Element 'Practitioner.identifier[ZANR]'': Unable to check minimum required (1) due to lack of slicing validation
  Warning @ Practitioner.identifier[0].type (line 7, col11) : None of the codes provided are in the value set http://hl7.org/fhir/ValueSet/identifier-type (http://hl7.org/fhir/ValueSet/identifier-type, and a code should come from this value set unless it has no suitable code) (codes = http://terminology.hl7.org/CodeSystem/v2-0203#LANR)
  Warning @ Practitioner.identifier[1].type (line 17, col11) : None of the codes provided are in the value set http://hl7.org/fhir/ValueSet/identifier-type (http://hl7.org/fhir/ValueSet/identifier-type, and a code should come from this value set unless it has no suitable code) (codes = http://fhir.de/CodeSystem/identifier-type-de-basis#ZANR)

Now need to look closer at the discriminators and slice definitions and see what the issues are.

view this post on Zulip Ewout Kramer (Aug 12 2019 at 12:44):

Ok, apparently not the solution for the .NET validator...

NotSupported : Slicing with a discriminator of type 'Pattern' is not yet supported by this validator

Thanks, though!

It does support it, but I had disabled the code for it (by accident). @Brian Postlethwaite corrected that, and it should work again in version 1.3 of the API. Oops ;-)

view this post on Zulip Ewout Kramer (Aug 12 2019 at 12:46):

This is the PR: https://github.com/FirelyTeam/fhir-net-api/pull/995

If you are doing this in your own code, you could upgrade to 1.3 now. I don't know which version is active in Simplifier though. @Martijn Harthoorn knows for sure ;-)

view this post on Zulip Martijn Harthoorn (Aug 14 2019 at 09:31):

Simplifier upgraded to 1.3 last week.

view this post on Zulip Simone Heckmann (Aug 14 2019 at 10:55):

Ok, the "not-supported" error message is gone now, but validation still fails spectacularly.
I will have to investigate further...

view this post on Zulip Rob Hausam (Aug 14 2019 at 20:19):

Yes, I tried going a little further with it and ran into other significant validation errors - mainly related to slicing and the Profile-identifier-lanr and Profile-identifier-zanr profiles. I didn't have time to chase them down more.

view this post on Zulip Simone Heckmann (Aug 15 2019 at 08:00):

Got it:
Solution: remove Identifier.type-slicing in the Coding-Profiles and use pattern instead, slice Identifier by pattern:type instead of pattern:$this.

Thanks to all who helped :thank_you:


Last updated: Apr 12 2022 at 19:14 UTC