public static List<ReportParticipant> ReturnList(string filePath) { string[] reportList = System.IO.File.ReadAllLines(filePath + "report.csv"); List<ReportParticipant> reportListOfNames = new List<ReportParticipant>(); List<ReportParticipant> report = new List<ReportParticipant>(); foreach (string reportLine in reportList.Skip(1)) { ReportParticipant ReportParticipant = new ReportParticipant(); string cleanLine = reportLine.Replace('"', ' '); string[] splitList = reportLine.Split(','); string MRN = splitList[0].ToString(); ReportParticipant.MRN = MRN; //oof string lastName = splitList[1].ToString(); string firstMiddleName = splitList[2].ToString(); string [] firstNameMiddle = firstMiddleName.Split(' '); string name = firstNameMiddle[1] + lastName; string lastFirstName = name.ToLower().Replace("\"", "").Replace(" ", ""); ReportParticipant.name = lastFirstName; string gender = splitList[5].ToString(); Gender maleOrFemale = AssignGender(gender); ReportParticipant.gender = maleOrFemale; reportListOfNames.Add(ReportParticipant); report = reportListOfNames.Where(x => x.name.Length > 3).ToList(); } return report; }
public static string[] createStringArray(ReportParticipant reportListParticipant) { string[] biGrams = BiGrams.CreateNGrams(reportListParticipant.name, 2); return biGrams; }