Skip to content

Commit c2da2c3

Browse files
committed
Geriatric Depression Scale (short form) added
1 parent 45e2d43 commit c2da2c3

18 files changed

+358
-19
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
*.iml
22
*.apk
3+
/app/release
34
.gradle
45
/local.properties
56
/.idea/workspace.xml

.idea/misc.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ android {
77
applicationId "uk.co.agnate.eldercare"
88
minSdkVersion 15
99
targetSdkVersion 26
10-
versionCode 14
10+
versionCode 15
1111
versionName "1.1"
1212
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1313
}

app/src/main/assets/about.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ <h1>About</h1>
3232
<p>This app has been designed as an educational resource for medicine in the eldery with the support of the staff and students of the eldercare department at Royal Cornwall Hospital, UK.</p>
3333
<p>Built with Bootstrap 4, HTML5, Font Awesome, Orgnode, Android Studio, Apple Xcode. Where possible all original scientific works have been cited with a journal reference and all registered trademarks and copyright acknowledged.</p>
3434
<p>This compilation of educational material and its <a href="https://github.com/rdjenkins/eldercare">source code</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.</p>
35-
<p>Version: 25 October 2017</p><!-- automatically updated -->
35+
<p>Version: 28 October 2017</p><!-- automatically updated -->
3636
<p>Contributors:<br>
3737
<a href="https://about.me/deanjenkins">Dr Dean Jenkins</a></p>
3838
</div><!-- /.container -->

app/src/main/assets/css/scale.css

+5-1
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,9 @@ input[type=radio]:checked + label:before { letter-spacing: 1rem; } /* allow spac
4444
input[type=radio]:checked + label { background: #e0e0e0; } /* extra visual identification of radio option */
4545

4646

