Baby Dashboard: Parenting enhanced with time series

7 min read Original article ↗

The Story behind it

I recently became a father and, I must admit, what a thrill. Having a little boy really changed my life, immersing me in an ocean of love. It also changed my schedule quite brutally. 

When you’re having a baby, you often hear the sentence “Every baby is different”. In our case, we heard it a lot, especially because when Louis came to life, he had respiratory problems. Nothing alarming, but the neo-natality department decided to keep him for 12 days. My girlfriend and I went to the hospital twice a day to take care of him. When we finally brought him home, he had an oxygen cannula. In addition to that particularity, there are a lot of medical follow-ups in Quebec after the birth of any baby. My days were a marathon of cuddling, changing diapers, baby bottles, and medical appointments. To help with the follow-ups, we started to log methodologically Louis’s life events, and we got hooked pretty fast to the cool insights we got:

  • How many meals were given in the last 24 hours?
  • How many hours did he sleep?
  • When should I bring people to the house and see him awake?
  • Are there any habits changing over time?

The Tech Stack

Requirements

  • I need an easy way to enter data in the system so my girlfriend and I can “punch” in some interventions from our phones. This has to be as low effort as possible, since we’ll be entering some events in the middle of the night.
  • I have to store the data in a database capable of handling more or less 30 events per day, for let’s say 3 years, so about 33,000 entries.
  • I need a way to visualize the data and obtain intelligence from it, so I can step up my parenting game.

So I started looking at the technologies around and found something that matched my plan. How to balance the concept of a complete time-series dashboard and the little time I have as a new dad taking care of a toddler. It needs to be top-notch, but I don’t want to spend a lot of time programming, or deploying infrastructure. And ideally, it has to be free. 

While I was designing the Baby Dashboard, we started to manually enter some interventions in a Google Sheet file, one line per intervention. It quickly became a burden, so I created a Google Form to fill the sheet more seamlessly. The form asks for a set of very simple metrics, and adds the timestamp automatically. Bonus points, I was able to add a shortcut on our home page of our cellphone. 

This was pretty good, and I could already start getting some intelligence using pivot tables and such tools. It was matching my size requirement (>40k lines) and was all accessible with our Google accounts on our phones.

Then, I thought about creating an ETL pipeline, extracting the data from Google Sheets, and loading it into an index so I can run a dashboard tool like Kibana on top of it. The main issue there was deployment. I had to run the ETL pipeline, the index and the reporting tools on some machines or deploy them as services using Docker. I investigated for about a day before stopping. This was against my “low effort” requirement.

And then, I realized some very powerful tools like Grafana could be leveraged to read the data directly from Google Sheets. Grafana offers a free-hosted tier, using my Google SSO, that perfectly fits the small scale of my experience. I created an organization in their cloud and got the infamous babydashboard.grafana.net URL. At that point, I was ready to rock.

Connecting Grafana to Google Sheet:

  • Install the plugin in your organization through the portal.
  • Create a Google API key.
  • Enter the sheet ID and the querying syntax to retrieve a set of data.

Here’s the final architecture, extremely simple, yet 100% free, cloud, secure, and accessible through our devices via our Google Accounts.

Building interesting Dashboards

Powerful dashboards are closely related to powerful calculation. When building dashboards, you can either pre-compute some metrics, or compute them on the fly. The baby dashboard relies mostly on the first option for a couple of reasons:

  • I can create complex formulas and equations directly in excel without deploying code.
  • The Google Sheet connector in Grafana is limited compared to a classic SQL request. It simply pulls data without joints or any complex operations.
  • Learning advanced features like Grafana data transformation was more demanding than processing the data in the sheet, which I was already familiar with.

I started creating tabs in the Google sheet to represent the information I wanted to display on the dashboard. To get aggregated results, Pivot Tables are used in conjunctions with some calculations like the =now() formula. A little tweaking was needed after I discovered that some of the calculations were static. After a bit of trial and error, I found the Google Sheet recalculation options, and got everything recalculated every minute, even when the sheet is offline.

Recommended by LinkedIn

The most useful metrics

Time since last changed/bathed: a classic time indicator relying on finding the last event of a type, and calculating the difference between when it happened and the current time. Fun to represent with gauges, so you can set custom thresholds on the metrics.

Time since last lunch/last diapers: almost identical to the Time since last changed/bathed metrics, this one is looking for the latest occurrence of two different events. For lunch, it combines breastfeeding sessions and baby bottles; I’ll let you guess the two options for diapers. The data is represented with large clocks. To make the dashboard more intuitive, all metrics related to food are pink, and everything related to hygiene is orange. 

Percentage of all metrics compared to their daily average: a very fun report, inspired by The Sims, that simply shows the completion level of each category of events based on the daily average of events. This is constantly updated so it adapts to the ever-evolving reality. This was realized by adding all events of the same kind every day through a pivot table grouped on the month-day value.

Totals of each category: a classic metric to see how many diapers or lunch was given to my child since we got him home. This was very handy to forecast diapers and baby wipes purchases.

Time series representations: those visualizations are displaying a given metric, like sleep time or quantity of milk per meal through time. Very useful to spot trends or behavioural changes.

The dashboard as a whole

When all metrics are together, the dashboard looks terrific! It works on my laptop, TV, cellphones, and my girlfriend loves it. We couldn’t go back to an existence without the Baby Dashboard.

What’s next?

I wrote this post with Louis by my side, from our house in Quebec City, on November 24, 2021, while on paternity leave from my job at Coveo

I'm now back at the office and this experience gave me a ton of ideas for the Product Insights team I’m building. This new team gathers time series events to detect trends and anomalies, and intelligently represents the data through dashboards for the whole R&D. Follow me on LinkedIn for more adventures!

Links with this icon were created by LinkedIn and links without it were added by the author.