0% found this document useful (0 votes)
10 views80 pages

HeartDiseasePrediction Report Django

The document outlines the development of a Heart Disease Prediction System using machine learning and data mining techniques to predict heart disease based on various medical parameters. It details the system's requirements, analysis, design, and implementation, including the use of Python, HTML, and CSS. The system aims to provide early diagnosis and improve treatment accessibility for heart disease patients.

Uploaded by

suraiyareeha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views80 pages

HeartDiseasePrediction Report Django

The document outlines the development of a Heart Disease Prediction System using machine learning and data mining techniques to predict heart disease based on various medical parameters. It details the system's requirements, analysis, design, and implementation, including the use of Python, HTML, and CSS. The system aims to provide early diagnosis and improve treatment accessibility for heart disease patients.

Uploaded by

suraiyareeha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 80

Table of Contents

Chapter 1. Introduction Page No.

1) Introduction to the System 4


2) Problem Definition 4
3) Aim 4
4) Objective 4
5) Goal 5
6) Need of System 5

Chapter 2. Hardware and Software requirement

1) Introduction 7
2) System environment 7
3) Software requirement 8
4) Hardware requirements 8

Chapter 3. System Analysis

1) Purpose 9
2) Project Scope 9
3) Existing System 9
4) Proposed System 9
5) System Description 10

Page 1
Chapter 4.Implementation issues

1) Python 11
2) HTML 13
3) Cascading style sheet(CSS) 16
4) SQLITE 17

Chapter 5. System Design


1) Introduction 21
2) Conceptual Design 22
3) ER-Diagram 23
4) Logical Design 23
5) Physical Design 24
6) Data Flow Diagram 24

Chapter 6.User Screens 25-35

Chapter 7.Coding 36-76

Chapter 8. Conclusion
7) Features of “Heart Disease Prediction” 78
8) Benefits Accrued from “Heart DiseasePrediction” 79
9) Limitations of “Heart Disease Prediction” 80

Bibliography

Page 2
CHAPTER # 1
Introduction
Contents:

 Introduction
 Problem Definition
 Aim
 Objective
 Goal
 Need of System

Page 3
Abstract

Now days, Heart disease is the most common disease. But, unfortunately the treatment of heart dis-
ease is somewhat costly that is not affordable by common man. Hence, we can reduce this problem
in some amount just by predicting heart disease before it becomes dangerous using Heart Disease
Prediction System Using Machine Learning and Data mining. If we can find out heart disease
problem in early stages then It becomes very helpful for treatment. Machine Learning and Data
Mining techniques are used for the construction of Heart Disease Prediction System. In health-
care biomedical field, there is large use of heath care data in the form of text, images, etc but, that
data is hardly visited and is not mined. So, we can avoid this problem by introducing Heart Disease
Prediction System. This system will help us reduce the costs and to enhance the quality treatment
of heart patients. This system can able to identify complex problems and can able to take intelligent
medical decisions. The system can predict likelihood of patients of getting heart problems by their
profiles such as blood pressure, age, sex, cholesterol and blood sugar. Also, the performance will be
compared by calculation of confusion matrix. This can help to calculate accuracy, precision, and re-
call. The overall system provides high performance and better accuracy.

Page 4
Introduction to the System:

The health care industries collect huge amounts of data that contain some hidden information,
which is useful for making effective decisions. For providing appropriate results and making
effective decisions on data, some advanced data mining techniques are used. In this study, a Heart
Disease Prediction System (HDPS) is developed using Naives Bayes and Decision Tree algorithms
for predicting the risk level of heart disease. The system uses 15 medical parameters such as age,
sex, blood pressure, cholesterol, and obesity for prediction. The HDPS predicts the likelihood of
patients getting heart disease. It enables significant knowledge. E.g. Relationships between medical
factors related to heart disease and patterns, to be established. We have employed the multilayer
perceptron neural network with back propagation as the training algorithm. The obtained results
have illustrated that the designed diagnostic system can effectively predict the risk level of heart
diseases.

Problem Definition:

Prediction of heart disease may seem tricky, but this is part of user service system (application
support direct contact with user).

Aim:

To predict heart disease according to input parameter values provided by user and dataset stored in
database.

Page 5
Objective:

The main objective of this research is to develop a heart disease prediction system. The system can
discover and extract hidden knowledge associated with diseases from a historical heart data set
Heart disease prediction system aims to exploit data mining techniques on medical data set to assist
in the prediction of the heart diseases.

Page 6
Goal:

 User can search for doctor’s help at any point of time.


 User can talk about their illness and get instant diagnosis.
 Informs the user about the type of disease or disorder it feels.
 Doctors get more clients online.

Page 7
Need of the System:

 There is always a need of a system that will provide the disease prediction information
according to parameter values shared by user.
 This system will help the user to find good doctors and medicines.

Page 8
PREDICTABLE ATTRIBUTE

 Diagnosis value 0:<50% diameter narrowing(no heart disease)


 Value 1:>50% diameter narrowing(has heart disease)
 Input Attributes :
 Sex
 Chest Pain Type
 Fasting Blood Sugar
 Restecg
 Exang
 Slope
 CA – number of major vessels colored by floursopy
 Thal
 Trest Blood Pressure
 Serum Cholesterol
 Thalach – maximum heart rate achieved
 Oldpeak
 Age in Year

Page 9
CHAPTER # 2
Hardware and
Software
Requirements

Contents:

 Software requirement
 Hardware requirements

Page 10
Software Requirements:

 Technology: Python Django

 IDE : Pycharm/Atom

 Client Side Technologies: HTML, CSS, JavaScript , Bootstrap

 Server Side Technologies: Python

 Data Base Server: Sqlite

