← Back
Home › Systems › Healthcare

patient-monitoring

Continuously measures a patient's vital signs, judges whether they are acceptable, and alerts the right clinician when they are not.

Philips IntelliVue, GE CARESCAPE, Masimo

Open the patient-monitoring pagepatient-monitoring Delta encodingcompression: Store differences between consecutive values instead of the values, turning sorted IDs, timestamps and counters into small numbers that pack into few bits.›Clock synchronizationdistributed: Estimate a clock's offset from four timestamps, filter out queueing noise, and steer the clock smoothly; NTP gets about a millisecond, PTP with hardware timestamps under a microsecond.›Alarm managementembedded: Turn raw process limits into a few actionable operator alarms with delay, deadband, acknowledge and shelving states, plus flood measurement.›Battery state estimationembedded: State of charge / health / power from coulomb counting, OCV curves and model-based observersLow power duty cyclingembedded: MCU sleep states, wake sources and radio duty cycling to run years on a batteryPreemptive priority schedulingembedded: Always run the highest-priority ready task, switching the instant a higher one becomes ready; selection is O(1) with one FIFO per priority and a bitmap.›Safety-critical codingstandardsembedded: Which rule sets (MISRA C, CERT C, JPL Power of Ten, Rust lint subsets) apply when software must not fail, what they forbid, and how to enforce them in CI.›Safety monitor architectureembedded: Independent doer/checker safety monitor that forces a safe state when the main channel misbehavesWatchdog timerembedded: A hardware down-counter that resets the chip unless software proves, in time and in a plausible pattern, that it is still healthy.›Hl7v2 message parsingnetworking: HL7 v2 pipe-delimited segments, escaping, ACKs and MLLP framing for clinical interfacesEcg beat classificationsignal-processing: Detect QRS complexes (Pan-Tompkins style band-pass, derivative, squaring, adaptive threshold) and classify beats by morphology and RR intervalIIR and FIR filterssignal-processing: Two ways to shape a sampled signal's spectrum: FIR (finite taps, always stable, exact linear phase) or IIR (feedback, a few coefficients, cheap but phase-distorting).›Oscillometric blood pressuresignal-processing: Deflate a cuff, extract the oscillation envelope and derive mean, systolic and diastolic pressure from amplitude-ratio pointsPeak detectionsignal-processing: Robust peak and event detection in noisy signals with adaptive thresholds and refractory periodsPpg heart rate estimationsignal-processing: Optical PPG heart rate: band-pass, motion-artifact removal with accelerometer, spectral trackingWavelet transformsignal-processing: Discrete wavelet transforms (Haar, CDF 9/7 lifting) for compression and multiscale analysisTime-series chunk storagestorage: Store each series as immutable compressed chunks of consecutive samples behind a small time index; a range query decodes only the chunks that overlap it.›Escalation policiessystems: Route each incident through ordered levels on timers until someone acknowledges it, with rotation lookup, dedup keys, snooze, loops and durable timers.›Hierarchical state machinesystems: Nest states so a substate inherits its parent's reactions and only overrides what differs, with ordered entry and exit actions along the path.›Publish subscribe event bussystems: In-process or on-box topic bus decoupling producers and consumers with bounded queuesBit packing and PFORcompression: Store blocks of integers with exactly b bits each and patch rare outliers separately (PFOR); the fastest integer codec family, billions of values per second.›Varint (LEB128)compression: Variable-length integers in 7-bit groups with a continuation bit; small numbers take 1 byte, the wire format of Protobuf, WebAssembly and DWARF.›PID controllerrobotics: Drive a measured value to a setpoint with three terms on the error: proportional, integral, derivative. The default feedback loop for motors, heaters, drones and gimbals.›Phase-locked loop (digital)signal-processing: Feedback loop that locks a local oscillator to the phase and frequency of an input tone; the core of carrier recovery, clock recovery and GNSS tracking.›Robust statisticsstatistics: Location and scale estimates (median, MAD, trimmed mean, Huber M-estimator) that stay correct when a minority of the data is garbage.›Debouncing throttlingsystems: Coalescing rapid events: debounce (wait for quiet), throttle (max rate), and cancelling stale in-flight requestsEquivalent circuit batterymodelembedded: Thevenin RC-network battery models with OCV-SoC curves and parameter identificationSpline interpolationnumerics: Linear, bilinear/trilinear and cubic spline interpolation on grids and tablesExtended Kalman filterrobotics: Kalman filter for nonlinear motion and measurement models: linearize f and h with Jacobians at the current estimate each step. The default estimator in robot navigation.›Code coverage instrumentationcompilers: Insert counters into compiled code to record which blocks, edges or lines ran; a spanning tree of the control-flow graph cuts the counters needed.›Dataflow analysiscompilers: Compute a fact per program point (live variables, reaching definitions, available expressions) by iterating transfer functions over the CFG to a fixed point.›End to end protection e2eembedded: Per-message counter, ID and CRC over a black channel to detect loss, repetition, corruption, delay+ 12 moreExplicit Eulernumerics: Step an ODE forward by its current slope, y += h·f(t, y); first-order, one evaluation per step, the baseline every other integrator is measured against.›Levenberg marquardtnumerics: Damped Gauss-Newton nonlinear least squares for model calibrationFinite differencesnumerics: Replace derivatives with weighted differences of grid values; simple stencils plus a stability condition (CFL) turn PDEs like heat, advection and waves into array loops.›LU and Cholesky factorizationnumerics: Factor A = PLU (any square matrix, partial pivoting) or A = LLᵀ (SPD) once in O(n³), then solve each right-hand side in O(n²).›Minimum spanning treegraphs: Cheapest set of edges connecting all vertices; Kruskal sorts edges and joins components with union-find, Prim grows one tree, Boruvka merges in parallel rounds.›Control-flow graphcompilers: Split a linear instruction list into basic blocks and connect them by jumps; the graph every optimizer, SSA builder and dataflow pass walks.›Topological sortgraphs: Order the vertices of a DAG so every edge points forward; the core of build systems, schedulers and dependency resolution, with cycle detection for free.›+ 5 moreThomas tridiagonal solvernumerics: O(n) tridiagonal linear solve used in implicit finite-difference and spline schemesd-ary heapdata-structures: Array heap with d children per node (d = 4 typical): half the binary heap's depth, siblings in one cache line, faster priority queues.›Union-findgraphs: Disjoint-set forest with union by size and path compression; merges sets and answers same-set queries in effectively constant time.›BFS and DFSgraphs: The two basic graph traversals; BFS gives hop distances and levels, DFS gives discovery/finish order for cycles, components and topological order.›+ 2 moreSparse matrices (CSR)numerics: Compressed sparse row stores only nonzeros as row pointers, column indices and values; SpMV streams them once, so it is memory-bandwidth bound.›+ 1 more

