0% found this document useful (0 votes)
44 views47 pages

Smart Grocery Inventory System Project

The document presents a project report on the 'Smart Grocery Inventory System' developed by students of SSM Central School for their Grade XII Computer Science curriculum. The system, built using Python and MySQL, aims to automate grocery inventory management, track expiry dates, and enhance operational efficiency while promoting sustainable practices. It includes features for managing product details, generating alerts for low stock and expiring items, and provides a practical learning experience in software development.

Uploaded by

nicipig995
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views47 pages

Smart Grocery Inventory System Project

The document presents a project report on the 'Smart Grocery Inventory System' developed by students of SSM Central School for their Grade XII Computer Science curriculum. The system, built using Python and MySQL, aims to automate grocery inventory management, track expiry dates, and enhance operational efficiency while promoting sustainable practices. It includes features for managing product details, generating alerts for low stock and expiring items, and provides a practical learning experience in software development.

Uploaded by

nicipig995
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SSM CENTRAL SCHOOL

SENIOR SECONDARY
Affiliated to CBSE No. 1930378
KUPPANDAPALAYAM – 638 008.

A Group Project Report on

“SMART GROCERY INVENTORY SYSTEM”


Submitted to CBSE, Delhi in Partial fulfilment
of the requirements for the award of
Grade XII – COMPUTER SCIENCE
for the academic year (2025-2026)
DONE BY
aadithya Shanmugam
akShay v
adheSShwar m

1
INTRODUCTION
Under the Guidance of [Link] KUMAR [Link].,[Link].,

CERTIFICATE
This is to certify that
AKSHAY V
Of class XII has successfully
Completed the project under the
Guidance of Mr. R .SIVA KUMAR during the year
2025-2026 titled,
“SMART GROCERY INVENTORY SYSTEM”
Station: … … … … … … …

Date: … … … … … … …

Staff –in- Charge

Submitted for the Annual Practical Examination held on … … … …

INTERNAL ASSESSMENT

Internal Examiner PRINCIPAL External Examiner

2
ACKNOWLEDGEMENT
It is a great pleasure to express my sincere gratitude to those who have
contributed to my learning through their support, encouragement and
guidance. First of all I thank God, the almighty for his blessings and kindness to
complete this project work with grand success.

I sincerely thank the Management, SSM GROUP OF INSTITUTIONS,


Komarapalayam for providing me the necessary facilities for the completion of
the project.

With great pleasure, I place on record my deep gratitude to the Principal,


Mr. MIRASH KAREEM SSM CENTRAL SCHOOL SENIOR SECONDARY,
Kuppandapalayam for providing all the facilities for the completion of the
project.

I am grateful for the co-operation and valuable suggestions rendered by


Mr.R. SIVA KUMAR PGT Department of Computer Science, for her sincere
assistance, valuable guidance and careful reviews, without which my effort
would have been in vain.

And Finally, I thankfully acknowledge the valuable suggestions and


assistance rendered by my parents and friends who were always been a great
inspiration to the success of this project.
3
4
Smart Grocery Inventory System
with Expiry Date Tracking

1. Introduction

5
In the modern retail industry, efficient inventory management plays a
crucial role in the success of supermarkets, grocery stores, and retail chains.
Managing hundreds or thousands of products manually is a complex task that
often leads to errors, overstocking, expired goods, or stockouts. Traditional
record-keeping using registers or spreadsheets cannot effectively handle the
fast-paced and dynamic nature of retail operations.
To address these challenges, the Smart Grocery Inventory System
with Expiry Date Tracking has been designed using Python as the front-end
programming language and MySQL as the back-end database. This system
offers a smart, automated, and user-friendly solution for managing grocery
stock details efficiently.
The system allows users to:
 Add and manage product details such as Item ID, Name, Quantity,
Price, and Expiry Date.
 Automatically track expiry dates, marking items as “Expiring Soon” or
“Expired” based on the current date.
 Display all products in a structured format for easy monitoring.
 Alert users when stock levels are low, ensuring timely reordering.
 Search for specific products quickly by Item ID or Name, improving
