Newborn app using Twitter and R (entering the data)

In a previous post, I described a simple, quick and easy solution for recording newborn feedings, dirty diapers and just about anything of interest. Here's the first part of the implementation: entering the data.

The basic idea is everyone logs data to a single Twitter account. As long as everyone uses the same keywords, all is good in the world. 🙂

Step 1: Setup a Twitter account

Go to and sign-up for a Twitter account.

Step 2: Protect your tweets (optional)

If you'd rather not have the whole world see your logs, protect your tweets. Go to Settings > Security and privacy > Privacy > Tweet privacy and select Protect my Tweets.


Step 3: Start logging your baby's data.

Anyone who wants to log baby data just needs to log into the Twitter account created above (in Step 1). With just a few rules about how data is logged, you'll have a flexible, simple, quick and easy system.

Feedings are logged in the format:

100 ml

Case does not matter and the space between the number and "ml" is optional. If "breast," "breastmilk" or "bm" is included in the same tweet, the feeding volume is interpreted as breastmilk rather than formula. At this moment, logging both formula and breastmilk in the same tweet is unsupported.

Dirty diapers are logged with either the "poop" or "pee" keyword. These can be logged together or with the feedings. In other words, this would be fine:

120ML big poop and some pee

Why Twitter?

The choice of Twitter as the mechanism for logging data has a number of advantages as well as disadvantages.

Here are a few of the advantages:

  • The data being logged is free format, so anything considered relevant can be logged and reviewed.
  • There are Twitter clients on just about every platform (iOS, Android, WP and web) which makes it super easy to tweet the baby data.
  • Tweets are timestamped, so the log data can be associated with a specific day and time.
  • Persistence of the data is outsourced to Twitter.
  • Occasionally, I tweet an aggregation of the data to the Twitter feed. Since everyone is already viewing the feed, this is a very convenient place to show trends, totals, etc.

And some disadvantages:

  • The free format makes it difficult to extract information, since there could potentially be data entry typos.
  • Twitter prevents duplicate tweets from being posted. However, merely adding some unique comment is enough to work-around this annoyance.
  • This system takes a hard dependency on Twitter and it being available. If it's offline, so is this system.
  • Since this system relies on Twitter, the client must be online.

In a future post, I'll dive into the R implementation for data analysis.

About the Author

Ray Li

Ray is a software engineer and data enthusiast who has been blogging for over a decade. He loves to learn, teach and grow. You’ll usually find him wrangling data, programming and lifehacking.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.