You are on page 1of 34

PROJECT TITLE

A MINI PROJECT REPORT

Submitted by
KALAIPRIYA B (312018104029)

NUTHAKKI MITHALI MARYAH (312018104039)

SOWMIYA V (312018104058)

in the partial fulfillment for the award of the degree


Of
BACHELOR OF ENGINEERING

In

COMPUTER SCIENCE AND ENGINEERING

JEPPIAAR SRR ENGINEERING COLLEGE


ANNA UNIVERSITY: CHENNAI 600 025
APRIL 2021
CERTIFICATE OF EVALUATION

S. No Name of the Title of the


Student(s) who have Project
done the project

1. KALAIPRIYA B
HOLD ON-
Web
NUTHAKKI MITHALI Application on
2.
suicide
MARYAH
prevention and
awareness
SOWMIYA V
3.

The Reports of the project work submitted by the above students in partial
fulfillment for the award of Bachelor of Engineering Degree in Computer Science
and Engineering of Anna University, Chennai were evaluated and confirmed to
be reports of the work by the above students and then evaluated.

Submitted on …………

INTERNAL EXAMINER EXTERNAL EXAMINER

I
ABSTRACT

Our website aims to create awareness about suicide prevention and


depression control. In addition to awareness, there are multiple characterizing
various modules to specialize the website. We have several features like
depression screening, data visualization, sentiment analysis and we have also
attached Indian helpline number.
There is a data exploratory page which displays the data analysis on
depression and suicide cases. It also gives a brief note on symptoms, causes for
depression, depression management. Also, depression is one talking that has a lot
of myths and tis makes the people suffering feel even worse about themselves, to
better the situation there is a number myths that have been countered with the
actual scientifically proven fact. The page also advises to take help if needed. The
page also contains a number helpline numbers of India in several cities, it also
contains some links to useful blogs and a couple of videos that help a person
suffering from depression feel a little bit better as well.
In the homepage different emojis characterizing different emotions are
present. Which when clicked displays information regarding those emotions that
is its definition, symptoms and management.
Our depression screening module focuses on checking the user's mental
health and analyses whether they are depressed or not and on what rate. Sentiment
analysis module is present to get the user’s feeling as input and analyze their
sentiment. It gives the result as positive or negative moods they have on that
period.
This is a separate website dedicated to create awareness about suicide
prevention and depression control where most of the facilities are satisfied. This
project focuses to create awareness to prevent the risk factors of depression and
suicide. In real world this website can be used by people who are depressed and
can be recommended to friends who might think suffering.

II
TABLE OF CONTENTS

CHAPTER NO. TITLE PAGE NO.

ABSTRACT II
LIST OF FIGURES V
LIST OF ABBREVIATIONS VI

1. INTRODUCTION 1
1.1 OVERVIEW

2. REQUIREMENT ANALYSIS 2
2.1 REQUIREMENTS FOR PYCHARM 2
2.2 SPECIFIACTIONS FOR FLASK 2
2.3 SOFTWARE REQUIREMENTS 2
2.4 INSTALLATIONS 2
2.5 LANGUAGES USED 2

3. SYSTEM ANALYSIS AND DESIGN 3


3.1 EXISTING SYSTEM 3
3.1.1 Drawbacks of Existing System 3
3.2 PROPOSED SYSTEM 3
3.3 UML DIAGRAMS 4
3.3.1 Use Case Diagram 4
3.3.2 Activity Diagram 4
3.4 DATA FLOW DIAGRAMS 5
3.4.1 Zero Level Data Flow Diagram 5
3.4.2 First Level Data Flow Diagram 5
3.4.3 Second Level Data Flow Diagram 6

III
4. SYSTEM IMPLEMENTATION 7
4.1 SYSTEM MODULES 7
4.1.1 Depression Screening 7
4.1.2 Data Analysis 10
4.1.3 Sentimental Analysis 12

5. SYSTEM TESTING 15
5.1 FUNCTIONALITY TESTING 15
5.2 USABILITY TESTING 15
5.3 INTERPHASE TESTING 15
5.3.1 Sentiment Analysis Module 15
5.3.2 Depression Screening Module 16
5.4 COMPATABILITY TESTING 16

