#!/usr/local/bin/perl
# summarize referee reports for ISCA

# pno = paper number
# ptl = paper title
# cnf = confidence rating
# imp = importance
# qty = quality
# tch = technical 
# act = action
# rnm = referee name
# raf = referee affiliation

# nrv = number of reviews
# apno = active paper number
# ccnf = cumulative confidence rating
# cimp = cumulative importance
# cqty = cumulative quality
# ctch = cumulative technical 
# cact = cumulative action
# @act = all action scores
# cvar = cumulative variance--prints sqrt


while (<>) {
    ($pno, $cnf, $imp, $qty, $tch, $act, $rnm, $ptl) = split(/:%:/);
    $nrv ++;
    $ccnf += $cnf;
    $cimp += $imp;
    $cqty += $qty;
    $ctch += $tch;
    $cact += $act;
	$ccnf{$rnm} += $cnf;
        $nrv {$rnm} ++;
    $cimp{$rnm} += $imp;
    $cqty{$rnm} += $qty;
    $ctch{$rnm} += $tch;
    $cact {$rnm}+= $act;
}
   $ccnf /= $nrv;
    $cimp /= $nrv;
    $cqty /= $nrv;
    $ctch /= $nrv;
    $cact /= $nrv;


print "Averages all Referees\n","Confidence = ",$ccnf,"\nImportance = ",$cimp,"\nQuality of presentation = ",$cqty,"\nTechnical contribution = ",$ctch,"\nRecommendation action = ",$cact,"\n\n\n\n\n";

foreach $target (sort keys(%ccnf))
{   $nrv=$nrv{$target};  write;}

format STDOUT_TOP =
Referee          #Reports  Confidence  Importance   Presentation   Technical      ACTION  
=======================================================================================
.

format STDOUT =
@<<<<<<<<<<<<<<<    @##        @.#         @.#          @.#            @.#         @.#  
$target,$nrv{$target}, $ccnf{$target}/$nrv,  $cimp{$target}/$nrv,  $cqty{$target}/$nrv, $ctch{$target}/$nrv, $cact{$target}/$nrv
.



