From 218300287366d26c742fb2c511c82db25766f573 Mon Sep 17 00:00:00 2001 From: Elvis Nieves Miranda Date: Tue, 21 Nov 2023 16:43:13 -0400 Subject: [PATCH 1/2] feat: add unescape functionality to person template csv parsing --- src/Biomatch.CLI/Csv/PersonRecordTemplate.cs | 2 +- src/Biomatch.CLI/Csv/PotentialMatchTemplate.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Biomatch.CLI/Csv/PersonRecordTemplate.cs b/src/Biomatch.CLI/Csv/PersonRecordTemplate.cs index 6ea2ca2..bcc6834 100644 --- a/src/Biomatch.CLI/Csv/PersonRecordTemplate.cs +++ b/src/Biomatch.CLI/Csv/PersonRecordTemplate.cs @@ -9,7 +9,7 @@ public static class PersonRecordTemplate { public static IEnumerable ParseCsv(string csvFilePath) { - using var reader = Sep.New(',').Reader(o => o with { }).FromFile(csvFilePath); + using var reader = Sep.New(',').Reader(o => o with { Unescape = true}).FromFile(csvFilePath); foreach (var readRow in reader) { yield return new PersonRecord( diff --git a/src/Biomatch.CLI/Csv/PotentialMatchTemplate.cs b/src/Biomatch.CLI/Csv/PotentialMatchTemplate.cs index 64b42ca..49d7bff 100644 --- a/src/Biomatch.CLI/Csv/PotentialMatchTemplate.cs +++ b/src/Biomatch.CLI/Csv/PotentialMatchTemplate.cs @@ -6,7 +6,7 @@ namespace Biomatch.CLI.Csv; public static class PotentialMatchTemplate { - public static async Task WriteToCsv( + public static Task WriteToCsv( IEnumerable potentialMatches, string csvFilePath ) @@ -67,6 +67,6 @@ string csvFilePath csvContent.AppendLine(line); } - await File.WriteAllTextAsync(csvFilePath, csvContent.ToString()); + return File.WriteAllTextAsync(csvFilePath, csvContent.ToString()); } } From f2673871e37ddcbc27184db655dfb6cd97040f3d Mon Sep 17 00:00:00 2001 From: Elvis Nieves Miranda Date: Tue, 21 Nov 2023 16:44:07 -0400 Subject: [PATCH 2/2] Fix csharpier formatting --- src/Biomatch.CLI/Csv/PersonRecordTemplate.cs | 2 +- src/Biomatch.CLI/Csv/PotentialMatchTemplate.cs | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Biomatch.CLI/Csv/PersonRecordTemplate.cs b/src/Biomatch.CLI/Csv/PersonRecordTemplate.cs index bcc6834..734e992 100644 --- a/src/Biomatch.CLI/Csv/PersonRecordTemplate.cs +++ b/src/Biomatch.CLI/Csv/PersonRecordTemplate.cs @@ -9,7 +9,7 @@ public static class PersonRecordTemplate { public static IEnumerable ParseCsv(string csvFilePath) { - using var reader = Sep.New(',').Reader(o => o with { Unescape = true}).FromFile(csvFilePath); + using var reader = Sep.New(',').Reader(o => o with { Unescape = true }).FromFile(csvFilePath); foreach (var readRow in reader) { yield return new PersonRecord( diff --git a/src/Biomatch.CLI/Csv/PotentialMatchTemplate.cs b/src/Biomatch.CLI/Csv/PotentialMatchTemplate.cs index 49d7bff..9ae1063 100644 --- a/src/Biomatch.CLI/Csv/PotentialMatchTemplate.cs +++ b/src/Biomatch.CLI/Csv/PotentialMatchTemplate.cs @@ -6,10 +6,7 @@ namespace Biomatch.CLI.Csv; public static class PotentialMatchTemplate { - public static Task WriteToCsv( - IEnumerable potentialMatches, - string csvFilePath - ) + public static Task WriteToCsv(IEnumerable potentialMatches, string csvFilePath) { var csvContent = new StringBuilder(); const string header =