Skip to content

feat(questionnaire-test-toolkit): saved responses, comparison extraction, strict interactions and Health Check acceptance - #27

Closed
pavlushkin wants to merge 4 commits into
feature/questionnaire-test-toolkit-user-contextfrom
feature/questionnaire-test-toolkit-shc-update
Closed

pavlushkin wants to merge 4 commits into
feature/questionnaire-test-toolkit-user-contextfrom
feature/questionnaire-test-toolkit-shc-update

Conversation

@pavlushkin

Copy link
Copy Markdown
Member

Follow-up to aehrc#2193 for the SMART Health Check toolkit update (plan — dependency: this PR is built on top of aehrc#2193's branch and currently targets it so the diff contains only the new work. After aehrc#2193 merges, this PR will be rebased onto main and retargeted).

What's included

Saved responses and comparison extraction

  • questionnaireResponse loads a saved response to resume or amend a form; with a patient, saved answers win over newly generated population answers while population still resolves launch context for expressions. Caller fixtures are cloned.
  • comparisonSourceResponse switches the Save button to modified-only extraction without rebuilding the form or losing unsaved edits.
  • Initialisation failures render a visible error and no Save button.

Strict interactions and date correctness

  • Input helpers reject disabled/read-only/fieldset-disabled controls with the question identifier and reason, and checkbox/radio/select helpers confirm the intended result instead of silently doing nothing.
  • invokeExtract waits for the callback of the Save click it dispatched rather than accepting an earlier extraction's result.
  • getBirthDateForAge formats the intended local calendar date directly (no UTC shift). Health Check "Patient details" assertion updated accordingly; the questionnaire age expression's birthday-day off-by-one is recorded as a separate defect.

Strict population seam

  • fetchResourceCallback prop (mutually exclusive with requestDefinitions, patient required); rejected requests fail the harness visibly even when the population module only warns.

Repeat helpers and Health Check acceptance

  • addRepeatGroup / removeRepeatGroup helpers with nested-group button exclusion and disabled-row rejection.
  • New acceptance scenarios through the callback seam: repaired About fixtures (separate latest vs completed QuestionnaireResponse searches), resume in-progress, amend completed against an explicit fresh-population baseline, remove-first medication, conditional enable/disable/re-enable, age thresholds from explicit DOBs under a fixed clock, and Encounter launch context.

CI

  • Offline Health Check suites run automatically on Node 24; the live-terminology extraction suite remains opt-in (workflow_dispatch / [run-live-terminology]).

Changelog

Consumer-visible changes are recorded under Unreleased in the toolkit changelog. The release version and date will be assigned when preparing publication. These entries extend the same Unreleased section as aehrc#2193.

Verification

  • Toolkit public-package regression suite: 46 tests (built package), typecheck and lint clean.
  • Health Check suites: extraction 26, population 24, calculation 45, conditions + completed forms 144, acceptance 7 — all passing (TZ=Australia/Sydney).
  • Packed-consumer check in an isolated install: ESM import + render/interaction, CJS export parity, TypeScript declaration resolution (requires @types/fhir@0.0.41 alignment).

… extraction and strict interactions

- BehavioralTestWrapper accepts questionnaireResponse to load a saved form
  (resume/amend) and comparisonSourceResponse for modified-only extraction
  through the existing Save button; caller fixtures are cloned, changing the
  comparison baseline never rebuilds the form
- Initialisation failures render a visible error and no Save button
- invokeExtract waits for the callback of the click it dispatched instead of
  accepting an earlier extraction's result
- getBirthDateForAge formats the intended local calendar date directly
- Input helpers reject disabled/read-only controls and confirm checkbox, radio
  and select results instead of silently doing nothing
- Public-package regression tests for saved responses, repeats, context
  resolution, extraction synchronisation, interaction guards, calendar dates
  and visible init failures; Health Check population assertion updated for the
  corrected birth date (questionnaire age-expression birthday off-by-one
  recorded in .scratch/SHC_TOOLKIT_DEFECTS.md)
…ers and Health Check acceptance

- BehavioralTestWrapper accepts fetchResourceCallback, mutually exclusive with
  requestDefinitions and requiring a patient; rejected requests fail the
  harness visibly even when the population module only warns, and changing the
  callback rebuilds the form
- addRepeatGroup and removeRepeatGroup helpers target stacked repeat
  instances, never matching nested groups' buttons, and reject disabled
  controls such as an empty final row or the remaining placeholder
- Health Check acceptance scenarios through the callback seam: repaired About
  fixtures with separate latest-versus-completed QuestionnaireResponse
  searches, resume in-progress, amend completed against an explicit
  fresh-population baseline, remove-first medication with association checks,
  conditional enable/disable/re-enable, age thresholds from explicit DOBs
  under a fixed Date, and Encounter launch context resolution
The deterministic offline suites (acceptance, population, calculation,
conditions and completed-form scenarios) run on push/PR paths affecting the
toolkit, renderer, SDC packages or the Health Check suite. The extraction
suite performs live SNOMED lookups against Ontoserver and remains opt-in via
workflow_dispatch or a [run-live-terminology] commit.
@pavlushkin

Copy link
Copy Markdown
Member Author

Superseded: this PR is being re-opened against the core repository. Closing.

@pavlushkin pavlushkin closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant