├── setup.py ├── __init__.py ├── tests └── __init__.py ├── scripts ├── __init__.py ├── reboot_timestamps.py ├── iodata.py └── auxillary.py ├── data ├── soups.csv ├── salads.csv ├── sandwiches.csv ├── sidedishes.csv ├── maincourses.csv └── meal_list.csv ├── full_meal_rnd ├── data │ ├── salads.csv │ ├── soups.csv │ ├── maincourses.csv │ ├── sandwiches.csv │ ├── sidedishes.csv │ └── meal_list.csv ├── TODO.txt ├── main.py └── roadmap.txt ├── backup_and_templates ├── template_csv.csv └── bkp.meal_list.csv ├── requirements.txt ├── classes ├── README.txt └── classes.py ├── .gitignore ├── METADATA.md ├── initialize_data.py ├── LICENSE.md ├── roadmap.md ├── main.py ├── TODO.md ├── README.md └── CHANGELOG.txt /setup.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /scripts/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data/soups.csv: -------------------------------------------------------------------------------- 1 | ,Name,KosherType,Prep_Ease,Prep_Time,Cook_Time,Rank,Scaling,TA,times_made,Timestamp,recipe_suggestion,Name_HE 2 | -------------------------------------------------------------------------------- /data/salads.csv: -------------------------------------------------------------------------------- 1 | ,Name,KosherType,Prep_Ease,Prep_Time,Cook_Time,Rank,Scaling,TA,times_made,Timestamp,recipe_suggestion,Name_HE 2 | -------------------------------------------------------------------------------- /data/sandwiches.csv: -------------------------------------------------------------------------------- 1 | ,Name,KosherType,Prep_Ease,Prep_Time,Cook_Time,Rank,Scaling,TA,times_made,Timestamp,recipe_suggestion,Name_HE 2 | -------------------------------------------------------------------------------- /data/sidedishes.csv: -------------------------------------------------------------------------------- 1 | ,Name,KosherType,Prep_Ease,Prep_Time,Cook_Time,Rank,Scaling,TA,times_made,Timestamp,recipe_suggestion,Name_HE 2 | -------------------------------------------------------------------------------- /data/maincourses.csv: -------------------------------------------------------------------------------- 1 | ,Name,KosherType,Prep_Ease,Prep_Time,Cook_Time,Rank,Scaling,TA,times_made,Timestamp,recipe_suggestion,Name_HE 2 | -------------------------------------------------------------------------------- /full_meal_rnd/data/salads.csv: -------------------------------------------------------------------------------- 1 | ,Name,KosherType,Prep_Ease,Prep_Time,Cook_Time,Rank,Scaling,TA,times_made,Timestamp,recipe_suggestion,Name_HE 2 | -------------------------------------------------------------------------------- /full_meal_rnd/data/soups.csv: -------------------------------------------------------------------------------- 1 | ,Name,KosherType,Prep_Ease,Prep_Time,Cook_Time,Rank,Scaling,TA,times_made,Timestamp,recipe_suggestion,Name_HE 2 | -------------------------------------------------------------------------------- /full_meal_rnd/data/maincourses.csv: -------------------------------------------------------------------------------- 1 | ,Name,KosherType,Prep_Ease,Prep_Time,Cook_Time,Rank,Scaling,TA,times_made,Timestamp,recipe_suggestion,Name_HE 2 | -------------------------------------------------------------------------------- /full_meal_rnd/data/sandwiches.csv: -------------------------------------------------------------------------------- 1 | ,Name,KosherType,Prep_Ease,Prep_Time,Cook_Time,Rank,Scaling,TA,times_made,Timestamp,recipe_suggestion,Name_HE 2 | -------------------------------------------------------------------------------- /full_meal_rnd/data/sidedishes.csv: -------------------------------------------------------------------------------- 1 | ,Name,KosherType,Prep_Ease,Prep_Time,Cook_Time,Rank,Scaling,TA,times_made,Timestamp,recipe_suggestion,Name_HE 2 | -------------------------------------------------------------------------------- /backup_and_templates/template_csv.csv: -------------------------------------------------------------------------------- 1 | ,Name,KosherType,Prep_Ease,Prep_Time,Cook_Time,Rank,Scaling,TA,times_made,Timestamp,recipe_suggestion,Name_HE 2 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | click==7.1.2 2 | colorama==0.4.4 3 | numpy==1.22.3 4 | pandas==1.4.2 5 | python-dateutil==2.8.2 6 | pytz==2022.1 7 | shellingham==1.4.0 8 | six==1.16.0 9 | typer==0.3.2 10 | typer-cli==0.0.12 11 | -------------------------------------------------------------------------------- /classes/README.txt: -------------------------------------------------------------------------------- 1 | NOTHING, I MEAN NOTHIN' IS YET IMPLEMENTED HERE. 2 | I AM NOT SURE ANYTHING WILL EVER BE IMPLEMENTED HERE. 3 | IT WAS JUST AN IDEA OF HOW TO DO SOMETHING, YET THAT IDEA HAS NOT YET COME TO FRUITION. 4 | Fruition is a nice word, I like the way it rolls on my tongue. 5 | -------------------------------------------------------------------------------- /full_meal_rnd/TODO.txt: -------------------------------------------------------------------------------- 1 | 2 | # To Do: 3 | 1. look at roadmap and adjust it for Shabbat meals future needs and growth plan 4 | 5 | 6 | # Things to Add to functions: 7 | 8 | ## Features: 9 | 1. add main ingredient 10 | 11 | ## main.py calls and flags 12 | 1. add soup/no-soup flag 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ignore all csv files 2 | #*.csv 3 | 4 | # ignore all log file 5 | # current logfiles: meals prepared 6 | *.log 7 | 8 | # ignore __pycache__ 9 | __pycache__/ 10 | 11 | # ignore all .swp files, these are temporary files when using vim 12 | *.swp 13 | 14 | # file used for initiallizing meal list at beginning of project. 15 | initialize_data.py 16 | 17 | # ignore venv folder 18 | venv/ 19 | 20 | # ignore self-tutorial folders 21 | *_tutorial/ 22 | -------------------------------------------------------------------------------- /classes/classes.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Here goes the defined classes for the project. 3 | None are yet to be defined, but a categorical to numerical conversion for some features may be implemented here using the enum librrary. 4 | 5 | Affected features: KosherType, cook_time, prep_ease, prep_time, scaling. 6 | ''' 7 | 8 | from enum import Enum 9 | 10 | 11 | class KosherType(str, Enum): 12 | parve = "parve" 13 | milchik = "milchik" 14 | fleisch = "fleisch" 15 | nonkosher = "nonkosher" 16 | #kosher ::: kosher type [parve|milchik|fleisch] 17 | -------------------------------------------------------------------------------- /METADATA.md: -------------------------------------------------------------------------------- 1 | # Short 2 | This document will describe the structure of the data 3 | 4 | # Long 5 | 6 | 1. Name ::: meal name, English. 7 | 2. KosherType ::: kosher tag of meal, [parve|milchik|fleisch]. 8 | 3. Diet ::: (NOT IMPLMENTED YET!) [vegan|glutenfree|vegeterian|keto|etc.] 9 | 4. Prep_Ease ::: how much technique and work does a meal needs [numeric 0-10, 0 is easiest] 10 | 5. Prep_Time ::: how much work time does working does the meal needs, NOT cooking time (soup has low Prep_Ease) [numeric 0-10, 0 is less time] 11 | 6. Cook_Time ::: 12 | 7. Rank ::: 13 | 8. Scaling ::: 14 | 9. TA ::: 15 | 10. times_made ::: 16 | 11. recipe_suggestion ::: 17 | 12. Name_HE ::: 18 | -------------------------------------------------------------------------------- /full_meal_rnd/main.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Here happens all the magic 3 | ''' 4 | 5 | import pandas as pd 6 | #import scripts.auxillary as aux 7 | #import scripts.iodata as iod 8 | import typer 9 | import os 10 | from pathlib import Path 11 | 12 | # default absolute pathway 13 | MEAL_LIST = "data/meal_list.csv" 14 | #absolute_path = os.path.join(os.path.dirname(__file__), f"../data/{MEAL_LIST}") 15 | absolute_path = Path(__file__).parent / MEAL_LIST 16 | soup_list = '' 17 | main_courses = '' 18 | side_dishes = '' 19 | salads = '' 20 | desserts = '' 21 | 22 | def main(soups: str = soup_list, main: str = main_courses, side: str = side_dishes, salad: str = salads, 23 | dessert: str = desserts): 24 | print("Not implemented yet") 25 | 26 | if __name__ == "__main__": 27 | typer.run(main) 28 | -------------------------------------------------------------------------------- /initialize_data.py: -------------------------------------------------------------------------------- 1 | ''' 2 | This is depracted and was only used to make the inital DataFrame and save it as a csv file 3 | ''' 4 | 5 | import pandas as pd 6 | 7 | meal_names = ["Pasta Rose", "Stir Fried Vegetables", "Hot Salad", "Hamburger and Fries"] 8 | 9 | # 0 - Milchik, 1 - Parve, 2 - Fleysh 10 | kosher_type = [0, 1, 1, 2] 11 | # Lower ease is better 12 | ease_of_making = [2, 6, 7, 4] 13 | # Higher rank is better 14 | rank = [4, 8, 8, 7] 15 | 16 | 17 | dinner_ideas = pd.DataFrame( 18 | { 19 | "Name": meal_names, 20 | "KoserType": kosher_type, 21 | "Ease": ease_of_making, 22 | "Rank": rank, 23 | "times_made": 0 24 | } 25 | ) 26 | 27 | if __name__ == '__main__': 28 | print(dinner_ideas) 29 | #print(make_random(dinner_ideas)) 30 | #print(dinner_ideas) 31 | #dinner_ideas.to_csv("meal_list.csv") 32 | 33 | 34 | -------------------------------------------------------------------------------- /scripts/reboot_timestamps.py: -------------------------------------------------------------------------------- 1 | ''' 2 | This script just reboots all timestamps and meal log data, good to run this when first configurating the program to your needs. 3 | ''' 4 | import pandas as pd 5 | import typer 6 | import os 7 | from pathlib import Path 8 | try: 9 | import scripts.auxillary as aux 10 | import scripts.iodata as iod 11 | except: 12 | import auxillary as aux 13 | import iodata as iod 14 | 15 | def main(data: str = "../data/meal_list.csv", log: str = "../data/meal.log"): 16 | """ 17 | resets all date data in the data file 18 | """ 19 | 20 | DATANAME = data 21 | LOGNAME = log 22 | PATH = os.path.dirname(__file__) 23 | 24 | datapath = Path(__file__).parent / data 25 | logpath = Path(__file__).parent / log 26 | 27 | meals_db = pd.read_csv(datapath, index_col=0) 28 | aux.reboot_time_timestamps(data=meals_db, logfile=log) 29 | 30 | if __name__ == "__main__": 31 | pass 32 | typer.run(main) 33 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Avishai Barnoy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /roadmap.md: -------------------------------------------------------------------------------- 1 | 2 | Ideas for extra features, algorithmic logic, directions of development, etc. 3 | 4 | # Roadmap 5 | ## Extra Functionality and things to add: 6 | 1. divide meals to subuntis and generate combinations, i.e., main course + side dish + salad. 7 | 2. scaling factor for meals, i.e., how easy is to make more from the meal. E.g., soups and bread scale good while schnitzel scales bad. 8 | 4. twitter bot or whatsapp bot 9 | 5. GUI website for suggestions 10 | 6. Ranking Function - at t0 the meal_list.csv comes with all ranks set to None/nan/0/1/etc and with each suggestion if meal never came up in the loop it will ask for a rank. A combination can be made so that only ranked meals will be suggested, this can be implemented by setting rank=0 for all meals and, after sufficient meals were ranked (maybe fraction of meals), to use weights. This results in 0 weights for meals not ranked, or not liked. Maybe the secretary problem, when have we learned enought and it is time to make a choice? 11 | 7. Suprise me option, just give a meal that was never ranked - this is problematic with current ranking system. If someone ranks 0 then he doesn't want to eat it and it cannot resurface in the suprise_me. A workaround would be that if a meal was ranked 0 when asked to rank the meal will get a timestamp, and the combined 0+timestamp can allow for proper filtering. 12 | 8. In future website: create a user and login system so that knowledge can be stored. This should not impede the free usage of the system. 13 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Here happens all the magic 3 | ''' 4 | 5 | import pandas as pd 6 | import scripts.auxillary as aux 7 | import scripts.iodata as iod 8 | import typer 9 | import os 10 | from pathlib import Path 11 | 12 | # default absolute pathway 13 | MEAL_LIST = "data/meal_list.csv" 14 | #absolute_path = os.path.join(os.path.dirname(__file__), f"../data/{MEAL_LIST}") 15 | absolute_path = Path(__file__).parent / MEAL_LIST 16 | 17 | def main(data: str = MEAL_LIST, rank: bool = False, TA: bool = None, inp: bool = False, kosher: str = "fleisch"): 18 | """ 19 | data ::: str, csv file with the meal data - default meal_list.csv in the data folder. 20 | 21 | rank ::: uses weights from the rank feature for random meal. 22 | 23 | TA ::: True-chooses only from takeaway, False-choose from everythin except TA, no-flag - choose from everything including TA. 24 | 25 | inp ::: Add a new meal to the meal DB, by questions to the audience. 26 | """ 27 | #typer.echo(f"Choosing meal from {kosher.value}") 28 | 29 | meals_db = pd.read_csv(absolute_path, index_col=0) 30 | 31 | meals_db = aux.filter_kosher(meals_db, kosher) 32 | if inp: 33 | new_meal = iod.meal_questions(meals_db) 34 | meals_db = iod.add_meal(meals_db, new_meal) 35 | else: 36 | meals_db, chosen_one = aux.choose_random(meals_db, rank, TA) 37 | iod.write_to_log(chosen_one) 38 | 39 | # save changes 40 | iod.save_data(meals_db, absolute_path) 41 | 42 | 43 | if __name__ == "__main__": 44 | typer.run(main) 45 | -------------------------------------------------------------------------------- /full_meal_rnd/roadmap.txt: -------------------------------------------------------------------------------- 1 | 2 | Ideas for extra features, algorithmic logic, directions of development, etc. 3 | 4 | # Roadmap 5 | ## Extra Functionality and things to add: 6 | 1. divide meals to subuntis and generate combinations, i.e., main course + side dish + salad. 7 | 2. make it smart, not just random based on rank/timestamp/etc. so that meals combine logically. 8 | 3. specific meal ideas, e.g., pasta sauce ideas -- identify subfamilies (e.g, pastas, salads) 9 | 4. scaling factor for meals, i.e., how easy is to make more from the meal. E.g., soups and bread scale good while schnitzel scales bad. 10 | 5. making time: fast, medium, slow. Maybe good for Shabbat meals, can be combined with multitasking with other cooking, soup making takes couple of hours to be ready but one can make other things in the meantime. 11 | 6. Add class ranking, so one can maximize class for 0 strain. 12 | 7. Add recipe suggestions from vetted bloggers 13 | 8. twitter bot or whatsapp bot 14 | 9. GUI website for suggestions 15 | 10. Ranking Function - at t0 the meal_list.csv comes with all ranks set to None/nan/0/1/etc and with each suggestion if meal never came up in the loop it will ask for a rank. A combination can be made so that only ranked meals will be suggested, this can be implemented by setting rank=0 for all meals and, after sufficient meals were ranked (maybe fraction of meals), to use weights. This results in 0 weights for meals not ranked, or not liked. Maybe the secretary problem, when have we learned enought and it is time to make a choice? 16 | 11. Suprise me option, just give a meal that was never ranked - this is problematic with current ranking system. If someone ranks 0 then he doesn't want to eat it and it cannot resurface in the suprise_me. A workaround would be that if a meal was ranked 0 when asked to rank the meal will get a timestamp, and the combined 0+timestamp can allow for proper filtering. 17 | 12. In future website: create a user and login system so that knowledge can be stored. This should not impede the free usage of the system. 18 | 13. write dictionary function that converts numeric values to textual where relevant. 19 | -------------------------------------------------------------------------------- /backup_and_templates/bkp.meal_list.csv: -------------------------------------------------------------------------------- 1 | ,Name,KosherType,Prep_Ease,Prep_Time,Cook_Time,Rank,Scaling,TA,times_made,Timestamp,recipe_suggestion,Name_HE 2 | 0,Pasta Rose,2,2,medium,medium,4,,0,0,,,פסטה רוזה 3 | 1,Stir Fried Vegetables,0,6,medium,short,8,,0,0,,,ירקות מוקפצים 4 | 2,Hot Salad,0,7,medium,short,8,,0,0,,,סלט חם 5 | 3,Hamburger and Fries,3,4,medium,medium,7,,0,1,2022-05-09,,המבורגר וצ'יפס 6 | 4,Pizza,2,5,long,medium,7,,0,0,2022-05-02,,פיצה 7 | 5,Sushi,1,10,long,medium,7,,0,0,,,סושי 8 | 6,Shushi TA,3,0,short,short,8,,1,0,,,סושי משלוח 9 | 7,Fried Eggs,1,2,short,short,6,,0,0,,,ביצי עין 10 | 8,Shakshuka,1,4,medium,short,5,,0,0,,,שקשוקה 11 | 9,Pasta tomato,0,4,medium,short,3,,0,0,,,פסטה ברוטב עגבניות 12 | 10,Stir Fried Veggies Frozen Bag,0,4,medium,short,7,,0,0,,,ירקות מוקפצים מיקס קפוא 13 | 11,toasts,2,3,short,short,4,,0,0,,,טוסטים 14 | 12,Eggs Benedict,2,10,long,medium,9,,0,0,,,אגז בנדיקט 15 | 13,Nachos,0,6,medium,short,7,,0,0,,,נאצ'וס 16 | 14,Gnochi,0,9,long,short,8,,0,0,,,ניוקי 17 | 15,Broccoli and Cauliflower,0,0,medium,medium,5,,0,0,,,ברוקולי וכרובית 18 | 16,Baguette,0,8,long,medium,7,,0,0,,,באגט 19 | 17,Ramen,3,8,long,long,7,,0,0,,,ראמן 20 | 18,Grilled Cheese,2,3,short,short,6,,0,0,,,לחם מטוגן 21 | 19,Salami Sandwich,3,2,short,short,5,,0,0,,,כריך סלאמי 22 | 20,Pasta mashroom cream sauce,2,3,medium,medium,7,,0,1,2022-05-09,,פסטה ברוטב שמנת פטריות 23 | 21,Pasta Bolognese,3,6,medium,medium,7,,0,0,,,ספגטי בולונז 24 | 22,Pasta Cacio e Pepe,2,3,medium,medium,5,,0,0,,,פסטה קצ'ו אה פפה 25 | 23,Pasta Broccoli and Almonds,0,6,medium,medium,7,,0,0,,,פסטה ברוטב ברוקולי ושקדים 26 | 24,Lasagna,2,6,long,medium,8,,0,0,,,לזניה 27 | 25,Hamburger TA,3,0,short,short,8,,1,0,,,המבורגר משלוח 28 | 26,Pizza TA,2,0,short,short,5,,1,0,,,פיצה משלוח 29 | 27,Potatoes with cheese (myabe cottage),2,4,medium,medium,4,,0,0,,,תפוחי אדמה וגבינהק 30 | 28,Pancakes,1,6,medium,short,7,,0,0,,,פנקייקים 31 | 29,Pasta Oli Olio,0,6,medium,medium,9,,0,0,,,פסטה אליו אוליו 32 | 30,Bagels,0,7,long,medium,8,,0,0,,,בייגל אמריקאי 33 | 31,Cornflakes,0,0,short,short,1,,0,0,,,קורנפלקס 34 | 32,Pasta Sweetpotato cream sauce,2,5,medium,medium,5,,0,0,,,פסטה ברוטב שמנת בטטה 35 | 33,Bruschetta tomato basil,0,5,medium,short,7,,0,0,,,ברוסקטות עם עגבניות ובזיליקום 36 | 34,Diced baked potato and sweet potato,0,4,medium,medium,5,,0,0,,,תפוחי אדמה ובטטות אפויים 37 | 35,Antipasto,0,4,medium,medium,4,,0,0,,,אנטיפסטי 38 | 36,Kitchen Coach sweet potato,0,4,medium,medium,6,,0,0,,,בטטות של עז תלם 39 | 37,Garlic bread,0,7,long,medium,9,,0,0,,,לחם שום 40 | 38,Creamed Potatoes,2,7,medium,medium,7,,0,0,,,תפוחי אדמה מוקרמים 41 | -------------------------------------------------------------------------------- /TODO.md: -------------------------------------------------------------------------------- 1 | 2 | # To Do: 3 | 1. add a function to ask if user wants to make meal, take the logic out of choose_random() 4 | 1.1 make --mock option work in CLI 5 | 2. add a field-format text file 6 | 3. change add_meal_questions(): 7 | 1.1 add description printed before everything to explain what's going on. 8 | 1.2 create a "def check_input(inp)" function to test if the input is correct 9 | 1.3 option to look for specific koshertype - milchik/fleisch 10 | 4. check convention for column naming with pandas. Choose one - camel, snake_eye, pascal 11 | 5. add enumerative classes 12 | 6. recipe suggestions 13 | 7. add scaling factor - define 3 main functions: linear, sub-linear, superlinear 14 | 8. look by kosher/diet: 15 | 7.1 kosher - vegan, vegeterian, parve, milchik, fleisch 16 | 7.1.1 change kosher type to parve, milchik, fleisch in meal_list 17 | 7.2 Diet - vegan, glutenfree, vegeterian, keto 18 | 9. add logic function for input mode: choices: (1) new meal, (2) update values, etc. 19 | 10. last_prepared - should not suggest meal if was prepared in past 3-4 days 20 | 21 | # Empty Functions: 22 | ## Auxillary 23 | 1. Adjust weights according to times made. 24 | 2. Make choice by ease 25 | 3. Give k-choices ranked by ease and/or rank 26 | 4. make choice by kosher type 27 | 5. if last_made don't make choice made in last 5 days or if last_made==int then that amount of days 28 | 6. export all flag options to filtering functions that can be make the relevant DB smaller for pd.sample. 29 | 6.1 OPTION: add and then remove a column of weights that get zeroed for filtering. 30 | e.g., if milchik chosen, in temp_filter all fleischik will get a 0 and then when doing sample(weights=temp_filter) 31 | the fleischik meals will be filtered out. 32 | 33 | ## Iodata 34 | 1. check_meal_input - check that every field in a new added meal is in the correct format 35 | 2. update_missing_data - goes over db and asks user to fill in empty data 36 | 37 | ## main 38 | 1. suprise me flag? 39 | 40 | # Things to Add to functions: 41 | 42 | ## Data organization: 43 | 44 | ## Features: 45 | 1. meal scaling factor - can be used for weekly meal planning 46 | 2. recipe suggestion - Krutit, Kitchencoach 47 | 48 | ## Random choice: 49 | 1. Adjust weights according to times made - maybe timestamp and then weight adjustment 50 | is only made if meal was prepared in the last n days. 51 | 2. make choice by kosher type 52 | 53 | ## Choose TA: 54 | 1. choice by type. 55 | 2. Time dilation - TA is only availabe in random if TA was not ordered in the past X days. 56 | 57 | -------------------------------------------------------------------------------- /full_meal_rnd/data/meal_list.csv: -------------------------------------------------------------------------------- 1 | ,Name,KosherType,Prep_Ease,Prep_Time,Cook_Time,Rank,Scaling,TA,times_made,Timestamp,recipe_suggestion,Name_HE 2 | 0,Pasta Rose,2,2,medium,medium,4,,0,0.0,,,פסטה רוזה 3 | 1,Stir Fried Vegetables,0,6,medium,short,8,,0,0.0,,,ירקות מוקפצים 4 | 2,Hot Salad,0,7,medium,short,8,,0,1.0,2022-05-11,,סלט חם 5 | 3,Hamburger and Fries,3,4,medium,medium,7,,0,1.0,2022-05-09,,המבורגר וצ'יפס 6 | 4,Pizza,2,5,long,medium,7,,0,0.0,2022-05-02,,פיצה 7 | 5,Sushi,1,10,long,medium,7,,0,0.0,,,סושי 8 | 6,Shushi TA,3,0,short,short,8,,1,0.0,,,סושי משלוח 9 | 7,Fried Eggs,1,2,short,short,6,,0,0.0,,,ביצי עין 10 | 8,Shakshuka,1,4,medium,short,5,,0,0.0,,,שקשוקה 11 | 9,Pasta tomato,0,4,medium,short,3,,0,0.0,,,פסטה ברוטב עגבניות 12 | 10,Stir Fried Veggies Frozen Bag,0,4,medium,short,7,,0,0.0,,,ירקות מוקפצים מיקס קפוא 13 | 11,toasts,2,3,short,short,4,,0,0.0,,,טוסטים 14 | 12,Eggs Benedict,2,10,long,medium,9,,0,0.0,,,אגז בנדיקט 15 | 13,Nachos,0,6,medium,short,7,,0,0.0,,,נאצ'וס 16 | 14,Gnochi,0,9,long,short,8,,0,0.0,,,ניוקי 17 | 15,Broccoli and Cauliflower,0,0,medium,medium,5,,0,0.0,,,ברוקולי וכרובית 18 | 16,Baguette,0,8,long,medium,7,,0,0.0,,,באגט 19 | 17,Ramen,3,8,long,long,7,,0,0.0,,,ראמן 20 | 18,Grilled Cheese,2,3,short,short,6,,0,0.0,,,לחם מטוגן 21 | 19,Salami Sandwich,3,2,short,short,5,,0,1.0,2022-05-10,,כריך סלאמי 22 | 20,Pasta mashroom cream sauce,2,3,medium,medium,7,,0,1.0,2022-05-09,,פסטה ברוטב שמנת פטריות 23 | 21,Pasta Bolognese,3,6,medium,medium,7,,0,0.0,,,ספגטי בולונז 24 | 22,Pasta Cacio e Pepe,2,3,medium,medium,5,,0,0.0,,,פסטה קצ'ו אה פפה 25 | 23,Pasta Broccoli and Almonds,0,6,medium,medium,7,,0,0.0,,,פסטה ברוטב ברוקולי ושקדים 26 | 24,Lasagna,2,6,long,medium,8,,0,0.0,,,לזניה 27 | 25,Hamburger TA,3,0,short,short,8,,1,0.0,,,המבורגר משלוח 28 | 26,Pizza TA,2,0,short,short,5,,1,1.0,2022-05-11,,פיצה משלוח 29 | 27,Potatoes with cheese (myabe cottage),2,4,medium,medium,4,,0,0.0,,,תפוחי אדמה וגבינהק 30 | 28,Pancakes,1,6,medium,short,7,,0,1.0,2022-05-11,,פנקייקים 31 | 29,Pasta Oli Olio,0,6,medium,medium,9,,0,0.0,,,פסטה אליו אוליו 32 | 30,Bagels,0,7,long,medium,8,,0,0.0,,,בייגל אמריקאי 33 | 31,Cornflakes,0,0,short,short,1,,0,0.0,,,קורנפלקס 34 | 32,Pasta Sweetpotato cream sauce,2,5,medium,medium,5,,0,0.0,,,פסטה ברוטב שמנת בטטה 35 | 33,Bruschetta tomato basil,0,5,medium,short,7,,0,0.0,,,ברוסקטות עם עגבניות ובזיליקום 36 | 34,Diced baked potato and sweet potato,0,4,medium,medium,5,,0,0.0,,,תפוחי אדמה ובטטות אפויים 37 | 35,Antipasto,0,4,medium,medium,4,,0,1.0,2022-05-11,,אנטיפסטי 38 | 36,Kitchen Coach sweet potato,0,4,medium,medium,6,,0,0.0,,,בטטות של עז תלם 39 | 37,Garlic bread,0,7,long,medium,9,,0,0.0,,,לחם שום 40 | 38,Creamed Potatoes,2,7,medium,medium,7,,0,1.0,2022-05-12,,תפוחי אדמה מוקרמים 41 | -------------------------------------------------------------------------------- /data/meal_list.csv: -------------------------------------------------------------------------------- 1 | ,Name,KosherType,Diet,Prep_Ease,Prep_Time,Cook_Time,Rank,Scaling,TA,times_made,Timestamp,recipe_suggestion,Name_HE 2 | 0,Pasta Rose,milchik,,2,medium,medium,4,,0,0.0,,,פסטה רוזה 3 | 1,Stir Fried Vegetables,parve,,6,medium,short,8,,0,0.0,,,ירקות מוקפצים 4 | 2,Hot Salad,parve,,7,medium,short,8,,0,1.0,2022-05-11,,סלט חם 5 | 3,Hamburger and Fries,fleisch,,4,medium,medium,7,,0,1.0,2022-05-09,,המבורגר וצ'יפס 6 | 4,Pizza,milchik,,5,long,medium,7,,0,0.0,2022-05-02,,פיצה 7 | 5,Sushi,parve,,10,long,medium,7,,0,0.0,,,סושי 8 | 6,Shushi TA,fleisch,,0,short,short,8,,1,0.0,,,סושי משלוח 9 | 7,Fried Eggs,parve,,2,short,short,6,,0,0.0,,,ביצי עין 10 | 8,Shakshuka,parve,,4,medium,short,5,,0,0.0,,,שקשוקה 11 | 9,Pasta tomato,parve,,4,medium,short,3,,0,0.0,,,פסטה ברוטב עגבניות 12 | 10,Stir Fried Veggies Frozen Bag,parve,,4,medium,short,7,,0,0.0,,,ירקות מוקפצים מיקס קפוא 13 | 11,toasts,milchik,,3,short,short,4,,0,0.0,,,טוסטים 14 | 12,Eggs Benedict,milchik,,10,long,medium,9,,0,0.0,,,אגז בנדיקט 15 | 13,Nachos,parve,,6,medium,short,7,,0,0.0,,,נאצ'וס 16 | 14,Gnochi,parve,,9,long,short,8,,0,0.0,,,ניוקי 17 | 15,Broccoli and Cauliflower,parve,,0,medium,medium,5,,0,0.0,,,ברוקולי וכרובית 18 | 16,Baguette,parve,,8,long,medium,7,,0,0.0,,,באגט 19 | 17,Ramen,fleisch,,8,long,long,7,,0,0.0,,,ראמן 20 | 18,Grilled Cheese,milchik,,3,short,short,6,,0,0.0,,,לחם מטוגן 21 | 19,Salami Sandwich,fleisch,,2,short,short,5,,0,1.0,2022-05-10,,כריך סלאמי 22 | 20,Pasta mashroom cream sauce,milchik,,3,medium,medium,7,,0,1.0,2022-05-09,,פסטה ברוטב שמנת פטריות 23 | 21,Pasta Bolognese,fleisch,,6,medium,medium,7,,0,0.0,,,ספגטי בולונז 24 | 22,Pasta Cacio e Pepe,milchik,,3,medium,medium,5,,0,0.0,,,פסטה קצ'ו אה פפה 25 | 23,Pasta Broccoli and Almonds,parve,,6,medium,medium,7,,0,0.0,,,פסטה ברוטב ברוקולי ושקדים 26 | 24,Lasagna,milchik,,6,long,medium,8,,0,0.0,,,לזניה 27 | 25,Hamburger TA,fleisch,,0,short,short,8,,1,0.0,,,המבורגר משלוח 28 | 26,Pizza TA,milchik,,0,short,short,5,,1,1.0,2022-05-11,,פיצה משלוח 29 | 27,Potatoes with cheese (myabe cottage),milchik,,4,medium,medium,4,,0,0.0,,,תפוחי אדמה וגבינהק 30 | 28,Pancakes,parve,,6,medium,short,7,,0,1.0,2022-05-11,,פנקייקים 31 | 29,Pasta Oli Olio,parve,,6,medium,medium,9,,0,0.0,,,פסטה אליו אוליו 32 | 30,Bagels,parve,,7,long,medium,8,,0,0.0,,,בייגל אמריקאי 33 | 31,Cornflakes,parve,,0,short,short,1,,0,0.0,,,קורנפלקס 34 | 32,Pasta Sweetpotato cream sauce,milchik,,5,medium,medium,5,,0,0.0,,,פסטה ברוטב שמנת בטטה 35 | 33,Bruschetta tomato basil,parve,,5,medium,short,7,,0,0.0,,,ברוסקטות עם עגבניות ובזיליקום 36 | 34,Diced baked potato and sweet potato,parve,,4,medium,medium,5,,0,0.0,,,תפוחי אדמה ובטטות אפויים 37 | 35,Antipasto,parve,,4,medium,medium,4,,0,1.0,2022-05-11,,אנטיפסטי 38 | 36,Kitchen Coach sweet potato,parve,,4,medium,medium,6,,0,0.0,,,בטטות של עז תלם 39 | 37,Garlic bread,parve,,7,long,medium,9,,0,0.0,,,לחם שום 40 | 38,Creamed Potatoes,milchik,,7,medium,medium,7,,0,1.0,2022-05-12,,תפוחי אדמה מוקרמים 41 | -------------------------------------------------------------------------------- /scripts/iodata.py: -------------------------------------------------------------------------------- 1 | ''' 2 | Functions for data input/ouput and update of data 3 | This whole library needs to undergo a thorough revamp and remodelling, removing redundant and depracted code parts, adding new functionality, descriptions, etc. 4 | ''' 5 | 6 | import pandas as pd 7 | import os 8 | from pathlib import Path 9 | 10 | def add_meal(data, new_data): 11 | ''' 12 | concats a new meal into a meal data set 13 | ''' 14 | new_ideas = pd.concat([data,new_data], ignore_index = True, axis = 0) 15 | return new_ideas 16 | 17 | def meal_questions(meal_data): 18 | ''' 19 | Ask user to enter information about meal, then stores in the data model, 20 | ''' 21 | # Here add a description of all relevant data 22 | data = meal_data 23 | inp = {key:"NaN" for key in data} 24 | # loop over keys, skip times_made, timestamp 25 | inp_inst = {} 26 | cols = ["Timestamp", "times_made"] 27 | print("Enter meal data:") 28 | instructions_dict = {} # here have instructions for each meal feature 29 | for i in data.loc[:, ~data.columns.isin(cols)]: 30 | # uncomment once instructions_dict is implemented 31 | #print(f"Input instructions for {i}:") 32 | #print(instructions_dict[i]) 33 | inp[i] = input(f"Enter value for {i}: ") 34 | inp["Timestamp"] = "NaN" 35 | inp["times_made"] = "NaN" 36 | print(inp) 37 | 38 | #while check_values(inp) == False: 39 | #break 40 | 41 | return pd.DataFrame(inp,index=[0]) 42 | 43 | def check_meal_inp(inp): 44 | ''' 45 | Check meal input if values are correct 46 | ''' 47 | pass 48 | 49 | def write_to_log(choice,logfile="meal.log"): 50 | ''' 51 | Appends a prepared eal to meal log 52 | ''' 53 | now = str(pd.Timestamp.now()) 54 | log = "{},{}\n".format(choice,now) 55 | with open(f"data/{logfile}","a") as f: 56 | f.writelines(log) 57 | 58 | def update_column(data,column): 59 | ''' 60 | data ::: df to update 61 | column ::: str, column name to update 62 | ''' 63 | for idx,row in data.iterrows(): 64 | print(idx,row.iloc[0],column) 65 | data.loc[idx,column] = input("Enter new value: ") 66 | 67 | def update_missing_data(data, column): 68 | ''' 69 | same as update_column() but won't update rows with values 70 | ''' 71 | pass 72 | 73 | def update_values_meal(): 74 | ''' 75 | modification of specific meal's attributes 76 | maybe print all meal names, ask for user numeric input by also showing their index. 77 | ''' 78 | pass 79 | 80 | def save_data(data, filename): 81 | ''' 82 | maybe add an overwrite warning? 83 | ''' 84 | data.drop_duplicates() 85 | data.to_csv(filename) 86 | return 0 87 | 88 | if __name__ == "__main__": 89 | FILENAME = "../data/meal_list.csv" 90 | PATH = os.path.join(os.path.dirname(__file__), f"../data/{FILENAME}") 91 | PATH = Path(__file__).parent / FILENAME 92 | data = pd.read_csv(PATH, index_col=0) 93 | #data.insert(2, "Diet", "NaN", True) 94 | print(data.head(n=5)) 95 | #data["KosherType"] = data["KosherType"].replace({0:"parve",1:"parve",2:"milchik",3:"fleisch"}) 96 | #save_data(data, PATH) 97 | #data = pd.read_csv(FILENAME,index_col=0) 98 | #data_new = meal_questions(data) 99 | #combined_arms = add_meal(data, data_new) 100 | #save_data(combined_arms, FILENAME) 101 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dinner Generator 2 | Dinner Generator is a Python program that randomly suggests ideas to prepare for dinner, so you can have [Class with Zero Strain](https://www.youtube.com/watch?v=NpDAFKqeUDw). 3 | 4 | > DeepCook, developed by ABN electronics was the first computer to defeat a human competitor in MasterChef. 5 | > 6 | > -- Neria Baris 7 | 8 | Feel free to help in anyway you wish, even adding more meals, recipe suggestions, etc. 9 | 10 | # Description 11 | ## Background 12 | I love cooking but I also hate deciding what to make for middle-week dinners. Hence, this project was born. It is supposed to randomly give a suggestion for a meal to prepare for dinner. 13 | I created a meal database (saved in the `data/meal_list.csv` file) and added some features to each meal. Each meal idea is based on meals I found that worked for me and my family, or something I wanted to try but never had the chance. Every meal is ranked according to my own preferances. 14 | 15 | Fun fact: I am a crazy person who develops in vim... 16 | 17 | ## Features 18 | Currently, the main enegine will randomly choose a meal from the < describe the different options implemented and how the choice is done, too_late() etc. > 19 | 20 | Currently ranking is only based on my own preferences for meals, but in the future a quick reranking option will be added, also an easy meal insertion to the db will be implemented. 21 | 22 | < one day, here you, brave reader, will find a thorough and in-depth description of this project > 23 | 24 | # Getting Started 25 | ## Dependencies 26 | Python3.8 was used for development, I believe that any Python3 version will be compatible.\n 27 | ``` 28 | click==7.1.2 29 | colorama==0.4.4 30 | numpy==1.22.3 31 | pandas==1.4.2 32 | python-dateutil==2.8.2 33 | pytz==2022.1 34 | shellingham==1.4.0 35 | six==1.16.0 36 | typer==0.3.2 37 | typer-cli==0.0.12 38 | ``` 39 | 40 | ## Installing 41 | Just run and all will be good. 42 | ```bash 43 | pip install -r requirements.txt 44 | ``` 45 | 46 | ## Executing Program 47 | Initially one should run the `reboot_timestamps.py` script to reset all the timestamp in the folder. 48 | 49 | Currently there is no working "main" function, but one will be implemented to run with command line arguments.\n 50 | To generate a random meal idea run: 51 | ```bash 52 | python main.py 53 | ``` 54 | This will promt the user with a suggestion and asking if he will make it, if the user answers `y` then the meal is logged. 55 | 56 | ## Help 57 | In order to read the help section run (which is a fun bonus of implementing a cli), this will also give you current CLI methods implemented. 58 | ```bash 59 | python main.py --help 60 | ``` 61 | 62 | There are no known issues, but the program is not really in any mature phase, and testing was done on-the-fly as I was writing the code. This is a terrible practice and should not be dont by anyone. Since I am not a programmer, just a computational chemsit / theoretical biophysicist no one holds me accountable for anything related to code. 63 | 64 | ## Contributions 65 | Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. 66 | 67 | Please make sure to write tests as appropriate, I (Avishai) didn't do the proper and appropriate work so there are currently no tests. 68 | 69 | Please don't hesitate to open an issue or pull request. You can also send me a message on Twitter. 70 | 71 | ## Author 72 | Contributors names and contact info 73 | 74 | Avishai Barnoy [@avishai231](https://twitter.com/avishai231) 75 | 76 | # License 77 | This project is licensed under the MIT License - see the LICENSE.md file for details. 78 | -------------------------------------------------------------------------------- /CHANGELOG.txt: -------------------------------------------------------------------------------- 1 | ################## 2 | # LOG 17.05.2022 # 3 | ################## 4 | 1. added METADATA.md file describing the data structure 5 | 2. added diet column, currently with NaN values 6 | 3. started building classes for flag usage in main using Typer, currently for kosher type. Also added nonkosher option. 7 | 8 | ################## 9 | # LOG 16.05.2022 # 10 | ################## 11 | 1. started laying foundation to Shabbat meal planner 12 | 2. change kosher from numeric to string - CLI option not yet implemented 13 | 2.1 Diet choice was added to TODO.md 14 | 3. added empty function to be filled (TBF) for kosher slicing 15 | 4. added empty csv files for meal categories 16 | 17 | ################## 18 | # LOG 15.05.2022 # 19 | ################## 20 | 1. changed absolute to relative path using pathlib.Path for data files 21 | 2. added try/except for scripts for better maintence -> should be removed once I start writing actual tests 22 | 23 | ################## 24 | # LOG 12.05.2022 # 25 | ################## 26 | 1. updated requierments, mostly to include typer and its helpers. 27 | 2. meal_questions now iterates through columns (except Timestamp and times_made), deleted depracted code segemnts. 28 | 3. added inp flag for a user to add new meals to db 29 | 4. updated README for the new flag method, where no db needs to be declared 30 | 5. updated requierments in README 31 | 32 | ################## 33 | # LOG 11.05.2022 # 34 | ################## 35 | 1. changed input file to be meal_list.csv by default but one can add it manually. 36 | 2. moved meal logger, meal_count update out of choose_random 37 | 3. started updating filename to be an argument (a default one) for functions instead of a hard-coded string inside functions logic. 38 | 39 | ################## 40 | # LOG 10.05.2022 # 41 | ################## 42 | 1. implemented CLI options using typer. Only rank weighing and takeaway options are implmented 43 | 2. added a csv template file 44 | 3. fixed problems with venv and updated the requirements file 45 | 4. fixed to_late(), sample() method wasn't sampling from the filtered meal list 46 | 5. small restructuring of main folder 47 | 6. updates to README, including description, usage information, installation, etc. 48 | 7. restructure folders 49 | 8. added __init__.py files to the different directories so they will be treated as python libraries. 50 | 51 | ################## 52 | # LOG 09.05.2022 # 53 | ################## 54 | 1. added prep_time data 55 | 2. added cook_time data 56 | 3. added hebrew name to meals 57 | 4. implemented to_late() function for choose_random(), when asking for a meal after 20:00 will not suggest long preparation time 58 | 5. timestamp only saves date and not hh:mm:ss anymore 59 | 60 | ################## 61 | # LOG 03.05.2022 # 62 | ################## 63 | 1. changed license GPLv3 to MIT 64 | 65 | ################## 66 | # LOG 02.05.2022 # 67 | ################## 68 | 1. finished check_time function for meal prep, didn't update values in 69 | meal_list.csv yet so this feature is not implemented yet. 70 | 2. removed redundant functions in auxillary 71 | 3. started reforming meal input in io_data to be more autonomous 72 | 73 | ################## 74 | # LOG 01.05.2022 # 75 | ################## 76 | 1. added option for Vegan under kosher 77 | 2. added more features, non of them with values for meals 78 | 3. updated KosherType to have vegan option and changed numbering for easier 79 | slicing 80 | 4. added update feature function to io_data.py 81 | 5. implemneted meal and date logging if user answers he's going to make the 82 | meal 83 | 84 | ################## 85 | # LOG 30.04.2022 # 86 | ################## 87 | 1. added timestamp and times_made reboot function for testing functionallity 88 | and future "reset" option for users. 89 | 90 | ################## 91 | # LOG 28.04.2022 # 92 | ################## 93 | 1. wrote stuff in README.md 94 | 2. deleted obsolete code using the random library 95 | 96 | ################## 97 | # LOG 27.04.2022 # 98 | ################## 99 | 1. imporved choose_random: 100 | 1.a combined with choose_TA and now it works using a TA flag 101 | 1.b removed random.choices 102 | 2. uploaded project to github 103 | 3. added more meals to meal_list.csv 104 | 4. added requierments file, gitignore, readme.md (although the latter is still 105 | empty) 106 | 107 | ################## 108 | # LOG 25.04.2022 # 109 | ################## 110 | 1. added timestamp column, being overwritten every time meal is prepared. 111 | 2. implemented choose_TA function allowing for random choice of a take-away 112 | meal. 113 | -------------------------------------------------------------------------------- /scripts/auxillary.py: -------------------------------------------------------------------------------- 1 | ''' 2 | main random meal choice function and its tiny helpers 3 | this is called auxiallary as it is supposed to support the main main.py file 4 | ''' 5 | import pandas as pd 6 | import os 7 | from pathlib import Path 8 | try: 9 | import scripts.iodata as iod 10 | except: 11 | import iodata as iod 12 | 13 | def choose_random(meals, rank: bool = False, times: bool = False, last_made: bool = False, TA=None, k=1): 14 | ''' 15 | Changes to make: 16 | 1. test time stamping 17 | 18 | makes either a fully (pseudo) random choice from all meal options 19 | or a weighted choice based on rank. 20 | Future: 21 | 1. Adjust weights according to times made. 22 | 2. Make choice by ease 23 | 3. Give k-choices ranked by ease and/or rank 24 | 4. make choice by kosher type 25 | 5. if last_made don't make choice made in last 5 days or if last_made==int then that amount of days 26 | meals ::: DataFrame with meal information 27 | rank ::: if True gives weights to meals based on rank 28 | last_made ::: *NOT IMPLEMENTED* should take into account when last made, maybe combine with times? 29 | TA ::: True - choose only from takeawy, False - choose only from homecooking, None - anything may come 30 | ''' 31 | use_rank = None 32 | 33 | meals_copy = meals.copy() 34 | 35 | # filter meals prepared in the past 4 days 36 | # NOT IMPLEMENTED YET # 37 | 38 | # use a weighted choice, by rank 39 | if rank == True: 40 | use_rank = choice["Rank"] 41 | 42 | # include or choose only take-away, default is to random from everythin 43 | if TA == False: 44 | meals_copy = meals_copy[meals_copy["TA"] == 0] 45 | elif TA == True: 46 | meals = meals_copy[meals_copy["TA"] == 1] 47 | 48 | is_late = is_too_late_to_cook() 49 | translate_time = {"short":0, "medium":1, "long": 2} 50 | if is_late == True: 51 | meals_copy.replace({"Prep_Time":translate_time,"Cook_Time":translate_time},inplace=True) 52 | meals_copy = meals_copy[meals_copy["Prep_Time"] < 2] 53 | meals_copy = meals_copy[meals_copy["Cook_Time"] < 2] 54 | 55 | choice = meals_copy.sample(n=k, weights=use_rank) 56 | 57 | # check if user wants to make meal and if yes log the meal. 58 | print(choice["Name"].iloc[0]) 59 | make_it = input("Are you going to make this meal? (y/n)") 60 | while True: 61 | if make_it.lower() == "y": 62 | meals.loc[choice.index[0],"times_made"] += 1 63 | meals.loc[choice.index[0],"Timestamp"] = pd.Timestamp.now().date() 64 | print("meal logged.") 65 | break 66 | elif make_it.lower() == "n": 67 | print("meal not logged.") 68 | break 69 | else: 70 | print("Please enter a valid answer.") 71 | make_it = input("Are you going to make this meal? (y/n)") 72 | return meals, choice["Name"].iloc[0] 73 | 74 | def is_too_late_to_cook(cutoff: int = 20): 75 | ''' 76 | Checks actual time and returns if choose_random should skip ideas with long preparation time. 77 | After 20:00 only short and medium durations will be considered. 78 | 1. Needs cooking duration feature implemnted. 79 | 2. Option: ask user how long does he plan to prepare the meal 80 | 81 | IMPORTANT 1: should be relevant to Cook_Time and Prep_Time, so if any of them is above medium then meal shouldn't be suggested. 82 | IMPORTANT 2: only takes into account that the time is less than 20:00, if you start cooking after midnight this function will fail to work properly. 83 | ''' 84 | hour = pd.Timestamp.now().hour 85 | if hour < cutoff: 86 | return False 87 | elif hour < 5: # Don't cook in the middle of the night 88 | return True 89 | else: 90 | return True 91 | 92 | def reboot_time_timestamps(data="meal_list.csv",logfile="meal.log"): 93 | ''' 94 | Resets all times made to 0 and removes all time stamps. 95 | This is currently designed only testing and developing. 96 | ''' 97 | while True: 98 | just_checking = input("Are you sure you want to reset *ALL* timestamps and all times_made? (y/n)") 99 | if just_checking.lower() == "n": 100 | print("data was not reset") 101 | return 0 102 | elif just_checking.lower() == "y": 103 | data["Timestamp"] = "NaN" 104 | data["times_made"] = 0 105 | iod.save_data(data) 106 | with open(logfile, "w") as f: pass # empties the meal.log file 107 | print("Data was reset and saved") 108 | return 0 109 | 110 | def filter_kosher(meal_list, kosher): 111 | ''' 112 | Takes loaded meal_list DF and returns the filtered meals according to specified kosher 113 | 114 | meal_list ::: pandas DataFrame with meals 115 | kosher ::: kosher type [parve|milchik|fleisch] 116 | ''' 117 | return meal_list 118 | 119 | if __name__ == "__main__": 120 | FILENAME = "../data/meal_list.csv" 121 | #PATH = os.path.join(os.path.dirname(__file__), f"../data/{FILENAME}") 122 | PATH = Path(__file__).parent / FILENAME 123 | data = pd.read_csv(PATH, index_col=0) 124 | #reboot_time_timestamps(data) 125 | 126 | --------------------------------------------------------------------------------