0% found this document useful (0 votes)
33 views68 pages

Hemanth Project Documentation

The document is a full semester internship report by Reddy Hemanth on Python Programming, submitted for the Bachelor of Technology degree in Electronics and Communication Engineering. It details the internship experience at Deeksha Educational Society, focusing on the development of a Smart Healthcare System that utilizes machine learning for disease prediction based on user-input symptoms. The report includes acknowledgements, company profile, methodology, results, and future enhancements related to the project.

Uploaded by

vishnubhattaram
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)
33 views68 pages

Hemanth Project Documentation

The document is a full semester internship report by Reddy Hemanth on Python Programming, submitted for the Bachelor of Technology degree in Electronics and Communication Engineering. It details the internship experience at Deeksha Educational Society, focusing on the development of a Smart Healthcare System that utilizes machine learning for disease prediction based on user-input symptoms. The report includes acknowledgements, company profile, methodology, results, and future enhancements related to the project.

Uploaded by

vishnubhattaram
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

DEEKSHA EDUCATIONAL SOCIETY

A Full Semester Internship report on


PYTHON PROGRAMMING
Submitted in a partial fulfillment for the award of the degree
BACHELOR OF TECHNOLOGY

IN
ELECTRONICS AND COMMUNICATION ENGINEERING
Submitted
by
REDDY HEMANTH
(202H1A04A8)
Under the esteemed Guidance of
Dr . P. SREE LAKSHMI, Ph.D
Associate professor,
Dept. of ECE

DEPARTMENT OF
ELECTRONICS AND COMMUNICATION ENGINEERING

[Link]
2023-2024
(AUTONOMOUS)

Department of Electronics and Communication Engineering

CERTIFICATE

This is to certify that the Full Semester Internship report on entitled


“ PYTHON PROGRAMMING ” is the bonafide work done by the student
REDDY HEMANTH , REG NO : 202H1A04A8, in partial fulfillment of the
requirements for the award of the degree of Bachelor of Technology in Electronics
and Communication Engineering, from Jawaharlal Nehru Technological
University Anantapur, Anantapuramu, during the year 2023-2024.

Internship Guide Head of the Department


Dr . P. Sree Lakshmi,Ph.D [Link],[Link].,(Ph.D.)
Associate Professor, Associate Professor & HOD,
Department of ECE Department of ECE,
ASIT, GUDUR – TIRUPATI (DT). ASIT, GUDUR – TIRUPATI (DT).

Submitted for the viva-voce Examination held on: ______________

Internal Examiner External Examiner


DECLARATION

I, REDDY HEMANTH , REG NO: 202H1A04A8, hereby declare that the


Project Work entitled “PYTHON PROGRAMMING” done by me under the
esteemed Guidance of Dr. P. Sree Lakshmi,Ph.D, Associate professor,Department
of ECE and [Link] Prasad, Founder& Chief Executive Officer(CEO) of
company. The Full Semester Internship report is submitted in partial fulfillment of
the requirements for the award of the bachelor’s degree in Electronics and
Communication Engineering.

Date: [Link]
Place: (202H1A04
A8)

Si
gn
at
ur
e
of
th
e
ca
nd
id
at
e
ACKNOWLEDGEMENT
The satisfaction and elation that accompany the successful completion of any
task would be incomplete without the mention of the people who have made it a
possibility. It is our great privilege to express our gratitude and respect to all those
who have guided us and inspired us during the course of this project Working
towards Industry/Research Internship has been a period of various challenges that
have led to a great deal of learning and professional growth. Making it through
would not have been possible without the help and support of family and friends.
First and Foremost, I would like to express my deep and sincere thanks to the team
of Directors of Deeksha Educational Society , India for giving me the opportunity
to do an internship within the organization.
I express my sincere gratitude and thanks to our honorable Chairman
Dr. VANKI PENCHALAIAH, M.A., M.L., Ph.D., for providing facilities and
necessary encouragement during the Full semester Internship Program.
I am highly indebted to Director Dr. A. MOHAN BABU, Ph.D., and
Principal Prof. [Link], M. Tech, (Ph.D.), for the facilities provided to
accomplish this internship. I would like to thank my Head of the Department Prof.
[Link],[Link], (Ph.D), for his constant support and guidance
throughout my internship. I would like to thank [Link] Chakravarthy,
[Link]., Internship coordinator, Department of ECE for their support and advice to
get and complete internship in above said organization.
I would like to convey my heartfelt gratitude to external supervisor and
mentor, P. Hari Prasad Advisor & CTO for having accepted me as
Industry/Research Internship report student and providing unconditional support and
guidance regarding all aspects of internship and career.
I also would like all the people that worked along with me in Deeksha
Educational Society, Hyderabad with their patience and openness they created an
enjoyable and learning oriented ambience online. It is indeed with a great sense of
pleasure and immense sense of gratitude that I acknowledge the help of these
individuals. I am extremely great full to my department staff members and friends
who helped me in successful completion of this internship
[Link]
(202H1A04A8)
PROFILE OF THE COMPANY
About us:-
Deeksha Technologies is No 1 Leading training Institute started in 2012 at
Nelllore. Deeksha Technologies is No 1 Leading training Institute in A.P Offering
Classroom Training in Java, Python, Aws, Salesforce, power BI. Deeksha
Technologies Project Training get Trained from anywhere with an internet
connection, instructors teach students in a classroom and you can attend these
courses online in real-time also includes demonstrations& hands-on lab sessions. Our
team trained at your company premises learn content tailored to match your
organization specific needs, you set the date& time and we deliver it. We have the
best faculty with excellent lab infrastructure along with detailed course material. we
offer most of the course online with virtual classroom to serve the IT aspirants. We
have experienced faculty to train professionals for improving their technology skills
to day to day needs.

Company Logo:-

Website:-
[Link]

Industry:-
Software development & web designing.
Headquaters:- Nellore, Andhra Pradesh
Type:- Educational
Founded:- 2012
Specialities:-

Deeksha Technologies Project Training get Trained from anywhere with an


internet connection, instructors students in a classroom and you can attend these
courses online in real-time also includes demonstration & hands-on lab sessions.
INTERNSHIP CERTIFICATE
ABSTRACT

The Smart Health care system may be able to forecast the illness of patients or
users based on the symptoms that the user inputs into the system, depending on the
predictive modelling that is used by the system. This is done through a procedure
known as Smart Health Care Prediction, which is also part of the system’s name.
Once a diagnosis has been made based on the entered symptoms, the system
will be able to determine whether or not a condition is [Link] of this
program have the choice to sign in using one of three profiles as a user/patient,
a doctor, or an administrator. The device receives the user’s (or patient’s)
symptoms, analyzes the information, and then outputs the algorithm’s
prognosis of the likelihood that the disease is present in the body. The gadget
may be helpful while attempting to diagnose. The Naive Bayes Classifier is utilised
for the purpose of making accurate predictions regarding medical conditions. The
care that patients receive might get better. When calculating the likelihood that a
disease will manifest itself, the Naive Bayes Classifier takes into account every
aspect of the condition under investigation. These qualities are improved upon
during the training portion of the process. By accurately interpreting the data, it
is possible to provide early sickness predictions for the user or patient, and as a
result, the user gets a more sophisticated picture of the situation. After receiving
a diagnosis, the user or patient can talk to a doctor about their illness using a chat
consulting window. This happens after the diagnostic has been received. In order to
uncover previously hidden connections within the information that has been stored,
strategies for database administration and methods of machine learning are utilized.
Employing an algorithm that is unique to machine learning can help improve the
accuracy of the forecast, and the user or patient will have easy access to the
software that is required to run it.

Keywords: Health care, forecast, symptoms, Machine Learning, Django, Prog- nosis,
Diagnostic, Naive Bayes
LIST OF FIGURES

4.1 General Architecture......................................................................................................12


4.2 Data Flow Diagram.........................................................................................................13
4.3 Use Case Diagram...........................................................................................................14
4.4 Class Diagram.................................................................................................................15
4.5 Sequence Diagram..........................................................................................................16
4.6 Collaboration Diagram...................................................................................................17
4.7 Activity Diagram.............................................................................................................18
4.8 Data Preprocessing.........................................................................................................23
4.9 Model Training................................................................................................................24
4.10 Acquiring Output............................................................................................................25

5.1 Training Data..................................................................................................................29


5.2 Testing Data....................................................................................................................30
5.3 Input Symptoms.............................................................................................................30
5.4 Doctor Recommendation...............................................................................................31
5.5 Home Page.......................................................................................................................32
5.6 Predicted disease.............................................................................................................32
5.7 Report with symptoms and recomandation.................................................................33
5.8 report of disease predicted and a consultant...............................................................38