Operating System: Microsoft Windows/Linux

Hardware Requirements:

 Processor: Pentium-III (or) Higher


 Ram: 64MB (or) Higher
 Hard disk: 80GB (or) Higher

Page 11
CHAPTER # 3
System Analysis

Contents:

 Purpose
 Project Scope
 Existing System
 Proposed System
 System Overview

Page 12
Purpose:

 User can search for doctor’s help at any point of time.


 User can talk about their illness and get instant diagnosis.
 Informs the user about the type of disease or disorder it feels.
 Doctors get more clients online.

Project Scope:

The project has a wide scope, as it is not intended to a particular organization. This project is
going to develop generic software, which can be applied by any businesses organization.
More over it provides facility to its users. Also the software is going to provide a huge
amount of summary data.

Page 13
Proposed System:

The development of the new system contains the following activities, which try to automate the
entire process keeping in view of the database integration approach.

1. User friendliness is provided in the application with various controls.


2. The system makes the overall project management much easier and flexible.
3. There is no risk of data mismanagement at any level while the project development is under
process.
4. It provides high level of security with different level of authentication.

Page 14
System Overview:

 Patient Login: - Patient Login to the system using his ID and Password.
 Patient Registration: -If Patient is a new user he will enter his personal details and he will
user Id and password through which he can login to the system.
 My Details: - Patient can view his personal details.
 Disease Prediction: - Patient will specify the input parameter values. System will take input
values and predict the disease based on the input data values specified by the patient and
system will also suggest doctors based on the locality.
 Search Doctor:- Patient can search for doctor by specifying name, address or type.
 Feedback:-Patient will give feedback this will be reported to the admin.
 Doctor Login: - Doctor will access the system using his User ID and Password.
 Patient Details: Doctor can view patient’s personal details.
 Notification: Admin and doctor will get notification how many people had accessed the
system and what all are the diseases predicted by the system.
 Admin Login: Admin can login to the system using his ID and Password.
 Add Doctor: Admin can add new doctor details into the database.
 Add Dataset: Admin can add dataset file in database.
 View Doctor: Admin can view various Doctors along with their personal details.
 View Disease: Admin can view various diseases details stored in database.
 View Patient: Admin can view various patient details that had accessed the system.
 View Feedback: Admin can view feedback provided by various users.

Page 15
CHAPTER # 4
Implementation issues

Python

Python is a widely used general-purpose, high level programming language. It was initially
designed by Guido van Rossum in 1991 and developed by Python Software Foundation. It was
mainly developed for emphasis on code readability, and its syntax allows programmers to express
concepts in fewer lines of code.
Python is a programming language that lets you work quickly and integrate systems more
efficiently.
Python is dynamically typed and garbage-collected. It supports multiple programming paradigms,
including procedural, object-oriented, and functional programming. Python is often described as a
"batteries included" language due to its comprehensive standard library.

Page 16
Machine Learning Technologies

We have used Pandas, Gradient boosting classifiers and Logistic Regression for this project
All are explain below:
Gradient boosting classifiers are a group of machine learning algorithms that combine many weak
learning models together to create a strong predictive model. Decision trees are usually used when
doing gradient boosting. Gradient boosting models are becoming popular because of their
effectiveness at classifying complex datasets.
Pandas are a fast, powerful, flexible and easy to use open source data analysis and manipulation
tool, built on top of the Python programming language.
In statistics, the logistic model is used to model the probability of a certain class or event existing
such as pass/fail, win/lose, alive/dead or healthy/sick.

HTML

HTML (Hypertext Markup Language) is the set of markup symbols or codes inserted in a file
intended for display on a World Wide Web browser page. The markup tells the Web browser how to
display a Web page's words and images for the user. Each individual markup code is referred to as
an element (but many people also refer to it as a tag). Some elements come in pairs that indicate
when some display effect is to begin and when it is to end.

Page 17
CASCADING STYLE SHEET (CSS)

Cascading Style Sheets (CSS) are a collection of rules we use to define and modify web pages.
CSS are similar to styles in Word. CSS allow Web designers to have much more control over their
pages look and layout. For instance, you could create a style that defines the body text to be
Verdana, 10 point. Later on, you may easily change the body text to Times New Roman, 12 point by
just changing the rule in the CSS. Instead of having to change the font on each page of your
website, all you need to do is redefine the style on the style sheet, and it will instantly change on all
of the pages that the style sheet has been applied to. With HTML styles, the font change would be
applied to each instance of that font and have to be changed in each spot.

CSS can control the placement of text and objects on your pages as well as the look of those
objects.

HTML information creates the objects (or gives objects meaning), but styles describe how the
objects should appear. The HTML gives your page structure, while the CSS creates the
“presentation”. An external CSS is really just a text file with a .css extension. These files can be
created with Dreamweaver, a CSS editor, or even Notepad.

The best practice is to design your web page on paper first so you know where you will want to use
styles on your page. Then you can create the styles and apply them to your page.

Page 18
Javascript

JavaScript is a programming languagecommonly used in web development. It was originally devel-


oped by Netscape as a means to add dynamic and interactive elements to websites. While
JavaScript is influenced byJava, the syntax is more similar to C and is based on ECMAScript, a
scripting language developed by Sun Microsystems.
JavaScript is a client-side scripting language, which means the source code is processed by the
client's web browser rather than on the web server. This means JavaScript functions can run after a
webpage has loaded without COMMUNICATING with the server. For example, a JavaScript func-
tion may check a web form before it is submitted to make sure all the required fields have been
filled out. The JavaScript code can produce an error message before any information is actually
transmitted to the server.
Like server-side scripting languages, such as PHP and ASP, JavaScript code can be inserted any-
where within the HTML of a webpage. However, only the output of server-side code is displayed in
the HTML, while JavaScript code remains fully visible in the source of the webpage. It can also be
referenced in a separate .JS file, which may also be viewed in a browser.