6. RESULTS AND DISCUSSION 17


6.1 RESULTS 17

7. CONCLUSION AND FUTURE 18


ENHANCEMENTS
7.1 CONCLUSION 18
7.2 FUTURE ENHANCEMENTS 18

REFERENCES 19
APPENDIX I - SOURCE CODE 20
APPENDIX II – SCREENSHOTS 26

IV
LIST OF FIGURES

FIGURE NO. NAME PAGE NO.

3.1 Use-Case Diagram 4


3.2 Activity Diagram 4
3.3 Zero Level Data Flow Diagram 5
3.4 First Level Data Flow Diagram 5
3.5 Second Level Data Flow Diagram 6
4.1 Depression Screening Module Flow Diagram 8
4.2 Data Analysis Module Flow Diagram 10
4.3 Sentimental Analysis Flow Diagram 12

V
LIST OF ABBREVIATIONS

NGO - Non - Governmental Organization


DS - Depression Screening
CB - Chat Bot
XAMPP - Multiplatform Apache Maria DB Perl PHP
PHP - Hypertext Preprocessor
IEEE - Institute of Electrical and Electronics Engineers
SA - Sentiment Analysis
NLP - Natural Language Process
EDAA - Exploratory Data Analysis Algorithm
DAC - Divide And Conquer
NCRB - National Crime Records Bureau

VI
Chapter 1

INTRODUCTION
1.1 ABOUT
Depression and suicide thoughts are the two of the most frightening things that
one can face in their lifetime. Unfortunately acting on those suicidal thoughts is
a far too common decision many make across the world. People who have
attempted suicide often quote that “They are emotions that never seems to end,
to a point they see no other option than to commit suicide.”

There are many reasons as to why a person tries to commit suicide or has suicidal
thoughts. The most common reason is that the depressed person was not able to
covey exactly what difficulty he/she was fasting at that moment to anyone
including their loved one as they themselves are not aware of what is troubling
them. A long and difficult research has been found that the basic motivation for
suicide is the feeling of not expressing their loneliness and hopelessness. But
there are several other reasons so as to why a person attempts suicide, each
individual has a different coping mechanism when it comes to hardships for some
people it might be very overwhelming and might not be able to deal with difficult
situations and hence choose this very sad and frightful option.

This website is helpful for those who need to overcome their suicidal thoughts,
depression and to relieve themselves from their sufferings. This website is also
designed to be recommended to a friend or a family member who you are worried
about or suspect to be on the verge of killing or harming themselves. This website
helps one to have a clear differentiation between myths and facts; the web page
also contains several helpline numbers that may come in handy at any point of
time.

1
Chapter 2

REQUIREMENT ANALYSIS
2.1 Specification for PYCHARM:
• RAM -4GB

• OS: Officially released 64-bit versions of the following:


▪ Microsoft Windows 8 or later
▪ macOS 10.13 or later
▪ Any Linux distribution that supports Gnome, KDE, or Unity DE.
PyCharm is not available for some Linux distributions, such as RHEL6
or CentOS6, that do not include GLIBC 2.14 or later.
▪ Pre-release versions are not supported.

2.2 Specification for FLASK:


• Python 2.7.x or 3.4 and above
• Python development libraries
• Pip

2.3 SOFTWARES RQUIRED


• Python3/Jupyter Notebook(data exploratory).
• Python3/Pycharm – Webpage Creation

2.4 INSTALLATIONS
• NLTK (pip install nltk)

• FLASK (pip install Flask)

2.5 LANGUAGES USED


• HTML
• CSS
• PYTHON3
• JAVASCRIPT

2
Chapter 3

SYSTEM ANALYSIS AND DESIGN

3.1 Existing System


There are very limited pages specific to suicide prevention for India. i.e. along
with Indian helpline number.
Websites are specific to either prevention or detection and mostly developed by
NGO’s. Therefore, having information about their mission is their motive and
focuses less on the prevention aspect.
3.1.1 Limitations of the Existing system
• Separate pages for suicide prevention, depression screening, helpline
numbers and data exploratory.
• Not very Interactive.
• Focuses only on the NGO’s goals and missions.

