More MySQL purging
[contractdashboard.git] / heuristics / runHeuristics.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
include_once("heuristics.inc.php");
$query = "SELECT *, agency.abn as agencyABN, IF(supplierABN != '',supplierABN,supplierName) as supplierID
FROM contractnotice JOIN agency ON contractnotice.agencyName=agency.agencyName";
 
$query = "SELECT *, agency.abn as agencyABN, IF(supplierABN != '',supplierABN,supplierName) as supplierID
FROM contractnotice JOIN agency ON contractnotice.agencyName=agency.agencyName
WHERE  DATE(importDate) = (select * from (SELECT DATE(importDate) 
FROM contractnotice ORDER BY importDate DESC limit 1) alias)";
    $query = $conn->prepare($query);
    $query->execute();
    databaseError($conn->errorInfo());
foreach ($query->fetchAll() as $cn) {
        //get each new CN from latest update
        foreach ($heuristics as $heuristic => $description) {
                // run all heuristics
                runHeuristic($heuristic, $cn);
        }
        flush();
}
/*foreach agency
 
aggregate agency metrics
 
foreach supplier
 
aggreate supplier metrics
 
foreach CN
 
aggregate CN metrics */
?>