accessibility and efficiency.
By integrating Python’s simplicity and logic-handling power with
MySQL’s structured data storage and retrieval, this project ensures that
data remains accurate, consistent, and permanently stored. The use of
6
databases also allows for better organization and scalability — making it
possible to manage even large inventories without performance issues.
Beyond its technical benefits, this system also promotes eco-friendly
business practices by reducing wastage through timely identification of
soon-to-expire goods. It supports cost control and customer satisfaction by
ensuring only fresh products are available for sale.
This project is not only an academic exercise but also a real-world
applicable system that mirrors the core functionalities of professional
inventory management software used in modern supermarkets. It highlights
the importance of automation, database management, and efficient
programming in solving practical problems faced by businesses every day.

Objectives
The primary objective of this project, “Smart Grocery Inventory System
with Expiry Date Tracking,” is to create a comprehensive and intelligent
system that simplifies grocery store management using Python and MySQL.
The system aims to automate day-to-day inventory operations while ensuring
accuracy, efficiency, and sustainability.
Below are the detailed objectives of this project:

1. To develop an automated grocery inventory management


system

7
The first objective is to design and implement a system that can manage
grocery data efficiently without manual intervention. The system allows the
user to add, modify, delete, and display product information in a structured
and organized manner. By automating these tasks, the system saves time and
reduces the possibility of human error in maintaining records.

2. To provide secure and permanent data storage using MySQL


One of the main goals of the project is to ensure that all data entered by
the user — such as product details, quantities, and expiry dates — are stored
permanently in a MySQL database.
Unlike temporary storage in Python lists or files, the use of a relational
database ensures data integrity, easy access, and scalability. It also allows
multiple users to retrieve or update information efficiently in a multi-user
environment.

3. To track expiry dates of perishable items


Managing expiry dates is a major challenge in grocery stores. This
project integrates date comparison logic to identify products that are expired
or about to expire (within 5 days).
The system automatically marks such items with alerts like “Expired!” or
“Expiring Soon”, enabling store staff to take immediate action — such as

8
removing, discounting, or restocking — thus reducing wastage and ensuring
customer safety.

4. To generate alerts for low stock and expiring items


Another key objective is to implement automatic notifications within
the program that alert users when:
 Stock quantity falls below a minimum level (e.g., less than 5 units).
 Products are nearing their expiry dates.
These alerts help maintain continuous product availability, avoid
overstocking, and ensure that customers always receive fresh items.

5. To enhance operational accuracy and efficiency


The system replaces manual record-keeping with a digital solution,
thereby increasing accuracy in data management.
It eliminates duplication errors, incorrect calculations, and misplaced records
that are common in manual systems. The automation of repetitive tasks such
as checking expiry and updating stock significantly boosts the efficiency of
store operations.

6. To simplify searching and updating of inventory records


The system provides search and update functionalities that allow users
to find specific products using keywords or IDs instantly.
9
This reduces time and effort compared to manual searching through ledgers
or spreadsheets. The system can quickly display item details, making it
convenient for real-time decision-making, stock checking, and sales
management.

7. To integrate Python with MySQL for real-world application


This project also serves as a demonstration of how Python, a high-level
programming language, can be integrated with MySQL, a robust database
management system.
Through this integration, students learn how front-end application logic
(Python) interacts with back-end storage (MySQL), forming the foundation of
modern software development practices.

8. To encourage sustainable and smart inventory practices


A key objective of this project is to promote eco-friendly business
practices by minimizing product wastage.
By tracking expiry dates and managing stock efficiently, the system helps
stores adopt sustainable methods that reduce financial loss and
environmental impact.

9. To create a scalable and extensible system

10
The design of the system is flexible and modular, making it easy to add
new features in the future.
Possible extensions include:
 Adding a Graphical User Interface (GUI) using Tkinter or PyQt.
 Integrating email or SMS notifications for expiry alerts.
 Generating sales and inventory reports in Excel or PDF format.
 Using cloud storage for real-time synchronization between multiple
branches.

10. To provide an educational and practical learning experience


Beyond its commercial applications, this project aims to help students
understand core Computer Science concepts such as:
 Database connectivity
 CRUD (Create, Read, Update, Delete) operations
 Conditional logic and loops
 Date/time handling in Python
 Real-world software design and problem-solving
By applying theoretical knowledge to a functional project, students gain
confidence and practical exposure to software development.

Summary of Objectives
In summary, the project’s objectives can be grouped as follows:

