Skip to content

Commit

Permalink
Merge pull request #168 from swetasingh8844/main
Browse files Browse the repository at this point in the history
Depression Screening Test Calculator
  • Loading branch information
ritika728 authored Feb 10, 2024
2 parents a895ede + 1eeff20 commit ae253fb
Show file tree
Hide file tree
Showing 5 changed files with 328 additions and 0 deletions.
37 changes: 37 additions & 0 deletions css_files/depression.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
body{
background-image: url(../images/depression.jpeg);
background-size: cover;

}
.calculator{
background-color: transparent;
font-weight: bold;
box-shadow: 5px 5px 10px 2px rgba(0,0,0,.8);
width: 70%;
margin: auto;
padding: 20px;
box-sizing: border-box;
}
.out{
padding-left: 100px;
padding-right: 10px;

}
.output{
padding-top: 10px;
}

.input-btn {
text-align: center;
}

#outputTarget {
padding: 20px;
}
.output-box {
background-color: #f0f0f0;
padding: 5px;
margin-top: 10px;
border-radius: 5px;

}
191 changes: 191 additions & 0 deletions html_files/depression.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Depression Screnning Risk Calculator</title>
<link rel="stylesheet" href="../css_files/home.css">
<link rel="stylesheet" href="../css_files/calci.css">
<link rel="shortcut icon" type="image/jpg" href="../images/wave (1).png"/>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" integrity="sha384-ezlrJyRBD9N5ZXUUqNl8XqVAjjc6b3lc1ce6Rrp+9/gs6gKDT3Vl+kD5tr5D2Gff" crossorigin="anonymous">
<link rel="stylesheet" href="../css_files/depression.css">
</head>
<body>
<header>
<h1>WELLNESS WAVE</h1>
</header>
<div class="navbar">
<ul>
<li class="navlist"><a href="../index.html" class="home">Home</a></li>
<li class="navlist"><a href="fitnesstracking.html" class="home">Tracking</a></li>
<li class="navlist"><a href="wellness.html" class="home">Wellness</a></li>
<!-- <li><a href="testimonial.html" class="home">Testimonial</a></li> -->
<li class="navlist"><a href="faq.html" class="home">FAQ</a></li>
</ul>
</div>
<h1 class="calci_title">Depression Screnning Risk Calculator</h1>
<div class="out">
<div class="calculator">
<div class="gender_box">
<label for="gender">Gender :</label>
<select id="gender" name="gender" required>
<option value="male">Male</option>
<option value="female">Female</option>
</select>
</div>

<div class="age">
<label for="age">Age (years):</label>
<input type="number" id="age" placeholder="Enter your age">
</div>

<label for="q1">1. I feel sad and unhappy most of the time.</label>
<select id="q1" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>
<br>
<label for="q2">2. I feel tired, have little energy and I am unable to concentrate.</label>
<select id="q2" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>
<br>
<label for="q3">3. I have lost interest in all aspects of life that used to be important to me.</label>
<select id="q3" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>
<br>
<label for="q4">4. The pleasure and joy has gone out of my life.</label>
<select id="q4" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>
<br>
<label for="q5">5. I feel that I am a guilty person who deserves to be punished.</label>
<select id="q5" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>
<br>
<label for="q6">6. I often feel restless with decreased activity.</label>
<select id="q6" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>
<br>
<label for="q7">7. I have difficulty making decisions and do things slowly.</label>
<select id="q7" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>
<br>
<label for="q8">8. I feel fatigued and it takes great effort for me to do simple things.</label>
<select id="q8" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>
<br>
<label for="q9">9. I have often noticed changes in my weight and appetite.</label>
<select id="q9" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>
<br>
<label for="q10">10. I have lost interest in sex and I am experiencing sexual difficulties.</label>
<select id="q10" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>
<br>
<label for="q11">11. I feel lifeless -- more dead than alive.</label>
<select id="q11" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>
<br>
<label for="q12">12. My future seems hopeless and I feel trapped.</label>
<select id="q12" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>
<br>
<label for="q13">13. My sleep has been disturbed; it's either too much or too little.</label>
<select id="q13" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>
<br>
<label for="q14">14. I feel depressed even when good things happen to me.</label>
<select id="q14" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>
<br>
<label for="q15">15. I often get thoughts of suicide or death.</label>
<select id="q15" required>
<option value="Agree">Agree</option>
<option value="Neutral">Neutral</option>
<option value="Disagree">Disagree</option>
</select>

<br>
<button type="button" onclick="calculateRisk()">Calculate</button>
<button type="button" onclick="clearForm()">Clear</button>

<div class="output-box">
<div class="output">
<div class="empty-output" id="outputTarget"></div>
</div>
</div>

</div>
</div>
<script src="../javascript/depression.js"></script>
<script src="https://kit.fontawesome.com/9e5d1ce9c2.js" crossorigin="anonymous"></script>
<footer class="footer">
<h2>Wellness Wave</h2>
<p>
"Sweat Today, Shine Tomorrow. Embrace the Burn, Sculpt the Strength.
Your Journey, Your Body, Your Triumph. Elevate your Fitness, Elevate your Life."
</p>
<h3 class="a"><a class="a" href="../html_files/terms.html" target="_blank">Terms & Conditions </a></h3>

<h3 class="a"><a class="a" href="../html_files/faq.html" target="_blank">Frequently Asked Questions</a></h3>