Page 19
Django

Django is a web application framework written in Python programming language. It is based on


MVT (Model View Template) design pattern. The Django is very demanding due to its rapid devel-
opment feature. It takes less time to build application after collecting client requirement.

This framework uses a famous tag line: The web framework for perfectionists with deadlines.

Page 20
DATASET USED

Page 21
CHAPTER # 5
System Design

Contents:
 Use case diagram
 Class Diagram
 Sequence Diagram
 Data flow diagram

Page 22
Use Case Diagram:

 Use case diagram consists of use cases and actors and shows the interaction between
them. The key points are:

 The main purpose is to show the interaction between the use cases and the actor.

 To represent the system requirement from user’s perspective.

 The use cases are the functions that are to be performed in the module.

Page 23
Page 24
Page 25
Sequence Diagram For Administrator:-

Login Application Database

Login
:Request

:Validate()
:executeQuery()

Administrator Response
Show Result

Success:hide() Failed:show()

Fig.5.4

Page 26
Sequence Diagram For User:-

Login Application Database

Login
:Request

:Validate()
User
:executeQuery()

Response
Show Result

Success:hide()
Failed:show()

Fig.5.5

Page 27
Data Flow Diagram

A Data Flow Diagram (DFD) is a graphical representation of the "flow" of data through an
Information System. A data flow diagram can also be used for the visualization of Data Processing.
It is common practice for a designer to draw a context-level DFD first which shows the interaction
between the system and outside entities. This context-level DFD is then "exploded" to show more
detail of the system being modeled.

A DFD represents flow of data through a system. Data flow diagrams are commonly used during
problem analysis. It views a system as a function that transforms the input into desired output. A
DFD shows movement of data through the different transformations or processes in the system.

Dataflow diagrams can be used to provide the end user with a physical idea of where the data they
input ultimately has an effect upon the structure of the whole system from order to dispatch to re-
stock how any system is developed can be determined through a dataflow diagram. The appropriate
register saved in database and maintained by appropriate authorities.

Data Flow Diagram Notation

Function

File/Database

Input/output

Flow

Page 28
DFD (Data Flow Diagram)

Page 29
Entity Relationship Diagrams (ER-Diagrams):

An entity-relationship (ER) diagram is a specialized graphic that illustrates the interrelationships


between entities in a database. ER diagrams often use symbols to represent three different types of
information. Boxes are commonly used to represent entities. Diamonds are normally used to
represent relationships and ovals are used to represent attributes

An entity-relationship model (ERM) in software engineering is an abstract and conceptual


representation of data. Entity-relationship modeling is a relational schema database modeling
method, used to produce a type of conceptual schema or semantic data model of a system, often a
relational database, and its requirements in a top-down fashion.

Symbols used in this E-R Diagram:


Entity: Entity is a “thing” in the real world with an independent existence. An entity may be an
object with a physical existence such as person, car or employee. Entity symbol is as follows

Attribute: Attribute is a particular property that describes the entity. Attribute symbol is

Relationship: Relationship will be several implicit relationships among various entity types
whenever an attribute of one entity refers to another entity type some relationship exits.
Relationship symbol is:

Key attributes: An entity type usually has an attribute whose values are distinct for each individual
entity in the collection. Such an attribute is called key attribute.

Page 30
Page 31
Activity Diagram

Page 32
CHAPTER # 6
Output screens
HOME PAGE

Page 33
USER REGISTRATION PAGE

Page 34
USER (PATIENT) LOGIN PAGE

Page 35
PATIENT HOME PAGE

Page 36
INPUT ATTRIBUTE VALUES PAGE

Page 37
VIEW DISEASE PREDICTION RESULT PAGE

Page 38
USER PROFILE PAGE

Page 39
CHANGE PASSWORD PAGE

Page 40
ADMIN LOGIN PAGE

Page 41
ADMIN HOME PAGE

Page 42
VIEW PREDICTION RESULTS PAGE

ADD DOCTOR DETAIL PAGE

Page 43
Page 44
VIEW ALL DOCTORS PAGE

Page 45
MANAGE PATIENTS

Page 46
CHAPTER # 7
Coding
HOME PAGE CODING

<!DOCTYPE html>
{% load static %}
<html lang="zxx">

<head>
<title>Heart Disease Prediction System</title>
<!-- Meta tag Keywords -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta charset="UTF-8" />
<meta name="keywords" />
<script>
addEventListener("load", function () {
setTimeout(hideURLbar, 0);
}, false);

function hideURLbar() {
window.scrollTo(0, 1);
}
</script>
<link rel="stylesheet" href="{% static 'css/bootstrap.css' %}">
<!-- Bootstrap-Core-CSS -->
<link href="{% static 'css/css_slider.css' %}" type="text/css" rel="stylesheet"
media="all">

Page 47
<!-- banner slider -->
<link rel="stylesheet" href="{% static 'css/style.css' %}" type="text/css"
media="all" />
<!-- Style-CSS -->
<link href="{% static 'css/font-awesome.min.css' %}" rel="stylesheet">
<!-- Font-Awesome-Icons-CSS -->
<!-- //Custom-Files -->

<!-- Web-Fonts -->


