restaurant-ordering-system / utils /file_initializer.py
nagasurendra's picture
Create utils/file_initializer.py
34e0e37 verified
raw
history blame
1.09 kB
import os
import pandas as pd
import json
CUSTOMERS_FILE = "database/customers.xlsx"
MENU_FILE = "database/menu.xlsx"
ORDERS_FILE = "database/orders.xlsx"
CONFIG_FILE = "utils/config.json"
def initialize_files():
if not os.path.exists(CUSTOMERS_FILE):
pd.DataFrame(columns=["Name", "Email", "Password", "Preferences", "Allergies", "Occasion"]).to_excel(CUSTOMERS_FILE, index=False)
if not os.path.exists(MENU_FILE):
pd.DataFrame(columns=["Dish Name", "Price", "Allergens", "Ingredients", "Nutrition", "Image", "Spice Level"]).to_excel(MENU_FILE, index=False)
if not os.path.exists(ORDERS_FILE):
pd.DataFrame(columns=["Table ID", "Customer Email", "Order Details", "Total Cost"]).to_excel(ORDERS_FILE, index=False)
if not os.path.exists(CONFIG_FILE):
config = {
"spice_levels": ["Mild", "Medium", "High"],
"preferences": ["Vegetarian", "Vegan", "Halal", "Full Menu"],
"occasions": ["Birthday", "Anniversary", "Other"]
}
with open(CONFIG_FILE, "w") as f:
json.dump(config, f)