Stream: IG creation
Topic: Slicing on a code and an extension value
Jean Duteau (Apr 23 2021 at 21:02):
I want to slice my Questionnaire items based on their type and then, within a type, based on the value of an extension. I think I finally got the definition of my slice discriminator right:
{
"id": "Questionnaire.item",
"path": "Questionnaire.item",
"slicing": {
"discriminator": [
{
"type": "value",
"path": "type"
},
{
"type": "value",
"path": "extension('http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl').value"
}
],
"rules": "closed",
"description": "Slice based on type to restrict the different types of answers allowed."
},
Jean Duteau (Apr 23 2021 at 21:04):
I am getting an error when running the publisher and I think it might be because this discriminator might be doing more than I think it is. I don't want to have to specify the extension on every item, only on those items that have the same type. My 'string', 'text', and 'date' item types don't need the extension, but the 'radio-button', 'check-box', and 'drop-down' choice items do.
Jean Duteau (Apr 23 2021 at 21:08):
Here is the error that I'm getting:
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:372)
at java.base/java.util.ArrayList.get(ArrayList.java:458)
at org.hl7.fhir.r5.utils.FHIRPathEngine.evaluateDefinition(FHIRPathEngine.java:5479)
at org.hl7.fhir.validation.instance.InstanceValidator.getCriteriaForDiscriminator(InstanceValidator.java:2991)
at org.hl7.fhir.validation.instance.InstanceValidator.sliceMatches(InstanceValidator.java:3486)
at org.hl7.fhir.validation.instance.InstanceValidator.matchSlice(InstanceValidator.java:4831)
Jean Duteau (Apr 23 2021 at 21:10):
Here is the definition of my SingleLine slice:
{
"id": "Questionnaire.item:SingleLine",
"path": "Questionnaire.item",
"sliceName": "SingleLine",
"min": 0,
"max": "*"
},
{
"id": "Questionnaire.item:SingleLine.type",
"path": "Questionnaire.item.type",
"patternCode": "string"
},
{
"id": "Questionnaire.item:SingleLine.initial",
"path": "Questionnaire.item.initial",
"max": "1",
"mustSupport": true
},
{
"id": "Questionnaire.item:SingleLine.initial.value[x]",
"path": "Questionnaire.item.initial.value[x]",
"slicing": {
"discriminator": [
{
"type": "type",
"path": "$this"
}
],
"ordered": false,
"rules": "open"
},
"type": [
{
"code": "string"
}
]
},
{
"id": "Questionnaire.item:SingleLine.initial.valueString",
"path": "Questionnaire.item.initial.valueString",
"min": 1,
"max": "1",
"mustSupport": true
},
Jean Duteau (Apr 23 2021 at 21:20):
my question is thus - if you specify a multi-part discriminator, do all parts of the discriminator have to appear in each slice?
Lloyd McKenzie (Apr 23 2021 at 21:22):
They're not supposed to, but it's possible the tooling doesn't handle that in all cases. Are you able to share a trimmed down version of the profile as a test case?
Jean Duteau (Apr 23 2021 at 21:23):
i might be able to. Let me see if I can make a simple two slice profile that fails the same way
Last updated: Apr 12 2022 at 19:14 UTC