Closed FikriMilano closed 3 months ago
I am reviewing it, thanks!
@santosh-pingle @jingtang10 Can we first merge https://github.com/google/android-fhir/pull/2066, before we merge this PR?
I am anticipating merge conflicts from https://github.com/google/android-fhir/pull/2066, so I pulled from there and integrate it in this PR.
And I would like to ensure that @MJ1998's contribution is duly noted from https://github.com/google/android-fhir/pull/2066.
Todo:
@FikriMilano any update on this PR?
@omarismail94 let me address that tomorrow. Thanks for the follow-up.
@omarismail94
there is a bug in createXFhirQueryFromExpression method.
where if we try to combine both fhirPathsEvaluatedPairs and variablesEvaluatedPairs, then fold the expression to replace the string template into the right evaluated value, the resulting xFhirQuery string gives the wrong result.
that happens because of the same variable name from both fhirPathsEvaluatedPairs and variablesEvaluatedPairs, and the variable from fhirPathsEvaluatedPairs are given first priority over the one from variablesEvaluatedPairs.
the one from fhirPathsEvaluatedPairs are empty, while what we need was from variablesEvaluatedPairs.
the resulting xFhirQuery has a search parameter, but that search parameter value is empty because of this. This will cause the fhirEngine resolver to search all resources of that type mentioned in the xFhirQuery. This can be prevented by using the _count param.
Example:
fhirPathsEvaluatedPairs contains: [{a}, “”] variablesEvaluatedPairs contains: [{a}, “47626”]
Resulting xFhirQuery: Patient?_id= The expected and correct xFhirQuery: Patient?_id=47626
Prevention 1, xFhirQuery: Patient?_count =1&_id= Prevention 2, xFhirQuery: Patient?_id=NOTHING
@FikriMilano
Or what if we replace the value where it exists.
The case where different value exists in both fhirPathsEvaluatedPairs
and variablesEvaluatedPairs
should ideally be considered as incorrect questionnaire authoring ?
Update :-
Case with different values will never arise.
We can prioritize variablesEvaluatedPairs first.
@MJ1998 will also add the filtering as discussed
EDIT: I take that back, this will break the feature where we supposed to replace the variable template with empty string, assuming the evaulated value is an empty string, that happens when the variable we need is from the fhirPathsEvaluatedPairs instead.
@MJ1998 @omarismail94 this is ready for review
Thanks @FikriMilano
A few requests as this is difficult to follow:-
hold up, let me try to use _count, and see whether it can prevent the resolver to search everything, when there are no parameter values supplied
ok, we don't need the hasMissingParamValue. adding the query with the _count param would prevent the resolver to search everything.
Patient?name=&_count=2
@MJ1998 @omarismail94 I've resolved the comments and updated the PR description
@omarismail94
there is a bug in createXFhirQueryFromExpression method.
where if we try to combine both fhirPathsEvaluatedPairs and variablesEvaluatedPairs, then fold the expression to replace the string template into the right evaluated value, the resulting xFhirQuery string gives the wrong result.
that happens because of the same variable name from both fhirPathsEvaluatedPairs and variablesEvaluatedPairs, and the variable from fhirPathsEvaluatedPairs are given first priority over the one from variablesEvaluatedPairs.
the one from fhirPathsEvaluatedPairs are empty, while what we need was from variablesEvaluatedPairs.
the resulting xFhirQuery has a search parameter, but that search parameter value is empty because of this. This will cause the fhirEngine resolver to search all resources of that type mentioned in the xFhirQuery. This can be prevented by using the _count param.
Example:
fhirPathsEvaluatedPairs contains: [{a}, “”] variablesEvaluatedPairs contains: [{a}, “47626”]
Resulting xFhirQuery: Patient?_id= The expected and correct xFhirQuery: Patient?_id=47626
Prevention 1, xFhirQuery: Patient?_count =1&_id= Prevention 2, xFhirQuery: Patient?_id=NOTHING
@FikriMilano can you create an issue here?
@omarismail94 there is a bug in createXFhirQueryFromExpression method. where if we try to combine both fhirPathsEvaluatedPairs and variablesEvaluatedPairs, then fold the expression to replace the string template into the right evaluated value, the resulting xFhirQuery string gives the wrong result. that happens because of the same variable name from both fhirPathsEvaluatedPairs and variablesEvaluatedPairs, and the variable from fhirPathsEvaluatedPairs are given first priority over the one from variablesEvaluatedPairs. the one from fhirPathsEvaluatedPairs are empty, while what we need was from variablesEvaluatedPairs. the resulting xFhirQuery has a search parameter, but that search parameter value is empty because of this. This will cause the fhirEngine resolver to search all resources of that type mentioned in the xFhirQuery. This can be prevented by using the _count param. Example: fhirPathsEvaluatedPairs contains: [{a}, “”] variablesEvaluatedPairs contains: [{a}, “47626”] Resulting xFhirQuery: Patient?_id= The expected and correct xFhirQuery: Patient?_id=47626 Prevention 1, xFhirQuery: Patient?_count =1&_id= Prevention 2, xFhirQuery: Patient?_id=NOTHING
@FikriMilano can you create an issue here?
here's the ticket https://github.com/google/android-fhir/issues/2451
@jingtang10 this PR is ready to merge
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Fixes #2075
Description
Alternative(s) considered N/A
Type Feature
Screenshots (if applicable)
Checklist
./gradlew spotlessApply
and./gradlew spotlessCheck
to check my code follows the style guide of this project../gradlew check
and./gradlew connectedCheck
to test my changes locally.