11
Category Objective Description
Automate inventory management and expiry
Functional
tracking
Integrate Python with MySQL for persistent data
Technical
handling
Reduce errors, improve efficiency, and generate
Operational
useful alerts
Sustainability Minimize waste through expiry management
Apply computer science concepts in a real-world
Educational
context

Overall Goal:
To design a smart, efficient, and user-friendly grocery inventory management
system that not only automates daily store operations but also demonstrates
the power of Python–MySQL integration in solving real-world problems
effectively.

12
Smart Grocery Inventory System with Expiry Date Tracking

2. Source Code.

13
"""
Smart Grocery Inventory System with Expiry Date Tracking
Class 12 CBSE Computer Science Project
Python + MySQL Integration
"""

import [Link]
from [Link] import Error
from datetime import datetime, timedelta
from tabulate import tabulate
import sys

DATABASE CONFIGURATION

class DatabaseConfig:
"""Database configuration and connection management"""

HOST = 'localhost'
USER = 'root' # Change to your MySQL username
PASSWORD = '' # Change to your MySQL password
DATABASE = 'grocery_inventory'

@staticmethod
def create_connection():

14
"""Create and return database connection"""
try:
connection = [Link](
host=[Link],
user=[Link],
password=[Link]
)
if connection.is_connected():
return connection
except Error as e:
print(f"Error connecting to MySQL: {e}")
return None

@staticmethod
def create_database():
"""Create database and table if they don't exist"""
connection = DatabaseConfig.create_connection()
if connection:
try:
cursor = [Link]()

