0% found this document useful (0 votes)
19 views18 pages

AI Health Diagnosis Assistant Report

The project report details the development of the AI Health Diagnosis Assistant, a web application designed to provide preliminary health diagnoses based on user-reported symptoms using AI and NLP technologies. It outlines the objectives, methodology, tools used, and challenges faced during the project, emphasizing the importance of user experience and ethical considerations. Future enhancements are proposed to expand the application's capabilities, including dynamic knowledge updates and integration of multi-modal inputs.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views18 pages

AI Health Diagnosis Assistant Report

The project report details the development of the AI Health Diagnosis Assistant, a web application designed to provide preliminary health diagnoses based on user-reported symptoms using AI and NLP technologies. It outlines the objectives, methodology, tools used, and challenges faced during the project, emphasizing the importance of user experience and ethical considerations. Future enhancements are proposed to expand the application's capabilities, including dynamic knowledge updates and integration of multi-modal inputs.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Project Report on AI Health Diagnosis Assistant

A training report Submitted in partial fulfillment of the requirements

for the award of degree of [Link] CSE (AI and ML)

Submitted to

LOVELY PROFESSIONAL UNIVERSITY PHAGWARA, PUNJAB

SUBMITTED BY

Name of student: Rohit Thakur


Registration Number: 12306142

From June 2025

to

July 2025
To whom so ever it may concern
I, Rohit Thakur, 12306142, hereby declare that the work done by me on “AI Health Diagnosis
Assistant” from June, 2025 to July, 2025, is a record of original work for the partial fulfillment of
the requirements for the award of the degree, [Link] Computer Science Engineering.

Rohit Thakur (12306142)


Training certification from organization
List of Figures/Charts

S. No. Title Page

1.1 AI Health Diagnosis Assistant Workflow 9

2.1 Backend System Architecture 14

2.2 Frontend User Interface (Initial View) 15

2.3 Frontend User Interface (Diagnosis Result View) 16


List of Abbreviations

S. No. Title

1. AI: Artificial Intelligence

2. NLP: Natural Language Processing

3. Flask: A Python Web Framework

4. HTML: HyperText Markup Language

5. UI: User Interface

6. CSV: Comma-Separated Values

7. API: Application Programming Interface


Chapter-1

INTRODUCTION OF THE PROJECT UNDERTAKEN

The healthcare industry is experiencing a rapid evolution driven by technological


innovation. One of the most promising areas is the application of Artificial Intelligence
(AI) to assist in preliminary diagnosis. The volume of health information available
online is vast, but it can be overwhelming for individuals to navigate and interpret their
symptoms accurately. Misinterpretation can lead to unnecessary anxiety, delayed care,
or self-misdiagnosis. This project, AI Health Diagnosis Assistant, aims to address this
challenge by providing a smart, user-friendly tool that offers a quick and preliminary
diagnosis based on a patient's description of their symptoms. The core purpose is not to
replace a medical professional but to act as a supportive tool that empowers users with
information and helps them better articulate their concerns.

This project is a direct application of the concepts and skills learned during my summer
course, "AI powered NLP," completed at AlgoTutor. The course provided the
foundational knowledge in natural language processing and machine learning models,
which were essential for designing and implementing the core predictive functionality
of this assistant.

1.1 Objectives of the Work Undertaken


The primary objectives of this project were meticulously planned to ensure a robust and
functional application:
1. Develop a user-friendly web application that serves as a seamless interface for
users to input their health symptoms. The goal was to create a simple form that
captures essential patient details and a description of their ailment, providing a clear
and accessible entry point for the user.

2. Build a machine learning model pipeline capable of processing natural language


descriptions of symptoms. This involved selecting a suitable model that could
understand the semantic meaning of text rather than just keywords, a crucial step for
accurate symptom matching.
3. Create a comprehensive knowledge base of diseases by leveraging a structured
dataset. This required careful utilization of cleaned_data.csv, which contains a
curated list of disease names, detailed symptom descriptions, and verifiable source
URLs from trusted medical institutions like MedlinePlus.

4. Implement a similarity-based prediction engine to match user-provided


symptoms to the most relevant disease in the knowledge base. The methodology
behind this engine needed to be both computationally efficient and highly accurate.

5. Provide a confidence score with each prediction to indicate the model's certainty.
This is a critical feature to manage user expectations and underscore that the output
is a probabilistic assessment, not a definitive medical diagnosis.

6. Ensure a clear and simple user experience by displaying the diagnosis in an easy-
to-read format and providing an external, reputable source for further reading.

1.2 Scope of the Work

The scope of this project is focused on developing a functional proof-of-concept


application. The system's functionality is defined by its ability to accept a natural
language query (symptom description) and return the most probable disease from its
static, pre-loaded knowledge base. The report documents the development of the
frontend interface ([Link]), the backend logic ([Link]), and the integration of a
pre-trained machine learning model and its data assets. It is important to note that
this system operates within a controlled environment and does not handle real-time
medical data, nor does it provide personalized medical advice.
1.3 Importance and Applicability

