0% found this document useful (0 votes)
153 views29 pages

Wa0002.

This document summarizes a training report submitted for a degree in Electronics and Communication Engineering on developing a healthcare chatbot. It describes using a decision tree algorithm to predict diseases based on user-reported symptoms. The document includes sections on surveying existing medical chatbots, objectives of developing a more advanced chatbot, the architectural design, modules used like Tkinter and Pandas, and how the healthcare chatbot works through classifying symptoms with a decision tree model.

Uploaded by

Raman deep
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)
153 views29 pages

Wa0002.

This document summarizes a training report submitted for a degree in Electronics and Communication Engineering on developing a healthcare chatbot. It describes using a decision tree algorithm to predict diseases based on user-reported symptoms. The document includes sections on surveying existing medical chatbots, objectives of developing a more advanced chatbot, the architectural design, modules used like Tkinter and Pandas, and how the healthcare chatbot works through classifying symptoms with a decision tree model.

Uploaded by

Raman deep
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/ 29

TRAINING REPORT

On

HEALTHCARE CHATBOT
Training From: Onlei Technology
Submitted to
MAHARAJA RANJIT SINGH PUNJAB TECHNICAL
UNIVERSITY
in partial fulfillment of the requirement for the award of the degree of

B.TECH
In

ELECTRONICS & COMMUNICATION ENGINEERING


Submitted by
Aditi Sengupta (190390016)

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING

GIANI ZAIL SINGH CAMPUS COLLEGE OF ENGINEERING &


TECHNOLOGY, MRSPTU
DECLARATION
I declare that this written submission represents my ideas in my own words and
where others' ideas or words have not been included, I have adequately cited and
referenced the original sources. I also declare that I have adhered to all principles
of academic honesty and integrity andhave not misrepresented or fabricated or
falsified any idea/data/fact/source in our submission. I understand that any
violation of the above will be cause for disciplinary action by the Institute and can
also evoke penal action from the sources which have thus not been properly cited
or from whom proper permission has not been taken when needed

Aditi Sengupta
ACKNOWLEDGMENT

It is my pleasure to be indebted to various people, who directly or


indirectly contributed to the development of this work and who
influenced my thinking, behaviour, and acts during study.
I express my sincere gratitude to trainers of Onlei Technology for their
support, cooperation, and motivation provided during the period of
project planning and training for constant inspiration, presence, and
blessings.
I am grateful to my department and teachers for extending their help
directly and indirectly through various channels in the project work.
Lastly, I would like to thank the almighty and my family for their moral
support and my friends with whom I shared my day-to-day experience
and received lots of suggestions.

