FHIR Chat · ValueSet $expand implementation help · implementers

Stream: implementers

Topic: ValueSet $expand implementation help


view this post on Zulip Tim Dunnington (Apr 28 2020 at 18:09):

Hey all, I'm trying to implement the $expand operation properly. For basic value sets it's straightforward, but I ran into an example that I need your clarification/help with. I have read the latest documentation linked to in some of the other discussion topics, and it's not clarifying this issue.

The standard value set for location types is http://hl7.org/fhir/ValueSet/v3-ServiceDeliveryLocationRoleType.

The core of that value set is the following compose block:

      "compose": {
          "include": [
            {
              "system": "http://hl7.org/fhir/v3/RoleCode",
              "filter": [
                {
                  "property": "concept",
                  "op": "is-a",
                  "value": "_ServiceDeliveryLocationRoleType"
                }
              ]
            }
          ],
          "exclude": [
            {
              "system": "http://hl7.org/fhir/v3/RoleCode",
              "concept": [
                {
                  "code": "_ServiceDeliveryLocationRoleType"
                }
              ]
            }
          ]
        }

I'm not clear on how to expand this. _ServiceDeliveryLocationRoleType contains a whole list of child concepts, many of which include their own child concepts, and so on.

So if I process the include rule, and follow the is-a relationship, I would end up with an expansion that had one parent code, _ServiceDeliveryLocationRoleType, and all its descendant concepts.

But then if I then run the exclude rule, wouldn't I end up with an empty expansion (because I just removed the root node of the codes I included)?

view this post on Zulip Lloyd McKenzie (Apr 28 2020 at 18:11):

Removing the root code wouldn't remove any of the descendants

view this post on Zulip Tim Dunnington (Apr 28 2020 at 18:13):

Are you saying that the result of the expansion should be flattened?

view this post on Zulip Yunwei Wang (Apr 28 2020 at 18:14):

expansion is flattened.

view this post on Zulip Tim Dunnington (Apr 28 2020 at 18:15):

Does a flattened expansion exclude abstract codes?

view this post on Zulip Tim Dunnington (Apr 28 2020 at 18:17):

For example, the _ServiceDeliveryLocationType is abstract, and all of its descendants are also abstract codes...you have to go several layers deep to get to an actual (non-abstract) code.

view this post on Zulip Yunwei Wang (Apr 28 2020 at 18:20):

Depends on terminology server. Take a look $expand operation: http://build.fhir.org/valueset-operation-expand.html

view this post on Zulip Lloyd McKenzie (Apr 28 2020 at 18:20):

The notion of 'abstract' is for a particular use - what's abstract in one use-case (e.g. user-selection) might still be concrete for other use-cases (e.g. decision support)

view this post on Zulip Lloyd McKenzie (Apr 28 2020 at 18:21):

So we don't want to make excluding 'abstract' codes a general rule. Also, the notion of 'abstract' is conveyed as a property and isn't necessarily handled in a standard way across code systems.

view this post on Zulip Tim Dunnington (Apr 28 2020 at 18:33):

I found the flattening idea confusing because the ValueSet specification allows for child concepts (ValueSet.expand.contains.contains), and doesn't explicitly state that the expansion should be flattened anywhere that I could find. So I couldn't tell, if the ValueSet.expand.contains itself has a contains, what that means. Does that mean sometimes you can expand and not flatten the list? And if so, when is that the case?

And thank you for answering all my questions here :)

view this post on Zulip Lloyd McKenzie (Apr 28 2020 at 18:42):

The ability to represent hierarchy in an expansion is going to be variable. A value set can constrain out intermediary concepts. It may also draw from multiple code systems and the relationships needed to determine cross-system relationships might not exist

view this post on Zulip Grahame Grieve (Apr 28 2020 at 19:44):

tx.fhir.org will not do a heirarchical value set when you exclude an codes - the value set is always flat in that case, whether the client asks for it to be flat or not.

view this post on Zulip Lin Zhang (Oct 28 2020 at 09:33):

Is there any example to show how to create filters in a code system and use them in relevant valuesets? I'm wondering how to enable expansion of an intensional valueset with a filter (op="in") for ICD-10. For example, I want to create an intensional valueset which includes ICD-10 code A00.0 and all its descendants.

view this post on Zulip Lin Zhang (Oct 28 2020 at 09:37):

Now, I'm still confused although there are separate instructions for creation and usage of filters in CodeSystem and ValueSet, respectively. Any comprehensive tutorial for the whole process consisting of creation and usage of filters? Thanks in advance.

view this post on Zulip Lin Zhang (Oct 28 2020 at 09:40):

filter.codes such as "concept", "code" or "parent" don't work when the filter is used to create valuesets. BTW, HAPI FHIR JPA Server is used.

view this post on Zulip Lin Zhang (Oct 28 2020 at 09:49):

(deleted)


Last updated: Apr 12 2022 at 19:14 UTC