This lab will build us from basic knowledge in a programming language like NodeJS or Python into a chart displaying moods and recent nutrtion in incremental steps.

  1. Enter one week of receipts into a CSV file

    1 hour

Using your favorite spreadsheet program you can enter the receipts and save the file as CSV into your project directory.

We can start with a simple set of fields:


  1. Load the CSV file with your programming language.

    4 hours

  2. Load the Tweet archive

    8 hours

The Tweet archive contains a file tweets.js which can be loaded directly into JS with the namespace initialized. Massaging can be done to load it as JSON with simple string manipulation.

Open the file an examine the beginning to get an idea, and look at the JSON spec or examples of JSON to figure out how to make the file into a valid JSON file.

  1. Create a function to load Tweets and receipts within a time frame

    8 hours

This would be aided by a database engine but we can also iterate by hand to exercise our algorithm skills.

  1. Add a function to assign the latest receipt before a Tweet to the tweet

    16 hours

For each Tweet we will associate it with a single receipt, being the most recent one before the Tweet was made. This can be tweaked by hand but should be mostly true given an urban or European style of shopping for the current day of eating.

  1. Enter 3 more weeks of receipts and add the item data to the spreadsheet.

    4 hours

If you've used a relateional database then feed free to break it off into a second table and we can make an equivalent view by using a join query.

  1. Enter nutritional data for each item.

    8 hours

The data that is entered may vary. One example may be calories,protein,carbs,fat. More could be imagined including subjective scores of how the item makes you feel.

Here the value of using a database should be clear. The spreadsheet can be resorted and values copied down to all instances of an item with ctrl+d and again a join can emulate a spreadsheet with a view.

  1. Score the mood for each Tweet

    8 hours

There are existing methods to score the mood for a piece of text, and so the Tweets can each be scored and have the score saved with them.

  1. Create a chart that displays the moods for each tweet

    16 hours

Use mood as the Y axis and the time as the X axis; and the receipt's nutrition info on multiple Y axis with the receipt time on the X axis.