Skip to content

Commit 3f3a9f4

Browse files
authored
Merge pull request #502 from Project-MONAI/AI-357
Ai 357
2 parents f46262e + 6c34ffe commit 3f3a9f4

File tree

59 files changed

+1350
-70
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1350
-70
lines changed

.github/workflows/ci.yml

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,11 +183,11 @@ jobs:
183183
ports:
184184
- 27017:27017
185185
steps:
186-
- name: Set up JDK 11
186+
- name: Set up JDK 17
187187
uses: actions/setup-java@v3
188188
with:
189189
distribution: zulu
190-
java-version: '11'
190+
java-version: '17'
191191

192192
- uses: actions/setup-dotnet@v3
193193
with:

src/Api/Hl7ApplicationConfigEntity.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
namespace Monai.Deploy.InformaticsGateway.Api
2828
{
29-
public class Hl7ApplicationConfigEntity : MongoDBEntityBase
29+
public sealed class Hl7ApplicationConfigEntity : MongoDBEntityBase
3030
{
3131
/// <summary>
3232
/// Gets or sets the name of a Hl7 application entity.
@@ -60,6 +60,8 @@ public class Hl7ApplicationConfigEntity : MongoDBEntityBase
6060
/// </summary>
6161
public List<string> PlugInAssemblies { get; set; } = default!;
6262

63+
public DateTime LastModified { get; set; } = DateTime.UtcNow;
64+
6365
public IEnumerable<string> Validate()
6466
{
6567
var errors = new List<string>();
@@ -114,7 +116,7 @@ public override string ToString()
114116
}
115117

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

137139
}
138140

139-
public class DataKeyValuePair : IKeyValuePair<string, DataLinkType>
141+
public sealed class DataKeyValuePair : IKeyValuePair<string, DataLinkType>, IEquatable<DataKeyValuePair>
140142
{
141143
[Key]
142144
public string Key { get; set; } = string.Empty;

src/InformaticsGateway/Services/HealthLevel7/IMllpClient.cs renamed to src/Api/Mllp/IMllpClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
using System.Threading;
1919
using System.Threading.Tasks;
2020

21-
namespace Monai.Deploy.InformaticsGateway.Services.HealthLevel7
21+
namespace Monai.Deploy.InformaticsGateway.Api.Mllp
2222
{
23-
internal interface IMllpClient : IDisposable
23+
public interface IMllpClient : IDisposable
2424
{
2525
Guid ClientId { get; }
2626

2727
string ClientIp { get; }
2828

2929
Task Start(Func<IMllpClient, MllpClientResult, Task> onDisconnect, CancellationToken cancellationToken);
3030
}
31-
}
31+
}

src/InformaticsGateway/Services/HealthLevel7/IMllpExtract.cs renamed to src/Api/Mllp/IMllpExtract.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@
1919
using HL7.Dotnetcore;
2020
using Monai.Deploy.InformaticsGateway.Api.Storage;
2121

22-
namespace Monai.Deploy.InformaticsGateway.Services.HealthLevel7
22+
namespace Monai.Deploy.InformaticsGateway.Api.Mllp
2323
{
24-
internal interface IMllpExtract
24+
public interface IMllpExtract
2525
{
26-
Task<Message> ExtractInfo(Hl7FileStorageMetadata meta, Message message);
26+
Task<Message> ExtractInfo(Hl7FileStorageMetadata meta, Message message, Hl7ApplicationConfigEntity configItem);
27+
28+
Task<Hl7ApplicationConfigEntity?> GetConfigItem(Message message);
2729
}
2830
}

src/InformaticsGateway/Services/HealthLevel7/IMllpService.cs renamed to src/Api/Mllp/IMllpService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
using System.Threading;
1919
using System.Threading.Tasks;
2020

21-
namespace Monai.Deploy.InformaticsGateway.Services.HealthLevel7
21+
namespace Monai.Deploy.InformaticsGateway.Api.Mllp
2222
{
2323
public interface IMllpService
2424
{

src/InformaticsGateway/Services/HealthLevel7/MllpClientResult.cs renamed to src/Api/Mllp/MllpClientResult.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
using System.Collections.Generic;
1919
using HL7.Dotnetcore;
2020

21-
namespace Monai.Deploy.InformaticsGateway.Services.HealthLevel7
21+
namespace Monai.Deploy.InformaticsGateway.Api.Mllp
2222
{
23-
internal class MllpClientResult
23+
public class MllpClientResult
2424
{
2525
public IList<Message> Messages { get; }
2626
public AggregateException? AggregateException { get; }

src/Api/Monai.Deploy.InformaticsGateway.Api.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353

5454
<ItemGroup>
5555
<PackageReference Include="fo-dicom" Version="5.1.1" />
56+
<PackageReference Include="HL7-dotnetcore" Version="2.36.0" />
5657
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
5758
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="6.0.25" />
5859
<PackageReference Include="Monai.Deploy.Messaging" Version="1.0.5" />
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2023 MONAI Consortium
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
using System.Threading.Tasks;
18+
using HL7.Dotnetcore;
19+
using Monai.Deploy.InformaticsGateway.Api.Storage;
20+
21+
namespace Monai.Deploy.InformaticsGateway.Api.PlugIns
22+
{
23+
/// <summary>
24+
/// <c>IInputDataPlugIn</c> enables lightweight data processing over incoming data received from supported data ingestion
25+
/// services.
26+
/// Refer to <see cref="IInputHL7DataPlugInEngine" /> for additional details.
27+
/// </summary>
28+
public interface IInputHL7DataPlugIn
29+
{
30+
string Name { get; }
31+
32+
Task<(Message hl7Message, FileStorageMetadata fileMetadata)> ExecuteAsync(Message hl7File, FileStorageMetadata fileMetadata);
33+
}
34+
35+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright 2023 MONAI Consortium
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
using System;
18+
using System.Collections.Generic;
19+
using System.Threading.Tasks;
20+
using HL7.Dotnetcore;
21+
using Monai.Deploy.InformaticsGateway.Api.Storage;
22+
23+
namespace Monai.Deploy.InformaticsGateway.Api.PlugIns
24+
{
25+
/// <summary>
26+
/// <c>IInputDataPlugInEngine</c> processes incoming data receivied from various supported services through
27+
/// a list of plug-ins based on <see cref="IInputDataPlugIn"/>.
28+
/// Rules:
29+
/// <list type="bullet">
30+
/// <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>
31+
/// <item>Incoming data is processed one file at a time and SHALL not wait for the entire study to arrive.</item>
32+
/// <item>Plug-ins MUST be lightweight and not hinder the upload process.</item>
33+
/// <item>Plug-ins SHALL not accumulate files in memory or storage for bulk processing.</item>
34+
/// </list>
35+
/// </summary>
36+
public interface IInputHL7DataPlugInEngine
37+
{
38+
void Configure(IReadOnlyList<string> pluginAssemblies);
39+
40+
Task<Tuple<Message, FileStorageMetadata>> ExecutePlugInsAsync(Message hl7File, FileStorageMetadata fileMetadata, Hl7ApplicationConfigEntity configItem);
41+
}
42+
}

src/Api/Test/packages.lock.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@
9494
"System.Threading.Channels": "6.0.0"
9595
}
9696
},
97+
"HL7-dotnetcore": {
98+
"type": "Transitive",
99+
"resolved": "2.36.0",
100+
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
101+
},
97102
"Macross.Json.Extensions": {
98103
"type": "Transitive",
99104
"resolved": "3.0.0",
@@ -1277,6 +1282,7 @@
12771282
"monai.deploy.informaticsgateway.api": {
12781283
"type": "Project",
12791284
"dependencies": {
1285+
"HL7-dotnetcore": "[2.36.0, )",
12801286
"Macross.Json.Extensions": "[3.0.0, )",
12811287
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
12821288
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",

src/Api/packages.lock.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@
2121
"System.Threading.Channels": "6.0.0"
2222
}
2323
},
24+
"HL7-dotnetcore": {
25+
"type": "Direct",
26+
"requested": "[2.36.0, )",
27+
"resolved": "2.36.0",
28+
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
29+
},
2430
"Macross.Json.Extensions": {
2531
"type": "Direct",
2632
"requested": "[3.0.0, )",

src/CLI/Test/packages.lock.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@
137137
"System.Threading.Channels": "6.0.0"
138138
}
139139
},
140+
"HL7-dotnetcore": {
141+
"type": "Transitive",
142+
"resolved": "2.36.0",
143+
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
144+
},
140145
"Macross.Json.Extensions": {
141146
"type": "Transitive",
142147
"resolved": "3.0.0",
@@ -1560,6 +1565,7 @@
15601565
"monai.deploy.informaticsgateway.api": {
15611566
"type": "Project",
15621567
"dependencies": {
1568+
"HL7-dotnetcore": "[2.36.0, )",
15631569
"Macross.Json.Extensions": "[3.0.0, )",
15641570
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
15651571
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",

src/CLI/packages.lock.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@
9393
"System.Threading.Channels": "6.0.0"
9494
}
9595
},
96+
"HL7-dotnetcore": {
97+
"type": "Transitive",
98+
"resolved": "2.36.0",
99+
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
100+
},
96101
"Macross.Json.Extensions": {
97102
"type": "Transitive",
98103
"resolved": "3.0.0",
@@ -541,6 +546,7 @@
541546
"monai.deploy.informaticsgateway.api": {
542547
"type": "Project",
543548
"dependencies": {
549+
"HL7-dotnetcore": "[2.36.0, )",
544550
"Macross.Json.Extensions": "[3.0.0, )",
545551
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
546552
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",

src/Client/Test/packages.lock.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1826,6 +1826,7 @@
18261826
"monai.deploy.informaticsgateway.api": {
18271827
"type": "Project",
18281828
"dependencies": {
1829+
"HL7-dotnetcore": "[2.36.0, )",
18291830
"Macross.Json.Extensions": "[3.0.0, )",
18301831
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
18311832
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",

src/Client/packages.lock.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
"System.Threading.Channels": "6.0.0"
4444
}
4545
},
46+
"HL7-dotnetcore": {
47+
"type": "Transitive",
48+
"resolved": "2.36.0",
49+
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
50+
},
4651
"Macross.Json.Extensions": {
4752
"type": "Transitive",
4853
"resolved": "3.0.0",
@@ -274,6 +279,7 @@
274279
"monai.deploy.informaticsgateway.api": {
275280
"type": "Project",
276281
"dependencies": {
282+
"HL7-dotnetcore": "[2.36.0, )",
277283
"Macross.Json.Extensions": "[3.0.0, )",
278284
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
279285
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",

src/Configuration/Test/packages.lock.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@
102102
"System.Threading.Channels": "6.0.0"
103103
}
104104
},
105+
"HL7-dotnetcore": {
106+
"type": "Transitive",
107+
"resolved": "2.36.0",
108+
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
109+
},
105110
"Macross.Json.Extensions": {
106111
"type": "Transitive",
107112
"resolved": "3.0.0",
@@ -1290,6 +1295,7 @@
12901295
"monai.deploy.informaticsgateway.api": {
12911296
"type": "Project",
12921297
"dependencies": {
1298+
"HL7-dotnetcore": "[2.36.0, )",
12931299
"Macross.Json.Extensions": "[3.0.0, )",
12941300
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
12951301
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",

src/Configuration/packages.lock.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
"System.Threading.Channels": "6.0.0"
4444
}
4545
},
46+
"HL7-dotnetcore": {
47+
"type": "Transitive",
48+
"resolved": "2.36.0",
49+
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
50+
},
4651
"Macross.Json.Extensions": {
4752
"type": "Transitive",
4853
"resolved": "3.0.0",
@@ -274,6 +279,7 @@
274279
"monai.deploy.informaticsgateway.api": {
275280
"type": "Project",
276281
"dependencies": {
282+
"HL7-dotnetcore": "[2.36.0, )",
277283
"Macross.Json.Extensions": "[3.0.0, )",
278284
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
279285
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",

src/Database/Api/Test/packages.lock.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,11 @@
7676
"System.Threading.Channels": "6.0.0"
7777
}
7878
},
79+
"HL7-dotnetcore": {
80+
"type": "Transitive",
81+
"resolved": "2.36.0",
82+
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
83+
},
7984
"Macross.Json.Extensions": {
8085
"type": "Transitive",
8186
"resolved": "3.0.0",
@@ -1264,6 +1269,7 @@
12641269
"monai.deploy.informaticsgateway.api": {
12651270
"type": "Project",
12661271
"dependencies": {
1272+
"HL7-dotnetcore": "[2.36.0, )",
12671273
"Macross.Json.Extensions": "[3.0.0, )",
12681274
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
12691275
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",

src/Database/Api/packages.lock.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@
4949
"System.Threading.Channels": "6.0.0"
5050
}
5151
},
52+
"HL7-dotnetcore": {
53+
"type": "Transitive",
54+
"resolved": "2.36.0",
55+
"contentHash": "N1HLMeIqYuY+4O69ItgZJoDBnnpNkK5N2pClceTJ2nFJxsP48iCsA4iz3tm43Yszi4r/vaThoc3UoLBfGP3vKw=="
56+
},
5257
"Macross.Json.Extensions": {
5358
"type": "Transitive",
5459
"resolved": "3.0.0",
@@ -280,6 +285,7 @@
280285
"monai.deploy.informaticsgateway.api": {
281286
"type": "Project",
282287
"dependencies": {
288+
"HL7-dotnetcore": "[2.36.0, )",
283289
"Macross.Json.Extensions": "[3.0.0, )",
284290
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.25, )",
285291
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",

src/Database/DatabaseMigrationManager.cs

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private static Type[] FindMatchingTypesFromAssemblies(Assembly[] assemblies)
6161
var matchingTypes = new List<Type>();
6262
foreach (var assembly in assemblies)
6363
{
64-
var types = assembly.ExportedTypes.Where(p => p.IsAssignableFrom(typeof(IDatabaseMigrationManager)));
64+
var types = assembly.ExportedTypes.Where(p => p.IsAssignableFrom(typeof(IDatabaseMigrationManager)) && p.Name != nameof(IDatabaseMigrationManager));
6565
if (types.Any())
6666
{
6767
matchingTypes.AddRange(types);

src/Database/EntityFramework/Migrations/20231204113501_Hl7DEstinationAndConfig.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+

22
using Microsoft.EntityFrameworkCore.Migrations;
33

44
#nullable disable

0 commit comments

Comments
 (0)