CodeBlueTimer
<co-code-blue-timer>CodeBlueTimer runs a resuscitation: elapsed time, the 2-minute CPR cycle, time since epinephrine, rhythm and shocks, one-tap event logging, and the event log for the code record.
import { CodeBlueTimer } from 'health-components';
Examples
Showcase
Live
Ended
Usage
<CodeBlueTimer patient="Ruiz, Carmen, 81 F" location="4 West 404B" startedAt={codeStart} rhythm="VF" energy={200} />
When to use
- The recorder screen during a cardiac arrest.
When not to use
- A deteriorating patient who still has a pulse: RapidResponsePanel.
Variants and states
| Variant | What it is |
|---|---|
| running | Live timers, action buttons. |
| rhythm check due | CPR tile turns red at 02:00 and blinks (still under reduced motion it stays red). |
| epinephrine | Amber from 03:00, red from 05:00. |
| ended | Header shows the outcome; actions hidden. |
| readOnly | Review of a past code. |
Clinical values
Every number goes through the clinical value rules: tabular digits, unit always shown, fixed precision per measure (temperature 0.1 °C, potassium 0.1 mmol/L, creatinine 0.01 mg/dL, heart rate whole bpm), the reference range in the tooltip and H, L, H! or L! flags. Doses drop trailing zeros and keep a leading zero (0.5 mg, 5 mg).
Accessibility
- Elapsed time is role timer; the log is a polite live region so new events are read once.
- Buttons are large and labelled with the drug and dose.
Do and don't
- Do: Keep the reminder intervals to the ACLS guideline the hospital uses.
- Don't: Treat the timers as orders; they are reminders.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
patient * | string | — | Patient ('Ruiz, Carmen, 81 F'); required |
location * | string | — | Location ('4 West 404B'); required |
startedAt | number | when the component mounts | When the code started, epoch ms |
now | number | live | Freezes the clock at this epoch ms (for review and tests) |
events | CodeEvent[] | [] | Array of { t: seconds, text, by }: the starting log (uncontrolled) |
eventsValue | CodeEvent[] | uncontrolled | The log (controlled); pair with onEventsChange |
onEventsChange | (events: CodeEvent[]) => void | none | Called with the new log when an event is added |
rhythm | string | none | Current rhythm ('VF', 'PEA') |
energy | string | number | none (200 in the shock log) | Defibrillator energy, joules biphasic |
vitals | InpatientMeasureValue[] | [] | Array of { measure, value }: monitor values |
team | string[] | none | string[]: the team |
ended | string | none | Outcome; ends the code (header shows it, actions hidden, clock stops) |
readOnly | boolean | false | Review of a past code: no actions |
onEvent | (event: CodeEvent) => void | none | Called with each new event |
onRosc | () => void | none | Called by ROSC |
rangeContext | RangeContextId | 'inpatient' when no global context is set | 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-code-blue-timer>. 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-code-blue-timer patient="…" location="…" [events]="events" (co-events-change)="onEventsChange($event.detail)"></co-code-blue-timer>
| Kind | Name | Description |
|---|---|---|
| attribute | patient | Patient ('Ruiz, Carmen, 81 F'); required |
| attribute | location | Location ('4 West 404B'); required |
| attribute | started-at / startedAt | When the code started, epoch ms; default when the component mounts |
| attribute | now | Freezes the clock at this epoch ms (for review and tests); default live |
| property / JSON attribute | events | Array of { t: seconds, text, by }: the starting log (uncontrolled); default [] |
| property / JSON attribute | events-value / eventsValue | The log (controlled); pair with onEventsChange; default uncontrolled |
| attribute | rhythm | Current rhythm ('VF', 'PEA'); default none |
| property / JSON attribute | energy | Defibrillator energy, joules biphasic; default none (200 in the shock log) |
| property / JSON attribute | vitals | Array of { measure, value }: monitor values; default [] |
| property / JSON attribute | team | string[]: the team; default none |
| attribute | ended | Outcome; ends the code (header shows it, actions hidden, clock stops); default none |
| attribute | read-only / readOnly | Review of a past code: no actions; default false |
| attribute | range-context / rangeContext | Which shared reference range flags use; the lab range on a result still wins; default 'inpatient' when no global context is set |
| attribute | default-checked / defaultChecked | |
| property / JSON attribute | default-value / defaultValue | |
| attribute | auto-focus / autoFocus | |
| event | co-events-change | Called with the new log when an event is added; default none (React: onEventsChange) |
| event | co-event | Called with each new event; default none (React: onEvent) |
| event | co-rosc | Called by ROSC; default none (React: onRosc) |