Closed maimoonak closed 1 year ago
@maimoonak and @f-odhiambo can you share some use cases and give us an indication of the urgency/priority of this issue?
@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
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
@f-odhiambo We have the above use case
discussed with Khumbo - this is high priority.
@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.
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" } }
@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
@sevenreup could you please take a look and confirm
@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.
@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
Okay, thanks @omarismail94 that will be appreciated
@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
@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.
@sevenreup PR is merged and will be part of the next release of the SDC library. Until that happens, you can fork/cherrypick
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