diff --git a/datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt b/datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt index 2a224a10b6..b637a6bf08 100644 --- a/datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt +++ b/datacapture/src/main/java/com/google/android/fhir/datacapture/fhirpath/ExpressionEvaluator.kt @@ -141,7 +141,10 @@ internal class ExpressionEvaluator( ) } - /** Returns the evaluation result of an expression as a [Type] value */ + /** + * Returns single [Type] evaluation value result of an expression, including cqf-expression and + * cqf-calculatedValue expressions + */ suspend fun evaluateExpressionValue( questionnaireItem: QuestionnaireItemComponent, questionnaireResponseItem: QuestionnaireResponseItemComponent?, diff --git a/datacapture/src/main/java/com/google/android/fhir/datacapture/validation/AnswerExtensionConstraintValidator.kt b/datacapture/src/main/java/com/google/android/fhir/datacapture/validation/AnswerExtensionConstraintValidator.kt index 5e5ed9734d..2d8397b912 100644 --- a/datacapture/src/main/java/com/google/android/fhir/datacapture/validation/AnswerExtensionConstraintValidator.kt +++ b/datacapture/src/main/java/com/google/android/fhir/datacapture/validation/AnswerExtensionConstraintValidator.kt @@ -53,9 +53,9 @@ internal open class AnswerExtensionConstraintValidator( ): AnswerConstraintValidator.Result { if (questionnaireItem.hasExtension(url)) { val extension = questionnaireItem.getExtensionByUrl(url) - val extensionCalculatedValue = + val extensionValue = extension.value.cqfCalculatedValueExpression?.let { expressionEvaluator(it) } - val extensionValue = extensionCalculatedValue ?: extension.value + ?: extension.value // Only checks constraint if both extension and answer have a value if ( diff --git a/datacapture/src/main/java/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt b/datacapture/src/main/java/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt index b97e85b0a2..cd75191115 100644 --- a/datacapture/src/main/java/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt +++ b/datacapture/src/main/java/com/google/android/fhir/datacapture/views/QuestionnaireViewItem.kt @@ -29,6 +29,7 @@ import com.google.android.fhir.datacapture.extensions.toSpanned import com.google.android.fhir.datacapture.validation.NotValidated import com.google.android.fhir.datacapture.validation.Valid import com.google.android.fhir.datacapture.validation.ValidationResult +import com.google.android.fhir.datacapture.views.factories.QuestionnaireItemViewHolder import org.hl7.fhir.r4.model.Questionnaire import org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent import org.hl7.fhir.r4.model.QuestionnaireResponse @@ -59,8 +60,12 @@ import org.hl7.fhir.r4.model.Type * @param answersChangedCallback the callback to notify the view model that the answers have been * changed for the [QuestionnaireResponse.QuestionnaireResponseItemComponent] * @param enabledAnswerOptions the enabled answer options in [questionnaireItem] - * @param minAnswerValue the inclusive lower bound on the range of allowed answer values - * @param maxAnswerValue the inclusive upper bound on the range of allowed answer values. + * @param minAnswerValue the inclusive lower bound on the range of allowed answer values, that may + * be used for widgets that check for bounds and change behavior based on the min allowed answer + * value, e.g the Slider widget + * @param maxAnswerValue the inclusive upper bound on the range of allowed answer values, that may + * be used for widgets that check for bounds and change behavior based on the max allowed answer + * value, e.g the Slider widget * @param draftAnswer the draft input that cannot be stored in the [QuestionnaireResponse]. * @param enabledDisplayItems the enabled display items in the given [questionnaireItem] * @param questionViewTextConfiguration configuration to show asterisk, required and optional text