MANSI Project Report 5
MANSI Project Report 5
PROJECT REPORT
ON
“CONTACT MANAGEMENT
SYSTEM ”
IN
THE PARTIAL FULFILMENT OF REQUIREMENTS FOR
THE AWARD OF DEGREE OF
(2024-2026)
I, MANSI, hereby declare that the work presented in the Project Report titled
“CONTACT MANAGEMENT SYSTEM ” and submitted as Industry Internship/
Project-I as part of MCA 2nd Semester to Department of Computer Science&
Applications, M.D. University, Rohtak is an authentic record of my work carried out
during the 2nd semester (Jan- June, 2025) under the supervision of Dr. GOPAL
SINGH, Associate Professor, Department of Computer Science & Applications.
Further, I also undertake that the matter embodied in this Project Report is my own
work and has not been submitted by me or by any other candidate for the award of any
other degree anywhere else.
MANSI RANA
Roll No. 24126
(Head of Department)
ACKNOWLEDGEMENT
Finally, I am thankful to the almighty God who has given me the power,
good sense and confidence to complete my project successfully. I also thank
my parents and friends who were a constant source of encouragement.
Their moral was indispensable.
The Contact Management System is a desktop-based application developed using Python as the front-
end programming language and SQLite as the back-end database. This project is designed to simplify
and automate the process of storing, retrieving, and managing personal or professional contact
information.
The system allows users to add, view, update, delete, and search contacts ef ciently. Each contact
record includes essential elds such as name, phone number, email address, and physical address. The
application features a user-friendly interface that enables easy interaction, SQLite, being a lightweight
and server less database engine, is integrated to provide fast and reliable data storage with no
con guration required, making the application portable and suitable for small-scale or personal use.
This project demonstrates the practical use of Python for application development and highlights the
effectiveness of SQLite in managing structured data. It is ideal for students and beginners looking to
understand the integration of Python with database systems.
fi
fi
fi
Table of Contents
Acknowledgement --------------------------------------------------------------3
Abstract --------------------------------------------------------------------------4
Page 6
1. PURPOSE
The primary purpose of developing the Contact Management System is to provide an ef cient, organized,
and user-friendly platform to store and manage contact information digitally. Traditional methods of
maintaining contacts manually or in spreadsheets are prone to errors, data loss, and are time-consuming. This
project aims to overcome such limitations by automating the process through a lightweight desktop
application.
3. Data Management:
To support basic database operations like add, update, delete, and view contact records in a
structured format.
4. Data Persistence:
To use SQLite, a lightweight, embedded database, for storing data locally and ensuring persistence
even after the application is closed.
5. User-Friendly Interface:
To provide a simple and interactive GUI ( or similar modules) for smooth user interaction, even for
non-technical users.
2. OBJECTIVES
The main objectives of the Contact Management System project are to design and implement a desktop-
based application that simpli es the process of managing contact information ef ciently and securely. This
project focuses on achieving the following goals:
The need for this application arises due to the following reasons:
Functional Scope:
◦ A simple, interactive interface developed using Tkinter (or similar Python GUI libraries).
5. Data Validation:
◦ Basic input validation to ensure correct and complete data entry (e.g., phone number format,
non-empty elds).
Page 8
fi
fi
fi
fi
fi
Technological Scope:
User Scope:
Python’s syntax is clean, readable, and concise. This makes it highly productive for building systems quickly
without excessive boilerplate code. When combined with SQL, which is the standard language for querying
relational databases, you get a powerful yet simple foundation for managing structured data like contacts.
A contact management system, at its core, deals with structured data — names, phone numbers, emails —
and SQL is exceptionally good at organising, searching, updating, and protecting that data. Python handles
the user interaction and logic ow, while SQL takes care of the heavy-lifting with the data.
Using SQLite, which is a server less, le-based database engine supported natively by Python, offers a
lightweight backend that requires no setup. This makes the system:
• Easy to deploy
Despite being lightweight, SQLite can handle thousands of contacts ef ciently, and the Python layer can be
modi ed to switch to a more powerful database like PostgreSQL or MySQL if scalability becomes an issue.
Page 9
fi
fl
fl
fi
fi
🔹 3. Strong Ecosystem and Integration
So, the base system can easily evolve into a desktop app, web app, or even integrate with third-party services
like Google Contacts or for messaging. The SQL layer remains compatible across all of these extensions.
With Python handling the logic (how data is manipulated) and SQL managing the data (how data is stored
and queried), there's a natural separation of concerns. This leads to cleaner architecture, easier debugging,
and better maintainability. Developers can:
Python allows fast prototyping. In a matter of hours, you can go from an idea to a working prototype with
full CRUD (Create, Read, Update, Delete) functionality. Since SQL doesn’t require additional frameworks,
setting up tables and data operations is instant. This speed of development is a major advantage in startups,
internal tools, or client demos.
Python has robust support for unit testing (unittest, pytest), and SQL queries are easy to verify with
predictable outputs. This makes the system testable at both the logic and database level. You can:
Such features are often vital in production systems that manage contact data.
Page 10
🔹 7. Security and Data Integrity
With SQL, you can enforce data integrity at the database level using constraints (e.g., unique emails or phone
numbers). Python can add additional layers of input validation and error handling. Together, they offer multi-
layered control over data correctness, which is essential in systems handling personal contact information.
Both Python and SQLite are free, open-source, and require minimal system resources. This makes the system
cost-effective and accessible to:
• Freelancers
• Small businesses
Python and SQL have massive communities and extensive documentation. If you hit a bug, need a new
feature, or want to integrate a library, chances are someone has already solved it or published a library for it.
This reduces development friction and increases con dence in building and maintaining such systems.
Page 11
fi
fi
CHAPTER -2
SYSTEM
DESIGN
&
ANALYSIS
Page 12
SYSTEM DESIGN AND ANALYSIS FOR CONTACT
MANAGEMENT
The System Design and Analysis phase is crucial for understanding how the Contact Management System
will function, what components are involved, and how data ows through the system. It focuses on both the
logical and physical aspects of the application.
1. System Analysis
1.1 Problem De nition:
Managing contact information manually can be tedious, error-prone, and inef cient. Users often face
dif culty in searching, updating, or organising contact details. A digital solution is needed to address these
problems effectively.
• Technical Feasibility: The system uses Python and SQLite, both of which are open-source and easy
to use. It is technically feasible for small-scale use.
• Operational Feasibility: End-users can easily interact with the system due to its simple GUI,
reducing training or learning effort.
• Economic Feasibility: The project requires minimal resources — no need for paid software or a
server setup, making it cost-effective.
2. System Design
2.1 Architectural Design:
• Application Layer (Logic): Contains the logic to process user input and interface with the database.
Architecture Flow:
Page 13
fi
fi
fl
fi
2.2 Functional Components:
Page 14
fi
fi
fi
CHAPTER -3
TOOLS,
TECHNOLOGIES
USED
&
REQUIREMENTS
ANALYSIS
Page 15
1. TOOLS AND TECHNOLOGIES USED
This project is built using a combination of open-source tools, technologies, and libraries that provide an
ef cient and cost-effective way to create a standalone desktop application for contact management.
• Purpose: Used to develop the entire application including logic, database interaction, and GUI.
• Why Python?
2. Database: SQLite
• Why SQLite?
◦ Perfect for small and medium applications with minimal resource usage.
• Purpose: Used to create the Graphical User Interface (GUI) of the application.
• Why Tkinter?
Page 16
fi
fi
fi
4. IDE/Text Editor (Any of the following):
• Purpose: Used for writing, testing, and debugging the Python code.
• Why?
◦ Syntax highlighting.
• Purpose: To visually inspect and manage the SQLite database (tables, rows, queries).
◦ Helps debug and verify table structure and data outside the application.
6. Operating System:
• Why? Python and SQLite are cross-platform technologies. The project can run on any OS where
Python is installed.
• sqlite3: Built-in library to connect and interact with the SQLite database.
• re (Regular Expressions): Used for validating email formats and phone numbers (if needed).
Page 17
fi
1. REQUIREMENT ANALYSIS
For the successful development of any project, it is very necessary to study about all the
requirements of the project. These requirements maybe related to resource, hardware, software,
functionalities etc.
SOFTWARE REQUIREMENTS
❖ Support All Device like, android, desktop, etc.
❖ Updated Browser is Preferred.
❖ Data loss may occur due to the interruption of Internet connection. So, the
user should ensure uninterrupted internet connection.
Page 18
CHAPTER -4
CODING
Page 19
SYNTAX CODE OF PYTHON IN
CONTACT MANAGEMENT SYSTEM
import sqlite3
# Function to connect to SQLite database and create table
if not exists
def initialise_database():
conn = sqlite3.connect('contacts.db')
cursor = conn.cursor()
cursor.execute('''
CREATE TABLE IF NOT EXISTS contacts (
id INTEGER PRIMARY KEY ACTOIN
INCREMENT,
name TEXT NOT NULL,
phone TEXT NOT NULL,
email TEXT
)
''')
conn.commit()
conn.close()
# User interface
def menu():
initialise_ database()
while True:
print("\n--- Contact Management System ---")
print("1. Add Contact")
print("2. View Contacts")
print("3. Search Contact")
print("4. Delete Contact")
print("5. Exit")
choice = input("Enter your choice: ")
if choice == '1':
Page 22
name = input("Enter name: ")
phone = input("Enter phone number: ")
email = input("Enter email: ")
add_contact(name, phone, email)
print("Contact added successfully!")
delete_contact(contact_id)
print("Contact deleted successfully!")
Page 23
elif choice == '5':
print("Exiting program.")
break
else:
print("Invalid choice. Please try again.")
Page 24
SYNTAX CODE OF IN SQLITE DATABASE
-- Insert a contact
INSERT INTO contacts (name, phone, email) VALUES (?, ?, ?);
-- Delete a contact by ID
DELETE FROM contacts WHERE id = ?;
Page 25
INDEX.PY
from tkinter import *
import sqlite3
import tkinter.ttk as ttk
import tkinter.messagebox as tkMessageBox
root = Tk()
root.title("Contact List")
width = 700
height = 400
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
x = int((screen_width / 2) - (width / 2))
y = int((screen_height / 2) - (height / 2))
root.resizable(0, 0)
root.config(bg="#6666ff")
#============================VARIABLES=================
==================
FIRSTNAME = StringVar()
LASTNAME = StringVar()
GENDER = StringVar()
AGE = StringVar()
ADDRESS = StringVar()
CONTACT = StringVar()
Page 26
#============================METHODS==================
===================
def Database():
conn = sqlite3.connect("pythontut.db")
cursor = conn.cursor()
cursor.execute("CREATE TABLE IF NOT EXISTS `member` (mem_id
INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, firstname
TEXT, lastname TEXT, gender TEXT, age TEXT, address TEXT, contact
TEXT)")
cursor.execute("SELECT * FROM `member` ORDER BY `lastname`
ASC")
fetch = cursor.fetchall()
for data in fetch:
tree.insert('', 'end', values=(data))
cursor.close()
conn.close()
def SubmitData():
if FIRSTNAME.get() == "" or LASTNAME.get() == "" or GENDER.get()
== "" or AGE.get() == "" or ADDRESS.get() == "" or CONTACT.get() == "":
result = tkMessageBox.showwarning('', 'Please Complete The
Required Field', icon="warning")
else:
tree.delete(*tree.get_children())
conn = sqlite3.connect("pythontut.db")
cursor = conn.cursor()
cursor.execute("INSERT INTO `member` (firstname, lastname,
gender, age, address, contact) VALUES(?, ?, ?, ?, ?, ?)",
(str(FIRSTNAME.get()), str(LASTNAME.get()), str(GENDER.get()),
int(AGE.get()), str(ADDRESS.get()), str(CONTACT.get())))
conn.commit()
cursor.execute("SELECT * FROM `member` ORDER BY `lastname`
ASC")
fetch = cursor.fetchall()
for data in fetch:
tree.insert('', 'end', values=(data))
cursor.close()
conn.close()
FIRSTNAME.set("")
Page 27
LASTNAME.set("")
GENDER.set("")
AGE.set("")
ADDRESS.set("")
CONTACT.set("")
def UpdateData():
if GENDER.get() == "":
result = tkMessageBox.showwarning('', 'Please Complete The
Required Field', icon="warning")
else:
tree.delete(*tree.get_children())
conn = sqlite3.connect("pythontut.db")
cursor = conn.cursor()
cursor.execute("UPDATE `member` SET `firstname` = ?, `lastname`
= ?, `gender` =?, `age` = ?, `address` = ?, `contact` = ? WHERE
`mem_id` = ?", (str(FIRSTNAME.get()), str(LASTNAME.get()),
str(GENDER.get()), str(AGE.get()), str(ADDRESS.get()),
str(CONTACT.get()), int(mem_id)))
conn.commit()
cursor.execute("SELECT * FROM `member` ORDER BY `lastname`
ASC")
fetch = cursor.fetchall()
for data in fetch:
tree.insert('', 'end', values=(data))
cursor.close()
conn.close()
FIRSTNAME.set("")
LASTNAME.set("")
GENDER.set("")
AGE.set("")
ADDRESS.set("")
CONTACT.set("")
def OnSelected(event):
global mem_id, UpdateWindow
curItem = tree.focus()
contents =(tree.item(curItem))
selecteditem = contents['values']
Page 28
mem_id = selecteditem[0]
FIRSTNAME.set("")
LASTNAME.set("")
GENDER.set("")
AGE.set("")
ADDRESS.set("")
CONTACT.set("")
FIRSTNAME.set(selecteditem[1])
LASTNAME.set(selecteditem[2])
AGE.set(selecteditem[4])
ADDRESS.set(selecteditem[5])
CONTACT.set(selecteditem[6])
UpdateWindow = Toplevel()
UpdateWindow.title("Contact List")
width = 400
height = 300
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
x = ((screen_width/2) + 450) - (width/2)
y = ((screen_height/2) + 20) - (height/2)
UpdateWindow.resizable(0, 0)
UpdateWindow.geometry("%dx%d+%d+%d" % (width, height, x, y))
if 'NewWindow' in globals():
NewWindow.destroy()
#===================FRAMES=============================
=
FormTitle = Frame(UpdateWindow)
FormTitle.pack(side=TOP)
ContactForm = Frame(UpdateWindow)
ContactForm.pack(side=TOP, pady=10)
RadioGroup = Frame(ContactForm)
Male = Radiobutton(RadioGroup, text="Male", variable=GENDER,
value="Male", font=('arial', 14)).pack(side=LEFT)
Female = Radiobutton(RadioGroup, text="Female", variable=GENDER,
value="Female", font=('arial', 14)).pack(side=LEFT)
#===================LABELS=============================
Page 29
=
lbl_title = Label(FormTitle, text="Updating Contacts", font=('arial', 16),
bg="orange", width = 300)
lbl_title.pack(fill=X)
lbl_firstname = Label(ContactForm, text="Firstname", font=('arial', 14),
bd=5)
lbl_firstname.grid(row=0, sticky=W)
lbl_lastname = Label(ContactForm, text="Lastname", font=('arial', 14),
bd=5)
lbl_lastname.grid(row=1, sticky=W)
lbl_gender = Label(ContactForm, text="Gender", font=('arial', 14),
bd=5)
lbl_gender.grid(row=2, sticky=W)
lbl_age = Label(ContactForm, text="Age", font=('arial', 14), bd=5)
lbl_age.grid(row=3, sticky=W)
lbl_address = Label(ContactForm, text="Address", font=('arial', 14),
bd=5)
lbl_address.grid(row=4, sticky=W)
lbl_contact = Label(ContactForm, text="Contact", font=('arial', 14),
bd=5)
lbl_contact.grid(row=5, sticky=W)
#===================ENTRY==============================
=
firstname = Entry(ContactForm, textvariable=FIRSTNAME, font=('arial',
14))
firstname.grid(row=0, column=1)
lastname = Entry(ContactForm, textvariable=LASTNAME, font=('arial',
14))
lastname.grid(row=1, column=1)
RadioGroup.grid(row=2, column=1)
age = Entry(ContactForm, textvariable=AGE, font=('arial', 14))
age.grid(row=3, column=1)
address = Entry(ContactForm, textvariable=ADDRESS, font=('arial',
14))
address.grid(row=4, column=1)
contact = Entry(ContactForm, textvariable=CONTACT, font=('arial',
14))
contact.grid(row=5, column=1)
Page 30
#==================BUTTONS=============================
=
btn_updatecon = Button(ContactForm, text="Update", width=50,
command=UpdateData)
btn_updatecon.grid(row=6, columnspan=2, pady=10)
#fn1353p
def DeleteData():
if not tree.selection():
result = tkMessageBox.showwarning('', 'Please Select Something
First!', icon="warning")
else:
result = tkMessageBox.askquestion('', 'Are you sure you want to
delete this record?', icon="warning")
if result == 'yes':
curItem = tree.focus()
contents =(tree.item(curItem))
selecteditem = contents['values']
tree.delete(curItem)
conn = sqlite3.connect("pythontut.db")
cursor = conn.cursor()
cursor.execute("DELETE FROM `member` WHERE `mem_id` =
%d" % selecteditem[0])
conn.commit()
cursor.close()
conn.close()
def AddNewWindow():
global NewWindow
FIRSTNAME.set("")
LASTNAME.set("")
GENDER.set("")
AGE.set("")
ADDRESS.set("")
CONTACT.set("")
NewWindow = Toplevel()
Page 31
NewWindow.title("Contact List")
width = 400
height = 300
screen_width = root.winfo_screenwidth()
screen_height = root.winfo_screenheight()
x = ((screen_width/2) - 455) - (width/2)
y = ((screen_height/2) + 20) - (height/2)
NewWindow.resizable(0, 0)
NewWindow.geometry("%dx%d+%d+%d" % (width, height, x, y))
if 'UpdateWindow' in globals():
UpdateWindow.destroy()
#===================FRAMES=============================
=
FormTitle = Frame(NewWindow)
FormTitle.pack(side=TOP)
ContactForm = Frame(NewWindow)
ContactForm.pack(side=TOP, pady=10)
RadioGroup = Frame(ContactForm)
Male = Radiobutton(RadioGroup, text="Male", variable=GENDER,
value="Male", font=('arial', 14)).pack(side=LEFT)
Female = Radiobutton(RadioGroup, text="Female", variable=GENDER,
value="Female", font=('arial', 14)).pack(side=LEFT)
#===================LABELS=============================
=
lbl_title = Label(FormTitle, text="Adding New Contacts", font=('arial',
16), bg="#66ff66", width = 300)
lbl_title.pack(fill=X)
lbl_firstname = Label(ContactForm, text="Firstname", font=('arial', 14),
bd=5)
lbl_firstname.grid(row=0, sticky=W)
lbl_lastname = Label(ContactForm, text="Lastname", font=('arial', 14),
bd=5)
lbl_lastname.grid(row=1, sticky=W)
lbl_gender = Label(ContactForm, text="Gender", font=('arial', 14),
bd=5)
lbl_gender.grid(row=2, sticky=W)
Page 32
lbl_age = Label(ContactForm, text="Age", font=('arial', 14), bd=5)
lbl_age.grid(row=3, sticky=W)
lbl_address = Label(ContactForm, text="Address", font=('arial', 14),
bd=5)
lbl_address.grid(row=4, sticky=W)
lbl_contact = Label(ContactForm, text="Contact", font=('arial', 14),
bd=5)
lbl_contact.grid(row=5, sticky=W)
#===================ENTRY==============================
=
firstname = Entry(ContactForm, textvariable=FIRSTNAME, font=('arial',
14))
firstname.grid(row=0, column=1)
lastname = Entry(ContactForm, textvariable=LASTNAME, font=('arial',
14))
lastname.grid(row=1, column=1)
RadioGroup.grid(row=2, column=1)
age = Entry(ContactForm, textvariable=AGE, font=('arial', 14))
age.grid(row=3, column=1)
address = Entry(ContactForm, textvariable=ADDRESS, font=('arial',
14))
address.grid(row=4, column=1)
contact = Entry(ContactForm, textvariable=CONTACT, font=('arial',
14))
contact.grid(row=5, column=1)
#==================BUTTONS=============================
=
btn_addcon = Button(ContactForm, text="Save", width=50,
command=SubmitData)
btn_addcon.grid(row=6, columnspan=2, pady=10)
Page 33
#============================FRAMES====================
==================
Top = Frame(root, width=500, bd=1, relief=SOLID)
Top.pack(side=TOP)
Mid = Frame(root, width=500, bg="#6666ff")
Mid.pack(side=TOP)
MidLeft = Frame(Mid, width=100)
MidLeft.pack(side=LEFT, pady=10)
MidLeftPadding = Frame(Mid, width=370, bg="#6666ff")
MidLeftPadding.pack(side=LEFT)
MidRight = Frame(Mid, width=100)
MidRight.pack(side=RIGHT, pady=10)
TableMargin = Frame(root, width=500)
TableMargin.pack(side=TOP)
#============================LABELS====================
==================
lbl_title = Label(Top, text="Contact Management System", font=('arial',
16), width=500)
lbl_title.pack(fill=X)
#============================ENTRY=====================
==================
#============================BUTTONS===================
==================
btn_add = Button(MidLeft, text="+ ADD NEW", bg="#66ff66",
command=AddNewWindow)
btn_add.pack()
btn_delete = Button(MidRight, text="DELETE", bg="red",
command=DeleteData)
btn_delete.pack(side=RIGHT)
#============================TABLES====================
==================
scrollbarx = Scrollbar(TableMargin, orient=HORIZONTAL)
scrollbary = Scrollbar(TableMargin, orient=VERTICAL)
tree = ttk.Treeview(TableMargin, columns=("MemberID", "Firstname",
"Lastname", "Gender", "Age", "Address", "Contact"), height=400,
selectmode="extended", yscrollcommand=scrollbary.set,
xscrollcommand=scrollbarx.set)
Page 34
scrollbary.config(command=tree.yview)
scrollbary.pack(side=RIGHT, fill=Y)
scrollbarx.config(command=tree.xview)
scrollbarx.pack(side=BOTTOM, fill=X)
tree.heading('MemberID', text="MemberID", anchor=W)
tree.heading('Firstname', text="Firstname", anchor=W)
tree.heading('Lastname', text="Lastname", anchor=W)
tree.heading('Gender', text="Gender", anchor=W)
tree.heading('Age', text="Age", anchor=W)
tree.heading('Address', text="Address", anchor=W)
tree.heading('Contact', text="Contact", anchor=W)
tree.column('#0', stretch=NO, minwidth=0, width=0)
tree.column('#1', stretch=NO, minwidth=0, width=0)
tree.column('#2', stretch=NO, minwidth=0, width=80)
tree.column('#3', stretch=NO, minwidth=0, width=120)
tree.column('#4', stretch=NO, minwidth=0, width=90)
tree.column('#5', stretch=NO, minwidth=0, width=80)
tree.column('#6', stretch=NO, minwidth=0, width=120)
tree.column('#7', stretch=NO, minwidth=0, width=120)
tree.pack()
tree.bind('<Double-Button-1>', OnSelected)
#============================INITIALIZATION==============
================
if __name__ == '__main__':
Database()
root.mainloop()
Page 35
SQLITE DATABASE
CODE
import sqlite3
from context lib import context manager
import re
import logging
from typing import List, Optional, Tuple, Dict, Any
# Pagination default
DEFAULT_PAGE_SIZE = 10
class ValidationError(Exception):
pass
Page 36
class DatabaseError(Exception):
pass
class Contact:
def __init__(self, name: str, phone: str, email: Optional[str] = None,
address: Optional[str] = None, contact_id: Optional[int] =
None):
self.id = contact_id
self.name = name.strip()
self.phone = phone.strip()
self.email = email.strip() if email else None
self.address = address.strip() if address else None
def __repr__(self):
return f"<Contact id={self.id} name={self.name} phone={self.phone}
>"
@contextmanager
def get_db_connection():
"""Context manager for SQLite connection."""
try:
conn = sqlite3.connect(DATABASE_NAME)
conn.execute("PRAGMA foreign_keys = ON")
yield conn
conn.commit()
except sqlite3.Error as e:
logging.error(f"Database error: {e}")
raise DatabaseError(e)
finally:
conn.close()
class ContactDAO:
"""Data Access Object for Contacts."""
def __init__(self):
self._initialize_database()
def _initialize_database(self):
with get_db_connection() as conn:
cursor = conn.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS contacts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
phone TEXT NOT NULL UNIQUE,
email TEXT,
address TEXT
)
""")
logging.info("Database and contacts table initialized.")
# Total count
cursor.execute("""
SELECT COUNT(*) FROM contacts
Page 40
WHERE name LIKE ? OR phone LIKE ?
""", (keyword_pattern, keyword_pattern))
total_count = cursor.fetchone()[0]
class ContactService:
"""
Service layer handling business logic for Contact Management.
Interacts with the DAO and performs validations or transformations.
"""
def __init__(self):
Page 41
self.dao = ContactDAO()
def _test_module():
logging.info("Starting Contact Management System backend test...")
service = ContactService()
# Add contacts
Page 42
try:
contact1_id = service.create_contact("Alice Wonderland",
"+1234567890", "[email protected]", "123 Maple Street")
contact2_id = service.create_contact("Bob Marley", "+1987654321",
"[email protected]", "456 Oak Avenue")
logging.info(f"Added test contacts with IDs {contact1_id},
{contact2_id}")
except ValidationError as e:
logging.error(f"Validation error during test add: {e}")
# Search contacts
contacts, total = service.search_contacts(keyword="Alice")
print(f"Search results for 'Alice': {contacts}, Total: {total}")
# Update contact
updated = service.update_contact(contact1_id, "Alice W.",
"+1234567890", "[email protected]", "789 Pine Road")
print(f"Updated contact {contact1_id}: {updated}")
# Delete contact
deleted = service.delete_contact(contact2_id)
print(f"Deleted contact {contact2_id}: {deleted}")
if __name__ == "__main__":_test_module()
Page 43
CHAPTER - 5
TESTING
Page 44
1. TESTING
Testing is the process of executing a program with the aim of finding an error. To make
our software perform well, it should be error-free. If testing is done successfully, it will
remove most if not all the errors from the software.
2. TYPES OF TESTING :-
2.1. UNIT TESTING
It focuses on the smallest unit of software design. In this, we test an individual unit or
group of interrelated units. The programmer often does it by using sample input and
observing its corresponding outputs.
Page 45
2.3. ALPHA TESTING
This is a type of validation testing. It is a type of acceptance testing which is done
before the product is released to customers. QA people typically do it
Page 46
CHAPTER - 6
IMPLEMENTATION
&
SCREENSHOTS
Page 47
1.IMPLEMENTATION
PROJECT STRUCTUEE
contact_manager/
├── contact_ manager .py
└── pythontut.db (auto-generated SQLite database)
The implementation of the Contact Management System is carried out in various structured phases,
following the software development life cycle (SDLC). Each phase contributes towards achieving the
objective of providing an ef cient and user-friendly system for managing personal and professional contacts.
1. Environment Setup
Before starting the actual implementation, the development environment is set up with the required tools and
technologies. For example:
• Other Tools: XAMPP for local server (if web-based), Git for version control
2. Module-Wise Implementation
• Implementation: Users must log in using a valid username and password. Data is checked from the
database using authentication logic.
• Implementation: A form is provided to enter contact details like Name, Phone Number, Email,
Address, etc. On submission, the data is validated and stored in the database.
Page 48
fi
c) View Contact List
• Implementation: Contacts are fetched from the database and displayed in a table format. Sorting and
search lters are applied for ease of use.
d) Edit/Update Contact
• Implementation: User selects a contact, edits the elds, and submits the form. The corresponding
record in the database is updated.
e) Delete Contact
• Implementation: A delete button is provided for each contact. On con rmation, the record is deleted
from the database.
f) Search Functionality
• Implementation: A search bar lters contacts based on name, phone number, or email using database
queries.
3. Backend Development
• Implemented business logic for managing contacts using appropriate programming language.
• Used SQL queries to perform CRUD (Create, Read, Update, Delete) operations.
• Ensured proper exception handling for user input and database connectivity errors.
4. Frontend Development
• Developed user interface using HTML/CSS (or GUI libraries for desktop apps).
• Integrated forms for data input and used responsive design for better usability.
Page 49
fi
fi
fi
fi
fi
5. Database Integration
6. Testing
• Unit testing was done on individual modules like Add, Delete, Search, etc.
• Integration testing ensured smooth communication between frontend, backend, and database.
• User Acceptance Testing (UAT) was performed to ensure the system met user requirements.
7. Deployment
• For a web-based system: Deployed using a local server like XAMPP/WAMP or hosted on a cloud
server.
• For a desktop application: Created an executable le and distributed it with required dependencies.
• Prepared technical documentation covering system architecture, database schema, and code structure.
• Developed a user manual with step-by-step instructions and screenshots for using the system.
Page 50
fi
2. SCREENSHOTS
Page 51
FRONT PAGE OF PROJECT
Caption
Page 52
• TYPING NAME
Page 53
• UPDATING A CONTACT LIST
PERSON 1
Page 54
• UPDATING A CONTACT LIST
PERSON 2
Page 55
• DELETING A CONTACT LIST
Page 56
CHAPTER - 7
CONCLUSION
&
FUTURE SCOPE
Page 57
Conclusion
The Contact Management System has been successfully developed and implemented to
simplify the process of storing, retrieving, updating, and managing contact information. The
system provides users with an intuitive interface to perform operations like adding new
contacts, editing existing ones, deleting outdated information, and searching through saved
contacts ef ciently.
By integrating backend logic with a user-friendly frontend, the system ensures both
functionality and ease of use. The use of a structured database ensures data integrity, while
features like validation and user authentication add security and reliability.
Overall, the project achieves its goal of replacing traditional contact-keeping methods (like
physical address books or spreadsheets) with a more ef cient, digital solution that saves time,
reduces errors, and enhances productivity.
Future Scope
While the current version of the Contact Management System serves basic functionalities effectively, there
are several areas where the system can be enhanced in the future:
1. Cloud Integration
• Allow users to store and access their contacts from anywhere by hosting the system on a cloud
platform.
2. Mobile Application
• Develop an Android/iOS version of the system for easier access and portability.
3. Import/Export Functionality
• Enable users to import contacts from other sources (like Google Contacts or CSV les) and export
them for backup.
• Introduce features to group contacts under categories like Family, Friends, Work, etc., for better
organisation.
• Add more powerful search tools, lters, and sorting options for handling large datasets.
Page 58
fi
fi
fi
fi
6. Pro le Picture and File Attachments
• Allow users to upload a pro le photo for each contact and attach documents (like ID proofs or
business cards).
7. Data Encryption
• Implement end-to-end encryption for storing contact data securely, especially in online versions.
• Incorporate voice commands and AI-based features for smart suggestions, duplicate contact
detection, and auto- ll.
Page 59
fi
fi
fi
fi
REFERENCES
2. MySQL Reference Manual – Used for learning database operations like creating tables, performing
CRUD operations, and integrating MySQL with Python using connectors.
3. Software Engineering Principles – Concepts of modular programming, system design, testing, and
documentation were applied based on standard software engineering practices.
4. Database Management System (DBMS) Textbooks – Standard textbooks were used for
understanding relational database concepts, normalisation, and entity-relationship models.
6. Tkinter GUI Library Documentation – Referred to for developing the graphical user interface in
Python, including window design, input forms, and event handling.
7. Project Development Notes and Lectures – Personal class notes and lectures provided guidance in
structuring the project and ensuring best practices were followed.
9. Unit Testing Guidelines – Followed principles and techniques for writing test cases and performing
validation of system modules.
10. Academic Guidelines for Project Report Writing – Followed formatting and documentation
standards as per institution or university norms for preparing the nal project report.
Page 60
fi
fi
fi