Skip to content

Commit

Permalink
some fixups
Browse files Browse the repository at this point in the history
Signed-off-by: Neil South <neil.south@answerdigital.com>
  • Loading branch information
neildsouth committed Dec 11, 2023
1 parent 634a484 commit 56c76cb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Api/Hl7ApplicationConfigEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

namespace Monai.Deploy.InformaticsGateway.Api
{
public class Hl7ApplicationConfigEntity : MongoDBEntityBase
public sealed class Hl7ApplicationConfigEntity : MongoDBEntityBase
{
/// <summary>
/// Gets or sets the name of a Hl7 application entity.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public async Task<Tuple<Message, FileStorageMetadata>> ExecutePlugInsAsync(Messa
foreach (var plugin in _plugsins)
{
var nm = plugin.ToString();
if (configItem is not null && configItem.PlugInAssemblies.Any(a => a.StartsWith(plugin.ToString()!)))
if (configItem is not null && configItem.PlugInAssemblies.Exists(a => a.StartsWith(plugin.ToString()!)))
{
_logger.ExecutingInputDataPlugIn(plugin.Name);
(hl7File, fileMetadata) = await plugin.ExecuteAsync(hl7File, fileMetadata).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ public async Task StopAsync(CancellationToken cancellationToken)
await Task.Delay(250).ConfigureAwait(false);
#pragma warning restore CA2016 // Forward the 'CancellationToken' parameter to methods
_cancellationTokenSource.Dispose();
return;
}

private void SetupPolling()
Expand Down
4 changes: 2 additions & 2 deletions src/InformaticsGateway/Services/HealthLevel7/MllpExtract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ public async Task<Message> ExtractInfo(Hl7FileStorageMetadata meta, Message mess
switch (type)
{
case DataLinkType.PatientId:
return await _externalAppDetailsRepository.GetByPatientIdOutboundAsync(tagId, new CancellationToken()).ConfigureAwait(false); ;
return await _externalAppDetailsRepository.GetByPatientIdOutboundAsync(tagId, new CancellationToken()).ConfigureAwait(false);

Check warning on line 108 in src/InformaticsGateway/Services/HealthLevel7/MllpExtract.cs

View check run for this annotation

Codecov / codecov/patch

src/InformaticsGateway/Services/HealthLevel7/MllpExtract.cs#L108

Added line #L108 was not covered by tests
case DataLinkType.StudyInstanceUid:
return await _externalAppDetailsRepository.GetByStudyIdOutboundAsync(tagId, new CancellationToken()).ConfigureAwait(false); ;
return await _externalAppDetailsRepository.GetByStudyIdOutboundAsync(tagId, new CancellationToken()).ConfigureAwait(false);
default:
break;
}
Expand Down
7 changes: 3 additions & 4 deletions src/InformaticsGateway/Services/HealthLevel7/MllpService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ internal sealed class MllpService : IMllpService, IHostedService, IDisposable, I
private readonly IMllpExtract _mIIpExtract;
private readonly IInputHL7DataPlugInEngine _inputHL7DataPlugInEngine;
private readonly IHl7ApplicationConfigRepository _hl7ApplicationConfigRepository;
private DateTime _lastConfigRead = new(2000, 1, 1);
private DateTime _lastConfigRead = new DateTime(2000, 1, 1);

public int ActiveConnections
{
Expand Down Expand Up @@ -218,12 +218,11 @@ private async Task ConfigurePlugInEngine()
if (configs is not null && configs.Any() && configs.Max(c => c.LastModified) > _lastConfigRead)
{
var pluginAssemblies = new List<string>();

Check warning on line 220 in src/InformaticsGateway/Services/HealthLevel7/MllpService.cs

View check run for this annotation

Codecov / codecov/patch

src/InformaticsGateway/Services/HealthLevel7/MllpService.cs#L220

Added line #L220 was not covered by tests
foreach (var config in configs.Where(p => p.PlugInAssemblies is not null && p.PlugInAssemblies.Count > 0))
foreach (var config in configs.Where(p => p.PlugInAssemblies?.Count > 0))
{
try
{
var addMe = config.PlugInAssemblies.Where(p => pluginAssemblies.Any(a => a == p) is false);
pluginAssemblies.AddRange(config.PlugInAssemblies.Where(p => pluginAssemblies.Any(a => a == p) is false));
pluginAssemblies.AddRange(config.PlugInAssemblies.Where(p => pluginAssemblies.Contains(p) is false));
}
catch (Exception ex)

Check warning on line 227 in src/InformaticsGateway/Services/HealthLevel7/MllpService.cs

View check run for this annotation

Codecov / codecov/patch

src/InformaticsGateway/Services/HealthLevel7/MllpService.cs#L225-L227

Added lines #L225 - L227 were not covered by tests
{
Expand Down

0 comments on commit 56c76cb

Please sign in to comment.