This project holds significant importance by demonstrating the practical application


of machine learning in a real-world, high-impact domain. Its applicability extends
beyond a simple demonstration and can be a valuable tool in several contexts:

• Patient Education: It serves as an accessible and immediate tool for individuals


to better understand their health concerns, helping them prepare for a
consultation with a doctor.

• Preliminary Self-Assessment: It can help users articulate their symptoms more


effectively, leading to more productive conversations with healthcare
professionals.

• Research and Development: The underlying model and methodology provide a


solid foundation that can be expanded for more complex applications, such as a
triage system in a non-critical healthcare setting.

• Educational Tool: This project can serve as a powerful example in computer


science and data science curricula, showcasing how theory translates into a
practical and impactful application.
1.4 AI Health Diagnosis Assistant Workflow

This flowchart illustrates the complete journey of a user's symptom query through
the application, from the frontend to the backend and back again. It highlights the
key processes and components involved in generating a diagnosis.
Chapter-2

DETAILED WORK DESCRIPTION

This chapter provides a detailed description of the systematic process undertaken during
the development of the AI Health Diagnosis Assistant. The project was broken down
into a series of logical steps, from environmental setup to the implementation of the
core predictive functions.

2.1 Tools and Technologies Used

The choice of technologies was guided by the need for a solution that was both
powerful and easy to prototype. The selected stack is a modern and efficient
combination for building machine learning-powered web applications.

1. Python
The core language for the backend, chosen for its extensive libraries and readability.

2. Flask
A lightweight web framework that provided a simple and effective way to create a web
API for the model.

3. sentence-transformers
This library was selected for its ability to convert sentences into dense vector
embeddings, capturing semantic meaning far more effectively than traditional methods
like bag-of-words.

4. scikit-learn
A powerful machine learning library whose cosine_similarity function was used to
calculate the similarity between text embeddings.

5. NumPy
Used for high-performance numerical operations, particularly for handling the large
[Link] array.
6. HTML & Tailwind CSS
A clean and responsive frontend was built using HTML, with all styling handled by a
single Tailwind CSS CDN link, ensuring a modern look without complex style sheets.

2.2 Methodology
The project's methodology was carefully structured to ensure a smooth and logical
development process.

1. Data Acquisition and Preparation:


The project began with the cleaned_data.csv file, which served as the
foundation of the knowledge base. This file was thoroughly analyzed to
understand its structure, which included columns for
Generated_Sentence_From_symptoms, Disease_Name, and Source_URL. This
data was then pre-processed to ensure consistency, though minimal cleaning was
required as the data was already in a suitable format.

2. Model Loading and Embedding: For optimal performance, the application's


core assets were loaded into memory only once when the Flask server started.
This included:

• The pre-trained SentenceTransformer model, which is a large language model


designed to produce high-quality sentence embeddings.
• The [Link] file, a NumPy array containing the vector representations
of all symptom descriptions from the cleaned_data.csv. This pre-computation
avoids the significant delay of generating embeddings for each new user query.

3. Prediction Logic: When a user submits their symptoms via the web form, the
backend's prediction function is invoked. This function performs the following
steps:
• It takes the user's free-form text input and encodes it into a single vector using
the loaded SentenceTransformer model.
• It then computes the cosine similarity between this new vector and every single
vector in the [Link] array. Cosine similarity is a measure of the angle
between two vectors, with a score of 1.0 indicating identical direction (high
similarity) and 0.0 indicating no similarity.
• The function identifies the index corresponding to the highest similarity score.
This index is used to retrieve the most relevant disease name, matched symptom
sentence, and source URL from the pre-loaded data structures.

4. User Interface and Display: The results are then passed back to the [Link]
template. The Jinja2 templating engine is used to dynamically render the
prediction_text within a dedicated div element, creating a seamless feedback
loop for the user.

2.3 Challenges Faced and How They Were Tackled

The development process, while successful, was not without its challenges.
1. Dependency Management: A major hurdle was ensuring all the Python
packages, especially sentence-transformers and its underlying dependencies,
were installed correctly. This was compounded by potential version conflicts.
The solution was to create a dedicated virtual environment and to be mindful of
the Python version used, as certain libraries might have compatibility issues with
the latest Python releases.

2. Model Performance: Loading a large language model and a significant data file
([Link]) can be memory-intensive. The chosen approach of loading
these assets only once at startup was a critical design decision that prevented
performance bottlenecks on subsequent user requests, ensuring a responsive user
experience.

3. Scalability: The current architecture is well-suited for a single-user prototype.


However, to scale for multiple users, the system would need to handle
concurrent requests efficiently. This challenge was noted for future work, with
potential solutions including asynchronous programming in the backend or
containerization for easier deployment on cloud platforms.

