FHIR Chat · Needs some help with Slicing on extension. · Profiling Academy - archived

Stream: Profiling Academy - archived

Topic: Needs some help with Slicing on extension.


view this post on Zulip Kristof Taveirne (Jan 19 2021 at 12:11):

Hi,
I'm currently writing my first StructureDefinition but I have some issues grasping the concept of slicing and its application.

I'm profiling an extension of the SDC Questionnaire.
What I want to achieve is that when a Questionnaire item is of type 'boolean' that then there MUST be an itemControl extension with value'check-box'.

So, want to enforce something like this:

"item": [
    {
      "linkId": "/testItem",
      "type": "boolean",
      "extension": [
        {
          "url": "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl",
          "valueCodeableConcept": {
            "coding": [
              {
                "system": "http://hl7.org/fhir/questionnaire-item-control",
                "code": "check-box"
              }
            ]
          }
        }
      ]
    }
  ]

I already have this to enforce the extension itself.

      {
        "id": "Questionnaire.item.extension:itemControl",
        "path": "Questionnaire.item.extension",
        "min": 1,
        "max": 1,
        "type": [
          {
            "code": "Extension",
            "profile": [
              "http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl"
            ]
          }
        ],
      }

But now I want the itemControl value in the extension to be conditional upon the item.type.
I guess I need to slice item.extension somehow and then refer to that slice in a constraint.

All pointers are welcome.

If somebody knows a couple of good tutorial / articles I can read to learn this in depth feel free to share. I'm eager to learn but I find it difficult to find good resources.

Thank you!
Kristof.

view this post on Zulip Richard Townley-O'Neill (Jan 19 2021 at 23:43):

One way is to not use slicing at all and in your profile of Questionnaire define a constraint on Questionnaire.item, something like type=boolean implies extension(http://hl7.org/fhir/StructureDefinition/questionnaire-itemControl).exists().

view this post on Zulip Richard Townley-O'Neill (Jan 19 2021 at 23:44):

To do it with slicing slice item with a discriminator or type.

view this post on Zulip Richard Townley-O'Neill (Jan 19 2021 at 23:48):

Have you seen https://www.hl7.org/fhir/profiling-examples.html ?

view this post on Zulip Richard Townley-O'Neill (Jan 19 2021 at 23:51):

Or https://simplifier.net/guide/profilingacademy/home ?

view this post on Zulip Kristof Taveirne (Jan 20 2021 at 12:28):

Thank you Richard,
I didn't know you could point to a specific extension using that syntax. thank you, this will help me. Indeed looks like I will not need slicing this way.
I've read through those sites, but when you're new to the topic they are a bit too abstract, at least for me. They assume a couple of key insights that apparently I'm still missing. It's a lot to take in :)


Last updated: Apr 12 2022 at 19:14 UTC