0% found this document useful (0 votes)
15 views

Blood Bank Management System (Python&MySQL)

Uploaded by

debanu2204
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Blood Bank Management System (Python&MySQL)

Uploaded by

debanu2204
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

SUNSHINE CHENNAI SENIOR SECONDARY SCHOOL

(Affiliated to Central Board of Secondary Education, New Delhi)


86/2, AGS Colony, Puzhuthivakkam, Chennai - 91

INVESTIGATORY PROJECT REPORT


20 to 20

NAME
ROLL NUMBER
CLASS & SEC
SUBJECT
TOPIC
SUNSHINE CHENNAI SENIOR SECONDARY SCHOOL
(Affiliated to Central Board of Secondary Education, New Delhi)
86/2, AGS Colony, Puzhuthivakkam, Madipakkam, Chennai-91

BONAFIDE CERTIFICATE

Certified to be the bonafide record of the Project Work /


Investigatory Experiment done by Master / Miss
of Class in SUNSHINE CHENNAI SENIOR
SECONDARY SCHOOL, Puzhuthivakkam, Chennai – 600 091, year
. .

Submitted for ALL INDIA SENIOR SCHOOL CERTIFICATE


EXAMINATION conducted by CBSE, New Delhi held on
at SUNSHINE CHENNAI SENIOR SECONDARY SCHOOL,
Puzhuthivakkam, Chennai - 600 091 by the candidate bearing the
Registration Number .

DATE: HEAD OF THE INSTITUTION

SIGNATURE OF
1) Internal Examiner
2) External Examiner
ACKNOWLEDGEMENT

I would like to take this opportunity to extend my sincere gratitude and appreciation
to my computer Science teacher for providing support throughout the process of
completing my computer project for school. I am also thankful to my principal for
allowing me the opportunity to explore and work on this project.

Additionally, I would like to express my heartfelt thanks to my family for their


unwavering support and encouragement during the completion of this project. The
invaluable lessons and skills I have acquired through this project have enriched my
learning experience and have prepared me for future challenges.

I am grateful for the opportunity to showcase my work to my class, and I am proud to


have contributed to the educational environment at our school. I am truly grateful
for the support and encouragement I have received throughout this project.

RAGHAV KARTHIK
INDEX
1. Introduction to Python:-----------------------------------------------------------------------------------------------------------5
1.1 Pros and Cons of Python:-------------------------------------------------------------------------------5
1.2 Working in Python:---------------------------------------------------------------------------------------5
2. Advantages/Benefits of Python:- ............................................................................................................. 6
3. Introduction to MySQL: - ......................................................................................................................... 7
3.1 What is MySQL?--------------------------------------------------------------------------------------------7
3.2 What is SQL?------------------------------------------------------------------------------------------------ 7
3.2.1 Summary of MYSQL Commands:----------------------------------------------------------------7
3.2.2 Connect MySQL database using Python-------------------------------------------------------8
4. System Requirements: -........................................................................................................................... 9
4.1 Hardware Requirements----------------------------------------------------------------------------------9
4.2 Software Requirements-----------------------------------------------------------------------------------9
5. Objective: -............................................................................................................................................ 10
6. System Design: - ..................................................................................................................................... 11
7. Program Code:- ...................................................................................................................................... 12
8. Output Screen:-...................................................................................................................................... 13
9. Conclusion:- ........................................................................................................................................... 16
10. Bibliography:- ....................................................................................................................................... 16
1. Introduction to Python:-

Python is a widely used general-purpose, high level programming language. It was


created by Guido Van Rossum in 1991 and further developed by the Python Software
Foundation. It was designed with an emphasis on code readability, and its syntax allows
programmers to express their concepts in fewer lines of code.

Python is a programming language that lets you work quickly and integrate systems more
efficiently.

1.1 Pros and Cons of Python:-


Pros:-
 Beginner friendly
 Well-supported
 Flexible
 Multiple libraries
 Embeddable
 Highly scalable
 Prototyping-friendly

