Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meal planning algorithm for short trips #7

Open
andreygolubkow opened this issue Sep 1, 2023 · 0 comments
Open

Meal planning algorithm for short trips #7

andreygolubkow opened this issue Sep 1, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@andreygolubkow
Copy link
Member

andreygolubkow commented Sep 1, 2023

Meal planning algorithm for short trips

See #10

As a leader of trip, I want to make a meal plan
To provide a balanced and tasty dishes

Acceptance criteria

  1. Data structures from Meal recipe editor for Meal planning feature #10 should be used
  2. MealPlanningService.ts should be created at `src/services/', it contains all business-logic for this feature
  3. The service has a public function GetMealPlan(arrive, leave, tourists, blacklist, whitelist):MealPlan with arguments:
    1. Camp arriving time - date and time, when the user starts living in camp(DateTime)
    2. Camp leaving time - date and time, when the user wanted to leave from their camp(DateTime)
    3. Tourists count - a number which describes how much tourists wants to eat in the trip(Number)
    4. blacklist - list of ingredients, if any meal contains that, the meal should be excluded from planning algorithm(Array of String)
    5. whitelist - list of ingredients which are preferred by team
  4. MealPlanningService gets meal recipes from json file, which are placed in the project(see Meal recipe editor for Meal planning feature #10)
  5. The algorithm of planning:
    1. The first step is to load meal recipes from json file, and exclude meals which contains ingredients from blacklist
    2. The second step of planning is to calculate eating times and classify it by (use EatingTimes enum) :
      1. +1 eating time for time from 06:00 AM to 12:00 PM - EatingTimes.Breakfast
      2. +1 eating time for time from 12:00 PM to 06:00 PM - EatingTimes.Lunch
      3. +1 eating time for time from 06:00 PM to 00:00 AM - EatingTimes.Dinner
    3. Check, that 50% of dishes contains preferred ingredients, if not, change it to have preferred ingredients
    4. Make MealPlan object (see tech details)
    5. Choose any dish for each eating time from MealPlan by random function and following requirements:
      1. One eating time contains one main dish, one beverage, one dessert
      2. Use Recipe->SuggestedFor property, to find which dish is most compatible with eating time
    6. Calculate summary of ingredients using tourists count, for example 100 gram of rice for one person * 4 persons = 400 gram
    7. Return the meal plan
  6. Unit tests should be created in ./tests/services/MealPlanningService.spec.ts

Technical details

Data structures

class MealPlan{
    meals: Dictionary<Date, MealPlanItem>,
    created: DateTime;
    ingredientsBlacklist: String[],
    touristsCount: number,
    arriveDateTime: DateTime,
    leaveDateTime: DateTime
}
class MealPlanItem {
    eatingTime: EatingTimes,
    dishes: Dictionary<DishType, SummarizedRecipe>   
}
class SummarizedRecipe {
    dishName: String,
    guide: String, //text how to cook the dish
    totalIngredients: Dictionary<Ingredient, number> // Ingredient->Qty * touristsCount
}

Useful links

TypeScript classes

Jest Testing: A Helpful, Introductory Tutorial

@andreygolubkow andreygolubkow added the enhancement New feature or request label Sep 1, 2023
@andreygolubkow andreygolubkow self-assigned this Sep 1, 2023
@andreygolubkow andreygolubkow changed the title [WIP] Meal planning for short trips [WIP] Meal planning algorithm for short trips Sep 29, 2023
@andreygolubkow andreygolubkow added internal Internal tools, refactoring, improvements and removed internal Internal tools, refactoring, improvements labels Sep 29, 2023
@andreygolubkow andreygolubkow added this to the MVP milestone Sep 29, 2023
@andreygolubkow andreygolubkow removed their assignment Oct 7, 2023
@andreygolubkow andreygolubkow changed the title [WIP] Meal planning algorithm for short trips Meal planning algorithm for short trips Oct 7, 2023
@andreygolubkow andreygolubkow moved this from Todo to In Progress in TAKT Website Jan 10, 2024
@andreygolubkow andreygolubkow moved this from In Progress to Todo in TAKT Website Jun 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants