Beginnings of Heuristics work
[contractdashboard.git] / heuristics / historyHeuristics.php
blob:a/heuristics/historyHeuristics.php -> blob:b/heuristics/historyHeuristics.php
  <?php
  // "unusual for agency/supplier due to previous low number of transactions "
  $heuristics["HISTORY_LOW_TRANSACTIONS"] = Array(
  "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
  - 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);
  }