FHIR Chat · Filter for "only leaves" in hierarchical CS · terminology

Stream: terminology

Topic: Filter for "only leaves" in hierarchical CS


view this post on Zulip Simone Heckmann (Jul 13 2020 at 07:26):

I need some help from the terminology experts :smile:
How do I define a filter to create a ValueSet expansion on a hierarchichal CodeSystem, that only contains the leaves (aka only concepts that have no child concept)...?

view this post on Zulip Michael Lawley (Jul 13 2020 at 07:47):

You could use a filter on 'child' with operator exists and value false

view this post on Zulip Simone Heckmann (Jul 13 2020 at 08:10):

Ooof. It's so obvious!
I must have been looking through the operator codes without seeing the "exists" value :face_palm:
...need more coffee...
Thanks!

view this post on Zulip Simone Heckmann (Jul 13 2020 at 08:22):

But hold on.
Are filters not machine readable? I'd have expected a FHIRPath expression somewhere in there...

So in my case the filter would be something like

<filter>
   <code value="has-no-children"/>
  <description value="allows selection of concepts without child concepts"/>
  <operator value="exists"/>
  <value value="false"/>
<filter>

But the information that this needs to be applied to the CodeSystem.concept.descentants().concept path is not part of the filter definition? Is that correct? How would the system know how to use the filter? Is that just business logic?

view this post on Zulip Simone Heckmann (Jul 13 2020 at 08:25):

The other thing I don't understand:
Why am I required to fix the value of the filter in the CodeSystem, when the ValueSet has the option to apply a value to the filter...?
In the above example I would have expected to be able to just say the filter "checks for child concepts" and leave it to the valueset using the filter to decide whether the value should be true or false...

view this post on Zulip Grahame Grieve (Jul 13 2020 at 08:46):

I don't understand that response. The code system defines what filters you can use, and the value set uses them. Michael was proposing a value set filter

view this post on Zulip Simone Heckmann (Jul 13 2020 at 09:35):

But the ValueSet filter can use either a property or a filter of the CodeSystem, since child concept is not a property, i assumed I needed to define a filter on the CodeSystem first, before a ValueSet can use it, no?

view this post on Zulip Michael Lawley (Jul 13 2020 at 10:17):

All properties also manifest as filters

view this post on Zulip Michael Lawley (Jul 13 2020 at 10:18):

parent and child are well-known properties defined implicitly for any CodeSystem with hierarchy and thus also available as filters.

view this post on Zulip Michael Lawley (Jul 13 2020 at 10:19):

You would thus use them in the ValueSet definition.

view this post on Zulip Simone Heckmann (Jul 13 2020 at 11:26):

Ok, so no Filter definition needed on the CodeSystem?
Is this correct for the ValueSet filter?

<filter>
  <code value="concept"/>
  <op value="exists"/>
  <value value="false"/>
<filter>

And the Terminology server would know that the code "concept" refers to the child element concept of CodeSystem.concept?
This seems a bit "magical" to me... But it makes sense that the default path for every property and filter would always be CodeSystem.concept...

view this post on Zulip Michael Lawley (Jul 13 2020 at 11:29):

The value for code would be child: '<code value="child" />'

view this post on Zulip Michael Lawley (Jul 13 2020 at 11:30):

It's saying match a concept if the concept's child property does not exist.

view this post on Zulip Michael Lawley (Jul 13 2020 at 11:31):

I think you're getting tripped up thinking about Fhirpath - there is no fhirpath here

view this post on Zulip Michael Lawley (Jul 13 2020 at 11:42):

But yes. The filters are applied relative to each concept, and the filter that references the concept itself is 'concept' (rather than say 'self' or 'this').

view this post on Zulip Simone Heckmann (Jul 13 2020 at 11:50):

Where is defined what "child" means...?I feel like I'm missing something...
It's not an element, nor a SearchParameter. How can it be "well known"?

view this post on Zulip Simone Heckmann (Jul 13 2020 at 11:51):

Oh is it this http://hl7.org/fhir/concept-properties#child : code
in http://hl7.org/fhir/codesystem.html#status !?

view this post on Zulip Simone Heckmann (Jul 13 2020 at 11:52):

Oh well. It's obvious, if you know what you're looking for :smirk:

view this post on Zulip Simone Heckmann (Jul 13 2020 at 11:54):

I somehow didn't expect that bit of information under the "Status" heading :laughing:
I actually found it by using a full text search on "child" on that page...

view this post on Zulip Peter Jordan (Jul 13 2020 at 22:29):

@Michael Lawley perhaps we might have a discussion on searching for leaf nodes in tomorrow's SNOMED on FHIR call?

view this post on Zulip Grahame Grieve (Jul 13 2020 at 22:32):

it's on my agenda to clarify the use of properties in general, and specifically for filters, in R5

view this post on Zulip Michael Lawley (Jul 14 2020 at 01:41):

Yes, http://hl7.org/fhir/codesystem.html#properties should really mention the standard / well-known properties and filters.
I wonder whether there should also be some kind of (extensible) binding for CodeSystem.property.code etc to further document this?

view this post on Zulip Michael Lawley (Jul 14 2020 at 01:42):

Re leaf nodes and SNOMED, sure. Because of SNOMED's ECL there are other ways to express this too.

view this post on Zulip Michael Lawley (Jul 14 2020 at 01:44):

I'll note also that this example is badly out of date http://hl7.org/fhir/codesystem-snomedct.html -- the property code values are wrong


Last updated: Apr 12 2022 at 19:14 UTC