While the 2010 Election was generally peaceful and the results came in fast, it doesn't mean the results were correct. I am referring to:

http://electionresults.ibanangayon.ph/res_reg5808114.html
http://electionresults.ibanangayon.ph/res_reg5808113.html
http://electionresults.ibanangayon.ph/res_reg5808112.html
http://electionresults.ibanangayon.ph/res_reg5808111.html
http://electionresults.ibanangayon.ph/res_reg5808110.html

These results are impossible and could not possibly happen. This is just for 5 clustered precincts. The effect of this mistake for a hundred CP is unimaginable lest a thousand. So i whipped out a small script to find other precincts where results are "questionable". The script basically checks for the "percentage" of votes garnered for a particular candidate. If it goes beyond the pre-configured threshold, it flags the file and makes a log.

Also, you need a local mirror of http://electionresults.ibanangayon.ph which can be easily accomplished with:

wget --mirror –w 2 –-convert-links http://electionresults.ibanangayon.ph

If you are on PLDT, use http://124.105.166.195/, for GlobeTelecom, use http://222.127.18.105/

Remember to edit $SearchFor, $mirror and $threshold to suit for needs.

#!/usr/bin/perl
#
# Election 2010 Anomaly Watcher
# John Homer H Alvero
# [email protected]
# May 13, 2010

use HTML::TableExtract;
use LWP::Simple;

# SearchFor:
# Possible Values:
#
# 1 = President
# 3 = Vice President
# 5 = Senator
# 7 = Party List

my $SearchFor = 1;
my $mirror = "/var/www/election/electionresults.ibanangayon.ph/";
my $threshold = 90;

&check_folders($mirror);

# SUB(s)
sub check_folders {

   my($dir) = @_;
   local (*FOLDER);

   my(@subfiles, $file, $specfile);
   opendir(FOLDER, $dir) or die "cannot open $dir";

   @subfiles = readdir(FOLDER);
   closedir(FOLDER);


   foreach $file (@subfiles) {
      $specfile = $dir .  $file;
      if (-f $specfile && $file =~ m/\S+\.html/) {
        my $page = get("file://" . $specfile) or die $!;
        $te = HTML::TableExtract->new( headers => [qw(Candidate Votes Percentage)], depth => 0, count => $SearchFor );
        $te->parse($page);

        foreach $ts ($te->tables) {
                foreach $row ($ts->rows) {
                        chop( $votes = @$row[2]);
                        if ($votes > $threshold) {
                                print "Found filename " . $specfile . " name:" .  @$row[0] . " at $votes%" . "\n";
                        }
                }
        }
#Check for Subdirectories (not really needed)
      } elsif (-d $specfile) {
        if ($specfile !~ m/\S+\.$/) {
                &check_folders($specfile . "\/");
        }
      }#if
   }#for
}#sub

UPDATE: (May 17, 2010)

I ran the script on my local mirror and here is what I found. (note that my local is not complete yet and scanning is not yet over)

