-
Notifications
You must be signed in to change notification settings - Fork 293
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
Support evaluation of variables, launchContext and other FHIR contexts for cqf-calculatedValue expressions #2326
Support evaluation of variables, launchContext and other FHIR contexts for cqf-calculatedValue expressions #2326
Conversation
b6d50ed
to
859a1be
Compare
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.
Instead of changing the original questionnaire's extensions, we can resolve the min and max values on-fly, ie, when creating the QuestionnaireViewItem instance.
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/QuestionnaireViewModel.kt
Outdated
Show resolved
Hide resolved
datacapture/src/main/java/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt
Outdated
Show resolved
Hide resolved
to add support for variable expressions, launchContexts and %resource expressions
79fdbe7
to
3e9a620
Compare
datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreTypes.kt
Outdated
Show resolved
Hide resolved
datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreTypes.kt
Outdated
Show resolved
Hide resolved
datacapture/src/main/java/com/google/android/fhir/datacapture/extensions/MoreTypes.kt
Show resolved
Hide resolved
...c/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt
Outdated
Show resolved
Hide resolved
...c/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt
Outdated
Show resolved
Hide resolved
...c/main/java/com/google/android/fhir/datacapture/validation/QuestionnaireResponseValidator.kt
Outdated
Show resolved
Hide resolved
datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt
Outdated
Show resolved
Hide resolved
…r-cqf-expressions
When evaluating cqf-calculatedValue expression for validation
a49d803
to
3cd10dc
Compare
…r-cqf-expressions
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.
Its a little difficult to follow the changes.
Can you please update the description with major changes in this PR that supports the said feature ? Thanks.
...apture/src/test/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluatorTest.kt
Outdated
Show resolved
Hide resolved
...t/java/com/google/android/fhir/datacapture/extensions/MoreQuestionnaireItemComponentsTest.kt
Outdated
Show resolved
Hide resolved
datacapture/src/test/java/com/google/android/fhir/datacapture/QuestionnaireViewModelTest.kt
Outdated
Show resolved
Hide resolved
datacapture/src/test/java/com/google/android/fhir/datacapture/QuestionnaireViewModelTest.kt
Show resolved
Hide resolved
datacapture/src/test/java/com/google/android/fhir/datacapture/QuestionnaireViewModelTest.kt
Outdated
Show resolved
Hide resolved
datacapture/src/test/java/com/google/android/fhir/datacapture/QuestionnaireViewModelTest.kt
Outdated
Show resolved
Hide resolved
datacapture/src/test/java/com/google/android/fhir/datacapture/QuestionnaireViewModelTest.kt
Outdated
Show resolved
Hide resolved
datacapture/src/test/java/com/google/android/fhir/datacapture/QuestionnaireViewModelTest.kt
Outdated
Show resolved
Hide resolved
datacapture/src/test/java/com/google/android/fhir/datacapture/QuestionnaireViewModelTest.kt
Outdated
Show resolved
Hide resolved
datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt
Outdated
Show resolved
Hide resolved
@LZRS please address the above comments by replying and resolving them. just so that it's clear when everything's been addressed. thanks! |
can you resolve the merge conflicts |
I've updated the description of the PR, describing some of the changes included in the PR. You could give it another look |
d7dd15f
to
6eeca2c
Compare
thanks! will take a look shortly. in the future please also reply to comments you've addressed if you've addressed them and resolve them. |
Thank you! Noted |
datacapture/src/main/java/com/google/android/fhir/datacapture/QuestionnaireViewModel.kt
Outdated
Show resolved
Hide resolved
...in/java/com/google/android/fhir/datacapture/validation/AnswerExtensionConstraintValidator.kt
Outdated
Show resolved
Hide resolved
datacapture/src/main/java/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt
Outdated
Show resolved
Hide resolved
1bb2c0e
to
c0fc3c6
Compare
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Fixes #2292 #1759
Description
Add support for evaluation of variable and x-fhir-query expressions(through launchContext) in cqf-calculatedValue expressions, currently supported in minValue and maxValue extensions
Some of the changes included in this PR are
expressionEvaluator
function that would be used in validation to evaluate cqf-calculatedValue expressionsType.valueOrCalculateValue
and replaced it's usage by passing the evaluated calculated value to thevalidate
method of the different validator classesresolveCqfExpression
and replaced it withevaluateExpressionValue
in theExpressionEvaluator
classQuestionnaireViewItem
to accept two more parametersminAnswerValue
andmaxAnswerValue
that could then be used within view factory classes to validate constraintsAlternative(s) considered
Have you considered any alternatives? And if so, why have you chosen the approach in this PR?
Type
Choose one: (Bug fix | Feature | Documentation | Testing | Code health | Builds | Releases | Other)
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.