<div class="container2">
<a href="https://twitter.com/ritikatwts" target="_blank" rel="noopener noreferrer" class="twitter-link">
<i class="fab fa-x-twitter" style="font-size: 1.25em;margin: 2px;"></i></a>
<a href="mailto:ritikamalik100102@gmail.com" class="e-mail-link">
<i class="fa-solid fa-envelope"style="font-size: 1.25em;margin: 2px;"></i></a>
<a href="https://github.com/ritika728" target="_blank" rel="noopener noreferrer" class="github-link">
<i class="fa-brands fa-github"style="font-size: 1.25em;margin: 2px;"></i></a>
<a href="https://www.linkedin.com/in/ritika-malik-must/" target="_blank" rel="noopener noreferrer" class="linkedin-link">
<i class="fa-brands fa-linkedin"style="font-size: 1.25em;margin: 2px;"></i></a>
</div>
<hr width="80%" color="silver">
<div class="footer__bar">
Copyright © 2024 Wellness Wave . All rights reserved.
</div>
</footer>
</body>
</html>

6 changes: 6 additions & 0 deletions html_files/fitnesstracking.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ <h4>Breast Cancer Risk Calculator</h4>
<p>This Breast Cancer Risk calculator is used to estimate an individual's breast cancer risk based on various factors such as age, family history, and reproductive history.</p>
</div>
</a>
<a href="depression.html" class="category">
<div class="container_box">
<h4>Depression Screnning Risk Calculator</h4>
<p>The Depression Screening risk calculator assesses individuals' mental health by evaluating key factors, providing a quick and effective way to identify potential symptoms and risks associated with depression.</p>
</div>
</a>
<a href="ideal_weight.html" class="category">
<div class="container_box gradient-hover">
<h4>Ideal Body Weight Calculator</h4>
Expand Down
Binary file added images/depression.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 94 additions & 0 deletions javascript/depression.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@

function calculateTotalScore() {

var q1 = document.getElementById("q1").value;
var q2 = document.getElementById("q2").value;
var q3 = document.getElementById("q3").value;
var q4 = document.getElementById("q4").value;
var q5 = document.getElementById("q5").value;
var q6 = document.getElementById("q6").value;
var q7 = document.getElementById("q7").value;
var q8 = document.getElementById("q8").value;
var q9 = document.getElementById("q9").value;
var q10 = document.getElementById("q10").value;
var q11 = document.getElementById("q11").value;
var q12 = document.getElementById("q12").value;
var q13 = document.getElementById("q13").value;
var q14 = document.getElementById("q14").value;
var q15 = document.getElementById("q15").value;

var score = 0;
score += (q1 === "Agree") ? 1 : 0;
score += (q2 === "Agree") ? 1 : 0;
score += (q3 === "Agree") ? 1 : 0;
score += (q4 === "Agree") ? 1 : 0;
score += (q5 === "Agree") ? 1 : 0;
score += (q6 === "Agree") ? 1 : 0;
score += (q7 === "Agree") ? 1 : 0;
score += (q8 === "Agree") ? 1 : 0;
score += (q9 === "Agree") ? 1 : 0;
score += (q10 === "Agree") ? 1 : 0;
score += (q11 === "Agree") ? 1 : 0;
score += (q12 === "Agree") ? 1 : 0;
score += (q13 === "Agree") ? 1 : 0;
score += (q14 === "Agree") ? 1 : 0;
score += (q15 === "Agree") ? 1 : 0;

return score;
}

function displayResult(score) {
var severity = getSeverity(score);
var resultText = "Calculated Risk: " + score + "<br>Severity: " + severity;
document.getElementById("outputTarget").innerHTML = resultText;
}
function getSeverity(score) {
if (score >= 0 && score <= 3) {
return "Low Depression";
} else if (score > 3 && score <= 6) {
return "Mild Depression";
} else if (score > 6 && score <= 9) {
return "Moderate Depression";
} else if (score > 9 && score <= 12) {
return "Moderately Severe Depression";
} else {
return "Severe Depression";
}
}
function calculateRisk() {
var age = document.getElementById("age").value;

if (age === "") {
alert("Please enter your age before calculating the risk.");
return;
}
var totalScore = calculateTotalScore();
displayResult(totalScore);
}

function clearForm() {

document.getElementById("gender").value = "male";
document.getElementById("age").value = "";
document.getElementById("q1").value = "Agree";
document.getElementById("q2").value = "Agree";
document.getElementById("q3").value = "Agree";
document.getElementById("q4").value = "Agree";
document.getElementById("q5").value = "Agree";
document.getElementById("q6").value = "Agree";
document.getElementById("q7").value = "Agree";
document.getElementById("q8").value = "Agree";
document.getElementById("q9").value = "Agree";
document.getElementById("q10").value = "Agree";
document.getElementById("q11").value = "Agree";
document.getElementById("q12").value = "Agree";
document.getElementById("q13").value = "Agree";
document.getElementById("q14").value = "Agree";
document.getElementById("q15").value = "Agree";


document.getElementById("outputTarget").innerHTML = "";
}

document.getElementById("calculateButton").addEventListener("click", calculateRisk);
document.getElementById("clearButton").addEventListener("click", clearForm);

0 comments on commit ae253fb

Please sign in to comment.