nagasurendra commited on
Commit
28122b0
·
verified ·
1 Parent(s): 4a00b98

Update utils/file_initializer.py

Browse files
Files changed (1) hide show
  1. utils/file_initializer.py +5 -13
utils/file_initializer.py CHANGED
@@ -1,24 +1,16 @@
1
  import os
2
  import pandas as pd
3
- import json
4
 
5
  CUSTOMERS_FILE = "database/customers.xlsx"
6
  MENU_FILE = "database/menu.xlsx"
7
  ORDERS_FILE = "database/orders.xlsx"
8
- CONFIG_FILE = "utils/config.json"
9
 
10
  def initialize_files():
 
 
11
  if not os.path.exists(CUSTOMERS_FILE):
12
- pd.DataFrame(columns=["Name", "Email", "Password", "Preferences", "Allergies", "Occasion"]).to_excel(CUSTOMERS_FILE, index=False)
13
  if not os.path.exists(MENU_FILE):
14
- pd.DataFrame(columns=["Dish Name", "Price", "Allergens", "Ingredients", "Nutrition", "Image", "Spice Level"]).to_excel(MENU_FILE, index=False)
15
  if not os.path.exists(ORDERS_FILE):
16
- pd.DataFrame(columns=["Table ID", "Customer Email", "Order Details", "Total Cost"]).to_excel(ORDERS_FILE, index=False)
17
- if not os.path.exists(CONFIG_FILE):
18
- config = {
19
- "spice_levels": ["Mild", "Medium", "High"],
20
- "preferences": ["Vegetarian", "Vegan", "Halal", "Full Menu"],
21
- "occasions": ["Birthday", "Anniversary", "Other"]
22
- }
23
- with open(CONFIG_FILE, "w") as f:
24
- json.dump(config, f)
 
1
  import os
2
  import pandas as pd
 
3
 
4
  CUSTOMERS_FILE = "database/customers.xlsx"
5
  MENU_FILE = "database/menu.xlsx"
6
  ORDERS_FILE = "database/orders.xlsx"
 
7
 
8
  def initialize_files():
9
+ if not os.path.exists("database"):
10
+ os.makedirs("database")
11
  if not os.path.exists(CUSTOMERS_FILE):
12
+ pd.DataFrame(columns=["Name", "Email", "Password"]).to_excel(CUSTOMERS_FILE, index=False)
13
  if not os.path.exists(MENU_FILE):
14
+ pd.DataFrame(columns=["Item", "Category", "Price"]).to_excel(MENU_FILE, index=False)
15
  if not os.path.exists(ORDERS_FILE):
16
+ pd.DataFrame(columns=["Table", "Customer", "OrderDetails", "TotalAmount"]).to_excel(ORDERS_FILE, index=False)