<?php |
<?php |
/* - large contract value |
|
- standard dev from mean/median |
/* - large contract value |
- percent of total contracts for supplier/agency*/ |
- standard dev from mean/median |
$heuristics["VALUE_LARGE_CONTRACT_OVERALL"] = Array( |
- percent of total contracts for supplier/agency */ |
"description" => "unusual value for time of year"); |
$heuristics["VALUE_LARGE_CONTRACT_OVERALL"] = Array( |
function METADATA_DUPLICATED_DESCRIPTION($cn) |
"description" => "unusual value for time of year"); |
{ |
|
$averageContractPeriod = getAverageContractPeriod(); |
function VALUE_LARGE_CONTRACT_OVERALL($cn) { |
$diff = strtotime($cn['contractStart']) - strtotime($cn['publishDate']); |
$averageContractPeriod = getAverageContractPeriod(); |
$days = intval($diff / 24); |
$diff = strtotime($cn['contractStart']) - strtotime($cn['publishDate']); |
return ($days > 45 ? 1 : 0); |
$days = intval($diff / 24); |
|
return ($days > 45 ? 1 : 0); |
} |
} |
|
|
/* - peculiar value |
/* - peculiar value |
- Just under 80k, amplified if other contracts with same supplier are just under |
- Just under 80k, amplified if other contracts with same supplier are just under |
*/ |
*/ |
$heuristics["VALUE_NEAR_THRESHOLD"] = Array( |
$heuristics["VALUE_NEAR_THRESHOLD"] = Array( |
"description" => "unusual value for time of year"); |
"description" => "unusual value for time of year"); |
/* |
/* |
- unusual variation amount - absolute value; large reductions as well as large increases |
- unusual variation amount - absolute value; large reductions as well as large increases |
*/ |
*/ |
$heuristics["VALUE_LARGE_VARIATION"] = Array( |
$heuristics["VALUE_LARGE_VARIATION"] = Array( |
"description" => "unusual value for time of year"); |
"description" => "unusual value for time of year"); |
function METADATA_DUPLICATED_DESCRIPTION($cn) |
|
{ |
function VALUE_LARGE_VARIATION($cn) { |
$averageContractPeriod = getAverageContractPeriod(); |
$averageContractPeriod = getAverageContractPeriod(); |
$diff = strtotime($cn['contractStart']) - strtotime($cn['publishDate']); |
$diff = strtotime($cn['contractStart']) - strtotime($cn['publishDate']); |
$days = intval($diff / 24); |
$days = intval($diff / 24); |
return ($days > 45 ? 1 : 0); |
return ($days > 45 ? 1 : 0); |
} |
} |
|
|
/* - unusual value for time of year |
/* - unusual value for time of year |
- compare to all other records in last 2 weeks |
- compare to all other records in last 2 weeks |
- ie. many large contracts in june so takes more to standout*/ |
- ie. many large contracts in june so takes more to standout */ |
$heuristics["VALUE_HIGH_FOR_MONTH"] = Array( |
$heuristics["VALUE_HIGH_FOR_MONTH"] = Array( |
"description" => "unusual value for time of year" |
"description" => "unusual value for time of year" |
); |
); |
function VALUE_HIGH_FOR_MONTH($cn, $monthAsInt) |
|
{ |
function VALUE_HIGH_FOR_MONTH($cn, $monthAsInt) { |
$averageContractPeriod = getAverageContractPeriod(); |
$averageContractPeriod = getAverageContractPeriod(); |
$diff = strtotime($cn['contractStart']) - strtotime($cn['publishDate']); |
$diff = strtotime($cn['contractStart']) - strtotime($cn['publishDate']); |
$days = intval($diff / 24); |
$days = intval($diff / 24); |
return ($days > 45 ? 1 : 0); |
return ($days > 45 ? 1 : 0); |
} |
} |
|
|
$monthlyValueAverage = Array(); |
$monthlyValueAverage = Array(); |
function getAgencyTransactions($agencyName) |
|
{ |
function getAgencyTransactions($agencyName) { |
global $agencyTransactions; |
global $agencyTransactions; |
if (!$agencyTransactions[$agencyName]) { |
if (!$agencyTransactions[$agencyName]) { |
$query = 'select count(*) from contractnotice where agencyName = "' . $agencyName . '"'; |
$query = 'select count(*) from contractnotice where agencyName = "' . $agencyName . '"'; |
$result = $conn->query($query); |
$result = $conn->query($query); |
$r = $result->fetch(PDO::FETCH_BOTH); |
$r = $result->fetch(PDO::FETCH_BOTH); |
$agencyTransactions[$agencyName] = $r[0]; |
$agencyTransactions[$agencyName] = $r[0]; |
} |
} |
return $agencyTransactions[$agencyName]; |
return $agencyTransactions[$agencyName]; |
} |
} |
|
|
?> |
?> |