Appearance
ADR-2819: Focus Active eCRF View on Backed Kernel Forms Outside Demo Mode
- Status: Accepted
- Date: 2026-11-20
- Authors: @fderuiter
- Deciders: @fderuiter
- Requirements: PRD-SYS-001 (audit fields and backed execution boundaries), PRD-EDC-005 (case report form workflow)
1. Context & Problem Statement
ADR-2622 moved clinical case report form collection onto kernel CollectionInstance forms rendered by EcrfFormPanel.vue (/api/v1/execution/ecrf/*). However, mounting /ecrf (apps/web/src/views/EcrfView.vue) outside demo mode still exposed five unbacked prototype panels alongside EcrfFormPanel.vue — legacy enrollment (SubjectEnrollmentForm.vue), sample vitals (CrcFormRenderer.vue), static CDASH reference rules, protocol ingestion (DesignerSchemaPanel.vue), EHR source reconciliation (EhrReconciliationDrawer.vue), and a local role-switcher dropdown — and required clinicians to paste raw enrollment UUIDs rather than resolving the selected participant's kernel enrollment. In demo mode, legacy walkthrough actions also used blocking window.alert() dialogs and rendered a link to /training even when that screen is unavailable.
2. Decision Drivers & Constraints
- Backed Clinical Truth Only Outside Demo Mode (PRD-SYS-001, ADR-2622): Non-demo
/ecrfbuilds must present only controls backed by Execution and Kernel APIs so clinical staff never enter data into local-only sample forms or hit dead-end refusal toasts. - Participant-to-Enrollment Resolution (PRD-EDC-005): Selecting a study participant on
/ecrfor navigating from Clinical Canvas (FormQueryList.vue,AppShell.vue,CommandPaletteOverlay.vue) must automatically resolve and populate the participant's kernelenrollmentIdviafindKernelEnrollmentRef(apps/web/src/canvas/kernelStudy.ts). - Non-Blocking Demo Walkthroughs: Demo builds (
VITE_DEMO_MODE=true) retain persona walkthrough panels for evaluation while replacing blockingwindow.alert()calls with toast notifications and gating links to unavailable routes behindisScreenAvailable(...).
3. Options Considered
Option 1: Gate Legacy Persona Panels to Demo Mode and Wire Kernel Enrollment Resolution on /ecrf (Selected)
- Overview: Outside demo builds (
!unbackedActionsEnabled()), render only the authenticated role badge,StudySubjectsBar, a participant selector with role-gated Clinical Canvas handoff (canManageParticipants), andEcrfFormPanel.vue. Resolve the chosen participant's kernel enrollment viafindKernelEnrollmentRef, syncEcrfFormPanel'senrollmentIdfield and clear staleopenErroron participant switches, forwardenrollmentIdon Clinical Canvas ->/ecrflinks, preserveonBeforeRouteLeave,onBeforeRouteUpdate, andbeforeunloadguards for unsaved kernel form edits, and replacewindow.alert()calls in demo composables withuseToastStore()notifications. - Pros:
- ✅ Aligns
/ecrfwith ADR-2622 andPRD-SYS-001by eliminating unbacked controls andlocalStoragesample drafts outside demo mode. - ✅ Removes manual UUID copy-paste by resolving participant kernel enrollments on
/ecrfand preservingenrollmentIdacross Clinical Canvas navigation. - ✅ Preserves demo walkthroughs without blocking
window.alert()dialogs or broken/traininglinks.
- ✅ Aligns
- Cons:
- ❌ Legacy unit tests that mounted
EcrfViewoutside demo mode expectingCrcFormRendererorSubjectEnrollmentFormmust explicitly opt intoVITE_DEMO_MODE="true"when exercising demo-only panels.
- ❌ Legacy unit tests that mounted
Option 2: Keep Unbacked Panels Mounted Outside Demo Mode Behind Click-Time Refusal Toasts
- Overview: Leave all legacy persona panels visible on
/ecrfand rely solely onallowUnbackedAction(...)refusal toasts when clicked. - Pros:
- ✅ Minimal template changes in
EcrfView.vue.
- ✅ Minimal template changes in
- Cons:
- ❌ Clutters the active clinical data-entry workspace with inert prototype forms and requires manual UUID entry for
EcrfFormPanel.vue.
- ❌ Clutters the active clinical data-entry workspace with inert prototype forms and requires manual UUID entry for
4. Decision Outcome
- Chosen Option: Option 1
- Justification: Focusing
/ecrfonStudySubjectsBar, participant enrollment resolution, andEcrfFormPanel.vueoutside demo builds satisfiesPRD-SYS-001andPRD-EDC-005while preserving non-blocking demo walkthroughs whenVITE_DEMO_MODE=true.
5. Consequences & Trade-offs
- Positive Impact: Clinical coordinators, investigators, monitors, and data managers see a single kernel-backed eCRF workflow on
/ecrfwith automatic enrollment resolution and direct navigation to and from Clinical Canvas. - Negative Impact / Technical Debt: Legacy persona components (
CrcFormRenderer.vue,DesignerSchemaPanel.vue,SubjectEnrollmentForm.vue) remain inapps/web/src/components/for demo mode until retired workspace-wide. - Mitigation Strategy: Vitest suites cover both non-demo focused mode and
VITE_DEMO_MODE="true"behavior, including navigation guards and alert-free toast notifications.
6. Implementation & Verification
- Affected Repositories / Services:
apps/web(EcrfView.vue,EcrfFormPanel.vue,FormQueryList.vue,AppShell.vue,CommandPaletteOverlay.vue,palette.ts,CrcFormRenderer.vue,useSchemaIngestion.js,useVerification.js),apps/web/README.md,docs/web/API_MIGRATION.md. - Verification Plan: Verified via
pnpm -r test,pnpm -r lint,pnpm --filter web typecheck,pnpm build,pnpm --filter web build:demo, andpnpm cadence check.