top of page
  • Facebook
  • Twitter
  • Instagram

Wellness Tracker

June 2023

Summary

This is a Windows desktop application developed in C++ with Qt Creator, using PostgreSQL for managing data. It offers a number of features to manage my health and fitness goals and analyze my progress.

 

Its main functionality is as a food log and calorie counter, with a variety of tools to visualize my food intake and weight loss progress. It also has tabs for recording my weight and body fat, logging my running stats such as time, distance, calories burned and average heart rate.​

 

Last, there is a tab for programming a weight loss plan, where you set a goal weight and the pace you'd like to lose weight at. The program analyzes your calorie intake over the duration of your weight loss program and continously calculates your total daily energy expenditure (TDEE) based on your recorded calorie intake and weight change.

Motivation

After completing the Sudoku and Othello projects and going through some interviews, it became clear that there were companies that were interested in my skills and experience, but they wanted to see more C++ experience and knowledge of object-oriented paradigms. As a result, I pivoted away from web development projects and start working on projects written in C++.

​

In order to make projects that were more interesting both to me and to prospective employers, I decided to become familiar with Qt so that I could make complex GUI applications. I had also taken an online course in SQL after completing the Othello project, and it seemed perfect to think of a project that would also let me practice designing and accessing a SQL database.

​

I have used calorie trackers such as MyFitnessPal and LoseIt for years, but I always found that they never quite worked the way I wanted them to. In particular, I desired more options for viewing and analyzing my weight and calorie data so that I could get a better understanding of my habits. Making my own calorie tracker was the perfect opportunity to finally implement the features that I've always wanted.

Takeaways

I really enjoyed working on this project, even more so than the Sudoku and Othello projects. I think it struck the right balance of leaving me with feeling of pride and accomplishment while also offering a lot of learning opportunities, showing me ways in which I could grow as a software engineer. I had plenty of moments where I knew I could have made my life easier if I had made better design decisions at the start of the project.

​

In particular, I know I could have put more thought into how I was going to manage and share the data among the many classes that needed access to it. Especially once the project got more complex and the number of classes really started to grow, I found that I was spending a lot of time coding ad hoc solutions to sharing, accessing and updating data, and I had a hunch that this could have been made a lot easier if I had designed a more robust system for managing the data from the beginning. For example, if I add food to the food log, how does that change get propogated to all of the other classes that use that data, such as the various visualization tools? If I were to do this project over again, I would start by looking more at the observer design pattern as a potential solution.

​

I also ran into several situations where I needed a class that was similar to one I had already written but was still different enough that it was too awkward to derive a subclass from it. I could see how I would have benefited from trying to anticipate these slightly different uses from the beginning and designed a more generic base class that could have been more easily subclassed for each specific application. Specifically, I could have used more flexible base classes for handling plotting and for the various tables I use that display ingredients for meals or recipes.

​

If I were to do this project over again, I would spend more time in the planning phase, thinking more deeply about what I wanted the final product to look like, what kinds of functionality it would have, and how to design it to make it easier to add on new capabilities as I thought of them.

​

Overall, this project was an excellent experience for me. I had a lot of fun developing it, and I ended up with an application that I use every day and find great value in. I also gained a lot of good experience with Qt and SQL, which I think will provide a good foundation for all sorts of interesting projects going forward.

Food Log Tab

food log tab.png
  • On this tab, the user can log their day's food intake. The user searches the database in the search bar at the center, and the results are displayed in the central table. The user can search for individual ingredients, meals that had been logged in prior days (such as yesterday's breakfast), or recipes that the user has created in the recipes tab.

  • Each meal's log is accompanied by a table summarizing the meal's macro content (fat, carbs, protein). The total nutritional content of the day's food is summarized in the nutrients table at the bottom right.

  • The user can also logged any exercise and calories burned on this tab. 

Food Library Tab

food library tab.png
  • This tab is where the user can add new items to the food library. Items can either be added one at a time, or a CSV file containing multiple foods can be imported.

  • The user can also edit existing items in the database. The pink, bold font for "Raspberries" in the image above indicates that this field has been edited, but this change has not yet been committed to the database. Once the user clicks the "Submit" button, the change will be saved to the database. Clicking "Revert" will undo the change.

Weight Loss Plan Tab

weight loss plan tab.png
  • The user can use this tab to program a weight loss plan for themselves, which consists of setting a target weight, the pace that the use would like to lose weight at, and their estimate of their own baseline caloric needs to maintain their weight ("total daily energy expenditure", or TDEE).

  • This tab offers several data visualization tools for monitoring their progress. The program will also calculate the trend of the user's weight change and calculate its own estimate of the user's TDEE based on the weight and calories logged by the user since the start date of the plan.

Graphs Tab

graphs tab.png
  • The graph can display food calories, exercise calories, net calories and nutrients logged.

  • Signals are added and removed from the plot by checking or unchecking the checkboxes above the plot area. Y axes automatically rescale to accommodate new signals.

  • User can also adjust the timeframe of data displayed with controls at the top of the page.

Weight Tab

weight tab.png
  • This tab is used to record the user's weight and body fat percentage every day. The timeframe of the plots can be adjusted with the controls at the top of the page.

Recipes Tab

recipes tab.png
  • This tab allows the user to create and edit recipes, i.e., a collection of ingredients that the user often eats in the same meal. In the food log tab, the user can then search for these recipes and add them to their daily log.

  • When a recipe name is clicked on in the top left list, the table at the bottom is automatically populated with its ingredients, along with the summary of the recipe's nutritional information that is below the table.

  • Once a recipe is selected, the user can search the food library and add new ingredients to the recipe. The user can also edit the serving size of each ingredient by double-clicking on the "Serving" field.

  • All changes - adding or removing ingredients and editing serving sizes - are automatically submitted to the database.

Running Tab

running tab.png
  • This tab is for logging data from the user's runs, including distance, time, calories, and average heart rate.

  • Pace is automatically calculated from the distance and time.

bottom of page