How it is built

Architecture overview

A patient-monitoring system measures a patient's vital signs continuously, decides whether they are acceptable, and tells the right person when they are not. A bedside monitor (or a small wearable telemetry pack) acquires waveforms: ECG for heart rhythm, photoplethysmography (PPG) for pulse and oxygen saturation, intermittent cuff blood pressure, respiration, temperature, sometimes invasive pressures. It filters them, derives numbers (heart rate, SpO2, blood pressure) and runs alarm logic locally. A central station collects many bedsides over the hospital network, shows them side by side, stores trends and forwards data and alarms to the electronic health record and to nurses' devices. Philips IntelliVue, GE CARESCAPE and Masimo, from the graph's examples, are commercial implementations; this page covers the shared mechanics.

The idea that makes it work is layering by criticality. The bedside monitor must keep measuring and alarming even if the network, the central station or the display fails, so the sensing, signal processing and alarm decision live in a small deterministic embedded system that depends on nothing else. The network layers above it add convenience: remote display, trends, annotation, escalation. A failure there must degrade the service, never silence the bedside.

The hard problems are not arithmetic. They are signal quality (motion, electrode noise, poor perfusion corrupt every measurement), alarm quality (too many false or non-actionable alarms desensitise staff, a problem called alarm fatigue) and evidence (the device is regulated, so its software lifecycle and risk analysis are part of the design).

Parts:

 sensors: ECG leads | SpO2 probe | NIBP cuff | resp | temp
      │ ADC, fixed sample rates (hardware timer)
      ▼
 acquisition task (high priority) ─► filters ─► per-parameter algorithms (HR, SpO2, BP, RR)
      │                                              │ numbers + signal-quality flags
      ▼                                              ▼
 waveform ring buffers                    alarm engine: limits, delays, priority, latch
      │                                              │ local alarm sound/light
      ▼                                              ▼
 local display            network task: waveforms + numbers + alarms (timestamped, sequenced)
                                         │
                      ───────────────────┴─────────────────── hospital network
                         central station ─► trend store ─► EHR (HL7 v2 / SDC) ─► nurse devices
                         (display, review, alarm relay, escalation)
 safety monitor + watchdog watch acquisition and alarm tasks; independent audible alarm path

How the parts fit together

Acquisition: fixed rates and a protected task

ECG and PPG are sampled by hardware timers at fixed rates (a few hundred samples per second for ECG and lower for PPG are typical, order of); software only reads the buffer. The acquisition task has the highest priority under Preemptive priority scheduling so that display and network work can never starve it, and its worst-case execution time is measured against its period. Filtering uses IIR and FIR filters: a high-pass to remove baseline drift (breathing, electrode movement), a notch or low-pass for mains interference at 50 or 60 Hz, and band-pass sections built from biquad-filters (no page yet) in cascade. An IIR section has low cost and nonlinear phase; a linear-phase FIR keeps the waveform shape that clinicians read for ST-segment changes, at higher cost, which is why the monitoring mode and the diagnostic mode of an ECG often use different filter bandwidths. The Fast Fourier transform is used for spectral checks (mains noise detection, respiration rate from a slow component), and SIMD programming accelerates multi-channel filter banks on processors that have vector units.

Parameter extraction: the algorithms that give the numbers

Heart rate and rhythm. ecg-beat-classification (no page yet) detects the QRS complex. The classic approach (Pan and Tompkins, IEEE Transactions on Biomedical Engineering, 1985) band-passes the signal, differentiates, squares and integrates over a moving window, then applies adaptive thresholds that follow the signal level, with searchback if a beat is missed. After detection, beats are classified (normal, premature, paced) by template matching on the beat's shape and its timing. peak-detection (no page yet) is the shared primitive: robust peaks in a noisy signal with a dynamic threshold and a refractory period. Public annotated recordings such as the MIT-BIH Arrhythmia Database on PhysioNet are the usual test set.

Oxygen saturation and pulse. ppg-heart-rate-estimation (no page yet) extracts pulse from the optical waveform. SpO2 is estimated from the ratio of pulsatile (AC) to baseline (DC) absorption at red and infrared wavelengths, mapped to saturation through a calibration curve found empirically for each sensor design. Motion corrupts PPG more than ECG; filtering and a Kalman filter that fuses the pulse with the ECG rate help, and the algorithm must report a quality flag so the alarm engine can tell "low saturation" from "no valid signal".

Blood pressure. oscillometric-blood-pressure (no page yet) inflates a cuff, lowers pressure in steps, and records the small pressure oscillations at each step. The envelope of oscillation amplitude peaks near mean arterial pressure; systolic and diastolic values are derived from characteristic ratios of that peak or from other empirical rules that differ between manufacturers and must be validated against reference measurements. The measurement is intermittent and slow (tens of seconds), so the alarm engine treats it as a periodic value, not a stream.

Compression and denoising. wavelet-transform (no page yet) serves two purposes: denoising and compact storage of waveforms. The alternative in the graph is a short-time spectrogram; wavelets localise sharp events such as the QRS better.

Alarm engine: what the nurse actually hears

Alarm management turns limits into a small number of actionable alarms. Principles, which match the structure of the IEC 60601-1-8 standard for alarm systems in medical equipment: alarms have priorities (high, medium, low) that determine sound and light patterns; physiological alarms (heart rate out of range) are distinguished from technical alarms (lead off, cuff leak); a condition must persist for a delay before it alarms; alarms can be acknowledged, silenced for a bounded time, or latched until seen. Implementation uses a Hierarchical state machine per alarm condition (inactive, delayed, active, acknowledged, silenced, cleared), with parent states for global modes such as "alarms paused" or "standby".

debouncing-throttling (no page yet) is the practical tool against alarm fatigue: ignore a limit crossing shorter than the delay, require the condition to clear for a hold time before re-arming, and suppress repeat sounds. Signal quality gates the logic: when the ECG leads are off, the heart-rate alarm is replaced by a "leads off" technical alarm and not by asystole.

Beyond the bedside, Escalation policies route unanswered alarms: first to the assigned nurse's device, then after a timeout to a colleague or charge nurse. Timeouts across thousands of active alarms use a Hierarchical timing wheel. Staff schedules and assignment rules use Recurrence rule expansion over calendar-date-arithmetic (no page yet), because shifts, holidays and daylight-saving changes decide who is on call.

Safety and fault handling

The monitor must not fail silently. A safety-monitor-architecture (no page yet) puts an independent checker beside the alarm path: for example a second processor or a hardware circuit that sounds a fallback alarm if the main software stops updating. A Watchdog timer is serviced only when the acquisition and alarm tasks have each completed their cycle, not just by a timer interrupt. redundancy-voting (no page yet) applies where two sensor channels measure the same quantity, such as two ECG derivations; a Memory protection unit isolates the display and network tasks from the alarm state. Messages that carry alarm state across links use end-to-end-protection-e2e (no page yet): a counter and CRC so a lost or repeated alarm message is detected. Code follows Safety-critical coding standards, checked by static tools based on Dataflow analysis. The medical software lifecycle standard IEC 62304 and the risk standard ISO 14971 are cited by number (no free public text); they require traceability from risk to requirement to test, and that is part of the design, not paperwork afterwards.

Time

Alarms, annotations and waveform segments from different devices are merged by timestamp, so the clocks must agree. Clock synchronization provides the offset estimate; a bedside clock disciplined with a PID controller or a Phase-locked loop (digital) never jumps, and Robust statistics discards outlier delay samples. Waveform streams also keep a sample counter, so the receiver can place samples in time even when packets arrive late.

Power for wearables and transport

Telemetry packs run on batteries, so battery-state-estimation (no page yet) tells nurses how long the pack has left. It uses an equivalent-circuit-battery-model (no page yet) (a resistor-capacitor network fitted with levenberg-marquardt (no page yet)), a voltage-to-charge curve held in spline-interpolation (no page yet) and an Extended Kalman filter that corrects the charge estimate from voltage. low-power-duty-cycling (no page yet) puts the processor and radio to sleep between bursts. A battery-low warning needs margin because low temperature and aging reduce capacity.

Network and integration

Inside the monitor, a publish-subscribe-event-bus (no page yet) decouples acquisition, algorithms, display and network: producers publish numbers and waveform chunks, consumers subscribe. Waveform packets use Bitstream serialization to keep the telemetry link small, and a Slab allocator provides fixed-size message buffers so no allocation can fail or fragment during operation. Toward the hospital systems, hl7v2-message-parsing (no page yet) covers the long-standing text format used to send observations to the record: segments separated by carriage returns, fields by pipes, framed on a TCP stream by a start and end byte pair (MLLP), each message acknowledged. A newer approach for medical-device interoperability is IEEE 11073 SDC (service-oriented device connectivity), which gives devices a standard service interface; open-source implementations exist (see below).

Central stations keep trends (a number per parameter per minute, or per beat) for days and waveform snippets around events. Time-series chunk storage fits: immutable compressed blocks per series, with Time partitioning to bound queries and retention. Numeric trend data compresses well with Delta encoding and Gorilla XOR compression. Clinical notes and alarm text attached to a patient's record are searched with an Inverted index over text normalised by Unicode text tokenization for search and Text normalization; Top-k selection powers "worst patients by alarm count" views.

Data and control flow

One heartbeat to one alarm:

  1. A timer starts an ADC conversion; the sample is written to a buffer and the acquisition task runs on the interrupt's signal.
  2. The sample passes the filters; the QRS detector updates thresholds and, on a detected beat, records the R-R interval.
  3. Heart rate is computed over a moving window (a robust median of recent intervals, not the last one); a signal-quality flag is attached.
  4. The alarm engine compares the value to the limits. A crossing starts a delay timer; if the value returns inside the limits, nothing is announced.
  5. After the delay the alarm becomes active: the bedside plays its pattern, the alarm state is sent with a sequence number and timestamp to the central station.
  6. If nobody acknowledges within the escalation timeout, the escalation policy sends it to the next recipient.

One blood-pressure measurement:

  1. The monitor inflates the cuff above the expected systolic value.
  2. It deflates in steps; at each step it records the oscillation amplitude after rejecting steps with motion artefacts.
  3. The envelope is analysed, values are computed and range-checked, the cuff is released (a hardware over-pressure limit protects the patient independently of the software).
  4. The result is stored as a timed numeric and forwarded; the alarm engine evaluates it against its limits.

One telemetry reconnect:

  1. The wireless link drops; the pack keeps measuring and alarming locally and buffers waveform chunks.
  2. The central station shows a "no signal" technical alarm after a timeout.
  3. On reconnect, the pack sends the buffered chunks with their original timestamps and sequence numbers; the receiver fills the gap and removes duplicates.