3.2 Proposed System


A web page that contains details regarding suicide prevention, depression
screening, helpline numbers, data exploratory analysis of data and sentiment
analysis.
Our webpage is effective due to the process of sentiment analysis where user’s
opinion is taken as input and analysis their nature of thought, either negative or
positive. The webpage has all the required content in one place (one page), it is
informative and eye catching due to the data exploratory in the form of graphs.
Also, the presence of the Depression Screening Test helps a person to better
understand their mental state and prevent us from making vague assumptions.

3
3.3 UML DIAGRAMS
3.3.1 Use-Case Diagram

Fig 3.1
3.3.2 Activity Diagram

Fig 3.2

4
3.4 DATA FLOW DIAGRAM

3.4.1 Zero Level Data Flow Diagram

Fig 3.3

3.4.2 First Level Data Flow Diagram

Fig 3.4

5
3.4.3 Second Level Data Flow Diagram

Fig 3.5

6
Chapter 4
IMPLEMENTATION
4.1 SYSTEM MODULE
4.1.1 MODULE 1(DEPRESSION SCREENING)

o MODULE INTRODUCTION

It is a simple quiz that contains 12 questions that are symptoms of having


depression, this test gets the answer from the user and displays if the
severity of the user’s depression ranging from no depression to requiring
immediate help.
o ALGORITHM/PROCEDURE

Step 1: Start the program


Step 2: Start the test.
Step 3: Display the rules
Step 4: If continue go to step 6.
Step 5: Else go to step 2.
Step 6: Display the question.
Step 7: Get user choice
Step 8: Based on the choice increment count value.
Step 8a: If Choice is ‘Not at all’ no increment.
Step 8b: If Choice is ‘Several Days’, score = score+1
Step 8c: If Choice is ‘More than half the days’, score = score+3
Step 8d: If Choice is ‘Nearly every day’, score = score+4
Step 9: Click on Next
Step 10: If Last question go to step 12.
Step 11: Else go to step 6.
Step 12: Display the score as well as the prediction.
Step 13: Stop

7
o DFD/FLOW DIAGRAM WITH EXPLAINATION
STAR
T

Start Test Input

Display Rules Output

Continu
e No
Yes
Display questions

SUBMIT

Calculate Score

Display Score

Stop

Fig 4.1
o EXPLAINATION

When we go for the depression screening test, initially we will be asked


whether to start the test or cancel. If cancelled, it returns to the same page that
was before. When the start quiz button is pressed it displays the rules to be
followed during the test which are:
1. Once you select your answer, it can't be undone.
8
2. You'll get points on the basis of your answers.
3. Be as truthful as you can. Choose the first option that comes to your mind.
4. There are a total of 12 questions.
5. You must answer all the questions, only if you answer the question it will
move to the next question.
After reading the rules, we have to press the continue button. Then the
questions will be displayed one after the other, that is only when one question is
submitted the next question will appear, after reading the questions, any one
option should be chosen from the choices:
a. Not at all
b. Several days
c. More than half a day
d. Nearly every day
Our options are taken as the input for the page. The points are calculated
as no increment for the choice ‘Not at all’, score is incremented by 1 for the choice
‘Several days’, score is incremented by 3 for ‘more than half a day’ and the score
is incremented by 4 for ‘Nearly every day’.
After completing the quiz when we click on the submit button, our score is
calculated with the above mentioned values and the choices we choose. Finally,
the result will be posted as one of the following:
You are completely fine; no need to get riled up at all (if the score is below
14)
You might be facing borderline depression, get out there and have some
fun with friends and family (if the score is between 14 and 20).
There is a high probability you are depressed, try consulting a specialist,
there is nothing to be alarmed about, and there are chances of not being
true also (if the score is between 20 and 29).
Consult a physician as soon as possible; there is a high chance you might
be depressed (if the score is above 29).

9
4.1.2 MODULE 2 (DATA ANALYSIS)
o MODULE INTRODUCTION

An exploratory data analysis to understand the depth of the issue, multiple


graphs have been plotted to depict the effect of suicide and depressions in
various different sectors including gender, age, profession, state and so on.
o DFD/FLOW DIAGRAM WITH EXPLAINATION

