CS304 Assignment 1 Solution
CS304 Assignment 1 Solution
Scenario:
A blood bank plays a vital role in saving people’s lives. A blood bank management system is a
system which manages the donation and storage of blood, and inventory operations etc. It
manages the collection, storage and distribution of blood to hospitals. Donors are individuals
who donate blood. They can register, update their profiles, and view their donation records. On
the other hand, patients in need of blood can register request and track status of their request.
They have specific blood type requirements and medical history.
The Inventory tracks available blood types and quantities, including inventory ID and expiration
dates, with methods for checking availability and updating records. Similarly, hospitals can view
donor details, and select required donor on biases of donor’s information. The admin must
handle donor registrations, manage blood inventory, and facilitate blood requests from hospitals.
It should also monitor blood expiry, check donor eligibility and ensures that blood is available
for critical patients. Admin also send reminders to donors for future donations.
Solution:
1) Extract the main objects (entities) of above system:
From the scenario the entities of the above system are:
• Donor
• Patient
• Blood
• Inventory
• Hospital
• Admin
• Blood Request
• Donation
2) Find the necessary attributes and functions that need to be associated with
each object.
Donor:
Attributes are:
• donorID (for uniquely identifier)
• donorName (name of the donor)
• donorAge (donor age)
• donorGender (donor gender)
• bloodType (blood group of donor)
• contactInfo (contact informtion of donor such as email, phone number etc.)
• medicalHistory (medical history of the donor)
• lastDonationDate (date of last donation of the donor)
• eligibilityStatus (donor is eligible or not for donation)
Functions are:
• register(): Register as a donor.
• updateProfile(): Update donor details.
• viewDonationHistory(): View past donations.
• checkEligibility(): Check donor’s eligibility to donate.
• donateBlood(): Record blood donation.
• receiveReminder(): Recieve reminders for future donation
Patient:
Attributes are:
• patientID (unique identifier)
• namePatient (name of the patient)
• bloodType (blood group of the patient)
• medicalHistory (medical history of the patient)
• requestedBloodType (requested blood group which is need of the patient)
• requestedQuantity (quantity of the requested blood group)
• requestStatus (status of the request is fullfilled, pending or cancelled)
• contactInfo (contact information of the patient)
Functions are:
• register(): Register as a patient.
• requestBlood(): Place a blood request.
• trackRequestStatus(): Track status of the blood request.
Blood:
Attributes are:
• bloodID (unique identifier)
• bloodType (blood group)
• quantity (how much required)
• expiryDate (date of expiry)
• donorID (for knowing who is donating blood)
Functions are:
• checkExpiry(): Check if the blood has expired.
• updateInventory(): Update the blood quantity and expiry.
Inventory:
Attributes are:
• inventoryID (unique identifier)
• bloodType (blood group)
• availableQuantity (no of bottles)
• expiryDate (date of expiry)
• location (storage location of blood)
Function are:
• addBlood(): Add blood to inventory.
• updateInventory(): Update blood details (quantity, expiry, etc.).
• checkAvailability(): Check if requested blood type is available.
Hospital:
Attributes are:
• hospitalID (unique identifier)
• hospitalName (name of the hospital)
• contactInfo (contact information like email , phone number etc)
• hospitalLocation (hospital location where is placed)
Functions are:
• viewDonorDetails(): View information of available donors.
• requestBlood(): Place a blood request.
• trackRequestStatus(): Track status of a blood request.
Admin:
Attributes are:
• adminID (unique identifier)
• adminName (name of admin)
• contactInfo (contact information of admin)
• role (role of the admin)
Functions are:
• manageDonorRegistrations(): Approve or reject donor registrations.
• manageBloodInventory(): Manage the inventory
• checkBloodExpiry(): Track blood expiry and ensure timely usage or discard.
• sendDonationReminders(): Send reminders to donors for future donations.
• approveRequest(): Approve or reject blood requests from hospitals.
BloodRequest:
Attributes are:
• requestID (unique identifier)
• patientID (links to the patient requesting blood)
• requestedBloodType (requested blood group)
• requestedQuantity (requested quantity of the blood)
• requestStatus ( Pending, Fulfilled, Denied)
• hospitalID (links to the hospital requesting blood)
Functions are:
Donation:
Attributes are:
• donationID (unique identifier)
• donorID (linked to the donor who made the donation)
• bloodType (blood group)
• donationDate (date of the donation)
• volumeDonated (integer)
Functions are:
• recordDonation(): Record a new donation.
• updateDonationStatus(): Update donation status (successful, failed, etc.).
Donor Donation
donorID donationID
donorName donorID
donorGender bloodType
bloodType bloodType
contactInfo donationDate
medicalHistory volumeDonated
lastDonationDate
eligibilityStatus
Patient BloodReqest
patientID requestID
namePatient patientID
bloodType requestedBloodType
medicalHistory requestedQuantity
requestedBloodType requestStatus
requestedQuantity hospitalID
requestStatus
contactInfo
Hospital
hospitalID
hospitalName
contactInfo
hospitalLocation
Inventory
inventoryID
bloodType
availableQuantity
expiryDate
location
Blood
bloodID
bloodType
quantity
expiryDate
donorID
Admin
adminID
adminName
contactInfo
role