Skip to main content

CodeBlueTimer

ComplexInpatient flow<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​

Storybook

Live​

Storybook

Ended​

Storybook

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​

VariantWhat it is
runningLive timers, action buttons.
rhythm check dueCPR tile turns red at 02:00 and blinks (still under reduced motion it stays red).
epinephrineAmber from 03:00, red from 05:00.
endedHeader shows the outcome; actions hidden.
readOnlyReview 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​

PropTypeDefaultDescription
patient *string—Patient ('Ruiz, Carmen, 81 F'); required
location *string—Location ('4 West 404B'); required
startedAtnumberwhen the component mountsWhen the code started, epoch ms
nownumberliveFreezes the clock at this epoch ms (for review and tests)
eventsCodeEvent[][]Array of { t: seconds, text, by }: the starting log (uncontrolled)
eventsValueCodeEvent[]uncontrolledThe log (controlled); pair with onEventsChange
onEventsChange(events: CodeEvent[]) => voidnoneCalled with the new log when an event is added
rhythmstringnoneCurrent rhythm ('VF', 'PEA')
energystring | numbernone (200 in the shock log)Defibrillator energy, joules biphasic
vitalsInpatientMeasureValue[][]Array of { measure, value }: monitor values
teamstring[]nonestring[]: the team
endedstringnoneOutcome; ends the code (header shows it, actions hidden, clock stops)
readOnlybooleanfalseReview of a past code: no actions
onEvent(event: CodeEvent) => voidnoneCalled with each new event
onRosc() => voidnoneCalled by ROSC
rangeContextRangeContextId'inpatient' when no global context is setWhich 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.

Angular template
<co-code-blue-timer patient="…" location="…" [events]="events" (co-events-change)="onEventsChange($event.detail)"></co-code-blue-timer>
KindNameDescription
attributepatientPatient ('Ruiz, Carmen, 81 F'); required
attributelocationLocation ('4 West 404B'); required
attributestarted-at / startedAtWhen the code started, epoch ms; default when the component mounts
attributenowFreezes the clock at this epoch ms (for review and tests); default live
property / JSON attributeeventsArray of { t: seconds, text, by }: the starting log (uncontrolled); default []
property / JSON attributeevents-value / eventsValueThe log (controlled); pair with onEventsChange; default uncontrolled
attributerhythmCurrent rhythm ('VF', 'PEA'); default none
property / JSON attributeenergyDefibrillator energy, joules biphasic; default none (200 in the shock log)
property / JSON attributevitalsArray of { measure, value }: monitor values; default []
property / JSON attributeteamstring[]: the team; default none
attributeendedOutcome; ends the code (header shows it, actions hidden, clock stops); default none
attributeread-only / readOnlyReview of a past code: no actions; default false
attributerange-context / rangeContextWhich shared reference range flags use; the lab range on a result still wins; default 'inpatient' when no global context is set
attributedefault-checked / defaultChecked
property / JSON attributedefault-value / defaultValue
attributeauto-focus / autoFocus
eventco-events-changeCalled with the new log when an event is added; default none (React: onEventsChange)
eventco-eventCalled with each new event; default none (React: onEvent)
eventco-roscCalled by ROSC; default none (React: onRosc)