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

Enhance x-fhir-query to handle fhirpath expression #1658

Closed
maimoonak opened this issue Oct 7, 2022 · 15 comments · Fixed by #1844, #1975 or #2000
Closed

Enhance x-fhir-query to handle fhirpath expression #1658

maimoonak opened this issue Oct 7, 2022 · 15 comments · Fixed by #1844, #1975 or #2000
Assignees
Labels
effort:medium Medium effort - 3 to 5 days P1 High priority issue type:enhancement New feature or request

Comments

@maimoonak
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Enhance x-fhir-query to handle fhirpath expression in query as defined in spec https://build.fhir.org/ig/HL7/sdc/expressions.html#x-fhir-query-enhancements

@jingtang10
Copy link
Collaborator

@maimoonak and @f-odhiambo can you share some use cases and give us an indication of the urgency/priority of this issue?

@jingtang10 jingtang10 added type:enhancement New feature or request P1 High priority issue effort:medium Medium effort - 3 to 5 days labels Oct 17, 2022
@fredhersch
Copy link
Collaborator

@maimoonak If this is an important issue (see Jing's comment), is this one you are interested/able to pick up?

cc: @f-odhiambo @pld

@sevenreup
Copy link

As of current, we are not able to access the context that the x-fhir-query is in. In our use case, we need to be able to access the patient id in the query to only get tasks that the patient owns. For example

Task?code=http://snomed.info/sct|12345678&subject={{Patient.id}}

cc: @KhumboLihonga @Gental-Giant

@Gental-Giant
Copy link

@f-odhiambo We have the above use case

@jingtang10
Copy link
Collaborator

discussed with Khumbo - this is high priority.

@KhumboLihonga
Copy link

@jingtang10 thanks again for taking a look at this. One use case for this is where we want to get a list of active patients with the same organization id as the patient being observed. As per the documentation, I believe the questionnaire would look like this.

@gosso22
Copy link
Contributor

gosso22 commented Feb 24, 2023

Hi @jingtang10 - another use case is for a scenario where you would want to use the information collected by a previous question in the questionnaire. For example we want to be able to select catchment areas based on selected district in the select district question in the questionnaire. When you select a certain district you would populate the drop down list of catchments areas that are part of that district. Below is the expression:

{ "url": "http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-answerExpression", "valueExpression": { "expression": "Location?status=active&partof={{%resource.repeat(item).where(linkId='district' and answer.exists()).answer.value.reference}}", "language": "application/x-fhir-query" } }

@omarismail94
Copy link
Contributor

@KhumboLihonga can you see if you can use enhanced x-fhir-queries now? The PRs merged should allow you to. When setting up the questionnaire fragment, use the setQuestionnaireLaunchContext builder function to pass in the resource you want to evaluate your expressions against

@omarismail94 omarismail94 reopened this Apr 17, 2023
@KhumboLihonga
Copy link

@sevenreup could you please take a look and confirm

@sevenreup
Copy link

@omarismail94 Tested the PR, and it works as intended.
The only thing that I think is missing is the ability to add more than one Resource to the launch context. So currently you can only add one Resource to be accessed in the enhanced x-fhir-queries but we have some use cases that will need access to multiple resources, for example, accessing both the Patient and the Location resource.

@omarismail94
Copy link
Contributor

@sevenreup I was away for the last two weeks. Great to see this works! I can work on a follow-up PR to allow adding multiple resources as part of the context

@sevenreup
Copy link

Okay, thanks @omarismail94 that will be appreciated

@omarismail94
Copy link
Contributor

@sevenreup can you work off the changes I made in PR#2000 to see if that resolves your issue? When setting up the fragment, I changed the API to be setQuestionnaireLaunchContexts (pluralised). It expects an encoded list of all the resources you want to pass

@sevenreup
Copy link

@omarismail94 I managed to test out the PR, It works as intended.
Used a Patient and Encounter as launch contexts and managed to access them in the x-fhir-query.

@omarismail94
Copy link
Contributor

omarismail94 commented May 26, 2023

@sevenreup PR is merged and will be part of the next release of the SDC library. Until that happens, you can fork/cherrypick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort:medium Medium effort - 3 to 5 days P1 High priority issue type:enhancement New feature or request
Projects
Status: Complete
9 participants