-
Notifications
You must be signed in to change notification settings - Fork 0
/
depression-test.html
220 lines (176 loc) · 9.04 KB
/
depression-test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<link href="depression-design.css" media="screen" rel="stylesheet" type="text/css">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
<title>Depression Test</title>
<style>
/* Your CSS styles here */
</style>
</head>
<body>
<section class="navigation-bar">
<nav class=navbar>
<div class="brand-div">
<p class="brand-name"><a href="index.html">MindLoom</a></p>
</div>
<div class="nav-options">
<ul class="nav-links">
<li><a href="index.html">Home</a></li>
<li><a href="about.html">About</a></li>
<li><a href="test.html">Test</a></li>
<li><a href="FAQ.html">FAQ</a></li>
</ul>
</div>
</nav>
</section>
<div class="flex-div">
<div class="container">
<h1>Depression Test (PHQ - 9)</h1>
<form id="depressionForm">
<label for="question1">1. Little interest or pleasure in doing things?</label>
<div class="radio-group">
<input id="q1-option1" name="question1" required type="radio" value="0">
<label for="q1-option1">No</label>
<input id="q1-option2" name="question1" type="radio" value="1">
<label for="q1-option2">Sometimes</label>
<input id="q1-option3" name="question1" type="radio" value="2">
<label for="q1-option3">Frequently</label>
<input id="q1-option4" name="question1" type="radio" value="3">
<label for="q1-option4">Always</label>
</div>
<label for="question2">2. Feeling down, depressed, or hopeless?</label>
<div class="radio-group">
<input id="q2-option1" name="question2" required type="radio" value="0">
<label for="q2-option1">No</label>
<input id="q2-option2" name="question2" type="radio" value="1">
<label for="q2-option2">Sometimes</label>
<input id="q2-option3" name="question2" type="radio" value="2">
<label for="q2-option3">Frequently</label>
<input id="q2-option4" name="question2" type="radio" value="3">
<label for="q2-option4">Always</label>
</div>
<label for="question3">3. Feeling down, depressed, or hopeless?</label>
<div class="radio-group">
<input id="q3-option1" name="question3" required type="radio" value="0">
<label for="q3-option1">No</label>
<input id="q3-option2" name="question3" type="radio" value="1">
<label for="q3-option2">Sometimes</label>
<input id="q3-option3" name="question3" type="radio" value="2">
<label for="q3-option3">Frequently</label>
<input id="q3-option4" name="question3" type="radio" value="3">
<label for="q3-option4">Always</label>
</div>
<label for="question4">4. Feeling tired or having little energy?</label>
<div class="radio-group">
<input id="q4-option1" name="question4" required type="radio" value="0">
<label for="q4-option1">No</label>
<input id="q4-option2" name="question4" type="radio" value="1">
<label for="q4-option2">Sometimes</label>
<input id="q4-option3" name="question4" type="radio" value="2">
<label for="q4-option3">Frequently</label>
<input id="q4-option4" name="question4" type="radio" value="3">
<label for="q4-option4">Always</label>
</div>
<label for="question5">5. Poor appetite or overeating?</label>
<div class="radio-group">
<input id="q5-option1" name="question5" required type="radio" value="0">
<label for="q5-option1">No</label>
<input id="q5-option2" name="question5" type="radio" value="1">
<label for="q5-option2">Sometimes</label>
<input id="q5-option3" name="question5" type="radio" value="2">
<label for="q5-option3">Frequently</label>
<input id="q5-option4" name="question5" type="radio" value="3">
<label for="q5-option4">Always</label>
</div>
<label for="question6">6. Feeling bad about yourself - or that you are a failure or have let yourself or
your
family down?</label>
<div class="radio-group">
<input id="q6-option1" name="question6" required type="radio" value="0">
<label for="q6-option1">No</label>
<input id="q6-option2" name="question6" type="radio" value="1">
<label for="q6-option2">Sometimes</label>
<input id="q6-option3" name="question6" type="radio" value="2">
<label for="q6-option3">Frequently</label>
<input id="q6-option4" name="question6" type="radio" value="3">
<label for="q6-option4">Always</label>
</div>
<label for="question7">7. Trouble concentrating on things, such as reading the newspaper or watching
television?</label>
<div class="radio-group">
<input id="q7-option1" name="question7" required type="radio" value="0">
<label for="q7-option1">No</label>
<input id="q7-option2" name="question7" type="radio" value="1">
<label for="q7-option2">Sometimes</label>
<input id="q7-option3" name="question7" type="radio" value="2">
<label for="q7-option3">Frequently</label>
<input id="q7-option4" name="question7" type="radio" value="3">
<label for="q7-option4">Always</label>
</div>
<label for="question8">8. Moving or speaking so slowly that other people could have noticed?
Or the opposite - being so fidgety or restless that you have been moving around a lot more than
usual?</label>
<div class="radio-group">
<input id="q8-option1" name="question8" required type="radio" value="0">
<label for="q8-option1">No</label>
<input id="q8-option2" name="question8" type="radio" value="1">
<label for="q8-option2">Sometimes</label>
<input id="q8-option3" name="question8" type="radio" value="2">
<label for="q8-option3">Frequently</label>
<input id="q8-option4" name="question8" type="radio" value="3">
<label for="q8-option4">Always</label>
</div>
<label for="question9">9. Thoughts that you would be better off dead, or of hurting yourself in some
way?</label>
<div class="radio-group">
<input id="q9-option1" name="question9" required type="radio" value="0">
<label for="q9-option1">No</label>
<input id="q9-option2" name="question9" type="radio" value="1">
<label for="q9-option2">Sometimes</label>
<input id="q9-option3" name="question9" type="radio" value="2">
<label for="q9-option3">Frequently</label>
<input id="q9-option4" name="question9" type="radio" value="3">
<label for="q9-option4">Always</label>
</div>
<!-- Add more questions as needed -->
<button onclick="calculateDepression()" type="button">Submit</button>
</form>
<!-- Result container -->
<div id="resultContainer"></div>
</div>
</div>
<script>
function calculateDepression() {
const questions = ["question1", "question2", "question3", "question4", "question5", "question6", "question7", "question8", "question9"]; // Add more questions here
let totalScore = 0;
questions.forEach(question => {
const selectedOption = document.querySelector(`input[name="${question}"]:checked`);
if (selectedOption) {
totalScore += parseInt(selectedOption.value, 10);
}
});
let depressionLevel = "";
if (totalScore >= 0 && totalScore <= 3) {
depressionLevel = "None";
} else if (totalScore >= 4 && totalScore <= 9) {
depressionLevel = "Mild Depression";
} else if (totalScore >= 10 && totalScore <= 13) {
depressionLevel = "Moderate Depression";
} else if (totalScore >= 14 && totalScore <= 18) {
depressionLevel = "Moderately Depression";
} else {
depressionLevel = "Severe Depression";
}
// Display the result using SweetAlert
Swal.fire({
title: 'Depression Test Result',
html: `<p>Depression Level: <strong>${depressionLevel}</strong></p>`,
icon: 'info'
});
}
</script>
</body>
</html>