private async Task <HypeConstants> GetHypeConstants() { _logger.LogInformation("Getting Hype Constants"); var supportedYears = await _interLeagueService.GetSupportedYears(); List <MasterGameYear> allMasterGameYears = new List <MasterGameYear>(); foreach (var supportedYear in supportedYears) { if (supportedYear.Year < 2019) { continue; } var masterGamesForYear = await _masterGameRepo.GetMasterGameYears(supportedYear.Year, true); var relevantGames = masterGamesForYear.Where(x => x.IsRelevantInYear(supportedYear)); allMasterGameYears.AddRange(relevantGames); } var outputModels = allMasterGameYears.Select(x => new MasterGameYearScriptInput(x)); string scriptsFolder = "C:\\FantasyCritic\\Scripts\\"; string scriptFileName = "regression_model.py"; string scriptPath = Path.Combine(scriptsFolder, scriptFileName); string dataFileName = Guid.NewGuid() + ".csv"; string dataPath = Path.Combine(scriptsFolder, dataFileName); using (var writer = new StreamWriter(dataPath)) using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture)) { csv.WriteRecords(outputModels); } var result = _pythonRunner.RunPython(scriptPath, dataPath); var splitString = result.Split(' '); File.Delete(dataPath); double baseScore = double.Parse(splitString[2]); double standardGameConstant = double.Parse(splitString[4]); double counterPickConstant = double.Parse(splitString[8]); double hypeFactorConstant = double.Parse(splitString[12]); double averageDraftPositionConstant = double.Parse(splitString[16]); double totalBidAmountConstant = double.Parse(splitString[20]); double bidPercentileConstant = double.Parse(splitString[24]); HypeConstants hypeConstants = new HypeConstants(baseScore, standardGameConstant, counterPickConstant, hypeFactorConstant, averageDraftPositionConstant, totalBidAmountConstant, bidPercentileConstant); _logger.LogInformation($"Hype Constants: {hypeConstants}"); return(hypeConstants); }