Python Dbms Project New One by Sagar Singh Rawat

Download as pdf or txt
Download as pdf or txt
You are on page 1of 32

PROJECT REPORT

ON
“Book Inventory”

Under The Supervision of Submitted By


Mr. Ashish Vishwakarma Sagar Singh Rawat
(Assistant Professor-USCS) BCA 3rd semester
ACKNOWLEDGEMENT

The most awaited moment of any endeavor is successful completion, but nothing can be done successfully
if done alone. Success is the outcome of contribution and consistent help of various persons and we thank
those ones who helped us in successful completion of this project.

Primarily I would like to thank Prof (Dr.) Sonal Sharma, Dean-USCS for providing a healthy and
encouraging environment to study.

I profusely thankful to the Dr. Monisha Awasthi, Program Coordinator- BCA 2nd Year, Associate
Professor-USCS for providing all the required resources in the successful completion of my project report.

I express my thanks to Mr. Ashish Vishwakarma, Project Mentor and Assistant Professor-USCS. He
has been generous enough to provide me an opportunity and accepting my candidature for the most
valuable guidance and affordable treatment given to us at every stage to boost my morale.

Sagar Singh Rawat


Roll No: 52
B.C.A :- 3rd Semester
DECLARATION

I hereby declare that the project report entitled Title of Your Project submitted by Sagar Singh Rawat to
Uttaranchal School of Computing Sciences. The project report was done under the guidance of Mr. Ashish
Vishwakarma, Assistant Professor-USCS. I further declare that the work reported in this project report has
not been submitted and will not be submitted, either in part or in full, for the award of any other degree or
diploma in this university or any other university or institute.

Sagar Singh Rawat

Roll No: 52
B.C.A:- 3rd Semester
CERTIFICATE

This is to certify Sagar Singh Rawat student of BCA 3rd Semester, of Uttaranchal School of
Computing Sciences, Dehradun, has completed the Project Report for the topic Book Inventory for
the session (2023- 2024).

Under the guidance of:


Mr. Ashish Vishwakarma
Assistant Professor-USCS
Uttaranchal University
Dehradun
INTRODUCTION

We are creating a Window application for “BOOK INVENTORY” In Python and SQL
language by using IDLE Python & My SQL.

A Book Inventory system is a software application that is designed to help manage and
organize is a collection of books .this system is commonly used by libraries ,schools ,
bookstores, and individuals ,who have large number of books to keep track of the book
management system typically consists of a database that contains information about each
Book ,such as its title ,author , ISBM, publication date, and genre .

The Book Inventory system can help automate many tasks related to book management,
such as adding new books to the database, tracking book loans, and generating reports on
the collection. This system allows users to easily search for books based on various criteria,
such as author or title, and can even provide recommendation based on previous reading
history or user preferences.

Book Inventory are designed to save time and increase efficiency in managing a large
number of books. They can also help reduce errors and minimize the risk of losing track of
books, which is especially important for libraries and other organization that have a
responsibility to maintain accurate records.

Overall, A Book Inventory is an essential tool for anyone who want to effectively manage
and organize their book collection, whether it is for personal use or for a large
organization. With the ability to quickly and easily track and organize book, this system
can save time, reduce errors, and make managing a collection of books much simpler and
more efficient.
OBJECTIVE

 Efficiently manage and organize books within a library or personal collection.


 Track information about each book, such as title, author, publisher, publication date,
genre, and location.
 Allow for easy searching and retrieval of books based on any of these attributes.
 Provide features for borrowing management, such as tracking which books have been
loaned out and to whom.
 Include features for tracking book reviews, ratings, and recommendations.
 Make it easier to find and access books as needed.
 Ensure that books are properly categorized and arranged for easy browsing and
selection.
 Help library staff or book collectors keep track of inventory and identify missing or
lost books.
 Provide reports and analytics on book circulation and usage patterns.
 Facilitate the process of purchasing new books and adding them to the collection.
SYSTEM ANALYSIS

EXISTING SYSTEM

 Various problems of physical system are described below :-


 If one is not very careful then there is a possibility of issuing more than one book to a
user.
 There is a possibility of issuing a book to a user, whose membership is not.
 When a user requests for the a book, one has to physically check for the presence of a
book in the library
 Answering management query is a time consuming process.
 Daily keeping a manual record of changes taking place in the library such as book
being issued, book being returned etc.can become cumbersome if the Library size is
bigger.

PROPOSED SYSTEM

The Book Inventory is a software application which avoids more manual hours in taking the
book, that need to spend in record keeping and generating reports. Maintaining of user details
is complex in manual system in terms of agreements, royalty and activities. This all have to
be maintained in ledgers or books. Co-coordinators needs to verify each record for small
information also.

 Easy search of book in the online library.


 Avoid the manual work.
 User need not go to the library for Issue any kind of book, he can renewal the book
online.
SOFTWARE & HARDWARE USED

Software Used

IDLE Python, My SQL

Hardware Used

Processor – Intel core i5


RAM – 4GB
Hard Disk – minimum space available 2-3 GB (512gSSD used)
Operating System – Windows/Linux

Technology Used

Python, SQL
MODULES

We are categorizing the modules in a single module.

 Admin
1. Add Book Records
2. Delete Book Record
3. Delete Full Inventory
4. Update Book Details
5. Change Book Availability
6. View All Book Present In Database
SYSTEM DESIGN

SYSTEM ANALYSIS AND DESIGN

The way that is followed by carrying on with the development of application is as followed.

DEFINING A PROBLEM

Defining a problem is one of the important activities of the project. The objective is to define
precisely the problem to be solved and there by determined the scope of the new system. The
phase consists of two main tasks. The fast task within this activity is to review the
organization needs to originally initiate the project. The second task is to identify, at an
abstractor general level, the expected capability of the new system. Thus, it helps to define
the goal to we achieved and the boundaries of your system. A clear understanding of the
problem will help using building a better system and reduce the risk of project failure. It also
specifies there source that has to be made available to the project. Three important factor
project goals, project bounce and the resource limits are sometimes called the projects in term
of reference.
FLOW CHART

A flow chart is a diagram of the steps in a process and their sequences. Also known as a process flow
diagram or process map.

START

MAIN MENU

ADD BOOKS INPUT

BOOK NAME
DATABASE
AUTHOR NAME

BOOK ID ENTER

SELECT PARTICULAR
DELETE BOOK RECORDS RECORD FOR DELETE ENTER

DELETE FULL INVENTORY ENTER


BOOK NAME

BOOK ID
UPDATE BOOK DETAILS INPUT
AUTHOR NAME

CHANGE BOOK AVAILABILITY INPUT BOOK NAME


ENTER

AUTHOR NAME
ENTER
DATA FLOW DIAGRAM

DISPLAY
REPORT
ADMIN COMMAND
ADD BOOK

BOOK NAME DISPLAY


COMMAND STATUS

COMMAND AUTHER NAME

COMMAND BOOK ID

DELETE BOOK RECORD SELECT PARTICULAR DISPLAY


COMMAND
RECORD FOR DELETE STATUS

COMMAND DELETE FULL INVENTORY

DATABASE

BOOK NAME

COMMAND UPDATE BOOK DETAILS SYSTEM DISPLAY


BOOK ID

COMMAND
AUTHOR NAME

COMMAN D BOOK AVAILABILITY

COMMAND BOOK NAME

COMMAND AUTHOR NAME


GANTT CHART

A Gantt chart is a project management tool that shows project tasks on a timeline. It is a visual bar
graph representation of a project’s schedule. Typically, the rows comprise different project tasks, often
drilling down to individual lessons, with the timeline forming the chart’s columns

NOVEMBER

1.1 Requirements

1.2 Research and Analysis