# Create database
[Link](f"CREATE DATABASE IF NOT EXISTS
{[Link]}")

15
print(f"Database '{[Link]}' is ready")

# Use the database


[Link](f"USE {[Link]}")

# Create table
create_table_query = """
CREATE TABLE IF NOT EXISTS products (
item_id INT AUTO_INCREMENT PRIMARY KEY,
item_name VARCHAR(100) NOT NULL,
category VARCHAR(50),
quantity INT NOT NULL,
price DECIMAL(10, 2) NOT NULL,
expiry_date DATE NOT NULL,
date_added TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
INDEX idx_expiry (expiry_date),
INDEX idx_name (item_name)
)
"""
[Link](create_table_query)
print("Table 'products' is ready")

[Link]()
[Link]()
[Link]()
16
except Error as e:
print(f"Error creating database/table: {e}")

INVENTORY MANAGEMENT SYSTEM

class GroceryInventory:
"""Main class for grocery inventory operations"""

def __init__(self):
"""Initialize the inventory system"""
[Link] = None
self.connect_to_database()

def connect_to_database(self):
"""Establish connection to the database"""
try:
[Link] = [Link](
host=[Link],
user=[Link],
password=[Link],
database=[Link]
)
if [Link].is_connected():
print("Connected to MySQL database successfully")
17
except Error as e:
print(f"Error connecting to database: {e}")
[Link](1)

def close_connection(self):
"""Close database connection"""
if [Link] and [Link].is_connected():
[Link]()
print("Database connection closed")

PRODUCT OPERATIONS

def add_product(self):
"""Add a new product to inventory"""
print("\n" + "="*70)
print("ADD NEW PRODUCT")
print("="*70)

try:
# Get product details from user
item_name = input("Enter Product Name: ").strip()
if not item_name:
print("ERROR: Product name cannot be empty!")
return

18
category = input("Enter Category (e.g., Dairy, Snacks, Beverages):
").strip()

quantity = int(input("Enter Quantity: "))


if quantity < 0:
print("ERROR: Quantity cannot be negative!")
return

price = float(input("Enter Price (Rs.): "))


if price < 0:
print("ERROR: Price cannot be negative!")
return

expiry_date_str = input("Enter Expiry Date (YYYY-MM-DD): ").strip()

# Validate date format


try:
expiry_date = [Link](expiry_date_str, '%Y-%m-
%d').date()
except ValueError:
print("ERROR: Invalid date format! Use YYYY-MM-DD")
return

# Insert into database


cursor = [Link]()
19
insert_query = """
INSERT INTO products (item_name, category, quantity, price,
expiry_date)
VALUES (%s, %s, %s, %s, %s)
"""
values = (item_name, category, quantity, price, expiry_date)

[Link](insert_query, values)
[Link]()

print(f"\nSUCCESS: Product '{item_name}' added successfully!")


print(f" Item ID: {[Link]}")

[Link]()

except ValueError:
print("ERROR: Invalid input! Please enter correct data types.")
except Error as e:
print(f"ERROR: Database error - {e}")

def view_all_products(self):
"""Display all products with expiry status"""
print("\n" + "="*90)
print("ALL PRODUCTS IN INVENTORY")
print("="*90)
20
try:
cursor = [Link]()
select_query = """
SELECT item_id, item_name, category, quantity, price, expiry_date
FROM products
ORDER BY expiry_date ASC
"""
[Link](select_query)
products = [Link]()

if not products:
print("\nNo products found in inventory.")
[Link]()
return

# Prepare data for table display


table_data = []
today = [Link]().date()
expiry_threshold = today + timedelta(days=5)

for product in products:


item_id, name, category, quantity, price, expiry_date = product

# Determine expiry status


21
if expiry_date < today:
status = "[EXPIRED]"
elif expiry_date <= expiry_threshold:
days_left = (expiry_date - today).days
status = f"[EXPIRING SOON - {days_left}d]"
else:
status = "[FRESH]"

# Check stock status


stock_status = " [LOW STOCK]" if quantity < 5 else ""

table_data.append([
item_id,
name,
category if category else "N/A",
f"{quantity}{stock_status}",
f"Rs.{price:.2f}",
expiry_date.strftime('%Y-%m-%d'),
status
])

# Display table
headers = ["ID", "Product Name", "Category", "Quantity", "Price",
"Expiry Date", "Status"]
print("\n" + tabulate(table_data, headers=headers, tablefmt="grid"))
22
# Summary statistics
total_products = len(products)
expired_count = sum(1 for p in products if p[5] < today)
expiring_soon_count = sum(1 for p in products if today <= p[5] <=
expiry_threshold)
low_stock_count = sum(1 for p in products if p[3] < 5)

print("\n" + "="*90)
print(f"SUMMARY: Total Products: {total_products} | "
f"Expired: {expired_count} | Expiring Soon: {expiring_soon_count} |
Low Stock: {low_stock_count}")
print("="*90)

[Link]()

except Error as e:
print(f"ERROR: Database error - {e}")

def search_product(self):
"""Search for products by name or ID"""
print("\n" + "="*70)
print("SEARCH PRODUCT")
print("="*70)

23
print("\n1. Search by Item ID")
print("2. Search by Product Name")

choice = input("\nEnter your choice (1-2): ").strip()

try:
cursor = [Link]()

if choice == '1':
item_id = int(input("Enter Item ID: "))
query = "SELECT * FROM products WHERE item_id = %s"
[Link](query, (item_id,))

elif choice == '2':


search_term = input("Enter Product Name (partial match allowed):
").strip()
query = "SELECT * FROM products WHERE item_name LIKE %s"
[Link](query, (f"%{search_term}%",))

else:
print("ERROR: Invalid choice!")
[Link]()
return

results = [Link]()
24
if not results:
print("\nNo products found matching your search.")
[Link]()
return

# Display results
table_data = []
today = [Link]().date()

for product in results:


item_id, name, category, quantity, price, expiry_date, date_added =
product

# Determine expiry status


if expiry_date < today:
status = "[EXPIRED]"
elif expiry_date <= today + timedelta(days=5):
days_left = (expiry_date - today).days
status = f"[EXPIRING SOON - {days_left}d]"
else:
status = "[FRESH]"

table_data.append([
item_id,
25
name,
category if category else "N/A",
quantity,
f"Rs.{price:.2f}",
expiry_date.strftime('%Y-%m-%d'),
status
])

headers = ["ID", "Product", "Category", "Qty", "Price", "Expiry", "Status"]


print("\n" + tabulate(table_data, headers=headers, tablefmt="grid"))

[Link]()

except ValueError:
print("ERROR: Invalid input!")
except Error as e:
print(f"ERROR: Database error - {e}")

def update_product(self):
"""Update product details"""
print("\n" + "="*70)
print("UPDATE PRODUCT")
print("="*70)

try:
26
item_id = int(input("Enter Item ID to update: "))

# Check if product exists


cursor = [Link]()
[Link]("SELECT * FROM products WHERE item_id = %s",
(item_id,))
product = [Link]()

if not product:
print(f"\nERROR: Product with ID {item_id} not found!")
[Link]()
return

# Display current details


print(f"\nCurrent Details:")
print(f" Name: {product[1]}")
print(f" Category: {product[2]}")
print(f" Quantity: {product[3]}")
print(f" Price: Rs.{product[4]}")
print(f" Expiry Date: {product[5]}")

print("\n" + "-"*70)
print("What would you like to update?")
print("1. Quantity")
print("2. Price")
27
print("3. Expiry Date")
print("4. All Details")

choice = input("\nEnter your choice (1-4): ").strip()

if choice == '1':
new_quantity = int(input("Enter new quantity: "))
if new_quantity < 0:
print("ERROR: Quantity cannot be negative!")
return
[Link]("UPDATE products SET quantity = %s WHERE item_id
= %s",
(new_quantity, item_id))
print(f"SUCCESS: Quantity updated to {new_quantity}")

elif choice == '2':


new_price = float(input("Enter new price (Rs.): "))
if new_price < 0:
print("ERROR: Price cannot be negative!")
return
[Link]("UPDATE products SET price = %s WHERE item_id =
%s",
(new_price, item_id))
print(f"SUCCESS: Price updated to Rs.{new_price:.2f}")

28
elif choice == '3':
new_expiry = input("Enter new expiry date (YYYY-MM-DD): ").strip()
try:
expiry_date = [Link](new_expiry, '%Y-%m-%d').date()
[Link]("UPDATE products SET expiry_date = %s WHERE
item_id = %s",
(expiry_date, item_id))
print(f"SUCCESS: Expiry date updated to {new_expiry}")
except ValueError:
print("ERROR: Invalid date format!")
return

elif choice == '4':


name = input("Enter new product name: ").strip()
category = input("Enter new category: ").strip()
quantity = int(input("Enter new quantity: "))
price = float(input("Enter new price (Rs.): "))
expiry = input("Enter new expiry date (YYYY-MM-DD): ").strip()

expiry_date = [Link](expiry, '%Y-%m-%d').date()

update_query = """
UPDATE products
SET item_name=%s, category=%s, quantity=%s, price=%s,
expiry_date=%s
29
WHERE item_id=%s
"""
[Link](update_query, (name, category, quantity, price,
expiry_date, item_id))
print("SUCCESS: All details updated successfully!")

else:
print("ERROR: Invalid choice!")
[Link]()
return

[Link]()
[Link]()

except ValueError:
print("ERROR: Invalid input!")
except Error as e:
print(f"ERROR: Database error - {e}")

def delete_product(self):
"""Delete a product from inventory"""
print("\n" + "="*70)
print("DELETE PRODUCT")
print("="*70)

30
try:
item_id = int(input("Enter Item ID to delete: "))

# Check if product exists


cursor = [Link]()
[Link]("SELECT item_name FROM products WHERE item_id =
%s", (item_id,))
product = [Link]()

if not product:
print(f"\nERROR: Product with ID {item_id} not found!")
[Link]()
return

# Confirm deletion
confirm = input(f"\nWARNING: Are you sure you want to delete
'{product[0]}'? (yes/no): ").strip().lower()

if confirm == 'yes':
[Link]("DELETE FROM products WHERE item_id = %s",
(item_id,))
[Link]()
print(f"\nSUCCESS: Product '{product[0]}' deleted successfully!")
else:
print("\nDeletion cancelled.")
31
[Link]()

except ValueError:
print("ERROR: Invalid input!")
except Error as e:
print(f"ERROR: Database error - {e}")

def show_alerts(self):
"""Display alerts for expired and low stock items"""
print("\n" + "="*90)
print("ALERTS & NOTIFICATIONS")
print("="*90)

try:
cursor = [Link]()
today = [Link]().date()
expiry_threshold = today + timedelta(days=5)

# Expired items
[Link]("SELECT item_id, item_name, expiry_date FROM
products WHERE expiry_date < %s", (today,))
expired = [Link]()

# Expiring soon items


32
[Link]("""
SELECT item_id, item_name, expiry_date
FROM products
WHERE expiry_date >= %s AND expiry_date <= %s
""", (today, expiry_threshold))
expiring_soon = [Link]()

# Low stock items


[Link]("SELECT item_id, item_name, quantity FROM products
WHERE quantity < 5")
low_stock = [Link]()

has_alerts = False

# Display expired items


if expired:
has_alerts = True
print("\n[EXPIRED ITEMS] - Remove immediately:")
print("-" * 90)
for item in expired:
days_expired = (today - item[2]).days
print(f" * ID: {item[0]:3d} | {item[1]:35s} | Expired {days_expired}
days ago")

# Display expiring soon items


33
if expiring_soon:
has_alerts = True
print("\n[EXPIRING SOON] - Within 5 days:")
print("-" * 90)
for item in expiring_soon:
days_left = (item[2] - today).days
print(f" * ID: {item[0]:3d} | {item[1]:35s} | {days_left} days
remaining")

# Display low stock items


if low_stock:
has_alerts = True
print("\n[LOW STOCK] - Below 5 units:")
print("-" * 90)
for item in low_stock:
print(f" * ID: {item[0]:3d} | {item[1]:35s} | Only {item[2]} units
left")

if not has_alerts:
print("\nNo alerts at this time. All products are fresh and well-
stocked.")

print("\n" + "="*90)
[Link]()

34
except Error as e:
print(f"ERROR: Database error - {e}")

def generate_report(self):
"""Generate inventory summary report"""
print("\n" + "="*90)
print("INVENTORY REPORT")
print("="*90)

try:
cursor = [Link]()

# Total products
[Link]("SELECT COUNT(*) FROM products")
total_products = [Link]()[0]

# Total inventory value


[Link]("SELECT SUM(quantity * price) FROM products")
total_value = [Link]()[0] or 0

# Category-wise breakdown
[Link]("""
SELECT category, COUNT(*), SUM(quantity), SUM(quantity * price)
FROM products
GROUP BY category
35
ORDER BY category
""")
category_data = [Link]()

# Expiry analysis
today = [Link]().date()
[Link]("SELECT COUNT(*) FROM products WHERE expiry_date
< %s", (today,))
expired_count = [Link]()[0]

[Link]("""
SELECT COUNT(*) FROM products
WHERE expiry_date >= %s AND expiry_date <= %s
""", (today, today + timedelta(days=5)))
expiring_soon_count = [Link]()[0]

# Low stock count


[Link]("SELECT COUNT(*) FROM products WHERE quantity <
5")
low_stock_count = [Link]()[0]

# Display report
print(f"\nOverall Summary:")
print(f" Total Products: {total_products}")
print(f" Total Inventory Value: Rs.{total_value:.2f}")
36
print(f" Expired Items: {expired_count}")
print(f" Expiring Soon: {expiring_soon_count}")
print(f" Low Stock Items: {low_stock_count}")

if category_data:
print(f"\nCategory-wise Breakdown:")
print("-" * 90)
table_data = []
for cat in category_data:
category = cat[0] if cat[0] else "Uncategorized"
table_data.append([
category,
cat[1],
cat[2],
f"Rs.{cat[3]:.2f}"
])

headers = ["Category", "Products", "Total Qty", "Total Value"]


print(tabulate(table_data, headers=headers, tablefmt="grid"))

print("\n" + "="*90)
[Link]()

except Error as e:
print(f"ERROR: Database error - {e}")
37
MAIN MENU SYSTEM

def display_menu():
"""Display the main menu"""
print("\n" + "="*90)
print(" " * 25 + "SMART GROCERY INVENTORY SYSTEM")
print("="*90)
print("\nMAIN MENU:")
print("\n 1. Add New Product")
print(" 2. View All Products")
print(" 3. Search Product")
print(" 4. Update Product")
print(" 5. Delete Product")
print(" 6. View Alerts (Expired/Low Stock)")
print(" 7. Generate Report")
print(" 8. Exit System")
print("\n" + "="*90)

def main():
"""Main function to run the inventory system"""
print("\n" + "="*90)
print(" " * 20 + "SMART GROCERY INVENTORY SYSTEM")
38
print(" " * 23 + "with Expiry Date Tracking")
print(" " * 30 + "Python + MySQL")
print("="*90)
print("\nInitializing system...")

# Create database and table


DatabaseConfig.create_database()

# Create inventory object


inventory = GroceryInventory()

# Main program loop


while True:
display_menu()

choice = input("Enter your choice (1-8): ").strip()

if choice == '1':
inventory.add_product()

elif choice == '2':


inventory.view_all_products()

elif choice == '3':


inventory.search_product()

39
elif choice == '4':
inventory.update_product()

elif choice == '5':


inventory.delete_product()

elif choice == '6':


inventory.show_alerts()

elif choice == '7':


inventory.generate_report()

elif choice == '8':


print("\n" + "="*90)
print("Thank you for using Smart Grocery Inventory System!")
print("="*90)
inventory.close_connection()
[Link](0)

else:
print("\nERROR: Invalid choice! Please enter a number between 1 and
8.")

input("\nPress Enter to continue...")

40
PROGRAM ENTRY POINT

if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print("\n\nProgram interrupted by user.")
print("Goodbye!")
[Link](0)
except Exception as e:
print(f"\nERROR: Unexpected error - {e}")
[Link](1)

Smart Grocery Inventory System with Expiry Date Tracking

41
3. Output.

1. System Initialization and Main Menu

42
2. Add New Product

3. View All Products


43
4. Search Product

5. Update Product

44
6. Delete Product

7. Alerts

45
8. Generate Report

9. Exit System
46
47

Common questions

Powered by AI

The system ensures data integrity and security by using MySQL as the database for storing sensitive product details, which provides robust data protection and consistent structure for data handling. By avoiding temporary storage in volatile media, it maintains the accuracy and reliability of the data, allowing secure multi-user access and preventing integrity breaches .

Implementing the Smart Grocery Inventory System significantly enhances customer satisfaction by ensuring that only fresh products are available, reducing the risk of purchasing expired goods. Timely restocking of low inventory items keeps popular products on shelves, which addresses customer needs and builds trust. By streamlining operations, stores can focus more on customer service, resulting in an overall improved shopping experience .

The system is designed to be scalable by using MySQL for data storage, which supports high data volumes and allows efficient multi-user data retrieval and updates. Its modular design suggests potential for future enhancements like adding GUI interfaces, integrating notifications, and using cloud storage. This scalability allows stores to efficiently expand inventory management capabilities as they grow without impacting system performance .

The system facilitates real-time monitoring by providing structured display of all inventory items, marking items approaching expiry, flagging low stock alerts, and enabling quick searches by product ID or name. Automated alerts for upcoming expirations and stock shortages ensure proactive inventory management, helping store managers make informed, timely decisions .

The Smart Grocery Inventory System integrates Python with MySQL to handle inventory management efficiently. Python is used for application logic due to its simplicity and capability for task automation, while MySQL provides robust and permanent data storage. This integration ensures data accuracy, consistency, and scalability, accommodating large inventories without performance issues .

The system enhances operational efficiency by digitizing inventory management, which eliminates manual record-keeping errors, speeds up data retrieval, and automates stock checks and updates. With features like low stock alerts, expiry date tracking, and instant search functionalities, it ensures smooth and efficient inventory oversight, reduces human intervention, and optimizes resource usage .

The system addresses multiple challenges of manual inventory management, such as errors due to manual data entry, overstocking, product wastage, and stockouts. By automating the process, it reduces errors, ensures that stock levels are maintained correctly, and alerts for expiration dates and low stock levels help prevent overstocking and wastage, ensuring product availability .

Key programming concepts applied include database connectivity with MySQL, CRUD operations (Create, Read, Update, Delete), conditional logic, loops, and date/time handling in Python. These concepts are foundational to the system's ability to automate inventory tasks, manage data securely, and interface between front-end logic and back-end storage .

Students gain hands-on experience with database connectivity, application of CRUD operations, and use of Python for handling real-world software development challenges. The project provides practical exposure to concepts like conditional logic, loops, and date/time handling, empowering students with confidence in software design and problem-solving .

The Smart Grocery Inventory System enhances sustainability by reducing waste through effective expiry date tracking. By automatically marking products as 'Expiring Soon' or 'Expired', it allows store staff to take timely actions such as removing or discounting soon-to-expire items, thus preventing wastage. This contributes to eco-friendly practices and ensures that customers access fresh items, aligning with sustainability goals .

You might also like