Skip to main content

StructuredDataGrid

ComplexChart panels<co-structured-data-grid>

StructuredDataGrid is a spreadsheet-like flowsheet for entering many numbers at once, with checks that block impossible values and warn on out-of-range ones.

import { StructuredDataGrid } from 'health-components';

Examples​

Showcase​

Storybook

Inpatient Ranges​

Storybook

Read Only​

Storybook

Usage​

<StructuredDataGrid title="ICU hourly vitals" columns={cols} rows={rows} onSave={save} />

When to use​

  • Nursing flowsheets, intake and output, dialysis runs, infusion vitals, ICU hourly charting.

When not to use​

  • One set of vitals: VitalsPanel. Free text: SOAPSection.

Variants and states​

VariantWhat it is
validGreen All valid tag.
out of rangeAmber cell with the flag and reference range. Saving is allowed.
not possibleRed cell: not a number or outside the hard limits. Saving is blocked.
required emptyRed after the first save attempt.
readOnlyFormatted values with units, no inputs.

Clinical values​

Every number renders through CareOS.ClinicalValue and CareOS.fmt (the clinical-values builder), matched by LOINC; measures that table lacks (NT-proBNP, lactate, vancomycin trough, CrCl, PHQ-9, per-kg doses) use a local table with the same rules: tabular figures, the unit always shown, fixed decimals per measure (potassium 1, sodium 0, creatinine 2), the reference range in the title or beside it, and H, L, HH or LL flags in words for screen readers. The flag says where the number sits against the adult reference range in the rules table; it does not say the number was measured correctly.

Accessibility​

  • role grid with a label per cell (column, row and unit).
  • Errors use role alert; aria-invalid on the input.
  • Enter and Down move down a column.

Do and don't​

  • Do: Set hard limits per column (SpO2 0 to 100).
  • Don't: Treat an in-range value as checked: the checks catch typing errors, not wrong measurements.

Props​

PropTypeDefaultDescription
columns *StructuredDataGridColumn[]—Columns; required
rowsStructuredDataGridRow[]noneInitial rows; the grid keeps its own copy as the user types
titlestringnoneCard title, also the grid's accessible name
subtitlestringnoneCard subtitle
readOnlybooleanfalseWhole grid read only
onSave(rows: StructuredDataGridRow[]) => voidnoneCalled with the rows when Save passes the checks
onRowsChange(rows: StructuredDataGridRow[]) => voidnoneCalled with the rows after every edit
rangeContextRangeContextIdthe global context, else 'outpatient'Which shared reference range flags use; the lab range on a result still wins

Also accepts native attributes, including defaultChecked, defaultValue, autoFocus, onChange, onInput, plus className and event handlers on the root element.

Angular, Vue and HTML​

Register the elements once (Angular guide), then use <co-structured-data-grid>. Attributes take strings; arrays and objects are set as properties (Angular [prop], Vue :prop) or as JSON attributes. Callbacks are DOM events with the value in event.detail.

Angular template
<co-structured-data-grid title="…" subtitle="…" [columns]="columns" (co-save)="onSave($event.detail)"></co-structured-data-grid>
KindNameDescription
property / JSON attributecolumnsColumns; required
property / JSON attributerowsInitial rows; the grid keeps its own copy as the user types; default none
attributetitleCard title, also the grid's accessible name; default none
attributesubtitleCard subtitle; default none
attributeread-only / readOnlyWhole grid read only; default false
attributerange-context / rangeContextWhich shared reference range flags use; the lab range on a result still wins; default the global context, else 'outpatient'
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
eventco-saveCalled with the rows when Save passes the checks; default none (React: onSave)
eventco-rows-changeCalled with the rows after every edit; default none (React: onRowsChange)
eventco-change (React: onChange)
eventco-input (React: onInput)