[BUG] Fhirpath treats `not-equal-to` operation as `equal-to`
Closed this issue · 1 comments
Describe the bug
It seems that fhirpath doesn't work correctly for equality !=
operation. I use it JUTE mappings.
Severity
Steps to reproduce the behavior:
POST /Mapping/$debug
mapping:
body:
$let:
answerLinkId: $ fhirpath("QuestionnaireResponse.repeat(item).where(linkId!='next-informative-message-question').where(answer).linkId").0
patient: $ fhirpath("QuestionnaireResponse.subject")
$body:
type: transaction
entry:
- request:
url: /ChatSuggestionHistory
method: POST
resource:
patient: $ patient
suggestion: $ answerLinkId
derivedFrom:
id: $ fhirpath("QuestionnaireResponse.id")
resourceType: QuestionnaireResponse
resourceType: ChatSuggestionHistory
id: informative-message-extract
resourceType: Mapping
scope:
item:
- answer:
- value:
string: informative-message-workout
linkId: next-informative-message-question
- text: >-
The air quality isn't great right now.
linkId: informative-message-air-pollution
- text: >-
Yeah to you! It looks like you are doing a great job working out.
answer:
- value:
Coding:
code: acknowledge
system: https://api.juli.co/code-systems/informative-message
display: Got it
linkId: informative-message-workout
status: completed
subject:
id: 66b00713-81a1-45f0-96c9-7896b17aade6
resourceType: Patient
questionnaire: informative-message
resourceType: QuestionnaireResponse
The result I get is below. Take a look at suggestion
field, it should contain the result of this expression $ fhirpath("QuestionnaireResponse.repeat(item).where(linkId!='next-informative-message-question').where(answer).linkId").0
.
And it does, but the result is wrong because I use !=
operation in where
clause, but it seems that it treats it as =
.
type: transaction
entry:
- request:
url: /ChatSuggestionHistory
method: POST
resource:
patient:
id: 66b00713-81a1-45f0-96c9-7896b17aade6
resourceType: Patient
suggestion: next-informative-message-question
derivedFrom:
id: >-
[281e353d-33ee-4c48-a7cb-c936da905b2b](http://localhost:8080/ui/console#/rest?req=GET%20/QuestionnaireResponse/281e353d-33ee-4c48-a7cb-c936da905b2b)
resourceType: QuestionnaireResponse
resourceType: ChatSuggestionHistory
Expected behavior
I should get informative-message-workout
in suggestion
field because it matches the fhirpath request.
Versions:
- Aidbox image version: 2202
But I see that https://github.com/HealthSamurai/fhirpath.clj library haven't updated for a long time.
Additional context
I tested this fhirpath expression using fhirparth.js (https://hl7.github.io/fhirpath.js/) and fhirpath-py and it works correctly.
Not-equal operator behavior is now fixed in the most recent :edge version of Aidbox.