0% found this document useful (0 votes)
21 views22 pages

Project Cover Page (AutoRecovered)

The document is a project file for a Computer Science project aimed at developing a Python-based system to track the repair status of machines using SQLite3 and Pandas. It includes sections on project acknowledgments, system requirements, installation procedures, code implementation, output, identified errors, and future modifications. The project focuses on organizing machine data into repaired and unrepaired categories and exporting this data into Excel sheets.

Uploaded by

bluejob4l
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)
21 views22 pages

Project Cover Page (AutoRecovered)

The document is a project file for a Computer Science project aimed at developing a Python-based system to track the repair status of machines using SQLite3 and Pandas. It includes sections on project acknowledgments, system requirements, installation procedures, code implementation, output, identified errors, and future modifications. The project focuses on organizing machine data into repaired and unrepaired categories and exporting this data into Excel sheets.

Uploaded by

bluejob4l
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
You are on page 1/ 22

COMPUTER SCIENCE

CBSE BOARD PROJECT FILE


2024-2025

Name: _______________________________________
Grade: _______________________________________
Roll no: ______________________________________

Page | 1
Acknowledgement

I take this opportunity to sincerely express my gratitude to

all who have helped me complete this project .

My sincere thanks to the Ms.Ambika Gulati, our

principal, Ms.Mini Nair,Our Viceprincipal,

Ms. Priyanka Bhattacharya our Head of section and

Mr.Mehmood Mudassir,our supervisor for constant

support and encouragement.

My sincere gratitute to Ms.Uvani Fernando, my Computer

Science teacher whose constant support and guidance

helped me complete this Project file

Page | 2
COMPUTER SCIENCE
CERTIFICATE

Certified to be the bonafide record of the project


work done by Master / Miss ___________________ of
Grade XII as prescribed by the Central Board of
Secondary Education, Delhi during the academic
year 2024- 2025.

_______________ ______________

Teacher in-charge Principal

Submitted for the Practical Examination on _______


held in The Millennium School, Dubai

_______________ ______________

Internal Examiner External Examiner

Page | 3
Index
1. Aim of the project Page No.

2. System Requirements Page No.


3. Installation Procedure Page No.

4. System Layout Page No.


5. Functions and Modules used Page No.

6. Script (Source code) Page No.


7. Output Page No.

8. Errors Identified Page No.


9. Future Modifications Page No.

10. Bibliography Page No.

Page | 4
Aim of the project:
The aim of this project is to develop a Python-based system using SQLite3 and
Pandas that tracks the repair status of machines. The system organizes the
machines into two categories: repaired and unrepaired, and exports the sorted
data into two separate Excel sheets. The system also ensures data integrity by
preventing duplicate entries

Page | 5
System Requirements Hardware:
1.A computer with at least 4 GB of RAM.
2.Hard disk with 500 MB of free space.
3.Software: Operating System: Windows 10/11, macOS, or Linux.
4.Python 3.6 or later. SQLite3.
5.Pandas library.
6. Openpyxl or XlsxWriter for Excel file handling

Page | 6
Installation Procedure Install
Python:
Download and install Python from python.org. Ensure you add
Python to your PATH during installation. Install Required Python
Packages:
1.pip install sqlite3
2.pip install pandas
3.pip install openpyxl
# Optional: Required for Excel file handling RUN THE SCRIPT:
1.python machine_tracker.py

Page | 7
System Layout Database:
The system uses an SQLite3 database (machines.db) to store
machine data, ensuring each machine entry is unique.
Data Management: Data is inserted, queried, and
manipulated using SQL commands through SQLite3.
Data Export: Pandas library is used to sort the data and export it to
Excel files, categorized by

Page | 8
Functions and Modules Used Modules:
sqlite3: For database operations like creating tables, inserting data,
and querying.
pandas: For data manipulation, querying the database results, and
exporting to Excel.
openpyxl (optional): For handling Excel file creation (can also use
XlsxWriter)

Page | 9
Functions:
Database Setup:
CREATE TABLE IF NOT EXISTS: Creates the table structure with a
primary key to avoid duplicates.
Data Insertion:
INSERT INTO: Inserts new machine records into the database.
Catches sqlite3.IntegrityError to avoid duplicates.
Data Querying: pd.read_sql_query: Retrieves data from the database
based on repair status.
Excel Export: pd.ExcelWriter: Writes the sorted data into two
separate Excel sheets.

Page | 10
C0DE
import sqlite3
import pandas as pd

# Create database connection


conn = sqlite3.connect('machines.db')
cursor = conn.cursor()

# Create tables if they do not exist


cursor.execute('''
CREATE TABLE IF NOT EXISTS machines (
Name TEXT,

SerialNumber TEXT PRIMARY KEY,


Nationality TEXT,
Repaired TEXT,
CashSpent REAL
)
''')

