Stream: IG creation
Topic: Identifying a slice by pattern
Richard Townley-O'Neill (Feb 26 2020 at 04:33):
I have a Fetal Movement profile that slices (STU3) Observation.code.coding by value:system and pattern:code.
When I identify a slice FetalMovementsSNOMED-CT using fixed values in the discriminator it works fine.
{ "id": "Observation.code.coding:FetalMovementsSNOMED-CT", "path": "Observation.code.coding", "sliceName": "FetalMovementsSNOMED-CT", "min": 1, "max": "1" }, { "id": "Observation.code.coding:FetalMovementsSNOMED-CT.system", "path": "Observation.code.coding.system", "min": 1, "fixedUri": "http://snomed.info/sct" }, { "id": "Observation.code.coding:FetalMovementsSNOMED-CT.code", "path": "Observation.code.coding.code", "min": 1, "fixedCode": "364617005" },
Richard Townley-O'Neill (Feb 26 2020 at 04:35):
We would like to identify slices using patternCoding.
{ "id": "Observation.code.coding:FetalMovementsSNOMED-CT", "path": "Observation.code.coding", "sliceName": "FetalMovementsSNOMED-CT", "min": 1, "max": "1", "patternCoding": { "system": "http://snomed.info/sct", "code": "364617005" } },
But the validator does not recognise the slice.
Could not match any discriminators ([system, code]) for slice Observation.code.coding:FetalMovementsSNOMED-CT in profile http://hl7.org.au/fhir/ch/v1/StructureDefinition/ncdhc-observation-fetal-movement - None of the discriminator [system, code] have fixed value, binding or existence assertions
Richard Townley-O'Neill (Feb 26 2020 at 04:38):
Though the IGpublisher produces a differential table that recognises system and code as 1..1 with fixed values.
image.png
Lloyd McKenzie (Feb 26 2020 at 04:39):
If you're slicing by pattern, the discriminator should just be coding - no need for both system and code as both would be covered by the pattern
Richard Townley-O'Neill (Feb 26 2020 at 04:47):
(deleted)
Richard Townley-O'Neill (Feb 26 2020 at 04:49):
We are slicing Observation.code.coding, not Observation.code
Richard Townley-O'Neill (Feb 26 2020 at 04:51):
{ "id": "Observation.code.coding", "path": "Observation.code.coding", "slicing": { "discriminator": [ { "type": "value", "path": "system" }, { "type": "pattern", "path": "code" } ], "rules": "closed" } },
Richard Townley-O'Neill (Feb 26 2020 at 04:53):
Observation.code is 1..1, so it cannot be sliced by coding.
Lloyd McKenzie (Feb 26 2020 at 04:55):
But why are you declaring two discriminators? Why not:
"slicing": {
"discriminator": [
{
"type": "pattern"
"path": "$this"
}
]
}
Lloyd McKenzie (Feb 26 2020 at 04:56):
And then just declare patterns on the codings for your slices?
Richard Townley-O'Neill (Feb 26 2020 at 04:56):
I did not know that was an option.
Richard Townley-O'Neill (Feb 26 2020 at 04:58):
Thanks. I'll investigate that option.
Richard Townley-O'Neill (Feb 26 2020 at 05:07):
That replaces the old error (Could not match any discriminators ...) with
Unsupported fixed pattern type for discriminator($this) for slice Observation.code.coding:FetalMovementsSNOMED-CT: org.hl7.fhir.r5.model.Coding
Lloyd McKenzie (Feb 26 2020 at 05:10):
That's very weird. @Grahame Grieve ?
Rob Hausam (Feb 26 2020 at 20:44):
I ran into exactly the same thing a few days ago. Apparently pattern is not currently supported with the Coding data type (fixed value constraints are also not supported for Coding, but pattern is what I was looking for). I had to constrain Coding.system and Coding.code in order to get it to work.
Shovan Roy (Feb 26 2020 at 23:14):
I did the same thing as @Rob Hausam all of our profiles (except vital sings) are following pattern and we are living with this work around. http://build.fhir.org/ig/hl7au/au-fhir-childhealth/profiles.html
Grahame Grieve (Feb 26 2020 at 23:53):
pattern is not currently supported with the Coding data type
what happens if you try?
Rob Hausam (Feb 26 2020 at 23:55):
You get the Unsupported fixed pattern type for discriminator
error that @Richard Townley-O'Neill reported.
Grahame Grieve (Feb 26 2020 at 23:58):
Does someone want to contribute a test case?that would be:
- a profile based of R4 base resource that defines a pattern with a Coding based discriminator
- an instance that conforms to the profile
- an instance that doesn't conform to the profile
Rob Hausam (Feb 26 2020 at 23:59):
or a similar error message (I could try to reproduce it again on my end if needed)
Grahame Grieve (Feb 27 2020 at 00:00):
that's the error. I found it and will fix it for next release if someone provides test cases
Shovan Roy (Feb 27 2020 at 00:01):
I or @Richard Townley-O'Neill will get you the test cases
Rob Hausam (Feb 27 2020 at 00:01):
sure - I'll try to find some time tonight to do it (unless someone else is able to do it first)
Rob Hausam (Feb 27 2020 at 00:01):
one of us should be able to
Shovan Roy (Feb 27 2020 at 00:37):
Hi @Grahame Grieve ,
Please see the two Profiles and the examples as provided below:
--Failing with Pattern--
For http://build.fhir.org/ig/hl7au/au-fhir-childhealth/branches/master/StructureDefinition-ncdhc-observation-urinalysis-protein.html , we have slice discriminator on pattern = code the sample is failing with error:
"Could not match discriminator ([code]) for slice Observation.code.coding:Urinalysis-SNOMED-CT in profile http://hl7.org.au/fhir/ch/v1/StructureDefinition/ncdhc-observation-urinalysis-protein - the discriminator [code] does not have fixed value, binding or existence assertions"
here is the link for the sample: http://build.fhir.org/ig/hl7au/au-fhir-childhealth/branches/master/ncdhc-observation-urinalysis-protein-example.html
--Working with Pattern (with workaround)--
As @Richard Townley-O'Neill mentioned in this discussion thread, For http://build.fhir.org/ig/hl7au/au-fhir-childhealth/branches/master/StructureDefinition-ncdhc-observation-fetal-movement.html we have slice discriminator on pattern = code and value=system, the sample is working.
here is the sample: http://build.fhir.org/ig/hl7au/au-fhir-childhealth/branches/master/ncdhc-observation-fetal-movement-example.html
Here is the link for QA page : http://build.fhir.org/ig/hl7au/au-fhir-childhealth/branches/master/qa.html
@Rob Hausam, fyi.. on profile/samples we are using
Grahame Grieve (Feb 27 2020 at 12:17):
ok.. fixed next release
Grahame Grieve (Feb 27 2020 at 12:17):
thanks.
Grahame Grieve (Feb 27 2020 at 13:00):
btw i had to hack the profile - check the test cases at https://github.com/FHIR/fhir-test-cases/commit/1d95524a886c2704ebdc6dd4361634a35a4626f8
Shovan Roy (Feb 27 2020 at 20:32):
Thanks @Grahame Grieve I can see that you are using pattern = $this as the discriminator, we will apply this to our profiles once the fix is published. Did I miss anything else?
Richard Townley-O'Neill (Feb 27 2020 at 23:33):
In commit 1d95524a886c2704ebdc6dd4361634a35a4626f8
validator/profile-slicing-coding-bad.json and validator/profile-slicing-coding-good.json have the same value for Observation.id
Grahame Grieve (Feb 28 2020 at 00:20):
it does. doesn't really matter but I'll fix it
Richard Townley-O'Neill (Feb 28 2020 at 00:22):
:+1:
I feared that unique ids were important to validation.
Shovan Roy (Mar 01 2020 at 22:17):
I took the latest IG Publisher, I can see the slicing with 'patern=$this' is coming out nicely. thanks @Grahame Grieve
image.png
Last updated: Apr 12 2022 at 19:14 UTC