← Back

Attendance and Device Gateway

100+ biometric terminals, 7 institutions · 2024 to 2026

What it is

A gateway between a fleet of ZKTeco biometric terminals and the systems that need attendance data. No screenshots for this one, it is an API and a set of workers.

Things worth pointing out

Three ingestion paths, one pipeline

Devices push punches over the ADMS protocol, a worker polls them live over pyzk, and a scheduled tally reconciles anything missed. All three land in the same table behind a unique constraint on device, user and raw timestamp, so they can run at once without producing a duplicate record.

Fixing device clock drift

Devices were converting the GMT Date header themselves against a timezone offset that could not be controlled across a mixed fleet, and timestamps jumped every morning. The server now answers the time request with an explicit local time and offset baked in, on a 120 second resync, so the server is the only clock that matters.

Fleet operations as tasks

16 Celery tasks handle propagating users and fingerprints to every device, clearing device logs remotely, probing connectivity, and reconciling untransferred logs. Device failures alert over email and Discord.

Tenant partitioning

The fleet is partitioned across 14 scopes, a student and a staff application for each of 7 institutions, so all of them share one deployment while their data stays separate.