Skip to content

Commit

Permalink
tidy up code
Browse files Browse the repository at this point in the history
  • Loading branch information
JFriel committed Jun 7, 2024
1 parent e171631 commit 18e5168
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 61 deletions.
82 changes: 41 additions & 41 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
<Project>
<ItemGroup>
<PackageVersion Include="CommandLineParser" Version="2.9.1"/>
<PackageVersion Include="Equ" Version="2.3.0"/>
<PackageVersion Include="ExcelNumberFormat" Version="1.1.0"/>
<PackageVersion Include="FluentFTP" Version="50.0.1"/>
<PackageVersion Include="HIC.SynthEHR" Version="2.0.0"/>
<PackageVersion Include="HIC.FAnsiSql" Version="3.2.4"/>
<PackageVersion Include="LibArchive.Net" Version="0.1.5"/>
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="MongoDB.Driver" Version="2.25.0"/>
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3"/>
<PackageVersion Include="NPOI" Version="2.7.0"/>
<PackageVersion Include="NLog" Version="5.3.2"/>
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.4"/>
<PackageVersion Include="SixLabors.ImageSharp.Drawing" Version="2.1.3"/>
<PackageVersion Include="Spectre.Console" Version="0.49.1"/>
<PackageVersion Include="SSH.NET" Version="2024.0.0"/>
<PackageVersion Include="Terminal.Gui" Version="1.17.0"/>
<PackageVersion Include="YamlDotNet" Version="15.1.6"/>
<PackageVersion Include="ConsoleControl" Version="1.3.0"/>
<PackageVersion Include="Autoupdater.NET.Official" Version="1.8.6"/>
<PackageVersion Include="DockPanelSuite.ThemeVS2015" Version="3.1.0"/>
<PackageVersion Include="System.Threading.ThreadPool" Version="4.3.0"/>
<PackageVersion Include="WeCantSpell.Hunspell" Version="5.0.0"/>
<PackageVersion Include="NUnit" Version="4.1.0"/>
<PackageVersion Include="ObjectListView.Repack.NET6Plus" Version="2.9.4"/>
<PackageVersion Include="Scintilla.NET" Version="5.3.2.9"/>
<PackageVersion Include="System.Resources.Extensions" Version="8.0.0"/>
<PackageVersion Include="VPKSoft.ScintillaLexers.NET" Version="1.1.16"/>
<PackageVersion Include="HIC.System.Windows.Forms.DataVisualization" Version="1.0.1"/>
<PackageVersion Include="NunitXml.TestLogger" Version="3.1.20"/>
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0"/>
<PackageVersion Include="NUnit.Analyzers" Version="4.2.0"/>
<PackageVersion Include="NSubstitute" Version="5.1.0"/>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0"/>
<PackageVersion Include="coverlet.collector" Version="6.0.2"/>
</ItemGroup>
</Project>
<ItemGroup>
<PackageVersion Include="CommandLineParser" Version="2.9.1" />
<PackageVersion Include="Equ" Version="2.3.0" />
<PackageVersion Include="ExcelNumberFormat" Version="1.1.0" />
<PackageVersion Include="FluentFTP" Version="50.0.1" />
<PackageVersion Include="HIC.SynthEHR" Version="2.0.0" />
<PackageVersion Include="HIC.FAnsiSql" Version="3.2.5" />
<PackageVersion Include="LibArchive.Net" Version="0.1.5" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="MongoDB.Driver" Version="2.25.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NPOI" Version="2.7.0" />
<PackageVersion Include="NLog" Version="5.3.2" />
<PackageVersion Include="SixLabors.ImageSharp" Version="3.1.4" />
<PackageVersion Include="SixLabors.ImageSharp.Drawing" Version="2.1.3" />
<PackageVersion Include="Spectre.Console" Version="0.49.1" />
<PackageVersion Include="SSH.NET" Version="2024.0.0" />
<PackageVersion Include="Terminal.Gui" Version="1.17.0" />
<PackageVersion Include="YamlDotNet" Version="15.1.6" />
<PackageVersion Include="ConsoleControl" Version="1.3.0" />
<PackageVersion Include="Autoupdater.NET.Official" Version="1.8.6" />
<PackageVersion Include="DockPanelSuite.ThemeVS2015" Version="3.1.0" />
<PackageVersion Include="System.Threading.ThreadPool" Version="4.3.0" />
<PackageVersion Include="WeCantSpell.Hunspell" Version="5.0.0" />
<PackageVersion Include="NUnit" Version="4.1.0" />
<PackageVersion Include="ObjectListView.Repack.NET6Plus" Version="2.9.4" />
<PackageVersion Include="Scintilla.NET" Version="5.3.2.9" />
<PackageVersion Include="System.Resources.Extensions" Version="8.0.0" />
<PackageVersion Include="VPKSoft.ScintillaLexers.NET" Version="1.1.16" />
<PackageVersion Include="HIC.System.Windows.Forms.DataVisualization" Version="1.0.1" />
<PackageVersion Include="NunitXml.TestLogger" Version="3.1.20" />
<PackageVersion Include="NUnit3TestAdapter" Version="4.5.0" />
<PackageVersion Include="NUnit.Analyzers" Version="4.2.0" />
<PackageVersion Include="NSubstitute" Version="5.1.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ This component has several configurable options that are detailed below
## Notes on updating an extraction
Using the "Append Data If Table Exists" option within this extraction destination component will allow you to re-extract additional information to a database, however there a number of caveats and gotchas with this.
* Archive Table
* Similar to data loads, these database tables will come with an _Archive table that will auto-populate hwne new extractions are ran against the database.
* Similar to data loads, these database tables will come with an _Archive table that will auto-populate when new extractions are ran against the database.
* Data Structure changing
* While the extractor can handle columns being removed, it does not support columns being added beyond the first extraction. For this you will need to write the data to a new databse table. It is reccomneded that the etxraction is cloned in this case.
* While the extractor can handle columns being removed, it does not support columns being added beyond the first extraction. For this you will need to write the data to a new databse table. It is recommended that the extraction is cloned in this case.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
using Rdmp.Core.ReusableLibraryCode.Checks;
using Rdmp.Core.ReusableLibraryCode.DataAccess;
using Rdmp.Core.ReusableLibraryCode.Progress;
using YamlDotNet.Core;

namespace Rdmp.Core.DataExport.DataExtraction.Pipeline.Destinations;

Expand Down Expand Up @@ -95,7 +94,7 @@ public class ExecuteFullExtractionToDatabaseMSSql : ExtractionDestination
[DemandsInitialization("If chekced, indexed will be created using the primary keys specified")]
public bool IndexTables { get; set; } = true;

[DemandsInitialization(@"How do you want to name datasets, use the following tokens if you need them:
[DemandsInitialization(@"How do you want to name the created index, use the following tokens if you need them:
$p - Project Name ('e.g. My Project')
$n - Project Number (e.g. 234)
$c - Configuration Name (e.g. 'Cases')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public DataTableUploadDestination(IExternalCohortTable externalCohortTable)
}
}

ClearPrimaryKeyFromDataTableAndExplicitWriteTypes(toProcess); //moved to here to try to fix tests, lets see what happens
ClearPrimaryKeyFromDataTableAndExplicitWriteTypes(toProcess);

StartAuditIfExists(TargetTableName);

Expand Down Expand Up @@ -249,13 +249,15 @@ public DataTableUploadDestination(IExternalCohortTable externalCohortTable)
}
if (IndexTables)
{
var indexes = UserDefinedIndexes.Any() ? UserDefinedIndexes : pkColumns.Select(c => c.ColumnName);
var indexes = UserDefinedIndexes.Count != 0 ? UserDefinedIndexes : pkColumns.Select(c => c.ColumnName);
try
{
_discoveredTable.CreateIndex(IndexTableName, _discoveredTable.DiscoverColumns().Where(c => indexes.Contains(c.GetRuntimeName())).ToArray());
}catch(Exception e)
}
catch (Exception e)
{
listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning,e.Message));
//We only warn about not creating the index, as it's not critical
listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning, e.Message));
}
}

Expand All @@ -268,22 +270,24 @@ public DataTableUploadDestination(IExternalCohortTable externalCohortTable)
if (currentStatus == TriggerStatus.Missing)
try
{
_triggerImplementer.CreateTrigger(ThrowImmediatelyCheckNotifier.Quiet);//this is the issue
_triggerImplementer.CreateTrigger(ThrowImmediatelyCheckNotifier.Quiet);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Warning, e.Message));
}

if (listener.GetType() == typeof(ForkDataLoadEventListener))
if (listener.GetType() == typeof(ForkDataLoadEventListener)) //need to add special fields to the datatable if we are logging to a database
{
var job = (ForkDataLoadEventListener)listener;
var listeners = job.GetToLoggingDatabaseDataLoadEventListenersIfany();
if (listeners.Count == 1)
foreach (var dleListener in listeners)
{
IDataLoadInfo dataLoadInfo = listeners.First().DataLoadInfo;
DataColumn newColumn = new DataColumn(SpecialFieldNames.DataLoadRunID, typeof(System.Int32));
newColumn.DefaultValue = dataLoadInfo.ID;
IDataLoadInfo dataLoadInfo = dleListener.DataLoadInfo;
DataColumn newColumn = new(SpecialFieldNames.DataLoadRunID, typeof(int))
{
DefaultValue = dataLoadInfo.ID
};
if (!toProcess.Columns.Contains(SpecialFieldNames.DataLoadRunID))
toProcess.Columns.Add(newColumn);

Expand Down Expand Up @@ -627,10 +631,6 @@ public void Dispose(IDataLoadEventListener listener, Exception pipelineFailureEx
}
}





EndAuditIfExists();
}

Expand Down
2 changes: 1 addition & 1 deletion directory.build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>11.0</LangVersion>
<Version>8.1.4</Version>
<Version>8.2.0</Version>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
</Project>

0 comments on commit 18e5168

Please sign in to comment.