DEV Community

Cover image for Calculating Session Attendance from RFID Event Records
stampiq
stampiq

Posted on

Calculating Session Attendance from RFID Event Records

Calculating Session Attendance from RFID Event Records

RFID-enabled conferences can generate multiple detection records for the same participant.

If an application simply counts every record, it may report more attendees than actually participated in a session.

Let's build a simplified JavaScript example that calculates unique session attendance.

Step 1: Define the session

const session = {
  eventId: "conference-001",
  checkpointId: "hall-a-entry",
  startsAt: "2026-12-01T09:00:00Z",
  endsAt: "2026-12-01T10:00:00Z"
};
Enter fullscreen mode Exit fullscreen mode

Our example uses a single entry checkpoint and a defined session time window.

Step 2: Create sample RFID records

const scans = [
  {
    eventId: "conference-001",
    attendeeId: "A101",
    checkpointId: "hall-a-entry",
    direction: "entry",
    timestamp: "2026-12-01T09:05:00Z"
  },
  {
    eventId: "conference-001",
    attendeeId: "A101",
    checkpointId: "hall-a-entry",
    direction: "entry",
    timestamp: "2026-12-01T09:06:00Z"
  },
  {
    eventId: "conference-001",
    attendeeId: "A102",
    checkpointId: "hall-a-entry",
    direction: "entry",
    timestamp: "2026-12-01T09:10:00Z"
  }
];
Enter fullscreen mode Exit fullscreen mode

There are three detection records, but only two distinct participants.

The attendee identifiers in this fictional dataset have already been resolved from their RFID credentials.

Step 3: Filter relevant detections

const start = Date.parse(session.startsAt);
const end = Date.parse(session.endsAt);

const validScans = scans.filter(scan => {
  const time = Date.parse(scan.timestamp);

  return (
    scan.eventId === session.eventId &&
    scan.checkpointId === session.checkpointId &&
    scan.direction === "entry" &&
    Boolean(scan.attendeeId) &&
    Number.isFinite(time) &&
    time >= start &&
    time < end
  );
});
Enter fullscreen mode Exit fullscreen mode

This prevents records from unrelated events, checkpoints or reporting periods from being included.

Step 4: Calculate unique attendance

const uniqueAttendees = new Set(
  validScans.map(scan => scan.attendeeId)
);

console.log({
  totalDetections: validScans.length,
  uniqueAttendees: uniqueAttendees.size
});
Enter fullscreen mode Exit fullscreen mode

Expected output:

{
  totalDetections: 3,
  uniqueAttendees: 2
}
Enter fullscreen mode Exit fullscreen mode

The result distinguishes raw activity from unique participant attendance.

Additional production considerations

Real-world systems may require:

  • Credential-to-attendee mapping.
  • Reader direction verification.
  • Stable detection identifiers.
  • Delayed event processing.
  • Database-backed aggregation.
  • Session overlap handling.
  • Appropriate data protection controls.

This example measures unique participants detected at an entrance during a session window. It does not prove that every participant remained for the entire session.

For additional event industry context, StampIQ provides information about real-time event analytics and reporting.

The key takeaway is simple: define what attendance means before counting RFID records.

This educational example is contributed by the StampIQ team and is not production-ready software.

Top comments (0)