-
Notifications
You must be signed in to change notification settings - Fork 305
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
Evaluating variables in answerExpressions #2066
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really nice code! @MJ1998
Just some minor comments.
datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt
Outdated
Show resolved
Hide resolved
datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt
Show resolved
Hide resolved
datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt
Outdated
Show resolved
Hide resolved
@MJ1998 this looks good to me, it will be nice to also merge this to master. We can perhaps have this enhancement in future PRs?
|
@jingtang10 kindly review |
datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt
Show resolved
Hide resolved
datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt
Outdated
Show resolved
Hide resolved
datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt
Show resolved
Hide resolved
datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change!
* Add X-FHIR-Query support for variable extension * Add unit tests * Fix dynamic answerExpression based on #2066 * Address review - Use viewModelScope for calculated-expression - Move the runBlocking to QuestionnaireItemViewItem for cqf-expression - Rename questionnaireVariablesMap to questionnaireVariableMap * Makes sure initial value got emitted to the questionnaireStateFlow Notifies the flow which will update the data stream when updateDependentQuestionnaireResponseItems finished running * Notify to not delay the update of UI - updateDependentQuestionnaireResponseItems can evaluate X-FHIR-Query expression which can delay the update of UI for 1-2 seconds depending on the retrieved resource size. - In the case of clicking next page after selecting an answer that shows the next pages based on skip logic (tapping this and that very quickly). We notify the UI pages immediately, then once the X-FHIR-Query expression is processed (1-2 seconds), we notify the UI again. Without this changes, when the user taps next page, the next pages that is supposed to be shown by skip logic will be shown late enough that the user don't see it, but if the user taps previous page button, user will see the shown pages decided by skip logic. And that looks like a bug. * WIP * Adjust code after major merge conflict * spotlessApply * Fix test * Fix test * Integrate suspend functions Related to enable when expressions. * spotlessApply * Add missing xFhirQueryResolver param * Address review * Address review and refactor to use suspend function * Run suspend for Barcode * Address review * Remove hasMissingParamValue Better alternative is to limit the received resource by using the _count common parameter. Example: Patient?name=&_count=2 * Fix test * Update QuestionnaireViewItemTest * Use runTest in QuestionnaireUiEspressoTest * Add missing import to access child of ChipGroup * spotlessApply * Fix test * Add missing coroutine launch * spotlessApply
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Fixes #2052
Description
There are 2 errors:
Solution here is to
xFhirExpressionString
has been constructedAlternative(s) considered
Removing caching of answer options but that makes it slow.
Type
Bug fix | Feature
Screenshots (if applicable)
[Used questionnaire json given in the issue linked]
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.