How prismqd/pqd-dash works
1. Overall shape
- This is a Next.js App Router frontend for the PRISMqd Dashboard.
- The repository is organized around one main product surface: a medical dashboard UI composed from many specialized cards and visualization panels.
2. Application entry points
- app/layout.tsx, app/page.tsx, and app/globals.css define the root shell, page composition, and global styling.
- app/actions/get-medical-dashboard-data.ts is the main data-fetching boundary for the dashboard, separating page rendering from data acquisition.
3. Primary feature surface
- components/medical-dashboard.tsx is the top-level dashboard composition component.
- The components/medical-dashboard/ folder contains the dashboard’s functional sub-panels: patient info, clinician info, policy info, status info, AI information, alert notes, alert surface, body diagram, timeline track, vital sign display, and the event details modal.
4. Data flow and domain boundary
- The dashboard appears to consume a single domain model of medical-alert and patient-state data, then fan that data out into specialized cards.
- components/medical-dashboard/types.ts defines the shared shape used across these panels, which keeps the UI consistent and typed.
- The page/data flow is likely: page → server action → DAL/mock data → dashboard component → individual cards/modals.
5. Data access layer
- lib/dal/mock-medical-dashboard.ts is the current data source boundary.
- This suggests the frontend is wired to a mocked or local data-access layer, rather than directly calling a live backend in this repo.
- That boundary is important for an architecture diagram because it shows where a future real API could be swapped in.
6. State and interaction
- components/alert-state-context.tsx provides shared client-side state for alert-related UI behavior.
- Interactive elements such as the event details modal, expanded cards, and notes panel are likely coordinated through this state layer rather than being isolated per-component.
7. Visualization subsystem
- components/vital-signs-waveform-card.tsx, data/vital-signs-stream.ts, data/scichart-vital-signs-data.ts, and data/waveforms.ts support the waveform/vital-sign visualization path.
- This is the most specialized part of the UI and is backed by SciChart, including the WASM runtime assets in public/_wasm/scichart2d.js and public/_wasm/scichart2d.wasm.
- In the diagram, this should be shown as a distinct visualization subsystem with a native/WebAssembly dependency.
8. Design system and shared UI
- components/ui/ contains reusable primitives such as button, card, progress, scroll area, and tooltip.
- The project uses Tailwind CSS and shadcn/ui-style component composition, which means most visual structure is built from small shared primitives rather than a heavyweight component framework.
9. Static assets and presentation resources
- public/images holds image assets, likely for anatomical or branded visuals.
- styles/globals.css and app/globals.css are the main styling entry points; the repo also includes a theme-provider.tsx, implying theme context is part of the UI shell.
10. Local content generation and preprocessing
- scripts/fetch-waveforms.mjs, scripts/verify-waveforms.mjs, and scripts/vectorize-body-diagram.ts indicate offline asset/data preparation.
- These scripts are not runtime features, but they matter architecturally because they generate or validate inputs used by the dashboard visualization and body diagram surfaces.
11. Component development workflow
- Nearly every major UI piece has a corresponding *.stories.tsx file, and there is a stories/Overview.mdx.
- Storybook is a first-class boundary for isolated component development and visual verification, separate from the live app runtime.
12. Testing and quality gates
- vitest.config.ts and storybook/vitest.setup.ts show Vitest-based testing support.
- Biome (biome.json), markdownlint, and Husky hooks indicate automated formatting/linting checks before commits and pushes.
13. Runtime and deployment context
- The stack is built for Node.js 22, Bun, and Vercel, with next.config.mjs controlling Next.js behavior.
- This matters architecturally because the app is designed for a server-rendered React deployment model, with static assets and WASM delivered through the Next/Vercel pipeline.
14. What to emphasize in an architecture diagram
- Show a central Medical Dashboard UI node fed by a mock data layer / server action.
- Break the UI into subpanels: patient/clinician/policy/status cards, alert and notes panels, timeline and body diagram, and vital-sign waveform visualization.
- Draw a separate SciChart/WASM visualization dependency and a shared UI primitives layer beneath the dashboard.
- Keep Storybook/testing/tooling as a side lane, and asset-generation scripts as an offline support lane rather than runtime components.
Main entry points: medical-dashboard.tsx Medical dashboard · vital-signs-waveform-card.tsx Waveform card · Overview.mdx Storybook · waveforms.ts Waveform data
Components 29
App shell
Next.js App Router entrypoints and page composition.
- Root layout · App-wide HTML shell and providers.
app/layout.tsx - Dashboard page · Top-level route composition for the dashboard.
app/page.tsx - Data action · Fetch boundary between page rendering and dashboard data.
app/actions/get-medical-dashboard-data.ts - Global styles · Application-wide styling entrypoint.
app/globals.css
Medical dashboard
Core product surface and its specialized panels.
- Medical dashboard · Main dashboard composition component.
components/medical-dashboard.tsx - Patient card · Patient identity and demographics surface.
components/medical-dashboard/patient-info-card.tsx - Clinician card · Clinician and care-team surface.
components/medical-dashboard/clinician-card.tsx - Policy card · Policy and care-rule surface.
components/medical-dashboard/policy-info-card.tsx - Status card · Current alert and patient-state summary.
components/medical-dashboard/status-info-card.tsx - AI card · AI-generated or AI-assisted information surface.
components/medical-dashboard/ai-information-card.tsx - Alert surface · Primary alert presentation and escalation view.
components/medical-dashboard/alert-surface-card.tsx - Notes panel · Alert notes and clinician annotations.
components/medical-dashboard/alert-notes-card.tsx - Body diagram · Body map or anatomical alert visualization.
components/medical-dashboard/body-diagram-card.tsx - Timeline track · Chronological alert and event track.
components/medical-dashboard/timeline-track.tsx - Vital sign · Single-vital presentation used inside the dashboard.
components/medical-dashboard/vital-sign.tsx - Event modal · Expanded event details and interaction focus.
components/medical-dashboard/event-details-modal.tsx
Data layer
Mock domain data and generated visualization inputs.
- Vital stream · Streaming or sequenced vital-sign data source.
data/vital-signs-stream.ts - Waveform data · Derived waveform dataset for chart rendering.
data/waveforms.ts - SciChart data · SciChart-specific vital-sign dataset preparation.
data/scichart-vital-signs-data.ts - Mock DAL · Local medical dashboard data boundary.
lib/dal/mock-medical-dashboard.ts
Visualization
Waveform rendering path and SciChart runtime.
- Waveform card · Dashboard card for waveform and vital-sign charts.
components/vital-signs-waveform-card.tsx - SciChart WASM · WebAssembly charting runtime loaded by the app.
public/_wasm/scichart2d.wasm - SciChart loader · JavaScript bootstrap for the SciChart runtime.
public/_wasm/scichart2d.js
Shared UI
Reusable primitives and cross-cutting UI state.
- Alert state · Shared client-side state for alert interactions.
components/alert-state-context.tsx - UI primitives · Reusable button, card, progress, scroll, and tooltip primitives.
components/ui - Theme provider · Application theme context and shell wiring.
components/theme-provider.tsx
Tooling
Storybook, testing, scripts, and repo workflows.
- Storybook · Isolated UI development and visual verification.
stories/Overview.mdx - Asset scripts · Waveform fetching, validation, and body-diagram preprocessing.
scripts - Quality checks · Vitest, Storybook setup, lint/format hooks, and repo checks.
vitest.config.ts
Connections 34
- Root layout → Theme provider: wraps · The root layout installs shared UI context.
- Root layout → Global styles: loads · Global CSS is applied at the app shell.
- Dashboard page → Data action: requests data · The page obtains dashboard data through the server action.
- Dashboard page → Medical dashboard: renders · The route composes the dashboard surface.
- Data action → Mock DAL: fetches from · Dashboard data is sourced from the mock DAL boundary.
- Medical dashboard → Patient card: includes · Dashboard fans out domain data into the patient panel.
- Medical dashboard → Clinician card: includes · Dashboard fans out domain data into the clinician panel.
- Medical dashboard → Policy card: includes · Dashboard fans out domain data into the policy panel.
- Medical dashboard → Status card: includes · Dashboard fans out domain data into the status panel.
- Medical dashboard → AI card: includes · Dashboard fans out domain data into the AI panel.
- Medical dashboard → Alert surface: includes · Dashboard includes the main alert surface.
- Medical dashboard → Notes panel: includes · Dashboard includes notes and annotations.
- Medical dashboard → Body diagram: includes · Dashboard includes anatomical alert visualization.
- Medical dashboard → Timeline track: includes · Dashboard includes the event timeline.
- Medical dashboard → Vital sign: includes · Dashboard includes vital-sign summary cards.
- Medical dashboard → Event modal: opens · Dashboard interaction surfaces expanded event details.
- Medical dashboard → Alert state: shares state · Interactive dashboard pieces coordinate through alert context.
- Notes panel → Alert state: reads state · Notes UI is coordinated by shared alert state.
- Event modal → Alert state: reads state · Modal state is controlled through the shared alert context.
- Vital sign → Waveform card: drills into · Vital-sign UI links to waveform visualization.
- Waveform card → Vital stream: consumes · Waveform card is fed by the vital-sign stream.
- Vital stream → Waveform data: transforms to · Streamed data is shaped for chart-ready waveform output.
- Waveform data → SciChart data: adapts to · Prepared waveform data is adapted for SciChart rendering.
- Waveform card → SciChart loader: loads · The charting card bootstraps the JS runtime.
- SciChart loader → SciChart WASM: boots · The JS loader activates the WASM runtime.
- SciChart data → SciChart WASM: renders with · SciChart-specific data is rendered by the WASM engine.
- Medical dashboard → UI primitives: builds from · Dashboard panels are composed from shared primitives.
- Medical dashboard → Theme provider: uses · Dashboard is themed through the shared provider.
- Storybook → Medical dashboard: documents · Storybook captures the dashboard and subcomponents.
- Storybook → UI primitives: documents · Storybook also covers shared primitive components.
- Asset scripts → Body diagram: prepares assets · Offline scripts generate or vectorize body-diagram inputs.
- Asset scripts → Waveform data: prepares assets · Offline scripts fetch and verify waveform inputs.
- Quality checks → Storybook: supports · Storybook setup participates in the quality workflow.
- Quality checks → Medical dashboard: verifies · Vitest and repo checks validate the dashboard surface.