4. Ethical Considerations: The project, while a proof-of-concept, deals with


sensitive health-related information. A key challenge was to ensure that the user
understood the limitations of the tool. This was addressed by implementing a
clear disclaimer on the front page, explicitly stating that the tool is for
informational purposes only and is not a substitute for professional medical
advice.

2.4 Learning Outcomes


This project provided invaluable practical experience and knowledge in several key
areas of software engineering and data science:
• End-to-End Development: Gained hands-on experience in building a full-stack
application, from designing the frontend to implementing the backend and
integrating a machine learning model.

• Machine Learning Application: Learned to apply complex NLP models like


SentenceTransformer in a practical context, understanding the concepts of
embeddings and similarity scoring.

• Performance Optimization: Developed an understanding of the trade-offs


between pre-computation and real-time processing to optimize application
performance and user experience.

• Data Handling: Gained experience in managing and utilizing structured data


(.csv files) and large numerical arrays (.npy files) within a Python application.

• Project Management: Learned to structure a project with clear goals, manage


dependencies, and document the process, which is essential for collaborative and
professional work.
2.5 Backend System Architecture This diagram visually represents the flow of data
and the interaction between the different layers of your application. It serves as a high-
level blueprint of the entire system.
2.6 Frontend User Interface

The frontend of the application is designed to be clean, intuitive, and user-friendly.


It is a single-page interface powered by a Flask backend and styled with Tailwind
CSS for a modern, responsive design. To demonstrate the user journey, two key
views of the interface have been captured.

• Initial View: The first image shows the web application's landing page,
presenting a form where users input their personal information and a free-
form text box to describe their symptoms. The form is designed with clear
labels and a minimal aesthetic to reduce cognitive load. The color palette,
dominated by soft blues and subtle shadows, creates a calming and
trustworthy atmosphere. This view highlights the application's readiness to
receive user data, making the initial interaction seamless and inviting.
• Diagnosis Result View:

The second image displays the same page after a user has submitted their
symptoms. A new section, styled with a clear border and a vibrant color
(e.g., green for a positive result or a more neutral tone), appears below the
form. This section prominently displays the predicted diagnosis, the
matched symptom sentence from the knowledge base, a confidence score
from the model, and a hyperlink to a trusted external source. This view
showcases the application's core functionality and how the results are
presented clearly and responsibly to the user.
Final Chapter-

CONCLUSION AND FUTURE PERSPECTIVE

The AI Health Diagnosis Assistant successfully demonstrates the power of machine


learning in creating a practical and accessible tool for preliminary health information.
By using the SentenceTransformer model and cosine similarity, the application can
accurately match a user's symptom description to a pre-defined disease, providing a
quick diagnosis and a reliable source for more information. The project's modular
design, with a clear separation of frontend, backend, and model assets, makes it robust
and easy to understand.

Summary of Findings and Key Observations

The project's core functionality is a successful demonstration of NLP in action. The


model proved to be highly effective at identifying relevant diseases based on symptom
descriptions, as evidenced by the high confidence scores on targeted inputs. The use of
pre-computed embeddings significantly improved the application's performance,
allowing for near-instantaneous predictions once the server is running. This design
choice effectively manages the computational overhead of the large language model.
The user interface is simple and intuitive, making the tool easy for non-technical users
to operate. The project successfully integrated a complex machine learning pipeline into
a simple web application, providing a solid foundation for future development.
Future Scope and Applicability The potential for this project is significant, and it
serves as a robust base for future work. A number of enhancements could transform it
from a proof-of-concept into a more advanced and robust tool:

• Dynamic Knowledge Base: Develop a system to automatically update the


disease and symptom knowledge base from trusted health data sources. This
would ensure the information remains current and comprehensive.

• Multi-Modal Input: Integrate a computer vision model to analyze images of


physical symptoms like skin rashes. The model would combine the visual
analysis with the text-based symptom analysis to provide a more accurate and
comprehensive diagnosis.
• Top-N Predictions: Modify the prediction logic to return the top three or five
most likely diseases, giving the user a more nuanced view of the possibilities
with their confidence scores.

• User Feedback Loop: Implement a feature that allows users to rate the accuracy
of the diagnosis. This data could then be used to fine-tune and retrain the model
over time, making it smarter and more accurate with each interaction.

• Personalization and Health History: Store a user's health history (with strict
privacy and security controls) to provide more tailored predictions based on their
unique profile. This could include factors like age, gender, and pre-existing
conditions.

• Mobile Application: Port the web application to a mobile platform using


frameworks like React Native or Flutter to increase its accessibility and
portability.

These enhancements would not only improve the accuracy and utility of the assistant
but also make it a more comprehensive and trusted resource for health-related inquiries,
demonstrating a clear path from a successful prototype to a powerful, real-world
application.

You might also like