I’ve long been interested in quantifying various aspects of health. Over the last few years I’ve developed several scripts for analyzing my own health, and I’m sharing them in a series of blog posts.
The first one in the series is one I call FoBot (the Food Robot, download it here). Basically, it’s a program that tells you what to eat in order to hit all of your nutritional goals. Suppose you wanted to eat a certain number of calories in the day, and that you also wanted to eat a certain amount of protein, a certain amount of fat, and a certain amount of fiber. Or maybe you follow a ketogenic diet and have a limit on the number of carbs you can eat. Apps like MyFitnessPal help you keep track of what you’ve eaten, but they’re less helpful when it comes to telling you what and how much to eat. Eat This Much helps you prepare meal plans that meet your goals, but to be honest I don’t want to cook or plan meals in advance. I just want to go to the grocery store once in a while and buy what I like; I don’t want to worry about buying ingredients for a certain meal.
That’s where FoBot comes in. FoBot tells how how to meet your calorie and macronutrient goals by eating what you already have. When you go to the grocery store you choose what you want to buy, and when you get home you enter the items into the program’s input spreadsheet. Think of it like a virtual pantry. Every day, you log whatever you already ate into the spreadsheet, and the program will tell you how much you need to eat to meet your goals. You can even give every item in your pantry a cost that the program will minimize, helping you prefer certain foods over others.
But what if you had a big lunch and can’t meet your goals for the day? Fortunately, FoBot lets you prioritize your goals. When some of them can’t be met, the lowest-priority ones will be sacrificed in favor of the high-priority ones. For example, maybe your highest-priority goal is a protein minimum, followed by a calorie maximum. If you’ve already eaten too much you may not be able to meet both constraints, so the program will tell you what to eat to meet your protein minimum while going over your calorie maximum as little as possible.