<link href="//fonts.googleapis.com/css?family=Quicksand:300,400,500,700"
rel="stylesheet">
<link href="//fonts.googleapis.com/css?
family=Mukta:200,300,400,500,600,700,800&amp;subset=devanagari,latin-ext"
rel="stylesheet">
<style> <!-- //Web-Fonts -->
.li2{
border:1px solid red;
padding:8px;
}
</style>

<link rel='stylesheet' type='text/css'


href="https://cdn.datatables.net/1.10.21/css/jquery.dataTables.min.css">
<link rel='stylesheet' type='text/css'
href="https://cdn.datatables.net/buttons/1.6.2/css/buttons.dataTables.min.css">

<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.10.21/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.2/js/dataTables.buttons.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js"></
script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/buttons/1.6.2/js/buttons.html5.min.js"></script>
Page 48
<script>
$(document).ready(function() {
$('#example').DataTable( {
dom: 'Bfrtip',
buttons: [
'copyHtml5',
'excelHtml5',
'csvHtml5',
'pdfHtml5'
]
} );
} );
</script>
</head>

<body>
<!-- main -->
<div id="home" style="margin-bottom:2%">
<!-- top header -->
<header>
<div class="top-bar py-3">
<div class="container">
<div class="row">
<div class="col-xl-6 col-lg-6 col-md-8 top-social-
agile text-lg-left text-center">
<div class="row">
<div class="col-5 header-
top_w3layouts">
<p class="text-bl">
<span class="fa fa-
map-marker mr-2"></span>ABC Sec-C, Delhi
</p>
</div>
Page 49
<div class="col-3 header-
top_w3layouts">
<p class="text-bl">
<span class="fa fa-
phone mr-2"></span>+1 000263676
</p>
</div>
<!-- social icons -->
<ul class="col-4 top-right-info">
<li>
<a href="#">
<span class="fa
fa-facebook-f"></span>
</a>
</li>
<li class="mx-3">
<a href="#">
<span class="fa
fa-twitter"></span>
</a>
</li>
<li>
<a href="#">
<span class="fa
fa-google-plus"></span>
</a>
</li>
<li class="ml-3">
<a href="#">
<span class="fa
fa-pinterest-p"></span>
</a>
</li>
</ul>
Page 50
<!-- //social icons -->
</div>
</div>
<div class="col-xl-7 col-lg-6 col-md-4 top-social-
agile text-md-right text-center mt-md-0 mt-2">
<div class="row">
<div class="offset-xl-6 offset-lg-4">
</div>
<div class="col-xl-3 col-lg-4 col-6
top-w3layouts p-md-0 text-right">
<!-- login -->
<a href="login.html"
class="login-button-2 text-uppercase text-bl">
</a>
<!-- //login -->
</div>
<div class="col-xl-3 col-lg-4 col-6
header-w3layouts text-md-right text-left">
<!-- register -->
<a href="register.html"
class="login-button-2 text-uppercase text-bl">
</a>
<!-- //register -->
</div>
</div>
</div>
</div>
</div>
</div>
</header>
<!-- //top header -->

<!-- second header -->


<div class="main-top" style="background:Green">
Page 51
<div class="container-fluid">
<div class="header d-md-flex justify-content-between align-
items-center py-3">
<!-- logo -->
<div id="logo" style="margin-left:13%">
<h1>
<a href="index.html">
<span class="fa fa-user-md mr-
2"></span>
<span class="logo-sp">Heart
Disease</span> Prediction
</a>
</h1>
</div>
<!-- //logo -->
<!-- nav -->
{% if request.user.is_staff %}
<div class="nav_w3ls" style="margin-right:4%">
<nav>
<label for="drop1"
class="toggle">Menu</label>
<input type="checkbox" id="drop1" />
<ul class="menu"
style="padding:15px;width:100%">

<li class="mx-lg-4 mx-md-3 my-md-0


my-2"><a href="{% url 'admin_home' %}" class="active">Home</a></li>

<li>
<label for="drop-2"
class="toggle toogle-2"> <span class="fa fa-angle-down" aria-hidden="true"></span>
</label>
<a href="#"> Doctor <span
class="fa fa-angle-down" aria-hidden="true"></span></a>
Page 52
<ul style="margin-
top:2%;width:40%;margin-right:0%">
<li
style="width:100%;"><a href="/add_doctor" class="drop-text">Add Doctor</a></li>
<li
style="width:100%;"><a href="/view_doctor" class="drop-text">View Doctor</a></li>
</ul>
</li>

<li class="mx-lg-4 mx-md-3 my-md-0


my-2"><a href="/view_patient">Patient</a></li>
<li class="mx-lg-4 mx-md-3 my-md-0
my-2">
<a
href="/view_search_pat">Searched Data</a></li>
<li><a
href="/view_feedback">Feedback</a></li>

</ul>
</nav>
</div>
<div class="nav_w3ls" style="margin-right:3%">

<nav>
<label for="drop2"
class="toggle">Menu</label>
<input type="checkbox" id="drop2" />
<ul class="menu">
<li class="mx-lg-4 mx-md-3 my-md-0
my-2" style="background:red;padding:8px">
<!-- First Tier Drop Down -->
<label for="drop-2"
Page 53
class="toggle toogle-2"> <span class="fa fa-angle-down" aria-hidden="true"></span>
</label>
<a href="#"><i class="fa fa-
user"></i> {{request.user.username}} <span class="fa fa-angle-down" aria-
hidden="true"></span></a>
<ul style="margin-
top:10%;width:80%;margin-right:5%">
<li
style="width:100%;"><a href="{% url 'change_password' %}" class="drop-
text">Password</a></li>
<li
style="width:100%;"><a href="{% url 'logout' %}" class="drop-text">Logout</a></li>
</ul>
</li>

