Global Scientific Platform
Serving Researchers Since 2012
IJERT-MRP IJERT-MRP

An AI-Driven Web Application for Mental Health Self-Assessment with Secure User Management and Intelligent Chatbot Support

DOI : 10.17577/IJERTV14IS050168

Download Full-Text PDF Cite this Publication

Text Only Version

An AI-Driven Web Application for Mental Health Self-Assessment with Secure User Management and Intelligent Chatbot Support

Shresth Gautam, Divyendra Singh, Anisha Chaudhary,

Under Graduate Student, Department of Computer Science and Applications,

School of Engineering and Technology, Sharda University, Greater Noida 201310, India.

Dr. Anand Pandey

Associate Professor, Department of Computer Science and Applications,

School of Engineering and Technology, Sharda University, Greater Noida 201310, India

Abstract Mental health disorders are a global problem that needs simple, scalable and smarter solutions for early detection and intervention. This study emphasized a full-stack AI-fueled web application for users to self-report their mental health. The system predicts a user's mental health using Support Vector Machine (SVM) model based on a cleaned and encoded mental health dataset and user self-reported data, with the SVM prediction, there is also an interactive and conversational deep learning based chatbot- Ashgen- for conversational support and guidance and a more engaging and positive user experience.

The application uses MySQL for user data storage. To restrict the access to user data using a secure password, werkzeug.security was used to hash the password to support the integrity in confirmation of user identities. The front end of the application used Flask. The application provides a responsive, modern UI design to support users accessibility and usability. Beyond providing the user an application for their mental health screening, the multi-component system supports their digital wellness with secure interactions through real-time AI. The paper provides the foundation for a path to other smart technology- augmented mental health platforms that utilizes intelligent automation, emotional support.