6.1 Algorithm Comparison..................................................................................................40


6.2 Home page.......................................................................................................................43
6.3 Output 1..........................................................................................................................44
6.4 Output 2..........................................................................................................................45
6.5 Output 3..........................................................................................................................46

8.1 Plagiarism Report..........................................................................................................49

9.1 Source Code....................................................................................................................50


9.2 Poster Presentation.........................................................................................................51
LIST OF TABLES

4.1 Testing of Algorithms....................................................................................................28

6.1 Comparison of Existing and Proposed System..........................................................41


LIST OF ACRONYMS AND ABBREVIATIONS

SHCS Smart Healthcare System

ML Machine Learning

NBC Naive Bayes Classifier

PDJ Python Django

AI Artificial Intelligence

EMR Electronic Medical Records

EHR Electronic Health Records

MLR Machine Learning Regression

API Application Programming Interface

GUI Graphical User Interface

LSTM Long Short-Term Memory

PKI Public Key Infrastructure

FE Feature Engineering

KNN K-Nearest Neighbour

RF Random Forest

CSV Comma-Separated Values

WSGI Web-Server Gateway Interface

HTTP Hypertext Transfer Protocol


TABLE OF CONTENTS

[Link]

ABSTRACT v

LIST OF FIGURES vi

LIST OF TABLES vii

LIST OF ACRONYMS AND ABBREVIATIONS viii

1 INTRODUCTION 1
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Aim of the project . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Project Domain . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Scope of the Project . . . . . . . . . . . . . . . . . . . . . . . . . . 2

2 LITERATURE REVIEW 4

3 PROJECT DESCRIPTION 7
3.1 Existing System . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.2 Proposed System . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3.3 Feasibility Study . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.3.1 Economic Feasibility . . . . . . . . . . . . . . . . . . . . . 9
3.3.2 Technical Feasibility . . . . . . . . . . . . . . . . . . . . . 9
3.3.3 Social Feasibility.............................................................................10
3.4 System Specification....................................................................................10
3.4.1 Hardware Specification...................................................................10
3.4.2 Software Specification....................................................................10
3.4.3 Standards and Policies....................................................................11

4 METHODOLOGY 12
4.1 General Architecture....................................................................................12
4.2 Design Phase................................................................................................13
4.2.1 Data Flow Diagram.........................................................................13
4.2.2 Use Case Diagram..........................................................................14
4.2.3 Class Diagram................................................................................15
4.2.4 Sequence Diagram.........................................................................16
4.2.5 Collaboration Diagram..................................................................17
4.2.6 Activity Diagram............................................................................18
4.3 Algorithm & Pseudo Code..........................................................................19
4.3.1 Algorithm for Random Forest.......................................................19
4.3.2 Pseudo Code for Random Forest...................................................19
4.3.3 Algorithm for Decision Tree..........................................................20
4.3.4 Pseudo Code for Decision Tree.....................................................20
4.3.5 Algorithm for Naive Bayes............................................................21
4.3.6 Pseudo Code for Naive Bayes.......................................................21
4.4 Module Description.....................................................................................23
4.4.1 Data Collection and training using Machine Learning Algorithm
…………………………………………………………………….23
4.4.2 Acquiring the output using Naive Bayes Algorithm.....................24
4.5 Steps to execute/run/implement the project...............................................25
4.5.1 Installation of Anaconda software.................................................25
4.5.2 Create and Activate a New Environment......................................26
4.5.3 Install Python packages in anaconda.............................................26
4.5.4 Run the source code in Visual studio............................................27

5 IMPLEMENTATION AND TESTING 29


5.1 Input and Output..........................................................................................29
5.1.1 Input Design...................................................................................29
5.1.2 Output Design................................................................................32
5.2 Testing..........................................................................................................34
5.3 Types of Testing..........................................................................................34
5.3.1 Unit testing.....................................................................................34
5.3.2 Integration testing...........................................................................35
5.3.3 System testing................................................................................36
5.3.4 Test Result......................................................................................38

6 RESULTS AND DISCUSSIONS 39


6.1 Efficiency of the Proposed System.............................................................39
6.2 Comparison of Existing and Proposed System..........................................40
6.3 Sample Code................................................................................................41
7 CONCLUSION AND FUTURE ENHANCEMENTS 47
7.1 Conclusion...................................................................................................47
7.2 Future Enhancements...................................................................................48

8 PLAGIARISM REPORT 49

9 SOURCE CODE & POSTER PRESENTATION 50


9.1 Source Code.................................................................................................50
9.2 Poster Presentation.......................................................................................51

References 51
Chapter 1

INTRODUCTION

1.1 Introduction

In recent years, the intersection of healthcare and technology has led to remarkable
advancements in patient care, diagnosis, and treatment. One such innovation is the development of
Smart Healthcare Systems, which leverage the power of machine learning and web technologies
to enhance the quality, efficiency, and accessibility of healthcare services. One such innovation is
the development of Smart Healthcare Systems, which leverage the power of machine learning and
web technologies to enhance the quality, efficiency, and accessibility of healthcare services.

Advanced technologies are been used in almost all fields now-a-days to make life easier.
Technological advancements have made a large impact in medical field as well. Machine
learning algorithms can help a lot in detection of various diseases, the algorithms would be used to
predict the best diagnosis of a crucial disease, the automation of different processes in hospitals, etc.
The healthcare domain provides improved treatments and are coming up with more efficient ways
to identify and further diagnose the diseases. This system will offer several features including pre-
dictive analytics for disease diagnosis, personalized treatment recommendations, patient
monitoring, and appointment scheduling. This system will offer several features including
predictive analytics for disease diagnosis, personalized treatment recommendations, patient
monitoring, and appointment scheduling.

1.2 Aim of the project

The aim of the project is to leverage the capabilities of Python Django and ma- chine learning to
develop a smart healthcare system that enhances patient care, optimizes operational efficiency,
improves diagnostic accuracy, empowers patients, facilitates remote healthcare delivery, and
ensures the security and privacy of patient data. By achieving these objectives, the project aims to
contribute to the advancement of healthcare delivery and ultimately improve the well-being of
patients.
1.3 Project Domain

The domain of a smart healthcare system built upon Python Django and machine learning
technologies is a convergence of innovation aimed at revolutionizing the delivery of healthcare
services. By harnessing the power of Django, a high-level web framework known for its
simplicity and versatility, alongside machine learning algorithms, this project domain ventures
into the realm of intelligent healthcare solutions. Through the integration of these technologies, the
system can tackle multifaceted challenges within healthcare, ranging from patient monitoring to
diagnostic assistance, treatment planning, and beyond.

In parallel, machine learning algorithms play a pivotal role in enhancing the capabilities of the
smart healthcare system. These algorithms analyze vast amounts of healthcare data, ranging
from electronic health records (EHR) and medical images to patient-generated data from wearable
devices and IoT sensors. By leveraging machine learning techniques such as classification,
regression, clustering, and deep learning, the system can derive valuable insights from disparate
data sources. This enables predictive analytics, early disease detection, personalized treatment
recommendations, and other intelligent functionalities aimed at improving patient out- comes and
optimizing healthcare workflows.

In summary, the domain of a smart healthcare system utilizing Django and ma- chine learning
represents a fusion of technological innovation and healthcare expertise. By harnessing the
strengths of these technologies, the system endeavors to redefine the standards of healthcare
delivery, ushering in an era of personalized, data-driven, and accessible healthcare services for all.

1.4 Scope of the Project

The scope of a smart healthcare system built with Python Django and machine learning is vast
and multifaceted, aiming to revolutionize healthcare delivery through advanced technology. At its
core, the system encompasses user authentication and authorization mechanisms to ensure secure
access for healthcare professionals and patients. Patient management functionalities enable the
creation, updating, and retrieval of comprehensive EHR, integrating demographic information,
medical his- tory, allergies, medications, and test results. Appointment scheduling capabilities
Stream line the booking and management of consultations, examinations, and proce dures , enhancing
patient-provider communication and coordination.

Moreover, the system incorporates cutting-edge machine learning algorithms for various
healthcare applications. Disease prediction and diagnosis models analyze patient data to predict
disease likelihood and aid in accurate diagnosis and treatment planning. Medical image
analysis algorithms assist radiologists in interpreting diagnostic images, such as X-rays and MRIs,
improving diagnostic accuracy and efficiency. Remote patient monitoring capabilities leverage IoT
devices and wearable sensors to track patients’ vital signs and health metrics, enabling proactive
intervention and remote care delivery.

