Create utils/file_initializer.py
Browse files- utils/file_initializer.py +24 -0
utils/file_initializer.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|