You are on page 1of 34

HEART DISEASE PREDICTION SYSTEM

Submitted By:

Student Name Registration # Session


Muhammad Shoaib CS181014 2018-2022
Hamza Akram CS181056 2018-2022

Department of Computer Science

Khwaja Fareed University of Engineering &


Information Technology
HEART DISEASE PREDICTION SYSTEM

Project Submitted to: Dr Mujeeb Ur Rehman

Department of Computer Science


In partial fulfilment of the requirements
For the degree of

Bachelors of Sciences in Computer Science

By:

Student Name Registration # Session


Muhammad Shoaib CS181014 2018-2022
Hamza Akram CS181056 2018-2022

Khwaja Fareed University of Engineering &


Information Technology
Rahim Yar Khan
2021

I
DECLARATION

We hereby declare that this project report is based on our original work except for citations and
quotations which have been duly acknowledged. We also declare that it has not been previously
and concurrently submitted for any other degree or award at Khwaja Fareed University of
Engineering & Information Technology or other institutions.

Student Name Registration # Date Signature


Muhammad Shoaib CS181014

Hamza Akram CS181056

II
APPROVAL FOR SUBMISSION

We certify that this project report entitled “Heart Disease Prediction System” was prepared by
Muhammad Shoaib and Hamza Akram has met the required standard for submission in partial
fulfilment of the requirements for the award of Bachelor of Computer Science (Honours) at
Khwaja Fareed University of Engineering & Information Technology.

Approved by:

Supervisor : Dr.Mujeeb Ur Rehman

Signature : _________________________

Date : _________________________

III
ACKNOWLEDGEMENT

We would like to thank everyone who had contributed to the successful completion of this
project. We would like to express our gratitude to our Project supervisor, Dr Mujeeb Ur Rehman
for his invaluable advice, guidance and his enormous patience throughout the development of the
research.

In addition, we would also like to express our gratitude to our loving parents and Fellows who
had helped and given me/us encouragement.

IV
ABSTRACT

The project entitled “Heart Disease’s Prediction System” is to develop a program keeping in
view the needs of predicting that either a person having Heart Disease or not. Heart Disease is
considered one of the most fatal and terrible diseases that causes many deaths worldwide.
According to the World Health Organization, 17.9 million people die every year due to this
disease. In just Pakistan, the number of deaths is 25,122 per year, accompanied by millions of
active cases. This project is a web application based program in which our predictive model uses
the top machine algorithm (support vector machine k- nearest neighbour K-NN, decision tree,
logistic regression Naive Bayes, Decision Tree algorithms) for heart disease prediction and
finally to be an algorithm with maximum accuracy used in the web application after its test
process. And the algorithms trained on the UCI Heart Disease repository dataset. Our system
assures the preservation of the cost and the time of the user. There are two modules of the
application, one is the admin and the other is the user which has been given the facilities like
prediction, The print report, Check previous prediction results, Feedback with single click. While
the admin is accountable for the Dataset and Database of the users, check which users have used
the web application at which time or for which purpose.

V
TABLE OF CONTENTS

CHAPTER 1...................................................................................................................................1

INTRODUCTION.........................................................................................................................1

1.1 INTRODUCTION.....................................................................................................................1
1.2 PROBLEM STATEMENT.........................................................................................................1
1.3 OBJECTIVE............................................................................................................................2
1.4 PROJECT SCOPE....................................................................................................................2
1.5 ADVANTAGES OF PROPOSED SOLUTION...............................................................................2
1.6 RELEVANCE TO STUDY PROGRAM.......................................................................................3
1.7 CHAPTER SUMMARY............................................................................................................3

CHAPTER 2...................................................................................................................................4

EXISTING SYSTEM....................................................................................................................4

2.1 EXISTING SYSTEM................................................................................................................4


2.2 DRAWBACKS OF EXISTING SYSTEM.....................................................................................4
2.3 EXAMPLES OF EXISTING SYSTEM.........................................................................................5
2.4 NEED TO REPLACE EXISTING SYSTEM.................................................................................5
2.5 CHAPTER SUMMARY............................................................................................................5