Keywords- Mental Health, SVM, Chatbot, Flask, User Authentication, Deep Learning, MySQL, Predictive Analytics

  1. INTRODUCTION

    1. Background

      Mental health is a foundation of human health that influences thinking, emotion, and behavior during every passage of life. The World Health Organization (WHO) states that one in eight people worldwide are living with a mental disorder, with depression and anxiety being one of the leading reasons for disability around the world. While a serious issue, recognizing mental health remains underdiagnosed and undertreated. This is especially true in areas with fewer mental health professionals

      or with cultural stigmas that hamper open discussion about these issues.

      Thus far, advancements in technology, particularly, digital technologies, have created new possibilities in monitoring and assessing mental health, as well as delivering interventions. AI- based systems can leverage patterns in complex behavioral data and make identifiable patterns and preliminary assessments. Coupling this with conversational agents (chatbots) offers patients and others immediate, empathetic responses that closely simulate human companionship, enhanced emotional self-reflection, and resilience.

      This research presents a privately-secured, AI-based mental health self-assessment system that integrates predictive modeling, intelligent conversation, and modern web technology. The prototype includes a machine learning-based mental health classifier based

      on a Support Vector Machine (SVM) that was trained on user- reported attributes. It also features a deep learning-powered chatbot named Ashgen, which is crafted to mimic natural conversation and help users navigate their mental health reflections in a supportive, non-judgmental way.

    2. Problem Statement

      As the mental health crisis continues to grow, countless individuals find themselves without access to professional support due to financial, geographical, or social hurdles. Even when resources are available, long wait times, a shortage of clinicians, and the stigma surrounding mental health can discourage people from seeking help. Additionally, early signs of mental distress often go unnoticed, allowing issues to worsen before any intervention takes place.

      This highlights a pressing need for proactive, intelligent systems that enable users to conduct preliminary self- assessments of their mental health in a private, secure, and user-

      friendly environment. However, creating such systems demands a thoughtful integration of machine learning models, conversational AI, secure data management, and an intuitive front-end that encourages user engagement.

    3. Research Motivation

      The inspiration for this project lies at the crossroads of AI, mental health support, and full-stack web development. By harnessing a blend of predictive modeling and conversational agents, we aim to break down the psychological barriers to mental health care and offer users a first step toward understanding their emotional well-being. This system is not intended to replace clinical diagnoses but rather to act as a supplementary tool that empowers users to regularly assess and reflect on their mental health.

      AI models like Support Vector Machines have demonstrated significant potential in identifying patterns within complex mental health data, such as user responses to screening questions. Similarly, well-designed chatbots can replicate empathetic dialogue and provide comfort, particularly to those who may feel isolated. When implemented securely through modern web frameworks, these tools can make a real difference. that allows users to assess their mental health status in real time and receive basic guidance via a secure and intelligent interface. More specifically, this research aims to:

      • Develop a machine learning pipeline for prediction of mental health with a cleaned and labeled dataset (includes age, gender, work environment, family history, and history of mental health conditions).

      • Create and train a deep learning chatbot model that interacts with the user like a chat machine, or friendly virtual colleague and can talk to the user in natural language.

      • Set up a secure user authentication process, including the use of hashing and validation of passwords, to protect users' credentials while registering and logging into the system.

      • Use MySQL for backend data management for stability to provide persistent storage for user profiles and user-chatbot interaction and predictions.

      • Build a visually pleasing and easy to navigate user interface using standard web technologies that will ensure a flexible user experience for diverse types of users.

      • Assess the performance of the system using common machine learning metrics (accuracy, confusion matrix, classification report), and establish the usability and functionality of the system's chatbot model using user testing or logging of events.

    4. Contribution of the Study

      This study contributes a novel, full-stack AI solution in the emerging field of digital mental health assessment. It is evidence that machine learning, chatbot interface, and secure and robust web-based design can combine to provide a linked, affordable service to identify people in need of proactive mental health support. Mental health screening.Research therefore examines not only technical implementation but also aspects of

      usability, ethics, and future directions concerning human- entered AI.There stands a chance that this system may be a scalable solution for educational institutes, corporate wellness programs, and individuals interested in preliminary mental health insights by offering a secure and intelligent platform for users to navigate their mental wellness.

  2. RELATED WORK

    1. AI and Machine Learning in Mental Health Assessment

      The use of artificial intelligence (AI) and machine learning (ML) has been steadily increasing in the mental health domain to enhance diagnostic accuracy, predict mental health disorders, and personalize treatment activities. Methods based on AI, primarily classification models such as support vector machine (SVM), decision trees, and random forests, are gaining popularity because they utilize large datasets with complex patterns.

      More recently, Wang et al. [1] used support vector machines (SVMs) to classify depression from social media posts; this has demonstrated with great accuracy that SVMs can be used in NLP to detect emotional states. This work provides a foundation for extending machine learning into the analysis of user- generated content, which informs much of our application of AI models to predicting mental health states.

      Also, in a comprehensive literature review by Shatte et al. [2], SVMs were reported to have a strong performance on the classification of mental health conditions like depression and anxiety from various datasets, including text and sensor input. Our approach reflects such evidence in that SVMs train to detect mental health status based on user input, thus safeguarding a valid and scalable means of early recognition of possible mental health issues.

      In yet another study, Althoff et al. [3] proposed the use of deep learning models to predict risk for mental health disorders based on behavioral patterns derived from social media. Their findings indicate that AI models may be able to identify early indicators of mental health issues that arise prior to clinical diagnosis, potentially lending themselves to early intervention. Their study extends our understanding of how to leverage AI and social media data to advance predictive capability for mental health applications.

    2. Chatbots in Mental Health and Wellbeing

      Conversational agents, or chatbots, represent a substantial proportion of digital mental health solutions. Chatbots are most commonly used as first-line screening, psychoeducation, and therapy support tools, thus allowing users convenient and scalable assistance.

      Woebot, an AI-enabled mental health chatbot, is one of the most prominent implementations, designed by Fitzpatrick et al. [4]. Woebot provides users with conversations based on Cognitive Behavioral Therapy (CBT) techniques, psychoeducation, and

      tracking interests over time.Upgrading to transformer-based models such as BERT for more nuanced understanding.

      Furthermore, Bickmore et al. [5] designed a relational agent, a type of chatbot, to provide social support to patients with chronic illness. This work showed that personalized and continuous engagement via chatbots can effectively reduce feelings of loneliness and improve mental wellbeing. These studies affirm the growing role of chatbots in offering mental health support and lay the foundation for further development of emotionally intelligent virtual assistants like Ashgen.

    3. Security and Privacy in Mental Health Applications Security is a critical concern in mental health applications, particularly when dealing with sensitive user data such as mental health status, medical history, and personal identifiers. Several studies highlight the importance of implementing robust security measures to safeguard user privacy and prevent unauthorized access.

      Cheng et al. [6] discussed the importance of secure authentication methods in digital mental health applications, proposing password hashing techniques such as bcrypt and PBKDF2 to mitigate the risks of data breaches. This research emphasizes the need for secure user authentication protocols, which we have incorporated into our system by utilizing Flasks werkzeug.security module to securely hash passwords before storage.

      Malhotra and Malhotra [7] outlined essential security measures for mental health applications, emphasizing the use of encryption, secure transmission protocols such as HTTPS, and the protection of user privacy. These guidelines have influenced our implementation of secure login mechanisms, database handling, and communication channels, all aligned with established industry standards to safeguard user information. In addition, multiple studies have underscored the importance of robust data protection policies, especially in areas like informed user consent, data anonymization, and secure storage. Nissenbaum [8], for example, introduced an ethical framework for managing data in health-related applications. Following this approach, our system ensures that all user interactions whether with the chatbot or during mental health assessments are anonymized and securely stored within a MySQL database.

    4. Relational Databases (SQL) in Health Applications

      Relational databases such as MySQL are commonly utilized in health-oriented applications due to their capacity to manage structured data efficiently, accommodate complex queries, and maintain data consistency. Various studies have investigated the benefits of SQL databases in managing user data, especially for applications handling sensitive health data.Ali et al. [9] pointed out the strengths of MySQL use in secure data management in telemedicine apps, pointing to its reliability and scalability in processing patient records. Their paper implies that MySQL's structured design facilitates straightforward querying and

      reporting and hence is a favorite for storing user information in health-oriented web applications.

      In the same vein, Bashir et al. [10] built a chatbot for mental health that utilized MySQL to store user interactions, sentiment scores, and mental health predictions. They discovered that storing data using a relational database made it easy to retrieve and store data while ensuring security, in such a way that their system could grow with user interactions. This method is similar to what we have done to our database architecture, where MySQL is utilized to store user credentials, session information, and prediction results securely.

    5. Full-Stack Web Applications to Monitor Mental Health Some research has been conducted on incorporating full-stack web technologies into mental health monitoring systems. These systems typically comprise a seamless integration of user interfaces, backend logic, machine learning models, and databases to provide users with an intuitive and insightful mental health assessment experience.

      Denecke et al. [11] reviewed various digital mental health tools and identified that successful systems often integrate self- assessment questionnaires, machine learning analytics, and conversational interfaces within user-friendly web platforms. Their emphasis on user-centric design as a key factor in driving engagement and efficacy strongly aligns with the philosophy behind our system, which places usability and accessibility at the core of development.

      Similarly, Vempati et al. [12] demonstrated the feasibility of implementing depression detection using a full-stack approach leveraging Flask and MySQL. Their architecturewhich includes a predictive machine learning backend and a secure databaseclosely mirrors our methodology. Their success underscores the practical advantages of using lightweight Python-based frameworks like Flask for rapid development and smooth model integration, which our application also adopts. Furthermore, Zhang et al. [13] explored how web-based mental health systems can bridge the healthcare access divide, particularly for rural and underserved populations. Teir study highlights the cost-effectiveness and scalability of deploying full-stack solutions on cloud platforms such as Heroku or AWS. This insight directly informs our deployment strategy, reinforcing our goal to make mental health support widely accessible without requiring substantial infrastructure investment.

      Collectively, these studies validate our architectural choices confirming that a full-stack approach combining AI, secure databases, and a responsive frontend is not only technically sound but also impactful in real-world mental health contexts

    6. AI and Ethical Considerations in Mental Health

      Ethical concerns surrounding the use of AI in mental health applications are becoming increasingly important as these technologies become more widespread. In their work, Yadollahi et al. [14] discussed the ethical implications of AI in mental

      health, stressing the importance of transparency, accountability, and user consent when using AI models to analyze sensitive data. Their work emphasizes the need to ensure that AI systems in mental health are designed with user autonomy and privacy in mind.

      In addition, a study by Vayena et al. [15] raised concerns about the potential for algorithmic bias in AI systems, particularly in healthcare, where biases can perpetuate existing inequalities. Their research suggests that machine learning models should be trained on diverse datasets to minimize bias and ensure fair outcomes for all users, a principle that we have incorporated into our model training process.

  3. SYSTEM ARCHITECTURE

    In order to process user inputs and produce predictions, the frontend (user interface) of the system interfaces with the backend server via a client-server architecture. Based on user self-reported data, the machine learning (ML) model in the backend is trained to predict mental health condition. A Flask- based web server coupled with a MySQL database for user administration powers the backend, while the user interface (UI) offers a conversational chatbot experience.3.1 System Components

        1. Frontend (User Interface)

          Fig 1. Login interface allowing registered users to securely access the mental health self-assessment platform.

          Technology: To accommodate a variety of devices, the frontend is constructed with an emphasis on responsive design, utilizing contemporary web technologies like HTML, CSS, and JavaScript. Users can interact with the system in a smooth and dynamic manner by using the React framework.

          Fig 2. Dashboard interface providing access to the self-check questionnaire and chatbot-based support system.

          Fig 3. Questionnaire interface for users to input mental health-related responses used as input for SVM-based prediction.

          Chatbot Interface: The conversational chatbot, which is at the heart of the frontend, enables users to enter their symptoms or worries in plain English. The chatbot guides users through the mental health evaluation by responding with pertinent information based on predefined intents.

          Fig 4. Chatbot interface (Ashgen) demonstrating an example of initial conversation and response using NLP techniques.

          Fig 5. Prediction result display indicating the assessed mental health condition based on the user's submitted data.

          User Interaction Flow: By responding to inquiries about mood, symptoms, lifestyle, and mental health, the user engages with the chatbot. After processing, the results are routed to the backend for guidance and prediction.

          Fig 6: System Architecture. This figure depicts the key components and data flow within the AI-driven mental health assessment system.

        2. Backend (Server and Application Logic)

          Technology: Flask, a lightweight Python framework, is used in the construction of the backend server to manage frontend requests and communicate with the database and machine learning model.

          User authentication: A MySQL database built into the system tracks user activity and safely maintains user credentials (using hashed passwords). Users' private sessions are guaranteed by the authentication system.

          Data Processing: The server cleans and formats the user inputs from the frontend into a format that is appropriate for the machine learning model.

        3. Machine Learning Model (SVM-based Mental Health Predictor)

          Model Type: A Support Vector Machine (SVM) model, trained on a dataset of self-reported mental health data, forms the basis of the mental health prediction. Users are categorized by the model into a number of mental health conditions, such as stress, anxiety, and depression.

          Training: The training dataset is made up of labeled data points that relate lifestyle characteristics and user symptoms to mental health disorders. In order to convert user inputs into numerical vectors that the model can process, feature extraction techniques are used.

          Prediction: The chatbot converts user responses into feature vectors, which are then introduced into the SVM model for categorization. A predicted mental health state and confidence levels are produced by the model.

        4. Database

          Technologies: SQLite for local development or MySQL Functions:

          • Oversees safe user authentication, employing robust hashing methods (like bcrypt) to store login credentials.

          • Preserves session metadata and user account data to enable activity tracking and customized access.

            Specifically, self-assessment data, chatbot interactions, and any personal mental health information are not stored in order to improve user privacy.The database schema is simple and privacy-oriented, and it mostly consists of:

            Users: retains the user ID, hashed password, and username. Strong data protection is guaranteed by this architecture, which also lowers the possibility of sensitive information being revealed and complies with ethical standards for applications pertaining to mental health.

            Fig 7 : MySQL Command Line Interface showing the users table structure and stored credentials within the chatbot database.

        5. Chatbot Engine (Natural Language Processing) Technology: To comprehend and handle user inquiries, the chatbot makes use of Natural Language Processing (NLP) techniques. For text vectorization, it uses pre-trained models such as TF-IDF (Term Frequency-Inverse Document Frequency), and for intent detection and response creation, it uses classification models (like SVM).

          The chatbot understands the intent (e.g., "I am feeling anxious") based on the user's input and uses the predetermined set of responses in the intent JSON to trigger the relevant responses.

          Response Generation: Depending on the identified intent, the chatbot generates dynamic responses that provide suggestions or assistance based on the exchange.

        6. Analytics and Reporting

    Data analysis: By monitoring user mood and engagement over time, the system offers insightful information about changes in users' mental health. Graphical depictions of mood, tension, and anxiety levels during several user sessions are examples of analytics tools.

    3.2 Data Flow

    User Interaction: To respond to inquiries regarding their mental health, the user engages with the chatbot interface.

    Data Submission: After the user responds, the chatbot sends the information to the backend, where it is processed and entered into the database.

    Prediction Request: The machine learning model receives the processed data from the backend in order to make a prediction. Model Prediction: The projected mental health state is produced by the SVM model and sent back to the frontend via the backend.

      1. Machine Learning Model

        1. Data Colletion and Preprocessing

  4. METHODOLOGY

    1. System Overview

      Flask, Python, Scikit-learn, MySQL, and an AI-powered chatbot comprise the contemporary tech stack used to create the suggested Mental Health Self-Assessment Web Application. Users can communicate with an AI-powered chatbot, safely register and log in, complete self-assessment questionnaires to gauge their mental health, and get forecasts based on machine learning models. By integrating security, artificial intelligence, and interactive tools, the program offers a simplified approach from user contact to mental health state prediction.

    2. System Architecture

      The architecture of the proposed system consists of four primary components:

      1. Frontend: A responsive, user-friendly web interface created using JavaScript (with support for AJAX), HTML5, and CSS3.

      2. Backend: Flask, a lightweight Python web framework, is used to create the application's backend. Flask routes handle chatbot interactions, mental health forecasts, user login, and registration.

      3. Database: A MySQL relational database safely houses the user information and chatbot interactions. To protect user data, passwords are scrambled before being saved.

      4. Machine Learning Model: A Support Vector Machine (SVM) model developed with Scikit-learn powers the prediction of mental health state. Based on the user's answers to self- assessment questions, the model is used to forecast the user's mental health status.

        Fig 8: Machine learning pipeline detailing data preprocessing, SVM training, evaluation, and deployment

        The dataset used to train the mental health prediction model includes user answers to a variety of queries about mental health. To prepare it for machine learning, this data is cleaned and processed. The following are the preprocessing steps:

        • Data Cleaning: Missing values, outliers, and unnecessary data are eliminated from the raw dataset.

        • Feature Encoding: Depending on the type of variable, either label encoding or one-hot encoding is used to encode categorical characteristics, such as user answers to survey questions.

        • Feature Scaling: To guarantee that the model gives each continuous feature equal weight, features such as age and self-assessment score are normalized or standardized.

        • Data Splitting: The dataset is split into training and testing sets, typically using an 80-20 split, where 80% of the data is used for training and 20% is used for testing.

          1. Model Training and Evaluation

            The Support Vector Machine (SVM), a supervised learning algorithm frequently used for classification tasks, is used in the mental health prediction model. Because of its excellent performance with high-dimensional, complicated data, the SVM classifier was selected. In this instance, the objective is to categorize users' mental health conditions into mild, severe, and healthy categories.

            Fig 9: Conceptual Illustration of SVM Margin and Hyperplane, showcasing the decision boundary and margin for classification

            SVM Decision Function

            A new data point is classified using SVM's decision function in accordance with the trained model. The decision function's formula is:

            () = +

            where the weight vector (the learned parameters) is denoted by

            .

            The input feature vector is denoted by . The bias term is .

            The sign of () is computed to determine the classification:

            • The class label is positive if () > 0.

            • The class label is negative if () < 0.

            The training.py script, which makes use of Scikit-learn's SVC (Support Vector Classifier) class, is used for training. Following training, the model is assessed using a number of criteria, including:

            • Accuracy: The percentage of all predictions that are accurate.

        1. Chatbot Implementation

          In order to understand and react to customer inquiries, the chatbot, Ashgen, was created utilizing Natural Language Processing (NLP) techniques. The chatbot first employs a bag- of-words strategy, in which user input is tokenized and a response is produced using a straightforward keyword matching method. An intent-response mapping file (intents.json) contains the pre-defined responses of the chatbot.

          1. Intent Recognition

            An integral component of the chatbot is intent recognition. Based on keywords, each user input is matched to a specific goal. When a user inquires about depression, for instance, the chatbot matches the input with the intent connected to depression and reacts appropriately.

          2. Chatbot Features

            • Empathetic Reactions: To make users feel heard and supported, the chatbot is designed to identify emotional clues in user input and respond with empathy.

            • Advice and Suggestions: The chatbot provides advice on mental health resources and makes recommendations for methods of treating mental health issues.

            • Ongoing Interaction: By interacting with users on an ongoing basis, the chatbot promotes camaraderie and support.

          3. Text Processing Bag-of-Words & TF-IDF

            For text processing, the system uses the Bag-of-Words or TF- IDF model, depending on the users query. The TF-IDF formula quantifies the importance of a word in a document relative to a collection of documents. The formula for TF-IDF is:

            TF-IDF(, ) = TF(, ) × IDF()

            Where:

            • TF(, )is the term frequency of term in document .

            • IDF()is the inverse document frequency of term , calculated as:

              N

              IDF(t) = log ()

            • Confusion Matrix: To show how well the model performs on the test and training datasets.

            • Precision, Recall, and F1-Score: To assess how well the model

              Where:

              df(t)

              predicts each class, particularly in cases where the data is unbalanced.

              The trade-off between the true positive rate and false positive rate is measured by the ROC-AUC, a performance evaluation tool.

              4.3.3 Model Deployment

              After training, the SVM model is integrated into the Flask application and stored as a pickle file (svm_model.pkl). Based on user input, the model is used in the /predict_mental_status route to produce predictions about mental health.

              • is the total number of documents.

              • ()is the number of documents containing the term

              This model helps represent text data and allows the system to identify important words in the context of user queries, which is essential for the chatbot's performance.

        2. Chatbot Training Cross-Entropy Loss

          If the chatbot utilizes deep learning techniques, Cross-Entropy Loss is used as the loss function for training. Cross-Entropy Loss measures the performance of the classification model,

          where the output is a probability value between 0 and 1. The formula for Cross-Entropy Loss is:

          = log()

          Where is the true label and is the predicted probability

          This formula is used to minimize the error between predicted and actual output during training, helping the model learn to better classify user intents and improve chatbot responses.

        3. User Authentication

          <>The program has a strong user authentication system in place for security. Using their login credentials, users can safely register and log in. While werkzeug. security is used to hash passwords prior to their storage in the MySQL database, the Flask-Login extension controls user sessions. This guarantees that user credentials are safe even in the event that the database is compromised.

          1. Password Hashing

            User credentials are not saved in plain text to improve security. Rather, the generate_password_hash() function is used to hash them, and check_password_hash() is used to verify them during login. To increase security, the PBKDF2 password hashing technique is used with a salt.

          2. Session Management

            Flask-Login, which monitors user behavior and makes sure that only authenticated users can access the chatbot services and mental health self-assessment forms, is used to manage user sessions.

        4. Database Design

          The MySQL database is used to store various aspects of user data securely, including:

          User credentials, such as hashed passwords and usernames, are kept in the users table.

          • Chatbot Interactions: To enhance the service and enable users to review earlier conversations, the chatbot keeps track of its conversations.

          • Mental Health Assessments: For analysis and reporting purposes, the outcomes of self-assessments, including scores and forecasts, are kept in a different table.

        5. UI/UX Design

      The application's frontend is made to be accessible, contemporary, and easy to use. Its interface is smooth, clear, and aesthetically pleasing thanks to its glassmorphism design. AJAX and other interactive features are incorporated to facilitate seamless user-system interactions, especially when communicating with the chatbot.

  5. RESULTS AND DISCUSSION

    1. Evaluation of Machine Learning Model

      We examined the Support Vector Machine (SVM) model's performance on the training and test datasets in order to gauge the efficacy of the mental health prediction model. The model's performance and robustness were assessed using a number of assessment metrics, such as accuracy, precision, recall, F1- score, and confusion matrix.

      Model

      Accuracy (%)

      SVM (Linear)

      85.07

      Logistic Regression

      88.06

      Random Forest

      88.06

      K-Nearest Neighbors (KNN)

      76.12

      Decision Tree

      85.07

      Table I: Accuracy Comparison of Traditional Machine Learning Models for Mental Health Prediction

      1. Confusion Matrix

        The confusion matrix offers a detailed perspective on the model's performance in several classes. It facilitates the visualization of false positives, false negatives, true positives, and true negatives. With a low probability of misclassification, the classifier can effectively differentiate between various mental health categories, according to the confusion matrix for the mental health prediction model.

        Fig 10:-Confusion matrix representing the performance of the SVM model on the test dataset.

      2. Precision, Recall, and F1-Score

        The metrics of precision, recall, and F1-score were computed for every mental health class, such as mild, severe, and healthy. These measures are essential for determining if the model can accurately forecast each class, particularly when there may be a class imbalance.

        Precision gauges how well positive predictions come true, whereas recall assesses how many real positive occurrences the model accurately detects.

        • The F1-score offers a fair assessment of the model's performance since it is the harmonic mean of precision and recall.

          Fig 11:-Accuracy result of SVM

          For example, the SVM model may have a somewhat reduced precision for the "severe" class, implying that some healthy users are incorrectly categorized as severe, but a high recall for the "severe" class, meaning it accurately detects the majority of the badly affected individuals. This trade-off will therefore be reflected in the F1-score.

      3. Accuracy

        The ratio of accurately predicted instances to total instances was used to determine the model's overall accuracy. When assessing the model's overall performance, the accuracy metric is crucial. A high accuracy means that the majority of users are being correctly classified into the appropriate mental health categories by the model.

      4. ROC Curve and AUC Score

        Additional information about the model's performance, particularly with regard to class distinction, can be found in the Receiver Operating Characteristic (ROC) curve and Area Under the Curve (AUC) score. The likelihood that the model will rate a randomly selected positive instance higher than a randomly selected negative instance is indicated by the AUC score. Better model performance is indicated by a higher AUC score.

    2. Evaluation of Chatbot Performance

      Ashgen, the chatbot, was assessed on how well it comprehended and responded to user input. Since the chatbot's main purpose is to help people have conversations about mental health, the following standards were used to gauge its efficacy:

      1. Intent Recognition Accuracy

        The precision with which the chatbot matches user inputs to established intents is known as intent recognition accuracy. The chatbot associates particular intents with terms in the user's input by employing a bag-of-words model. According to preliminary testing, the system demonstrated a great identification ability for frequently asked topics and concerns pertaining to mental health.

        Plans are in place to replace the bag-of-words model with a more sophisticated strategy like TF-IDF or Word Embeddings as the chatbot learns and develops. As a result, the system will be able to comprehend increasingly complicated inquiries and respond with greater context awareness.

      2. Response Generation and Empathy

        The chatbot's responses were assessed according on how sympathetic they were and how well they addressed the user's question. After interacting with the chatbot in a number of test scenarios, users' answers were evaluated for helpfulness and emotional suitability. According to preliminary findings, the chatbot generally gave empathetic responses, recommending mental health services and providing guidance on how to deal with stress and worry.

      3. User Engagement

        The quantity of interactions and the amount of time users spent conversing with the chatbot were used to gauge user engagement. Users interacted with Ashgen more frequently when they were more involved. This implies that the chatbot is contributing significantly to consumers' continuous support.

    3. UI/UX Performance

      The user interface and experience of the web application were evaluated with a group of participants to verify the platform is intuitive, responsive, and user-friendly. Important UI/UX metrics consist of:

      • Usability: Participants said the self-assessment form was simple to fill out and the program was easy to use.

      • Visual Appeal: Users commented favorably on the contemporary design with glassmorphism and animations, saying that the aesthetic contributed to a relaxing, enjoyable experience.

      • Responsiveness: The program worked well on a variety of screens, including PCs, tablets, and smartphones, throughout testing. AJAX and CSS3 enabled the responsive design, which guaranteed lag-free and crash-free performance.

    4. Security Analysis

      Strong security was a top concern because the system manages private mental health information. A number of security features were put in place, such as secure database handling, session management, and password hashing.

      1. Password Security

        The werkzeug security module, which hashes passwords prior to their storage in the database, was used to improve password

        security. This lowers the possibility of unwanted access by preventing the program from saving passwords in plaintext. The login procedure was tested and verified to be secure; no vulnerabilities were found.

      2. Session Management

        Only authorized users can access critical functionality, such as the self-assessment form, thanks to the application's use of Flask-Login for session management. By restricting the length of user sessions, session expiration is used to further safeguard user data.

      3. Data Privacy

        All personal information is encrypted and safely saved thanks to the system. To avoid possible data breaches, the MySQL database is set up to use encrypted connections. Additionally, privacy rules are followed by storing only the bare minimum of necessary data.

    5. Discussion

      The evaluation's findings show that the Mental Health Self- Assessment Web Application does a good job of predicting mental health status, offering chatbot support, and guaranteeing a safe, easy-to-use experience. Personalized forecasts and mental health support are made possible by the integration of AI through the SVM model and chatbot.

      According to user feedback, the platform is successful in providing both clinical forecasts and sympathetic responses two essential components of mental health assistance. There is room for improvement, though. By upgrading its intent recognition engine and switching to a transformer-based paradigm, the chatbot should be able to comprehend more complex discussions. Additionally, expanding the SVM model's training dataset and applying feature engineering could improve the predictions even more.

      Although the security procedures in place are sound, it's crucial to assess and upgrade them frequently in order to handle new threats. The system complies with applicable privacy standards and prioritizes user privacy.

  6. CONCLUSION

    An inventive method for helping people self-report and track their mental health is the AI-Based Self-Assessment System for Mental Health Status. The technology allows users to participate in meaningful self-assessments by fusing natural language processing with contemporary machine learning techniques, such Support Vector Machines (SVM), in an intuitive chatbot interface. Scalable prediction capabilities, safe user administration, and effective data processing are all guaranteed by the system's modular architecture.

    Users can submit their mental health data in a natural and intuitive manner because to a smooth interaction flow between the frontend and backend components. The backend then processes the data and produces precise forecasts of mental health issues. In addition to making it easier to predict

    symptoms like stress, anxiety, and depression, this interaction provides each user with a customized experience.

    The system offers insightful information about long-term patterns in mental health by utilizing past user data and incorporating analytics. To guarantee better predictions and higher user satisfaction, the system can be further improved by ongoing enhancements, such as more varied training datasets, enhanced natural language processing (NLP) capabilities, and more advanced user feedback systems.

  7. FUTURE WORK

    Although the current method offers a strong basis for predicting mental health and self-assessment, there are a number of opportunities for future improvements:

    1. Integration of Other Mental Health Models: An SVM model is used for categorization in the current system. In order to improve forecast accuracy and better handle complicated user inputs, future iterations could include additional sophisticated models, such as deep learning approaches (such as Transformers or Recurrent Neural Networks).

    2. Multimodal Data Integration: To offer more thorough insights into the user's mental health state, the system might be extended to incorporate multimodal data inputs such voice tone analysis, facial expression recognition, or physiological data (e.g., heart rate variability).

    3. Real-Time Monitoring: A future version of the system might concentrate on real-time monitoring, in which users' everyday activities (such as their sleep patterns and activity levels) are monitored to give continuous mental health care. Currently, the system performs assessments based on user interactions.

    4. Better NLP and Intent Recognition: To comprehend a wider variety of user inputs, the chatbot's NLP skills must be improved. Larger language modelspossibly built on more intricate transformer architecturescan help the chatbot better understand and address a range of mental health issues by picking up on minute details in user inquiries.

    5. User Feedback Loop: While it isn't incorporated at the moment, adding a feedback mechanism can assist improve the chatbot's conversational skills as well as the machine learning models. To increase accuracy over time, an adaptive learning system might modify the model's parameters in response to user input.

    6. Personalized Mental Health Support: Depending on the user's unique needs and mental health condition, future versions may include individualized mental health recommendations, such as coping mechanisms, self-help methods, or suggestions for professional referrals. These characteristics might facilitate the transition from self-evaluation to real assistance.

    7. Ethical Considerations and Data Privacy: Maintaining the highest standards of user data privacy and confidentiality is crucial because mental health is a delicate field. Future research will focus on improving the system's data security protocols, upholding stringent privacy guidelines, and integrating moral frameworks that guarantee equity and prevent biases in forecasts.

    8. Wider Dataset Inclusion: The system will be better equipped to make accurate predictions for a larger audience if the training dataset is expanded to cover a more varied range of demographics and global populations. This will guarantee that the system may be adjusted to various regional and cultural elements that affect mental health.

    By putting these developments into practice, the AI-Based Self- Assessment System for Mental Health Status can develop into a more powerful instrument for individualized mental health treatment, providing those in need with real-time help, precise forecasts, and continuous support.

  8. REFERENCES

  1. Y. Wang, et al., "Detecting Depression in Social Media Posts Using SVM," IEEE Transactions on Affective Computing, vol. 10, no. 3, pp. 419427, Jul.-Sep. 2019.

  2. A. B. R. Shatte, et al., "Machine Learning in Mental Health: A Scoping Review of Methods and Applications," Psychological Medicine, vol. 49, no. 9, pp. 14261448, 2019.

  3. A. Althoff, et al., "Using SocialMedia for Early Detection of Mental Health Issues," Proceedings of the 26th International Conference on World Wide Web, 2017, pp. 12411250.

  4. K. K. Fitzpatrick, et al., "Delivering CBT to Young Adults with Depression and Anxiety Using a Fully Automated Conversational Agent (Woebot)," JMIR Mental Health, vol. 4, no. 2, e19, Apr. 2017.

  5. J. Bickmore, et al., "Relational Agents: Effectiveness of Personalized Health Advice," Human-Computer Interaction, vol. 18, no. 3, pp. 387406, 2003.

  6. Q. Cheng, et al., "Security in eHealth: Authenticating Users in Mental Health Platforms," Computers & Security, vol. 77, pp. 3449, 2018.

  7. S. Malhotra and R. Malhotra, "Security in Mental Health Web Applications: Threats and Countermeasures," International Journal of Web Applications, vol. 13, no. 3, pp. 123131, 2021.

  8. H. Nissenbaum, "Privacy in Context: Technology, Policy, and the Integrity of Social Life," Stanford University Press, 2009.

  9. M. Ali, et al., "A MySQL-Based Cloud Platform for Telemedicine Data Management," Journal of Healthcare Engineering, vol. 2020, pp. 17, 2020.

  10. M. A. Bashir, et al., "Chatbot Systems in Mental Health and Their Backend Architecture: A Case Study," Procedia Computer Science, vol. 184, pp. 812819, 2021.

  11. K. Denecke, et al., "Digital Mental Health Tools: Review and Integration Framework," Frontiers in Digital Health, vol. 3, pp. 26, 2021.

  12. R. Vempati, et al., "AI-Based Depression Detection Web Application with Flask and SQL Integration," International Journal of Emerging Technologies in Learning (iJET), vol. 17, no. 15, pp. 4452, 2022.

  13. X. Zhang, et al., "Bridging the Gap: Mental Health Systems for Rural Populations," IEEE Transactions on Healthcare Engineering, vol. 8, no. 2,

    pp. 145159, 2020.

  14. N. Yadollahi, et al., "Ethical Issues in AI-Driven Mental Health Technologies," Journal of Ethics in Mental Health, vol. 9, no. 1, pp. 5568, 2021.

  15. P. Vayena, et al., "Algorithmic Bias and Fairness in Health AI," Journal of Artificial Intelligence in Medicine, vol. 120, pp. 19, 2021.