Chat Bot Report
Chat Bot Report
AND TECHNOLOGY
(An Autonomous Institution, Affiliated to Anna University, Chennai)
Natham, Dindigul - 624 014
BUILDING A CHATBOT
Submitted by
Supervisor/Guide
April 2025
ABSTRACT
This project presents the development of a Medical Expert System Chatbot with a graphical
user interface (GUI) that assists users in obtaining preliminary medical diagnoses based on re-
ported symptoms. The system leverages rule-based expert systems using the Python ’experta’
library for diagnosis logic and ’tkinter’ for creating an intuitive GUI. The chatbot accepts user-
provided symptoms, analyzes them against predefined medical rules, and generates appropriate
diagnoses along with recommended medications and dosages. The system also maintains pa-
tient history, allows for feedback collection, and provides a user-friendly interface accessible
to individuals without medical expertise. Testing demonstrated the system’s effectiveness in
diagnosing common conditions such as flu, migraines, and respiratory issues with clear, ap-
propriate medical recommendations. The Medical Expert System Chatbot serves as a valuable
preliminary screening tool, although it emphasizes the importance of professional medical con-
sultation for serious conditions.
i
ACKNOWLEDGEMENTS
We would like to express our sincere gratitude to our guide, Dr. John Doe, for providing in-
valuable guidance and support throughout the project. We are also thankful to the Department
of Computer Science and Engineering, NPR College of Engineering and Technology, for pro-
viding the necessary resources and infrastructure to complete this project successfully.
We extend our appreciation to our friends and family for their constant encouragement and
moral support during the course of this project.
ii
Contents
ABSTRACT i
ACKNOWLEDGEMENTS ii
LIST OF FIGURES v
LIST OF TABLES vi
1 INTRODUCTION 1
1.1 OVERVIEW OF CHATBOTS . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 MOTIVATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 OBJECTIVES OF THE PROJECT . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 COMPARISON WITH EXISTING SYSTEMS . . . . . . . . . . . . . . . . . 2
2 TECHNOLOGIES USED 4
3 PROJECT REQUIREMENTS 5
3.1 HARDWARE REQUIREMENTS . . . . . . . . . . . . . . . . . . . . . . . . 5
3.2 SOFTWARE REQUIREMENTS . . . . . . . . . . . . . . . . . . . . . . . . . 5
3.3 TOOLS AND PLATFORMS . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4 SYSTEM DESIGN 7
4.1 ARCHITECTURE OF THE CHATBOT . . . . . . . . . . . . . . . . . . . . . 7
4.2 FLOW OF THE CHATBOT . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.3 COMPONENTS OF THE SYSTEM . . . . . . . . . . . . . . . . . . . . . . . 8
5 METHODOLOGY 10
5.1 DEVELOPMENT PROCESS . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
5.2 GUI DEVELOPMENT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5.3 EXPERT SYSTEM IMPLEMENTATION . . . . . . . . . . . . . . . . . . . . 11
5.4 TESTING AND EVALUATION . . . . . . . . . . . . . . . . . . . . . . . . . 12
iii
6 RESULTS AND DISCUSSION 13
6.1 FUNCTIONALITY RESULTS . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.2 CHALLENGES FACED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
6.3 USER FEEDBACK ANALYSIS . . . . . . . . . . . . . . . . . . . . . . . . . 15
7 CONCLUSION 16
8 FUTURE WORK 17
A CODE LISTING 19
B SAMPLE OUTPUTS 20
iv
List of Figures
v
List of Tables
vi
LIST OF SYMBOLS AND ABBREVIATIONS
vii
Chapter 1
INTRODUCTION
1.2 MOTIVATION
1. Accessibility: Many individuals face barriers to accessing timely information due to ge-
ographic, financial, or time constraints. A chatbot provides an accessible alternative for
preliminary information.
3. Preliminary Screening: By offering initial assessments based on user inputs, the chatbot
can help users determine whether their query warrants further expert attention or could
be resolved with basic information.
4. Education: The system can serve as an educational tool, helping users understand the
relationship between queries and potential solutions.
1
5. Record Keeping: The ability to maintain user history provides continuity and allows for
tracking progression over time.
1. To develop a rule-based expert system capable of analyzing user inputs and providing
appropriate responses.
3. To implement a system for storing and retrieving user histories to provide context-aware
responses.
7. To design a system that balances simplicity for non-technical users with accuracy and
reliability.
1. Commercial Chatbots: Systems like IBM Watson Assistant and Microsoft Bot Frame-
work provide sophisticated platforms for building conversational interfaces but require
significant technical expertise to deploy.
2. Domain-Specific Systems: Specialized chatbots exist for healthcare (Ada Health, Baby-
lon Health), customer service, and education, each optimized for their specific domain
but often limited in flexibility.
3. Open-Source Frameworks: Tools like Rasa and Botpress offer customizable chatbot de-
velopment platforms but require programming knowledge and infrastructure setup.
2
4. Rule-Based vs. ML-Based: Many systems combine rule-based approaches with machine
learning techniques to improve accuracy over time, while our system primarily uses rule-
based logic for transparent decision-making.
3
Chapter 2
TECHNOLOGIES USED
1. Rule-Based Expert Systems: These systems use predefined rules created by domain ex-
perts to make decisions based on user inputs. The primary advantages include trans-
parency in decision-making processes and reliability for well-defined problems. How-
ever, they may struggle with novel situations not covered by existing rules.
2. Natural Language Processing (NLP): Enables chatbots to understand user inputs in nat-
ural language, improving the conversational experience. While not implemented in the
current version of our chatbot, NLP represents a potential future enhancement.
4. User Interface Technologies: Modern GUI frameworks like tkinter (Python), React, or
Flutter enable the creation of accessible interfaces that facilitate interaction with the un-
derlying expert system.
5. Data Management: Systems for storing and retrieving user information, typically using
structured databases or simpler file-based storage like CSV files.
The current project primarily utilizes rule-based expert systems through the ’experta’ li-
brary, a Python implementation of the CLIPS rule-based language, combined with a tkinter
GUI for user interaction.
4
Chapter 3
PROJECT REQUIREMENTS
The hardware requirements for developing and running the Chatbot are relatively modest, mak-
ing the system accessible on standard computing equipment.
Component Specification
Operating System Windows 10/11, macOS, or Linux
Programming Language Python 3.7 or higher
Expert System Library Experta 1.9.4
GUI Framework tkinter (included with Python)
Additional Libraries csv (standard library)
5
1. Visual Studio Code: Primary integrated development environment (IDE) for coding and
debugging.
4. Experta Documentation: Reference materials for implementing the rule-based expert sys-
tem.
6
Chapter 4
SYSTEM DESIGN
The Chatbot follows a modular architecture that separates the user interface from the expert
system core. This design facilitates maintainability and allows each component to be developed
and tested independently.
System Architecture
1. User Interface Layer: Implemented using tkinter, this layer handles all user interactions,
input collection, and result display. It includes forms for user information, input selec-
tion, and feedback collection.
2. Expert System Core: Built using the Experta library, this component contains the knowl-
edge base in the form of rules and facts. It processes inputs and user data to generate
responses.
3. Data Management Layer: Handles the reading and writing of user records and feedback
to persistent storage (CSV files).
4. Controller Layer: Coordinates the flow of data between the UI, expert system, and data
management components.
7
This modular architecture allows for future enhancements, such as expanding the knowl-
edge base or replacing the UI with alternative interfaces (e.g., web-based or mobile).
Chatbot Flow
1. User Identification: The user enters their name and relevant information. The system
checks for existing records associated with the name.
3. Input Collection: The user selects inputs from predefined options or enters custom inputs.
4. Input Analysis: The expert system processes the inputs and user data.
5. Response Generation: Based on the rules in the knowledge base, the system generates a
response along with recommendations.
6. Result Presentation: The response and recommendations are displayed to the user in a
clear, readable format.
7. Feedback Collection: The user provides feedback on the usefulness and accuracy of the
response, which is stored for future analysis.
This flow ensures a comprehensive user experience while maximizing the effectiveness of
the expert system’s capabilities.
1. InputChecker Class: This is the core expert system component that inherits from Ex-
perta’s KnowledgeEngine. It contains rules that match patterns of inputs to specific
responses and recommendations. The rules incorporate user-specific logic to provide
appropriate information.
8
2. ChatbotGUI Class: This class implements the graphical user interface using tkinter. It
includes:
4. Main Application Loop: Initializes the GUI and maintains the application state.
Each component is designed with clear responsibilities and interfaces, allowing for inde-
pendent development and testing.
9
Chapter 5
METHODOLOGY
1. Requirement Analysis: Identifying the core functionalities needed for a useful chatbot,
including:
2. Knowledge Base Development: Creating the rules based on common inputs and condi-
tions.
4. GUI Design: Creating wireframes and mockups for the user interface.
This methodology allowed for progressive development and validation of each component
before final integration.
10
5.2 GUI DEVELOPMENT
The GUI was developed using tkinter, Python’s standard GUI toolkit. The interface design
focused on usability, clarity, and accessibility.
Key design considerations included:
1. Tab-based Organization: Separate tabs for input (user information and inputs) and output
(response and feedback) create a clear workflow.
2. Responsive Layout: The interface adapts to different screen sizes while maintaining read-
ability.
3. Visual Hierarchy: Important elements like response results are displayed prominently.
4. Error Prevention: Input validation ensures that required fields are completed and data is
in the expected format.
5. Accessibility: Clear labels, adequate spacing, and logical tab order improve usability.
6. Contextual Information: Previous records are displayed when available, providing valu-
able context.
Implementation details:
1. Widget Selection: Appropriate widgets were chosen for different types of input:
2. Event Handling: The interface responds to user actions through event bindings:
3. State Management: The application maintains its state across tab changes and user inter-
actions.
The expert system was implemented using the Experta library, which provides a Python imple-
mentation of a rule-based system. The implementation focused on creating rules that accurately
map inputs to responses.
Each rule in the expert system consists of:
11
1. Antecedents: Conditions that must be true for the rule to fire (inputs and user conditions)
2. Consequents: Actions to take when the rule fires (setting response and recommendation
information)
The expert system processes facts (inputs and user data) against these rules to determine
the appropriate response.
The Chatbot underwent systematic testing to ensure its reliability and accuracy:
2. Integration Testing: The integrated system was tested for proper communication between
components:
3. User Testing: The complete system was tested with sample user scenarios:
4. Validation: The responses and recommendations were validated against domain knowl-
edge to ensure appropriateness.
Test results were used to refine both the expert system rules and the GUI design, improving
the overall functionality and user experience.
12
Chapter 6
The Chatbot successfully implemented all planned features and demonstrated reliable perfor-
mance across various test scenarios.
Sample Diagnosis for Flu Symptoms
1. Accurate Input Analysis: The system correctly matched input combinations to appropri-
ate responses according to the implemented rules.
3. User History Integration: The system successfully retrieved and displayed previous
records, providing valuable context for returning users.
13
4. Feedback Collection: User feedback was properly collected and stored for future analy-
sis.
5. Clear Warning System: For potentially serious conditions, the system prominently dis-
played warnings about seeking appropriate attention.
The system demonstrated reliable performance across all test cases, correctly implementing
the rules and providing appropriate guidance.
During the development and testing of the Chatbot, several challenges were encountered:
1. Rule Complexity: Creating a comprehensive set of rules that accurately capture the rela-
tionship between inputs and conditions proved challenging. The current implementation
includes only basic conditions and would need expansion for more comprehensive cov-
erage.
2. Input Ambiguity: Many inputs can be associated with multiple conditions, making defini-
tive response difficult. The system currently handles this by focusing on specific input
combinations but could benefit from a more nuanced approach.
3. GUI Responsiveness: Ensuring the GUI remained responsive while processing rules and
retrieving records required careful implementation of threading and event handling.
4. Data Validation: Implementing robust validation for user inputs to prevent errors while
maintaining a seamless user experience required careful attention to detail.
5. Warning Communication: Balancing the need to provide clear warnings for serious con-
ditions without causing unnecessary alarm required thoughtful interface design.
These challenges were addressed through iterative development and testing, resulting in a
system that successfully manages these complexities.
14
6.3 USER FEEDBACK ANALYSIS
While the system includes functionality for collecting user feedback, comprehensive analysis
of user responses would require deployment to a broader audience over an extended period.
Initial feedback from testing indicates:
1. Interface Usability: The tab-based design and clear workflow were well-received by test
users.
2. Response Clarity: Users appreciated the clear presentation of diagnoses and recommen-
dations.
3. Warning Effectiveness: The prominent display of warnings for serious conditions was
considered appropriate and helpful.
This feedback provides valuable direction for future enhancements to the system.
15
Chapter 7
CONCLUSION
The Chatbot successfully demonstrates the potential of rule-based expert systems combined
with user-friendly interfaces for providing guidance. By implementing a knowledge base of
common conditions and inputs, the system offers valuable assistance to users seeking to under-
stand their concerns.
Key conclusions from this project include:
1. Expert System Viability: Rule-based expert systems remain viable and valuable for struc-
tured domains where clear relationships exist between inputs and conditions.
3. User History Value: Maintaining and leveraging user history provides valuable context
that improves the relevance of recommendations.
5. Feedback Integration: Building mechanisms for user feedback enables continuous im-
provement of both the knowledge base and the user interface.
The Chatbot serves as a promising foundation for more sophisticated assistance tools,
demonstrating that even relatively simple rule-based systems can provide valuable guidance
when paired with thoughtful interface design.
16
Chapter 8
FUTURE WORK
While the current implementation of the Chatbot provides useful functionality, several oppor-
tunities for enhancement and expansion exist:
2. Machine Learning Integration: Adding machine learning components could enable the
system to improve response accuracy based on feedback and outcomes.
3. Multilingual Support: Adding support for multiple languages would make the system
accessible to diverse populations.
5. Voice Interface: Implementing voice recognition and synthesis would improve accessi-
bility for users with visual impairments or limited typing ability.
These enhancements would build upon the solid foundation established in the current im-
plementation, creating a more comprehensive and powerful tool for guidance.
17
Bibliography
18
Appendix A
CODE LISTING
19
Appendix B
SAMPLE OUTPUTS
This appendix would contain additional screenshots showing the chatbot in action, including
user interface elements and interaction examples.
20
Appendix C
This appendix would contain detailed explanations of each rule in the expert system, including
their conditions, actions, and the reasoning behind their implementation.
21