[go: up one dir, main page]

0% found this document useful (0 votes)
50 views12 pages

Cs Project

Uploaded by

anmolsaksena01
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)
50 views12 pages

Cs Project

Uploaded by

anmolsaksena01
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/ 12

COMPUTER SCIENCE PROJECT

ON BLOOD BANK DATA


MANAGEMENT SYSTEM

Name : Anmol Saksena


Roll No : 10
Class : 12-A
Certificate
This is to certify that Anmol Saksena , Roll
no of Class XII , has Satisfactorily
completed the Computer Science Project
based on Binary Files , on the subject
Blood Bank Data Management System’,
for the Practical Evaluation of Computer
Science for AISSCE CBSE 2023

Teacher’s Name - Meenu Gangwar


Computer Science Teacher
Acknowledgement
I would like to thank my computer teacher
Ms. Meenu Gangwar for her teaching and
guidance. This project would have been
impossible without her lessons.
Project Description
The project ‘Blood Bank Data
Management System’ is an attempt to
computerize the personal details of
applicants to a blood bank. The
application is developed using Python
Programming Language to create a binary
file blood.dat and perform various
operations on it.
In a menu driven interface, the application
is providing the following option:
Menu operations
1. Create-Create blood.dat and add
entries to it
2. Append- add entries to the existing
blood.dat
3. Display all- display all entries in
blood.dat
4. Search on- using a parameter as a
reference, display the entire entry
a. Donor ID
b. Name
c. Aadhar ID
d. Phone no
5. Count-count the number of entries
satisfying the condition given
a. All records
b. Blood Group
c. Gender
d. Name
e. Year of birth
6. Edit-edit the entry using the given
parameter to find it
a. Date of Birth
b. Donor id
c. Phone no
d. Record no
7. Insert-insert a new entry at the
specified position
a. Record no
b. Before Donor id
c. After Donor id
8. Delete- delete an entry based on the
specified parameter
a. Phone no
b. Donor ID
c. Name
d. Record no
Binary File Description
File name – blood.dat
Field Name- Description

Donor ID- denotes the donor id of the donor


Name- denotes the name of the donor
Address- denotes the address of the donor
Phone no-denotes the phone no of the donor
Blood group- denotes the blood group of the donor
Gender- denotes the gender of the donor
Date of birth- denotes the date of birth of the donor
Last donation date- denotes the last donation date of the
donor
Medical history- denotes the medical history of the donor
Aadhar id-denotes the aadhar id of the donor
import pickle as p
def create():
blood=open("blood.dat","wb+")
lst=[]
while True:
did=input("enter donor id- ")
name=input("enter name- ")
add=input("enter address- ")
pno=input("enter pno- ")
bg=input("enter blood group- ")
gen=input("enter gender- M,F or other- ")
dob=input("enter date of birth in the format dd-mm-yyyy - ")
last=input("enter last donation date- ")
med=input("enter medical history- ")
aad=input("enter aadhar id- ")
lst.append([did, name, add, pno, bg, gen, dob, last, med, aad])
ans=input("enter n if you wish to stop entering- ")
if ans in "Nn":
break
p.dump(lst,blood)
blood.close()
def app():
blood=open("blood.dat","rb+")
did=input("enter new donor id- ")
name=input("enter new name- ")
add=input("enter new address- ")
pno=input("enter new pno- ")
bg=input("enter new blood group- ")
gen=input("enter new gender- M,F or other- ")
dob=input("enter new date of birth- ")
last=input("enter new last donation date- ")
med=input("enter new medical history- ")
aad=input("enter new aadhar id- ")
lst=[did, name, add, pno, bg, gen, dob, last, med, aad]
it=p.load(blood)
print(it)
it.append(lst)
print(it)
blood.close()
blood1=open("blood.dat","wb+")
p.dump(it,blood1)
blood1.close()