Cons:-
 Not the Fastest Language
 Not Strong on Type-binding
 Not Easily Convertible
 Poor multithreading
 Poor Memory Efficiency
 Weak in Mobile Computing

1.2 Working in Python:-

There are multiple Python distributions available today.


 CPython Installation
 Anaconda Python distribution
 Many popular IDEs are also available eg., Spyder IDE, PyCharm IDE etc. Of
these, Spyder IDE is already available as a part of Anaconda Python
distribution.
Once you have Python installed on your computers, you are ready to work on it. You
can work in Python in following different modes:-
i)In Interactive mode(also called Immediate Mode)
ii)In Script mode
2. Advantages/Benefits of Python:-

The diverse application of the Python language is a result of the combination of features that
give this language an edge over others. Some of the benefits of programming in Python include:

1. Presence of Third-Party Modules:


The Python Package Index (PyPI) contains numerous third-party modules that make Python capable
of interacting with most of the other languages and platforms.
2. Extensive Support Libraries:
Python provides a large standard library that includes areas like internet protocols, string
operations, web services tools, and operating system interfaces. Many high-use programming tasks
have already been scripted into the standard library which reduces the length of code to be written
significantly.
3. Open Source and Community Development:
Python language is developed under an OSI-approved open source license, which makes it free to
use and distribute, including for commercial purposes.
Further, its development is driven by the community which collaborates for its code through
hosting conferences and mailing lists and provides for its numerous modules.
4. Learning Ease and Support Available:
Python offers excellent readability and uncluttered simple-to-learn syntax which helps beginners to
utilize this programming language. The code style guidelines, PEP 8, provide a set of rules to
facilitate the formatting of code. Additionally, the wide base of users and active developers has
resulted in a rich internet resource bank to encourage development and the continued adoption of
the language.
5. User-friendly Data Structures:
Python has built-in list and dictionary data structures that can be used to construct fast runtime
data structures. Further, Python also provides the option of dynamic high-level data typing which
reduces the length of support code that is needed.
6. Productivity and Speed:
Python has a clean object-oriented design, provides enhanced process control capabilities, and
possesses strong integration and text processing capabilities and its own unit testing framework, all
of which contribute to the increase in its speed and productivity. Python is considered a viable
option for building complex multi-protocol network applications.
3. Introduction to MySQL: -

MySQL is a very popular open-source relational database management system (RDBMS).

3.1 What is MySQL?

 MySQL is a relational database management system


 MySQL is open-source
 MySQL is free
 MySQL is ideal for both small and large applications
 MySQL is very fast, reliable, scalable, and easy to use
 MySQL is cross-platform
 MySQL is compliant with the ANSI SQL standard
 MySQL was first released in 1995
 MySQL is developed, distributed, and supported by Oracle Corporation

3.2 What is SQL?

SQL is the standard language for dealing with Relational Databases.

SQL is used to select, insert, update, and delete database records.

3.2.1 Summary of MYSQL Commands:-

-- Database-Level
DROP DATABASE databaseName -- Delete the database (irrecoverable!)
DROP DATABASE IF EXISTS databaseName -- Delete if it exists
CREATE DATABASE databaseName -- Create a new database
CREATE DATABASE IF NOT EXISTS databaseName -- Create only if it does not exists
SHOW DATABASES -- Show all the databases in this server
USE databaseName -- Set the default (current) database
SELECT DATABASE() -- Show the default database
SHOW CREATE DATABASE databaseName -- Show the CREATE DATABASE statement