[email protected]:/home/john/ibangangayon/124.105.166.195# /root/table.pl
Found filename res_reg3629006.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg3615004.html name:ACOSTA, Vetellano S. at 100.00%
Found filename res_reg3636022.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg5512002.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg313022.html name:AQUINO, Benigno Simeon III C. at 99.20%
Found filename res_reg3516000.html name:AQUINO, Benigno Simeon III C. at 98.20%
Found filename res_reg3807028.html name:VILLAR, Manuel Jr B. at 99.09%
Found filename res_reg3826010.html name:VILLAR, Manuel Jr B. at 99.49%
Found filename res_reg6615003.html name:VILLAR, Manuel Jr B. at 98.15%
Found filename res_reg3601016.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg705032.html name:AQUINO, Benigno Simeon III C. at 98.55%
Found filename res_reg3812027.html name:AQUINO, Benigno Simeon III C. at 99.64%
Found filename res_reg6610016.html name:TEODORO, Gilberto Jr.  C. at 98.01%
Found filename res_reg6606006.html name:AQUINO, Benigno Simeon III C. at 98.35%
Found filename res_reg3807036.html name:VILLAR, Manuel Jr B. at 98.84%
Found filename res_reg3835015.html name:VILLAR, Manuel Jr B. at 98.18%
Found filename res_reg302019.html name:AQUINO, Benigno Simeon III C. at 98.88%
Found filename res_reg3812029.html name:AQUINO, Benigno Simeon III C. at 99.67%
Found filename res_reg705034.html name:AQUINO, Benigno Simeon III C. at 98.79%
Found filename res_reg3826008.html name:VILLAR, Manuel Jr B. at 98.97%
Found filename res_reg3803017.html name:TEODORO, Gilberto Jr.  C. at 98.32%
Found filename res_reg3803013.html name:TEODORO, Gilberto Jr.  C. at 98.92%
Found filename res_reg3807018.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg3835014.html name:VILLAR, Manuel Jr B. at 98.73%
Found filename res_reg3832009.html name:TEODORO, Gilberto Jr.  C. at 99.24%
Found filename res_reg3812064.html name:AQUINO, Benigno Simeon III C. at 99.29%
Found filename res_reg3617010.html name:VILLAR, Manuel Jr B. at 99.34%
Found filename res_reg3807023.html name:TEODORO, Gilberto Jr.  C. at 99.57%
Found filename res_reg3626009.html name:AQUINO, Benigno Simeon III C. at 98.84%
Found filename res_reg702017.html name:AQUINO, Benigno Simeon III C. at 98.02%
Found filename res_reg3832010.html name:TEODORO, Gilberto Jr.  C. at 99.37%
Found filename res_reg3812047.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg6615012.html name:VILLAR, Manuel Jr B. at 99.19%
Found filename res_reg3812050.html name:AQUINO, Benigno Simeon III C. at 99.87%
Found filename res_reg3629002.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg6607015.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg6610014.html name:TEODORO, Gilberto Jr.  C. at 98.87%
Found filename res_reg4406026.html name:TEODORO, Gilberto Jr.  C. at 100.00%
Found filename res_reg4406026.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg4406026.html name:PERLAS, Jesus Nicanor P. at 100.00%
Found filename res_reg4406026.html name:DE LOS REYES, John Carlos G. at 100.00%
Found filename res_reg4406026.html name:ESTRADA EJERCITO, Joseph M. at 100.00%
Found filename res_reg4406026.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg4406026.html name:VILLANUEVA, Eduardo C. at 100.00%
Found filename res_reg4406026.html name:MADRIGAL, Jamby A. at 100.00%
Found filename res_reg4406026.html name:ACOSTA, Vetellano S. at 100.00%
Found filename res_reg4406026.html name:GORDON, Richard J. at 100.00%
Found filename res_reg112002.html name:TEODORO, Gilberto Jr.  C. at 98.33%
Found filename res_reg6606002.html name:AQUINO, Benigno Simeon III C. at 98.58%
Found filename res_reg3832011.html name:TEODORO, Gilberto Jr.  C. at 99.61%
Found filename res_reg3629018.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg6610010.html name:TEODORO, Gilberto Jr.  C. at 99.37%
Found filename res_reg5535035.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg5535035.html name:VILLANUEVA, Eduardo C. at 100.00%
Found filename res_reg5535035.html name:ACOSTA, Vetellano S. at 100.00%
Found filename res_reg5535035.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg5535035.html name:DE LOS REYES, John Carlos G. at 100.00%
Found filename res_reg5535035.html name:ESTRADA EJERCITO, Joseph M. at 100.00%
Found filename res_reg5535035.html name:GORDON, Richard J. at 100.00%
Found filename res_reg5535035.html name:MADRIGAL, Jamby A. at 100.00%
Found filename res_reg5535035.html name:PERLAS, Jesus Nicanor P. at 100.00%
Found filename res_reg5535035.html name:TEODORO, Gilberto Jr.  C. at 100.00%
Found filename res_reg3812025.html name:AQUINO, Benigno Simeon III C. at 99.62%
Found filename res_reg7001014.html name:TEODORO, Gilberto Jr.  C. at 99.70%
Found filename res_reg3812069.html name:AQUINO, Benigno Simeon III C. at 99.58%
Found filename res_reg1529053.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg1529053.html name:VILLANUEVA, Eduardo C. at 100.00%
Found filename res_reg1529053.html name:PERLAS, Jesus Nicanor P. at 100.00%
Found filename res_reg1529053.html name:TEODORO, Gilberto Jr.  C. at 100.00%
Found filename res_reg1529053.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg1529053.html name:MADRIGAL, Jamby A. at 100.00%
Found filename res_reg1529053.html name:ACOSTA, Vetellano S. at 100.00%
Found filename res_reg1529053.html name:GORDON, Richard J. at 100.00%
Found filename res_reg1529053.html name:DE LOS REYES, John Carlos G. at 100.00%
Found filename res_reg1529053.html name:ESTRADA EJERCITO, Joseph M. at 100.00%
Found filename res_reg3818005.html name:AQUINO, Benigno Simeon III C. at 98.55%
Found filename res_reg3637008.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg3833002.html name:AQUINO, Benigno Simeon III C. at 99.59%
Found filename res_reg3807022.html name:TEODORO, Gilberto Jr.  C. at 99.67%
Found filename res_reg3802024.html name:AQUINO, Benigno Simeon III C. at 99.37%
Found filename res_reg3836018.html name:ACOSTA, Vetellano S. at 100.00%
Found filename res_reg3635006.html name:TEODORO, Gilberto Jr.  C. at 98.31%
Found filename res_reg3803011.html name:TEODORO, Gilberto Jr.  C. at 98.98%
Found filename res_reg3807007.html name:VILLAR, Manuel Jr B. at 98.72%
Found filename res_reg3835017.html name:VILLAR, Manuel Jr B. at 99.11%
Found filename res_reg6610001.html name:TEODORO, Gilberto Jr.  C. at 99.59%
Found filename res_reg3114084.html name:BINAY, Jejomar C. at 100.00%
Found filename res_reg3114084.html name:CHIPECO, Dominador Jr F. at 100.00%
Found filename res_reg3114084.html name:FERNANDO, Bayani F. at 100.00%
Found filename res_reg3114084.html name:LEGARDA, Loren B. at 100.00%
Found filename res_reg3114084.html name:MANZANO, Eduardo B. at 100.00%
Found filename res_reg3114084.html name:ROXAS, Manuel A. at 100.00%
Found filename res_reg3114084.html name:SONZA, Jose Y. at 100.00%
Found filename res_reg3114084.html name:YASAY, Perfecto R. at 100.00%
Found filename res_reg3812057.html name:AQUINO, Benigno Simeon III C. at 98.96%
Found filename res_reg3812014.html name:AQUINO, Benigno Simeon III C. at 98.59%
Found filename res_reg3812019.html name:AQUINO, Benigno Simeon III C. at 98.92%
Found filename res_reg6604024.html name:VILLAR, Manuel Jr B. at 98.72%
Found filename res_reg5527039.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg5527039.html name:VILLANUEVA, Eduardo C. at 100.00%
Found filename res_reg5527039.html name:DE LOS REYES, John Carlos G. at 100.00%
Found filename res_reg5527039.html name:ESTRADA EJERCITO, Joseph M. at 100.00%
Found filename res_reg5527039.html name:TEODORO, Gilberto Jr.  C. at 100.00%
Found filename res_reg5527039.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg5527039.html name:PERLAS, Jesus Nicanor P. at 100.00%
Found filename res_reg5527039.html name:MADRIGAL, Jamby A. at 100.00%
Found filename res_reg5527039.html name:ACOSTA, Vetellano S. at 100.00%
Found filename res_reg5527039.html name:GORDON, Richard J. at 100.00%
Found filename res_reg3836013.html name:VILLAR, Manuel Jr B. at 100.00%
Found filename res_reg3817021.html name:ESTRADA EJERCITO, Joseph M. at 98.65%
Found filename res_reg705005.html name:AQUINO, Benigno Simeon III C. at 98.51%
Found filename res_reg3637017.html name:AQUINO, Benigno Simeon III C. at 100.00%
Found filename res_reg3601017.html name:MADRIGAL, Jamby A. at 300.00%
Found filename res_reg3601017.html name:ACOSTA, Vetellano S. at 300.00%
Found filename res_reg3601017.html name:GORDON, Richard J. at 300.00%
Found filename res_reg3601017.html name:DE LOS REYES, John Carlos G. at 300.00%
Found filename res_reg3601017.html name:ESTRADA EJERCITO, Joseph M. at 300.00%
Found filename res_reg3601017.html name:VILLAR, Manuel Jr B. at 300.00%
Found filename res_reg3601017.html name:TEODORO, Gilberto Jr.  C. at 300.00%
Found filename res_reg3601017.html name:PERLAS, Jesus Nicanor P. at 300.00%
Found filename res_reg3601017.html name:AQUINO, Benigno Simeon III C. at 300.00%
Found filename res_reg3601017.html name:VILLANUEVA, Eduardo C. at 300.00%