Import libraries and


Import dataset

Display dataset
details

Clear unnecessary fields

Plot graphs with various


parameters

Display
graphs

Stop

Fig 4.2

10
o ALGORITHM/PROCEDURE
Step 1: Start the program
Step 2: Open Jupyter Notebook
Step 3: Import the necessary libraries.
Step 4: Import the dataset
Step 5: Display the dataset in a tabular form to better understand the
dataset, its columns and rows.
Step 6: Check for columns having Null values and delete the columns that
have excessive null values.
Step 7: Plot and display each graph.
Step 8: Stop

o EXPLAINATION

The website contains a data exploratory module which is divided into two
pages as mental health analysis and suicide rate analysis.
In mental health analysis, the libraries and the dataset from survey.csv from
Kaggle is imported in Jupyter notebook. The dataset is displayed in a tabular form
to better understand the dataset. Check for columns having null values and delete
the columns having excessive null values. The graphs are plotted and displayed.
In suicide rate analysis, the libraries and the dataset from survey.csv from Kaggle
is imported in Jupyter notebook. The dataset is displayed in a tabular form to
better understand the dataset. Check for columns having null values and delete
the columns having excessive null values. The graphs are plotted and displayed
in each group as

11
4.1.3 MODULE 3 (SENTIMENT ANALYSIS)
o MODULE INTRODUCTION

Analysis to get the user’s feelings as input and analyze their mental health
and predict their nature of thought i.e., positive or negative.
o DFD/FLOW DIAGRAM WITH EXPLAINATION

Start

Input From the user

Split the sentences to individual words.


Clean the text: Remove stop words, Remove numbers and special characters

Yes

Word is present
in the emotion
arrayelists

Add the word to an array


emotional_words[] and identify each
emotion positive or negative and add
it to score[]

Yes No
Score[neg]
>score[pos
]

Return/ display “you are Return/ display “you are


having negative having positive thoughts”
thoughts”

STOP

Fig 4.3
12
o ALGORITHM/PROCEDURE

Step 1: Start the program


Step 2: Install Flask
Step 3: Start the venv environment.
Step 4: Create a HTML and CSS page to create a form that takes in the
user input.
Step 5: Use the submit button to send the input derived to the main.py page
Step 6: Open the main.py page
Step 7: Render the route using GET and POST methods.
Step 8: If request.method=’post’
Step 9: Store the user input in a variable inp.
Step 10: Using The SentimnetIntensityAnalyzer() function find out the
scores of negativity and positivity
Step 11: Assign score[pos] to pos and score[neg] to neg
Step 12: Return the message based on the score to the HTML page.
Step 12a: If neg>pos return (You are currently having some
negative thoughts.)
Step 12b: Else If pos>neg return (You are currently having some
Positive thoughts.)
Step 12c: Else return (You are currently having some Neutral
thoughts.)

Step 13: The Html Page receives the message from the main.py page and
displays the result in a modal
Step 14: We can now click on the result button to see the result.
Step 15: Stop The Program.

13
o EXPLAINATION

Sentiment Analysis is present to analyze the user’s mood by getting input


from themselves and evaluating. The input is in the text format of how they are
feeling at that time.
Initially, when we click the ‘Sentiment Analysis’ button it navigates to a
page where a plain text box is present with submit and result buttons. In the text
box user has to type how they are feeling and what’s their mood on that period.
After typing everything submit button should be pressed. The analysis module
splits the sentences into individual words and start analyzing those words. After
splitting, it cleans the text to remove stop words and also remove numbers and
special characters. It takes the sentimental words into account. If the individual
words are present in the emotion, it adds the word to an array emotional_words[]
and identify each emotion is positive or negative and add it to score[] array.
In this project the NLP(Natural language processing) is used, the NLP
contains a toolkit named NLTK(The Natural Language Toolkit) which contains
multiple libraries out of which we have used the “Vader library” which contains
the “SentimentIntensityAnalyzer()” function which makes the analyzing very
efficient and simple, using this function there is no need to hard code the emotions
as a key value pair all of it is taken into account by the function. The joyful words
are considered as positive words whereas sorrowful or the hatred words are
considered as negative words. After evaluating a pop-up message will be
displayed as “Your text is analyzed, please click on the result button to view your
result”.
Then user needs to click the result button to know the analysis of their text.
If the score[neg] value is greater than score[pos] value, then the result is viewed
as “You are having negative thoughts currently”. Otherwise, the result will be
displayed as “You are having positive thoughts currently”.