</ul>
</nav>
</div>

{% elif request.user.patient_set.all.0 %}
<div class="nav_w3ls" style="margin-left:5%;font-
weight:bold">
<nav>
<label for="drop3"
class="toggle">Menu</label>
<input type="checkbox" id="drop3" />
<ul class="menu"
style="padding:15px;width:100%">
<li><a href="{% url 'patient_home'
%}" class="active">Home</a></li>
<li class="mx-lg-4 mx-md-3 my-md-0
my-2"><a href="/add_heartdetail">Predict</a></li>
Page 54
<li class="mx-lg-4 mx-md-3 my-md-0
my-2"><a href="/profile_doctor">My Detail</a></li>
<li class="mx-lg-4 mx-md-3 my-md-0
my-2"><a href="/sent_feedback">Feedback</a></li>
<li><a
href="/view_search_pat">History</a></li>
</ul>
</nav>
</div>
<div class="nav_w3ls" style="margin-right:3%">

<nav>
<label for="drop4"
class="toggle">Menu</label>
<input type="checkbox" id="drop4" />
<ul class="menu">
<li class="mx-lg-4 mx-md-3 my-md-0
my-2" style="background:red;padding:8px">
<!-- First Tier Drop Down -->
<label for="drop-3"
class="toggle toogle-3"> <span class="fa fa-angle-down" aria-hidden="true"></span>
</label>
<a href="#"><i class="fa fa-
sign-in"></i> Hello,{{request.user.username}} <span class="fa fa-angle-down" aria-
hidden="true"></span></a>
<ul style="margin-
top:8%;width:80%;margin-right:5%">
<li
style="width:100%;"><a href="{% url 'change_password' %}" class="drop-text">
Password</a></li>
<li
style="width:100%;"><a href="{% url 'logout' %}" class="drop-text"> Logout</a></li>
</ul>
</li>
Page 55
</ul>
</nav>
</div>
{% elif request.user.doctor_set.all.0 %}
<div class="nav_w3ls" style="margin-right:4%">
<nav>
<label for="drop5"
class="toggle">Menu</label>
<input type="checkbox" id="drop5" />
<ul class="menu"
style="padding:15px;width:100%">
<li><a href="{% url 'doctor_home'
%}" class="active">Home</a></li>
<li class="mx-lg-4 mx-md-3 my-md-0
my-2">
<a
href="/profile_doctor">My Detail</a></li>
<li class="mx-lg-4 mx-md-3 my-md-0
my-2">
<a
href="view_search_pat">Searched Data</a></li>

</ul>
</nav>
</div>
<div class="nav_w3ls" style="margin-right:3%">

<nav>
<label for="drop6"
class="toggle">Menu</label>
<input type="checkbox" id="drop6" />
<ul class="menu">
<li class="mx-lg-4 mx-md-3 my-md-0
my-2" style="background:red;padding:8px">
Page 56
<!-- First Tier Drop Down -->
<label for="drop6"
class="toggle toogle-2"> <span class="fa fa-angle-down" aria-hidden="true"></span>
</label>
<a href="#"><i class="fa fa-
user"></i> {{request.user.username}} <span class="fa fa-angle-down" aria-
hidden="true"></span></a>
<ul style="margin-
top:10%;width:80%;margin-right:5%">
<li
style="width:100%;"><a href="{% url 'change_password' %}" class="drop-
text">Password</a></li>
<li
style="width:100%;"><a href="{% url 'logout' %}" class="drop-text">Logout</a></li>
</ul>
</li>

</ul>
</nav>
</div>
{% else %}
<div class="nav_w3ls" style="margin-right:4%">
<nav>
<label for="drop7"
class="toggle">Menu</label>
<input type="checkbox" id="drop7" />
<ul class="menu"
style="padding:15px;width:100%">
<li><a href="{% url 'home' %}"
class="active">Home</a></li>
<li class="mx-lg-4 mx-md-3 my-md-0
my-2">
Page 57
<a href="{% url 'about'
%}">About Us</a></li>
<li><a href="{% url 'gallery'
%}">Gallery</a></li>

<li style="padding-left:20px"><a
href="{% url 'contact' %}">Contact Us</a></li>
</ul>
</nav>
</div>
<div class="nav_w3ls" style="margin-right:3%">

<nav>
<label for="drop"
class="toggle">Menu</label>
<input type="checkbox" id="drop" />
<ul class="menu">
<li class="mx-lg-4 mx-md-3 my-md-0
my-2" style="background:red;padding:8px">
<!-- First Tier Drop Down -->
<label for="drop-2"
class="toggle toogle-2"> <span class="fa fa-angle-down" aria-hidden="true"></span>
</label>
<a href="#"><i class="fa fa-
sign-in"></i> Login <span class="fa fa-angle-down" aria-hidden="true"></span></a>
<ul style="margin-
top:10%;width:80%;margin-right:5%">
<li
style="width:100%;"><a href="{% url 'login_admin' %}"
class="drop-text">Admin</a></li>
<li
style="width:100%;"><a href="{% url 'login' %}" class="drop-text">User</a></li>
</ul>
</li>
Page 58
</ul>
</nav>
</div>
{% endif %}

<!-- //nav -->


</div>
</div>
</div>
<!-- //second header -->

<!-- banner -->


{% block body %}
{% endblock %}
<!-- //banner -->
</div>
<!-- //main -->

<!-- footer bottom -->