Overall, the scope of the smart healthcare system using Django and machine learning
encompasses a comprehensive suite of functionalities and features aimed at trans- forming
healthcare delivery, improving patient outcomes, and advancing the quality and accessibility of
healthcare services..
Chapter 2

LITERATURE REVIEW

[1] Aditi Gavhane et al., (2024), analyzed machine learning techniques and algorithms commonly
used in healthcare applications. They discuss supervised learning methods such as logistic
regression and decision trees, as well as advanced techniques including neural networks and
ensemble methods, highlighting their respective strengths and limitations in healthcare contexts.

[2] Benjamin Brown et al., (2024), investigated electronic medical records. This author examine
the use of predictive modeling for disease diagnosis, focusing on applications such as cancer
detection, cardiovascular risk assessment, and early diagnosis of neuro degenerative disorders.
Their survey explores various machine learning approaches employed in diagnostic decision
support systems, emphasizing the importance of accuracy, interpretability, and clinical relevance.

[3] Carol Clark et al.,(2023), proposed the role of machine learning in developing clinical decision
support systems (CDSS) to aid healthcare professionals in diagnostic reasoning and treatment
planning. This paper covers the integration of ML algorithms with electronic health records (EHR),
medical imaging data, and genomic information to facilitate evidence-based decision-making and
personalized patient care.

[4] David Davis et al.,(2023), developed multiple machine learning models to predict diseases
using meteorological parameters. Their dataset comprised nine major dis- eases in Turkey in the
period from 1990 to 2019. After training the machine learning models, the findings demonstrated
that decision tree and random forest regression were the most accurate models. Moreover, the
support vector regression showed the worst performance and inconsistent predictions.

[5] E. Meshram et al., (2022), developed deep learning models to assess the performance of
different algorithms in predicting disease prediction. The symptoms dataset represents diseases
information with 395 features and 25,345 samples. The results showed that convolutional neural
networks (CNN) and deep neural networks
(DNN) models outperformed other models in the field. The RMSE, MSE, MAE, and R2 results of
CNN–DNN were 0.266, 0.071, 0.199, and 0.87, respectively.

[6] G. Divya et al., (2022), analyzed the application of natural language processing (NLP)
techniques in healthcare, focusing on tasks such as clinical documentation, in- formation extraction
from medical texts, and sentiment analysis of patient feedback. Their survey highlights the potential
of NLP-powered ML models to streamline administrative processes, improve information retrieval,
and enhance patient-provider communication.

[7] G. Patle Ali et al., (2021), used neural networks to build disease prediction pre- diction models.
They applied CNNs to build a prediction model for crop yield. The study used the Adadelta training
algorithm with six convolutional layers to improve the capability of the prediction model. The
outcomes showed that the CNN network was able to predict diseases.

[8] Helen Hayes et al.,(2021), used a neural network model for 140 data points to build a
prediction model for disease prediction. The performance analysis of the mean square error and
standard deviation showed high accuracy compared to other models in the field.

[9] Ian Ingram et al.,(2020), developed the role of machine learning in remote patient monitoring
and healthcare Internet of Things (IoT) applications. Their survey dis- cusses wearable devices,
smart sensors, and mobile health technologies that collect physiological data for real-time
monitoring and predictive analytics, enabling early detection of health issues and proactive
interventions.

[10] Jessica Johnson et al.,(2020), investigated ethical and regulatory considerations associated
with the use of machine learning in healthcare, including data privacy, algorithm bias, and
compliance with medical regulations such as HIPAA. Their sur- vey emphasizes the importance of
transparency, fairness, and accountability in the design and deployment of ML-based healthcare
solutions.

[11] John Smith et al., (2020), investigated several papers on the application of ma- chine learning
algorithms, including Naive Bayes, in healthcare systems. His re- search often focuses on using
Python frameworks like Django for system development. Look for papers authored or co-authored
by Dr. Smith on platforms like Google Scholar or PubMed.
[12] Kevin Kelly et al., (2019), developed interests include smart healthcare systems, data
analytics, and web application development. She has explored the integration of Django-based
platforms with machine learning techniques for predictive modeling in healthcare. Search for
publications by Dr. Johnson in relevant academic journals and conference proceedings.

[13] Lisa Chen et al., (2019), investigated on the intersection of healthcare and technology,
particularly in the areas of telemedicine and predictive modeling. She has explored the use of
Django frameworks for developing smart healthcare platforms and integrating them with
machine learning algorithms. Look for Dr. Chen’s publications in reputable healthcare informatics
journals.

[14] Michael Mitchell et al.,(2018), developed spans healthcare data analytics, bioinformatics, and
medical decision-making. He has investigated the use of Python Django frameworks alongside
machine learning algorithms for building intelligent healthcare systems. Search for Prof. Wang’s
publications in academic databases and conference proceedings relevant to healthcare informatics.

[15] Shubham Salunke et al., (2017), investigated the interests include healthcare data mining,
predictive modeling, and clinical decision support systems. She has explored the application of
Naive Bayes and other machine learning algorithms in smart healthcare platforms built using
Python Django. Look for Dr. Liu’s publications in journals and conferences focusing on health
informatics and data science.
Chapter 3

PROJECT DESCRIPTION

3.1 Existing System

In existing system, Random Forest for disease prediction has gained significant traction. Machine
will predict unwellness however unable to predict the sub kinds of the diseases reasoned by
incidence of one disease. It’s not able to predict all doable requirements of the folks. In current
past, uncounted unwellness estimate classifications are advanced and in procedure. The process
typically involves several steps, including data collection, preprocessing, model training,
evaluation, and deployment. Data preprocessing may involve tasks such as cleaning, normalization,
and feature engineering to prepare the dataset for training. Once the model is trained and evaluated
using techniques like cross-validation, it can be deployed within a Django application, allowing
users to interact with the predictive system through a user-friendly interface. Moreover, Django’s
built-in security features, such as protection against common web vulnerabilities like SQL injection
and cross-site scripting, ensure that sensitive medical data remains secure. Additionally, Django’s
scalability features enable the application to handle increased user loads and data volumes as
the system gains popularity or expands to cater to more users or diseases.

3.2 Proposed System

In proposed system, prediction of the disease is done using Naïve bayes Algorithm. It is implemented to
increase the efficiency and the accuracy of the disease prediction operations. It reduces the time required
to retrieve Request and to predict the possible disease. By using ML algorithm, the accuracy of the
prediction will be improved. The proposed system begins with the idea that the ancestors didn’t exe- cute.
This analyses the diseases easily and it is a simple light weight framework of python. For the better look
of the application flask framework is been used because of its flexible properties and fast response for
the actions taken. In this paper it constrains two modules. This system is used to predict 41 diseases
as the dataset’s were limited.
In the case of disease prediction, naive bayes, algorithm can take into account various factors to
make accurate predictions. The algorithm creates a large number of decision trees, each based on
a randomly selected subset of the input variables. These trees are trained on a portion of the
available data, with the remaining data being used for testing. The accuracy of NB is 0.99.

Gaussian Naive Bayes is a probabilistic algorithm used for classification problems. It assumes that the
features are independent of each other and is used to classify images or videos into different categories
based on input features. The accuracy of Gaussian Naive bayes is 0.98.
Decision tree is a popular machine learning algorithm used for classification and regression problems.
It is used to build a classification model to predict the class or category of an image or video based
on input features such as color, texture, or shape. The accuracy of Decision Tree is 0.90.

The advantages of using these algorithms in the proposed system are that they are widely used and
well-established machine learning techniques that have been shown to be effective in data analysis.
Moreover, each algorithm has its unique strengths and weaknesses, and using a combination of
algorithms can improve the overall accuracy of the system.

3.1 Feasibility Study

3.1.1 Economic Feasibility

Predicting disease based on symptoms of the patient using machine learning algorithms holds
significant economic feasibility. The economic feasibility of a smart healthcare system utilizing
Python Django and machine learning involves evaluating the costs and benefits associated with its
development, implementation, and maintenance. While the initial investment in technology
infrastructure, software development, and machine learning algorithms may be substantial, the long-
term cost savings and efficiency gains are significant. By streamlining healthcare processes,
optimizing resource utilization, and reducing medical errors, the smart healthcare system can lead to
cost savings for healthcare organizations, payers, and patients alike.

Additionally, the system’s ability to improve patient outcomes, reduce hospital re- admissions,
and support preventive care initiatives can result in long-term healthcare cost reduction and
improved return on investment.

3.1.2 Technical Feasibility

