public void CsvIsLoaded_CsvFile_AnyResults() { var raceResults = RaceResultCsvRepository.GetAll(CsvDataFile); var xyResultsMen = PerformanceVsHalfRaceSpeedAnalyzer.GetXYResults(raceResults, distance: 20, minDataSize: 200, gender: Gender.Male); var xyResultsWomen = PerformanceVsHalfRaceSpeedAnalyzer.GetXYResults(raceResults, distance: 20, minDataSize: 200, gender: Gender.Female); var menResults2017 = xyResultsMen .Where(x => x.Key.year == "2017" && x.Value.AgeComparativePerformanceRatio < 1) .ToDictionary(x => x.Key, x => x.Value); var womenResults2017 = xyResultsWomen .Where(x => x.Key.year == "2017" && x.Value.AgeComparativePerformanceRatio < 1) .ToDictionary(x => x.Key, x => x.Value); var str1 = PerformanceVsHalfRaceSpeedAnalyzer.ParseToXYColumnStr(menResults2017.Values.ToList()); var str2 = PerformanceVsHalfRaceSpeedAnalyzer.ParseToXYColumnStr(menResults2017.Values.ToList()); var str = str1 + str2; var selectedQuadrantResults = menResults2017 .Where(x => x.Value.AgeComparativePerformanceRatio < 0.65) .Select(x => x.Key) .ToList(); //var selectedQuadrantResults = xyResultsMen // .Where(x => x.Value.AgeComparativePerformanceRatio < 0.7 && x.Value.FirstHalfVsTotalTimeSpeedRatio > 0.55) // .Select(x => GetResultAsStr(x.Key)) // .ToList(); }
static void Main(string[] args) { Directory.SetCurrentDirectory(AppContext.BaseDirectory); try { var baseDataPath = @"..\..\..\..\..\data"; var csvDataFileFullPath = Path.Combine(baseDataPath, "data.csv"); //// Web acquisition: //var results = RaceResultWebRepository.GetAll(); //RaceResultCsvRepository.SaveAll(csvDataFileFullPath, results); // Csv reader: var raceResults = RaceResultCsvRepository.GetAll(csvDataFileFullPath); var participantRepository = new ParticipantRepository(raceResults); var participantsResults9CompletedRaces = participantRepository.GetAllCompletedNRaces(distance: 20, minNumberOfCompletedRaces: 9); var participantsResults5CompletedRaces = participantRepository.GetAllCompletedNRaces(distance: 20, minNumberOfCompletedRaces: 5); var confidenceIntervalTimeByAgeForMen = Analyzers.GetConfidenceIntervalTimeByAgeForMen(raceResults, distance: 20, minDataSize: 100); var progressionDispersion = Analyzers.GetProgressionDispersion(participantsResults5CompletedRaces, distance: 20); var progressionSumary20km = Analyzers.GetProgressionSummary(participantsResults9CompletedRaces, distance: 20); var ageGenderParticipation20km = Analyzers.GetAgeGenderParticipation(raceResults, distance: 20); var ageGenderAverageTime20km = Analyzers.GetAgeGenderAverageTime(raceResults, distance: 20, minDataSize: 30); var part1VsPart2Dispersion = PerformanceVsHalfRaceSpeedAnalyzer.GetXYResults(raceResults, distance: 20, minDataSize: 300); SaveResultsToFile(baseDataPath, "confidenceIntervalTimeByAgeForMen.csv", confidenceIntervalTimeByAgeForMen); SaveResultsToFile(baseDataPath, "progressionDispersion2.csv", progressionDispersion); SaveResultsToFile(baseDataPath, "progressionSumary20km.csv", progressionSumary20km); SaveResultsToFile(baseDataPath, "ageGenderParticipation20km.csv", ageGenderParticipation20km); SaveResultsToFile(baseDataPath, "ageGenderAverageTime20km.csv", ageGenderAverageTime20km); SaveResultsToFile(baseDataPath, "performanceVsHalfRaceSpeed.csv", part1VsPart2Dispersion); Console.WriteLine("Finished."); } catch (Exception ex) { Console.WriteLine(ex.ToString()); } Console.ReadKey(); }