function candidatesArePeopleToo() { $s = mysql_query("SELECT * FROM candidates"); while ($r = mysql_fetch_array($s)) { $name = $r['name_cleaned']; $sid = $r['id']; if (strpos($r['url'], "http://") === 0) { $url = $r['url']; } else { $url = 'http://www.alegeri-2008.ro' . $r['url']; } $idString = '<a href=' . $url . '>alegeri2008</a>'; $persons = getPersonsByName($name, $idString); // If I reached this point, I know for sure I either have one // or zero matches, there are no ambiguities. if (count($persons) == 0) { $person = addPersonToDatabase($name, $r['name_cleaned']); } else { $person = $persons[0]; info("Found {" . $name . "}"); } // First and foremost, attempt to add this to the person's history. addPersonHistory($person->id, "alegeri/2008", $url); // Locate these people and update them in several tables now. // We're mainly interested in updating the ID to the new ID that // will be in the People database, from the previous ID that was // the senator's ID in the senators table. mysql_query("UPDATE candidates " . "SET idperson={$person->id} " . "WHERE id=" . $r['id']); } }
function candidatesArePeopleToo() { global $FLAG_CAN_CHANGE_DB; $s = mysql_query("\n SELECT c.id, c.name, c.idm\n FROM cdep_2008_deputies AS c\n where idperson=0"); while ($r = mysql_fetch_array($s)) { $name = $r['name']; // Get the party $ps = mysql_query("\n SELECT c.iddep, p.id, p.name\n FROM cdep_2008_belong as c\n LEFT JOIN parties AS p ON p.id = c.idparty\n WHERE iddep = {$r['idm']}\n ORDER BY c.time DESC"); $rs = mysql_fetch_array($ps); $idString = $rs['name']; $persons = getPersonsByName($name, $idString, infoFunction); // If I reached this point, I know for sure I either have one // or zero matches, there are no ambiguities. if (count($persons) == 0) { $person = addPersonToDatabase($name, $r['name']); } else { $person = $persons[0]; } // First and foremost, attempt to add this to the person's history. addPersonHistory($person->id, "cdep/2008", "http://www.cdep.ro/pls/parlam/structura.mp?idm={$r['idm']}&cam=2&leg=2008", 1230768000); // Locate these people and update them in several tables now. // We're mainly interested in updating the ID to the new ID that // will be in the People database, from the previous ID that was // the senator's ID in the senators table. if ($FLAG_CAN_CHANGE_DB) { mysql_query("UPDATE cdep_2008_deputies " . "SET idperson={$person->id} " . "WHERE id=" . $r['id']); } } printJsCommitCookieScript(); }
function candidatesArePeopleToo() { global $FLAG_CAN_CHANGE_DB; $s = mysql_query("SELECT id, name, t, url, party " . "FROM catavencu_2008 " . "WHERE idperson=0"); while ($r = mysql_fetch_array($s)) { $name = trim($r['name']); $idString = '' . $r['url'] . ', ' . $r['party']; $persons = getPersonsByName($name, $idString, infoFunction); // If I reached this point, I know for sure I either have one // or zero matches, there are no ambiguities. if (count($persons) == 0) { $person = addPersonToDatabase($name, $r['name']); } else { $person = $persons[0]; } // First and foremost, attempt to add this to the person's history. addPersonHistory($person->id, "catavencu/2008", $r['url']); // Locate these people and update them in several tables now. // We're mainly interested in updating the ID to the new ID that // will be in the People database, from the previous ID that was // the senator's ID in the senators table. if ($FLAG_CAN_CHANGE_DB) { mysql_query("UPDATE catavencu_2008 " . "SET idperson={$person->id} " . "WHERE id=" . $r['id']); } } printJsCommitCookieScript(); }
function candidatesArePeopleToo() { global $FLAG_CAN_CHANGE_DB; $s = mysql_query("\n SELECT c.id, c.name\n FROM govro_people AS c\n where idperson=0"); while ($r = mysql_fetch_array($s)) { $name = $r['name']; // Get the party $idString = 'none now'; $persons = getPersonsByName($name, $idString, infoFunction); // If I reached this point, I know for sure I either have one // or zero matches, there are no ambiguities. if (count($persons) == 0) { $person = addPersonToDatabase($name, $r['name']); } else { $person = $persons[0]; } // First and foremost, attempt to add this to the person's history. addPersonHistory($person->id, "gov/ro", "www.gov.ro", 1258848000); // Locate these people and update them in several tables now. // We're mainly interested in updating the ID to the new ID that // will be in the People database, from the previous ID that was // the senator's ID in the senators table. if ($FLAG_CAN_CHANGE_DB) { mysql_query("UPDATE govro_people " . "SET idperson={$person->id} " . "WHERE id=" . $r['id']); } } printJsCommitCookieScript(); }
function senatorsArePeopleToo() { $s = mysql_query("SELECT * FROM senat_2004_senators"); while ($r = mysql_fetch_array($s)) { $name = $r['name']; $sid = $r['id']; $persons = getPersonsByName($name); // If I reached this point, I know for sure I either have one // or zero matches, there are no ambiguities. if (count($persons) == 0) { $person = addPersonToDatabase($name, $r['name_diacritics']); } else { $person = $persons[0]; } // First and foremost, attempt to add this to the person's history. addPersonHistory($person->id, "senat/2004", "http://www.cdep.ro/pls/" . "parlam/structura.mp?idm=" . $r['idm'] . "&cam=1&leg=2004"); // Locate these people and update them in several tables now. // We're mainly interested in updating the ID to the new ID that // will be in the People database, from the previous ID that was // the senator's ID in the senators table. // senators() table. mysql_query("UPDATE senators SET idperson={$person->id} WHERE id={$sid}"); mysql_query("UPDATE senators_belongs " . "SET idperson={$person->id} " . "WHERE idsen={$sid}"); mysql_query("UPDATE senators_belongs_agg " . "SET idperson={$person->id} " . "WHERE idsen={$sid}"); mysql_query("UPDATE votes_senators " . "SET idperson={$person->id} " . "WHERE idsen={$sid}"); mysql_query("UPDATE votes_senators_agg " . "SET idperson={$person->id} " . "WHERE idsen={$sid}"); mysql_query("UPDATE away_times " . "SET idperson={$person->id} " . "WHERE iddepsen={$sid} AND chamber=1"); } }
function candidatesArePeopleToo() { global $FLAG_CAN_CHANGE_DB; $s = mysql_query("SELECT e.id, e.name, e.idparty, p.name as pname \n FROM euro_2009_candidates AS e\n LEFT JOIN parties AS p ON p.id = e.idparty \n where idperson=0\n "); while ($r = mysql_fetch_array($s)) { $name = $r['name']; $idString = '' . $r['pname'] . ''; $persons = getPersonsByName($name, $idString, infoFunction); // If I reached this point, I know for sure I either have one // or zero matches, there are no ambiguities. if (count($persons) == 0) { $person = addPersonToDatabase($name, $r['name']); } else { $person = $persons[0]; } // First and foremost, attempt to add this to the person's history. addPersonHistory($person->id, "euro/2009", "http://ro.wikipedia.org/wiki/Alegeri_pentru_Parlamentul_European_%C3%AEn_Rom%C3%A2nia,_2009", 1244349442); // Locate these people and update them in several tables now. // We're mainly interested in updating the ID to the new ID that // will be in the People database, from the previous ID that was // the senator's ID in the senators table. if ($FLAG_CAN_CHANGE_DB) { mysql_query("UPDATE euro_2009_candidates " . "SET idperson={$person->id} " . "WHERE id=" . $r['id']); } } printJsCommitCookieScript(); }
function candidatesArePeopleToo() { global $FLAG_CAN_CHANGE_DB; $s = mysql_query("SELECT e.id, e.name, e.text \n FROM euro_parliament_2007_qvorum AS e\n WHERE idperson=0\n "); while ($r = mysql_fetch_array($s)) { $name = $r['name']; $persons = getPersonsByName($name, $name, infoFunction); // If I reached this point, I know for sure I either have one // or zero matches, there are no ambiguities. if (count($persons) == 0) { $person = addPersonToDatabase($name, $r['name']); } else { $person = $persons[0]; } // First and foremost, attempt to add this to the person's history. addPersonHistory($person->id, "qvorum/2009", "http://qvorum.ro/ViewAnalyse.aspx?analyseID=13", 1242508980); if (strpos($r['text'], "o contribuţie slabă") > 0) { $score = 0; } else { if (strpos($r['text'], "o contribuţie medie") > 0) { $score = 1; } else { if (strpos($r['text'], "o contribuţie bună") > 0) { $score = 2; } else { if (strpos($r['text'], "o contribuţie deosebită") > 0) { $score = 3; } } } } mysql_query("UPDATE euro_parliament_2007_qvorum SET score={$score} \n WHERE id={$r['id']}"); // Locate these people and update them in several tables now. // We're mainly interested in updating the ID to the new ID that // will be in the People database, from the previous ID that was // the senator's ID in the senators table. if ($FLAG_CAN_CHANGE_DB) { mysql_query("UPDATE euro_parliament_2007_qvorum " . "SET idperson={$person->id} " . "WHERE id=" . $r['id']); } } printJsCommitCookieScript(); }
function candidatesArePeopleToo() { global $FLAG_CAN_CHANGE_DB; $s = mysql_query("SELECT * FROM results_2008_candidates WHERE idperson=0"); while ($r = mysql_fetch_array($s)) { $name = $r['nume']; $sid = $r['id']; list($cod, $judet) = split(" ", $r['college']); $idString = "{$judet}-{$cod}"; if ($judet == 'Strainatate') { $url = "http://www.thinkopolis.eu/colegiu/Diaspora-{$cod}"; } else { $jsel = mysql_query("SELECT id FROM counties WHERE name='{$judet}'"); if ($rsel = mysql_fetch_array($jsel)) { $url = "http://alegeri-2008.ro/candidati/x-{$rsel['id']}/"; } } // Let's attempt to create an id string. Best guess we have for these // people is the info-alegeri site. We would like to avoid linking to the // BEC pdf's, even though those would be the best ones. $persons = getPersonsByName($name, $idString, getExistingPersonInfo); // If I reached this point, I know for sure I either have one // or zero matches, there are no ambiguities. if (count($persons) == 0) { $person = addPersonToDatabase($name, $name); } else { $person = $persons[0]; } // First and foremost, attempt to add this to the person's history. addPersonHistory($person->id, "results/2008", $url); // Locate these people and update them in several tables now. // We're mainly interested in updating the ID to the new ID that // will be in the People database, from the previous ID that was // the senator's ID in the senators table. if ($FLAG_CAN_CHANGE_DB == true) { mysql_query("UPDATE results_2008_candidates " . "SET idperson={$person->id} " . "WHERE id={$sid}"); } } printJsCommitCookieScript(); }