More value heuristics
[contractdashboard.git] / heuristics / runHeuristics.php
blob:a/heuristics/runHeuristics.php -> blob:b/heuristics/runHeuristics.php
<?php <?php
include_once("heuristics.inc.php"); include_once("heuristics.inc.php");
$query = "SELECT *, agency.abn as agencyABN, IF(supplierABN != '',supplierABN,supplierName) as supplierID $query = "SELECT *, agency.abn as agencyABN, IF(supplierABN != '',supplierABN,supplierName) as supplierID
FROM contractnotice JOIN agency ON contractnotice.agencyName=agency.agencyName"; FROM contractnotice JOIN agency ON contractnotice.agencyName=agency.agencyName";
   
$query = "SELECT *, agency.abn as agencyABN, IF(supplierABN != '',supplierABN,supplierName) as supplierID $query = "SELECT *, agency.abn as agencyABN, IF(supplierABN != '',supplierABN,supplierName) as supplierID
FROM contractnotice JOIN agency ON contractnotice.agencyName=agency.agencyName FROM contractnotice JOIN agency ON contractnotice.agencyName=agency.agencyName
WHERE DATE(importDate) = (select * from (SELECT DATE(importDate) WHERE DATE(importDate) = (select * from (SELECT DATE(importDate)
FROM contractnotice ORDER BY importDate DESC limit 1) alias)"; FROM contractnotice ORDER BY importDate DESC limit 1) alias)";
$result = mysql_query($lastimportquery); $result = mysql_query($query);
if (!$result) echo mysql_error().$query; if (!$result) echo mysql_error().$query;
while ($cn = mysql_fetch_array($result, MYSQL_BOTH)) { while ($cn = mysql_fetch_array($result, MYSQL_BOTH)) {
//get each new CN from latest update //get each new CN from latest update
foreach ($heuristics as $heuristic => $description) { foreach ($heuristics as $heuristic => $description) {
// run all heuristics // run all heuristics
runHeuristic($heuristic, $cn); runHeuristic($heuristic, $cn);
} }
flush(); flush();
} }
/*foreach agency /*foreach agency
   
aggregate agency metrics aggregate agency metrics
   
foreach supplier foreach supplier
   
aggreate supplier metrics aggreate supplier metrics
   
foreach CN foreach CN
   
aggregate CN metrics */ aggregate CN metrics */
?> ?>