Following my success with extracting my Google Search History in a simple manner, I’ve decided that I should do something similar to extract all the data I’ve been feeding into myfitnesspal for the last 5 months. As I briefly mentioned in the review of the app + website, the progress graphs leave a lot to be desired and there’s very little in the way of analysis of the data. I have a lot of questions about my progress and there is no easy way to answer all of them using just the website. For instance, what is my average sugar intake? Is this more or less than my target intake? How does my weekend nutrition compare to my weekday nutrition? How much beer have I drunk since starting to log all my food?
Unfortunately there isn’t an API for the website yet, so I’m going to need to resort to screen scraping to extract it all. This should be pretty easy using the BeautifulSoup python library, but first I need to get access to the data. My food diary isn’t public, so I need to be logged in to get access to it. This means my scraping script needs to pretend to be a web browser and log me in to the website in order to access the pages I need.
I initially toyed with the idea of reading cookies from the web browser sqlite cookie database, but this is overly complex. It’s actually much easier just using python to do the login as a POST request and to store any cookies received back from that. Fortunately I’m not the first person to try and do this, so there’s plenty of examples on StackOverflow of how to do it. I’ll post my own solution once it’s done.
Another of the very useful apps I’ve been using since the start of the “New Regime” is Libra. It totally makes up for the crappy progress graphs on the MyFitnessPal website or in the mobile app.
It’s an app that has a singular purpose: it’s just for tracking weight. But it does it very well. You enter a weight for every day, it works out statistics based on those weights, calculates the trend value for your weight, (so smoothes out daily fluctuations caused by water intake etc), and predicts when you’ll hit your target. It performs a weekly backup of data to the SD card, and will export data in csv format too. Screenshots below:
Simple screen to enter a weight each day, date controls and a slider
The progress graph is displayed on the main screen, showing progress, predictions and BMI brackets
The statistics page shows details about your progress
The Libra app is available on the android market for free, with a paid ad-free version also available.
(The first in a series of posts on apps I’ve found useful under ‘the new regime’)
One of the best apps/services I’ve found for general fitness and nutrition and weight loss is MyFitnessPal. I’m fairly sure I wouldn’t have made quite as good progress without it.
The main selling point of the service is that it allows you to track what you eat and what exercise you do, in order to monitor and help regulate your calorific intake. When you create an account you put in the usual details as well as your weight and height, tell it how much activity you do on a daily basis and how much weight you’d like to lose, and it works out how many calories you should eat each day to hit that target. All you have to do is enter the food you eat (by searching the food database) and the exercise you do (cardiovascular/strength training can be entered separately) and it calculates your net deficit/over spend each day.
I’m a big sucker for life-logging, and logging each part of each meal takes this to the extreme. I now have almost 5 months of data on what I’ve been eating. Why I’d want this, I’m not sure, but it’s there now! The service also handles logging stats such as weight, waist, neck and chest measurements, although the progress graphs for these leave a lot to be desired. Like most good services, this is a website with associated mobile app, with android, iPhone and blackberry versions available. Some screenshots of the android app and the website are below:
The home screen gives you an overview of the days progress so far
You can add exercise into your diary, either from the list of your regular exercises or by searching for a new exercise
The diary screen shows you what you’ve entered under food for each meal, or what exercise you’ve added
The website includes progress reports, such as this net calories consumed histogram.
Progress graphs in the mobile app are even worse than on the website
Large database of foods with calorific and nutritional information
Easy logging of food and exercise, weight and measurements
Adjusts calorie allowance as weight changes
Social features – friends, forums etc
Mobile app makes it easy to log food or exercise while out and about
Easy to stay on top of calorific intake – actually helps with weight loss
Lots of support, encouragement and advice on forums
Can contribute to database if food is missing
Can report inaccurate data, up-vote correct data
Users can contribute to database and some users are stupid
Progress graphs are pretty useless
Mobile app and website sometimes disagree on calories burnt from exercise
The MyFitnessPal website is at http://www.myfitnesspal.com and the mobile apps are available here.
(thanks to my good friend Christopher for the initial heads up on this site!)
Since the beginning of the year I’ve been living under what we’ve been calling ‘the new regime’. This ‘new regime’ basically involves not living like a fat useless slob, so I’ve been getting fit, eating healthily and losing weight. So far I’ve lost over 10kg and can now run around the park a few times without collapsing to the floor clutching at my chest and screaming about ambulances, so I’d say its going pretty well. The basic concept behind the new regime is:
Eat less + do more = lose weight.
This will be followed once some weight has been lost by:
Eat a normal amount + do more = stay the same.
About a month ago, I came across someone somewhere on the internet recommending “The Hacker’s Diet” as a guide for weight loss. Not having read such a guide before I started on ‘the new regime’ I skimmed it a bit; the tl;dr version is:
Eat less + do more = lose weight.
This doesn’t exactly seem like rocket science to me, but lots of people seem to have a problem grasping this concept. The Hacker’s Diet does a pretty decent job of describing the human body as a simple system with inputs and outputs and manages to explain that if you limit your input and increase your output, you get a deficit and lose weight. So if you find anyone that says ‘Oh, I really struggle to lose weight’, slap them round the back of the head and point them in that direction.
The whole point of this post is that the last couple of chapters of the book contain a lot of information about tracking the calories you eat, the calories you burn, analysing trend from daily weight figures and so on. There’s a lot of detail on how to create spreadsheets to calculate weight trends, how to keep a daily log of calorie intake, and pages and pages of calorific information for food. The thing is, it’s 2011 now so none of those chapters are necessary, because as with anything that’s a pain in the rear end there are now loads of apps available to make life easier. As I’ve been using a number of them for 5 months I figure I’ll share the knowledge and review some of them over the next few days.