Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested polymorphic item support #33

Closed
autark opened this issue Jan 10, 2020 · 3 comments
Closed

Nested polymorphic item support #33

autark opened this issue Jan 10, 2020 · 3 comments

Comments

@autark
Copy link

autark commented Jan 10, 2020

I was trying to apply the new polymorphic item support (using v1.0.0) to a resource of type QuestionnaireResponse. While it seems to be possible to query the polymorhpic value[x] nodes located at the root level using just value, nested nodes seems to require one to explicitly write out the value type, eg. valueString.

At root level, answer.value seems to work as expected:

$ node fhirpath -f questionnaireResponse.txt -m stu3 -e "QuestionnaireResponse.item[0].answer.value"
fhirpath(QuestionnaireResponse.item[0].answer.value) =>
[
 "Red"
]

But trying to fetch answers for nested items gives no result:

$ node fhirpath -f questionnaireResponse.txt -m stu3 -e "QuestionnaireResponse.item[0].item[0].answer.value"
fhirpath(QuestionnaireResponse.item[0].item[0].answer.value) =>
[]

$ node fhirpath -f questionnaireResponse.txt -m stu3 -e "QuestionnaireResponse.item[0].answer.item[0].answer.value"
fhirpath(QuestionnaireResponse.item[0].answer.item[0].answer.value) =>
[]

Querying using the specific value type works:

$ node fhirpath -f questionnaireResponse.txt -m stu3 -e "QuestionnaireResponse.item[0].item[0].answer.valueString"
fhirpath(QuestionnaireResponse.item[0].item[0].answer.valueString) =>
[
 "Blue"
]

Also, using some functions seems to throw it off, f.ex. while this works:

$ node fhirpath -f questionnaireResponse.txt -m stu3 -e "QuestionnaireResponse.item.where(linkId='1').answer.value"
fhirpath(QuestionnaireResponse.item.where(linkId='1').answer.value) =>
[
 "Red"
]

a similar query like the following doesn't even though the node is at the root level:

$ node fhirpath -f questionnaireResponse.txt -m stu3 -e "QuestionnaireResponse.descendants().where(linkId='1').answer.value"
fhirpath(QuestionnaireResponse.descendants().where(linkId='1').answer.value) =>
[]

questionnaireResponse.txt

@plynchnlm
Copy link
Collaborator

Thanks for the report. I did not consider recursive definitions (item.item and item.answer.item) in my implementation. I will have to find a way to handle that.

I am not sure offhand why the path with "descendants()" is failing, but I will look into that too.

@niquola
Copy link
Collaborator

niquola commented Jan 10, 2020

The root of the problem - fhir-fuel/fhir-fuel.github.io#2
We should fix it in FHIR JSON representation!

@plynchnlm
Copy link
Collaborator

Fixed in 1.0.1.

yuriy-sedinkin added a commit that referenced this issue Jan 11, 2022
…for-context-variables to master

* commit '3a0b432cda764d6c9a7f66ce8b6eebe879b4b2b8':
  Fixed issues found during review
  Updated type annotations
  Storing the path for the data extracted from a resource
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants