Skip to content

Bachelor thesis - Android application for nutrition control with adaptive meal plan generation

Notifications You must be signed in to change notification settings

alfonzii/Nutritional-assistant

Repository files navigation

IN CONSTRUCTION. README NOT FINISHED YET AND ONLY IN CONCEPT VERSION.

Nutritional-assistant

Simple android application for nutrition control and weight goal achievement with adaptive meal plan generation created in Java with Android SDK.

Biggest asset of this application in comparison to similar nutrition control/manager apps on market is that users don't have to strictly obey given meal plan. Instead, they can deviate from it if needed and still be able to meet their nutrition limits and goals by using application's adaptive meal plan re-generation.

Quick overview

Application helps it's users to get dreamed weight in relatively painless, straightforward and healthy way. User provides 6 parameters (sex, age, weight, height, current lifestyle, weight goal), from which are daily nutrition intake limits calculated to meet chosen weight goal. Afterwards, user can generate daily meal plan that many times as he needs, to be finally happy with the one generated (beware of API request limit in this version of app). Generated meal plan satisfies nutrition limits as much as possible. Application also supports adding foods from provided databases manually. Adding food manually breaks generated meal plan, because it changes assumed nutrition intake. User can deal with such sitations by using application's adaptive re-generation of meal plan, so it's now possible for user to add his own foods to meals and be sure that in the end, his nutrition limits will be satisfied.

User manual

Main activity

On MainActivity you see overview of your daily food intake, generated meal plan and manually added foods. You got four main options from this activity:

1. Add food (floating button)
2. Reset
3. Settings
4. (Re)Generate meal plan

Other actions you can do on MainActivity:

  • Checking generated food – changes it's state and adds or subtracts it's nutrition values from daily intake
  • Swiping left manually added food – removes it from nutrition manager
  • Clicking on any (manual/generated) food – opens OverviewActivity with details of given food

Screenshots

TODO Main activity screenshots

1. Add food

Clicking food adding button gets you to a FoodAddingActivity, from where you can search and filter foods you want to manually add. To actually search for foods you have to hit search button on keyboard. Application doesn't give suggestions to keywords. This is intentional feature, trying to minimize API calls to API servers, because of daily API request limit. After you choose what you want to eat or have eaten, OverviewActivity of given food will be shown so you can set quantity, serving size and meal where to add food. Hitting ADD button adds food into your log.

Manually adding food for the first time a day

When you manually add food to your log for the first time in a day, you will be presented with 3 options to choose from. That happens because you are deviating from generated meal plan and application needs to know, how to act accordingly. These options are:

  • Cheatday – tells application to not bother with any adaptive re-generation settings for meal plan. Basically, choosing this option makes app ignore any manually added food.
  • Nextday – application will transfer any caloric excess from this day to next day at the end of the day. On next day, application will generate meal plan considering this caloric excess (will generate plan from your recommended daily caloric intake minus caloric excess from yesterday), so in total it will be the same caloric intake for both days.
  • Thisday – application will generate till the end of the day such meal plans, that considering manually added food, it's still able to keep to daily nutrition limits as much as possible.

Choosing one option makes it permanent till the end of the day or reset.

2. Reset

From main screen you got option (in action bar) to reset your daily food income and adaptive feature (if set). Simply press the button and you are back to 0s.

3. Settings

Clicking Settings action button presents you with 2 options:

1. Nutrition settings
2. User parameters

Nutrition settings

In nutrition settings you can set your daily nutrition limits. You can choose from manual or automatic setting. From manual you can set limits manually, but most of time, automatic is sufficent. If you choose automatic, then you are asked about your current lifestyle (sedentary, mild activity, medium activity, high activity) and what is your weight goal (gain, lose, maintain). After entering these, app calculates your daily nutrition limit. Prerequisite to this automatic calculation is entering your parameters in UserParametersAcitivty. If you haven't entered them, app won't let you do automatic calculation and will ask you to enter them.

User parameters

For application correct functioning when using automatic nutrition settings, you are required to enter your physical parameters here.

4. (Re)Generate meal plan

After User parameters and Nutrition settings are set, clicking on RE-GENERATE button generates a meal plan satisfying calculated nutrition daily limits as much as possible. If generated meal plan is unsatisfactory, clicking button again gives some other meal plan. Generated foods which are already checked won't be re-generated.

Technical details

Food types

Three food types are supported:
1. Product
2. Recipe
3. Restaurant food

Recipes are recipes, restaurant foods are foods available from restaurants in user vicinity and products are everything else, which is not recipe or restaurant food.

Application supports Restaurant food in USA regions. It means, if there are any restaurants nearby user, their food can be found in manual food adding by setting food type filter to Restaurant.

For now, application doesn't implement GPS support and setting of radius in which to consider restaurants. To tweak with this functionality, you have to change NutritionixDMS class constant fields coordinates and radiusMeters.

API request limit

By using Nutritionix and Spoonacular free plans, application is limited by their daily API requests limit. Application got default provided authorization keys for both services, but it's HIGHLY RECOMMENDED you provide your own keys so you can manage your API requests consumption.

Instructions to provide custom authorization keys for Nutritionix and Spoonacular

TODO

Minimum Android Version

  • Android 6.0 Marshmallow (API 23)

Tested on devices

  • Nexus 5X (API 29, x86 emulator)
  • Huawei P8 Lite (Android 6.0, API 23, physical device)

Known issues

TODO

TODO

  • Implement Database
  • Implement Intake overview
  • Use View Binding ✔️
  • Make activity hierarchy in AndroidManifest.xml to be able to use "back" action button
  • In food adding dialog popup change number picker to number entering (number picker was used just for personal learning purposes)
  • Use external solution with API for foods (right now I'm using just local database with cca. 1K of entries)

Dataset

Powered by Nutritionix & Spoonacular API

About

Bachelor thesis - Android application for nutrition control with adaptive meal plan generation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages