script to calculate candidate-wise aggregates