Happiness Monitoring In The Cloud

Jacopo Aliprandi
Quantyca
Published in
4 min readMay 28, 2019

Do you think that monitoring and reporting your company happiness is impossible? In this post, I’ll describe Quantyca Happiness monitoring, a serverless solution to deliver happiness surveys to our colleagues.

Photo by Fausto García on Unsplash

We can monitor everything, except for our team morale. We decided to fix it.

What is corporate happiness? Have you ever thought about asking your employees this question? We do!

We spend a lot of our time in the office. It is an ecosystem where we interact with different people, complex situations (projects, technologies) in different environments (offices, customer site, etc.). So we started a project with the goal of measuring our corporate happiness!

We work on the concept of aggregate work happiness. Day by day, week by week we will study it and try to understand its dynamics, the elements, and events that contribute to its evolution. We will observe aggregate trends and also personal ones.

Happiness index will inspire moments of reflection and action both on the individual person and on the group.

…to the solution

What do we ask to our colleagues? To vote.

Express weekly their sentiment about the week just passed, about relationship with colleagues or customers, progress of the projects, technological achievements and acquisition of new skills, recognition of our work, problem solving, etc..

The idea is simple:

  • just asking our teammates how it is going
  • gather happiness indexes in a table
  • and then build an evergreen old-school report that can show us trends

So simple that we had to come up with something to complicate it.

The Architecture

First of all, we wanted to have some fun with Google Cloud Platform. To do so, we took a serverless approach, integrated with the already existing DBMS. Thus we built from scratch an infrastructure to send email based surveys and gather happiness indexes.

The following image shows an overview of the architecture we built:

Quantyca Happiness Monitoring Architecture

The components of the infrastructure can be separated according to three different concerns:

  • Campaign Management: generates the campaign by selecting the target email addresses. It defines the campaign parameters and eventually sends the customized email.
  • Happiness Index Gathering: a micro-application allows the user to send the survey results by clicking on a bunch of smilies in the email.
  • Reporting: the final report where all the obscure mysteries are revealed. It is backed by our company HR DBMS.

To keep all this stuff secure we looked for a cheap and completely stateless solution. So we opted for the use of JSON Web Tokens. JWTs are generated by the campaign manager and filled with the correct parameters. In this way, only a user who received an original email from the campaign manager can submit his/her weekly happiness index. Nonetheless, the certified parameters in the JWT prevent jokes from colleagues changing each other results.

The Happiness Journey

Campaign manager: target list extraction

Everything starts with Cloud Scheduler. Every Friday at 1 PM it publishes a message on a PubSub topic that almost immediately triggers the first Cloud Function.

Its duty is to extract from our DBMS the target list of the campaign. For each individual in the target list, a new message is published on another topic. This message contains the user id, the email address, and the campaign date: all the parameters needed to send the email and gather the data correctly.

Campaign manager: email sending

This second message wakes up the second cloud function in charge of:

  • generating the JWT containing user identifiers and campaign date
  • populating the email template
  • eventually sending the email

Gathering data

Eventually, a notification pops up on the team smartphones. A new incoming email!

The click of a smiley triggers the third function and the happiness index is written in a table of the Cloud SQL DB.

Reporting

The last step of this journey is to finally see the data through a Data Studio report. Here it is!

Quantyca Happiness Report

Conclusion

  • Time spent: low
  • Infrastructure Costs: free tier
  • Fun & happiness of the developers: high

Many thanks to Matteo, Alessia and Giandomenico that participated with happiness in this little crazy project.

--

--