cursor.execute('''
CREATE TABLE IF NOT EXISTS
repaired_machines (
Name TEXT,
Page | 11
SerialNumber TEXT PRIMARY KEY,
Nationality TEXT,

Repaired TEXT,
CashSpent REAL
)
''')

def add_entry(name, serial_number,


nationality, repaired, cash_spent):
try:
cursor.execute('''
INSERT INTO machines (Name,
SerialNumber, Nationality, Repaired,
CashSpent)
VALUES (?, ?, ?, ?, ?)

''', (name, serial_number, nationality,


repaired, cash_spent))
conn.commit()
print(f"Entry with Serial Number

Page | 12
{serial_number} added successfully.")
except sqlite3.IntegrityError:
print(f"Entry with Serial Number
{serial_number} already exists.")

def export_data_to_excel():
# Query repaired machines
cursor.execute('''
SELECT * FROM machines WHERE
Repaired = 'Yes'

''')
repaired_data = cursor.fetchall()

if repaired_data:
# Convert to DataFrame and export to
Excel
df_repaired =
pd.DataFrame(repaired_data,
columns=['Name', 'SerialNumber',
'Nationality', 'Repaired', 'CashSpent'])

df_repaired.to_excel('repaired_machines.xlsx',
index=False)

Page | 13
print("Repaired machines exported to
'repaired_machines.xlsx'.")

# Move repaired machines to


repaired_machines table
cursor.executemany('''
INSERT OR IGNORE INTO
repaired_machines (Name, SerialNumber,
Nationality, Repaired, CashSpent)
VALUES (?, ?, ?, ?, ?)
''', repaired_data)

# Remove repaired machines from


machines table
cursor.execute('''
DELETE FROM machines WHERE
Repaired = 'Yes'

''')
conn.commit()

Page | 14
else:
print("No repaired machines found.")

# Query unrepaired machines


cursor.execute('''
SELECT * FROM machines WHERE
Repaired = 'No'
''')
unrepaired_data = cursor.fetchall()

if unrepaired_data:

# Convert to DataFrame and export to


Excel
df_unrepaired =
pd.DataFrame(unrepaired_data,
columns=['Name', 'SerialNumber',
'Nationality', 'Repaired', 'CashSpent'])

df_unrepaired.to_excel('unrepaired_machines.
xlsx', index=False)
print("Unrepaired machines exported to
'unrepaired_machines.xlsx'.")
else:

Page | 15
print("No unrepaired machines found.")

def main():

while True:
print("\nOptions:")
print("1. Add a new entry")
print("2. Export data to Excel and sort
repaired machines")
print("3. Exit")

choice = input("Enter your choice (1/2/3):


").strip()

if choice == '1':
name = input("Enter Name: ").strip()
serial_number = input("Enter Serial
Number: ").strip()

nationality = input("Enter Nationality:


").strip()

Page | 16
repaired = input("Is it repaired?
(Yes/No): ").strip()
cash_spent = input("Enter Cash Spent:
").strip()

try:
cash_spent = float(cash_spent)
add_entry(name, serial_number,
nationality, repaired, cash_spent)
except ValueError:
print("Invalid cash spent value. Please
enter a numeric value.")

elif choice == '2':


export_data_to_excel()

elif choice == '3':


print("Exiting the program.")
break

else:
print("Invalid choice. Please try again.")

# Close the database connection

Page | 17
conn.close()

if __name__ == "__main__":
main()

Page | 18
Output
Database:
A SQLite database file (machines.db) containing the machine
records. Excel Sheets: An Excel file (machines_report.xlsx) with two
sheets: 1. Repaired Machines: Contains all machines that have
been repaired. Unrepaired Machines: Contains all machines that
are not yet repaired.

Page | 19
Errors Identified
Duplicate Entries:
If a duplicate machine ID is inserted, the script raises an
sqlite3.IntegrityError, which is handled gracefully by ignoring the
duplicate entry.

Database Connection Errors:


If the database connection fails, the script could throw a
connection error. To handle this, ensure proper error handling or
connection verification before execution.

Page | 20
Future Modifications
User Interface:
Develop a graphical user interface (GUI) for easier data entry and
report generation.

Detailed Reports:
Add more detailed filtering options, such as filtering by machine
type, repair date, or technician.

Automated Updates: Implement a feature that


automatically updates the Excel file whenever new data is inserted
into the database.

Cloud Integration: Integrate the system with cloud


services like Google Sheets or a cloud database for remote access
and multi-user collaboration.

Page | 21
Bibliography Python documentation:
https://docs.python.org/3/ Pandas documentation:
https://pandas.pydata.org/ SQLite3 documentation:
https://www.sqlite.org/docs.html OpenPyXL documentation:
https://openpyxl.readthedocs.io/ en/stable/

Page | 22

You might also like