Aditi Sengupta
Table of content :
1. Introduction…………………………………………………………………………………5
1.1 Healthcare Chatbot………………………………………………………….5
1.2 Diseases prediction, Decision tree algorithm……………………6
2. Survey regarding disease diagnosis………………………………………………
6
2.1 Existing system………………………………………………………………..7
2.2 Proposedsystem……………………………………………………………..7
3. Objectives……………………………………………………………………………………8
3.1 Overall algorithm………………………………………………………….…8
4. Architectural design ……………………………………………………………………9
4.1 Architectural requirements……………………………………………10
5. Features…………………………………………………………………………………….11
6. Module used………………………………………………………………………………
11
6.1 Tkinter…………………………………………………………………………..12
6.2 Os………………………………………………………………………………….12
6.3 Web browser…………………………………………………………………13
6.4 Numpy…………………………………………………………………………..13
6.5 Pandas…………………………………………………………………………..14
6.6 Matplotlib……………………………………………………………………..16
7. Working of healthcare chatbot………………………………………………….18
7.1 Procedure of project……………………………………………………..19
7.2 Files used in project……………………………………………………….19
7.3 Required
system…………………………………………………………….20
7.3.1 User login to system………………………………………………..
1 . Introduction
1.1 Healthcare chatbot
Abstract: As the demand in Machine Learning and AI keeps growing,
new technologies will keep coming in the market which will impact our
day-to-day activities, and one such technology is Virtual Assistant Bots
or simply Chatbots. Chatbots have evolved from being Menu/Button
based, to Keywords based and now Contextual based. The most
advanced among all of the above is contextual based because it uses
Machine Learning and Artificial Intelligence techniques to store and
process the training models which help the chatbot to give better and
appropriate response when user asks domain specific questions to the
bot. The idea is to create a medical chatbot that can diagnose the
disease and provide basic details about the disease before consulting a
doctor. This will help to reduce healthcare costs and improve
accessibility to medical knowledge through medical chatbot. The
chatbots are computer programs that use natural language to interact
with users. Our project focuses on providing the users immediate and
accurate prediction of the diseases based on their symptoms. For the
prediction of diseases, we have used Decision tree algorithm. Chatbots
can play a major role in reshaping the healthcare industry by providing
predictive diagnosis.
1.2 Disease Prediction, Decision tree Algorithm
Since the past few decades, humans have been tirelessly working day in
and day out that they fail to prioritize their health on a regular basis. In
the longer run, this problem leads to jeopardizing the quality of life.
Nevertheless, with the aid of Artificial Intelligence, we can now provide
health care services to individuals at their convenience at reasonable
prices. One of the biggest blessings we possess is a healthy body. A
healthy body and enhanced quality of life is something each one of us
looks up to. The primary focus of this paper is to provide these services
to fulfill the above mentioned purpose. It is difficult to imagine our lives
without high tech gadgets because they have become an essential part
of our lives. Therefore the field of Artificial Intelligence is prospering
due to the various applications of it in the research field. Disease
prediction is one of the main goals of the researchers based on the
facts of big data analysis which in turn improves the accuracy of risk
classification based on the data of a large volume. E-healthcare facilities
in general, are a vital resource to developing countries but are often
difficult to establish because of the lack of awareness and development
of infrastructure. A number of internet users depend on the internet
for clearing their healthcare based queries. We have designed a
platform for providing online medical services to patients with a goal to
provide assistance to healthcare professionals. The user can also seek
medical guidance in an easier way and get exposure to various diseases
and diagnosis available for it. In order to make communication more
effective, we have implemented a chatbot for disease prediction.
Chatbots are the human version of software that is based on AI and
uses Natural language processing (NLP) to interpret and accordingly
respond to the user. This study proposes the disease prediction chatbot
using the concepts of NLP and machine learning algorithms. The
prediction is carried out using the Decision tree algorithm.
2.SURVEY REGARDING DISEASE DIAGNOSIS :-
An application of counseling chatbot, which provides conversational
service for mental health care based on emotions recognition methods
and chat assistant platform. This application doesn’t consider the user's
psychiatric status through continuous user monitoring.
In this text-based healthcare chatbots can be designed to effectively
support patients and health professionals in therapeutic settings
beyond on side consultations. It does not have face to face care and
where THCB are likely to fail.
This paper reports a primary care chatbot system created to assist
healthcare staff by automating the patient's intake process. In this
paper they did not include more disease and also a symptom synonym
thesauri also should be produced.
This provides a text-to-text conversational age that asks the user about
their health issue. The user can chat as if chating with a human. The bot
then asks the user a series of questions about their symptoms to
diagnose and gives suggestions about the different symptoms to clarify
the disease. Doesn’t give detailed information No features such as
duration, intensity of symptoms etc
The proposed method is a chatbot based mobile healthcare service that
can immediately respond to the accidents that arise in everyday life
and to the condition changes of chronic-disease patients. Also proposes
a framework for the human-robot interaction that can endure an
efficient implementation of the chatbot service. It is a text based bot
irrespective of having all advanced features.
Conversational agents have many technical, design and linguistic
challenges. They introduced the nature of conversation user
interface(CUI) for health and described UX design. Some technical
limitations like voice message are not accurate, some corruptions are
faced due to the network so the timing of bot remainders is corrupted.
The Bot Transition program provides a framework and resources based
on AAP, AFP and ACP recommendations to promote skill attainment in
self-care. A scripted text messaging platform is feasible and appears to
be well-received by patients and caregivers. It is designed only for
people with special health needs transitioning into adolescents.
The system uses a question and answer protocol in the form of a
chatbot to answer users' queries. The complex questions and answers
present in the database are viewed and answered by an expert. This
chatbot is comparatively time consuming.
This chatbot is an attempt to let users understand the symptoms they
are facing and get a basic diagnosis about the disease they could be
having. Complex interface, time consuming, high installation cost.
A chatbot is an interactive software application to simulate natural user
interactions based on AI modeling. We have proposed a dataset for the
commonly occurring medical conditions together with a prototype
model to provide quick assistance to the patients.It only gives solutions
for the common medical conditions.
Uses both KNN algorithm and decision tree classifier and from that
more accurate one is taken and shows the output. As it uses both
algorithms it is time consuming.
2.1 EXISTING SYSTEM
Many of the existing systems have chats through texts.Some limitations
of such Chatbotsare,there is no instant response given to the patient,
they have to wait for experts acknowledgement for a long time. And
also there are a limited number of diseases in the dataset.Technical
issues like voice messages are not accurate in the existing system .
2.2 PROPOSED SYSTEM
In our system the user can interact with the chatbot through text and
chat bot will interact using voice and text manner. With respect to the
users queries, the bot identifies the disease if user chatting with the
chatbot. According to the diseases of the user, bot gives suggestions for
the disease and also prescribe specialist doctors. This system can be
used by multiple users at a time without any lagging.
3. Objectives
1. To extract symptoms from user chat.
2. To classify and predict the diseases using a decision tree classifier.
3. To develop a healthcare chatbot to predict diseases by symptoms
taken as input.
3.1 Overall Algorithm
1. Insert user query in the chatbot window.
2. The details will be extracted from the user chat.
3. Decision Tree classifier algorithm is used to process the query.
4. The response is fetched from the chatbot like Disease Prediction and
Disease Precaution and output to the user.
5. Exit.
4. Architectural Design