-- Table-Level
DROP TABLE [IF EXISTS] tableName, ...
CREATE TABLE [IF NOT EXISTS] tableName (
columnName columnType columnAttribute, ...
PRIMARY KEY(columnName),
FOREIGN KEY (columnNmae) REFERENCES tableName (columnNmae)
)
SHOW TABLES -- Show all the tables in the default database
DESCRIBE|DESC tableName -- Describe the details for a table
ALTER TABLE tableName ... -- Modify a table, e.g., ADD COLUMN and DROP COLUMN
ALTER TABLE tableName ADD columnDefinition
ALTER TABLE tableName DROP columnName
ALTER TABLE tableName ADD FOREIGN KEY (columnNmae) REFERENCES tableName (columnNmae)
ALTER TABLE tableName DROP FOREIGN KEY constraintName
SHOW CREATE TABLE tableName -- Show the CREATE TABLE statement for this tableName

-- Row-Level
INSERT INTO tableName
VALUES (column1Value, column2Value,...) -- Insert on all Columns
INSERT INTO tableName
VALUES (column1Value, column2Value,...), ... -- Insert multiple rows
INSERT INTO tableName (column1Name, ..., columnNName)
VALUES (column1Value, ..., columnNValue) -- Insert on selected Columns
DELETE FROM tableName WHERE criteria
UPDATE tableName SET columnName = expr, ... WHERE criteria
SELECT * | column1Name AS alias1, ..., columnNName AS aliasN
FROM tableName
WHERE criteria
GROUP BY columnName
ORDER BY columnName ASC|DESC, ...
HAVING groupConstraints
LIMIT count | offset count

3.2.2 Connect MySQL database using Python


While working with Python, we need to work with databases, and they may be of different types
like MySQL, SQLite, NoSQL, etc. In this section, we will be looking forward to how to connect
MySQL databases using MySQL Connector/Python.
MySQL Connector module of Python is used to connect MySQL databases with the Python
programs.
Connecting to the Database:-
The mysql.connector provides the connect() method used to create a connection between the
MySQL database and the Python application. The syntax is given below.
Syntax:
Conn_obj= mysql.connector.connect(host = <hostname>, user = <username>, passwd =
<password>)
The connect() function accepts the following arguments.
Hostname – It represents the server name or IP address on which MySQL is running.
Username – It represents the name of the user that we use to work with the MySQL server. By
default, the username for the MySQL database is root.
Password – The password is provided at the time of installing the MySQL database. We don’t
need to pass a password if we are using the root.
Database – It specifies the database name which we want to connect. This argument is used
when we have multiple databases.
4. System Requirements: -

4.1 Hardware Requirements

This section describes the recommended hardware requirements for the Enterprise Service
Manager.

 4 CPU Cores or more

 8 GB RAM or more

 RAID10 or RAID 0+1 disk setup

4.2 Software Requirements


 Windows Operating System
 Python 3.1.1
 Spyder
 MySQL 8.0.37
 MySQL WorkBench
 MySQL connector must be installed along with MySQL in the Python program.

Installing Connector/Python with pip:-

This is the recommended way to install Connector/Python.

Make sure you have a recent pip version installed on your system. If your system already
has pip installed, you might need to update it.

shell> pip install mysqlx-connector-python


5. Objective: -

The objective is to develop the Blood Bank Management System project. The aim is to
provide blood donation service to the city recently. Blood Bank Management System (BBMS) is a
system that is designed to store, process, retrieve and analyse information concerned with the
administrative and inventory management within a blood bank. This project aims at maintaining all
the information pertaining to blood donors, different blood groups available in each blood bank and
help them manage in a better way. Aim is to provide transparency in this field, make the process of
obtaining blood from a blood bank hassle free and corruption free and make the system of blood
bank management effective.
Needs of Blood Bank Management System
Bank blood donation system is planned to collect blood from many donators and distribute that
blood to needy people who require blood. To do all this, we require high quality software to
manage those jobs.
To fulfil these need, blood bank management system project contain modules which are include
the detail of following areas:-
• Blood Donor
• Blood Recipient

