Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
LZRS committed Mar 6, 2024
1 parent 1ada327 commit c0fc3c6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c0fc3c6

Please sign in to comment.