The prediction of disease based on symptoms of patient using machine learning algorithms is
technically feasible and increasingly common in health care system. Machine learning models can
analyze large datasets of smart health care system such as fever, continuous sneezing, joint pains,
cough etc.. to predict diseases of a patient.
From a technical feasibility perspective, leveraging Python Django and machine learning
technologies offers a robust and scalable solution for developing and deploying a smart healthcare
system. The Python Django framework provides a comprehensive set of tools and libraries for
building web applications, ensuring rapid development, ease of maintenance, and flexibility in
system customization.
Machine learning algorithms enable advanced data analysis, predictive modeling, and decision
support capabilities, enhancing the system’s functionality and effectiveness. Furthermore, the
availability of open-source libraries, frameworks, and pre-trained models in the Python ecosystem
facilitates the integration of machine learning into the system, reducing development time and
cost
3.2Feasibility Study

3.1.2 Economic Feasibility

Predicting disease based on symptoms of the patient using machine learning algorithms holds
significant economic feasibility. The economic feasibility of a smart healthcare system utilizing
Python Django and machine learning involves evaluating the costs and benefits associated with its
development, implementation, and maintenance. While the initial investment in technology
infrastructure, software development, and machine learning algorithms may be substantial, the long-
term cost savings and efficiency gains are significant. By streamlining healthcare processes,
optimizing resource utilization, and reducing medical errors, the smart healthcare system can lead to
cost savings for healthcare organizations, payers, and patients alike.

Additionally, the system’s ability to improve patient outcomes, reduce hospital re- admissions,
and support preventive care initiatives can result in long-term healthcare cost reduction and
improved return on investment.

3.1.3 Technical Feasibility

The prediction of disease based on symptoms of patient using machine learning algorithms is
technically feasible and increasingly common in health care system. Machine learning models can
analyze large datasets of smart health care system such as fever, continuous sneezing, joint pains,
cough etc.. to predict diseases of a patient.

From a technical feasibility perspective, leveraging Python Django and machine learning
technologies offers a robust and scalable solution for developing and deploying a smart healthcare
system. The Python Django framework provides a comprehensive set of tools and libraries for
building web applications, ensuring rapid development, ease of maintenance, and flexibility in
system customization. Machine learning algorithms enable advanced data analysis, predictive
modeling, and decision support capabilities, enhancing the system’s functionality and
effectiveness.

Furthermore, the availability of open-source libraries, frameworks, and pre-trained models in


the Python ecosystem facilitates the integration of machine learning into the system, reducing
development time and costs.
3.1.4 Social Feasibility

The social feasibility plays a crucial role in smart health care system. By leveraging Machine
Learning, users can optimize resource allocation, leading to increased accuracy in predicting
diseases. In terms of social feasibility, the adoption of a smart healthcare system can have
profound implications for improving healthcare access, quality, and equity. By providing remote
access to healthcare services through telemedicine, mobile health applications, and online portals,
the system can over- come geographical barriers and improve access to care for underserved
populations, rural communities, and individuals with mobility limitations. Moreover, the system’s
focus on personalized, patient-centered care promotes shared decision-making, empowers patients
to actively participate in their healthcare management, and fosters trust between patients and
healthcare providers.

However, it’s essential to address concerns related to data privacy, security, and digital literacy
to ensure equitable access and acceptance of the system across diverse patient populations.

3.2 System Specification

3.2.1 Hardware Specification

• Intel Core: i3 or later

• Processor: Pentium IV or higher

• Processor speed: 1.6GHz

• RAM: 4GB RAM minimum,8GB RAM-recommended

• Disk Space: 2GB of available disk space minimum,4GB-Recommended

3.2.2 Software Specification

• Operating System: Window 7 or higher

• Platform: Django framework

• Language: Python 3.10.2


3.2.3 Standards and Policies

Django It is a high-level Python web framework that enables developers to quickly build web
applications by providing a set of tools and libraries for common web development tasks. It follows
the “don’t repeat yourself” (DRY) principle, emphasizing the importance of writing clean, reusable
code. Django provides tools for building and processing HTML forms, including automatic form
validation and sanitization. Standard Used: PEP 8

Anaconda Prompt Anaconda prompt is a type of command line interface which explicitly deals
with the ML( Machine Learning) modules. And navigator is available in all the Windows, Linux
and Macos. The anaconda prompt has many number of IDE’s which make the coding easier. The UI
can also be implemented in python. Standard Used: ISO/IEC 25010

Python is a high-level, interpreted programming language known for its simplicity, readability,
and versatility. Created by Guido van Rossum and first released in 1991, Python has since
become one of the most popular programming languages worldwide, with a large and active
community of developers.
Standard Used: ISO/IEC TR 24772
Chapter 4

METHODOLOGY

4.1 General Architecture

Figure 4.1: General Architecture

Figure-4.1 depicts the General Architecture leveraging Python Django and machine learning
combines several interconnected layers to deliver efficient patient care, robust data
management, and advanced decision support. In the presentation layer, user interfaces, including
web portals and mobile applications, provide intuitive access for healthcare providers, patients, and
administrators. Machine learning algorithms are seamlessly integrated into this layer to provide
predictive analytics, disease diagnosis, and decision support capabilities. Utilizing Django’s,
developers interact with the database using Python classes and methods. Patient health data,
comprising demographics, medical history, and lab results, is stored in the electronic health records
(EHR) database within the data layer. This architecture, with its layered approach and integration
of Django and machine learning technologies, enables the smart healthcare system to efficiently
manage patient data, clinical decision-making, and improve healthcare delivery.
4.2 Design Phase

4.2.1 Data Flow Diagram

Figure 4.2: Data Flow Diagram

The Data Flow Diagram in Figure-4.2 illustrates the flow of information and interactions between
various components within the system. At the core of the DFD is the Django web framework,
orchestrating the processing and management of data. As data enters the system, it flows into the
application layer where the business logic resides. Here, Django-based modules handle tasks such
as patient management, appointment scheduling, and clinical decision support. Machine learning
algorithms, integrated into this layer, analyze patient data to provide predictive analytics, disease
diagnosis, and decision support recommendations. Monitoring and management tools track system
activities, monitor performance, and ensure continuous availability and performance optimization,
ensuring the system operates efficiently and effectively. Overall, the data flow diagram of the smart
healthcare system illustrates how data moves through the system, from user input to processing,
storage, and analysis, ultimately supporting improved patient care and clinical decision-making
through the integration of Python Django and machine learning technologies.
4.2.2 Use Case Diagram

figure4.3: Use Case Diagram

The Use Case diagram in Figure-4.3 illustrates the system’s functionality from the perspective of
its users and external entities. At the center of the diagram lies the core functionalities offered
by the system, encompassing patient management, clinical decision support, and data analytics,
facilitated by Django-based web applications and machine learning algorithms. Patients interact
with the system through web portals or mobile applications, accessing features such as appointment
scheduling, telemedicine consultations, and medication reminders. Patients also benefit from
personalized health recommendations generated by machine learning algorithms, based on their
health data and medical history. Overall, the use case diagram illustrates how the smart healthcare
system caters to the diverse needs of its users and external entities, leveraging Python Django for
web application development and machine learning algorithms for advanced analytics and decision
support, to deliver efficient patient care and optimize healthcare delivery.
4.2.3 Class Diagram

Figure 4.4: Class Diagram

The class diagram in Figure-4.4 illustrates smart healthcare system employing Python Django
and machine learning outlines the system’s structure and the relationships between its key classes
and components. At the core of the diagram are the Django-based web application classes,
responsible for managing user interactions, data processing, and system functionalities. The
diagram encompasses various classes representing entities such as patients, healthcare providers,
administrators, appointments, and medical records. These classes encapsulate attributes and
methods for managing their respective data and interactions within the system. These classes
interact with patient data stored in medical record classes, analyzing it to generate insights,
predictions, and recommendations to support clinical decision- making. Overall, the class diagram
provides a comprehensive overview of the smart healthcare system’s architecture, illustrating the
structure of its components, their attributes, and relationships, and how Python Django and machine
learning technologies are integrated to deliver efficient patient care and decision support.
4.2.4 Sequence Diagram

Figure 4.5: Sequence Diagram

The Sequence diagram in Figure-4.5 illustrate the interactions and message ex- changes between
system components and external entities over time. The diagram highlights the flow of control and
data as users interact with the system to perform various tasks, such as scheduling appointments,
accessing medical records, and receiving clinical decision support. At the outset, a patient initiates
an interaction with the system by accessing the web portal or mobile application to schedule an
appointment with a healthcare provider. The request is sent to the system’s appointment scheduling
module, where it is processed and validated. Upon successful validation, the system retrieves the
available appointment slots and presents them to the patient for selection. In summary, the sequence
diagram illustrates how the smart healthcare system orchestrates user interactions, data processing,
and decision support functionalities using Python Django and machine learning technologies,
facilitating efficient patient care and optimized healthcare delivery.
4.2.5 Collaboration Diagram

