analyzeRisk = function(input) {
    const { data, args } = input;
    const { riskThreshold, unusualHourStart, unusualHourEnd } = args;
  
    return data.map(transaction => {
      let risk = 0;
      let riskFactors = [];
      if (transaction.amount > riskThreshold) {
        risk++;
        riskFactors.push("High amount");
      }
      if (transaction.hour >= unusualHourStart || transaction.hour < unusualHourEnd) {
        risk++;
        riskFactors.push("Unusual hour");
      }
      return { ...transaction, risk, riskFactors, suspicious: risk > 0 };
    });
}
Analyzes transactions for risk based on amount and time

This function is designed to be executed in parallel by Turbit across multiple processes.
It evaluates each transaction against predefined risk criteria and assigns risk scores.