CHAPTER 3...................................................................................................................................6

REQUIREMENT ENGINEERING.............................................................................................6

3.1 DETAILED DESCRIPTION OF PROPOSED SYSTEM..................................................................6


3.2 UNDERSTANDING THE SYSTEM............................................................................................6
3.2.1 User Involvement.........................................................................................................6
3.2.2 Stakeholders.................................................................................................................6
3.2.3 Domain........................................................................................................................6
3.3 REQUIREMENT ENGINEERING...............................................................................................7

VI
3.3.1 Functional Requirements.............................................................................................7
3.3.2 Non-Functional Requirements.....................................................................................8
3.3.3 Requirement Baseline................................................................................................10
3.3.4 Need to Feature Mapping..........................................................................................11
3.4 HURDLES IN OPTIMISING THE CURRENT SYSTEM..............................................................11
3.5 CHAPTER SUMMARY..........................................................................................................11

CHAPTER 4.................................................................................................................................12

DESIGN........................................................................................................................................12

4.1 SOFTWARE PROCESS MODEL.............................................................................................12


4.2 BENEFITS OF SELECTED MODEL........................................................................................13
4.3 LIMITATIONS OF MODEL....................................................................................................14
4.4 DESIGN...............................................................................................................................15
4.4.1 Methodology Diagram...............................................................................................15
4.4.2 Entity Relationship Diagram.....................................................................................16
4.4.3 System Flow Diagram...............................................................................................17
4.4.1 UML Diagrams..........................................................................................................18
4.5 SUMMARY..........................................................................................................................24

VII
LIST OF TABLES

TABLE 1- FUNCTIONAL REQUIREMENT 01.......................................................................................7


TABLE 2- FUNCTIONAL REQUIREMENT 02.......................................................................................7
TABLE 3- FUNCTIONAL REQUIREMENT 03.......................................................................................7
TABLE 4- FUNCTIONAL REQUIREMENT 05.......................................................................................8
TABLE 5- FUNCTIONAL REQUIREMENT 06.......................................................................................8
TABLE 6- FUNCTIONAL REQUIREMENT 07.......................................................................................8
TABLE 7- NON-FUNCTIONAL REQUIREMENT 01..............................................................................8
TABLE 8- NON-FUNCTIONAL REQUIREMENT 02..............................................................................9
TABLE 9-NON-FUNCTIONAL REQUIREMENT 03...............................................................................9
TABLE 10-NON-FUNCTIONAL REQUIREMENT 04.............................................................................9
TABLE 11-NON-FUNCTIONAL REQUIREMENT 05.............................................................................9
TABLE 12-NON-FUNCTIONAL REQUIREMENT 06...........................................................................10
TABLE 13- NON-FUNCTIONAL REQUIREMENT 07..........................................................................10
TABLE 14. NON-FUNCTIONAL REQUIREMENT 08..........................................................................10
TABLE 15- NEED TO FEATURE MAPPING.......................................................................................11
TABLE 25. SEQUENCE DIAGRAM SELECTING OPTIONS.................................................................22

VIII
LIST OF FIGURES

FIGURE 1- SPIRAL PROCESS MODEL THAT USED IN OUR PROJECT ................................................13


FIGURE 2- METHODOLOGY DIAGRAM............................................................................................15
FIGURE 3- ENTITY RELATIONSHIP DIAGRAM.................................................................................16
FIGURE 4-FLOW DIAGRAM.............................................................................................................17
FIGURE 5-USE CASE DIAGRAM......................................................................................................18
FIGURE 6-CLASS DIAGRAM............................................................................................................20
FIGURE 8-ACTIVITY DIAGRAM......................................................................................................21
FIGURE 9- DIAGRAM VIEW DETAILS.............................................................................................23

IX
CHAPTER 4 DESIGN

Chapter 1

Introduction

1.1 Introduction
The Machine learning has improved A lot of the fields related to the human and the
Healthcare is one of them. In healthcare, machine learning is specifically used for the
detection of diseases to make the diagnose process Effective and Accurate. Similarly for
the Detection of Heart Disease Machine learning provides algorithms that can be used for
detection of the heart disease.

