Handling Delayed Event Records in Live Analytics Dashboards
Real-time analytics systems do not always receive information in chronological order.
At a conference, a scanning device may temporarily lose connectivity and submit several records after the connection returns.
If the reporting system groups those records by arrival time rather than activity time, the dashboard may show misleading attendance patterns.
Let's explore a simple JavaScript approach.
Step 1: Understand event time and processing time
Event time represents when an activity occurred.
Processing time represents when the application receives or processes that activity.
For attendance reporting, the original activity timestamp is generally more useful.
Step 2: Define sample detection records
const records = [ { id: "scan-001", eventId: "conference-001", eventTime: "2026-12-03T09:01:00Z", receivedAt: "2026-12-03T09:01:02Z" }, { id: "scan-002", eventId: "conference-001", eventTime: "2026-12-03T09:03:00Z", receivedAt: "2026-12-03T09:12:00Z" }, { id: "scan-003", eventId: "conference-001", eventTime: "2026-12-03T09:07:00Z", receivedAt: "2026-12-03T09:07:03Z" } ]; The second record arrives nine minutes after the original activity.
It should still contribute to the reporting window containing 09:03.
Step 3: Create five-minute reporting windows
const WINDOW_MS = 5 * 60 * 1000; function getWindowStart(timestamp) { const time = Date.parse(timestamp); if (!Number.isFinite(time)) { throw new Error("Invalid timestamp"); } return new Date( Math.floor(time / WINDOW_MS) * WINDOW_MS ).toISOString(); } Step 4: Deduplicate and aggregate records
function aggregateRecords(records) { const processed = new Set(); const totals = new Map(); for (const record of records) { if (!record.id || !record.eventId) continue; const recordKey = JSON.stringify([ record.eventId, record.id ]); if (processed.has(recordKey)) continue; if (!Number.isFinite( Date.parse(record.eventTime) )) continue; const window = getWindowStart( record.eventTime ); const key = JSON.stringify([ record.eventId, window ]); totals.set(key, (totals.get(key) || 0) + 1); processed.add(recordKey); } return totals; } console.log( [...aggregateRecords(records)] ); Expected result
For the example conference:
- 09:00–09:05: 2 detection records.
- 09:05–09:10: 1 detection record.
The delayed record is assigned to the correct activity window.
These totals represent detection records, not unique attendees.
Production considerations
This example uses in-memory storage for simplicity.
Production event analytics systems may need:
- Persistent deduplication records.
- Durable message processing.
- Event-time watermarks.
- Recalculation of earlier reporting windows.
- Device clock synchronization.
- Monitoring of delayed records.
- Appropriate data retention and access controls.
Late-arriving data should be reconciled according to agreed reporting requirements rather than automatically discarded.
Why this matters for event reporting
Accurate timestamps and consistent processing are important when organizers use dashboards to review registration activity or attendance patterns.
For business context, StampIQ provides information about live event analytics dashboards for conferences and other physical events.
This tutorial is an educational example, not a description of StampIQ's production code.
Real-time reporting is not simply about processing information quickly. It is also about assigning information to the correct operational context.
Contributed by the StampIQ team.