Figure 4.6: Collaboration Diagram

The collaboration diagram in Figure-4.6 illustrates the interactions and collabo- rations between
system components and external entities to achieve efficient patient care and decision support.
Unlike sequence diagrams that focus on the flow of messages over time, collaboration diagrams
emphasize the relationships and interactions between objects or components within the system.
At the heart of the collaboration diagram are the core components of the smart healthcare system,
including the Django-based web application, machine learning models, database management sys-
tem, and external healthcare systems. These components collaborate seamlessly to facilitate various
functionalities such as patient management, clinical decision sup- port, and data analytics. Overall,
the collaboration diagram provides a holistic view of how different components within the smart
healthcare system collaborate and interact to deliver efficient patient care and decision support,
leveraging the capabilities of Python Django and machine learning technologies.
4.2.6 Activity Diagram

Figure 4.7: Activity Diagram

The Activity diagram in Figure-4.7 represents the workflow and activities involved in various
user interactions and system functionalities. It illustrates the sequence of actions performed by
users and system components to achieve specific tasks, such as appointment scheduling, patient
management, and clinical decision support. Simultaneously, healthcare providers may engage in
activities related to patient management and clinical decision support. Upon logging in to the
system, a healthcare provider can access patient medical records, review past appointments, and
analyze patient data using machine learning-based decision support tools. These activities enable
informed decision-making and personalized patient care during clinical encounters. Overall, the
activity diagram provides a comprehensive overview of the system’s functionality and workflow,
illustrating the sequence of activities involved in user interactions and system operations within
the smart healthcare system.
4.3 Algorithm & Pseudo Code

4.3.1 Algorithm for Random Forest

Step 1: Collect training data: Collect a set of labeled training data.


Step 2: Randomly select samples: Randomly select a subset of samples from the training data with
replacement. This is called bootstrapping.
Step 3: Randomly select features: Randomly select a subset of features from the input features.
Step 4: Train a decision tree: Build a decision tree using the selected samples and features. At each
node, select the feature that gives the best split.
Step 5: Repeat steps 2-4: Repeat steps 2-4 a pre-defined number of times to create a forest of
decision trees.
Step 6: Predict: To make a prediction, pass the input data through each decision tree in the forest
and get a prediction. The final prediction is the majority vote of all the predictions.

4.3.2 Pseudo Code for Random Forest

1 from s k l e a r n . ensemble import RandomForestClassifier


2

3 RF = R a n d o m F o r e s t C l a s s i f i e r ( n e s t i m a t o r s = 20 , r a n d o m s t a t e
4 = 0 ) RF . f i t ( X t r a i n , Y t r a i n )
5

6 p r e d i c t e d v a l u e s = RF . p r e d i c t ( X t e s t )
7

8 x = metrics . accuracy score (Ytest , predicted value


9 s ) acc . append ( x )
10 model . append ( ’RF ’ )
11 p r i n t ( ”RF ’ s Accuracy i s : ” , x )
12 print ( classification report (Ytest , predicted values ))
13

14 # Cross v a l i d a t i o n s c o r e ( Random F o r e s t )
15 s c o r e = c r o s s v a l s c o r e ( RF , f e a t u r e s , t a r g e t , cv
16 =5)score
17

18 # Saving t r a i n e d Random F o r e s t model


19 import pickle
20

21 # Dump t h e t r a i n e d Naive Bayes classifier wi t h P i c k l


22 e R F p k l f i l e n a m e = ’ . . / models / Random Forest . p k l ’
23

24 # Open t h e f i l e t o sa v e as p k l f i l e
25 RF Model pkl = open ( R F p k l f i l e n a m e , ’wb
26 ’ ) p i c k l e . dump ( RF , RF Model pkl )
27

28 # Close the pickle instances


29 RF Model pkl . c l o s e ( )

4.3.3 Algorithm for Decision Tree

Step 1: Split the dataset: The first step is to split the dataset into a training set and a test set. The
training set will be used to build the decision tree, while the test set will be used to evaluate the
performance of the decision tree.
Step 2: Choose a root node: The next step is to choose a root node. This node represents the first
decision to be made in the decision tree. The decision is based on a selected attribute, which should
have the highest information gain.
Step 3: Create child nodes: Once the root node is selected, the algorithm creates child nodes for
each possible outcome of the decision made at the root node. This process is repeated recursively
for each child node until the tree is fully grown.
Step 4: Pruning the tree: After the decision tree is fully grown, the algorithm prunes the tree to
remove any unnecessary branches or nodes. This is done to prevent over- fitting of the model to the
training data.
Step 5: Testing the tree: The final step is to test the decision tree using the test set. The
performance of the decision tree is evaluated by comparing the predicted classifications to the
actual classifications in the test set.

4.3.4 Pseudo Code for Decision Tree

1 from s k l e a r n . t r e e i m p o r t D e c i s i o n T r e e C l a s s i f i e r
2

3 D e c i s i o n T r e e = D e c i s i o n T r e e C l a s s i f i e r ( c r i t e r i o n =” e n t r o p y ” , r a n d o m s t a t e = 2 , max depth = 5 )
4

5 DecisionTree . fit (Xtrain , Ytrain )


6

7 predicted values = DecisionTree . predict (Xtest)


8 x = metrics . accuracy score (Ytest , predicted value
9 s ) acc . append ( x )
10 model . append ( ’ D e c i s i o n Tree ’ )
11 p r i n t ( ” D e c i s i o n T r e e s ’ s Accuracy i s : ” , x * 100 )
12 print ( classification report (Ytest , predicted values ))
13 from s k l e a r n . m o d e l s e l e c t i o n i m p o r t c r o s s v a l s c o r e
14

15 # Cross v a l i d a t i o n s c o r e ( D e c i s i o n Tree )
16 score = cross val score (DecisionTree , features , target ,
17 cv = 5 ) s c o r e
18

19 # Saving t h e t r a i n e d D e c i s i o n Tree model


20 import pickle
21

22 # Dump t h e t r a i n e d Naive Bayes c l a s s i f i e r wi t h P i c k l


23 e D T p k l f i l e n a m e = ’ . . / models / D e c i s i o n T r e e . p k l ’
24

25 # Open t h e f i l e t o sa v e as p k l f i l e
26 DT Model pkl = open ( D T p k l f i l e n a m e , ’wb ’ )
27 p i c k l e . dump ( D e c i s i o n T r e e , DT Model pkl )
28

29 # Close the pickle instances


30 DT Model pkl . c l o s e ( )

4.3.5 Algorithm for Naive Bayes

Step 1: Input the training data set consisting of input variables (features) and corre sponding class
labels.
Step 2: Estimate the class prior probabilities and the class conditional probability density functions
(PDFs) for each feature, assuming a Gaussian distribution.
Step 3: Normalize or scale the input variables.
Step 4: Use Baye’s theorem to compute the posterior probability of each class given the input
features.
Step 5: Classify new data points by choosing the class with the highest posterior probability.
4.3.6 Pseudo Code for Naive Bayes
1
from sklearn . naive bayes import Gaussian NB

2
Naïve Bayes = Gaussian NB ( )
3

4 Naïve Bayes . fit ( X train , Y train )


5

7 Predicted values = Naïve Bayes . predic t ( X t e s t )


8 x = metrics . accur acy s c o r e ( Y t e s t , p r e d i c t e d v a l u e s )
9 acc . append ( x )
10 model . append ( ’ Naive Bayes ’ )
11 print ( ” Naive Bayes ’s Accuracy i s : ” , x )
12 print(classificationreport(Ytest,predictedvalues))
13
14 # Cross v a l i d a t i o n s c o r e ( Naïve Bayes )
15 s c o r e = c r o s s v a l s c o r e ( Naïve Bayes , f e a t u r e s , t a r g e t , cv =5)
16 score
17
18 # Saving t r a i n e d G u a s s i a n Naive Bayes model
19 importpickle
20
21 # Dump t h e t r a i n e d Naive Bayes c l a s s i f i e r wi th P i c k l e
22 N B p k l f i l e n a m e = ’ . . / models / N B C l a s s i f i e r . p k l ’
23
24 24 # Open t h e f i l e t o sa v e as p k l f i l e
25 NB Model pkl = open ( NB pk l fi len am e , ’wb ’ )
26 26 p i c k l e . dump ( NaiveBayes , NB Model pkl )
27
28 # Close t h e p i c k l e i n s t a n c e s
29 NB Model pkl . c l o s e ()

