Professional Documents
Culture Documents
SINGLE INTERFACE
A Main project thesis submitted in partial fulfillment of requirements for the award
of degree for VIII semester
BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING
by
M.MONISHA (19131A05C0)
K.SAI HARSHITA (19131A05K9)
K.HARITHA (19131A05A3)
SATYAJIT MISRO (19131A05L3)
i
CERTIFICATE
This is to certify that the main project entitled “Integrating several illness prediction
methods into a single interface” being submitted by
M.MONISHA (19131A05C0)
K.SAI HARSHITA (19131A05K9)
K.HARITHA (19131A05A3)
SATYAJIT MISRO (19131A05L3)
in partial fulfilment for the award of the degree “Bachelor of Technology” in Computer
Science and Engineering to the Jawaharlal Nehru Technological University, Kakinada is
a record of bonafide work done under my guidance and supervision during VIII semester
of the academic year 2022-2023.
The results embodied in this record have not been submitted to any other
university or institution for the award of any Degree or Diploma.
ii
DECLARATION
K. HARITHA (19131A05A3)
SATYAJIT MISRO
(19131A05L3)
iii
ACKNOWLEDGEMENT
We would like to express our deep sense of gratitude to our esteemed institute
Gayatri Vidya Parishad College of Engineering (Autonomous), which has provided
us an opportunity to fulfill our cherished desire.
We express our profound gratitude and our deep indebtedness to our guide
Mr.Ch.SRIKANTH VARMA, whose valuable suggestions, guidance and
comprehensive assessments helped us a lot in realizing our project.
We also thank our coordinator, Dr. CH. SITA KUMARI, Associate Professor,
Department of Computer Science and Engineering, for the kind suggestions and guidance
for the successful completion of our project work.
M.MONISHA (19131A05C0)
K.SAI HARSHITA (19131A05K9)
K.HARITHA (19131A05A3)
SATYAJIT MISRO (19131A05L3)
iv
ABSTRACT
We are all aware of how AI is advancing medical science in the modern world and how it
is proving to be a savior. AI has brought a revolution in the field of medical science and is
going beyond our imagination day by day. AI is transforming the practice of medicine.
It’s helping doctors diagnose patients more accurately, make predictions about patients’
future health, and recommend better treatments.
Disease prediction using Machine learning is the system that is used to predict diseases
from the symptoms which are given by the patients or any user. The system processes the
symptoms provided by the user as input and gives the output as the probability of the
disease occurrence.
From as basic as Diabetes detection or Breast Cancer detection using simple Machine
learning models to as complex as Corona virus detection or Alzheimer detection using
segmentation and other advanced techniques, AI has gone beyond our imaginations.
That’s why we came up with the idea of creating an online platform where we brought
together all these disease detections under one roof. The web application can detect a
variety of diseases. The machine learning algorithm determines whether a person is
suffering from a specific disease after they enter their information and upload their
scanning reports. It displays the result whether he or she is suffering from that disease or
not along with the severity.
For each disease listed above the model employs various machine learning techniques.
v
INDEX
CHAPTER 1. INTRODUCTION.................................................................1
1.1 Objective…...........................................................................1
1.2 About the Algorithm............................................................2
1.3 Purpose…..............................................................................5
1.4 Scope….................................................................................6
CHAPTER 2. SRS DOCUMENT................................................................7
2.1 Functional Requirements..................................................7
2.2 Non-functional Requirements...........................................7
2.3 Minimum Hardware Requirements...................................8
2.4 Minimum Software Requirements....................................8
vi
CHAPTER 5. PROJECT DESCRIPTION..............................................17
5.1 Problem Definition….......................................................17
5.2 Project Overview..............................................................17
5.3 Module Description….....................................................18
5.3.1 Python and Flask Framework…........................18
5.3.2 Model.................................................................19
FUTURE SCOPE...............................................................74
REFERENCE LINKS.......................................................75
vi
1. INTRODUCTION
In most cases, AI uses a system that combines hardware and software. From a
software standpoint, AI is especially focused on algorithms. A theoretical foundation for
using AI is called an artificial neural network (ANN).
Our project's main objective is to integrate various illness prediction models into a
single web interface. It helps patients and other medical experts determine if they have a
certain condition or not. It offers accurate findings and the severity degree based on the
data the user has submitted.
1.1. OBJECTIVE
With traditional patient risk identification techniques, it was found that the number of
different combinations of variables about conditions, lab values, socioeconomic
information, and other data points corresponding to individuals made it very challenging
to identify the relationship among the data points. Machine learning models can address
some of the weaknesses of traditional linear models as they are better at handling
nonlinearity and can better identify implicit relationships among the input variables [1].
Machine learning models can handle feature selection, which is a process that is used to
determine the variables and relationships to be considered while building the model.
1
Hence, machine learning algorithms can be used to identify high-risk patients based on
historical data, assuming a high number of variables and data points.
We have used Python which has an extensive and comprehensive collection of freely
available packages covering a variety of topics. Scientific Python libraries such as
NumPy, SciPy, and pandas provide efficient implementation of numerical operations and
tasks common in science and engineering.
These libraries provide a strong base from which more advanced scientific
software can be built without needing to worry about low-level algorithms. Additionally,
many domain specific packages exist which address the scientific needs of the
meteorological community. Convolutional neural networks and other cutting-edge
machine learning techniques were also employed to categorize different disorders.
CNN stands for Convolutional Neural Network. It is a type of neural network that is
commonly used for image and video analysis but can also be used for other types of data
such as audio signals or natural language processing.
A typical Convolutional Neural Network (CNN) consists of several layers. The most
common layers in a CNN are:
These layers are typically stacked one on top of the other to form a deep neural network.
The output of the last layer is then fed into a loss function, which measures how well the
network is performing on the given task. The goal of training the network is to minimize
the loss function by adjusting the weights of the network.
CNNs have been used for a variety of applications, such as object recognition, facial
recognition, image and video classification, and medical image analysis. They have
shown excellent performance in these tasks, often outperforming other types of machine
learning algorithms.
3
1.2.2. Random Forest
Random Forest is a type of ensemble learning algorithm used in machine learning for
classification and regression tasks [2]. It is based on the concept of decision trees and
uses a combination of multiple decision trees to make predictions.
1. Random subsets of the training data are selected, and a decision tree is built on each
subset.
2. Each decision tree is built by recursively splitting the data based on the best split that
maximizes the information gain. The split is chosen based on a randomly selected subset
of features.
3. The process of building the decision tree continues until a stopping criterion is reached,
such as the maximum depth of the tree or the minimum number of samples required to
make a split.
4. The output of each decision tree is a prediction, which is either a class label in the case
of classification or a continuous value in the case of regression.
5. To make a prediction, the Random Forest combines the predictions from all the
decision trees by taking the mode of the class labels in the case of classification or the
mean of the continuous values in the case of regression.
6. The final prediction is based on the combined predictions of all the decision trees in the
Random Forest.
4
1.3. PURPOSE
The purpose of a disease prediction project that targets diseases is to develop accurate
and reliable machine learning models that can predict the likelihood of an individual
developing one of the target diseases. The purpose of a disease prediction project is to
leverage the power of machine learning to improve disease prevention and detection.
By leveraging large datasets of medical records, genetic data, and other relevant
information, the project aims to identify risk factors and develop models that can predict
disease risk with high accuracy. The developed models can be integrated into clinical
practice or electronic health record systems to provide healthcare providers with disease
risk predictions, helping them make more informed decisions about patient care and
disease prevention.
1) Pneumonia - Infection that inflames air sacs in one or both lungs, which may fill with
fluid.
3) Diabetes - Diabetes is a chronic disease that occurs either when the pancreas does not
produce enough insulin or when the body cannot effectively use the insulin it produces
[3].
4) Breast cancer - It is a type of cancer that develops in the breast tissue. It is the most
common cancer among women worldwide. Breast cancer usually begins as a small lump
in the breast that can be detected through a breast exam or mammography
5
1.4. SCOPE
The scope of this project can be quite broad, depending on the specific goals and
objectives of the project. However, in general the project aims to improve health
outcomes [12]. With the increasing availability of health data, the project focuses on
using machine learning to identify patterns and trends in health outcomes and to develop
more targeted interventions.
The scope of a disease prediction project can vary depending on the specific diseases
being targeted and the goals of the project. Here are some potential areas of focus for a
disease prediction project that targets seven diseases:
1. Data collection: Collecting and curating large datasets of medical records, genetic
data, and other relevant information for patients with the seven target diseases.
2. Feature engineering: Identifying and selecting the most informative features from
the collected data to build accurate disease prediction models.
3. Model development: Developing machine learning models, such as logistic
regression or random forest, that can accurately predict the likelihood of an
individual developing one of the seven target diseases.
4. Model evaluation and validation: Evaluating the performance of the developed
models and validating their accuracy using independent test datasets.
5. User interface development: Developing an easy-to-use interface for clinicians or
individuals to input patient data and receive disease risk predictions.
6. Deployment and integration: Deploying the developed models into clinical
practice or integrating them into electronic health record systems to provide
disease risk.
6
2. SRS DOCUMENT
• Maintains all the records of the patients and doctors and can be accessed
through a same command prompt.
• This bot would also save the time as searching digitalized records is quicker
than manually, though there exist some digitalized records they are separate
from one another
7
• Efficiency - Once user has learned about the system through his interaction,
he can perform the task easily.
• Understandability-Because of user friendly interfaces, it is more
understandable to the users.
Python based Computer Vision and Deep Learning libraries will be exploited for
the development and experimentation of the project.
8
3. ANALYSIS
• Even a novice user will be able to comprehend how to use the interface, making it
user-friendly.
While there are numerous online platforms for identifying different diseases
separately, we have developed a platform where we have combined different sickness
prediction methodologies into a single interface as part of our research. By merely
supplying the necessary test information, it enables the user to anticipate numerous
diseases with simplicity.
We came up with the idea of creating an online platform where we brought together all
these disease detections under one roof. The web application can detect a variety of
diseases. The machine learning algorithm determines whether a person is suffering from
a specific disease after they enter their information and upload their scanning reports. It
displays the result whether he or she is suffering from that disease or not along with the
severity.
9
For training the model to identify various diseases, we employ various machine learning
algorithms. They are: -
• Pneumonia - (CNN)
• Alzheimer- (CNN)
• Covid- (CNN)
It is very time-saving
Automatic medical reports generation
Accurate results
Degree of severity
User- friendly graphical interface
Highly reliable
Cost effective
10
3.3 FEASIBILITY STUDY
A feasibility study is an analysis that takes all a project's relevant factors into
account including economic, technical, legal, and scheduling considerations
to ascertain the likelihood of completing the project successfully. A
feasibility study is important and essential to evolute any proposed project is
feasible or not. A feasibility study is simply an assessment of the practicality
of a proposed plan or project.
• What are the alternatives among which a solution will be chosen (During
subsequent phases)
• To analyze if the software meets organizational requirements. There are
various types of feasibility that can be determined. They are:
Operational - Define the urgency of the problem and the acceptability of any
solution, includes people-oriented and social issues: internal issues, such as
manpower problems, labor objections, manager resistance, organizational conflicts,
and policies; also, external issues, including social acceptability, legal aspects, and
government regulations.
Technical: Is the feasibility within the limits of current technology? Does the
technology exist at all? Is it available within a given resource?
11
Economic - Is the project possible, given resource constraints? Are the benefits that
will accrue from the new system worth the costs? What are the savings that will
result from the system, including tangible and intangible ones? What are the
development and operational costs?
13
3.4. COST BENEFIT ANALYSIS
The financial and the economic questions during the preliminary investigation are
verified to estimate the following:
• The cost of the hardware and software for the class of application being
considered.
• The benefits in the form of reduced cost.
• The proposed system will give the minute information, as a result.
• Performance is improved which in turn may be expected to provide
increased profits.
• This feasibility checks whether the system can be developed with the
available funds.
• This can be done economically if planned judicially, so it is economically
feasible.
• The cost of the project depends upon the number of man-hours required.
14
4. SOFTWARE DESCRIPTION
4.2. Flask
Flask is a web framework, it’s a Python module that lets you develop web applications
easily. It has a small and easy-to-extend core: it’s a microframework that doesn’t include
an ORM (Object Relational Manager) or such features. It does have many cool features
like URL routing and template engine [9]. It is a WSGI web app framework. To install
flask on the system, we need to have python 2.7 or higher installed on our system. It is
designed to keep the core of the application simple and scalable. Instead of an abstraction
layer for database support, Flask supports extensions to add such capabilities to the
application.
4.3. Python
15
4.4. HTML/CSS
The Hypertext Markup Language or HTML is the standard markup language for
documents designed to be displayed in a web browser. It is often assisted by technologies
such as Cascading Style Sheets (CSS) and scripting languages such as JavaScript. HTML
elements are the building blocks of HTML pages. With HTML constructs, images and
other objects such as interactive forms may be embedded into the rendered page. HTML
can embed programs written in a scripting language such as JavaScript, which affects the
behavior and content of web pages. The inclusion of CSS defines the look and layout of
content. CSS is designed to enable the separation of content and presentation, including
layout, colors, and fonts. This separation can improve content accessibility; provide more
flexibility and control in the specification of presentation characteristics; enable multiple
web pages to share formatting by specifying the relevant CSS in a separate .css file,
which reduces complexity and repetition in the structural content.
4.5. TensorFlow
TensorFlow is a free and open-source software library for machine learning and artificial
intelligence. It can be used across a range of tasks but has a particular focus on training
and inference of deep neural networks [10]. TensorFlow was developed by the Google
Brain team for internal Google use in research and production. The initial version was
released under the Apache License 2.0 in 2015.Google released the updated version of
TensorFlow, named TensorFlow 2.0, in September 2019.TensorFlow can be used in a
wide variety of programming languages, including Python, JavaScript, C++, and Java.
4.6. Matplotlib
We used CNN and Random Forest algorithms for different disease predictions. The main
objective is to develop a reliable system for disease prediction with accurate results.
Our project's primary goal is to assist users in determining whether or not they have a
specific disease based on the information provided by the users.
1. Collection of datasets.
2. Data split for training and testing.
3. Training the model.
4. Repeating steps 2 and 3 for different ratios of Training and testing data to
maximize the accuracy.
5. Webpage creation
17
6. Linking both Machine Learning model and Webpage.
7. Displaying results
The output of our project consists of Name of the person, age, and final result whether he
is suffering from particular disease or not, along with the degree of severity.
Flask is a web framework, it’s a Python module that lets you develop web
applications easily. It has a small and easy-to-extend core: it’s a microframework that
doesn’t include an ORM (Object Relational Manager) or such features. It does have many
cool features like URL routing and template engine. It is a WSGI web app framework. To
install flask on the system, we need to have python 2.7 or higher installed on our system.
It is designed to keep the core of the application simple and scalable. Instead of an
abstraction layer for database support, Flask supports extensions to add such capabilities
to the application.
18
5.3.2. MODEL
FIG 5.1 The layers of a CNN have neurons arranged in 3 dimensions: width,
height and depth
19
ReLU layer
ReLU means Rectified Linear Unit, ReLU is the most used activation function in
the world right now. Since, it is used in almost all the convolutional neural networks
or deep learning. As you can see, the ReLU is half rectified (from bottom). f(z) is
zero when z is less than zero and f(z) is equal to z when z is above or equal to zero.
Range: max (0, z)
But the issue is that all the negative values become zero immediately which decreases
the ability of the model to fit or train from the data properly. That means any negative
input given to the ReLU activation function turns the value into zero immediately in the
graph, which in turns affects the resulting graph by not mapping the negative values
appropriately.
20
Random Forest
Random Forest is one of the most popular and commonly used algorithms by Data
Scientists. Random forest is a Supervised Machine Learning Algorithm that is used
widely in Classification and Regression problems. It builds decision trees on
different samples and takes their majority vote for classification and average in case
of regression. One of the most important features of the Random Forest Algorithm
is that it can handle the data set containing continuous variables, as in the case of
regression, and categorical variables, as in the case of classification [7]. It performs
better for classification and regression tasks.
1. Bagging– It creates a different training subset from sample training data with
replacement the final output is based on majority voting. For example, Random Forest.
21
Important Features of Random Forest
Diversity: Not all attributes/variables/features are considered while making an
individual tree; each tree is different [7].
Immune to the curse of dimensionality: Since each tree does not consider all the
features, the feature space is reduced.
Parallelization: Each tree is created independently out of different data and
attributes. This means we can fully use the CPU to build random forests.
Train-Test split: In a random forest, we don’t have to segregate the data for train
and test as there will always be 30% of the data which is not seen by the decision
tree.
22
The implementation consists of following modules: -
The user is first redirected to the homepage of our website, where they can choose to
evaluate any of the listed diseases. They are- Pneumonia, Covid, Alzheimer’s, Breast
Cancer, and Diabetes-
When a user submits a chest x-ray for covid or pneumonia, a machine learning
model analyses the image and determines whether the patient has the disease or
not. It also determines the severity of the condition, such as mild, moderate, or
high.
A brain MRI is given as input to the machine learning model in the case of
Alzheimer's. The model analyses the image and determines whether or not the
patient has the disease or not. It also determines the severity of the condition, such
as mild demented, moderate demented, non demented and very demented.
In the case of diabetes, the user provides the machine learning model with input
data on glucose, insulin, age, the number of pregnancies, blood pressure, skin
thickness, BMI, and the Diabetes Pedigree function. The model forecasts whether
a person has the disease or not based on these variables.
In the case of Breast Cancer, the user provides the machine learning model with
input data on concave points mean, area mean, radius mean, perimeter mean,
concavity mean. The model forecasts whether a person has the disease or not
based on these variables.
23
FLOWCHART
24
6. SYSTEM DESIGN
• A lot of time is saved down the line when teams can visualize processes,
user interactions and static structure of the system.
UML is linked with object-oriented design and analysis. UML makes the
use of elements and forms associations between them to form diagrams. Diagrams
in UML can be broadly classified as:
25
Diagrams and Deployment Diagrams.
26
• Behaviour Diagrams – Capture dynamic aspects or behaviour of the system.
Behaviour diagrams include Use Case Diagrams, State Diagrams, Activity
Diagrams and Interaction Diagrams.
Building Blocks of the UML Building Blocks of the UML Building Blocks of the
UML
• Things
• Relationships
• Diagrams
Things are the abstractions that are first-class citizens in a model; relationships tie
these things together; diagrams group interesting collections of things.
27
Things in the UML
• Structural things
• Behavioural things
• Grouping things
• Annotational things
These things are the basic object-oriented building blocks of the UML. You use
them to write well-formed models.
Structural Things
Structural things are the nouns of UML models. These are the mostly static
parts of a model, representing elements that are either conceptual or physical.
Collectively, the structural things are called classifiers.
Class - A Class is a set of identical things that outlines the functionality and
properties of an object. It also represents the abstract class whose functionalities are
not defined. Its notation is as follows
28
Collaboration - A larger pattern of behaviors and actions. Example: All classes
and behaviors that create the modeling of a moving tank in a simulation.
Use Case - A sequence of actions that a system performs that yields an observable
result. Used to structure behavior in a model. Is realized by collaboration.
Node - A physical element existing at run time and represents are source.
29
Behavioral Things
Behavioral things are the dynamic parts of UML models. These are the verbs of a
model, representing behavior over time and space. In all, there are three primary
kinds of behavioral things
• Interaction
• State machine
Interaction
State machine
21
0
Grouping Things
Package − Package is the only one grouping thing available for gathering structural
and behavioural things.
Annotational Things
Annotational things are the explanatory parts of UML models. These are the
comments you may apply to describe, illuminate, and remark about any element in
a model. There is one primary kind of annotational thing, called a note. A note is
simply a symbol for rendering constraints and comments attached to an element or
a collection of elements.
• Dependency
• Association
• Generalization
• Realization
30
Dependency
It is an element (the independent one) that may affect the semantics of the other
element (the dependent one). Graphically, a dependency is rendered as a dashed
line, possibly directed, and occasionally including a label.
Association
Association is basically a set of links that connects the elements of a UML
model. It also describes how many objects are taking part in that relationship.
Generalization
It is a specialization/generalization relationship in which the specialized
element (the child) builds on the specification of the generalized element (the
parent). The child shares the structure and the behavior of the parent. Graphically, a
generalization relationship is rendered as a solid line with a hollow arrowhead
pointing to the parent.
Realization
Realization can be defined as a relationship in which two elements are
connected. One element describes some responsibility, which is not implemented
and the other one implements them. This relationship exists in case of interfaces.
31
6.3 UML DIAGRAMS
• Class diagram
• Object diagram
• Component diagram
• Composite structure diagram
• Use case diagram
• Sequence diagram
• Communication diagram
• State diagram
• Activity diagram
32
Fig 6.3 Sequence Diagram
33
7. DEVELOPMENT
7.1. RAW
DATA Pneumonia
Dataset
Covid Dataset
34
Alzheimer’s dataset
Fig 7.4 Lab results of various patients for detecting breast cancer
35
Diabetes dataset
36
7.2. SAMPLE CODE
app.py
import urllib.request
import os
import cv2
import pickle
import imutils
import sklearn
import joblib
import numpy as np
covid_model = load_model('models/covid.h5')
braintumor_model = load_model('models/braintumor.h5')
alzheimer_model = load_model('models/alzheimer_model.h5')
37
pneumonia_model = load_model('models/pneumonia_model.h5')
breastcancer_model = joblib.load('models/cancer_model.pkl')
# Configuring Flask
UPLOAD_FOLDER = 'static/uploads'
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
app.config['UPLOAD_FOLDER'] =
UPLOAD_FOLDER
def allowed_file(filename):
"""
"""
set_new = []
img = cv2.resize(img,dsize=img_size,interpolation=cv2.INTER_CUBIC)
set_new.append(preprocess_input(img))
return np.array(set_new)
38
"""
39
Finds the extreme points on the image and crops the rectangular out of them
"""
set_new = []
gray = cv2.cvtColor(img,
cv2.COLOR_RGB2GRAY) gray =
cnts = cv2.findContours(
cnts = imutils.grab_contours(cnts)
c = max(cnts, key=cv2.contourArea)
ADD_PIXELS = add_pixels_value
31
0
new_img = img[extTop[1]-ADD_PIXELS:extBot[1]+ADD_PIXELS,
31
1
extLeft[0]-ADD_PIXELS:extRight[0]+ADD_PIXELS].copy()
set_new.append(new_img)
return np.array(set_new)
@app.route('/')
def home():
return render_template('homepage.html')
@app.route('/covid')
def covid():
return render_template('covid.html')
@app.route('/breastcancer')
def breast_cancer():
return render_template('breastcancer.html')
@app.route('/braintumor')
def brain_tumor():
return render_template('braintumor.html')
@app.route('/diabetes')
def diabetes():
return render_template('diabetes.html')
@app.route('/alzheimer')
def alzheimer():
return render_template('alzheimer.html')
40
@app.route('/pneumonia')
def pneumonia():
return render_template('pneumonia.html')
@app.route('/heartdisease')
def heartdisease():
return render_template('heartdisease.html')
@app.route('/resultc', methods=['POST'])
def resultc():
if request.method == 'POST':
firstname = request.form['firstname']
lastname = request.form['lastname']
email = request.form['email']
phone = request.form['phone']
gender = request.form['gender']
age = request.form['age']
file = request.files['file']
filename = secure_filename(file.filename)
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
img = cv2.imread('static/uploads/'+filename)
41
img = img/255.0
pred = covid_model.predict(img)
pred = 0
else:
pred = 1
else:
return redirect(request.url)
@app.route('/resultbt', methods=['POST'])
def resultbt():
if request.method == 'POST':
firstname = request.form['firstname']
lastname = request.form['lastname']
email = request.form['email']
phone = request.form['phone']
gender = request.form['gender']
age = request.form['age']
file = request.files['file']
42
if file and allowed_file(file.filename):
filename = secure_filename(file.filename)
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
img = cv2.imread('static/uploads/'+filename)
img = crop_imgs([img])
img = img.reshape(img.shape[1:])
pred = braintumor_model.predict(img)
pred = 0
else:
pred = 1
else:
return redirect(request.url)
@app.route('/resultd', methods=['POST'])
def resultd():
if request.method == 'POST':
43
firstname = request.form['firstname']
lastname = request.form['lastname']
email = request.form['email']
phone = request.form['phone']
gender = request.form['gender']
pregnancies = request.form['pregnancies']
glucose = request.form['glucose']
bloodpressure = request.form['bloodpressure']
insulin = request.form['insulin']
bmi = request.form['bmi']
diabetespedigree = request.form['diabetespedigree']
age = request.form['age']
skinthickness = request.form['skin']
pred = diabetes_model.predict(
@app.route('/resultbc', methods=['POST'])
def resultbc():
if request.method == 'POST':
44
firstname = request.form['firstname']
lastname = request.form['lastname']
email = request.form['email']
phone = request.form['phone']
gender = request.form['gender']
age = request.form['age']
cpm = request.form['concave_points_mean']
am = request.form['area_mean']
rm = request.form['radius_mean']
pm = request.form['perimeter_mean']
cm = request.form['concavity_mean']
pred = breastcancer_model.predict(
def resulta():
if request.method == 'POST':
print(request.url)
firstname = request.form['firstname']
lastname = request.form['lastname']
45
email = request.form['email']
phone = request.form['phone']
gender = request.form['gender']
age = request.form['age']
file = request.files['file']
filename = secure_filename(file.filename)
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
img = cv2.imread('static/uploads/'+filename)
img = img/255.0
pred = alzheimer_model.predict(img)
pred = pred[0].argmax()
print(pred)
else:
46
return redirect('/')
@app.route('/resultp', methods=['POST'])
def resultp():
if request.method == 'POST':
firstname = request.form['firstname']
lastname = request.form['lastname']
email = request.form['email']
phone = request.form['phone']
gender = request.form['gender']
age = request.form['age']
file = request.files['file']
filename = secure_filename(file.filename)
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
img = cv2.imread('static/uploads/'+filename)
img = img/255.0
pred = pneumonia_model.predict(img)
47
pred = 0
else:
pred = 1
else:
return redirect(request.url)
@app.route('/resulth', methods=['POST'])
def resulth():
if request.method == 'POST':
firstname = request.form['firstname']
lastname = request.form['lastname']
email = request.form['email']
phone = request.form['phone']
gender = request.form['gender']
nmv = float(request.form['nmv'])
tcp = float(request.form['tcp'])
eia = float(request.form['eia'])
thal = float(request.form['thal'])
48
op = float(request.form['op'])
mhra = float(request.form['mhra'])
age = float(request.form['age'])
endpoints. @app.after_request
def add_header(response):
"""
"""
response.headers['X-UA-Compatible'] = 'IE=Edge,chrome=1'
return response
app.run(debug=True)
49
homepage.html
<!doctype html>
<html lang="en">
<style>
.headstyle {
caps;
margin-bottom: 0px
.divstyle {
margin-right: 1px
</style>
<head>
<meta charset="utf-8">
50
<!-- Bootstrap CSS -->
50
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384
eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
crossorigin="anonymous">
<title>AdvaCare</title>
</head>
<body>
<div class="container-fluid">
data-bs-target="#navbarSupportedContent" aria-
controls="navbarSupportedContent" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<li class="nav-item">
</li>
<li class="nav-item">
51
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
<li class="nav-item">
</li>
</ul>
</div>
</div>
</nav>
style="font-variant: petite-caps;margin-bottom:0px">
</h1>
52
person is
53
suffering from a specific disease or not. It is an all in one medical solution which brings
5 Disease Detections like Covid Detection, Breast Cancer Detection, Alzheimer
Detection, Diabetes Detection and Pneumonia Detection under one platform.</p>
</h2>
</div>
<a href="./breastcancer"><img
d-block"></a>
</div>
55
<a href="./alzheimer"><img
auto d-block"></a>
</div>
</div>
</div>
</div>
<a href="./pneumonia"><img
auto d-block"></a>
</div>
</div>
</div>
56
</div>
57
<h3 class='text-center py-3'
<b><i>AI in HealthCare</i></b>
</h3>
style='margin-bottom: 30px;'>
<div class="col">
</div>
<div class="col">
</div>
</div>
58
<h3 class='text-center py-3'
<b><i>Machine Learning</i></b>
</h3>
<div class="col">
</div>
<div class="col">
</div>
</div>
59
<h3 class='text-center py-3'
</h3>
<div class="col">
</div>
<div class="col">
alt="...">
</div>
</div>
</div>
51
0
<footer class='text-light bg-dark position-relative '>
Made by Team - 47
</p>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-
beta3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-
JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9E
kf"
crossorigin="anonymous"></script>
</body>
</html>
51
1
7.3. RESULTS
INITIAL WEBPAGE
Fig 7.6 The homepage of our website contains following listed diseases. They are-
Pneumonia, Covid, Alzheimer’s, Breast Cancer, and Diabetes.
51
2
Covid Detection
Fig 7.7 The user provides following input values- First name, Last name, Phone number,
Email, Gender, Age, and also upload their chest scan.
Fig 7.8 The model analyzes the image and displays the result accordingly. In the
above case the model displays the result as positive.
60
Fig 7.9 The user provides following input values- First name, Last name, Phone number,
Email, Gender, Age, and also upload their chest scan.
Fig 7.10 The model analyzes the image and displays the result accordingly. In the
above case the model displays the result as negative.
61
Breast Cancer detection
Fig 7.11 The user provides following input values- First name, Last name, Phone
number, Email, Gender, Age, concave points mean, area mean, radius mean, perimeter
mean, concavity mean.
Fig 7.12 The model analyzes the values and displays the result accordingly. In the
above case the model displays the result as malignant (high in effect).
62
Fig 7.13 The user provides following input values- First name, Last name, Phone
number, Email, Gender, Age, concave points mean, area mean, radius mean,
perimeter mean, concavity mean.
Fig 7.14 The model analyzes the values and displays the result accordingly. In the
above case the model displays the result as benign (no effect).
63
Alzheimer’s detection
Fig 7.15 The user provides following input values- First name, Last name, Phone
number, Email, Gender, Age, and also upload their MRI scan.
Fig 7.16 The model analyzes the image and displays the result accordingly. In the
above case the model displays the result as Nondemented (no effect).
64
Diabetes detection
Fig 7.17 The user provides following input values- First name, Last name, Phone
number, Email, Gender, Age, number of pregnancies, glucose, blood pressure,
skin thickness, insulin, BMI, diabetes pedigree.
Fig 7.18 The model analyzes the values and displays the result accordingly. In the
above case the model displays the result as positive.
65
Fig 7.19 The user provides following input values- First name, Last name, Phone
number, Email, Gender, Age, number of pregnancies, glucose, blood pressure,
skin thickness, insulin, BMI, diabetes pedigree.
Fig 7.20 The model analyzes the values and displays the result accordingly. In the
above case the model displays the result as negative.
66
Pneumonia detection
Fig 7.21 The user provides following input values- First name, Last name, Phone
number, Email, Gender, Age, and also upload their chest scan.
Fig 7.22 The model analyzes the image and displays the result accordingly. In the
above case the model displays the result as positive.
67
Fig 7.23 The user provides following input values- First name, Last name, Phone
number, Email, Gender, Age, and also upload their chest scan.
Fig 7.24 The model analyzes the image and displays the result accordingly. In the
above case the model displays the result as negative.
68
8. TESTING
Importance of Testing
The importance of software testing is imperative. A lot of times this process is
skipped, therefore, the product and business might suffer. To understand the importance
of testing, here are some key points to explain
Testing is of different ways The main idea behind the testing is to reduce the errors and
do it with a minimum time and effort.
Benefits of Testing
• Cost-Effective: It is one of the important advantages of software testing. Testing
any IT project on time helps you to save your money for the long term. In case if the bugs
caught in the earlier stage of software testing, it costs less to fix.
• Security: It is the most vulnerable and sensitive benefit of software testing. People
are looking for trusted products. It helps in removing risks and problems earlier.
69
• Customer Satisfaction: The main aim of any product is to give satisfaction to their
customers. UI/UX Testing ensures the best user experience.
Integration Testing: Integration tests verify that different modules or services used by
your application work well together. For example, it can be testing the interaction with
the database or making sure that microservices work together as expected. These types
of tests are more expensive to run as they require multiple parts of the application to be
up and running.
There is sometimes a confusion between integration tests and functional tests as they
both require multiple components to interact with each other. The difference is that an
integration test may simply verify that you can query the database while a functional test
would expect to get a specific value from the database as defined by the product
requirements.
Regression Testing: Regression testing is a crucial stage for the product & very useful
for the developers to identify the stability of the product with the changing requirements.
Regression testing is a testing that is done to verify that a code change in the software
does not impact the existing functionality of the product.
70
System Testing: System testing of software or hardware is testing conducted on a
complete integrated system to evaluate the system’s compliance with its specified
requirements. System testing is a series of different tests whose primary purpose is to
fully exercise the computer-based system.
Performance Testing: It checks the speed, response time, reliability, resource usage,
scalability of a software program under their expected workload. The purpose of
Performance Testing is not to find functional defects but to eliminate performance
bottlenecks in the software or device.
Alpha Testing: This is a form of internal acceptance testing performed mainly by the in-
house software QA and testing teams. Alpha testing is the last testing done by the test
teams at the development site after the acceptance testing and before releasing the
software for the beta test. It can also be done by the potential users or customers of the
application. But still, this is a form of in-house acceptance testing.
Beta Testing: This is a testing stage followed by the internal full alpha test cycle. This is
the final testing phase where the companies release the software to a few external user
groups outside the company test teams or employees. This initial software version is
known as the beta version. Most companies gather user feedback in this release.
71
Fig 8.1.1 Blackbox Testing
This method is named so because the software program, in the eyes of the tester, is like a
black box; inside which one cannot see. This method attempts to find errors in the
following categories:
White Box Testing: White box testing (also known as Clear Box Testing, Open Box
Testing, Glass Box Testing, Transparent Box Testing, Code-Based Testing or Structural
Testing) is a software testing method in which the internal
structure/design/implementation of the item being tested is known to the tester. The
tester chooses inputs to exercise paths through the code and determines the appropriate
outputs. Programming know-how and the implementation knowledge is essential. White
box testing is testing beyond the user interface and into the nitty-gritty of a system. This
method is named so because the software program, in the eyes of the tester, is like a
white/transparent box; inside which one clearly sees.
72
9. CONCLUSION
There are situations when you require a doctor's assistance right away but they are not
available for any reason. In our project, we have created a disease prediction system that
allows patients to test for any of the listed disorders.
Both benefits and drawbacks exist with this system. In order for the system to determine
whether a particular patient has a particular disease or not, it still requires certain test
results and patient scans to be provided as input to the model. Therefore, it enables users
to determine whether they have a specific condition or not and take preventative actions
as necessary.
The main challenge that we faced while working on this project was the availability of
data (mainly image data). As we know that data is a big issue in machine learning/deep
learning and that's why we had to go on with the amount of data we had.
73
10. FUTURE SCOPE
Depending on the precise goals and objectives of the project, the scope of this work can
seem quite vast. Yet, the project's overarching goal is to enhance health outcomes. The
project focuses on applying machine learning to discover patterns and trends in health
outcomes and to design more focused interventions as a result of the growing
accessibility of health data.
A disease prediction project's objectives and target diseases will determine the project's
precise scope.
As time goes on, we will have access to an increasing amount of data, and we will work
to improve the accuracy of our models by training them on a larger volume of data.
Also, we'll be introducing more diseases that can be identified using X-ray scans or
simply by entering a few numbers.
We also have plans to add other functionality, such as the ability for our app to display
warnings and self-cure instructions for users who test positive. The records of the
detection will also be kept.
Therefore, these are some upcoming upgrades or enhancements that we intend to make.
74
11. REFERENCE LINKS
1. https://towardsdatascience.com/training-a-random-forest-to-identify-malignant-breast-
cancer-tumors-49e8a69fc964
2.https://www.sciencedirect.com/science/article/pii/S187705092300025X#:~:text=The%
20Random%20Forest%20algorithm%20outperforms,of%20multiple%20feature%20selec
tion%20methods.
3.https://datascience.stackexchange.com/questions/55556/how-to-calculate-pedigree-
function-in-diabetes-prediction
4.https://www.analyticsvidhya.com/blog/2020/09/pneumonia-detection-using-cnn-with-
implementation-in-python/
5.https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8614951/
6.https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8083897/
7.https://www.upgrad.com/blog/basic-cnn
architecture/#:~:text=other%20advanced%20tasks.-
,What%20is%20the%20architecture%20of%20CNN%3F,the%20main%20responsibility
%20for%20computation.
8.https://www.analyticsvidhya.com/blog/2021/06/understanding-random-forest/
9.https://www.javatpoint.com/flask-tutorial
10.https://en.wikipedia.org/wiki/TensorFlow
11. https://matplotlib.org/
12.https://www.google.com/search?q=random+forest+algorithm&rlz=1C1UEAD_enIN9
89IN989&sxsrf=APwXEdeVp5Fpz0VQs4GL7fvyDc3YzgXt_Q:1680201532651&sourc
e=lnms&tbm=isch&sa=X&ved=2ahUKEwjbwYS8poT-
AhU7nmMGHSeHAfUQ_AUoAXoECAEQAw&biw=1366&bih=649&dpr=1#imgrc=to
Kd_5-L6dtcLM
75