def displayall():
blood=open("blood.dat","rb")
it=p.load(blood)
for i in it:
print(i)
blood.close()
def search():
blood=open("blood.dat","rb")
cont=p.load(blood)
sear=input("you can search on a) donor id, b)name, c) aadhar id and d) phone no, enter
the one you wish to search on- ")
inp=input("enter the search parameter- ")
for i in cont:
if sear=="a":
if i[0]==inp:
print(i)
if sear=="b":
if i[1]==inp:
print(i)
if sear=="c":
if i[9]==inp:
print(i)
if sear=="d":
if i[3]==inp:
print(i)
blood.close()
def countrec():
blood=open("blood.dat","rb")
cnt=0
cont=p.load(blood)
inp=input(" you can count a)all records, b) blood group, c) gender, d) name and e) year of
birth- enter the one you wish to count- ")
sear=input("enter a search parameter if required, if not, just enter null- ")
if inp=="a":
for i in cont:
cnt+=1
elif inp=="b":
for i in cont:
if i[4]==sear:
cnt+=1
elif inp=="c":
for i in cont:
if i[5]==sear:
cnt+=1
elif inp=="d":
for i in cont:
if i[1]==sear:
cnt+=1
elif inp=="e":
for i in cont:
if i[6][-4:]==sear:
cnt+=1
print(cnt)
blood.close()
def edit():
blood=open("blood.dat","rb")
cont=p.load(blood)
inp=input("you can edit by a)dob, b) donor id and c) phone no and d) record no, enter the
one you wish to change- ")
key=input("enter the reference value")
did=input("enter new donor id- ")
name=input("enter new name- ")
add=input("enter new address- ")
pno=input("enter new pno- ")
bg=input("enter new blood group- ")
gen=input("enter new gender- M,F or other- ")
dob=input("enter new date of birth in the format dd-mm-yyyy - ")
last=input("enter new last donation date- ")
med=input("enter new medical history- ")
aad=input("enter new aadhar id- ")
lstedit=[did, name, add, pno, bg, gen, dob, last, med, aad]

if inp=="a":
for i in cont:
if i[6]==key:
i=lstedit
elif inp=="b":
for i in cont:
if i[0]==key:
i=lstedit
elif inp=="c":
for i in cont:
if i[3]==key:
i=lstedit
elif inp=="d":
i[key-1]=lstedit
blood.close()
blood1=open("blood.dat","wb+")
p.dump(cont, blood1)
blood1.close()
def insert():
blood=open("blood.dat","rb")
cont=p.load(blood)
did=input("enter new donor id- ")
name=input("enter new name- ")
add=input("enter new address- ")
pno=input("enter new pno- ")
bg=input("enter new blood group- ")
gen=input("enter new gender- M,F or other- ")
dob=input("enter new date of birth in the format dd-mm-yyyy - ")
last=input("enter new last donation date- ")
med=input("enter new medical history- ")
aad=input("enter new aadhar id- ")
lstins=[did, name, add, pno, bg, gen, dob, last, med, aad]
inp=input("you can enter a new entry at a) record no, b) after given donor id, c) before
given donor id- enter the one you wish to enter- ")
if inp=="a":
recno=int(input("enter record no-"))
cont.insert(lstins,recno-1)
elif inp=="b":
don=input("enter the donor id you wish to use as a reference point")
for i in cont:
if i[0]==don:
index=cont.index(i)
cont.insert(lstins,index)
elif inp=="c":
don=input("enter the donor id you wish to use as a reference point")
for i in cont:
if i[0]==don:
index=cont.index(i)
cont.insert(lstins,index+1)
blood.close()
blood1=open("blood.dat","wb+")
p.dump(cont, blood1)
blood1.close()
def delete():
blood=open("blood.dat","rb")
cont=p.load(blood)
inp=input("you can delete by a) phone no, b) donor id, c) name or d) record no - enter the
one you wish to delete- ")
key=input("enter the value of the choice you picked ")
if inp=="a":
for i in cont:
if i[3]==key:
cont.remove(i)
elif inp=="b":
for i in cont:
if i[0]==key:
cont.remove(i)
elif inp=="c":
for i in cont:
if i[1]==key:
cont.remove(i)
elif inp=="d":
cont.remove(cont[int(key)-1])
blood.close()
blood1=open("blood.dat","wb+")
p.dump(cont,blood1)
blood1.close()
while True:
ch=input(" a) Create a file \n b) Append \n c) Display contents \n d) Search \n e) Count \n
f) Edit \n g) Insert \n h) Delete \n enter your choice- ")
if ch=="a":
create()
elif ch=="b":
app()
elif ch=="c":
displayall()
elif ch=="d":
search()
elif ch=="e":
countrec()
elif ch=="f":
edit()
elif ch=="g":
insert()
elif ch=="h":
delete()
ans=input("enter y if you wish to continue- ")
if ans!="y":
break

You might also like