In our proposed system we will focus on overcoming the problem of detection of Heart
Disease. While using Machine Learning algorithms at Basic Level with good accuracy of
detection. Moreover, our system will be reducing the cost of the diagnosis. And leads to
better treatment to the heart Leads this project is the initial level and for sure this Project
is going to be helpful to the Health care Sector. And this project ultimately goes long for
in the future for the detection of this particular Disease.

1.2 Problem Statement


According to the World Health Organization, 17.9 million people die every year due to
Heart Disease and in just Pakistan; the number of deaths is 25,122 people per year along
with millions of active cases. One of the main reasons for deaths related to heart disease
is late diagnoses of this disease as there is no system for initial stages to predict this
disease. Through which we can also predict that hospital tests are too costly and in a
country, like Pakistan, it is not affordable for everyone.

Moreover, the machine errors also lead towards the wrong detection through which
correct treatment couldn't occur. As a result, it causes an increase in the number of
deaths. Therefore, by using this platform a person can easily get to know that either he
has heart disease or not by fulfilling few parameters, which cost him nothing as compared
to other costly and insufficient tests. So once he gets his result, based on that his

10
CHAPTER 4 DESIGN

treatment can be started at an initial phase. So this platform is beneficial for those who
are eager to know about having Heart Disease or not.

1.3 Objective

The key Objectives of the given project are:


 Solve heart disease prediction problem
  Reducing the cost of for prediction
 Provide On time result of prediction
 To save the time of People (time efficient)
 Provides possible Maximum Accuracy of prediction
 Provides user friendly platform to users
 Provide people useful tips regarding the Heart Disease on the basis of their prediction
result

1.4 Project Scope


It is a web-based application that is being used as one portal for Heart Disease detection.
That is playing a vital role in helping people to get diagnosed with higher accuracy, in
which the backend role is operated by the admin. A user has to do just:
 User has to register by visiting website
 After registration, login to user module.
 Select required service from the module and those services are being provided to him/her
 If user selects the heart disease prediction then he/she has to enter few parameters, after
providing those parameters and some processing user will get result

This Project is delivers via phases:


 1st phase
Admin panel
 2nd phase
Predictive model training and testing, and Fitting

11
CHAPTER 4 DESIGN

 3rd Phase
Analysis
 4th Phase
Testing and improving security

1.5 Advantages of Proposed Solution


There are a lot of benefits of the proposed system such as:
 Maximize Accuracy of Prediction:
This System will gives user maximum possible accuracy of the prediction.
 On-Time Diagnose
Second main advantage of this system is that it provides on-time diagnose at initial stage
that basically leads to provision of on-time and correct treatment at earliest stage.
 Reducing Cost
This system will cost nothing to the user in order to know that either he has Heart Disease
or not. All other methods for diagnosis are way much costly.
 Save Time
It will save time of users as they have to just put few parameters which are being asked
and then they are provided.
 Proper User Management
The major advantage of this system is that there is proper management of the all features
and user gets facilitated just on few clicks.

1.6 Relevance to Study Program


Computer science techniques like Machine learning play a vital role in the health care
sector. Especially, when we talk about predicting any specific disease. This technique has
changed a lot of concepts.

12
CHAPTER 4 DESIGN

Similarly, when the health care sector wants this type of prediction model, a computer
scientist use his knowledge to the fullest in order to create such predictive models that
fulfil needs of Healthcare sector

1.7 Chapter Summary


We see nowadays that Machine learning has revolutionized and completely changed the
concept of Disease Prediction, as it has automated the prediction processes. Which
ultimately saves money and time along with some great accuracy. This project is also
providing the same facility as it diagnoses heart disease by an almost automated process
and saves the cost of time along with the best accuracy of heart disease prediction.

13
CHAPTER 4 DESIGN

Chapter 2

Existing Systems

2.1 Existing System:


It would be unfair if we can't talk about the existing system before replacing it with the
most forward-looking and developed. Because by examining the current system we
would be able to know that where did we are lagging and what we have to adapt to or
change.

