Skip to content
H
Engineering8 min read

Building an Employee Productivity Platform with Laravel

Session normalisation, aggregation jobs and why a dashboard should never query raw events.

  • Laravel
  • MySQL
  • Data Modelling
  • Dashboards

Activity tracking looks simple from the outside: collect events, draw a chart. The difficulty starts when you ask what any single event actually means.

A window that was open for forty minutes could be forty minutes of focused work, forty minutes of a document left on screen, or five minutes of work and thirty-five of an empty chair. The raw event does not distinguish them. The model has to.

Normalise before you store meaning

The first structural decision was that raw signals never reach a dashboard. They are normalised into sessions first — an application interval, a site visit, an active/idle classification — and only then aggregated.

php···
$session = ActivitySession::open($employee, $device, $startedAt);

$session->recordAppUsage($processName, $windowStart, $windowEnd);
$session->recordSiteVisit($host, $openedAt, $closedAt);
$session->classify($activeSeconds, $idleSeconds);

Doing it this way means 'active time' has exactly one definition in the system. Derived values computed in several places will eventually disagree, and disagreement destroys trust in a dashboard faster than a missing feature.

Aggregate on a schedule, not on request

Per-minute sampling across a workforce multiplies quickly. If a dashboard reads from raw events, response time degrades as history accumulates — the system gets slower precisely as it becomes more valuable.

Rollups are therefore rebuilt by scheduled jobs: daily, weekly and monthly summaries per employee. The dashboard reads aggregates; the timeline drill-down is the only place that touches events.

Three altitudes of the same data

  • Organisation overview — shape and trend, for spotting patterns.
  • Team view — comparison over time, for workload discussion.
  • Individual timeline — detail, for a specific conversation.

A manager moves between them rather than choosing one. Leading with a single productivity score would have been easier to build and much easier to misread.

The part that is not technical

Screenshots and website activity change the character of the data. They need explicit retention windows, and the interface language needs to describe them accurately. Workforce analytics and activity insight are honest descriptions of the aggregate view; surveillance is an honest description of a screenshot capture. Both exist on the platform, and pretending only the first one does would be dishonest.

Status

In progress. No metrics are published here, because there are no verified numbers to publish — and an invented one would be worse than none.

Written by Huzaifa Ahmed

Next step

Have something to build — or something to automate?

Tell me what the system needs to do. I will tell you honestly whether I am the right person to build it.