4.1 Architectural requirement


Initially the chatbot ask to enter the name of the user, one major
symptom that they are facing and period of facing that symptom. In the
next step the chatbot ask the specific symptom the user is facing. for
example, type 0 for heavy fever or type 1 for mild fever. Next the bot
will ask some series of symptoms, and user have to answer in "yes" or
"no" manner. Decision Tree is a Supervised learning technique that can
be used for both classification and Regression problems, but mostly it is
preferred for solving Classification problems. It is a tree-structured
classifier where, internal nodes represent the features of a data set
branches represent the decision rules and each leaf node represents
the outcome. In a Decision tree, there are two nodes, which are the
Decision Node and Leaf Node. Decision nodes are used to make any
decision and have multiple branches, whereas Leaf nodes are the
output of those decisions and do not contain any further branches. The
decisions or the test are performed on the basis of features of the given
data set. Algorithm asks set of question to user and accordingly it
arrives at a solution. It predicts the disease and gives necessary
precautions based on it.
5. Features :-
• Register Screen.
• Sign-in Screen.
• Generates database for user login system.
• Offers you a GUI Based Chatbot for patients for diagnosing. [A
pragmatic Approach for Diagnosis]
• Recommends an appropriate doctor to you for the following
symptom.
6. Module Used:-
• Our program uses a number of python modules to work properly:
• tkinter
• os
• webbrowser
• numpy
• pandas
• matplotlib
6.1 tkinter
Tkinter is the standard GUI library for Python. Python when combined
with Tkinter provides a fast and easy way to create GUI applications.
Tkinter provides a powerful object-oriented interface to the Tk GUI
toolkit.
Creating a GUI application using Tkinter is an easy task. All you need to
do is perform the following steps −
Import the Tkinter module.
Create the GUI application main window.
Add one or more of the above-mentioned widgets to the GUI
application.
Enter the main event loop to take action against each event triggered
by the user.

Example:
import Tkinter
top = Tkinter.Tk()
# Code to add widgets will go here...
top. mainloop()

6.2. OS module
The OS module in Python provides functions for interacting with the
operating system. OS comes under Python’s standard utility modules.
This module provides a portable way of using operating system-
dependent functionality. The os and os.path modules include many
functions to interact with the file system.
Handling the Current Working Directory
Consider Current Working Directory(CWD) as a folder, where the
Python is operating. Whenever the files are called only by their name,
Python assumes that it starts in the CWD which means that name-only
reference will be successful only if the file is in the Python’s CWD.
Note: The folder where the Python script is running is known as the
Current Directory. This is not the path where the Python script is
located.
Getting the Current working directory
To get the location of the current working directory os.getcwd() is used

Example:
# Python program to explain os.getcwd() method

# importing os module
import os
# Get the current working
# directory (CWD)
cwd = os.getcwd()
# Print the current working
# directory (CWD)
print("Current working directory:", cwd)