So currently several systems are available for the prediction of Heart Disease. Like some
of them are typical hospital tests that are being conducted for the purpose of heart
Disease prediction and the others are numerous online predictors, all these are
accompanied by a lot of drawbacks and hindrances, therefore we need to replace them
with exceptional and advanced features holding systems.

2.2 Drawbacks of Existing System:


When we talk about the drawbacks of the current system we found major drawbacks.
Those are described as follows:
 Costly:
If we talk about a major disadvantage of the current system then it would be the funds a
person has to bear just to know that either he posses heart disease or not, just for
prediction.
 Minimum Accuracy:
The other main disadvantage the present system gives us is the minimum accuracy
measurement. As it has been noticed, that sometimes one typical hospital result gives us
the positive result while from somewhere else it's negative. So the accuracy of the
existing system is not so well.
 Time-consuming:

14
CHAPTER 4 DESIGN

The other main shortcoming of the current system is really time-consuming as compared
to the modern heart disease prediction systems.
 Wrong diagnose leads to wrong treatment:
Due to minimum accuracy problems, the current systems can lead to the wrong treatment
which is basically a threat to the patient's life, and in some cases, it can really become the
cause of the patient's demise as well.
 Not proper user management:
As we have seen, there are various online predictors available which lack behind in
giving precise or proper user management, due to which users can't get aided or
facilitated suitably.

2.3 Examples of Existing System:


Few existing systems are mentioned below:
 Eco diagram:
Eco diagram is one of the hospital tests that are being available and conducted for Heart
Disease diagnosis. But it cost a lot of Money to the patient. it also sometimes show up
with accuracy problems.
 Online Predictor:
There are also various online predictors available on the internet. But none of them is
trained well to give us accurate result.

2.4 Need to Replace Existing System:


After taking a brief look at the current systems, we have seen that present systems have
several issues that need to be addressed, and we have to replace them by ensuring new
ones.

As we have seen that there are numerous problems in the current systems such as
minimum accuracy, time-consuming, etc., and one of the main reasons for deaths can be
the diagnosis of the disease due to the above reasons.

The currently available systems are having serious accuracy issues as they delay accuracy
of prediction which leads to the faulty detection of disease, which leads to the wrong

15
CHAPTER 4 DESIGN

diagnose. So to get on-time results we should replace the current system by providing and
ensuring good results in the latest and modern system.

2.5 Chapter Summary:


We see nowadays that Machine learning has completely changed the concept of Disease
Prediction. And automate the prediction process. Which ultimately saves time and money
required for prediction and moreover gives much Accuracy.

This project provided the same facility for heart disease and saves the cost of funds and
time, also providing the best accuracy of heart disease prediction and is quite effective for
the people who are eager to know that whether they have heart disease or not using this
portal and in near future, it will become the primary need of the people related to this
particular disease.

Chapter 3

Requirement Engineering

3.1 Detailed Description of proposed System


Our proposed system is a web-based application that can be practiced as the one portal
for heart disease detection. That is reducing the People's worries about the heart disease
prediction problem.

In our system, the backend role is managed by the admin, and the user simply visits the
website to register. After registration user login to the user module, choose services that
are required from the module, and those services are then offered. The services like
prediction, Print report, check previous prediction results, Feedback is available there.

16
CHAPTER 4 DESIGN

If the user selects the prediction, then the user is asked to enter few parameters asked next
to the form provided to the user, after clicking to prediction, this service is provided to
the user, so simply this web application provides all amenities and conveniences to the
user just in one click.

3.2 Understanding the System

3.2.1 User Involvement


We make assure that the essential needs of the user are meant to be met. This
website will be able to support and facilitate users, they can be of any type but as
long as the user can use the internet and understand the basic layout of the website
of this program will definitely prove useful and advantageous for them.

3.2.2 Stakeholders
The main stakeholders being involved are:
 Admin
 End user

3.2.3 Domain
 Web application
 Tools: Html, CSS, JavaScript, Python, DjangoFramework, php, mysql,
