[LON-CAPA-cvs] cvs: modules /gerd evaluate.pl
www
lon-capa-cvs@mail.lon-capa.org
Thu, 30 Mar 2006 13:29:55 -0000
www Thu Mar 30 08:29:55 2006 EDT
Added files:
/modules/gerd evaluate.pl
Log:
Evaluate course data
Index: modules/gerd/evaluate.pl
+++ modules/gerd/evaluate.pl
use strict;
# Read the discussions
open(IN,'classified.csv');
my %evals=();
my %totals=();
my $line;
while ($line=<IN>) {
chomp($line);
my ($user,$length,$classes)=($line=~/^(\w+)\,.+\,(\d+)\,(\w+)$/);
unless ($user) { next; }
unless ($length) { next; }
my @entries=($classes=~/(\d\w)/g);
foreach (@entries) {
$evals{$user.':'.$_}+=$length/($#entries+1);
}
$totals{$user}+=$length;
}
close(IN);
my %discussion;
foreach my $user (keys %totals) {
foreach my $number (1..8) {
foreach my $char ('a'..'d') {
$discussion{$user.':'.$number.$char}=$evals{$user.':'.$number.$char}/$totals{$user};
}
}
}
# Read the other info
open(IN,'compiled.csv');
my %grade=();
my %fcipre=();
my %fcipost=();
my %mpexpre=();
my %mpexpost=();
my %gender=();
my %fcigain=();
my %mpex=();
my %fci=();
$line=<IN>; # header
while ($line=<IN>) {
chomp($line);
my @entries=split(/\,/,$line);
my $user=$entries[4];
unless ($user=~/\w/) { next; }
$gender{$user}=$entries[1];
$grade{$user}=$entries[7]/4;
$fcipre{$user}=$entries[8]/30;
foreach my $mp (1..34) {
$mpexpre{$user.':'.$mp}=($entries[38+$mp]-1)/4;
}
$fcipost{$user}=$entries[73]/30;
if (($fcipost{$user}) && ($fcipre{$user})) {
$fcigain{$user}=($fcipost{$user}-$fcipre{$user})/2+0.5;
$fci{$user}=($fcipost{$user}+$fcipre{$user})/2;
} elsif ($fcipost{$user}) {
$fci{$user}=$fcipost{$user};
} elsif ($fcipre{$user}) {
$fci{$user}=$fcipre{$user};
}
foreach my $mp (1..34) {
$mpexpost{$user.':'.$mp}=($entries[103+$mp]-1)/4;
}
foreach my $mp (1..34) {
if (($mpexpost{$user.':'.$mp}) && ($mpexpre{$user.':'.$mp})) {
$mpex{$user.':'.$mp}=($mpexpost{$user.':'.$mp}+$mpexpre{$user.':'.$mp})/2;
} elsif ($mpexpost{$user.':'.$mp}) {
$mpex{$user.':'.$mp}=$mpexpost{$user.':'.$mp};
} elsif ($mpexpre{$user.':'.$mp}) {
$mpex{$user.':'.$mp}=$mpexpre{$user.':'.$mp};
}
}
}
close(IN);
#
# All information read
# Variables between 0 and 1 for
# discussions
# fcipre
# fcipost
# mpexpre
# mpexpost
# grade
# fcigain
#