Skip to content

Commit e7a7954

Browse files
committed
finishing HL7 support
Signed-off-by: Neil South <[email protected]>
1 parent 11721d4 commit e7a7954

File tree

52 files changed

+774
-187
lines changed

Some content is hidden

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

52 files changed

+774
-187
lines changed

Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ ENV DEBIAN_FRONTEND=noninteractive
3434

3535
RUN apt-get clean \
3636
&& apt-get update \
37-
&& apt-get install -y --no-install-recommends \
38-
curl \
39-
&& rm -rf /var/lib/apt/lists
37+
&& apt-get install -y --no-install-recommends curl \
38+
&& apt-get install -y libc6-dev=2.35-0ubuntu3.6 # this is a workaround for Mongo encryption library
39+
RUN rm -rf /var/lib/apt/lists
40+
41+
4042

4143
WORKDIR /opt/monai/ig
4244

@@ -45,6 +47,8 @@ COPY --from=build /tools /opt/dotnetcore-tools
4547
COPY LICENSE ./
4648
COPY docs/compliance/third-party-licenses.md ./
4749

50+
RUN ln -s /usr/lib/x86_64-linux-gnu/libdl.so.2 /opt/monai/ig/libdl.so # part 2 of workaround for Mongo encryption library
51+
4852
EXPOSE 104
4953
EXPOSE 2575
5054
EXPOSE 5000

src/Api/HL7DestinationEntity.cs

100644100755
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ namespace Monai.Deploy.InformaticsGateway.Api.Models
2525
/// {
2626
/// "name": "MYPACS",
2727
/// "hostIp": "10.20.100.200",
28-
/// "aeTitle": "MONAIPACS",
2928
/// "port": 1104
3029
/// }
3130
/// </code>
@@ -36,5 +35,10 @@ public class HL7DestinationEntity : BaseApplicationEntity
3635
/// Gets or sets the port to connect to.
3736
/// </summary>
3837
public int Port { get; set; }
38+
39+
public override string ToString()
40+
{
41+
return $"Name: {Name}/Host: {HostIp}/Port: {Port}";
42+
}
3943
}
4044
}

src/Api/Models/BaseApplicationEntity.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ public class BaseApplicationEntity : MongoDBEntityBase
3535
/// </summary>
3636
public string Name { get; set; } = default!;
3737

38-
/// <summary>
39-
/// Gets or sets the AE Title (AET) used to identify itself in a DICOM association.
40-
/// </summary>
41-
public string AeTitle { get; set; } = default!;
4238

4339
/// <summary>
4440
/// Gets or set the host name or IP address of the AE Title.
@@ -65,10 +61,8 @@ public BaseApplicationEntity()
6561
SetDefaultValues();
6662
}
6763

68-
public void SetDefaultValues()
64+
public virtual void SetDefaultValues()
6965
{
70-
if (string.IsNullOrWhiteSpace(Name))
71-
Name = AeTitle;
7266
}
7367

7468
public void SetAuthor(ClaimsPrincipal user, EditMode editMode)
@@ -90,7 +84,7 @@ public void SetAuthor(ClaimsPrincipal user, EditMode editMode)
9084

9185
public override string ToString()
9286
{
93-
return $"Name: {Name}/AET: {AeTitle}/Host: {HostIp}";
87+
return $"Name: {Name} /Host: {HostIp}";
9488
}
9589
}
9690
}

src/Api/Models/DestinationApplicationEntity.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,21 @@ public class DestinationApplicationEntity : BaseApplicationEntity
3636
/// Gets or sets the port to connect to.
3737
/// </summary>
3838
public int Port { get; set; }
39+
40+
/// <summary>
41+
/// Gets or sets the AE Title (AET) used to identify itself in a DICOM association.
42+
/// </summary>
43+
public string AeTitle { get; set; } = default!;
44+
45+
public override void SetDefaultValues()
46+
{
47+
if (string.IsNullOrWhiteSpace(Name))
48+
Name = AeTitle;
49+
}
50+
51+
public override string ToString()
52+
{
53+
return $"Name: {Name}/AET: {AeTitle}/Host: {HostIp}/Port: {Port}";
54+
}
3955
}
4056
}

