Stream: IG creation
Topic: How do I slice this to get the behaviour I want?
Jean Duteau (Dec 10 2020 at 01:19):
I'm trying to slice my Questionnaire.items to specify constraints on different types of items. I have constraints on the following "types" of questions that I want to make: Single Line, TextArea, DateTime, RadioGroup, Checkboxes, Dropdowns, Slider, Integer Text. I put "types" because some of these have the same item.type and I use the itemControl extension to differentiate (i.e RadioGroup, Checkboxes, Dropdowns are all type=choice with different itemControl codes).
I wasn't sure how to make a single slice with a discriminator of type + extension(itemControl).value because not every slice would have the extension. Right now, I have an initial slice on type to get SingleLine, TextArea, DateTime, Choices, Integers. I then further slice Choices and Integers on extension(itemControl).value to get the different types of choices and integers.
That gets me the following in my SD:
{
"id": "Questionnaire.item",
"path": "Questionnaire.item",
"slicing": {
"discriminator": [
{
"type": "value",
"path": "type"
}
],
"rules": "closed",
"description": "Slice based on type to restrict the different types of answers allowed."
},
"mustSupport": true
}
{
"id": "Questionnaire.item:Choices",
"path": "Questionnaire.item",
"sliceName": "Choices",
"slicing": {
"discriminator": [
{
"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."
},
"min": 0,
"max": "*"
},
That seems to me that it should give me the behaviour that I want but I'm getting validation errors that don't make sense. With the following item:
{
"extension": [
{
"url": "http://hl7.org/fhir/us/icsr-ae-reporting/StructureDefinition/extension-itemTitle",
"valueString": "Single Line Text"
},
{
"url": "http://hl7.org/fhir/us/icsr-ae-reporting/StructureDefinition/extension-itemSASVariableName",
"valueString": "SLT"
},
{
"url": "http://hl7.org/fhir/us/icsr-ae-reporting/StructureDefinition/extension-itemRequiredText",
"valueMarkdown": "Please answer this"
},
"type": "string",
"linkId": "d635f126-e754-3f5b-2cff-f713a3b2e42d",
"required": true,
"text": "Enter some text",
"initial": [
{
"valueString": "placeholder text"
}
]
},
I'm getting these errors:
Error @ Bundle.entry[1].resource.ofType(Questionnaire).item[0] (line 67, col11) : Profile http://hl7.org/fhir/us/icsr-ae-reporting/StructureDefinition/ibm-fda-shape-questionnaire, Element matches more than one slice - SingleLine, Choices/Checkbox
Error @ Bundle.entry[1].resource.ofType(Questionnaire).item[0] (line 67, col11) : Profile http://hl7.org/fhir/us/icsr-ae-reporting/StructureDefinition/ibm-fda-shape-questionnaire, Element matches more than one slice - SingleLine, Choices/Dropdown
Error @ Bundle.entry[1].resource.ofType(Questionnaire).item[0] (line 67, col11) : Profile http://hl7.org/fhir/us/icsr-ae-reporting/StructureDefinition/ibm-fda-shape-questionnaire, Element matches more than one slice - SingleLine, Choices/RadioGroup
Error @ Bundle.entry[1].resource.ofType(Questionnaire).item[0] (line 67, col11) : Profile http://hl7.org/fhir/us/icsr-ae-reporting/StructureDefinition/ibm-fda-shape-questionnaire, Element matches more than one slice - SingleLine, Integers/Range
Error @ Bundle.entry[1].resource.ofType(Questionnaire).item[0] (line 67, col11) : Profile http://hl7.org/fhir/us/icsr-ae-reporting/StructureDefinition/ibm-fda-shape-questionnaire, Element matches more than one slice - SingleLine, Integers/Slider
And I'm getting similar errors on my other items.
Grahame Grieve (Dec 10 2020 at 01:26):
I'll have to debug this. Is this for ballot?
Jean Duteau (Dec 10 2020 at 01:26):
nope.
Jean Duteau (Dec 10 2020 at 01:26):
i'm adding it to an HL7 guide of mine so that you can take a look if you want.
Grahame Grieve (Dec 10 2020 at 01:27):
I'll look next week
Jean Duteau (Dec 10 2020 at 01:28):
what? you're not going to drop everything to solve my problem?!? how dare you! :)
I was actually hoping that someone less busier than you could help me and tell me what I'm obviously doing wrong ;)
ryan moehrke (Dec 10 2020 at 01:50):
element.slicing should only be for the root element, all the element definitions for the individual slices should have fixedCode or something similar right?
it looks like from your excerpts that you have a slicing definition in both the root element (Questionnaire.item) and the slice (Questionnaire.item:Choices) but no actual definition of any particular slice
But do you want a discriminator that can define a slice based on the combination of questionnaire.item.value and questionnaire.item.extension(itemControl).value? if so my only thought is using patternBackboneElement but I have no idea if you can do that..
Jean Duteau (Dec 10 2020 at 04:11):
You can check out my ICSR guide - fhir-icsr-ae-reporting - to see what I'm trying to do.
Last updated: Apr 12 2022 at 19:14 UTC