• Blood collection
• Camp
• Stock details
The main objective of this application is to automate the complete operations of the blood
bank. They need to maintain hundreds of thousands of records. Also searching should be
very faster, so they can find required details instantly.
This system makes conveniently available good quality, safe blood and other blood
components, which can be provided in a sound, ethical and acceptable manner, consistent
with the long-term well-being of the community. It actively encourages voluntary blood
donation, motivate and maintain a well-indexed record of blood donors and educate the
community on the benefits of blood donation. This will also serve as the store in reducing
unnecessary utilization of blood and help the blood bank work more efficiently towards self-
sufficiency in blood.
The system will provide the user the option to look at the details of the existing Donor List,
Blood Group and to add a new Donor. It also allows the user to modify the record. The
administrator can alter all the system data.

Front End Back End


Python MySQL
6. System Design: -

This is the overall system architecture of Blood Bank Management System. We use Python and
MySQL Db for this project.

We would insert, update, delete and also retrieve record from data base through Python script
from MySQL Db. We would also create database, create tables, and insert bulk of records through
MySQL sql scripts itself in the initial stage. Later, we can maintain the Db and insert/update or
retrieve records from Python program itself.

We would create blood_bank Database. Then, we would create below 4 tables.

1)Blood_Bank
2)Patient
3)Donor
4)Stock

Patient and Donor tables have its own primary key(unique identifier) in them. And Blood_Bank has
primary key and foreign keys(reference keys) to Patient and Donor tables.

Whenever a patient or donor record is inserted, we would do the insert into Blood_Bank table. And
the stock table would be updated on a regular basis based on the utilization of blood for the
patients and the quantity of blood added by the donor.
7. Program Code:-

This is the Python program developed to insert, update, delete and retrieve records from
Blood_Bank Db tables.
8. Output Screen:-
SELECT *
FROM
blood_bank.blood_bank
where
blood_bank_id=308;

Some of the reporting queries on blood bank data, that were run in MySQL Db:-

SELECT Patient_Name,Blood_Group,Disease
FROM Patient
WHERE Patient_ID = 101;

SELECT Donor_Name,Donor_Addresss,Donor_Contact,Medical_Report
FROM Donor
WHERE Medical_Report = 'Satisfactory';
SELECT Patient_Name,Blood_Group,Blood_Bank_Name,blood_bank.patient_id,patient.patient_id
FROM Patient, Blood_Bank
WHERE blood_bank.patient_id = patient.patient_id;

SELECT Donor_Name,Medical_Report,Donor_Addresss,donor.donor_id,Blood_Bank_Name
FROM Donor,Blood_Bank
WHERE blood_bank.donor_id = donor.donor_id;

SELECT Blood_Bank_Name, Blood_Bank_Contact,Patient_Name,Patient.Patient_id


FROM Blood_Bank, Patient
WHERE patient.patient_id = blood_bank.patient_id;

SELECT Patient_Name, Donor_Name, Blood_Bank_Name, D.Blood_Group, Medical_Report


FROM Blood_Bank,Patient ,Donor D
WHERE blood_bank.patient_id = patient.patient_id AND blood_bank.donor_id = D.donor_id;
SELECT Donor_Name, Donor.Donor_ID, Blood_Bank.Donor_ID
FROM Donor LEFT OUTER JOIN Blood_Bank
ON Blood_Bank.Donor_ID = donor.donor_id
GROUP BY Donor_Name, Donor.Donor_ID, Blood_Bank.Donor_ID;

9. Conclusion:-

With the Python code and MySQL, we are able to build effective Blood Bank Management System,
which would in turn help in effectively utilizing the donor’s blood for the needy patients. This would
serve as the great project for our society.
We would also be able to do analysis of the patient, donor, and blood bank data by running the
reporting queries in MySQL Db. This analysis work would be useful in collecting the necessary
quantity of blood group and also would ensure the fitness of the donor providing blood, thereby
ensuring patient is receiving the right blood group with all the proper health parameters.

10. Bibliography:-

https://www.python.org/
https://dev.mysql.com/doc/
https://www.javatpoint.com/mysql-tutorial

You might also like