14
Chapter 5

TESTING
5.1 Functionality Testing

All the links and buttons have been tested and all the navigations are
working as expected.
Buttons present the Project work as expected without any delay, and
produce the results.

5.2 Usability Testing


Efforts are put in to ensure that the application is built in-line with user
needs. The content that is displayed in the web application is also be clearly
visible.

5.3 Interphase Testing:


5.3.1 Sentiment Analysis:

Test Case 1:
Input:
I hate life, the pandemic has affected my mental health and I don’t
feel good about myself.
Output:
You are currently having some Negative thoughts Thank you for
trying out our Sentiment Analyzer hope you get clarity on your thoughts and
feelings.

15
Test Case 2:
Input:
I am positive that I’m doing well on all aspects of my life, and am
loving every second of this beautiful adventure.
Output:
You are currently having some Negative thoughts Thank you for
trying out our Sentiment Analyzer hope you get clarity on your thoughts.

5.3.2 Depression Screening:


The options selected by the user is taken into consideration and the final
score is calculated as expected and based the score achieved the final result is
being displayed accurately.
The Score vs Result is as follows.
UserScore (<14) - You are completely fine, no need to get riled up at all.
UserScore (14-20) - You might be facing borderline depression, get out there and
have some fun with friends and family
UserScore(20-29) - There is a high probability you are depressed, try consulting
a specialist, there is nothing to be alarmed about, there are chances of not being
true also.
UserScore(29>) - Consult a physician as soon as possible, there is a high chance
you might be Depressed.
5.4 Compatibility Testing:
Web Browser – Works as expected in the following browsers:
• Microsoft Edge
• Internet Explorer
• Chrome
• Safari
Mobile Browser – Not compatible with hand held devices

16
Chapter 6

RESULTS AND DISCUSSION

We have developed our website to mainly aim on creating awareness about


suicide prevention and depression control. In addition to awareness, there are
multiple characterizing various modules to specialize the website. We have added
several features like depression screening, data visualization, sentiment analysis
and we have also attached Indian helpline number.

Our data exploratory page is designed to display the data analysis on depression
and suicide cases that has segregated by age, education and marital status to
deeply know the causes of depression and suicides.

Our depression screening module is created to focus on analyzing the user's


mental health, whether they are depressed or not and on what rate. Sentiment
analysis module is present to get the user’s feeling as input and analyze their
sentiment. It gives the result as positive or negative moods they have on that
moment.

Helpline page has been added to provide Indian helpline numbers and numbers
of NGOs that rescues people from depression. Also added some links of useful
blogs. Get-to-know module is present to display information all about
depression with some myths and facts.

17
Chapter 7

CONCLUSION AND FUTURE ENHANCEMENT


7.1 CONCLUSION

This dissertation is dealt with the design and development process of awareness
creating web-application. We have implemented our project with data analysis
on depression and suicide cases - a get to know page where we can know all about
depression and a helpline page availing Indian helpline number and for specific
cities.
Our website also focuses on analyzing the user’s mental health and mood with a
sentiment analysis module. A screening page is present to analyze more about
their mental health. This helps to have an interactive relationship with the user
and the website.
As a part of our mini project, we are visualizing the usage of this app for people
who are suffering from depression and may have a threat of committing suicide.
This app can be used for screening ourselves and can be recommended to our
friends and family for their benefits as well. With the help of this project, we hope
that we can at least reduce the number of suicides, and prevent thoughts.

7.2 FUTURE AVENUES


• Identifying Therapists nearby.

• Booking appointments with the Therapists.

• Facial and Voice recognition to detect mood.

18
REFERENCES

