HeartDiseasePrediction Report Django
HeartDiseasePrediction Report Django
1) Introduction 7
2) System environment 7
3) Software requirement 8
4) Hardware requirements 8
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 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:
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
Page 9
CHAPTER # 2
Hardware and
Software
Requirements
Contents:
Software requirement
Hardware requirements
Page 10
Software Requirements:
IDE : Pycharm/Atom
Hardware Requirements:
Page 11
CHAPTER # 3
System Analysis
Contents:
Purpose
Project Scope
Existing System
Proposed System
System Overview
Page 12
Purpose:
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.
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
Page 19
Django
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.
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
:Request
:Validate()
:executeQuery()
Administrator Response
Show Result
Success:hide() Failed:show()
Fig.5.4
Page 26
Sequence Diagram For User:-
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.
Function
File/Database
Input/output
Flow
Page 28
DFD (Data Flow Diagram)
Page 29
Entity Relationship Diagrams (ER-Diagrams):
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
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 -->
<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 -->
<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>
</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 %}
</div>
<button type="submit" class="btn submit
mt-4">Send Heart data</button>
</form>
</div>
</div>
</section>
<!-- //register -->
{% endblock %}
</p></center>
</div>
{% if pred != "0" %}
</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 %}
<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>
{% endblock %}
Page 75
CHAPTER # 8
Advantages & Limitations
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:
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
Page 80