<!-- copyright -->
<div class="copy-w3pvt" style="background:green;color:white">
<div class="container py-3">
<div class="row">
<div class="col-lg-7 w3ls_footer_grid1_left text-lg-left text-
center">
<p style="color:white">&copy; 2021 Heart Disease
Prediction. All rights reserved | Design by
ABC</a>
</p>
Page 59
</div>
<div class="col-lg-5 w3ls_footer_grid_left1_pos text-lg-right text-
center mt-lg-0 mt-2">
<ul style="color:white">
<li>
<a href="#" style="color:white"
class="facebook">
<span class="fa fa-facebook-f mr-
2"></span>Facebook</a>
</li>
<li class="mx-3">
<a href="#" style="color:white"
class="twitter">
<span class="fa fa-twitter
mr-2"></span>Twitter</a>
</li>
<li>
<a href="#" style="color:white"
class="google"> <span class="fa fa-google-plus
mr-2"></span>Google Plus</a>
</li>
</ul>
</div>
</div>
</div>
</div>

<a href="#home" style="color:white" class="move-top text-center"></a>


<!-- //move top icon -->
</body>
</html>

USER REGISTRATION PAGE CODING


Page 60
{% extends 'index.html' %}
{% load static %}
{% block body %}
<!-- register -->
{% ifequal error "create" %}
<script>
alert('Registration Successfull');
window.location="{% url 'login' %}";
</script>
{% endifequal %}

<section class="logins py-5">


<div class="container py-xl-5 py-lg-3">
<div class="title-section mb-md-5 mb-4">
<h6 class="w3ls-title-sub"></h6>
<h3 class="w3ls-title text-uppercase text-dark font-weight-
bold">Register Now</h3>
</div><hr/>
<div class="login px-sm-12" style="width:100%">
<form action="" method="post" enctype="multipart/form-
data">
{% csrf_token %}
<div class="form-group row">
<div class="col-md-6">
<label>First Name</label>
<input type="text" class="form-control"
name="fname" placeholder="First Name" required="">
</div>
<div class="col-md-6">
<label>Last Name</label>
<input type="text" class="form-control"
name="lname" placeholder="Last Name" required="">
Page 61
</div>
</div>
<div class="form-group row">
<div class="col-md-6">
<label>Username</label>
<input type="text" class="form-control"
name="uname" placeholder="Username" required="">
</div>
<div class="col-md-6">
<label>Password</label>
<input type="password" class="form-control"
name="pwd" placeholder="Password" required="">
</div>
</div>
<div class="form-group row">
<div class="col-md-6">
<label>Email</label>
<input type="email" class="form-control"
name="email" placeholder="Enter Email" required="">
</div>
<div class="col-md-6">
<label>Contact</label>
<input type="text" class="form-control"
name="contact" placeholder="Enter Contact" required="">
</div>
</div>
<div class="form-group row">
<div class="col-md-6">
<label>Date Of Birth</label>
<input type="date" class="form-control"
name="dob" placeholder="" required="">
</div>
<div class="col-md-6">
<label>Image</label>
Page 62
<input type="file" class="form-control"
name="image" required="">
</div>
</div>
<div class="form-group row">
<div class="col-md-6">
<label class="mb-2">City</label>
<input type="text" class="form-control"
name="add" id="password1" placeholder="Enter Address" required="">
</div>
<div class="col-md-6">
<label>User Type</label>
<div class="form-control">
Patient <input type="radio"
placeholder="Patient" name="type" style="margin-right:4%" required=""
value="Patient">
Doctor <input type="radio" placeholder="Patient"
name="type" required="" value="Doctor">
</div>
</div>
</div>
<button type="submit" class="btn submit mt-
4">Register</button>
<p class="text-center mt-5">
<a href="#">By clicking Register, I agree to your
terms</a>
</p>
</form>
</div>
</div>
</section>
{% endblock %}

DISEASE PREDICTION PAGE CODING


Page 63
{% extends 'index.html' %}
{% load static %}
{% block body %}
<!-- register -->

<section class="logins py-5">


<div class="container py-xl-5 py-lg-3">
<div class="title-section mb-md-5 mb-4">
<h6 class="w3ls-title-sub"></h6>
<h3 class="w3ls-title text-uppercase text-dark font-
weight-bold">Add Heart Detail</h3>
</div><hr/>
<div class="login px-sm-12" style="width:100%">
<form action="" method="post"
enctype="multipart/form-data">
{% csrf_token %}
<div class="form-group row">
<div class="col-md-1">
<label>Age</label>
<input type="text" class="form-
control" name="age" required="">
</div>
<div class="col-md-1">
<label>Sex</label>
<input type="text" class="form-
control" name="sex" required="">
</div>
<div class="col-md-1">
<label>CP</label>
<input type="text" class="form-
control" name="cp" required="">
Page 64
</div>
<div class="col-md-1">
<label>Trestbps</label>
<input type="text" class="form-
control" name="trestbps" required="">
</div>
<div class="col-md-1">
<label>Cholestrol</label>
<input type="text" class="form-
control" name="chole" required="">
</div>
<div class="col-md-1">
<label>Fbs</label>
<input type="text" class="form-
control" name="fbs" required="">
</div>
<div class="col-md-1">
<label>Restecg</label>
<input type="text" class="form-
control" name="restecg" required="">
</div>
<div class="col-md-1">
<label>Thalach</label>
<input type="text" class="form-
control" name="thalach" required="">
</div>
<div class="col-md-1">
<label>Exang</label>
<input type="text" class="form-
control" name="exang" required="">
</div>
<div class="col-md-1">
<label>OldPeak</label>
<input type="text" class="form-
Page 65
control" name="old_peak" required="">
</div>
<div class="col-md-1">
<label>Slope</label>
<input type="text" class="form-
control" name="slope" required="">
</div>
<div class="col-md-1">
<label>CA</label>
<input type="text" class="form-
control" name="ca" required="">
</div>
<div class="col-md-1">
<label>Thal</label>
<input type="text" class="form-
control" name="thal" required="">
</div>