[1] Open Sourcing Mental Illness Ltd is a non-profit Indiana corporation with
501(c)(3) tax-exempt status. EIN: 81-3587896.
[2] Principal Software Engineer at Accion Labs India Private Limited
[3] BI India Bureau- International Suicide Prevention Day: These are the suicide
prevention helpline numbers in India
[4]Liu B. Sentiment analysis and opinion mining. Synthesis Lectures Human
Language Technologies 2012;5:1–167

[5]Pang B, Lee L. Opinion mining and sentiment analysis. Foundations Trends


Information Retrieval 2008;2:1–135.

[6]Rana TA, Cheah Y-N. Aspect extraction in sentiment analysis: comparative


analysis and survey. Artificial Intelligence Review 2016;46:459–483.

[7]Cambria E. Affective computing and sentiment analysis. IEEE Intelligent


Systems 2016;31:102–107

[8]Bengaluru, Karnataka, India/ National Crime Records Bureau (NCRB), Govt


of India has shared this dataset under Govt. Open Data License - India.
NCRB has also shared the historical data on their website.
https://www.businessinsider.in/science/health/news/international-suicide-
prevention-day-these-are-the-suicide-prevention-helpline-numbers-in-
india/amp_articleshow/78035281.cms

19
APPENDIX
APPENDIX I - SOURCE CODE

Sentiment Analysis Function: (main.py)