python(ML)

3.3 Requirement Engineering

3.3.1 Functional Requirements

Table 1- Functional Requirement 01


Function User Registration
Description To use the website user must register for create the account and login using
user_id and password to use functionality being in the web Application
Input User details.

17
CHAPTER 4 DESIGN

Output User registered.


Side effect None.

Table 2- Functional Requirement 02


Function Prediction
Description The user can gets to now either he has the Heart Disease or not
Input Source User and his Health related parameters
Output User gets the Result of the Prediction
Side effect The wrong input leads to wrong result

Table 3- Functional Requirement 03


Function Update profile
Description Registered use can update their profile info.
Input Source Registered people will check their profile.
Output Change data in profile.
Side effect If user enter data then it also added to his profile

Table 4- Functional Requirement 04


Function Print Report
Description The user can print his report
Input Source Input source is Registered user
Output The report is printed
Side effect None.

Table 5- Functional Requirement 05


Function Check Previous Result
Description User will check his previous prediction result
Input Source Register user how had at least get his prediction at least one time
Output Previous Result is show to user
Side effect None.

Table 6- Functional Requirement 06


Function Admin Login
Description Admin can login and manage user Database and dataset
Input Source Input source is admin.
Output Admin logged in.
Side effect None

Table 7- Functional Requirement 07

18
CHAPTER 4 DESIGN

Function Feedback
Description User can gives his recommendation and suggestion
Input Source Register user
Output User suggestion has been sent
Side effect None.

3.3.2 Non-Functional Requirements


Table 6- Non-Functional Requirement 01
Non-Functional
Requirement Fast page loading speed

Descriptions Page loading speed should be First and page loading must be a click away
Less page loading speed shows bad impact to users.
Side Effect

Table 7- Non-Functional Requirement 02

Non-Functional
Requirement Responsiveness
Descriptions Websites should transform responsively and fast at all screen resolutions on
different browsers and platforms.
Side Effect Not responsiveness will leads to less traffic on site

Table 8-Non-Functional Requirement 03


Non-Functional
Requirement User Friendly
Descriptions Website interface must be easy to use and user friendly.
Side Effect If the website is not being the user Friendly then many user can’t use it.

Table 9-Non-Functional Requirement 04


Non-Functional
Requirement Serviceability
Descriptions Website Should always provides the services 24/7
Side Effect If its not so that will leads to the lake of service

Table 10- Non-Functional Requirement 07


Non-Functional

19
CHAPTER 4 DESIGN

Requirement Data Integrity


Descriptions The website assured the integrity of the data of the user
Side Effect User never trust upon the site.

Table 11. Non-Functional Requirement 08


Non-Functional
Requirement Security
Descriptions Website security must be assured
Side Effect Website will may

3.3.3 Requirement Baseline

Requirements that will be covered in our project:


 Achieve the needs of Users related to the heart Disease prediction
 Assure the good Accuracy of the prediction to the user

 Assure on-time result to the user

3.4 Hurdles in Optimising the Current System


Many hurdles are faced during building project:
 To make the performance of website Accurate.
 Training of the Model on data set and assuring god accuracy on
 To maintain the performance of website
 Making all the modules perfect.

3.5 Chapter Summary


In this chapter, we will discuss how we can make a system that will be covering out the
functionalities that are not occurring in the existing system. We will also be describing the
functional and non-functional requirement that makes the system complete and the
difficulties or hurdles we have to face to make the system complete.

20
CHAPTER 4 DESIGN

In the end, we are at the conclusion that this web application will be covering the needs of
the people that are facing the heart disease detection problem and will provide the facilities
by minimizing the cost factor and maximizing the prediction accuracy.

Chapter 4

Design

4.1 Software Process Model


The software development models are the various processes or methodologies that are
decided for the development of the project depending on the project’s aims and goals.
Many development life cycle models have been developed to achieve different expected
objectives. So in this project, we are going to choose the spiral model which will help us
in our work to achieve our goal.

