Home > Learning, Lesson, Problem, Projects/Experiments, Python > Python: Cooking App P-1

Python: Cooking App P-1



Learning : Python, Data-Base, SQlite
Subject: Writing a Cooking Application

Over view: We will start new project to work on in coming weeks, and will call it ” Cooking App” I will use Python as a code language and Sqlite3 as a database in a full stack task.

Assumptions: I will assume that we have some basic information about Database such as Tables, fields, records and relationships between tables also Primary key and foreign keys. All this are important just to understand what’s going on, and we will write the code to generate all tables through Python code.

The Concept: The Cooking App will give the user the ability to write a food Recipe with it’s ingredients and how to cook it. (Along with it’s photo.. ) The application will have the ability to store a list for ingredient so the user can select from it instead of re-writing it every time, also to save the photo of your dish if you want.

Data-Base Design: In this application we will need four Tables, we will call them: Recipes, Photo, Rec_ingredients and ingredient_list. Each table will have a Primary Key (id).

Here are the Tables and the Fields

    Recipes

  • r_id PRIMARY KEY AUTOINCREMENT
  • r_name
  • r_type (Breakfast, Lunch, Dinner)
  • r_tags (NOT Sure to use static list or DB-Table)
  • r_date
  • r_details
  • #In Recipes Table we will store Recipes Name, Recipes type the data and how to prepare the DISH also a photo of the dish, for the tags i am not sure if using a static list or Data-Base Table.
    Photo

  • p_id PRIMARY KEY AUTOINCREMENT
  • r_id FOREIGN KEY
  • p_name
  • #In Photo Table we will store the DISH photo by storing the jpeg file name linked to the r_id, and will be saved in a sub-folder in app-folder


    Ingredients_List

  • ing_id PRIMARY KEY AUTOINCREMENT
  • i_name
  • #In Ingredient Table we will store all the Ingredient Names, this Table will be used as (Drop-Down List) in the application.


    rec_ingredient

  • ing_id PRIMARY KEY AUTOINCREMENT
  • i_l_id
  • r_id
  • #In rec_ingredient Table we will store a links from the Recipes and Ingredients so we can list all ingredient for a Recipe.

First thing we will write in the application is the Main-Menu and other sub menus we may have in the application. (After posting this article Menus may change)

[ MAIN MENU ]
1. Add New Meal.
2. Ingredients Manager [will have a sub menu]
3. ??.
4. Show Recipes.(Meals) [will have a sub menu]
5. Recipes Information.) [ number or Recipes by date, number on tags, number of Ingredients .. ]
6. Data-Base Information.
7. Setting. [will have a sub menu]
9. Exit.


[ Show Recipes ]
1. Show All Recipes.
2. Show Recipes By Date.
3. Show Recipes By Ingredients.
4. Show Recipes By Tags.
5. Show Recipes By Name.

9. Exit.


[ SETTING MENU ]
1. Create the needed Tables.
2. Drop Tables.
3. Insert Dummy Data. (MUST be run after Tables Creation)
9. Exit.


[ INGREDIENT MENU ]
1. Show all Ingredient.
2. Add Ingredient.
3. Delete Ingredient.
4. Edit Ingredient.
9. Exit.

We can say that this is a blue-print of the application that we want to work on, everything is subject to change while working, since this is a personal application we will be flexible in changing, but in real life project development cycle we need to take an approval (From the Business Owner) on the project plan and design before we start working also to be very clear that : “Any changes in the scope of work may cost money and time”.

Next Post: In next post we will write the codes for the menu also we will create the Tables.



To Download my Python code (.py) files Click-Here




Follow me on Twitter..




By: Ali Radwani




  1. No comments yet.
  1. February 6, 2020 at 8:17 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: