Skip to content

Commit

Permalink
Bump HIC.BadMedicine from 1.1.2 to 1.2.0 (#1776)
Browse files Browse the repository at this point in the history
* Bump HIC.BadMedicine from 1.1.2 to 1.2.0

Bumps [HIC.BadMedicine](https://github.com/HicServices/BadMedicine) from 1.1.2 to 1.2.0.
- [Release notes](https://github.com/HicServices/BadMedicine/releases)
- [Changelog](https://github.com/HicServices/BadMedicine/blob/develop/CHANGELOG.md)
- [Commits](HicServices/SynthEHR@v1.1.2...v1.2.0)

---
updated-dependencies:
- dependency-name: HIC.BadMedicine
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* BadMedicine API update

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: James A Sutherland <[email protected]>
  • Loading branch information
dependabot[bot] and jas88 authored Mar 13, 2024
1 parent 9200e0a commit 1c26240
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PackageVersion Include="Equ" Version="2.3.0"/>
<PackageVersion Include="ExcelNumberFormat" Version="1.1.0"/>
<PackageVersion Include="FluentFTP" Version="49.0.2"/>
<PackageVersion Include="HIC.BadMedicine" Version="1.1.2"/>
<PackageVersion Include="HIC.BadMedicine" Version="1.2.0"/>
<PackageVersion Include="HIC.FAnsiSql" Version="3.2.1"/>
<PackageVersion Include="LibArchive.Net" Version="0.1.4"/>
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,18 @@ public ExecuteCommandGenerateTestData(IBasicActivateItems activator, string data
_numberOfRecords = numberOfRecords;
_toFile = toFile;

var dataGeneratorFactory = new DataGeneratorFactory();
var match = dataGeneratorFactory.GetAvailableGenerators().FirstOrDefault(g =>
g.Name.Contains(datasetName, StringComparison.InvariantCultureIgnoreCase));
var match = DataGeneratorFactory.GetAvailableGenerators().Cast<DataGeneratorFactory.GeneratorType?>().FirstOrDefault(g =>
g?.Type.FullName?.Contains(datasetName, StringComparison.InvariantCultureIgnoreCase) == true);

if (match == null)
if (match is null)
{
SetImpossible(
$"Unknown dataset '{datasetName}'. Known datasets are:{Environment.NewLine}{string.Join(Environment.NewLine, dataGeneratorFactory.GetAvailableGenerators().Select(g => g.Name).ToArray())}");
$"Unknown dataset '{datasetName}'. Known datasets are:{Environment.NewLine}{string.Join(Environment.NewLine, DataGeneratorFactory.GetAvailableGenerators().Select(static g => g.Type.FullName).ToArray())}");
return;
}

_r = new Random(seed);
_generator = dataGeneratorFactory.Create(match, _r);
_generator = DataGeneratorFactory.Create(match.Value.Type, _r);
}

public override void Execute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,10 +588,8 @@ private static DiscoveredTable Create<T>(DiscoveredDatabase db, PersonCollection
notifier.OnCheckPerformed(new CheckEventArgs($"Generating {numberOfRecords} records for {dataset}",
CheckResult.Success));

var factory = new DataGeneratorFactory();

//half a million biochemistry results
var biochem = factory.Create(typeof(T), r);
var biochem = DataGeneratorFactory.Create(typeof(T), r);
var dt = biochem.GetDataTable(people, numberOfRecords);

//prune "nulls"
Expand Down Expand Up @@ -647,15 +645,14 @@ private ICatalogue ImportCatalogue(ITableInfo ti)
forwardEngineer.ExecuteForwardEngineering(out var cata, out _, out var eis);

//get descriptions of the columns from BadMedicine
var desc = new Descriptions();
cata.Description = Trim(desc.Get(cata.Name));
cata.Description = Trim(Descriptions.Get(cata.Name));
if (cata.Description != null)
{
cata.SaveToDatabase();

foreach (var ci in cata.CatalogueItems)
{
var ciDescription = Trim(desc.Get(cata.Name, ci.Name));
var ciDescription = Trim(Descriptions.Get(cata.Name, ci.Name));
if (ciDescription != null)
{
ci.Description = ciDescription;
Expand Down
17 changes: 6 additions & 11 deletions Rdmp.UI/SimpleDialogs/Reports/GenerateTestDataUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,13 @@ public GenerateTestDataUI(IActivateItems activator, ICommandExecution command) :
{
InitializeComponent();

var dataGeneratorFactory = new DataGeneratorFactory();

var yLoc = 0;

foreach (var t in dataGeneratorFactory.GetAvailableGenerators())
foreach (var t in DataGeneratorFactory.GetAvailableGenerators())
{
var ui = new DataGeneratorUI
{
Generator = dataGeneratorFactory.Create(t, new Random()),
Generator = DataGeneratorFactory.Create(t.Type, new Random()),
Location = new Point(0, yLoc)
};
yLoc += ui.Height;
Expand Down Expand Up @@ -143,9 +141,9 @@ private void EnableOrDisableGoButton()

private void btnGenerate_Click(object sender, EventArgs e)
{
var uis = pDatasets.Controls.OfType<DataGeneratorUI>().Where(ui => ui.Generate).ToArray();
var uis = pDatasets.Controls.OfType<DataGeneratorUI>().Where(static ui => ui.Generate).ToArray();

if (!uis.Any())
if (uis.Length == 0)
{
MessageBox.Show("At least one dataset must be selected");
return;
Expand Down Expand Up @@ -206,11 +204,8 @@ private void Execute(PersonCollection identifiers, Queue<DataGeneratorUI> queue,
//tell form it is running
Executing.Add(current);

var dataGeneratorFactory = new DataGeneratorFactory();

//reset the current generator to use the seed provided
current.Generator = dataGeneratorFactory.Create(current.Generator.GetType(), r);

current.Generator = DataGeneratorFactory.Create(current.Generator.GetType(), r);

current.BeginGeneration(identifiers, _extractDirectory);

Expand All @@ -227,7 +222,7 @@ private void Execute(PersonCollection identifiers, Queue<DataGeneratorUI> queue,

private void AnnounceIfComplete()
{
if (!Executing.Any())
if (Executing.Count == 0)
{
MessageBox.Show("Finished generating test data");
Close();
Expand Down
3 changes: 1 addition & 2 deletions Tests.Common/Scenarios/TestsRequiringA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ protected DiscoveredTable CreateDataset<T>(DiscoveredDatabase db, int people, in
protected DiscoveredTable CreateDataset<T>(DiscoveredDatabase db, PersonCollection people, int rows, Random r)
where T : IDataGenerator
{
var f = new DataGeneratorFactory();
var instance = f.Create<T>(r);
var instance = DataGeneratorFactory.Create<T>(r);

var dt = instance.GetDataTable(people, rows);

Expand Down

0 comments on commit 1c26240

Please sign in to comment.