Skip to content

Commit

Permalink
add sci update
Browse files Browse the repository at this point in the history
  • Loading branch information
JFriel committed Jul 16, 2024
1 parent 9403777 commit bc1f484
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
30 changes: 22 additions & 8 deletions SCIStorePlugin/Attachers/SciStoreAttacher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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()
Expand All @@ -45,7 +45,7 @@ public SciStoreAttacher()
/// <param name="job"></param>
/// <returns></returns>
/// <exception cref="BadCombinedReportDataException"></exception>
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);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -133,7 +133,21 @@ private void BulkInsertDataTable(DataTable dataTable, IDataLoadJob job)

var tbl = _dbInfo.ExpectTable(dataTable.TableName);
using var blk = tbl.BeginBulkInsert();
blk.Upload(dataTable);
foreach (var row in dataTable.Rows)
{
try
{
var ndt = new DataTable();
ndt.Rows.Add(row);
blk.Upload(ndt);
}
catch (Exception e)
{
job.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning,
$"Skipped a row due to error: {e.Message}", e));
}
}
//blk.Upload(dataTable);
}

public bool SilentRunning { get; set; }
Expand Down Expand Up @@ -162,7 +176,7 @@ private void CreateReadCodeConstraint()
};
}

public override void LoadCompletedSoDispose(ExitCodeType exitCode,IDataLoadEventListener postLoadEventListener)
public override void LoadCompletedSoDispose(ExitCodeType exitCode, IDataLoadEventListener postLoadEventListener)
{
}

Expand All @@ -172,9 +186,9 @@ private void ResolveTestResultOrderDuplication(List<SciStoreReport> 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}"));
}
}
Expand Down
2 changes: 1 addition & 1 deletion SharedAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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-doug-special")]

0 comments on commit bc1f484

Please sign in to comment.