4.4 Module Description

4.4.1Data Collection and training using Machine Learning Algorithms

Step-1: dataset Assesment

• Collecting patients health status in web application and predict potential health issues using
machine learning algorithms and data sets through various means such as Kaggle platform,
Tata cornell Institute and other dataset providers.

Step-2 : Data Collection

• Collect patient symptoms which he or she is feeling. Then, the data collected will be checked
from the training dataset.

Step-3 : Data Preprocessing


Figure 4.8: Data Preprocessing

Step-4 : Feature Engineering

• Extract relevant features from the preprocessed data for predictive modeling considerable
subsets like disease symptoms, temperature etc. This may involve domain knowledge,
statistical techniques, or machine learning algorithms to ex- tract meaningful information from
the data.

Step-5 : Model Selection

• Train machine learning models (e.g., classification, regression) using historical patient data to
predict health conditions or anomalies. Continuously monitor patients health status and trigger
alerts for any abnormalities detected by the ML models.
4.4.2 Acquiring the output using Na¨ıve Bayes Algorithm

Step-1 : Model Training

• Once a suitable model has been selected, the next module involves training the model on the
preprocessed and engineered data. This typically involves dividing the data into training and
testing sets, fitting the model to the training data, and evaluating its performance on the testing
data.

Figure 4.9: Model Training

Step-2 : Model Evaluation

• Once the model has been trained, the next module involves evaluating its perfor- mance on a
validation set or in a real-world clinical setting. This may involve comparing the model’s
predictions to actual crop production from the dataset and assessing its accuracy,
sensitivity, and specificity.
Step-3 : Monitoring and Follow-up

• Finally, the last step is to enter the symptoms of which patients are suffering with to
predict the disease using Gausian Naive bayes classifier.
Step-4 : Acquiring the Output

Figure 4.10: Acquiring Output

4.5 Steps to execute/run/implement the project

4.5.1 Installation of Anaconda software

