-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbprs.awk
73 lines (63 loc) · 2.06 KB
/
bprs.awk
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
#!/usr/bin/awk -f
BEGIN {
# Define the total number of items and valid score range
num_items = 18
min_score = 1
max_score = 7
# Define the names of the 18 BPRS items
items[1] = "Somatic Concern"
items[2] = "Anxiety"
items[3] = "Emotional Withdrawal"
items[4] = "Conceptual Disorganization"
items[5] = "Guilt Feelings"
items[6] = "Tension"
items[7] = "Mannerisms and Posturing"
items[8] = "Grandiosity"
items[9] = "Depressive Mood"
items[10] = "Hostility"
items[11] = "Suspiciousness"
items[12] = "Hallucinatory Behavior"
items[13] = "Motor Retardation"
items[14] = "Uncooperativeness"
items[15] = "Unusual Thought Content"
items[16] = "Blunted Affect"
items[17] = "Excitement"
items[18] = "Disorientation"
# Introduction message
print "Brief Psychiatric Rating Scale (BPRS) Scoring"
print "Please enter scores for each item (1-7):"
# Initialize total score
total_score = 0
}
# Function to validate input
function validate_input(score) {
return (score >= min_score && score <= max_score)
}
{
# Iterate through each item
for (i = 1; i <= num_items; i++) {
while (1) {
# Prompt user with the item name
printf "Item %d - %s (1-7): ", i, items[i]
getline score < "-" # Read input from standard input
# Validate the input
if (score ~ /^[0-9]+$/ && validate_input(score)) {
total_score += score
break
} else {
print "Invalid input! Please enter a number between 1 and 7."
}
}
}
# Display the total score
print "\nTotal BPRS Score: " total_score
# Interpretation of the total score
if (total_score <= 31) {
print "Interpretation: Minimal Symptoms"
} else if (total_score <= 53) {
print "Interpretation: Mild to Moderate Symptoms"
} else {
print "Interpretation: Severe Symptoms"
}
exit
}