The Spiral Model is an evolutionary software process model that couples the iterative
nature of prototyping with the controlled and systematic aspects of the linear sequential
model. Using the Spiral model, the software is developed in order of incremental
releases. It provides the potential for rapid development of incremental versions of the
software.

21
CHAPTER 4 DESIGN

Figure 1- Spiral Process Model that used in our Project

 Customer Communication
Tasks required establishing effective communication between developer & customer.
 Planning 
Determination of objectives, alternatives, and constraints
 Risk Analysis
Analysis alternatives and attempts to identify and resolve the risks involved
 Development
Product development and testing product
 Assessment
Customer evaluation

4.2 Benefits of Selected Model


 Indication of the Risks
Indication of risks will be much less if we choose this process model e.g. if robot
structure will not according to stakeholders. This risk can be solved without involving
much cost.
 Rapid prototyping tools

22
CHAPTER 4 DESIGN

In our project prototyping is compulsory because it is necessary to make prototype to


check whether our robot is following the path or not.
 High-Risk Functions
Critical and high-risk functions functionalities will develop first like placing sensors
according to the width of black line or tape
 Incremental Process
Incremental process is profitable for our project because when we increment our project
fault and improvement will be done in incremental process.
 Life Cycle
Users involved in this system so we can easily communicate with them and change
anything if they want in next incremental process in all lifecycle steps.
 Feedback
We can get feedback frequently from the customers after all increments and model it will
help us to make our project run smooth. Cumulative costs assessed frequently.

4.3 Limitations of Model


Following are the limitation of the proposed system
 Management is Difficult
By using this model it was difficult for us to manage meeting hours with the stakeholder
and know what they want more in our project.
 Time Duration
Completing project time will not be accurately calculated.
 Small Project
This process model cannot be very profitable for small project because hardware
implementation requires much cost and time.
 Adding Additional Functions
Adding additional functionality is difficult using this process model in over project
because increase in weight can cause our robot to work slowly.

 Indefinite Time
Spiral model may go indefinite time as if our robot sensors have not preciously placed.
 Documentation
23
CHAPTER 4 DESIGN

In every increment documentation of our required more concentration to correctly written for
each and every stage.

4.4 Design

4.4.1 Methodology Diagram

Figure 2- Methodology Diagram

24
CHAPTER 4 DESIGN

4.4.2 Entity Relationship Diagram


Entity relationship diagram is:

Figure 3- Entity Relationship Diagram

An entity–relationship model describes interrelated things of interest in a specific domain of


knowledge. A basic ER model is composed of entity types and specifies relationships that can
exist between entities.

25
CHAPTER 4 DESIGN

4.4.3 System Flow Diagram

System Flow Diagram is defined graphical and sequential representation of the major steps
involved in a systematic process of our project.

Figure 4-Flow Diagram

26
CHAPTER 4 DESIGN

4.4.1 UML Diagrams

Use Case Diagram

Figure 5-Use Case Diagram

27
CHAPTER 4 DESIGN

Class Diagram

Figure 6-Class Diagram

28
CHAPTER 4 DESIGN

Activity Diagram

Figure 7-Activity Diagram

29
CHAPTER 4 DESIGN

Sequence Diagram

Table 12. Sequence Diagram Selecting Options

30
CHAPTER 4 DESIGN

Figure 8- Diagram View Details

31
CHAPTER 4 DESIGN

Component Diagram

Component Diagram

4.5 Summary
It is crucial to choose an appropriate process model according to the project so that future
work will go smoothly and risk-free along with incurring a low cost. In this chapter, we
choose the spiral process model as it is suitable and appropriate furthermore limitations and
befits are discussed as it is incremental and prototyping helps us to make our project
according to the users' need moreover diagrammatically project is explained in this chapter.

32
CHAPTER 4 DESIGN

LIST OF SYMBOLS
& And

/ OR

- Dash

| Vertical bar

< Less Than

= Equal

< Less than

> Greater than

<= Less and Equal to

=> Greater and Equal to

# Number

0 off

1 on

Fig Figure

Fry Functional Requirements

NFR Non Functional Requir

ement

33

You might also like