0% found this document useful (0 votes)
12 views30 pages

Modified CS PROJECT

Uploaded by

Arceus Gaming
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)
12 views30 pages

Modified CS PROJECT

Uploaded by

Arceus Gaming
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/ 30

CS PROJECT

HOSPITAL
MANAGEMENT
SYSTEM
2024-25

Presented by :
PAUL & ADITYARAJ
Class- XII-A

1
CONTENT
Sr. No. CONTENT NAME PageNo.

1 Certificate 5

2 Acknowledgments 6

3 Why we choose this Topic 7

Establishment of Connections and


4 8-10
Importing

5 Creating the Table 11

6 Tkinter Window 12

7 Adding New Medicines 14

8 Viewing Medicines 15

9 Checking Expiry 15

10 Deleting Medicine Data 16

11 GUI Widgets 17

12 Running the Main Loop 19-23

3
2024-25

PM SHRI KENDRIYA
VIDYALAYA
AMBARNATH

SHIFT - 1

2
CONTENT
Sr. No. CONTENT NAME PageNo.

13 Cross Check using MySQL 24

14 Device Specifications 27

15 RESOURCES 28

4
CERTIFICATE!!

This is to certify that PAUL JOHNSON


student of class XII-A has successfully
completed his Computer Science
project for topic Hospital Medicine
Management under the guidance of Mr.
Kaushalya Patel Ma'am, PGT CS,
Kendriya Vidalaya Ambarnath (Shift 1)
for the academic session 2024-25

___________________ ___________________
Signature of Student Date

___________________
Signature of Teacher

5
CERTIFICATE!!

This is to certify that ADITYARAJ


SUBRAMANIYAN MUDALIYAR student
of class XII-A has successfully
completed his Computer Science
project for topic Hospital Medicine
Management under the guidance of Mr.
Koushilya Patel Ma'am, PGT CS,
Kendriya Vidalaya Ambarnath (Shift 1)
for the academic session 2024-25

___________________ ___________________
Signature of Student Date

___________________
Signature of Teacher

5
ACKNOWLEDGEMENT

In the accomplishment of this project successfully, many people


have best owned upon me their blessings and the heart pledged
support, this time I am utilizing to thank all the people who have
been concerned with project. Primarily I would thank god for being
able to complete this project with success. Then I would like to
thank my COMPUTER SCIENCE TEACHER Mrs. Koushilya Patel
Ma'am PGT (CS), whose valuable guidance has been the ones that
helped me patch this project and make it full proof success his
suggestions and his instructions has served as the major
contributor towards the completion of the project.

6
WHY WE CHOOSE
THIS TOPIC ???????
Hospitals and medical facilities rely heavily on
timely and accurate management of their
medicine inventory to provide quality healthcare.
Manual processes or outdated systems can lead
to inefficiencies, such as:

Expired Medicines in Stock


Hospitals may unknowingly administer expired drugs, risking patient safety.
Overstocking or Understocking:
Overstocking increases storage costs, while understocking leads to delays in patient
treatment.
Error-Prone Record Keeping:
Manual inventory tracking often results in errors, misplacement of records, and
difficulty retrieving critical information during emergencies.
Inefficient Communication:
Lack of a streamlined system between inventory management and hospital staff
affects decision-making.
Proposed Solution
We aim to solve this problem by developing a Hospital
Medicine Management System, which:
1. Automates Inventory Tracking:
Ensures real-time updates for stock levels and critical
medicine details.
2. Proactively Notifies Expiry Dates:
Alerts staff about medicines nearing expiry to avoid
potential health risks.
3. Provides Easy Accessibility:
Offers a user-friendly interface for quick access to
medicine information.
4. Minimizes Errors:
Reduces the dependency on manual record-keeping,
enhancing data accuracy and consistency.
5. Supports Data-Driven Decisions:
Helps administrators track medicine usage patterns
and optimize procurement strategies.

7
Importing the
mysql.connector Module

First install the library pip install mysql-connector-


python

pip downloads the mysql-connector-python

8
Importing Required
Libraries
mysql.connector
This library is used to establish a
tkinter
connection between Python and
a MySQL database. Tkinter is a Python library for
It provides functionalities to creating Graphical User Interfaces
perform database operations (GUIs).
such as executing SQL queries, tk is the main module for creating
retrieving data, and managing widgets (like buttons, labels, entry
transactions. fields).
messagebox: A submodule in
Tkinter used for displaying dialog
boxes (e.g., error messages, success
notifications).

datetime and timedelta


These modules handle date and
time operations.
datetime.now() gives the current
date and time.
timedelta helps in performing
arithmetic on dates, such as
adding or subtracting days.

9
Establishing the
Connection
Assigning the Connection Object
db = mysql.connector.connect(...)
A connection object (db) is created. This object represents the active connection to
the MySQL server.

Parameters:
host:
Value: "127.0.0.1"
This is the IP address of the MySQL server.
"127.0.0.1" refers to the localhost, meaning the database is hosted on the same
machine where the script is running.

port:
Value: 3306
This is the port number MySQL listens to for connections.
3306 is the default port for MySQL.

user:
Value: "root"
This is the username used to authenticate with the database.

password:
Value: "ROOT"

database:
Value: "hospital"
Specifies the name of the database to connect to.

10
create the table
a clean start
You can access the all the past medicines entries without a
loss of any medicine.