47-
47+
/*.yndk input[type=radio] {display: contents;}*/
48+
.yndk input[type=radio] + label { background: #ffffff; padding: 0.5rem;}
49+
.yndk input[type=radio] + label:before { content: ""; letter-spacing: 0;}
50+
.yndk input[type=radio]:checked + label:before { content: ""; letter-spacing: 0;}
51+
.yndk input[type=radio]:checked + label { background: #e0e0e0; border: 1px solid black; }
4852

app/src/main/assets/js/scales/abcd2.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function simplecheckbox(varname,value,labeltext,onclick) {
106106
var html = ' <div class="row1">' +
107107
' <div class="col1">' +
108108
' <input id="' + varname + '" value="'+ value +'" onclick="'+ onclick +'" type="checkbox">' +
109-
' <label for="' + varname + '">' + labeltext + '' +
109+
' <label for="' + varname + '">' + labeltext + '</label>' +
110110
' </div>' +
111111
' </div>'
112112
return html;
@@ -116,7 +116,7 @@ function simpleradio(varid,varname,value,labeltext,onclick) {
116116
var html = ' <div class="row1">' +
117117
' <div class="col1">' +
118118
' <input id="' + varid + '" name="' + varname + '" value="'+ value +'" onclick="'+ onclick +'" type="radio">' +
119-
' <label for="' + varid + '">' + labeltext + '' +
119+
' <label for="' + varid + '">' + labeltext + '</label>' +
120120
' </div>' +
121121
' </div>'
122122
return html;

app/src/main/assets/js/scales/amt.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function simplecheckbox(varname,value,labeltext,onclick) {
7676
var html = ' <div class="row1">' +
7777
' <div class="col1">' +
7878
' <input id="' + varname + '" value="'+ value +'" onclick="'+ onclick +'" type="checkbox">' +
79-
' <label for="' + varname + '">' + labeltext + '' +
79+
' <label for="' + varname + '">' + labeltext + '</label>' +
8080
' </div>' +
8181
' </div>'
8282
return html;

app/src/main/assets/js/scales/cha2ds2-vasc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ function simplecheckbox(varname,value,labeltext,onclick) {
120120
var html = ' <div class="row1">' +
121121
' <div class="col1">' +
122122
' <input id="' + varname + '" value="'+ value +'" onclick="'+ onclick +'" type="checkbox">' +
123-
' <label for="' + varname + '">' + labeltext + '' +
123+
' <label for="' + varname + '">' + labeltext + '</label>' +
124124
' </div>' +
125125
' </div>'
126126
return html;

app/src/main/assets/js/scales/curb-65.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function simplecheckbox(varname,value,labeltext,onclick) {
7575
var html = ' <div class="row1">' +
7676
' <div class="col1">' +
7777
' <input id="' + varname + '" value="'+ value +'" onclick="'+ onclick +'" type="checkbox">' +
78-
' <label for="' + varname + '">' + labeltext + '' +
78+
' <label for="' + varname + '">' + labeltext + '</label>' +
7979
' </div>' +
8080
' </div>'
8181
return html;
@@ -92,7 +92,7 @@ headerBlurb("CURB-65 score","Risk of death in community-acquired pneumonia","Tic
9292
simplecheckbox("tblable_calc_form_c","1","Confusion - i.e. AMT score of 8 or less (1)","CURB65();") +
9393
simplecheckbox("tblable_calc_form_u","1","Urea &gt;7 mmol/l (1)","CURB65();") +
9494
simplecheckbox("tblable_calc_form_r","1","Respiratory rate &gt;30/min (1)","CURB65();") +
95-
simplecheckbox("tblable_calc_form_b","1","Blood pression (SBP &lt;90mmHg or DBP ≤60mmHg (1)","CURB65();") +
95+
simplecheckbox("tblable_calc_form_b","1","Blood pressure (SBP &lt;90mmHg or DBP ≤60mmHg (1)","CURB65();") +
9696
simplecheckbox("tblable_calc_form_a","1","Age ≥65 (1)","CURB65();") +
9797

9898
' <div id="result" class="alert alert-success">' +

app/src/main/assets/js/scales/gds.js

+295
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,295 @@
1+
// Geriatric Depression Score Calculator
2+
// Javascript to load a bootstrap-styled calculator on a page
3+
// created 27/Oct/2017 Dean Jenkins
4+
5+
// The original scale is in the public domain due to it being partly the result of Federal support.
6+
// See https://web.stanford.edu/~yesavage/GDS.html for more information.
7+
8+
// This code has been released under the following license.
9+
// Creative Commons Attribution 4.0 International (CC BY 4.0)
10+
// https://creativecommons.org/licenses/by/4.0/
11+
12+
function getvaluefromcheckbox(id) {
13+
if (document.getElementById(id).checked) {
14+
return parseFloat(document.getElementById(id).value);
15+
} else {
16+
return 0;
17+
}
18+
}
19+
20+
// getvaluefromradio() for getting radio values
21+
function getvaluefromradio(name) { // radio buttons work if they have the same name!
22+
var radios = document.getElementsByName(name);
23+
24+
for (var i = 0, length = radios.length; i < length; i++) {
25+
if (radios[i].checked) {
26+
return parseFloat(radios[i].value);
27+
// only one radio can be logically checked, don't check the rest
28+
break;
29+
}
30+
}
31+
return null; // we may get here if no radio is checked
32+
}
33+
34+
function getvaluefromyndkradio(name,positive) {
35+
value = getvaluefromradio(name);
36+
if (value == positive) {
37+
return 1;
38+
}
39+
if (value == 0) {
40+
return null;
41+
} else {
42+
return 0;
43+
}
44+
}
45+
46+
function uncheck(id) {
47+
document.getElementById(id).checked = false;
48+
}
49+
50+
//uncheckradio() for unchecking radio buttons
51+
function uncheckradio(name) { // radio buttons work if they have the same name!
52+
var radios = document.getElementsByName(name);
53+
54+
for (var i = 0, length = radios.length; i < length; i++) {
55+
radios[i].checked = false;
56+
}
57+
}
58+
59+
//checkradio() for checking radio buttons
60+
function checkradio(id) { // specific radio button options have different id's
61+
document.getElementById(id).checked = true;
62+
}
63+
64+
65+
function GDS()
66+
{
67+
var totalquestions = 15;
68+
var skipped = 0;
69+
var gds1=getvaluefromyndkradio("tblable_calc_form_GDS1","-1");
70+
if (gds1==null) { skipped = skipped + 1; }
71+
var gds2=getvaluefromyndkradio("tblable_calc_form_GDS2","1");
72+
if (gds2==null) { skipped = skipped + 1; }
73+
var gds3=getvaluefromyndkradio("tblable_calc_form_GDS3","1");
74+
if (gds3==null) { skipped = skipped + 1; }
75+
var gds4=getvaluefromyndkradio("tblable_calc_form_GDS4","1");
76+
if (gds4==null) { skipped = skipped + 1; }
77+
var gds5=getvaluefromyndkradio("tblable_calc_form_GDS5","-1");
78+
if (gds5==null) { skipped = skipped + 1; }
79+
var gds6=getvaluefromyndkradio("tblable_calc_form_GDS6","1");
80+
if (gds6==null) { skipped = skipped + 1; }
81+
var gds7=getvaluefromyndkradio("tblable_calc_form_GDS7","-1");
82+
if (gds7==null) { skipped = skipped + 1; }
83+
var gds8=getvaluefromyndkradio("tblable_calc_form_GDS8","1");
84+
if (gds8==null) { skipped = skipped + 1; }
85+
var gds9=getvaluefromyndkradio("tblable_calc_form_GDS9","1");
86+
if (gds9==null) { skipped = skipped + 1; }
87+
var gds10=getvaluefromyndkradio("tblable_calc_form_GDS10","1");
88+
if (gds10==null) { skipped = skipped + 1; }
89+
var gds11=getvaluefromyndkradio("tblable_calc_form_GDS11","-1");
90+
if (gds11==null) { skipped = skipped + 1; }
91+
var gds12=getvaluefromyndkradio("tblable_calc_form_GDS12","1");
92+
if (gds12==null) { skipped = skipped + 1; }
93+
var gds13=getvaluefromyndkradio("tblable_calc_form_GDS13","-1");
94+
if (gds13==null) { skipped = skipped + 1; }
95+
var gds14=getvaluefromyndkradio("tblable_calc_form_GDS14","1");
96+
if (gds14==null) { skipped = skipped + 1; }
97+
var gds15=getvaluefromyndkradio("tblable_calc_form_GDS15","1");
98+
if (gds15==null) { skipped = skipped + 1; }
99+
100+
if (skipped == totalquestions) {
101+
var score = 0;
102+
} else {
103+
var score = parseFloat(gds1 + gds2 + gds3 + gds4 + gds5 + gds6 + gds7 + gds8 + gds9 + gds10 + gds11 + gds12 + gds13 + gds14 + gds15);
104+
}
105+
if (skipped < 8 && skipped > 0) { // correct score as 'few' questions missed
106+
// see https://web.stanford.edu/~yesavage/GDS.html for the logic
107+
var rawscore = score;
108+
console.log("raw score = " + rawscore);
109+
console.log("skipped = " + skipped);
110+
var totalanswered = totalquestions - skipped;
111+
console.log("total answered = " + totalanswered);
112+
console.log("score = " + rawscore + " + " + skipped + " *(" + rawscore + "/" + totalanswered + ")");
113+
score = rawscore + skipped * (rawscore / (totalquestions - skipped));
114+
score = Math.round(score + 0.5);
115+
if (score>15) { score=15; } // don't give a score of 16 by rounding up
116+
console.log("score = " + score);
117+
}
118+
document.getElementById("tblable_calc_form_score").innerHTML = score.toString();
119+
120+
var summaryhtml="";
121+
122+
if (score<5) {
123+
summaryhtml = summaryhtml + "Normal, depending on age, education, complaints";
124+
$('#result').removeClass();
125+
$('#result').addClass("alert alert-success");
126+
}
127+
if (score>4 && score<9) {
128+
summaryhtml = summaryhtml + "Mild depression";
129+
$('#result').removeClass();
130+
$('#result').addClass("alert alert-warning");
131+
}
132+
if (score>8 && score<12) {
133+
summaryhtml = summaryhtml + "Moderate depression";
134+
$('#result').removeClass();
135+
$('#result').addClass("alert alert-danger");
136+
}
137+
if (score>11) {
138+
summaryhtml = summaryhtml + "Severe depression";
139+
$('#result').removeClass();
140+
$('#result').addClass("alert alert-danger");
141+
}
142+
143+
if (skipped < 8 && skipped > 0 && score != rawscore) {
144+
if (skipped==1) {
145+
summaryhtml = summaryhtml + ". (Score of " + rawscore + " corrected assuming the 1 missed question would indicate depression.)";
146+
} else {
147+
summaryhtml = summaryhtml + ". (Score of " + rawscore + " corrected assuming " + parseFloat(score - rawscore) + " of the " + skipped + " missed questions would indicate depression.)";
148+
}
149+
}
150+
document.getElementById("tblable_calc_form_comment").innerHTML = summaryhtml;
151+
}
152+
153+
function resetCalc() {
154+
uncheckradio("tblable_calc_form_GDS1");
155+
checkradio("tblable_calc_form_GDS1dk");
156+
157+
uncheckradio("tblable_calc_form_GDS2");
158+
checkradio("tblable_calc_form_GDS2dk");
159+
160+
uncheckradio("tblable_calc_form_GDS3");
161+
checkradio("tblable_calc_form_GDS3dk");
162+
163+
uncheckradio("tblable_calc_form_GDS4");
164+
checkradio("tblable_calc_form_GDS4dk");
165+
166+
uncheckradio("tblable_calc_form_GDS5");
167+
checkradio("tblable_calc_form_GDS5dk");
168+
169+
uncheckradio("tblable_calc_form_GDS6");
170+
checkradio("tblable_calc_form_GDS6dk");
171+
172+
uncheckradio("tblable_calc_form_GDS7");
173+
checkradio("tblable_calc_form_GDS7dk");
174+
175+
uncheckradio("tblable_calc_form_GDS8");
176+
checkradio("tblable_calc_form_GDS8dk");
177+
178+
uncheckradio("tblable_calc_form_GDS9");
179+
checkradio("tblable_calc_form_GDS9dk");
180+
181+
uncheckradio("tblable_calc_form_GDS10");
182+
checkradio("tblable_calc_form_GDS10dk");
183+
184+
uncheckradio("tblable_calc_form_GDS11");
185+
checkradio("tblable_calc_form_GDS11dk");
186+
187+
uncheckradio("tblable_calc_form_GDS12");
188+
checkradio("tblable_calc_form_GDS12dk");
189+
190+
uncheckradio("tblable_calc_form_GDS13");
191+
checkradio("tblable_calc_form_GDS13dk");
192+
193+
uncheckradio("tblable_calc_form_GDS14");
194+
checkradio("tblable_calc_form_GDS14dk");
195+
196+
uncheckradio("tblable_calc_form_GDS15");
197+
checkradio("tblable_calc_form_GDS15dk");
198+
}
199+
200+
function unckeck(varname) {
201+
document.getElementById(varname).checked = false;
202+
}
203+
204+
function headerBlurb(title,oneliner,instruction) {
205+
var html='<h2>' + title + '</h2>' +
206+
'<p>' + oneliner + '</p>' +
207+
'<p class="font-italic">' + instruction + '</p>'
208+
return html;
209+
}
210+
211+
function simplecheckbox(varname,value,labeltext,onclick) {
212+
var html = ' <div class="row1">' +
213+
' <div class="col1">' +
214+
' <input id="' + varname + '" value="'+ value +'" onclick="'+ onclick +'" type="checkbox">' +
215+
' <label for="' + varname + '">' + labeltext + '</label>' +
216+
' </div>' +
217+
' </div>'
218+
return html;
219+
}
220+
221+
function simpleradio(varid,varname,value,labeltext,onclick) {
222+
var html = ' <div class="row1">' +
223+
' <div class="col1">' +
224+
' <input id="' + varid + '" name="' + varname + '" value="'+ value +'" onclick="'+ onclick +'" type="radio">' +
225+
' <label for="' + varid + '">' + labeltext + '</label>' +
226+
' </div>' +
227+
' </div>'
228+
return html;
229+
}
230+
231+
function yndkradio(varidy,varidn,variddk,varname,question,onclick) {
232+
var html = ' <div>' +
233+
' <div>' +
234+
' <p>' + question + '</p>' +
235+
' </div>' +
236+
' <div class="col1 yndk">' +
237+
' <input id="' + varidy + '" name="' + varname + '" value="1" onclick="'+ onclick +'" type="radio">' +
238+
' <label for="' + varidy + '">Yes</label>' +
239+
' <input id="' + varidn + '" name="' + varname + '" value="-1" onclick="'+ onclick +'" type="radio">' +
240+
' <label for="' + varidn + '">No</label>' +
241+
' <input id="' + variddk + '" name="' + varname + '" value="0" onclick="'+ onclick +'" type="radio">' +
242+
' <label for="' + variddk + '">skip</label>' +
243+
' </div>' +
244+
' </div>'
245+
return html;
246+
}
247+
248+
249+
var calculatorHTML = '' +
250+
'<div class="calculator" id="tblable_calc">' +
251+
252+
' <div name="hform" id="tblable_calc_form">' +
253+
254+
headerBlurb("Geriatric Depression Scale","Screening tool for depression (short version)","Select all that apply. Score may be corrected for skipped questions.") +
255+
256+
yndkradio("tblable_calc_form_GDS1y","tblable_calc_form_GDS1n","tblable_calc_form_GDS1dk","tblable_calc_form_GDS1","Are you basically satisfied with your life?","GDS();") +
257+
yndkradio("tblable_calc_form_GDS2y","tblable_calc_form_GDS2n","tblable_calc_form_GDS2dk","tblable_calc_form_GDS2","Have you dropped many of your activities and interests?","GDS();") +
258+
yndkradio("tblable_calc_form_GDS3y","tblable_calc_form_GDS3n","tblable_calc_form_GDS3dk","tblable_calc_form_GDS3","Do you feel that your life is empty?","GDS();") +
259+
yndkradio("tblable_calc_form_GDS4y","tblable_calc_form_GDS4n","tblable_calc_form_GDS4dk","tblable_calc_form_GDS4","Do you often get bored?","GDS();") +
260+
yndkradio("tblable_calc_form_GDS5y","tblable_calc_form_GDS5n","tblable_calc_form_GDS5dk","tblable_calc_form_GDS5","Are you in good spirits most of the time?","GDS();") +
261+
yndkradio("tblable_calc_form_GDS6y","tblable_calc_form_GDS6n","tblable_calc_form_GDS6dk","tblable_calc_form_GDS6","Are you afraid that something bad is going to happen to you?","GDS();") +
262+
yndkradio("tblable_calc_form_GDS7y","tblable_calc_form_GDS7n","tblable_calc_form_GDS7dk","tblable_calc_form_GDS7","Do you feel happy most of the time?","GDS();") +
263+
yndkradio("tblable_calc_form_GDS8y","tblable_calc_form_GDS8n","tblable_calc_form_GDS8dk","tblable_calc_form_GDS8","Do you often feel helpless?","GDS();") +
264+
yndkradio("tblable_calc_form_GDS9y","tblable_calc_form_GDS9n","tblable_calc_form_GDS9dk","tblable_calc_form_GDS9","Do you prefer to stay at home, rather than going out and doing new things?","GDS();") +
265+
yndkradio("tblable_calc_form_GDS10y","tblable_calc_form_GDS10n","tblable_calc_form_GDS10dk","tblable_calc_form_GDS10","Do you feel you have more problems with memory than most?","GDS();") +
266+
yndkradio("tblable_calc_form_GD11y","tblable_calc_form_GDS11n","tblable_calc_form_GDS11dk","tblable_calc_form_GDS11","Do you think it is wonderful to be alive now?","GDS();") +
267+
yndkradio("tblable_calc_form_GDS12y","tblable_calc_form_GDS12n","tblable_calc_form_GDS12dk","tblable_calc_form_GDS12","Do you feel pretty worthless the way you are now?","GDS();") +
268+
yndkradio("tblable_calc_form_GDS13y","tblable_calc_form_GDS13n","tblable_calc_form_GDS13dk","tblable_calc_form_GDS13","Do you feel full of energy?","GDS();") +
269+
yndkradio("tblable_calc_form_GDS14y","tblable_calc_form_GDS14n","tblable_calc_form_GDS14dk","tblable_calc_form_GDS14","Do you feel that your situation is hopeless?","GDS();") +
270+
yndkradio("tblable_calc_form_GDS15y","tblable_calc_form_GDS15n","tblable_calc_form_GDS15dk","tblable_calc_form_GDS15","Do you think that most people are better off than you are?","GDS();") +
271+
272+
' <div id="result" class="alert alert-success">' +
273+
' <div><b>GDS score = <span id="tblable_calc_form_score"></span></b>. ' +
274+
' <span id="tblable_calc_form_comment"></span></div>' +
275+
' </div>' +
276+
277+
' <div class="reset">' +
278+
' <input value="Reset" class="btn btn-secondary" onclick="resetCalc(); GDS(); return false;" type="reset">' +
279+
' </div>' +
280+
281+
' </div><!-- end hform -->' +
282+
283+
'</div><!-- end calculator -->' +
284+
'<p class="small">Source <a href="https://web.stanford.edu/~yesavage/GDS.html">Sheik et al. (1986)</a></p>' +
285+
'';
286+
287+
function calcHTML() {
288+
document.write('<div id="calc"></div>');
289+
290+
document.getElementById("calc").innerHTML = calculatorHTML;
291+
}
292+
293+
calcHTML();
294+
resetCalc(); // required to set the default radio button
295+
GDS();

0 commit comments

Comments
 (0)