-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile
More file actions
executable file
·99 lines (86 loc) · 2.86 KB
/
Copy pathcompile
File metadata and controls
executable file
·99 lines (86 loc) · 2.86 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
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
#!/usr/bin/env node
var _ = require('dry-underscore');
var checklist = [
{
title: "Thoughts and Feelings",
questions: [
"Feeling sad or down in the dumps",
"Feeling unhappy or blue",
"Crying spells or tearfulness",
"Feeling discouraged",
"Feeling hopeless",
"Low self-esteem",
"Feeling worthless or inadequate",
"Guilt or shame",
"Criticizing yourself or blaming yourself",
"Difficulty making decisions",
]
},{
title: "Activities and Personal Relationships",
questions: [
"Loss of interest in family, friends or colleagues",
"Loneliness",
"Spending less time with family or friends",
"Loss of motivation",
"Loss of interest in work or other activities",
"Avoiding work or other activities",
"Loss of pleasure or satisfaction in life",
]
},{
title: "Physical Symptoms",
questions: [
"Feeling tired",
"Difficulty sleeping or sleeping too much",
"Decreased or increased appetite",
"Loss of interest in sex",
"Worrying about your health",
]
},{
title: "Suicidal Urges",
questions: [
"Do you have any suicidal thoughts?",
{ text: "Would you like to end your life?", suicide: true },
{ text: "Do you have a plan for harming yourself?", suicide: true },
]
}
];
var question_number = 0;
_.each(checklist, function(cl){
cl.questions = _.map(cl.questions, function(question){
question_number++;
if(_.isString(question)){ question = { text: question }; }
return(_.extend({ first: (question_number === 1), number: question_number }, question));
});
});
var answers = [
{ score: 0, title: "Not At All" },
{ score: 1, title: "Somewhat" },
{ score: 2, title: "Moderately" },
{ score: 3, title: "A Lot" },
{ score: 4, title: "Extremely" },
];
var scoring_key = [
{ min: 0, max: 5, result: "No Depression", normal: true },
{ min: 6, max: 10, result: "Normal but unhappy", normal: true },
{ min: 11, max: 25, result: "Mild depression" },
{ min: 26, max: 50, result: "Moderate depression" },
{ min: 51, max: 75, result: "Severe depression" },
{ min: 76, max: 100, result: "Extreme depression" }
];
var legend = {
title: "Level of Depression",
values: scoring_key
};
function main(){
_.render.load_file("page", "./page.html.hb");
// _.render.load_file("checklist", "./checklist.html.hb");
var page_data = { scoring_key: scoring_key };
var hash = {
checklist: checklist,
answers: answers,
legend: legend,
page_data: _.stringify(_.stringify(page_data))
};
_.stdout(_.render("page", hash));
}
main();