Purpose
Creates the medicines table if it does not already exist
SQL Command
CREATE TABLE IF NOT EXISTS creates a new table.
Table Structure
medicine_code VARCHAR(6) PRIMARY KEY:
A column to store unique medicine codes.
maximum length of 6 characters.
name VARCHAR(255):
A column for the name of the medicine.
Maximum length of 255 characters.
supplier VARCHAR(255):
A column for the supplier's name.
maximum length of 255 characters.
units INT:
A column to store the quantity of the medicine available.
INT specifies an integer data type.
cost_per_unit FLOAT:
A column for the cost per unit of the medicine.
FLOAT is a data type for decimal numbers.
manufacture_date DATE:
A column to store the medicine's manufacture date.
DATE is a data type for dates in YYYY-MM-DD format.
expiry_date DATE:
A column to store the medicine's expiry date.

11
Tkinter window

root = tk.Tk()
Creates the main window of the GUI application.
Tk is the main class in the tkinter
root is a common variable name used to reference the main window

root.title("Hospital Medicine Management System")


Sets the title of the main window.
The text Hospital Medicine Management System will appear on the title bar of
the window.

root.geometry("1000x1000")
Defines the size of the main window in pixels.
1000x1000 means:
Width = 1000 pixels
Height = 1000 pixels

root.configure(bg="#f0f8ff")
#f0f8ff is a hexadecimal color code that represents Alice Blue, a light blue shade.
Enhances the GUI.

Output

12
header_label = tk.Label(...)

font=("Arial", 16, "bold")


"Arial": The font type.
16: Font size.
"bold": Makes the text bold
bg="#4682b4"
#4682b4 is the hexadecimal code for Steel Blue
fg="white"
Sets the foreground (text) color to white
header_label.pack(fill=tk.X, pady=10)
fill=tk.X
Makes the label stretch horizontally
pady=10
Adds vertical padding (10 pixels) above and below the label

The generate_medicine_code() Function

MAX(medicine_code
An SQL function that retrieves the highest value in the medicine_code
Ensures the new medicine code is unique
result = cursor.fetchone()[0]
Fetches the first row from the query result.
new_id = last_id + 1
Assigns the first medicine code with numeric value 1

The function checks the If codes exist, it


increments the last Returns the formatted
medicines table for the If no codes exist, it
code to generate a new medicine code to be
largest existing starts with "MD0001".
unique one. used in the database
medicine code.

13
Function to add a new medicine

Collects user
inputs from the
GUI fields.

Validates that all fields are


filled and numeric values
are correctly formatted.

Generates a unique
medicine code

Inserts the data into the


medicines table.

Displays a success
message

Clears the form for the next entry.


14
view_medicines

cursor.execute("SELECT * FROM medicines"):


Executes a SQL query to fetch all columns (*) from the medicines table

check_expiry

datetime.now():
Fetches the current date and time as a datetime object.
.date():
Extracts only the date (YYYY-MM-DD) part of the datetime object.
timedelta(days=1):
Represents a time difference of one day.
+ timedelta(days=1):
Adds one day to the current date to calculate tomorrow’s date.
Example; - If today's date is 2024-11-15, then,
tomorrow = datetime.now().date() + timedelta(days=1)
tomorrow = datetime.now().date() + timedelta(days=1)

15
Function to delete a medicine

Retrieve the
medicine code from
the input field.
Validate the input to
ensure it's not
empty.
Execute a
parameterized SQL
DELETE query to
remove the record
with the given
medicine_code.
Check the number of
affected rows:

delete_code_entry.get() returns "MD0001"


The query: "DELETE FROM medicines WHERE medicine_code = %s"
with code = "MD0001" deletes the record.
delete_code_entry.get() returns "MD9999"
The query: "DELETE FROM medicines WHERE medicine_code = %s"
with code = "MD9999" does not affect any rows because no such
record exists.

16
GUI Widgets

1. Label: Displays the text "Medicine Name" to indicate the input field’s purpose.
2. font: Sets the font style and size to Arial, 12.
3. bg: Background color of the label (#f0f8ff, a light blue shade).
4. pack(): Adds the label to the window with default alignment.
5. Entry: Provides a text input field for entering the medicine name.
6. pady: Adds vertical padding of 5 pixels around the input field.

command: Links the button to the add_medicine function. When clicked, the function runs, validating
inputs and adding the new medicine to the database.
bg: Sets the button’s background color to light blue (#87cefa).
pady: Adds vertical padding of 10 pixels around the button.

Workflow
Input medicine details (name, supplier, units, cost, manufacture date, expiry date).
Click "Add Medicine" to save the data in the database.
Click "View Medicines" to display all records.
Use "Check Expiry" to identify medicines nearing expiration.
Use "Medicine Code to Delete" and click "Delete Medicine" to remove specific records.

17
Display area for viewing medicines

Run the Tkinter event loop

18
1. Interface

2. Input

19
3. Input Successful

4. Adding Multiple Inputs

20
5. View Medicine

21
6. Checking Expiry

7. Deleting Medicines through Medicine Code

22
AFTER DELETION:
(VIEW MEDICINE)

23
IN MYSQL
1. USING DATABASE:

2. WRITING QUERY FOR SHOWING TABLE

3. TABLE WITH ELEMENTS AS ENTERED


THROUGH THE 'GUI':

24
Input

mysql

25
Input

mysql

26
DEVICE
SPECIFICATIONS

Windows 7 and above.


Requirement of OS
MacOS (need Anaconda)

4GB RAM with Availability of 2GB


RAM & ROM Requirement
Storage.

Latest Version/ Version: 3.11 or


Python Version
higher

27
RESOURCES

Tkinter Python GUI Tutorial


https://youtu.be/-GhzpvvIXlM?si=t3KCnCN6-
eOGSIVP

Basic idea of how to do project.


https://youtu.be/gzDA06Q4fZM?si=kXLSUIGvEbWw_dVF

geeksforgeeks for Coding GUI Widegts and Labelling


https://www.geeksforgeeks.org/

28
THANK YOU!

29

You might also like