Skip to content

Commit af4c416

Browse files
committed
adding HL7 plugin
Signed-off-by: Neil South <[email protected]>
1 parent 076cc86 commit af4c416

File tree

232 files changed

+10240
-1403
lines changed

Some content is hidden

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

232 files changed

+10240
-1403
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:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,3 +560,4 @@ FodyWeavers.xsd
560560
# Additional files built by Visual Studio
561561

562562
# End of https://www.toptal.com/developers/gitignore/api/aspnetcore,dotnetcore,visualstudio,visualstudiocode
563+
/src/InformaticsGateway/Properties/launchSettings.json

doc/dependency_decisions.yml

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -314,62 +314,77 @@
314314
:why: MIT (https://raw.githubusercontent.com/dotnet/efcore/release/6.0/LICENSE.txt)
315315
:versions:
316316
- 6.0.22
317-
:when: 2022-08-16 23:05:49.698463427 Z
317+
- 6.0.25
318+
- :when: 2022-08-16 23:05:49.698463427 Z
318319
- - :approve
319320
- Microsoft.EntityFrameworkCore
320321
- :who: mocsharp
321322
:why: MIT (https://raw.githubusercontent.com/dotnet/efcore/release/6.0/LICENSE.txt)
322323
:versions:
323324
- 6.0.22
325+
- 6.0.25
324326
:when: 2022-08-16 23:05:50.137694970 Z
325327
- - :approve
326328
- Microsoft.EntityFrameworkCore.Abstractions
327329
- :who: mocsharp
328330
:why: MIT (https://raw.githubusercontent.com/dotnet/efcore/release/6.0/LICENSE.txt)
329331
:versions:
330332
- 6.0.22
331-
:when: 2022-08-16 23:05:51.008105271 Z
333+
- 6.0.25
334+
- :when: 2022-08-16 23:05:51.008105271 Z
332335
- - :approve
333336
- Microsoft.EntityFrameworkCore.Analyzers
334337
- :who: mocsharp
335338
:why: MIT (https://raw.githubusercontent.com/dotnet/efcore/release/6.0/LICENSE.txt)
336339
:versions:
337340
- 6.0.22
338-
:when: 2022-08-16 23:05:51.445711308 Z
341+
- 6.0.25
342+
- :when: 2022-08-16 23:05:51.445711308 Z
339343
- - :approve
340344
- Microsoft.EntityFrameworkCore.Design
341345
- :who: mocsharp
342346
:why: MIT (https://raw.githubusercontent.com/dotnet/efcore/release/6.0/LICENSE.txt)
343347
:versions:
344348
- 6.0.22
345-
:when: 2022-08-16 23:05:51.922790944 Z
349+
- 6.0.25
350+
- :when: 2022-08-16 23:05:51.922790944 Z
346351
- - :approve
347352
- Microsoft.EntityFrameworkCore.InMemory
348353
- :who: mocsharp
349354
:why: MIT (https://raw.githubusercontent.com/dotnet/efcore/release/6.0/LICENSE.txt)
350355
:versions:
351356
- 6.0.22
352-
:when: 2022-08-16 23:05:52.375150938 Z
357+
- 6.0.25
358+
- :when: 2022-08-16 23:05:52.375150938 Z
353359
- - :approve
354360
- Microsoft.EntityFrameworkCore.Relational
355361
- :who: mocsharp
356362
:why: MIT (https://raw.githubusercontent.com/dotnet/efcore/release/6.0/LICENSE.txt)
357363
:versions:
358364
- 6.0.22
359-
:when: 2022-08-16 23:05:52.828879230 Z
365+
- 6.0.25
366+
- :when: 2022-08-16 23:05:52.828879230 Z
367+
- - :approve
368+
- Microsoft.EntityFrameworkCore.Tools
369+
- :who: ndsouth
370+
:why: MIT (https://raw.githubusercontent.com/dotnet/efcore/release/6.0/LICENSE.txt)
371+
:versions:
372+
- 6.0.25
373+
- :when: 2022-08-16 23:05:52.828879230 Z
360374
- - :approve
361375
- Microsoft.EntityFrameworkCore.Sqlite
362376
- :who: mocsharp
363377
:why: MIT (https://raw.githubusercontent.com/dotnet/efcore/release/6.0/LICENSE.txt)
364378
:versions:
365-
- 6.0.22
379+
- 6.0.25
366380
:when: 2022-08-16 23:05:53.270526921 Z
367381
- - :approve
368382
- Microsoft.EntityFrameworkCore.Sqlite.Core
369383
- :who: mocsharp
370384
:why: MIT (https://raw.githubusercontent.com/dotnet/efcore/release/6.0/LICENSE.txt)
371385
:versions:
372386
- 6.0.22
387+
- 6.0.25
373388
:when: 2022-08-16 23:05:53.706997823 Z
374389
- - :approve
375390
- Microsoft.Extensions.ApiDescription.Server
@@ -512,22 +527,25 @@
512527
:versions:
513528
- 6.0.21
514529
- 6.0.22
515-
:when: 2022-08-29 18:11:22.090772006 Z
530+
- 6.0.25
531+
- :when: 2022-08-29 18:11:22.090772006 Z
516532
- - :approve
517533
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions
518534
- :who: mocsharp
519535
:why: MIT (https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt)
520536
:versions:
521537
- 6.0.21
522538
- 6.0.22
523-
:when: 2022-08-29 18:11:22.090772006 Z
539+
- 6.0.25
540+
- :when: 2022-08-29 18:11:22.090772006 Z
524541
- - :approve
525542
- Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore
526543
- :who: mocsharp
527544
:why: MIT (https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt)
528545
:versions:
529546
- 6.0.22
530-
:when: 2022-08-29 18:11:22.090772006 Z
547+
- 6.0.25
548+
- :when: 2022-08-29 18:11:22.090772006 Z
531549
- - :approve
532550
- Microsoft.Extensions.FileProviders.Abstractions
533551
- :who: mocsharp
@@ -774,16 +792,16 @@
774792
- :who: neilsouth
775793
:why: Apache-2.0 (https://github.com/Project-MONAI/monai-deploy-messaging/raw/main/LICENSE)
776794
:versions:
777-
- 1.0.3
778-
- 1.0.4
795+
- 1.0.5-rc0006
796+
- 1.0.5
779797
:when: 2023-10-13 18:06:21.511789690 Z
780798
- - :approve
781799
- Monai.Deploy.Messaging.RabbitMQ
782800
- :who: neilsouth
783801
:why: Apache-2.0 (https://github.com/Project-MONAI/monai-deploy-messaging/raw/main/LICENSE)
784802
:versions:
785-
- 1.0.3
786-
- 1.0.4
803+
- 1.0.5-rc0006
804+
- 1.0.5
787805
:when: 2023-10-13 18:06:21.511789690 Z
788806
- - :approve
789807
- Monai.Deploy.Storage

src/Api/HL7DestinationEntity.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright 2021-2022 MONAI Consortium
3+
* Copyright 2019-2020 NVIDIA Corporation
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
namespace Monai.Deploy.InformaticsGateway.Api.Models
19+
{
20+
/// <summary>
21+
/// HL7 Destination Entity
22+
/// </summary>
23+
/// <example>
24+
/// <code>
25+
/// {
26+
/// "name": "MYPACS",
27+
/// "hostIp": "10.20.100.200",
28+
/// "aeTitle": "MONAIPACS",
29+
/// "port": 1104
30+
/// }
31+
/// </code>
32+
/// </example>
33+
public class HL7DestinationEntity : BaseApplicationEntity
34+
{
35+
/// <summary>
36+
/// Gets or sets the port to connect to.
37+
/// </summary>
38+
public int Port { get; set; }
39+
}
40+
}

src/Api/Hl7ApplicationConfigEntity.cs

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
/*
2+
* Copyright 2022 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.ComponentModel.DataAnnotations;
20+
using System.ComponentModel.DataAnnotations.Schema;
21+
using System.Linq;
22+
using FellowOakDicom;
23+
using Monai.Deploy.InformaticsGateway.Api.Storage;
24+
using Monai.Deploy.InformaticsGateway.Common;
25+
using Newtonsoft.Json;
26+
27+
namespace Monai.Deploy.InformaticsGateway.Api
28+
{
29+
public class Hl7ApplicationConfigEntity : MongoDBEntityBase
30+
{
31+
/// <summary>
32+
/// Gets or sets the name of a Hl7 application entity.
33+
/// This value must be unique.
34+
/// </summary>
35+
[Key, Column(Order = 0)]
36+
public string Name { get; set; } = default!;
37+
38+
/// <summary>
39+
/// Gets or sets the sending identifier.
40+
/// </summary>
41+
[JsonProperty("sending_identifier")]
42+
public StringKeyValuePair SendingId { get; set; } = new();
43+
44+
/// <summary>
45+
/// Gets or sets the data link.
46+
/// Value is either PatientId or StudyInstanceUid
47+
/// </summary>
48+
[JsonProperty("data_link")]
49+
public DataKeyValuePair DataLink { get; set; } = new();
50+
51+
/// <summary>
52+
/// Gets or sets the data mapping.
53+
/// Value is a DICOM Tag
54+
/// </summary>
55+
[JsonProperty("data_mapping")]
56+
public List<StringKeyValuePair> DataMapping { get; set; } = new();
57+
58+
/// <summary>
59+
/// Optional list of data input plug-in type names to be executed by the <see cref="IInputHL7DataPlugInEngine"/>.
60+
/// </summary>
61+
public List<string> PlugInAssemblies { get; set; } = default!;
62+
63+
public DateTime LastModified { get; set; } = DateTime.UtcNow;
64+
65+
public IEnumerable<string> Validate()
66+
{
67+
var errors = new List<string>();
68+
if (string.IsNullOrWhiteSpace(SendingId.Key))
69+
errors.Add($"{nameof(SendingId.Key)} is missing.");
70+
if (string.IsNullOrWhiteSpace(SendingId.Value))
71+
errors.Add($"{nameof(SendingId.Value)} is missing.");
72+
73+
if (string.IsNullOrWhiteSpace(DataLink.Key))
74+
errors.Add($"{nameof(DataLink.Key)} is missing.");
75+
76+
if (DataMapping.IsNullOrEmpty())
77+
errors.Add($"{nameof(DataMapping)} is missing values.");
78+
79+
ValidateDataMapping(errors);
80+
81+
return errors;
82+
}
83+
84+
private void ValidateDataMapping(List<string> errors)
85+
{
86+
for (var idx = 0; idx < DataMapping.Count; idx++)
87+
{
88+
var dataMapKvp = DataMapping[idx];
89+
90+
if (string.IsNullOrWhiteSpace(dataMapKvp.Key) || dataMapKvp.Value.Length < 8)
91+
{
92+
if (string.IsNullOrWhiteSpace(dataMapKvp.Key))
93+
errors.Add($"{nameof(DataMapping)} is missing a name at index {idx}.");
94+
95+
if (string.IsNullOrWhiteSpace(dataMapKvp.Value) || dataMapKvp.Value.Length < 8)
96+
errors.Add($"{nameof(DataMapping)} ({dataMapKvp.Key}) @ index {idx} is not a valid DICOM Tag.");
97+
98+
continue;
99+
}
100+
101+
try
102+
{
103+
DicomTag.Parse(dataMapKvp.Value);
104+
}
105+
catch (Exception e)
106+
{
107+
errors.Add($"DataMapping.Value is not a valid DICOM Tag. {e.Message}");
108+
}
109+
}
110+
}
111+
112+
public override string ToString()
113+
{
114+
return JsonConvert.SerializeObject(this);
115+
}
116+
}
117+
118+
//string key, string value
119+
public class StringKeyValuePair : IKeyValuePair<string, string>
120+
{
121+
[Key]
122+
public string Key { get; set; } = string.Empty;
123+
public string Value { get; set; } = string.Empty;
124+
125+
public static implicit operator StringKeyValuePair(KeyValuePair<string, string> kvp)
126+
{
127+
return new StringKeyValuePair { Key = kvp.Key, Value = kvp.Value };
128+
}
129+
130+
public static List<StringKeyValuePair> FromDictionary(Dictionary<string, string> dictionary) =>
131+
dictionary.Select(kvp => new StringKeyValuePair { Key = kvp.Key, Value = kvp.Value }).ToList();
132+
133+
public override bool Equals(object? obj) => Equals(obj as StringKeyValuePair);
134+
135+
public bool Equals(StringKeyValuePair? other) => other != null && Key == other.Key && Value == other.Value;
136+
137+
public override int GetHashCode() => HashCode.Combine(Key, Value);
138+
139+
}
140+
141+
public class DataKeyValuePair : IKeyValuePair<string, DataLinkType>
142+
{
143+
[Key]
144+
public string Key { get; set; } = string.Empty;
145+
public DataLinkType Value { get; set; }
146+
147+
public static implicit operator DataKeyValuePair(KeyValuePair<string, DataLinkType> kvp)
148+
{
149+
return new DataKeyValuePair { Key = kvp.Key, Value = kvp.Value };
150+
}
151+
152+
public override bool Equals(object? obj) => Equals(obj as DataKeyValuePair);
153+
154+
public bool Equals(DataKeyValuePair? other) => other != null && Key == other.Key && Value == other.Value;
155+
156+
public override int GetHashCode() => HashCode.Combine(Key, Value);
157+
}
158+
159+
public interface IKeyValuePair<TKey, TValue>
160+
{
161+
public TKey Key { get; set; }
162+
public TValue Value { get; set; }
163+
}
164+
165+
public enum DataLinkType
166+
{
167+
PatientId,
168+
StudyInstanceUid
169+
}
170+
}

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+
}

0 commit comments

Comments
 (0)