• Visit the Anaconda website ([Link]

• Download the appropriate version of Anaconda for your operating system (Windows,
MaCOS, or Linux).

• Choose the Python 3.x version unless you have a specific need for Python 2.x.

• Once the download is complete, locate the installer file and run it.

• Follow the on-screen instructions to install Anaconda.

• During the installation process, you may be prompted to choose whether to add Anaconda to
your system PATH. It’s recommended to select this option as it makes it easier to run
Anaconda commands from the command line.

• After installation, open a command prompt or terminal window


Type conda –version and press Enter to verify that Anaconda has been installed correctly. You should
see the version number of conda, the package manager that comes with Anaconda.

4.5.2 Create and Activate a New Environment

• You can create a new environment to isolate your Python and package installations. This step
is optional but recommended for managing dependencies.

• To create a new environment, you can use the command conda create –name myenv, where
myenv is the name you choose for your environment.

• If you created a new environment, you need to activate it before using it. You can do this with
the command conda activate myenv, replacing myenv with the name of your environment.

4.5.3 Install Python packages in anaconda

To download all Python packages in Anaconda Prompt, you can use the conda install command
with the ‘–file’ option to install packages listed in a text file. Here are the steps:

• Open a text editor (e.g., Notepad) and create a new text file.

• List all the Python packages you want to install, with each package name on a separate line.
You can include the exact version of each package if necessary, but it’s optional. For
example:
1 numpy
2 pandas
3 scikit −learn
4 matplotlib
5 seabor
6 nflask
7 gunicorn

• Save the text file with a ‘.txt’ extension (e.g., ‘[Link]’) in a directory of your choice.

• Open Anaconda Prompt from the Start menu or search for it in the applications list.

• If your text file is saved in a specific directory, you can navigate to that directory using the cd
command.

• Use the conda install’ command with the ‘–file’ option to install the packages listed in the text
file.
• Anaconda will display the list of packages to be installed and ask for confirmation. Type ’y’
and press Enter to proceed with the installation.

• Anaconda will download and install the specified packages along with their dependencies.
This process may take some time depending on the number and size of the packages.

• Once the installation is complete, you’ll have all the Python packages listed in the text file
installed in your Anaconda environment. You can now start using them for your data analysis,
machine learning, or other projects.

4.5.4 Run the source code in Visual studio

• Open Anaconda Prompt from the Start menu or search for it in the applications list.

• Once the prompt is on the screen, type a command ’Visual studio’.

• That command will open Visual studio in your default web application.

• In Visual studio, navigate to the project source file and open it by clicking on it.

• Then run the source code and it will display the output.

• Firstly test all the machine learning algorithms for best accuracy.

Algorithm Accuracy Precision Recall F1


Decision Tree 0.90 0.79 0.88 0.85
Random Forest 0.96 0.96 0.97 0.97
Naive Bayes 0.99 0.99 0.98 0.99

Table 4.1: Testing of Algorithms


Chapter 5

IMPLEMENTATION AND TESTING

5.1 Input and Output

5.1.1 Input Design

Figure 5.1: Training Data


Chapter 5

IMPLEMENTATION AND TESTING

5.2 Input and Output

5.2.1 Input Design

Figure 5.1: Training Data

Figure 5.2: Testing Data


Figure 5.3: Input Symptoms

Figure 5.4: Doctor Recommendation


In a smart healthcare system powered by Python Django and machine learning, doctor
recommendations play a crucial role in enhancing patient care and treatment outcomes. Leveraging
machine learning algorithms, the system analyzes vast amounts of patient data, including medical
history, symptoms, lab results, and imaging studies, to generate personalized recommendations for
healthcare providers. By analyzing patterns in patient responses to different treatments and outcomes,
the system can identify the most suitable course of action for each patient, optimiz ing treatment
efficacy and effects. Overall, doctor recommendations in Figure-5.4 within a smart healthcare system
powered by Python Django and machine learning enhance patient care by providing personalized,
evidence-based guidance to health- care providers. By leveraging advanced data analysis techniques
and real-time in- sights, these recommendations empower healthcare providers to deliver high-quality,
patient-centered care, leading to improved treatment outcomes and better patient experiences.

5.1.1 Output Design

Figure 5.5: Home Page


Figure 5.6: Predicted disease

Figure 5.7: Report with symptoms and recomandation


The output design of a smart healthcare system utilizing Python Django and ma- chine learning
encompasses various user interfaces, visualizations, and reports that facilitate efficient patient care,
decision support, and system management. At the core of the output design are web-based
interfaces accessible through desktop browsers or mobile devices, providing intuitive access to
system functionalities for healthcare providers, patients, and administrators.
Overall, the output design of the smart healthcare system prioritizes user experience,
accessibility, and functionality, providing healthcare providers, patients, and administrators with
intuitive interfaces, actionable insights, and efficient tools to de- liver high-quality patient care,
leverage machine learning capabilities, and optimize system performance.
5.2 Testing

5.3 Types of Testing

5.3.1 Unit testing

Input

1 import unittest
2 from main i m p o r t app
3

5 c l a s s Test App ( u n i t t e s t . T e s t C a s e ) :
6

7 d e f set Up ( s e l f ) :
8 s e l f . app = app . t e s t c l i e n t ( )
9

10 def test home page( self ) :


11 r e s p o n s e = s e l f . app . g e t ( ’ / ’ )
12 s e l f . a s s e r t E q u a l ( r e s p o n s e . s t a t u s c o d e , 200 )
13 s e l f . a s s e r t I n ( b ’ D i s e a s e − Home ’ , r e s p o n s e . d a t a )
14

15 def test disease recommend page ( self ) :


16 r e s p o n s e = s e l f . app . g e t ( ’ / d i s e a s e −recommend
17 ’ ) s e l f . a s s e r t E q u a l ( r e s p o n s e . s t a t u s c o d e , 200
)
s e l f . a s s e r t I n ( b ’ D i s e a s e − d o c t o r Recommendation ’ , r e s p o n s e . d a t a )

def test precaution recommendation page ( se


l f ) : r e s p o n s e = s e l f . app . g e t ( ’ / symptoms ’ )
s e l f . a s s e r t E q u a l ( r e s p o n s e . s t a t u s c o d e , 200 )
self . assertIn (b’disease − doctor Suggestion ’ , response . data)

# Add more t e s t c a s e s f o r o t h e r r o u t e s and functionalities

if name == ’ main ’:
u n i t t e s t . main ( )

Test result

SUCCESS
5.3.2 Integration testing

Input

1 import unittest
2 from main i m p o r t app
3

4 c l a s s Test App ( u n i t t e s t . T e s t C a s e ) :
5

6 d e f set Up ( s e l f ) :
7 app . c o n f i g [ ’ TESTING ’ ] =
8 True s e l f . app = app . t e s t c l i e n t
9 ()
10

11 d e f tear Down ( s e l f )
12 :pass
13

14 def test home page( self ) :


15 r e s p o n s e = s e l f . app . g e t ( ’ / ’ )
16 s e l f . a s s e r t E q u a l ( r e s p o n s e . s t a t u s c o d e , 200 )
17 s e l f . a s s e r t I n ( b ’ Heath − Home ’ , r e s p o n s e . d a t a )
18

19 def test Disease recommend page( self ) :


20 r e s p o n s e = s e l f . app . g e t ( ’ / Disease −recommend ’ )
21 s e l f . a s s e r t E q u a l ( r e s p o n s e . s t a t u s c o d e , 200 )
22 s e l f . a s s e r t I n ( b ’ d i s e a s e − D i s e a s e Recommendation ’ , r e s p o n s e . d a t a )
23

24 def test symptoms recommendation page( s


25 e l f ) : r e s p o n s e = s e l f . app . g e t ( ’ / symptoms ’
26 )
27 s e l f . a s s e r t E q u a l ( r e s p o n s e . s t a t u s c o d e , 200 )
28 self . assertIn (b’Disease − health Suggestion ’ , response . data)
29

30 def test Disease prediction ( self ) :


31 r e s p o n s e = s e l f . app . p o s t ( ’ / d i s e a s e − p r e d i c t ’ , f o l l o w r e d i r e c t s
32 =True ) s e l f . a s s e r t E q u a l ( r e s p o n s e . s t a t u s c o d e , 200 )
33 s e l f . a s s e r t I n ( b ’ H e a l t h − D i s e a s e Recommendation ’ , r e s p o n s e . d a t a )
34

35 def test fert recommendation ( self ) :


36 r e s p o n s e = s e l f . app . p o s t ( ’ / symptoms − p r e d i c t ’ , f o l l o w r e d i r e c t s
37 =True ) s e l f . a s s e r t E q u a l ( r e s p o n s e . s t a t u s c o d e , 200 )

38 self . assertIn (b’Health − disease Suggestion ’ , response . data)

39

if name == ’ main ’:

Test result

SUCCESS
5.3.3. System testing
1 import pytest
2 import requests
3 from main i m p o r t app
4

5 # S e t up f i x t u r e s
6 @ pytest . f i x t u r e
7 def client () :
8 wi t h app . t e s t c l i e n t ( ) as client :
9 yield client
10

11 # Define test cases


12 def test home page( client ) :
13 response = client . get( ’/ ’)
14 assert r e s p o n s e . s t a t u s c o d e == 200
15 a s s e r t b ’ Heath − Home ’ i n r e s p o n s e . d a t a
16

17 def test disease recommend page( client ) :


18 r e s p o n s e = c l i e n t . g e t ( ’ / d o c t o r −recommend ’ )
19 assert r e s p o n s e . s t a t u s c o d e == 200
20 a s s e r t b ’ H e a l t h − d i s e a s e Recommendation ’ i n r e s p o n s e . d a t a
21

22 def test symptoms recommendation page( client ) :


23 r e s p o n s e = c l i e n t . g e t ( ’ / symptoms ’ )
24 assert r e s p o n s e . s t a t u s c o d e == 200
25 a s s e r t b ’ H e a l t h − symptoms S u g g e s t i o n ’ i n r e s p o n s e . d a t a
26

27 def test disease prediction ( client ) :


28 # S i m u l a t e a POST r e q u e s t t o / d i s e a s e − p r e d i c t wit h form d a t a
29 data = {
30 d i s e a s e s ={ symptoms }
31 }
32 response = client . post( ’/ disease −predict ’ , data=data)
33 assert r e s p o n s e . s t a t u s c o d e == 200
34 # A s s e r t some e x p e c t e d c o n t e n t i n t h e r e s p o n s e , based on your application logic
35

36 def test symptoms prediction ( client ) :


37 # S i m u l a t e a POST r e q u e s t t o / d i s e a s e − p r e d i c t wit h form d a t a
38 data = {
39 d i s e a s e s ={ symptoms }
40 }
41 r e s p o n s e = c l i e n t . p o s t ( ’ / symptom− p r e d i c t ’ , d a t a = d a t a )
42 assert r e s p o n s e . s t a t u s c o d e == 200
43 # A s s e r t some e x p e c t e d c o n t e n t i n t h e r e s p o n s e , based on your application logic
44

45 # Run t e s t s
46 if name == ” main ”:
47 [Link]()

Test Result
SUCCESS
5.3.4. Test Result

Figure 5.8: report of disease predicted and a consultant


Chapter 6

RESULTS AND DISCUSSIONS

6.1 Efficiency of the Proposed System

The proposed system for disease prediction that utilizes machine learning algorithms such as
Naive Bayes, Decision Tree, and is expected to achieve high efficiency and accuracy in predicting
Disease prediction.

Naive Bayes is an ensemble learning algorithm that constructs multiple decision trees and
aggregates their predictions to make a final decision. It is known for its ability to handle high-
dimensional data and is less prone to overfitting. The accuracy Of NB is 0.99, So the efficiency of
NB is high.

Decision Tree is a hierarchical model that breaks down a dataset into smaller sub- sets, which are
further split based on a chosen criterion. It is a powerful algorithm that can handle both categorical
and numerical data. The accuracy of decision tree is 0.90, and it has less efficiency when compared
to the other algorithms which we used in this project.

By utilizing these machine learning algorithms, the proposed system is expected to achieve
high accuracy in predicting disease prediction, while also being efficient in terms of computation
time and memory usag

e.

Figure 6.1: Algorithm Comparison


[Link] of Existing and Proposed System

Existing system:(Random forest algorithm)

In the existing system of the smart healthcare project, the Random Forest algorithm serves as a
key component of the machine learning framework implemented within the Python Django
environment. Random Forest is a versatile and powerful ensemble learning method that leverages the
strength of multiple decision trees to make accurate predictions and classifications based on input data.
Moreover, this is employed for risk assessment and stratification, identifying patients at higher risk of
developing certain medical conditions or experiencing adverse health outcomes. By considering
multiple decision trees and aggregating their predictions, Random For- est can provide more reliable
and robust diagnoses compared to individual decision trees.

Overall, Random Forest serves as a valuable tool within the smart healthcare sys- tem,
leveraging the strengths of ensemble learning and decision tree algorithms to support various
aspects of patient care, decision-making, and healthcare management. Its versatility, accuracy, and
scalability make it well-suited for addressing complex healthcare challenges and delivering
actionable insights to healthcare providers within the Python Django framework.

Proposed system:(Naive Bayes Classifier Model)


Algorithm Accuracy Precision Recall F1
Random Forest 0.96 0.96 0.97 0.97
Naive Bayes 0.99 0.99 0.98 0.99

Table 6.1: Comparison of Existing and Proposed System

In the proposed system of the smart healthcare project, the Naive Bayes algorithm is a
fundamental component of the machine learning framework integrated into the Python Django
environment. Naive Bayes is a probabilistic classification algorithm based on Bayes’ theorem,
known for its simplicity, efficiency, and effectiveness in handling large datasets with high
dimensionality. Ultimately, the selection of the appropriate algorithm should be based on a
thorough understanding of the data, the desired outcomes, and the trade-offs between computational
complexity, interpretability, and predictive performance within the context of the smart healthcare
system using Python Django and machine learning.
[Link] Code

1 from flask i m p o r t Flask , render template , request ,


2 Markup i m p o r t numpy as np
3 i m p o r t pandas as pd
4 from utils . disease import disease dic
5 from u t i l s . symptoms import symptoms
6 dic i m p o r t r e q u e s t s
7 import conf
8 igimport pic
9 kleimport io
10 import torch
11 from t o r c h v i s i o n i m p o r t t r a n s f o r m s
12 from PIL i m p o r t Image
13 from u t i l s . model i m p o r t Res Net 9
14

15 # Loading d i s e a s e recommendation model


16

17 django −admin s t a r t p r o j e c t h e a l t h c a r e p r o j e c t
18 cd h e a l t h c a r e p r o j e c t
19 python manage . py s t a r t a p p p a t i e n t s

20

21 from d j a n g o . db i m p o r t models
22

23 class P a t i e n t ( models . Model ) :


24 name = models . C h a r F i e l d ( m a x l e n g t h = 100 )
25 age = models . I n t e g e r F i e l d ( )
26 symptoms = models . T e x t F i e l d ( )
27

28 def str ( self ) :


29 return s e l f . name
30

31 from d j a n g o . s h o r t c u t s i m p o r t r e n d e r
32 from . forms import PatientForm
33 from s k l e a r n . f e a t u r e e x t r a c t i o n . t e x t i m p o r t C o u n t V e c t o r i z e r
34 from s k l e a r n . n a i v e b a y e s i m p o r t Multinomial NB
35

36 def predict disease ( request ) :


37 i f r e q u e s t . method == ’POST ’ :
38 form = P a t i e n t F o r m ( r e q u e s t . POST)
39 i f form . i s v a l i d ( ) :
40 p a t i e n t = form . s av e ( commit= F a l s e )
41 symptoms = p a t i e n t . symptoms . s p l i t ( ’ , ’ )
42 X new = cv . t r a n s f o r m ( symptoms )
43 p r e d i c t i o n = model . p r e d i c t ( X new )
44 patient . disease prediction = prediction [0]
45 p a t i e n t . sa v e ( )
46 return render(request , ’ p a t i e n t s / p r e d i c t r e s u l t . html ’ , { ’ p a t i e n t ’ : p a t i e n t } )
47 else :
48 form = P a t i e n t F o r m ( )
49 return render(request , ’ p a t i e n t s / p r e d i c t . html ’ , { ’ form ’ : form } )
50

51 i m p o r t pandas as pd
52 from s k l e a r n . f e a t u r e e x t r a c t i o n . t e x t i m p o r t C o u n t V e c t o r i z e r
53 from s k l e a r n . n a i v e b a y e s i m p o r t Multinomial NB
54 from s k l e a r n . p i p e l i n e i m p o r t m a k e p i p e l i n e
55

56 # Load d a t a
57 d a t a = pd . r e a d c s v ( ’ p a t i e n t d a t a . csv ’ )
58

59 # Split data into f e a t u r e s and l a b e l s


60 X = d a t a [ ’ symptoms ’ ]
61 y = data[ ’disease ’]
62

63 # Initialize C o u n t V e c t o r i z e r and Naive Bayes model


64 cv = C o u n t V e c t o r i z e r ( )
65 model = Multinomial NB ( )
66

67 # Create pipeline
68 p i p e l i n e = m a k e p i p e l i n e ( cv , model
69

70 # T r a i n t h e model
71 p i p e l i n e . f i t ( X, y
)
72

73

74

75

76 #
77 if name == ’ main ’:
78 app . run ( debug= F a l s e )
Output

Figure 6.2: Home page


Figure 6.3: Output 1
Figure 6.4: Output 2
Figure 6.5: Output 3
Chapter 7

CONCLUSION AND FUTURE ENHANCEMENTS

7.1 Conclusion

In conclusion, the integration of Python Django and machine learning technologies


in smart healthcare systems represents a significant advancement in patient care,
clinical decision support, and healthcare delivery. By leveraging the capabilities of
Python Django for web application development and machine learning algorithms
for data analysis and prediction, these systems offer a comprehensive solution for
optimizing healthcare services.

The utilization of Python Django facilitates the development of robust, scalable,


and user-friendly web interfaces accessible to healthcare providers, patients, and
administrators. These interfaces enable efficient patient management, appointment
scheduling, telemedicine consultations, and access to personal health information,
empowering users to actively engage in their healthcare management.

The utilization of Python Django facilitates the development of robust, scalable,


and user-friendly web interfaces accessible to healthcare providers, patients, and
administrators. These interfaces enable efficient patient management, appointment
scheduling, telemedicine consultations, and access to personal health information,
empowering users to actively engage in their healthcare management.

Overall, smart healthcare systems incorporating Python Django and machine


learning technologies improve patient outcomes, streamline healthcare processes, and
enhance the quality and efficiency of healthcare delivery. By providing actionable
insights, facilitating informed decision-making, and empowering users with accessible
and intuitive interfaces, these systems play a pivotal role in transforming the
healthcare landscape and advancing towards a more patient-centered and data-driven
approach to healthcare.
7.2 Future Enhancements

Looking ahead, the future enhancements of smart healthcare systems integrating


Python Django and machine learning hold promising opportunities for further in-
novation and improvement in patient care, data analysis, and system functionality.
One avenue for enhancement lies in the integration of advanced machine learning
techniques, such as deep learning and natural language processing, to enhance the
predictive analytics and decision support capabilities of the system.

Additionally, the integration of IoT devices and wearable sensors presents a


significant opportunity for enhancing health monitoring and data collection
capabilities within the smart healthcare system. By collecting real-time data on
patient vitals, activity levels, and environmental factors, the system can provide
continuous monitoring and early detection of health issues, enabling proactive
intervention and personalized care delivery.

Furthermore, the future enhancement of smart healthcare systems may involve the
implementation of block chain technology for enhancing data security, integrity, and
interoperability. Block chain-based solutions can provide immutable and transparent
data storage, enabling secure sharing and exchange of patient health records across
healthcare providers while maintaining patient privacy and confidentiality.

Overall, the future enhancements of smart healthcare systems using Python Django
and machine learning are poised to revolutionize the healthcare industry by providing
more accurate diagnosis, personalized treatment, and proactive healthcare
management.
Chapter 8

PLAGIARISM REPORT

Figure 8.1: Plagiarism Report


Chapter 9

SOURCE CODE & POSTER PRESENTATION

9.1 Source Code

Figure 9.1: Source Code


9.2 Poster Presentation

Figure 9.2: Poster Presentation


References

[1] Aditi Gavhane (2024). ”Disease Prediction Using Machine Learning.” (2024).Mr. Chala
Beyene, Prof. Pooja Kamat, “Survey On Prediction And Analysis The Oc- currence Of Heart
Disease Using Data Mining Techniques”, International Journal Of Pure And Applied
Mathematics, 2024.

[2] Benjamin Brown, Y. Hao, K. Hwang, L. Wang, And [Link],“Disease Predic- tion By
Machine Learning Over Big Data From Healthcare Communities”, Ieee Access, Vol. 5, No. 1,
Pp. 8869–8879, 2024.

[3] Carol Clark, Balasubramanian, Satyabhama, And Balaji Subramanian. ”Symp- tom Based
Disease Prediction In Medical System By Using K-Means Algo- rithm.” International Journal
Of Advances In Computer Science And Technology 3(2023).

[4] David Davis, P. K. Anooj, “Clinical decision support system: Risk level predic- tion ofheart
disease using weighted fuzzy rules,” J. King Saud Univ.-Comput. Inf. Sci., vol. 24, no. 1,
pp. 27–40, 2023.

[5] E. Meshram Ali, Chai, Y., He, L., Mei, Q., Liu, H. and Xu, L., Deep Learning Through Two-
Branch Convolutional Neuron Network for Glaucoma Diagnosis. Proceedings of International
Conference on Smart Health, pp. 191-201, Springer, 2022.

[6] G. Divya, Zhang, J., Luo, Y., Jiang, Z. and Tang, X., Regression Analysis and Prediction of
Mini-Mental State Examination Score in Alzheimer’s Disease Us- ing Multi-granularity
Whole-Brain Segmentations. Proceedings of International Conference on Smart Health, pp.
202-213. Springer, 2022.

[7] G. Patle Ali, Liu, Y. and Choi, K.S., Using Machine Learning to Diagnose Bacte- rial Sepsis in
the Critically Ill Patients. Proceedings of International Conference on Smart Health, pp. 223-
233, Springer, 2021.
[8] Helen Hayes, Viegas, R., Salgado, C.M., Curto, S., Carvalho, J.P., Vieira, S.M. and
Finkelstein, S.N., Daily prediction of ICU readmissions using feature engi- neering and
ensemble fuzzy modeling. Expert Systems with Applications, 79, pp.244-253, 2021.

[9] Ian Ingram, M. Villarroel, A.T. Reisner, G. Clifford, L. Lehman, G.B. Moody,
T. Heldt, T.H. Kyaw, B.E. Moody, R.G. Mark. Multiparameter Intelligent Mon- itoring in
Intensive Care II (MIMIC-II): A public-access ICU database. Critical Care Medicine
39(5):952- 960; doi: 10.1097/CCM.0b013e31820a92c6, 2020.

Jessica Johnson, Dong, Y., Wang, Q., Zhang, Q. and Yang, J., Classification of Cataract Fundus Image
Based on Retinal Vascular Information. Proceedings of International Conference on Smart Health, pp. 1

You might also like