diff --git a/SCIStorePlugin/Attachers/SciStoreAttacher.cs b/SCIStorePlugin/Attachers/SciStoreAttacher.cs index e0176cc..cc35125 100644 --- a/SCIStorePlugin/Attachers/SciStoreAttacher.cs +++ b/SCIStorePlugin/Attachers/SciStoreAttacher.cs @@ -20,7 +20,7 @@ namespace SCIStorePlugin.Attachers; [Description(@"Populates the RAW database from XML files retrieved from the SCI Store web service in the ForLoading directory")] public class SciStoreAttacher : Attacher { - public string HeaderTable ="Header"; + public string HeaderTable = "Header"; public string SamplesTable = "SampleDetails"; public string ResultsTable = "Results"; private Stopwatch _timer; @@ -31,7 +31,7 @@ public class SciStoreAttacher : Attacher [DemandsInitialization(@"Determines behaviour when bad reports are encountered e.g. LabNumbers like 000000000. True - Report warning and continue (not loading file) -False - Stop the data load with an error",DefaultValue = true)] +False - Stop the data load with an error", DefaultValue = true)] public bool IgnoreBadData { get; set; } public SciStoreAttacher() @@ -45,7 +45,7 @@ public SciStoreAttacher() /// /// /// - public override ExitCodeType Attach(IDataLoadJob job,GracefulCancellationToken token) + public override ExitCodeType Attach(IDataLoadJob job, GracefulCancellationToken token) { // Create the DataTable repository into which the XML files will be loaded into prior to their bulk insert into RAW var dataTableSchemaSource = new DataTableSchemaFromDatabase(_dbInfo); @@ -78,7 +78,7 @@ public override ExitCodeType Attach(IDataLoadJob job,GracefulCancellationToken t { labs = reports .Select(report => reportFactory.Create(report, job)) - .Where(r=>r != null) //bad reports are null + .Where(r => r != null) //bad reports are null .ToList(); } catch (BadCombinedReportDataException e) @@ -111,7 +111,6 @@ public override ExitCodeType Attach(IDataLoadJob job,GracefulCancellationToken t BulkInsertDataTable(destRepo.HeadersTable, job); BulkInsertDataTable(destRepo.SampleDetailsTable, job); BulkInsertDataTable(destRepo.ResultsTable, job); - _timer.Stop(); job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Information, "SciStoreAttacher::Attach complete")); @@ -162,7 +161,7 @@ private void CreateReadCodeConstraint() }; } - public override void LoadCompletedSoDispose(ExitCodeType exitCode,IDataLoadEventListener postLoadEventListener) + public override void LoadCompletedSoDispose(ExitCodeType exitCode, IDataLoadEventListener postLoadEventListener) { } @@ -172,9 +171,9 @@ private void ResolveTestResultOrderDuplication(List labs, IDataL { foreach (var sample in lab.Samples) { - var recordsRemoved = sample.ResolveTestResultOrderDuplication(); + var recordsRemoved = sample.ResolveTestResultOrderDuplication(); if (recordsRemoved > 0) - job.OnNotify(this,new NotifyEventArgs(ProgressEventType.Warning, + job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning, $"Resolved duplicate TestResultOrder using method 'ResolveTestResultOrderDuplication' in lab number:{lab.Header.LabNumber}")); } } diff --git a/SCIStorePlugin/Data/SciStoreHeader.cs b/SCIStorePlugin/Data/SciStoreHeader.cs index 0779308..d00bf0f 100644 --- a/SCIStorePlugin/Data/SciStoreHeader.cs +++ b/SCIStorePlugin/Data/SciStoreHeader.cs @@ -109,7 +109,8 @@ private static string CleanCHI(string chi) // encountered in Fife Haematology load if (!string.IsNullOrWhiteSpace(chi) && chi.Equals("Temp Residen")) return chi[..10]; - + if (chi.Length > 10) + throw new Exception($"CHI '{chi}' was too long"); return chi; } diff --git a/SharedAssemblyInfo.cs b/SharedAssemblyInfo.cs index 2e3a57a..19eef30 100644 --- a/SharedAssemblyInfo.cs +++ b/SharedAssemblyInfo.cs @@ -12,4 +12,4 @@ // These should be overwritten by release builds [assembly: AssemblyVersion("6.1.6")] [assembly: AssemblyFileVersion("6.1.6")] -[assembly: AssemblyInformationalVersion("6.1.6")] +[assembly: AssemblyInformationalVersion("6.1.7")]