6.3 Webbrowser
In Python, webbrowser module is a convenient web browser controller. It
provides a high-level interface that allows displaying Web-based documents to
users. 
webbrowser can also be used as a CLI tool. It accepts a URL as the argument
with the following optional parameters: -n opens the URL in a new browser
window, if possible, and -t opens the URL in a new browser tab. 

 Python

python -m webbrowser-t "https://www.google.com"

Example:

import webbrowser
webbrowser.open('http://www.python.org')

6.4. NumPy
NumPy is a general-purpose array-processing package. It provides a high-
performance multidimensional array object, and tools for working with these
arrays. It is the fundamental package for scientific computing with Python. It is
open-source software. It contains various features including these important
ones:
 A powerful N-dimensional array object
 Sophisticated (broadcasting) functions
 Tools for integrating C/C++ and Fortran code
 Useful linear algebra, Fourier transform, and random number
capabilities
Besides its obvious scientific uses, NumPy can also be used as an efficient
multi-dimensional container of generic data. Arbitrary data-types can be defined
using Numpy which allows NumPy to seamlessly and speedily integrate with a
wide variety of databases. Installation:
 Mac and Linux users can install NumPy via pip command:
pip install numpy

Example:
# Python program to demonstrate
# basic array characteristics
import numpy as np
# Creating array object
arr = np.array( [[ 1, 2, 3],
[ 4, 2, 5]] )
# Printing type of arr object
print("Array is of type: ", type(arr))
# Printing array dimensions (axes)
print("No. of dimensions: ", arr.ndim)
# Printing shape of array
print("Shape of array: ", arr.shape)
# Printing size (total number of elements) of array
print("Size of array: ", arr.size)
# Printing type of elements in array
print("Array stores elements of type: ", arr.dtype)

6.5 Pandas
Pandas is an open-source library that is made mainly for working with relational
or labeled data both easily and intuitively. It provides various data structures
and operations for manipulating numerical data and time series. This library is
built on top of the NumPy library. Pandas is fast and it has high performance &
productivity for users.

Advantages 

 Fast and efficient for manipulating and analyzing data.

 Data from different file objects can be loaded.

 Easy handling of missing data (represented as NaN) in floating


point as well as non-floating point data

 Size mutability: columns can be inserted and deleted from


and higher dimensional objects

 Data set merging and joining.

 Flexible reshaping and pivoting of data sets

 Provides time-series functionality.

Example
import pandas as pd
import numpy as np

# Creating empty series


ser = pd.Series()
print(ser)

# simple array
data = np.array(['g', 'e', 'e', 'k', 's'])

ser = pd.Series(data)
print(ser)
6.6 Matplotlib
Matplotlib is an amazing visualization library in Python for 2D plots of arrays.
Matplotlib is a multi-platform data visualization library built on NumPy arrays
and designed to work with the broader SciPy stack. It was introduced by John
Hunter in the year 2002.
One of the greatest benefits of visualization is that it allows us visual access to
huge amounts of data in easily digestible visuals. Matplotlib consists of several
plots like line, bar, scatter, histogram etc.
Installation :
Windows, Linux and macOS distributions have matplotlib and most of its
dependencies as wheel packages. Run the following command to
install matplotlib package :
python -mpip install -U matplotlib

Example
# importing matplotlib module
from matplotlib import pyplot as plt

# x-axis values
x = [5, 2, 9, 4, 7]
# Y-axis values
y = [10, 5, 8, 4, 2]

# Function to plot
plt.plot(x,y)

# function to show the plot


plt.show()
7.WORKING OF HEALTHCARE CHATBOT
A chatbot is a piece of software that conducts a conversation with users
via auditory or textual methods. A medical chatbot facilitates the job of
a healthcare provider and helps improve their performance by
interacting with users in a human-like way.

There are countless cases where intelligent medical chatbots could help
physicians, nurses, therapists, patients, or their families. They can step
in and minimize the amount of time they spend on tasks like:

providing health-related information to users


