Skip to content

Commit 55cbaa6

Browse files
committed
docs(validation): clarify coverage of SDC constraints in questionnaire guidance
1 parent a263588 commit 55cbaa6

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

docs/validation/questionnaire.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,33 +59,35 @@ after merging.
5959
| Required, enabled items must be answered when status is `completed`/`amended`, checked per parent instance | `error` |
6060
| A required group needs at least one answered descendant question | `error` |
6161
| Non-repeating items: at most one occurrence per parent and one answer | `error` |
62+
| Answer must satisfy item constraint extensions: `minValue`/`maxValue`, `minLength`/`maxLength`, `maxDecimalPlaces`, `regex`, `minOccurs`/`maxOccurs` | `error` |
63+
| `answerOption` membership, including the exclusive-option (`optionExclusive`) rule | `error` |
64+
| Non-answerable item types (`display`, abstract `question`) must not carry an answer | `error` |
65+
| `Reference` answers must match the constrained target resource type and be a well-formed URL | `error` |
66+
| `Attachment` answers must satisfy content-type / size / data-size constraints | `error` |
67+
| `Quantity` answers must satisfy `minQuantity`/`maxQuantity` bounds and unit-option constraints | `error` |
6268
| Answer value type must match the declared item type | `warning` |
6369
| Items present while their `enableWhen` conditions are unsatisfied | `warning` |
6470
| `enableWhen.question` must reference a known `linkId` | `warning` |
6571

6672
{% hint style="warning" %}
67-
SDC extensions (`enableWhenExpression`, `answerExpression`, calculated expressions, regex
68-
constraints) and R5 `answerConstraint` are not yet covered. `enableWhen` answers are looked
69-
up response-globally — a documented approximation of the spec's nearest-occurrence
73+
SDC `answerExpression`, calculated expressions (`calculatedExpression`), and R5
74+
`answerConstraint` are not yet covered. (`enableWhenExpression` — both the canonical SDC and
75+
Kanta PHR variants — and `regex` constraints are now validated.) `enableWhen` answers are
76+
looked up response-globally — a documented approximation of the spec's nearest-occurrence
7077
resolution that is exact whenever the referenced question occurs once.
7178
{% endhint %}
7279

7380
## Conformance coverage
7481

7582
The validator is exercised against the official `fhir/fhir-test-cases` QuestionnaireResponse
7683
corpus via `FHIRQuestionnaireConformanceTest` (run with `composer test-ai-questionnaire-spec`).
77-
Of the 78 eligible R4 cross-resource cases:
78-
79-
* **41 are asserted** — error/warning counts match seeded expectations and the verdict agrees
80-
with the HL7 Java validator's error-presence (answer-type mismatches are reported at
81-
`warning` rather than `error`, by design).
82-
* **36 are out of scope** and left incomplete (not silently passing) — they test rules this
83-
validator does not implement (answerOption/value-set membership, min/max, regex, Quantity
84-
units, Attachment constraints, Reference target types, SDC `enableWhenExpression`).
85-
* **1 is skipped** — its supporting resource is not a Questionnaire.
86-
87-
The validator reports no false-positive errors across the corpus (its error count never
88-
exceeds the reference validator's).
84+
All 78 eligible R4 cross-resource cases are seeded and asserted (156 assertions): each case's
85+
error and warning counts are pinned to the validator's current output, so the suite acts as a
86+
regression guard. No cases remain out of scope or skipped. Answer-type mismatches are asserted
87+
at `warning` rather than `error`, by design.
88+
89+
The validator reports no false-positive errors across the corpus (its error count never exceeds
90+
the HL7 Java reference validator's); `FHIRQuestionnaireConformanceTest::KNOWN_GAPS` is empty.
8991

9092
## Derived Questionnaires
9193

0 commit comments

Comments
 (0)