src/Api/SourceApplicationEntity.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,20 @@ namespace Monai.Deploy.InformaticsGateway.Api
3333
/// </example>
3434
public class SourceApplicationEntity : BaseApplicationEntity
3535
{
36+
/// <summary>
37+
/// Gets or sets the AE Title (AET) used to identify itself in a DICOM association.
38+
/// </summary>
39+
public string AeTitle { get; set; } = default!;
40+
41+
public override void SetDefaultValues()
42+
{
43+
if (string.IsNullOrWhiteSpace(Name))
44+
Name = AeTitle;
45+
}
46+
47+
public override string ToString()
48+
{
49+
return $"Name: {Name}/AET: {AeTitle}/Host: {HostIp}";
50+
}
3651
}
3752
}

src/Api/Storage/Hl7FileStorageMetadata.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace Monai.Deploy.InformaticsGateway.Api.Storage
2727
public sealed record Hl7FileStorageMetadata : FileStorageMetadata
2828
{
2929
public const string Hl7SubDirectoryName = "ehr";
30-
public const string FileExtension = ".txt";
30+
public const string FileExtension = ".hl7";
3131

3232
/// <inheritdoc/>
3333
[JsonIgnore]

src/Api/Storage/Payload.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ public TimeSpan Elapsed
8686

8787
public int FilesFailedToUpload { get => Files.Count(p => p.IsUploadFailed); }
8888

89-
public string DestinationFolder { get; set; } = string.Empty;
90-
9189
public Payload(string key, string correlationId, string? workflowInstanceId, string? taskId, DataOrigin dataTrigger, uint timeout)
9290
{
9391
Guard.Against.NullOrWhiteSpace(key, nameof(key));
@@ -108,7 +106,7 @@ public Payload(string key, string correlationId, string? workflowInstanceId, str
108106
DataTrigger = dataTrigger;
109107
}
110108

111-
public Payload(string key, string correlationId, string? workflowInstanceId, string? taskId, DataOrigin dataTrigger, uint timeout, string? payloadId = null, string? DestinationFolder = null) :
109+
public Payload(string key, string correlationId, string? workflowInstanceId, string? taskId, DataOrigin dataTrigger, uint timeout, string? payloadId = null) :
112110
this(key, correlationId, workflowInstanceId, taskId, dataTrigger, timeout)
113111
{
114112
Guard.Against.NullOrWhiteSpace(key, nameof(key));
@@ -121,7 +119,6 @@ public Payload(string key, string correlationId, string? workflowInstanceId, str
121119
{
122120
PayloadId = Guid.Parse(payloadId);
123121
}
124-
DestinationFolder ??= string.Empty;
125122
}
126123

127124
public void Add(FileStorageMetadata value)

src/Api/Test/HL7DestinationEntityTest.cs

100644100755
Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,34 +21,23 @@ namespace Monai.Deploy.InformaticsGateway.Api.Test
2121
{
2222
public class HL7DestinationEntityTest
2323
{
24-
[Fact]
25-
public void GivenAMonaiApplicationEntity_WhenNameIsNotSet_ExepectSetDefaultValuesToBeUsed()
26-
{
27-
var entity = new HL7DestinationEntity
28-
{
29-
AeTitle = "AET",
30-
};
31-
32-
entity.SetDefaultValues();
3324

34-
Assert.Equal(entity.AeTitle, entity.Name);
35-
}
3625

3726
[Fact]
3827
public void GivenAMonaiApplicationEntity_WhenNameIsSet_ExepectSetDefaultValuesToNotOverwrite()
3928
{
4029
var entity = new HL7DestinationEntity
4130
{
42-
AeTitle = "AET",
31+
Port = 1104,
4332
HostIp = "IP",
4433
Name = "Name"
4534
};
4635

4736
entity.SetDefaultValues();
4837

49-
Assert.Equal("AET", entity.AeTitle);
5038
Assert.Equal("IP", entity.HostIp);
5139
Assert.Equal("Name", entity.Name);
40+
Assert.Equal(1104, entity.Port);
5241
}
5342
}
5443
}

src/Api/Test/BaseApplicationEntityTest.cs renamed to src/Api/Test/SourceBaseApplicationEntityTest.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,16 @@
1414
* limitations under the License.
1515
*/
1616

17-
using Monai.Deploy.InformaticsGateway.Api.Models;
1817
using Xunit;
1918

2019
namespace Monai.Deploy.InformaticsGateway.Api.Test
2120
{
22-
public class BaseApplicationEntityTest
21+
public class SourceBaseApplicationEntityTest
2322
{
2423
[Fact]
2524
public void GivenABaseApplicationEntity_WhenNameIsNotSet_ExpectSetDefaultValuesToSetName()
2625
{
27-
var entity = new BaseApplicationEntity
26+
var entity = new SourceApplicationEntity
2827
{
2928
AeTitle = "AET",
3029
HostIp = "IP"
@@ -38,7 +37,7 @@ public void GivenABaseApplicationEntity_WhenNameIsNotSet_ExpectSetDefaultValuesT
3837
[Fact]
3938
public void GivenABaseApplicationEntity_WhenNameIsSet_ExpectSetDefaultValuesToNotSetName()
4039
{
41-
var entity = new BaseApplicationEntity
40+
var entity = new SourceApplicationEntity
4241
{
4342
AeTitle = "AET",
4443
HostIp = "IP",

src/Api/packages.lock.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
},
4242
"Microsoft.NET.ILLink.Tasks": {
4343
"type": "Direct",
44-
"requested": "[8.0.0, )",
45-
"resolved": "8.0.0",
46-
"contentHash": "B3etT5XQ2nlWkZGO2m/ytDYrOmSsQG1XNBaM6ZYlX5Ch/tDrMFadr0/mK6gjZwaQc55g+5+WZMw4Cz3m8VEF7g=="
44+
"requested": "[8.0.1, )",
45+
"resolved": "8.0.1",
46+
"contentHash": "ADdJXuKNjwZDfBmybMnpvwd5CK3gp92WkWqqeQhW4W+q4MO3Qaa9QyW2DcFLAvCDMcCWxT5hRXqGdv13oon7nA=="
4747
},
4848
"Monai.Deploy.Messaging": {
4949
"type": "Direct",

src/CLI/packages.lock.json

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
},
3636
"Microsoft.NET.ILLink.Tasks": {
3737
"type": "Direct",
38-
"requested": "[8.0.0, )",
39-
"resolved": "8.0.0",
40-
"contentHash": "B3etT5XQ2nlWkZGO2m/ytDYrOmSsQG1XNBaM6ZYlX5Ch/tDrMFadr0/mK6gjZwaQc55g+5+WZMw4Cz3m8VEF7g=="
38+
"requested": "[8.0.1, )",
39+
"resolved": "8.0.1",
40+
"contentHash": "ADdJXuKNjwZDfBmybMnpvwd5CK3gp92WkWqqeQhW4W+q4MO3Qaa9QyW2DcFLAvCDMcCWxT5hRXqGdv13oon7nA=="
4141
},
4242
"System.CommandLine.Hosting": {
4343
"type": "Direct",

src/Client.Common/packages.lock.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
},
1111
"Microsoft.NET.ILLink.Tasks": {
1212
"type": "Direct",
13-
"requested": "[8.0.0, )",
14-
"resolved": "8.0.0",
15-
"contentHash": "B3etT5XQ2nlWkZGO2m/ytDYrOmSsQG1XNBaM6ZYlX5Ch/tDrMFadr0/mK6gjZwaQc55g+5+WZMw4Cz3m8VEF7g=="
13+
"requested": "[8.0.1, )",
14+
"resolved": "8.0.1",
15+
"contentHash": "ADdJXuKNjwZDfBmybMnpvwd5CK3gp92WkWqqeQhW4W+q4MO3Qaa9QyW2DcFLAvCDMcCWxT5hRXqGdv13oon7nA=="
1616
}
1717
}
1818
}

src/Client/Test/packages.lock.json

100644100755
File mode changed.

src/Common/packages.lock.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
},
1111
"Microsoft.NET.ILLink.Tasks": {
1212
"type": "Direct",
13-
"requested": "[8.0.0, )",
14-
"resolved": "8.0.0",
15-
"contentHash": "B3etT5XQ2nlWkZGO2m/ytDYrOmSsQG1XNBaM6ZYlX5Ch/tDrMFadr0/mK6gjZwaQc55g+5+WZMw4Cz3m8VEF7g=="
13+
"requested": "[8.0.1, )",
14+
"resolved": "8.0.1",
15+
"contentHash": "ADdJXuKNjwZDfBmybMnpvwd5CK3gp92WkWqqeQhW4W+q4MO3Qaa9QyW2DcFLAvCDMcCWxT5hRXqGdv13oon7nA=="
1616
},
1717
"System.IO.Abstractions": {
1818
"type": "Direct",

src/Configuration/ValidationExtensions.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ public static bool IsValid(this HL7DestinationEntity hl7destinationEntity, out I
6666

6767
var valid = true;
6868
valid &= !string.IsNullOrWhiteSpace(hl7destinationEntity.Name);
69-
valid &= IsAeTitleValid(hl7destinationEntity.GetType().Name, hl7destinationEntity.AeTitle, validationErrors);
70-
valid &= IsValidHostNameIp(hl7destinationEntity.AeTitle, hl7destinationEntity.HostIp, validationErrors);
69+
valid &= IsValidHostNameIp(hl7destinationEntity.Name, hl7destinationEntity.HostIp, validationErrors);
7170
valid &= IsPortValid(hl7destinationEntity.GetType().Name, hl7destinationEntity.Port, validationErrors);
7271

7372
return valid;

src/Configuration/packages.lock.json

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"net8.0": {
55
"Microsoft.NET.ILLink.Tasks": {
66
"type": "Direct",
7-
"requested": "[8.0.0, )",
8-
"resolved": "8.0.0",
9-
"contentHash": "B3etT5XQ2nlWkZGO2m/ytDYrOmSsQG1XNBaM6ZYlX5Ch/tDrMFadr0/mK6gjZwaQc55g+5+WZMw4Cz3m8VEF7g=="
7+
"requested": "[8.0.1, )",
8+
"resolved": "8.0.1",
9+
"contentHash": "ADdJXuKNjwZDfBmybMnpvwd5CK3gp92WkWqqeQhW4W+q4MO3Qaa9QyW2DcFLAvCDMcCWxT5hRXqGdv13oon7nA=="
1010
},
1111
"Ardalis.GuardClauses": {
1212
"type": "Transitive",

src/Database/EntityFramework/Configuration/HL7DestinationEntityConfiguration.cs

100644100755
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ internal class HL7DestinationEntityConfiguration : IEntityTypeConfiguration<HL7D
2626
public void Configure(EntityTypeBuilder<HL7DestinationEntity> builder)
2727
{
2828
builder.HasKey(j => j.Name);
29-
builder.Property(j => j.AeTitle).IsRequired();
3029
builder.Property(j => j.Port).IsRequired();
3130
builder.Property(j => j.HostIp).IsRequired();
3231
builder.Property(j => j.CreatedBy).IsRequired(false);
@@ -35,7 +34,7 @@ public void Configure(EntityTypeBuilder<HL7DestinationEntity> builder)
3534
builder.Property(j => j.DateTimeUpdated).IsRequired(false);
3635

3736
builder.HasIndex(p => p.Name, "idx_destination_name").IsUnique();
38-
builder.HasIndex(p => new { p.Name, p.AeTitle, p.HostIp, p.Port }, "idx_source_all").IsUnique();
37+
builder.HasIndex(p => new { p.Name, p.HostIp, p.Port }, "idx_source_all").IsUnique();
3938

4039
builder.Ignore(p => p.Id);
4140
}

src/Database/EntityFramework/EfDatabaseMigrationManager.cs

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public IHost Migrate(IHost host)
3737
catch (Exception ex)
3838
{
3939
var logger = scope.ServiceProvider.GetService<ILogger>();
40-
logger?.Log(LogLevel.Critical, "Failed to migrate database", ex);
40+
logger?.Log(LogLevel.Critical, message: "Failed to migrate database", exception: ex);
4141
throw;
4242
}
4343
}

0 commit comments

Comments
 (0)