Add initial date based heuristics
[contractdashboard.git] / heuristics / historyHeuristics.php
blob:a/heuristics/historyHeuristics.php -> blob:b/heuristics/historyHeuristics.php
- unusual for agency/supplier <?php
- previous low number of transactions // "unusual for agency/supplier due to previous low number of transactions "
- zero ie. new agency/supplier is huge score $heuristics["HISTORY_LOW_TRANSACTIONS"] = Array(
- unusual value for time of year "description" => "unusual for agency/supplier due to previous low number of transactions "
  );
  function HISTORY_LOW_TRANSACTIONS($cn)
  {
  $averageContractPeriod = getAverageContractPeriod();
  $diff = strtotime($cn['contractStart']) - strtotime($cn['publishDate']);
  $days = intval($diff / 24);
  return ($days > 45 ? 1 : 0);
  }
  /* - 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["HISTORY_HIGH_VALUE_FOR_MONTH"] = Array(
  "description" => "unusual value for time of year");
  function HISTORY_HIGH_VALUE_FOR_MONTH($cn)
  {
  $averageContractPeriod = getAverageContractPeriod();
  $diff = strtotime($cn['contractStart']) - strtotime($cn['publishDate']);
  $days = intval($diff / 24);
  return ($days > 45 ? 1 : 0);
  }