Skip to content

Support SDC calculatedExpression in FHIRQuestionnaireValidator #92

Description

@Ardenexal

Component: Validation (FHIRQuestionnaireValidator) — not in the template dropdown
FHIR Version: All versions (SDC extension)

Problem Statement

FHIRQuestionnaireValidator does not yet support the SDC calculatedExpression extension
(http://hl7.org/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression).
Documented as out of scope in docs/validation/questionnaire.md. Answers that should be
auto-calculated from a FHIRPath expression are not checked against the calculated value.

Proposed Solution

Read the calculatedExpression extension off the source Questionnaire item, evaluate it via
FHIRPathService against the response, and validate that the submitted answer matches the
calculated result. Reuse the expression-evaluation pattern from evaluateEnableWhenExpression
(src/Component/Validation/src/FHIRQuestionnaireValidator.php:2254) and the EXT_* constant
convention (~:126-175). Add an EXT_CALCULATED_EXPRESSION_SDC constant.

Additional Context

Precedent: EXT_ENABLE_WHEN_EXPRESSION_SDC (line 175). One of three remaining uncovered
SDC/R5 questionnaire-validation features; enableWhenExpression and regex are already covered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions