HomeCase studiesContinuous Pharmaceutical Cold-Chain Telemetry, Excursion Detection, and...

Case study · Basel, Switzerland

Continuous Pharmaceutical Cold-Chain Telemetry, Excursion Detection, and GxP Audit Platform

Pharmaceutical & Perishable Cold-Chain IoT

Biologics and temperature-sensitive clinical shipments degrade silently whenever reefers, passive thermal shippers, or staging warehouses drift outside validated thermal bands without immediate intervention. We engineered a cold-chain telemetry and compliance platform powered by Go ingestion workers, an MQTT broker mesh, TimescaleDB hypertables, and a React operations console. Edge loggers stream temperature, humidity, shock, and door-open events continuously—buffering offline across ocean and air legs—while server-side evaluators compute cumulative thermal exposure and produce 21 CFR Part 11-aligned release dossiers.

Industry
Pharmaceutical & Perishable Cold-Chain IoT
Solution
A Web and API cold-chain observability platform uniting high-throughput Go MQTT consumers, TimescaleDB time-series storage, automated excursion rules, and a React shipment command interface.
Platforms
Web & API
Stack
Go · MQTT · TimescaleDB · React · TypeScript · PostgreSQL
Location
Basel, Switzerland · delivered remotely
Role
Engineering, with the team behind for mobile and QA

Delivered remotely for a business based in Basel, Switzerland. Names withheld by agreement.

Project Overview

Biopharmaceutical distribution depends on unbroken environmental control from fill-finish suites through customs bonded warehouses, air-freight ULDs, and clinical dispensing depots. A single unmonitored compressor fault or tarmac delay can push monoclonal antibodies, mRNA payloads, or cell therapies outside validated 2–8 °C or ultra-low cryogenic bands, turning a high-value batch into a quarantine loss. Historically, quality assurance teams only discovered those excursions days later by plugging USB data loggers into receiving-dock PCs and manually stitching spreadsheets together.

To replace reactive post-mortem checks with continuous operational visibility, we architected and built a Web and API cold-chain telemetry platform using Go, MQTT, TimescaleDB, and React. The system ingests real-time and store-and-forward sensor streams from mobile trackers and fixed facility probes, evaluates cumulative thermal stability budgets as data arrives, and presents QA officers and dispatchers with cryptographically verifiable shipment histories.

Cold-Chain Telemetry Challenges

Engineering software for regulated pharmaceutical logistics introduces constraints rarely seen in consumer IoT dashboards:

  • Discontinuous connectivity across multimodal lanes: Air cargo holds, refrigerated ocean containers, and underground customs vaults routinely sever cellular links for hours or days, requiring deterministic store-and-forward reconciliation once signals return.
  • Strict regulatory traceability: Under Good Distribution Practice (GDP) and 21 CFR Part 11 expectations, every threshold breach, alarm acknowledgment, sensor calibration record, and batch disposition decision must carry non-repudiable operator attribution and timestamps.
  • Nuanced excursion semantics: A raw reading of 8.4 °C for ninety seconds while loading a pallet carries vastly different clinical risk than prolonged exposure or cumulative Mean Kinetic Temperature (MKT) drift across multiple legs.
  • High-cardinality time-series joins: Auditors do not inspect sensor streams in isolation; they inspect temperatures bound to specific lot numbers, lane SOPs, packaging qualification profiles, and courier handoffs.

Architectural Strategy

We structured the platform around a clean split between deterministic Go stream processing and transactional PostgreSQL/TimescaleDB state. Rather than treating time-series telemetry and relational shipment manifests as separate silos stitched together in application code, TimescaleDB houses both compressed sensor hypertables and normalized GMP metadata in one ACID-compliant database cluster.

MQTT 5.0 serves as the uniform ingestion fabric across heterogeneous hardware—bridging cellular real-time trackers, BLE cabin gateways, and fixed warehouse Modbus collectors. Stateless Go worker pools subscribe to partitioned shared MQTT topics, validate sensor schemas, deduplicate retransmissions, and update sliding excursion state in Redis before flushing batched writes into TimescaleDB.

Core Capabilities

  • Multi-Probe Shipment & Facility Live Views: React dashboards render route trajectories, ambient versus internal payload curves, battery health, light-tamper flags, and shock events across active lanes.
  • Stability Budget & MKT Evaluation: Configurable rule engines track continuous time-out-of-refrigeration (TOR), consecutive threshold breaches, and Arrhenius-weighted Mean Kinetic Temperature against product-specific stability limits.
  • Out-of-Order Backfill Reconciliation: When an offline logger uploads buffered readings from a completed flight, the evaluator automatically recomputes excursion intervals across the affected timeline without dropping live alerts.
  • Guided QA Disposition Workflows: Quality officers review flagged excursions alongside calibration certificates, record root-cause classifications, attach CAPA references, and apply reason-coded electronic signatures to release or quarantine stock.
  • Tamper-Evident Audit Dossiers: One-click dossier generation produces signed PDF and machine-readable CSV packages containing raw interval logs, alert escalations, and SHA-256 verification digests.

Technical Architecture

Field gateways and cellular probes publish compact CBOR or JSON telemetry envelopes over mTLS-secured MQTT connections using QoS 1 acknowledgments. Go ingestion workers consume partitioned broker streams, verify device provisioning status, evaluate real-time dwell timers via Redis, and execute bulk COPY inserts into TimescaleDB hypertables while emitting live updates over WebSockets to connected React consoles.

Flow: Cellular & BLE Cold-Chain Loggers → MQTT 5.0 Broker Cluster (mTLS + Shared Subscriptions) → Go Ingestion & Excursion Engine (Redis State Cache) → TimescaleDB Hypertables & PostgreSQL GMP Ledger → Go REST/WebSocket API → React QA & Dispatch Console

Within TimescaleDB, raw telemetry chunks partition automatically by time and device space, while background policies roll up hourly and daily min/max/average summaries into continuous aggregates. Older chunks compress natively into columnar storage without altering SQL query interfaces for historical lane qualification studies.

Technology Stack

Category Technology detail
Telemetry Ingestion & Evaluators Go microservices with concurrent MQTT subscriber pools
Device Messaging Transport MQTT 5.0 broker cluster with mutual TLS and persistent sessions
Time-Series Persistence TimescaleDB hypertables with continuous aggregates and compression
Relational & Audit Metadata PostgreSQL tables for lanes, stability budgets, and electronic signatures
Alert State & Deduplication Redis sorted sets and sliding-window alarm state caches
Operations & QA Console React SPA with live thermal charts and excursion workflows
Client Type Safety TypeScript shared DTOs and WebSocket telemetry contracts
Live UI Streaming Server-Sent Events and WebSockets pushed from Go API gateways
Report Signing & Exports Go PDF/CSV dossier generator with SHA-256 tamper hashes

Engineering Trade-offs & Solutions

Engineering Challenge Solution & Trade-off
Out-of-order offline logger backfills break naive streaming alerts Separated live threshold evaluation from a Go timeline-reconciliation worker triggered whenever recorded_at trails ingested_at; adds minor re-computation overhead on reconnect in exchange for mathematically accurate TOR totals.
High-frequency MQTT bursts risk saturating single-row database inserts Buffered validated sensor frames inside Go channels and flushed via PostgreSQL binary COPY batches every sub-second window; trades milliseconds of persistence lag for dramatically lower WAL I/O.
Direct raw scans across months of sensor data slowed multi-lane React views Built TimescaleDB continuous aggregates at 5-minute and 1-hour buckets paired with adaptive zoom queries in the Go API; slightly increases storage footprint while keeping chart pan-and-zoom instantaneous.
Hardware vendors reported timestamps in mixed local offsets and drift states Enforced strict UTC epoch normalization at the gateway/Go boundary and logged both device-reported time and broker-receipt time side by side for audit transparency.

Security & Reliability

Regulated logistics demands defense in depth from silicon to browser session. Every IoT gateway and standalone tracker authenticates to the MQTT cluster using unique X.509 client certificates mapped to strict topic-level ACLs, blocking lateral topic snooping or rogue payload injection. On the ingestion side, Go workers enforce strict schema bounds, reject implausible sensor corruption before persistence, and route invalid packets to a diagnostic dead-letter stream.

