ClinicalDecisionSupportCard
<co-clinical-decision-support-card>ClinicalDecisionSupportCard renders one CDS Hooks card: info, warning or critical indicator, summary, detail, the values behind it, suggestions to apply, links, and an override that needs a reason.
import { ClinicalDecisionSupportCard } from 'health-components';
Examples
Showcase
Warning
Info
Overridden
Usage
<ClinicalDecisionSupportCard card={hooksCard} onOverride={log} />
When to use
- Showing a CDS Hooks service response at order-select, order-sign or patient-view.
When not to use
- Drug-drug or allergy checks inside e-prescribing: DrugInteractionAlert.
Variants and states
| Variant | What it is |
|---|---|
| info | Blue edge. |
| warning | Amber edge and wash. |
| critical | Red edge, role alert; the override button says Override. |
| suggestions | Recommended suggestion is the primary button. |
| overriding | Reason select (plus free text for Other); Continue disabled until a reason is given. |
| accepted / overridden | Collapsed result line with the reason. |
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
- Critical cards use role alert; others are labelled regions.
- Values carry their flag in words and show the reference range.
Do and don't
- Do: Name the source of the rule.
- Don't: Let a critical card be dismissed with no reason.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
card * | CdsCard | — | The CDS Hooks card; required |
state | CdsCardState | uncontrolled | Card state (controlled): 'open' | 'accepted' | 'overridden' |
defaultState | CdsCardState | 'open' | Initial state |
onStateChange | (state: CdsCardState) => void | none | Called when the state changes |
overrideReason | string | 'recorded' | Reason shown for an already overridden card |
onOverride | (reasonCode: string, text?: string) => void | none | Called with the reason code ('other' plus the typed text for Other) when the user overrides |
onAccept | (suggestion: CdsSuggestion) => void | none | Called with the suggestion the user applies |
onLink | (link: CdsLink) => void | none | Called when a link without `url` is clicked |
feedback | boolean | true | Shows 'Overrides are logged with the reason.' |
rangeContext | RangeContextId | the 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, plus className and event handlers on the root element.
Angular, Vue and HTML
Register the elements once (Angular guide), then use <co-clinical-decision-support-card>. 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.
<co-clinical-decision-support-card state="…" default-state="…" [card]="card" (co-state-change)="onStateChange($event.detail)"></co-clinical-decision-support-card>
| Kind | Name | Description |
|---|---|---|
| property / JSON attribute | card | The CDS Hooks card; required |
| attribute | state | Card state (controlled): 'open' | 'accepted' | 'overridden'; default uncontrolled |
| attribute | default-state / defaultState | Initial state; default 'open' |
| attribute | override-reason / overrideReason | Reason shown for an already overridden card; default 'recorded' |
| attribute | feedback | Shows 'Overrides are logged with the reason.'; default true |
| attribute | range-context / rangeContext | Which shared reference range flags use; the lab range on a result still wins; default the global context, else 'outpatient' |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| event | co-state-change | Called when the state changes; default none (React: onStateChange) |
| event | co-override | Called with the reason code ('other' plus the typed text for Other) when the user overrides; default none (React: onOverride) |
| event | co-accept | Called with the suggestion the user applies; default none (React: onAccept) |
| event | co-link | Called when a link without `url` is clicked; default none (React: onLink) |