Plan your Diet with Shiny

Plan your Diet with Shiny

Posted by Matthew Boccio

Updated: May 4, 2020

At one point or another, most of us have made personal goals to eat more nutritious, balanced meals. Whether your goal is to drop a few pounds, have more energy, put on muscle, or just feel better throughout the day, managing one's diet is a key way to achieve all of this. Nutritionists and dietitians declare that the best way to achieve this is to have a balanced diet full of fresh, whole produce.

But being able to know whether you're getting the right balance of nutrients from this food isn't easy. Try going to the grocery store, and finding the calorie and vitamin breakdown of some of your favorite foods, and the result is often the same: your favorite vegetable, or fruit, or cut of meat, is completely unlabeled. And the task of looking up each piece, and doing the math of what calories you're getting based on how much you think it weighs, is cumbersome. With this in mind, I designed my Shiny app - Pocket Nutritionist - to be an interactive tool where users can select any food they desire, and find all the information about it that they would need to plan a healthy, balanced diet. 

The app consisted of three main parts: 

The first was a food group comparison, where you would be able to see how different foods compared to one another based on specific macro-nutrients. Does beef have more protein than pork or chicken? Which food group has the highest sugar content? What food groups should I be eating if I wanted to do a keto diet, and I needed a high fat intake? The first page of the app intends to provide easy-to-read graphs that answer all of these questions, and lets you pick specific foods based on the type of diet and nutrient intake you're looking for. 

Second, I created a display panel that lets you compare your individual food choices to the food group it belongs to as a whole. Say you wanted to pick a high carb bread or wrap to include in your lunch, but wanted to pick a type that had low sugar. This tool allows you to see how your specific food choices stack up with the greater whole, giving you more confidence in picking specific items. 

The third and final page of the app is where you're able to commit your choices to a diet plan. Included in the layout is a table, provided by the USDA, that allows you to look up your daily recommended calorie input based on your age, gender, and daily level of physical activity. Once you've recognized what your body needs, it's time to head over to the interactive diet planner, which lets you select multiple foods and see the total calories and macro-nutrients displayed for the sum of all your choices. The reactive pie chart also breaks down your macro-nutrients by percentage, letting you see if your diet is as balanced as you would like it to be. We provide recommended nutrient balances, as outlined by the USDA's dietary guidelines, but feel free to plan your diet according to your needs! 

I plan to use this app personally, and keep improving its functionality to include better available data (micro-nutrient content, additional foods, etc.) because I want to make planning my own healthy meals as easy as possible. So whatever your dietary goals or needs are, I hope that you get as much value out of this app as I do, and hope that every time you're in the grocery store, you know you can rely on your pocket nutritionist for help! 

Matthew Boccio

Data Scientist with the ability to quickly dissect complex problems, provide thoughtful detailed analysis using data-driven tools and business intuition, and communicate solutions clearly to relevant stakeholders. I believe in the power of data science and its potential to unlock knowledge that can benefit businesses, further our understanding of the world, and help humanity as a whole. We have more complex data at our fingertips than ever before - with the right skills and tools, we have the ability to unravel meaning from this complexity, and quickly discover novel answers to any question we have the creativity to ask.

View all articles

Topics from this blog: R R Visualization R Shiny

Interested in becoming a Data Scientist?

Get Customized Course Recommendations In Under a Minute