Inside the Web and API tier, role-based access control distinguishes read-only courier observers, logistics dispatchers, and QA release signatories. Electronic sign-offs require re-authentication and capture user identity, timestamp, signature meaning, and immutable SHA-256 hashes of the underlying telemetry slice. All database tables storing disposition decisions and alert acknowledgments are append-only, preserving a complete forensic chain across revisions.

Performance & Scale

Go's lightweight goroutine scheduler allows a compact pool of ingestion pods to maintain tens of thousands of concurrent MQTT session states and evaluate sliding thermal windows in memory with minimal garbage-collection pressure. Batching inserts into TimescaleDB hypertables avoids lock contention even when fleets of ocean containers reconnect simultaneously at port terminals.

On the frontend, the React console uses viewport-aware downsampling, memoized chart canvases, and selective WebSocket channel subscriptions keyed to filtered lanes or active exceptions. Dispatchers monitoring global cold-chain hubs experience responsive map and graph updates without downloading redundant historical raw points.

Operational Outcomes

Consolidating disparate logger portals and manual spreadsheets into a unified Go, TimescaleDB, and React platform reshaped daily quality and logistics execution:

  • Proactive in-transit intervention: Dispatchers spot cooling-unit drift and unexpected tarmac dwell delays while shipments are still recoverable, shifting teams from post-arrival write-offs to live corrective routing.
  • Audit-ready batch release workflows: QA officers replace multi-hour manual PDF compilation with linked thermal graphs, automated stability-budget verdicts, and signed release dossiers backed by immutable telemetry records.
  • Cross-lane carrier accountability: Lane validation engineers compare seasonal thermal performance across packaging configurations and freight partners using consistent, queryable TimescaleDB aggregates.
  • Confidence across connectivity gaps: Store-and-forward MQTT reconciliation ensures neither maritime crossings nor warehouse RF dead zones leave blind spots in final regulatory records.

01 — Questions

asked about this kind of project

How does the platform preserve data integrity when cellular loggers cross ocean freight or tarmac dead zones?

Edge gateways and smart probes persist sensor readings to local flash ring buffers with monotonic sequence IDs and hardware-backed timestamps. Upon reconnecting to the MQTT broker with QoS 1 delivery, Go consumers ingest historical backfills out of order into TimescaleDB while flagging whether an excursion occurred live or during an offline gap.

Why choose TimescaleDB over a standalone NoSQL time-series engine for cold-chain compliance?

Pharmaceutical batch release requires joining raw sensor series directly against relational shipment manifests, stability budgets, calibration certificates, and CAPA sign-offs. TimescaleDB inherits PostgreSQL transactional joins and foreign-key constraints while delivering chunk partitioning, columnar compression, and continuous aggregates.

How do you prevent false thermal alarms during routine warehouse dock transfers or probe defrost cycles?

Each lane profile pairs high/low static thresholds with configurable dwell-time windows and Mean Kinetic Temperature (MKT) accumulators managed in Go and Redis. Brief door-open spikes inside permitted grace intervals remain logged as telemetry anomalies without paging on-call QA officers.

How are out-of-order historical backfills handled without corrupting real-time excursion calculations?

Go ingestion workers route delayed frames into a re-evaluation queue tied to the affected shipment ID and time range. The excursion evaluator replays the sorted series over the impacted window, updating cumulative time-out-of-refrigeration (TOR) counters and recording an immutable audit revision.

What secures individual IoT loggers and prevents spoofed telemetry frames from entering GMP records?

Every gateway and cellular tracker authenticates to the MQTT broker using per-device X.509 certificates over mTLS, bound via ACL topics to its provisioned device identifier. Rejected certificates or malformed CBOR/JSON payloads are quarantined without touching TimescaleDB hypertables.

How does the React dashboard stay responsive when QA engineers inspect multi-week multi-probe shipments?

Go query endpoints serve precomputed TimescaleDB continuous aggregates at coarse resolution for full-route overviews and automatically switch to raw chunk scans only when an operator zooms into a narrow excursion window.

03 — Similar project?

describe what is different about yours

Build yours.

Tell me what exists, what you need and the deadline. Fixed price for a defined scope, or $55/day (8–9 hours work) with a written plan first.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.