-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
72 lines (56 loc) · 2.38 KB
/
index.html
File metadata and controls
72 lines (56 loc) · 2.38 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Target Heart Rate Estimator</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 40px;
}
input, button {
padding: 10px;
font-size: 16px;
margin-top: 10px;
}
#result {
margin-top: 20px;
font-weight: bold;
}
</style>
</head>
<body>
<h2>HRt = 185.8 + (-0.06*PCSI score) + (-1.88*Age) + (0.47*time since injury) + (-0.21*Neck Disability Index) + (-0.65*HADS depression score)</h2>
<p>Not medical advice. Please don't sue me...</p>
<label for="pcsi">PCSI score (3-114):</label>
<input type="number" id="pcsi" step="1" min="3" max="114">
<label for="age">Age (13–18):</label>
<input type="number" id="age" step="1" min="13" max="18">
<label for="time">Time since injury (days, 4-21):</label>
<input type="number" id="time" step="1" min="4" max="21">
<label for="ndi">Neck Disability Index (0-32):</label>
<input type="number" id="ndi" step="1" min="0" max="32">
<label for="hads">HADS Depression Score (0–12):</label>
<input type="number" id="hads" step="1" min="0" max="12">
<button onclick="calculateHRt()">Calculate HRt</button>
<p id="result"></p>
<script>
function calculateHRt() {
const pcsi = parseFloat(document.getElementById("pcsi").value);
const age = parseFloat(document.getElementById("age").value);
const time = parseFloat(document.getElementById("time").value);
const ndi = parseFloat(document.getElementById("ndi").value);
const hads = parseFloat(document.getElementById("hads").value);
if ([pcsi, age, time, ndi, hads].some(isNaN)) {
document.getElementById("result").textContent = "Oops! You forgot to add a value above.";
return;
}
if (pcsi < 3 || pcsi > 114 || age < 13 || age > 18 || time < 4 || time > 21 || ndi < 0 || ndi > 32 || hads < 0 || hads > 12) {
document.getElementById("result").textContent = "A value you entered above is outside of the range of our prediction model. A prediction for this person may not be accurate.";
return;
}
const hrt = 185.8 + (-0.06 * pcsi) + (-1.88 * age) + (0.47 * time) + (-0.21 * ndi) + (-0.65 * hads);
document.getElementById("result").textContent = `Estimated HRt: ${hrt.toFixed(2)} bpm`;
}
</script>
</body>
</html>