from flask import Flask, render_template, request
from nltk.sentiment.vader import SentimentIntensityAnalyzer
import nltk
nltk.download('vader_lexicon')
app = Flask(__name__)
@app.route('/analysis', methods=["GET", "POST"])
def analysis():
if request.method == "POST":
inp = request.form.get("inp")
sid = SentimentIntensityAnalyzer()
score = sid.polarity_scores(inp)
neg = score["neg"]
pos = score["pos"]
if neg > pos:
return render_template('analysis.html', message="You are currently
having some Negative thoughts!", mood=" ", thank="Thank you for trying
out our Sentiment Analyser hope you get clarity on your thoughts and
feelings.")
elif pos > neg:
return render_template('analysis.html', message="You are currently
having some Possitive thoughts!", mood=" ", thank="Thank you for trying
out our Sentiment Analyser hope you get clarity on your thoughts and
feelings.")
else:
return render_template('analysis.html', message="You are currently
having some Neutral thoughts!", mood=" ", thank="Thank you for trying out
our Sentiment Analyser hope you get clarity on your thoughts and feelings.")
else:
return render_template('analysis.html', mood="Please enter your thoughts
and click 'Submit' to know your results.")

return render_template('analysis.html')
20
Depression Screening:

//selecting all required elements


const start_btn = document.querySelector(".start_btn button");
const info_box = document.querySelector(".info_box");
const exit_btn = info_box.querySelector(".buttons .quit");
const continue_btn = info_box.querySelector(".buttons .restart");
const quiz_box = document.querySelector(".quiz_box");
const result_box = document.querySelector(".result_box");
const option_list = document.querySelector(".option_list");

// if startQuiz button clicked


start_btn.onclick = ()=>{
info_box.classList.add("activeInfo"); //show info box
}

// if exitQuiz button clicked


exit_btn.onclick = ()=>{
info_box.classList.remove("activeInfo"); //hide info box
}

// if continueQuiz button clicked


continue_btn.onclick = ()=>{
info_box.classList.remove("activeInfo"); //hide info box
quiz_box.classList.add("activeQuiz"); //show quiz box
showQuetions(0); //calling showQestions function
queCounter(1); //passing 1 parameter to queCounter

let que_count = 0;
let que_numb = 1;
let userScore = 0;
let counter;
let counterLine;
let widthValue = 0;

21
const quit_quiz = result_box.querySelector(".buttons .quit");

const next_btn = document.querySelector("footer .next_btn");


const bottom_ques_counter = document.querySelector("footer .total_que");

// if Next Que button clicked


next_btn.onclick = ()=>{
if(que_count < questions.length - 1){ //if question count is less than total
question length
que_count++; //increment the que_count value
que_numb++; //increment the que_numb value
showQuetions(que_count); //calling showQestions function
queCounter(que_numb); //passing que_numb value to queCounter
clearInterval(counter); //clear counter
clearInterval(counterLine); //clear counterLin
next_btn.classList.remove("show"); //hide the next button
}else{
clearInterval(counter); //clear counter
clearInterval(counterLine); //clear counterLine
showResult(); //calling showResult function
}
}

// getting questions and options from array


function showQuetions(index){
const que_text = document.querySelector(".que_text");

//creating a new span and div tag for question and option and passing the
value using array index
let que_tag = '<span>'+ questions[index].numb + ". " +
questions[index].question +'</span>';
let option_tag = '<div class="option"><span>'+ questions[index].options[0]
+'</span></div>'
+ '<div class="option"><span>'+ questions[index].options[1]
+'</span></div>'
22
+ '<div class="option"><span>'+ questions[index].options[2]
+'</span></div>'
+ '<div class="option"><span>'+ questions[index].options[3]
+'</span></div>';
que_text.innerHTML = que_tag; //adding new span tag inside que_tag
option_list.innerHTML = option_tag; //adding new div tag inside option_tag

const option = option_list.querySelectorAll(".option");

// set onclick attribute to all available options


for(i=0; i < option.length; i++){
option[i].setAttribute("onclick", "optionSelected(this)");
}
}
// creating the new div tags which for icons
let tickIconTag = '<div class="icon tick"><i class="fas fa-check"></i></div>';
let crossIconTag = '<div class="icon cross"><i class="fas fa-
times"></i></div>';

//if user clicked on option


function optionSelected(answer){
clearInterval(counter); //clear counter
clearInterval(counterLine); //clear counterLine
let userAns = answer.textContent; //getting user selected option
const allOptions = option_list.children.length; //getting all option items
answer.classList.add("correct");
answer.insertAdjacentHTML("beforeend", tickIconTag);

if(userAns == "Not at all"){ //if user selected option is equal to array's correct
answer
userScore += 0; //upgrading score value with 1

}
else if(userAns == "Several days"){
userScore += 1;

}
else if(userAns == "More than half the days"){
23
userScore += 3;

}
else if(userAns == "Nearly every day"){
userScore += 4;

for(i=0; i < allOptions; i++){


option_list.children[i].classList.add("disabled"); //once user select an
option then disabled all options
}

next_btn.classList.add("show"); //show the next button if user selected any


option
}

function showResult(){
info_box.classList.remove("activeInfo"); //hide info box
quiz_box.classList.remove("activeQuiz"); //hide quiz box
result_box.classList.add("activeResult"); //show result box
const scoreText = result_box.querySelector(".score_text");
if (userScore < 14 ){
let scoreTag = '<span class="result_text"><p>RESULT: <br/></p>
<p>You are completely fine, no need to get riled up at all</p></span>';
scoreText.innerHTML = scoreTag; //adding new span tag inside
score_Text
}
else if(userScore >=14 && userScore< 20 ){
let scoreTag = '<span class="result_text"><p>RESULT: <br/></p> <p>
You might be facing borderline depression, get out there and have some fun
with friends and family.</p></span>';
scoreText.innerHTML = scoreTag;
}
else if(userScore >=20 && userScore< 29 ){
let scoreTag = '<span class="result_text"><p>RESULT:
<br/></p><p>There is a high probability you are depressed, try consulting a
24
specialist, there is nothing to be alarmed about, there are chances of not being
true also. </p></span>';
scoreText.innerHTML = scoreTag;
}
else{
let scoreTag = '<span class="result_text"><p>RESULT: <br/></p><p>
Consult a physician as soon as possible, there is a high chance you might be
Depressed. </p></span>';
scoreText.innerHTML = scoreTag;
}
}

function queCounter(index){
//creating a new span tag and passing the question number and total question
let totalQueCounTag = '<span><p>'+ index +'</p> of <p>'+ questions.length
+'</p> Questions</span>';
bottom_ques_counter.innerHTML = totalQueCounTag; //adding new span
tag inside bottom_ques_counter
}

25
APPENDIX II – SCREEN SHOTS

HOME PAGE:

HELPLINE:

GET TO KNOW PAGE:

26
DEPRESSION SCREENING:

SENTIMENT ANALYSIS:

EXPLORATRY ANALYSIS:

27

You might also like