-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbprs.pl
More file actions
60 lines (51 loc) · 1.72 KB
/
bprs.pl
File metadata and controls
60 lines (51 loc) · 1.72 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
#!/usr/bin/perl
sub calculate_bprs_total_score {
my @bprs_items = (
'01. Somatic Concern', # Replace with the actual BPRS item scores
'02. Anxiety',
'03. Emotional Withdrawal',
'04. Conceptual Disorganisation',
'05. Guilt Feelings',
'06. Tension',
'07. Mannerisms and Posturing',
'08. Grandiosity',
'09. Depressive Mood',
'10. Hostility',
'11. Suspiciousness',
'12. Hallucinatory Behaviour',
'13. Motor Retardation',
'14. Uncooperativness',
'15. Unusual Thought Conent',
'16. Blunted Affect' ,
'17. Excitement',
'18. Disorientation', # Add more items as needed
);
my %bprs_scores;
# Get user input for each BPRS item
foreach my $item (@bprs_items) {
my $valid_input = 0;
while (!$valid_input) {
print "Enter score for $item [0-7]: ";
my $score = <STDIN>;
chomp($score);
# Validate input
if ($score =~ /^\d+$/ && $score >= 0 && $score <= 7) {
$bprs_scores{$item} = $score;
$valid_input = 1;
} else {
print "Invalid input. Please enter a number between 0 and 7.\n";
}
}
}
# Calculate total BPRS score
my $total_score = 0;
foreach my $item_score (values %bprs_scores) {
$total_score += $item_score;
}
return $total_score;
}
# Main program
print "Brief Psychiatric Rating Scale (BPRS) Total Score Calculator\n";
my $total_bprs_score = calculate_bprs_total_score();
# Print the total score
print "\nTotal BPRS Score: $total_bprs_score\n";