1.3 Design

1.4 Review

1.5 Development

2.1 Research and Analysis

2.2 Design

1.6 Testing
CODING

# Importing all necessary modules


import sqlite3

from tkinter import *


import tkinter.ttk as ttk
import tkinter.messagebox as mb
import tkinter.simpledialog as sd

# Connecting to Database
connector = sqlite3.connect('library.db')
cursor = connector.cursor()

connector.execute(
'CREATE TABLE IF NOT EXISTS Library (BK_NAME TEXT, BK_ID TEXT PRIMARY KEY
NOT NULL, AUTHOR_NAME TEXT, BK_STATUS TEXT, CARD_ID TEXT)'
)

# Functions
def issuer_card():
Cid = sd.askstring('Issuer Card ID', 'What is the Issuer\'s Card
ID?\t\t\t')

if not Cid:
mb.showerror('Issuer ID cannot be zero!', 'Can\'t keep
Issuer ID empty, it must have a value')
else:
return Cid

def display_records():
global connector, cursor
global tree
tree.delete(*tree.get_children())

curr = connector.execute('SELECT * FROM Library')


data = curr.fetchall()

for records in data:


tree.insert('', END, values=records)

def clear_fields():
global bk_status, bk_id, bk_name, author_name, card_id

bk_status.set('Available')
for i in ['bk_id', 'bk_name', 'author_name', 'card_id']:
exec(f"{i}.set('')")
bk_id_entry.config(state='normal')
try:
tree.selection_remove(tree.selection()[0])
except:
pass

def clear_and_display():
clear_fields()
display_records()

def add_record():
global connector
global bk_name, bk_id, author_name, bk_status

if bk_status.get() == 'Issued':
card_id.set(issuer_card())
else:
card_id.set('N/A')

surety = mb.askyesno('Are you sure?',


'Are you sure this is the data you want to enter?\nPlease
note that Book ID cannot be changed in the future')

if surety:
try:
connector.execute(
'INSERT INTO Library (BK_NAME, BK_ID,
AUTHOR_NAME, BK_STATUS, CARD_ID) VALUES (?, ?, ?, ?, ?)',
(bk_name.get(), bk_id.get(),
author_name.get(), bk_status.get(), card_id.get()))
connector.commit()

clear_and_display()

mb.showinfo('Record added', 'The new record


was successfully added to your database')
except sqlite3.IntegrityError:
mb.showerror('Book ID already in use!',
'The Book ID you are trying to enter is
already in the database, please alter that book\'s record or check any discrepancies on your side')

def view_record():
global bk_name, bk_id, bk_status, author_name, card_id
global tree

if not tree.focus():
mb.showerror('Select a row!', 'To view a record, you
must select it in the table. Please do so before continuing.')
return

current_item_selected = tree.focus()
values_in_selected_item = tree.item(current_item_selected)
selection = values_in_selected_item['values']

bk_name.set(selection[0]) ; bk_id.set(selection[1]) ;
bk_status.set(selection[3])
author_name.set(selection[2])
try:
card_id.set(selection[4])
except:
card_id.set('')

def update_record():
def update():
global bk_status, bk_name, bk_id, author_name, card_id
global connector, tree

if bk_status.get() == 'Issued':
card_id.set(issuer_card())
else:
card_id.set('N/A')

cursor.execute('UPDATE Library SET BK_NAME=?,


BK_STATUS=?, AUTHOR_NAME=?, CARD_ID=? WHERE BK_ID=?',
(bk_name.get(), bk_status.get(),
author_name.get(), card_id.get(), bk_id.get()))
connector.commit()

clear_and_display()

edit.destroy()
bk_id_entry.config(state='normal')
clear.config(state='normal')

view_record()
bk_id_entry.config(state='disable')
clear.config(state='disable')

edit = Button(left_frame, text='Update Record', font=btn_font,


bg=btn_hlb_bg, width=20, command=update)
edit.place(x=50, y=375)

def remove_record():
if not tree.selection():
mb.showerror('Error!', 'Please select an item from the
database')
return

current_item = tree.focus()
values = tree.item(current_item)
selection = values["values"]

cursor.execute('DELETE FROM Library WHERE BK_ID=?',


(selection[1], ))
connector.commit()

tree.delete(current_item)

mb.showinfo('Done', 'The record you wanted deleted was


successfully deleted.')

clear_and_display()

def delete_inventory():
if mb.askyesno('Are you sure?', 'Are you sure you want to
delete the entire inventory?\n\nThis command cannot be reversed'):
tree.delete(*tree.get_children())
cursor.execute('DELETE FROM Library')
connector.commit()
else:
return

def change_availability():
global card_id, tree, connector

if not tree.selection():
mb.showerror('Error!', 'Please select a book from the
database')
return

current_item = tree.focus()
values = tree.item(current_item)
BK_id = values['values'][1]
BK_status = values["values"][3]

if BK_status == 'Issued':
surety = mb.askyesno('Is return confirmed?', 'Has the
book been returned to you?')
if surety:

cursor.execute('UPDATE Library SET


bk_status=?, card_id=? WHERE bk_id=?', ('Available', 'N/A', BK_id))
connector.commit()
else: mb.showinfo(
'Cannot be returned', 'The book status cannot be
set to Available unless it has been returned')
else:
cursor.execute('UPDATE Library SET bk_status=?,
card_id=? where bk_id=?', ('Issued', issuer_card(), BK_id))
connector.commit()

clear_and_display()

# Variables
lf_bg = 'LightSkyBlue' # Left Frame Background Color
rtf_bg = 'DeepSkyBlue' # Right Top Frame Background Color

rbf_bg = 'DodgerBlue' # Right Bottom Frame Background Color


btn_hlb_bg = 'SteelBlue' # Background color for Head Labels and Buttons

lbl_font = ('Georgia', 13) # Font for all labels


entry_font = ('Times New Roman', 12) # Font for all Entry widgets
btn_font = ('Gill Sans MT', 13)

# Initializing the main GUI window


root = Tk()
root.title('Library Management System by sagar verma')
root.geometry('1010x530')
root.resizable(0, 0)

Label(root, text='LIBRARY MANAGEMENT SYSTEM', font=("Noto Sans CJK TC", 15, 'bold'),
bg=btn_hlb_bg, fg='White').pack(side=TOP, fill=X)

# StringVars
bk_status = StringVar()
bk_name = StringVar()
bk_id = StringVar()
author_name = StringVar()
card_id = StringVar()

# Frames
left_frame = Frame(root, bg=lf_bg)
left_frame.place(x=0, y=30, relwidth=0.3, relheight=0.96)

RT_frame = Frame(root, bg=rtf_bg)


RT_frame.place(relx=0.3, y=30, relheight=0.2, relwidth=0.7)

RB_frame = Frame(root)
RB_frame.place(relx=0.3, rely=0.24, relheight=0.785, relwidth=0.7)

# Left Frame
Label(left_frame, text='Book Name', bg=lf_bg, font=lbl_font).place(x=98, y=25)
Entry(left_frame, width=25, font=entry_font, text=bk_name).place(x=45, y=55)

Label(left_frame, text='Book ID', bg=lf_bg, font=lbl_font).place(x=110, y=105)


bk_id_entry = Entry(left_frame, width=25, font=entry_font, text=bk_id)
bk_id_entry.place(x=45, y=135)

Label(left_frame, text='Author Name', bg=lf_bg, font=lbl_font).place(x=90, y=185)


Entry(left_frame, width=25, font=entry_font, text=author_name).place(x=45, y=215)

Label(left_frame, text='Status of the Book', bg=lf_bg, font=lbl_font).place(x=75, y=265)


dd = OptionMenu(left_frame, bk_status, *['Available', 'Issued'])
dd.configure(font=entry_font, width=12)
dd.place(x=75, y=300)

submit = Button(left_frame, text='Add new record', font=btn_font, bg=btn_hlb_bg, width=20,


command=add_record)
submit.place(x=50, y=375)

clear = Button(left_frame, text='Clear fields', font=btn_font, bg=btn_hlb_bg, width=20,


command=clear_fields)
clear.place(x=50, y=435)

# Right Top Frame


Button(RT_frame, text='Delete book record', font=btn_font, bg=btn_hlb_bg, width=17,
command=remove_record).place(x=8, y=30)
Button(RT_frame, text='Delete full inventory', font=btn_font, bg=btn_hlb_bg, width=17,
command=delete_inventory).place(x=178, y=30)
Button(RT_frame, text='Update book details', font=btn_font, bg=btn_hlb_bg, width=17,
command=update_record).place(x=348, y=30)
Button(RT_frame, text='Change Book Availability', font=btn_font, bg=btn_hlb_bg, width=19,
command=change_availability).place(x=518, y=30)

# Right Bottom Frame


Label(RB_frame, text='BOOK INVENTORY', bg=rbf_bg, font=("Noto Sans CJK TC", 15,
'bold')).pack(side=TOP, fill=X)

tree = ttk.Treeview(RB_frame, selectmode=BROWSE, columns=('Book Name', 'Book ID', 'Author',


'Status', 'Issuer Card ID'))

XScrollbar = Scrollbar(tree, orient=HORIZONTAL, command=tree.xview)


YScrollbar = Scrollbar(tree, orient=VERTICAL, command=tree.yview)
XScrollbar.pack(side=BOTTOM, fill=X)
YScrollbar.pack(side=RIGHT, fill=Y)

tree.config(xscrollcommand=XScrollbar.set, yscrollcommand=YScrollbar.set)

tree.heading('Book Name', text='Book Name', anchor=CENTER)


tree.heading('Book ID', text='Book ID', anchor=CENTER)
tree.heading('Author', text='Author', anchor=CENTER)
tree.heading('Status', text='Status of the Book', anchor=CENTER)
tree.heading('Issuer Card ID', text='Card ID of the Issuer', anchor=CENTER)

tree.column('#0', width=0, stretch=NO)


tree.column('#1', width=225, stretch=NO)
tree.column('#2', width=70, stretch=NO)
tree.column('#3', width=150, stretch=NO)
tree.column('#4', width=105, stretch=NO)
tree.column('#5', width=132, stretch=NO)

tree.place(y=30, x=0, relheight=0.9, relwidth=1)


clear_and_display()

# Finalizing the window


root.update()
root.mainloop()
OUTPUT

1. Main Menu

2. Add Book Record in Database


ENTER
3. All Book Present in Database

4. Delete A Record ( select one record from database and click on delete book
records)

ENTER
5. Update Book Details ( select one record for edit than you can edit on main
menu)

For Updating Books

6. Change Book Availability ( select of data for change , click change book
availability then enter the issuer’ id card id and ok )

For change book availability


TESTING

Testing System testing is designed to uncover the weaknesses that were not foundin earlier test.
In the testing phase, the program is executed with the explicit intention of finding errors. This
includes forced system failures and validation of the system, as its user in the operational
environment will implement it. For this purpose, test cases are developed. When a new system
replaces the old one, suchas in the present case, the organization can extract data from the old
system to test them on the new. Such data usually exist in sufficient volume to provide
sample listings and they can create a realistic environment that ensures eventual system
success. Regardless of the source of test data, the programmers and analyst will eventually
conduct four different types of tests.

SECURITY TESTING OF THE PROJECT

Unit testing focuses verification efforts on the smallest unit of the software design, the
module. This is also known as Module Testing. The modules are tested separately. This
testing is carried out during programming stage itself.

Validation Testing

Validation testing can be defined in many ways but a simple definition is that validation
succeeds when the software functions in a manner that can be reasonably expected by the
users. After validation test has been conducted one ofthe two possible conditions exists

1. The function or the performance characteristics confirm to specification and are accepted.

2. A deviation from specification is uncovered and a deficiency list is created.

Output Testing

After performing the validation testing the next step is output testing of the proposed system
since no system is useful if it does not produce the required output in the specific format. The
outputs generated or displayed by the system under consideration are tested by asking the
users about the formats required by them.

User Acceptance Testing

User acceptance of a system is a key factor for the success of any system. The system under
consideration is tested for user acceptance by constantly keeping in touch with prospective
system users at the time development and making changeswhenever required.

System verification and validation

System verification and validation is done to check the quality of the software insimulated and
live environment. A number of different transactions are used to perform verification.
Validation is the process of demonstrating that the implemented software does satisfy the
system requirements. One aspect ofsoftware validation is to statistically analyze the program
without resorting to actual execution. The system validation done in such-a-way that the
system response time will not cause any hardship to the user.

White Box Testing

White box testing is a test case design method that uses the control structure of the procedural
design to derive test cases. Using white box testing methods, we can derive test cases that

❖ Guarantee that all independent paths within a module have been exercised at least once.

❖ Exercise all logical decisions on their true and false sides.

❖ Execute all loops at their boundaries and within their operational bounds.

❖ Exercise internal data structures to ensure their validity.

Black Box Testing

Black box testing methods focus on the functional requirements if the software.That is, black
box testing enables us to derive sets of input conditions that will fully exercise all functional
requirements of the program. Black box testing attempts to find errors in following categories:

➢ Incorrect or missing functions

➢ Interface errors

➢ Performance errors

➢ Initialization and termination error.


FUTURE SCOPE

As now the project/software will work upon command prompt in future we will make GUI
(Graphical User Interface) or web-based software/system so that every user can access it very
easily. Student also be a user of this system. Performance will be improved day to day users
increment.In future we can convert it in android application (APP).

1. Integration of Advanced Technologies: Implementing cutting-edge technologies like AI and

machine learning for predictive analytics, recommending books based on user preferences, or

automating routine tasks like book categorization.

2. Enhanced User Experience: Developing a user-friendly interface for both librarians and

patrons, making it intuitive and easily navigable. Introducing features like personalized

dashboards, easy search options, and mobile-friendly interfaces can significantly enhance user

satisfaction.

3. Mobile Application Development: Creating dedicated mobile apps for both Android and iOS

platforms to provide users with the flexibility to access library services on their smartphones or

tablets. This could include features like barcode scanning for book checkouts, push

notifications for overdue books, and renewal reminders.

4. Expansion of Services: Incorporating additional services such as digital lending (e-books,

audio books), inter-library loan management, or collaborative features like book clubs, forums,

or discussion boards to promote community engagement.

5. Data Analytics and Reporting: Implementing robust analytics tools to gather insights into

user behavior, popular book genres, borrowing patterns, etc. This data can aid in making

informed decisions about collection development and resource allocation.


6. Security and Privacy Enhancements: Strengthening the security measures to protect

sensitive user data and ensuring compliance with data privacy regulations such as GDPR,

HIPAA, etc.

7. API Integration and Interoperability: Integrating the library system with other educational

institutions, digital libraries, or online databases through APIs to provide a more

comprehensive resource pool for users.


BIBLIOGRAPHY

 https://www.geeksforgeeks.org/python-dictionary/?ref=lbp
 https://www.geeksforgeeks.org/python-oops-concepts/?ref=lbp
 https://www.geeksforgeeks.org/constructors-in-python/?ref=lbp
 https://www.javatpoint.com/python-lambda-functions
 https://www.javatpoint.com/python-while-loop
 https://www.javatpoint.com/python-mysql-database-connection
 https://www.javatpoint.com/python-dictionary

You might also like