Scaling

In the order you hit them:

  1. Signal quality, not CPU. Artefacts dominate false alarms. Levers: better electrodes and skin prep, multi-channel fusion, quality flags that gate alarms.
  2. Alarm volume per nurse. Levers: delays, priorities, smart defaults per patient type, escalation tuned to staffing, suppression of non-actionable technical alarms.
  3. Real-time budget on the bedside. More channels and algorithms per processor. Levers: vector instructions, fixed rates, moving non-critical work to a lower-priority task or a second core.
  4. Central station load. Hundreds of waveforms per station. Levers: send downsampled waveforms for overview, full resolution only on selection, compress with delta and XOR codecs.
  5. Wireless capacity and battery. Levers: duty cycling, compress, send numbers continuously and waveforms on request.
  6. Retention. Waveform history is large. Levers: store full waveforms only around events, keep trends for longer, chunked time-series storage with partition-level deletion.
  7. Software assurance. Each change must be re-verified. Levers: regression suites on recorded waveform databases, modular alarm logic with explicit state machines, static analysis in CI.

Failure modes

FailureSymptomCauseFix
Alarm fatiguestaff ignore or silence alarmsmany short, non-actionable alarmsdelay timers, signal-quality gating, patient-specific limits, review alarm statistics
False asystolealarm on a healthy patientlead off or flat artefact treated as no beatstechnical alarm for lead-off, require multi-lead agreement
Missed arrhythmiano alarm on a real eventadaptive threshold too high after a large artefact, or beat detector misses wide beatsthreshold recovery logic, searchback, test on annotated databases
Wrong SpO2 under motionreadings drop or jumpmotion corrupts the PPG ratiomotion-tolerant filtering, quality flag, hold last good value with an age indicator
Silent monitorscreen frozen, no alarmacquisition or alarm task hungwatchdog tied to task progress, independent fallback alarm
Time skewalarm from one device appears out of order in the recordunsynchronised clocksClock synchronization and timestamps from the source, not the receiver
Lost or repeated alarm messagecentral station shows an old or missing alarmlink retries with no sequence checkscounter and CRC end to end, state refresh at intervals
Dropped battery without warningpack diesstate-of-charge estimate wrong at cold temperature or after agingtemperature-aware model, margin on the warning threshold, filter SoC with voltage correction
Record mismatchobservation filed against the wrong patient or the wrong timeidentity or timestamp error in HL7 mappingverify patient association at admit, validate messages on receipt, acknowledge only after storage
Noisy trend gapsholes in trends after reconnectbuffered data discarded on restartpersist buffers, replay by sequence number

Real implementations

namewhat it isrepolicencenotes
OpenICE (MD PnP)open-source integrated clinical environment for connecting medical devicesmdpnp/mdpnpBSD-2-Clause (per LICENSE)research and prototyping platform; supported devices listed in the repo
sdc11073Python implementation of IEEE 11073 SDC (service-oriented device connectivity)Draegerwerk/sdc11073MITmaintained by Dräger
WFDB for Pythonread, write and process physiological signal and annotation filesMIT-LCP/wfdb-pythonMITused with PhysioNet datasets
NeuroKit2Python toolbox for ECG, PPG, respiration and other biosignal processingneuropsychology/NeuroKitMITresearch and prototyping, not a certified monitor

Philips IntelliVue, GE CARESCAPE and Masimo are proprietary medical devices; they are named only for orientation. None of the open-source projects above is a cleared medical device on its own.

The alternative: a consumer or research wearable that streams raw data to a phone and computes the metrics there. It is cheap and useful for wellness and studies; it is not a substitute for a regulated monitor where an alarm must reach staff within a defined time, work offline, and come with a risk file and a software lifecycle.

Sources

  • PhysioNet, MIT-BIH Arrhythmia Database. dataset
  • OpenICE: repo; sdc11073: repo; WFDB: repo; NeuroKit2: repo
  • J. Pan and W. J. Tompkins, A Real-Time QRS Detection Algorithm, IEEE Transactions on Biomedical Engineering BME-32(3), 230-236, 1985. paper
  • IEC 60601-1-8 (alarm systems), IEC 62304 (medical software lifecycle), ISO 14971 (risk management) and IEEE 11073: standards, cited by number (no free public text)

Similar systems

Share the most building blocks with this one.