</div>
<button type="submit" class="btn submit
mt-4">Send Heart data</button>
</form>
</div>
</div>
</section>
<!-- //register -->

{% endblock %}

PREDICTION RESULT PAGE CODING


Page 66
{% extends 'index.html' %}
{% load static %}
{% block body %}

<section class="logins py-5">


<div class="container py-xl-5 py-lg-3">
<div class="title-section mb-md-5 mb-4">
<h6 class="w3ls-title-sub" style="color:red"></h6>
<h3 class="w3ls-title text-uppercase text-dark font-weight-
bold">Heart Prediction Output</h3>
</div><hr/>
<div class="login px-sm-12" style="width:100%">

<h1 align='center' style='color:red'>Prediction


output</h1><hr><center><p><b>Accuracy (%) is :</b> {{ accuracy }} </p><p><b>Result
is :</b>
{% if pred == "0" %}
<span style='color:green'>You are healthy.</span>
{% else %}
<span style='color:red'>You are Unhealthy, Need to Checkup.</span>
{% endif %}

</p></center>

</div>
{% if pred != "0" %}

<div class="container-fluid" style="width:90%;margin-top:3%">


<div class="container-fluid">
<h1 align="center" style="font-weight:bold;font-family : 'Monotype Corsiva' ;
color : #E6120E ;margin-top:4%">You may contact this Doctor</h1>
</div><hr>
<table id="example" class="display" style="width:100%">
Page 67
<thead>
<tr>
<th>#</th>
<th>Image</th>
<th>Full Name</th>
<th>Email</th>
<th>Contact</th>
<th>Address</th>
</tr>
</thead>
<tbody>
{% for i in doctor %}
<tr>
<td>{{forloop.counter}}</td>
<td><img src="{{i.image.url}}" style="width:80px;height:90px"></td>
<td>{{i.user.first_name}} {{i.user.last_name}}</td>
<td>{{i.user.email}}</td>
<td>{{i.contact}}</td>
<td>{{i.address}}</td>
</tr>
{% empty %}
<tr>
<td colspan="5">No Record Found.</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
</section>
{% endblock %}

ADD DOCTOR DETAILS PAGE


Page 68
{% extends 'index.html' %}
{% load static %}
{% block body %}
<!-- register -->
{% ifequal error "create" %}
<script>
alert('Add a new Doctor Successfully');
window.location="{% url 'view_doctor' %}";
</script>
{% endifequal %}

<section class="logins py-5">


<div class="container py-xl-5 py-lg-3">
<div class="title-section mb-md-5 mb-4">
<h6 class="w3ls-title-sub"></h6>
<h3 class="w3ls-title text-uppercase text-dark font-weight-
bold">Add Doctor</h3>
</div><hr/>
<div class="login px-sm-12" style="width:100%">
<form action="{% if doctor %}/change_doctor/{{doctor.id}}/{%
else %}/add_doctor{% endif %}" method="post" enctype="multipart/form-data">
{% csrf_token %}
{% if not doctor %}
<div class="form-group row">
<div class="col-md-6">
<label>First Name</label>
<input type="text" class="form-control"
name="first_name" placeholder="First Name" required="">
</div>
<div class="col-md-6">
<label>Last Name</label>
<input type="text" class="form-control"
Page 69
name="last_name" placeholder="Last Name" required="">
</div>
</div>
<div class="form-group row">
<div class="col-md-6">
<label>Username</label>
<input type="text" class="form-control"
name="username" placeholder="Username" required="">
</div>
<div class="col-md-6">
<label>Password</label>
<input type="password" class="form-control"
name="password" placeholder="Password" required="">
</div>
</div>
{% endif %}
<div class="form-group row">
<div class="col-md-6">
<label>Email</label>
<input type="email" class="form-control"
name="email" placeholder="Enter Email" required="" value="{{doctor.user.email}}" {% if
doctor %}readonly{% endif %}>
</div>
<div class="col-md-6">
<label>Contact</label>
<input type="text" class="form-control"
name="contact" placeholder="Enter Contact" required="" value="{{doctor.contact}}">
</div>
</div>
<div class="form-group row">
<div class="col-md-6">
<label class="mb-2">Address</label>
<input type="text" class="form-control"
name="address" id="password1" placeholder="Enter Address" required=""
Page 70
value="{{doctor.address}}">
</div>
<div class="col-md-6">
<label>Image</label>
<input type="file" class="form-control"
name="image">
{% if doctor
%}<span>{{doctor.image.url}}</span>{% endif %}
</div>

</div>
<div class="form-group row">
<div class="col-md-12">
<label>Specialist</label>
<input class="form-control"
name="category" placeholder="Specialist" value="{{doctor.category}}">
</div>

</div>
<button type="submit" class="btn submit mt-4">Register
Doctor</button>
</form>
</div>
</div>
</section>
<!-- //register -->

{% endblock %}

VIEW ALL DOCTORS PAGE CODING


