-
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
populate initial with initialExpression result collection #2751
base: master
Are you sure you want to change the base?
Conversation
To support multiple initially selected options from the dropdown, not quite sure populating the
I would suggest maybe using |
@LZRS Thank you so much for your feedback! Invariant:
cc: @jingtang10 , @icrc-jofrancisco |
datacapture/src/main/java/com/google/android/fhir/datacapture/mapping/ResourceMapper.kt
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.
LGTM
… initialExpression
@@ -248,22 +249,51 @@ object ResourceMapper { | |||
"QuestionnaireItem item is not allowed to have both initial.value and initial expression. See rule at http://build.fhir.org/ig/HL7/sdc/expressions.html#initialExpression." | |||
} | |||
|
|||
// Initial values can't be specified for groups or display items | |||
if (questionnaireItem.initial.isNotEmpty() || questionnaireItem.initialExpression != null) { |
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.
i think this can just be incorporated into the check
. so you have:
check(
!(questionnaireItem.type == Questionnaire.QuestionnaireItemType.GROUP ||
questionnaireItem.type == Questionnaire.QuestionnaireItemType.DISPLAY) || (questionnaireItem.initial.isEmpty() && questionnaireItem.initialExpression == null),
)
or maybe rephrase it somehow ^
evaluatedExpressionResult.any { answerOption.value.equalsDeep(it) } | ||
} | ||
} else { | ||
// Handle initial values based on whether the questionnaire item repeats |
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.
so in this else
block, the anwerOption
is empty in the questionnaire item? why do we have to do anything in this case?
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.
pls also reflect these changes with new test cases.
IMPORTANT: All PRs must be linked to an issue (except for extremely trivial and straightforward changes).
Fixes #2750
Description
Updated
populateInitialValue()
function inResourceMapper.kt
of the SDC module to populatequestionnaireItem.initial
with values of collection instead of just the first value of the collection.Alternative(s) considered
None | Looking forward to feedback
Type
Bug fix
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.