Stream: implementers
Topic: Matching words in code:text
Paul Lynch (Jun 11 2021 at 17:15):
We would like to be able to match against individual words in code:text, so that a search on code:text=wei would match a display string, "Body weight". @Lloyd McKenzie said today that they way :text is currently described for (for tokens), he thought the search would likely only match at the beginning of the display string, and that agrees with the current HAPI implementation.
This seems like a significant shortcoming, since someone trying to find codes for "weight" will be unlikely to think of typing "Body weight". Could there be some mechanism for requesting matching at the beginning of words, if token :text's definition can't be changed?
Note: I did create FHIR-32673 for this, but at Lloyd's suggestion I am posting here as well.
Grahame Grieve (Jun 11 2021 at 17:55):
the page is inconsistent on this matter. It's certainly not intended to left match only
Yunwei Wang (Jun 11 2021 at 18:05):
I am having the same problem. Since token:text is string search, then I think one option is searching with token:text:contains
For my project, I am considering to create an operation on token so it can search either code or text.
Paul Lynch (Jun 11 2021 at 20:50):
Yunwei Wang said:
so it can search either code or text.
We would like to do that too, though that is a separate issue.
Paul Lynch (Jun 11 2021 at 20:53):
The problem with :contains is that it finds stuff in the middle of word, which almost never what you want. If you are searching for "eight", you don't want "weight". You would end up with a fair amount of noise in the results, especially if you were autocompleting and searching as the user types.
Yunwei Wang (Jun 11 2021 at 23:40):
We decided to use text-based search which is search based on word instead sub-string. I cannot find many details about text-based search in FHIR spec.
Paul Lynch (Jun 12 2021 at 00:06):
@Yunwei Wang How did you do that text-based searching (word matching) on code:text? Do you have a custom FHIR server? What syntax did you use in the query?
Yunwei Wang (Jun 12 2021 at 00:11):
FHIR has two search parameters _content
and _text
for text-based search on resource content and narrative respectively (see http://build.fhir.org/search#content) But these two do not fit our use case which is text-based search on a selected element.
We decide to use the same syntax, such as "lung AND cancer" on our customized search parameter (if we could figure out how to defined a search parameter for text-based search) or customized search operation
Paul Lynch (Jun 12 2021 at 00:15):
Okay. BTW, I just tested Observation?code:text:contains=.... on a HAPI FHIR server and it didn't work. I think modifiers don't modify each other that way, but all modify the search parameter, and :contains is not a modifier for a token parameter.
Last updated: Apr 12 2022 at 19:14 UTC