Page 71
{% extends 'index.html' %}
{% load static %}
{% block body %}
<div class="container-fluid" style="width:90%;margin-top:8%">
<div class="container-fluid">
<h1 align="center" style="font-weight:bold;font-family : 'Monotype Corsiva' ;
color : #E6120E ;margin-top:4%">View Doctor</h1>
</div><hr>
<table id="example" class="display" style="width:100%">
<thead>
<tr>
<th>#</th>
<th>Full Name</th>
<th>Image</th>
<th>Email</th>
<th>Contact</th>
<th>Address</th>
<th>Category</th>
<th>Status</th>
<th>Assign</th>
<th>Action</th>
</tr>
</thead>
<tbody>
{% for i in doc %}
<tr>
<td>{{forloop.counter}}</td>
<td>{{i.user.first_name}} {{i.user.last_name}}</td>
<td><img src="{{i.image.url}}" style="width:80px;height:80px"></td>
<td>{{i.user.email}}</td>
<td>{{i.contact}}</td>
<td>{{i.address}}</td>
<td>{{i.category}}</td>
Page 72
<td>
{% if i.status == 1 %} <b>Authorized</b>{% else %}
<b>Unauthorized</b>
{% endif %}
</td>
<td>{% if i.status == 1 %}
<a href="{% url 'assign_status' i.id %}" onclick="return confirm('Do you
want to withdraw approval to doctor : {{i.user.first_name}}?')"><button class="btn btn-
danger">Cancel</button></a>
{% else %}
<a href="{% url 'assign_status' i.id %}" onclick="return confirm('Do you
want to give approve to doctor : {{i.user.first_name}}?')"><button class="btn btn-
success">Assign</button></a>
{% endif %}
</td>
<td style="width:150px">
<a href="{% url 'change_doctor' i.id %}" ><button class="btn btn-
primary"><i class="fa fa-edit"></i></button></a>
<a href="{% url 'delete_doctor' i.id %}" ><button class="btn btn-danger"
onclick="return confirm('Are you sure?')"><i class="fa fa-trash-o"></i></button></a></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% for i in messages %}
<script>
alert('hii');
alert({{i}});</script>
{% endfor %}
{% endblock %}

CHANGE PASSWORD PAGE CODING


Page 73
{% extends 'usernavigation.html' %}
{% block body %}
{% load static %}
<style>
.mybtnone:hover{background-color : #800000;
color : #429E00 ; font-weight : bold
}
</style>
<div class="container">
<h2 style = "font-weight:bold;font-family : 'Monotype Corsiva' ; color : #E6120E ;margin-
top:7%" align="center">Change Password</h2><hr>

<div class="container-fluid" style="">


<div class="row">
<div class="col-md-6">
<form method="post" action="">
{% csrf_token %}
<div class="form-group">
<label >Old Password</label>
<input type="password" class="form-control" aria-describedby="emailHelp"
name="pwd3">
</div>

<div class="form-group">
<label >New Password</label>
<input type="password" class="form-control" aria-describedby="emailHelp"
name="pwd1">
</div>

<div class="form-group">
<label for="exampleInputPassword1">Confirm Password</label>
<input type="password" class="form-control" id="exampleInputPassword1"
Page 74
name="pwd2">
</div>
<button type="submit" class="btn btn-primary mybtnone">Submit</button>
</form>
</div>

<div class="col-md-6">
<img src="{% static 'images/notes2.jpg' %}" style="width:90%;height:400px">
</div>
</div>

</div>
</div>

{% ifequal error "yes" %}


<script>
alert('Password Changed.....');
window.location=('{% url 'logout' %}')
</script>
{% endifequal %}
{% ifequal error "not" %}
<script>
alert('New Password and Confirm Password are not match');
</script>
{% endifequal %}

{% endblock %}

Page 75
CHAPTER # 8
Advantages & Limitations

Advantages of “Heart Disease Prediction System”

“Heart Disease Prediction System” provides various features, which


complement the information system and increase the productivity of the system.
These features make the system easily usable and convenient. Some of the important
features included are listed as follows:

 Intelligent User Forms Design


 Data access and manipulation through same forms
 Access to most required information
 Data Security
 Restrictive data access, as per login assigned only.
 Organized and structured storage of facts.
 Strategic Planning made easy.
 No decay of old Records.
 Exact financial position of the Business.
 User can search for doctor’s help at any point of time.
 User can talk about their illness and get instant diagnosis.
 Doctors get more clients online.

Page 76
Limitations of “Heart Disease Prediction System”:

Besides the above achievements and the successful completion of the project, we still
feel the project has some limitations, listed as below:

1. It is not a large scale system.


2. Only limited information provided by this system.
3. Since it is an online project, user’s need internet connection.
4. People who are not familiar with computers can’t use this software.
5. The system is not fully automated; it needs doctors for full diagnosis.

Page 77
CHAPTER # 8
Future Scope

FUTURE SCOPE

This web application involves almost all the basic features of the online heart disease prediction
system. The future implementation will be online help for the patients and chatting with doctors and
website administrator.

CONCLUSION

It has been a great pleasure for me to work on this exciting and challenging project. This project
proved good for me as it provided practical knowledge of not only programming in Python and
Sqlite web based application. It also provides knowledge about the latest technology used in
developing web enabled application and client server technology that will be great demand in
future. This will provide better opportunities and guidance in future in developing projects
independently.

Page 78
Bibliography
BIBLIOGRAPHY

 Wikipedia

 https://www.geeksforgeeks.org/python-django/

 https://www.javatpoint.com

 https://www.python.org/

 https://www.tutorialspoint/

Page 79
 REFERENCE BOOKS

Two scoops of Django for 1.11 by Daniel Greenfeld’s and Audrey Greenfield

Lightweight Django by Elman and Mark Lavin

Page 80

You might also like