guidance for patient
medication management and dosage
connecting people and organizations with first responders
FAQ-type queries (contact details, directions, opening hours and
service/treatment details)
It’s important to note that despite the fact that chatbots can offer
valuable facts and symptoms, they aren’t qualified to give an official
diagnosis. The main premise behind these talking or texting smart
algorithms is to become the first point of contact before any human
involvement is needed.
7.1 Procedure of the project:
Decision Tree algorithm belongs to the family of supervised learning
algorithms. They can be used to solve both regression and classification
problems. Decision trees use the tree representation to solve the
problem in which each leaf node corresponds to a class label and
attributes are represented on the internal node of the tree.If the value
is less than threshold, then go to the left child node. If the value is more
than threshold, then go to the right child node. Then as we have got the
disease, now we need to append the details of the disease and
necessary precautions need to be taken. If user is having that particular
symptom for more than 13 days then, chatbot will respond as "You
should take the consultation from doctor".If it is less than 13 days then
chat bot will respond as, "It might not be that bad but you should take
precautions". After predicting the disease, the bot will give necessary
precautions that one must take. Decision After predicting the
disease,the bot will give a basic description about the disease, as the
user will get an idea of what disease that user might be facing. Bot will
respond to everything in voice,for that we have used pyttsx3. pyttsx3 is
a text-to-speech conversion library in Python. Unlike alternative
libraries, it works offline and is compatible with both Python 2 and
3.The proposed Chatbot system functions based on a Decision Tree
algorithm. It generates responses for the user queries based on the
following method.
7.2 Files used in the project
• QuestionDiagnosisTkinkter.py
• Testing.csv
• Training.csv
• doctors_dataset.csv
• healthcare_chatbotConsole.py
• newlogin.py
7.3 REQUIRED SYSTEM
Some chatbots are compact medical reference
books which are useful not only for patients, doctors
etc but also for those who want to learn something
about health. The user feels that they are incorporated
in the process of their health. Patients who feel
included, who are interacting through chatbots with
the healthcare system, will stay with the system, and
that is important for them and the healthcare provider.
The old chatbot are client communications systems
and their best effort is a question and answer page on a
website. Bot can facilitate to get the common health
related question and prediction of disease without a
human interference
7.3.1 User Login to System:
User registers on Chatbot application. Then
ask queries regarding to the health care and medical
details.
7.3.2 Disease Prediction:
Depending on the disease symptoms SVM
algorithm can predict the disease.
7.4 Functionality
The system focuses on the messages that the user provides while
initiating the conversation. The idea behind this is to detect the
preliminary symptoms and the problems that the user may be
experiencing. After the Chatbot has collected enough keywords from
the initial messages, it now starts leading the conversation by asking
questions to the user and trying to shortlist few diseases that the user
may be suffering through. After the Chatbot has shortlisted the possible
diseases that the user may have, now it gives a rank to the possible
diseases that the user may be suffering from. When the list of possible
diseases, the Chatbot starts questioning the user about how the user is
feeling. Once it gets ample amount of data it finds the most likely
disease that the user may be suffering through. After the Chatbot has
found the disease that the user is suffering through, it measures the
seriousness of the illness and acts accordingly either by suggesting
remedies and medication to the user or by connecting the user to the
doctor if the measure hits the predetermined threshold value.
8. OUTPUT
User login screen
Username and password
Details of the user login should be entered
Successful login
Click on the start
Diseases should be selected from yes and no option
The symptom regarding the diseases are showed with the name of the
particular diseases in the window and link should be provided of the
doctor which will provide particular treatment for particular diseases.
Which are diagonised by using this healthcare chatbot and can now
book the appointment of the doctor.
The full detail of the doctor are shown with their full contact details.
Conclusion
Medical Chatbot will have a great impact on the life of its users. It
would provide them the advantage of carrying a virtual Doctor in
their pockets. It would also give them the freedom to consult a
doctor 24/7 and also can get a real doctor's advice if needed. This
can be a most popular tool for people with busy schedule as they won't
have to hamper their schedule to consult a doctor for minor health
queries. This would also be a tool with high utility among elderly and
physically disabled people as this can help them get solutions to all
their health related issue at their fingertips. We would bring Doctors
and Medical Professionals to our platform to feed the medical data into
our records and also to chat with our users when required. Having
lots of medical data would make our Chatbot function more efficiently
and accurately. My Chatbot is in a design phase right now. I would
be implementing the whole design into code very soon and I plan to
launch it in the next few months. I am implementing the Chatbot
engine in python and using healthcare chatbot as the CSV files in
pandas platform. I also plan to design and make a device that people
could wear and let it collect their important body readings and health
data. I would make the device using raspberry pi and would make it
compatible with my Chatbot and many others services as well using
APIs. The idea behind comparing my Chatbot with HealthTap was
not to show that my Chatbot was better than HealthTap in anyways,
but to show that it was different from any chatbot present till date.

You might also like