Skip to content

Commit

Permalink
HL7 improve logging
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 13, 2023
1 parent f46262e commit 45878ec
Show file tree
Hide file tree
Showing 59 changed files with 1,353 additions and 70 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,11 @@ jobs:
ports:
- 27017:27017
steps:
- name: Set up JDK 11
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: '11'
java-version: '17'

- uses: actions/setup-dotnet@v3
with:
Expand Down
8 changes: 5 additions & 3 deletions 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 Expand Up @@ -60,6 +60,8 @@ public class Hl7ApplicationConfigEntity : MongoDBEntityBase
/// </summary>
public List<string> PlugInAssemblies { get; set; } = default!;

public DateTime LastModified { get; set; } = DateTime.UtcNow;

public IEnumerable<string> Validate()
{
var errors = new List<string>();
Expand Down Expand Up @@ -114,7 +116,7 @@ public override string ToString()
}

//string key, string value
public class StringKeyValuePair : IKeyValuePair<string, string>
public sealed class StringKeyValuePair : IKeyValuePair<string, string>, IEquatable<StringKeyValuePair>
{
[Key]
public string Key { get; set; } = string.Empty;
Expand All @@ -136,7 +138,7 @@ public static List<StringKeyValuePair> FromDictionary(Dictionary<string, string>

}

public class DataKeyValuePair : IKeyValuePair<string, DataLinkType>
public sealed class DataKeyValuePair : IKeyValuePair<string, DataLinkType>, IEquatable<DataKeyValuePair>
{
[Key]
public string Key { get; set; } = string.Empty;
Expand Down
6 changes: 3 additions & 3 deletions ...eway/Services/HealthLevel7/IMllpClient.cs → src/Api/Mllp/IMllpClient.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
using System.Threading;
using System.Threading.Tasks;

namespace Monai.Deploy.InformaticsGateway.Services.HealthLevel7
namespace Monai.Deploy.InformaticsGateway.Api.Mllp
{
internal interface IMllpClient : IDisposable
public interface IMllpClient : IDisposable
{
Guid ClientId { get; }

string ClientIp { get; }

Task Start(Func<IMllpClient, MllpClientResult, Task> onDisconnect, CancellationToken cancellationToken);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@
using HL7.Dotnetcore;
using Monai.Deploy.InformaticsGateway.Api.Storage;

namespace Monai.Deploy.InformaticsGateway.Services.HealthLevel7
namespace Monai.Deploy.InformaticsGateway.Api.Mllp
{
internal interface IMllpExtract
public interface IMllpExtract
{
Task<Message> ExtractInfo(Hl7FileStorageMetadata meta, Message message);
Task<Message> ExtractInfo(Hl7FileStorageMetadata meta, Message message, Hl7ApplicationConfigEntity configItem);

Task<Hl7ApplicationConfigEntity?> GetConfigItem(Message message);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
using System.Threading;
using System.Threading.Tasks;

namespace Monai.Deploy.InformaticsGateway.Services.HealthLevel7
namespace Monai.Deploy.InformaticsGateway.Api.Mllp
{
public interface IMllpService
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
using System.Collections.Generic;
using HL7.Dotnetcore;

namespace Monai.Deploy.InformaticsGateway.Services.HealthLevel7
namespace Monai.Deploy.InformaticsGateway.Api.Mllp
{
internal class MllpClientResult
public class MllpClientResult
{
public IList<Message> Messages { get; }
public AggregateException? AggregateException { get; }
Expand Down
1 change: 1 addition & 0 deletions src/Api/Monai.Deploy.InformaticsGateway.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@

<ItemGroup>
<PackageReference Include="fo-dicom" Version="5.1.1" />
<PackageReference Include="HL7-dotnetcore" Version="2.36.0" />
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="6.0.25" />
<PackageReference Include="Monai.Deploy.Messaging" Version="1.0.5" />
Expand Down
35 changes: 35 additions & 0 deletions src/Api/PlugIns/IInputHL7DataPlugIn.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright 2023 MONAI Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System.Threading.Tasks;
using HL7.Dotnetcore;
using Monai.Deploy.InformaticsGateway.Api.Storage;

namespace Monai.Deploy.InformaticsGateway.Api.PlugIns
{
/// <summary>
/// <c>IInputDataPlugIn</c> enables lightweight data processing over incoming data received from supported data ingestion
/// services.
/// Refer to <see cref="IInputHL7DataPlugInEngine" /> for additional details.
/// </summary>
public interface IInputHL7DataPlugIn
{
string Name { get; }

Task<(Message hl7Message, FileStorageMetadata fileMetadata)> ExecuteAsync(Message hl7File, FileStorageMetadata fileMetadata);
}

}
42 changes: 42 additions & 0 deletions src/Api/PlugIns/IInputHL7DataPlugInEngine.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2023 MONAI Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using HL7.Dotnetcore;
using Monai.Deploy.InformaticsGateway.Api.Storage;

namespace Monai.Deploy.InformaticsGateway.Api.PlugIns
{
/// <summary>
/// <c>IInputDataPlugInEngine</c> processes incoming data receivied from various supported services through
/// a list of plug-ins based on <see cref="IInputDataPlugIn"/>.
/// Rules:
/// <list type="bullet">
/// <item>SCP: A list of plug-ins can be configured with each AET, and each plug-in is executed in the order stored, enabling piping of the incoming data before each file is uploaded to the storage service.</item>
/// <item>Incoming data is processed one file at a time and SHALL not wait for the entire study to arrive.</item>
/// <item>Plug-ins MUST be lightweight and not hinder the upload process.</item>
/// <item>Plug-ins SHALL not accumulate files in memory or storage for bulk processing.</item>
/// </list>
/// </summary>
public interface IInputHL7DataPlugInEngine
{
void Configure(IReadOnlyList<string> pluginAssemblies);

Task<Tuple<Message, FileStorageMetadata>> ExecutePlugInsAsync(Message hl7File, FileStorageMetadata fileMetadata, Hl7ApplicationConfigEntity configItem);
}
}
6 changes: 6 additions & 0 deletions src/Api/Test/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@
"System.Threading.Channels": "6.0.0"
}
},
"HL7-dotnetcore": {
"type": "Transitive",
"resolved": "2.36.0",
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
},
"Macross.Json.Extensions": {
"type": "Transitive",
"resolved": "3.0.0",
Expand Down Expand Up @@ -1277,6 +1282,7 @@
"monai.deploy.informaticsgateway.api": {
"type": "Project",
"dependencies": {
"HL7-dotnetcore": "[2.36.0, )",
"Macross.Json.Extensions": "[3.0.0, )",
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",
Expand Down
6 changes: 6 additions & 0 deletions src/Api/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@
"System.Threading.Channels": "6.0.0"
}
},
"HL7-dotnetcore": {
"type": "Direct",
"requested": "[2.36.0, )",
"resolved": "2.36.0",
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
},
"Macross.Json.Extensions": {
"type": "Direct",
"requested": "[3.0.0, )",
Expand Down
6 changes: 6 additions & 0 deletions src/CLI/Test/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@
"System.Threading.Channels": "6.0.0"
}
},
"HL7-dotnetcore": {
"type": "Transitive",
"resolved": "2.36.0",
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
},
"Macross.Json.Extensions": {
"type": "Transitive",
"resolved": "3.0.0",
Expand Down Expand Up @@ -1560,6 +1565,7 @@
"monai.deploy.informaticsgateway.api": {
"type": "Project",
"dependencies": {
"HL7-dotnetcore": "[2.36.0, )",
"Macross.Json.Extensions": "[3.0.0, )",
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",
Expand Down
6 changes: 6 additions & 0 deletions src/CLI/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@
"System.Threading.Channels": "6.0.0"
}
},
"HL7-dotnetcore": {
"type": "Transitive",
"resolved": "2.36.0",
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
},
"Macross.Json.Extensions": {
"type": "Transitive",
"resolved": "3.0.0",
Expand Down Expand Up @@ -541,6 +546,7 @@
"monai.deploy.informaticsgateway.api": {
"type": "Project",
"dependencies": {
"HL7-dotnetcore": "[2.36.0, )",
"Macross.Json.Extensions": "[3.0.0, )",
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",
Expand Down
1 change: 1 addition & 0 deletions src/Client/Test/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -1826,6 +1826,7 @@
"monai.deploy.informaticsgateway.api": {
"type": "Project",
"dependencies": {
"HL7-dotnetcore": "[2.36.0, )",
"Macross.Json.Extensions": "[3.0.0, )",
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",
Expand Down
6 changes: 6 additions & 0 deletions src/Client/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
"System.Threading.Channels": "6.0.0"
}
},
"HL7-dotnetcore": {
"type": "Transitive",
"resolved": "2.36.0",
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
},
"Macross.Json.Extensions": {
"type": "Transitive",
"resolved": "3.0.0",
Expand Down Expand Up @@ -274,6 +279,7 @@
"monai.deploy.informaticsgateway.api": {
"type": "Project",
"dependencies": {
"HL7-dotnetcore": "[2.36.0, )",
"Macross.Json.Extensions": "[3.0.0, )",
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",
Expand Down
6 changes: 6 additions & 0 deletions src/Configuration/Test/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@
"System.Threading.Channels": "6.0.0"
}
},
"HL7-dotnetcore": {
"type": "Transitive",
"resolved": "2.36.0",
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
},
"Macross.Json.Extensions": {
"type": "Transitive",
"resolved": "3.0.0",
Expand Down Expand Up @@ -1290,6 +1295,7 @@
"monai.deploy.informaticsgateway.api": {
"type": "Project",
"dependencies": {
"HL7-dotnetcore": "[2.36.0, )",
"Macross.Json.Extensions": "[3.0.0, )",
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",
Expand Down
6 changes: 6 additions & 0 deletions src/Configuration/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@
"System.Threading.Channels": "6.0.0"
}
},
"HL7-dotnetcore": {
"type": "Transitive",
"resolved": "2.36.0",
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
},
"Macross.Json.Extensions": {
"type": "Transitive",
"resolved": "3.0.0",
Expand Down Expand Up @@ -274,6 +279,7 @@
"monai.deploy.informaticsgateway.api": {
"type": "Project",
"dependencies": {
"HL7-dotnetcore": "[2.36.0, )",
"Macross.Json.Extensions": "[3.0.0, )",
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",
Expand Down
6 changes: 6 additions & 0 deletions src/Database/Api/Test/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@
"System.Threading.Channels": "6.0.0"
}
},
"HL7-dotnetcore": {
"type": "Transitive",
"resolved": "2.36.0",
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
},
"Macross.Json.Extensions": {
"type": "Transitive",
"resolved": "3.0.0",
Expand Down Expand Up @@ -1264,6 +1269,7 @@
"monai.deploy.informaticsgateway.api": {
"type": "Project",
"dependencies": {
"HL7-dotnetcore": "[2.36.0, )",
"Macross.Json.Extensions": "[3.0.0, )",
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",
Expand Down
6 changes: 6 additions & 0 deletions src/Database/Api/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
"System.Threading.Channels": "6.0.0"
}
},
"HL7-dotnetcore": {
"type": "Transitive",
"resolved": "2.36.0",
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
},
"Macross.Json.Extensions": {
"type": "Transitive",
"resolved": "3.0.0",
Expand Down Expand Up @@ -280,6 +285,7 @@
"monai.deploy.informaticsgateway.api": {
"type": "Project",
"dependencies": {
"HL7-dotnetcore": "[2.36.0, )",
"Macross.Json.Extensions": "[3.0.0, )",
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",
Expand Down
2 changes: 1 addition & 1 deletion src/Database/DatabaseMigrationManager.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private static Type[] FindMatchingTypesFromAssemblies(Assembly[] assemblies)
var matchingTypes = new List<Type>();
foreach (var assembly in assemblies)
{
var types = assembly.ExportedTypes.Where(p => p.IsAssignableFrom(typeof(IDatabaseMigrationManager)));
var types = assembly.ExportedTypes.Where(p => p.IsAssignableFrom(typeof(IDatabaseMigrationManager)) && p.Name != nameof(IDatabaseMigrationManager));
if (types.Any())
{
matchingTypes.AddRange(types);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;

using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable
Expand Down
Loading

0 comments on commit 45878ec

Please sign in to comment.