Skip to content

Commit 1311753

Browse files
committed
Refactor RemoteAppExecution plug-ins to a new project
- New APIs to allow plug-in projects to extend database setups and configurations - Add integration test feature for end-to-end RemoteAppExecution - Rename Plugin to PlugIn Signed-off-by: Victor Chang <[email protected]>
1 parent 22c23d2 commit 1311753

File tree

174 files changed

+5692
-2194
lines changed

Some content is hidden

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

174 files changed

+5692
-2194
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ jobs:
255255
timeout-minutes: 30
256256
strategy:
257257
matrix:
258-
feature: [AcrApi, DicomDimseScp, DicomDimseScu, DicomWebExport, DicomWebStow, HealthLevel7, Fhir]
258+
feature: [AcrApi, DicomDimseScp, DicomDimseScu, DicomWebExport, DicomWebStow, HealthLevel7, Fhir, RemoteAppExecutionPlugIn]
259259
database: [ef, mongodb]
260260
fail-fast: false
261261
env:

src/Api/DestinationApplicationEntity.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
* limitations under the License.
1616
*/
1717

18-
using System.Collections.Generic;
19-
2018
namespace Monai.Deploy.InformaticsGateway.Api
2119
{
2220
/// <summary>
@@ -38,11 +36,5 @@ public class DestinationApplicationEntity : BaseApplicationEntity
3836
/// Gets or sets the port to connect to.
3937
/// </summary>
4038
public int Port { get; set; }
41-
42-
/// <summary>
43-
/// Gets or sets remote application executions.
44-
/// </summary>
45-
public virtual List<RemoteAppExecution> RemoteAppExecutions { get; set; } = new();
46-
public virtual List<DestinationApplicationEntityRemoteAppExecution> DestinationApplicationEntityRemoteAppExecutions { get; set; } = new();
4739
}
4840
}

src/Api/ExportRequestDataMessage.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021-2022 MONAI Consortium
2+
* Copyright 2021-2023 MONAI Consortium
33
* Copyright 2019-2021 NVIDIA Corporation
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,6 +17,7 @@
1717

1818
using System.Collections.Generic;
1919
using Ardalis.GuardClauses;
20+
using Monai.Deploy.InformaticsGateway.Api.PlugIns;
2021
using Monai.Deploy.Messaging.Events;
2122

2223
namespace Monai.Deploy.InformaticsGateway.Api
@@ -32,9 +33,9 @@ public class ExportRequestDataMessage
3233
public string Filename { get; }
3334

3435
/// <summary>
35-
/// Optional list of data output plug-in type names to be executed by the <see cref="IOutputDataPluginEngine"/>.
36+
/// Optional list of data output plug-in type names to be executed by the <see cref="IOutputDataPlugInEngine"/>.
3637
/// </summary>
37-
public List<string> PluginAssemblies
38+
public List<string> PlugInAssemblies
3839
{
3940
get
4041
{
@@ -62,7 +63,6 @@ public string[] Destinations
6263
get { return _exportRequest.Destinations; }
6364
}
6465

65-
6666
public ExportRequestDataMessage(ExportRequestEvent exportRequest, string filename)
6767
{
6868
IsFailed = false;

src/Api/IsExternalinit.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
using System.ComponentModel;
1818

19-
namespace System.Runtime.CompilerServices
19+
namespace Monai.Deploy.InformaticsGateway.Api
2020
{
2121
/// <summary>
2222
/// Reserved to be used by the compiler for tracking metadata.

src/Api/MonaiApplicationEntity.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
using System.ComponentModel.DataAnnotations;
2121
using System.ComponentModel.DataAnnotations.Schema;
2222
using System.Security.Claims;
23+
using Monai.Deploy.InformaticsGateway.Api.PlugIns;
2324

2425
namespace Monai.Deploy.InformaticsGateway.Api
2526
{
@@ -73,9 +74,9 @@ public class MonaiApplicationEntity : MongoDBEntityBase
7374
public List<string> Workflows { get; set; } = default!;
7475

7576
/// <summary>
76-
/// Optional list of data input plug-in type names to be executed by the <see cref="IInputDataPluginEngine"/>.
77+
/// Optional list of data input plug-in type names to be executed by the <see cref="IInputDataPlugInEngine"/>.
7778
/// </summary>
78-
public List<string> PluginAssemblies { get; set; } = default!;
79+
public List<string> PlugInAssemblies { get; set; } = default!;
7980

8081
/// <summary>
8182
/// Optional field to specify SOP Class UIDs to ignore.
@@ -134,7 +135,7 @@ public void SetDefaultValues()
134135

135136
AllowedSopClasses ??= new List<string>();
136137

137-
PluginAssemblies ??= new List<string>();
138+
PlugInAssemblies ??= new List<string>();
138139
}
139140

140141
public override string ToString()

src/Api/IInputDataPlugin.cs renamed to src/Api/PlugIns/IInputDataPlugin.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
using FellowOakDicom;
1919
using Monai.Deploy.InformaticsGateway.Api.Storage;
2020

21-
namespace Monai.Deploy.InformaticsGateway.Api
21+
namespace Monai.Deploy.InformaticsGateway.Api.PlugIns
2222
{
2323
/// <summary>
24-
/// <c>IInputDataPlugin</c> enables lightweight data processing over incoming data received from supported data ingestion
24+
/// <c>IInputDataPlugIn</c> enables lightweight data processing over incoming data received from supported data ingestion
2525
/// services.
26-
/// Refer to <see cref="IInputDataPluginEngine" /> for additional details.
26+
/// Refer to <see cref="IInputDataPlugInEngine" /> for additional details.
2727
/// </summary>
28-
public interface IInputDataPlugin
28+
public interface IInputDataPlugIn
2929
{
3030
string Name { get; }
3131

32-
Task<(DicomFile dicomFile, FileStorageMetadata fileMetadata)> Execute(DicomFile dicomFile, FileStorageMetadata fileMetadata);
32+
Task<(DicomFile dicomFile, FileStorageMetadata fileMetadata)> ExecuteAsync(DicomFile dicomFile, FileStorageMetadata fileMetadata);
3333
}
3434
}

src/Api/IInputDataPluginEngine.cs renamed to src/Api/PlugIns/IInputDataPluginEngine.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@
2020
using FellowOakDicom;
2121
using Monai.Deploy.InformaticsGateway.Api.Storage;
2222

23-
namespace Monai.Deploy.InformaticsGateway.Api
23+
namespace Monai.Deploy.InformaticsGateway.Api.PlugIns
2424
{
2525
/// <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"/>.
26+
/// <c>IInputDataPlugInEngine</c> processes incoming data receivied from various supported services through
27+
/// a list of plug-ins based on <see cref="IInputDataPlugIn"/>.
2828
/// Rules:
2929
/// <list type="bullet">
3030
/// <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>
@@ -33,10 +33,10 @@ namespace Monai.Deploy.InformaticsGateway.Api
3333
/// <item>Plug-ins SHALL not accumulate files in memory or storage for bulk processing.</item>
3434
/// </list>
3535
/// </summary>
36-
public interface IInputDataPluginEngine
36+
public interface IInputDataPlugInEngine
3737
{
3838
void Configure(IReadOnlyList<string> pluginAssemblies);
3939

40-
Task<Tuple<DicomFile, FileStorageMetadata>> ExecutePlugins(DicomFile dicomFile, FileStorageMetadata fileMetadata);
40+
Task<Tuple<DicomFile, FileStorageMetadata>> ExecutePlugInsAsync(DicomFile dicomFile, FileStorageMetadata fileMetadata);
4141
}
4242
}

src/Api/IOutputDataPlugin.cs renamed to src/Api/PlugIns/IOutputDataPlugin.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717
using System.Threading.Tasks;
1818
using FellowOakDicom;
1919

20-
namespace Monai.Deploy.InformaticsGateway.Api
20+
namespace Monai.Deploy.InformaticsGateway.Api.PlugIns
2121
{
2222
/// <summary>
23-
/// <c>IOutputDataPlugin</c> enables lightweight data processing over incoming data received from supported data ingestion
23+
/// <c>IOutputDataPlugIn</c> enables lightweight data processing over incoming data received from supported data ingestion
2424
/// services.
25-
/// Refer to <see cref="IOutputDataPluginEngine" /> for additional details.
25+
/// Refer to <see cref="IOutputDataPlugInEngine" /> for additional details.
2626
/// </summary>
27-
public interface IOutputDataPlugin
27+
public interface IOutputDataPlugIn
2828
{
2929
string Name { get; }
3030

31-
Task<(DicomFile dicomFile, ExportRequestDataMessage exportRequestDataMessage)> Execute(DicomFile dicomFile, ExportRequestDataMessage exportRequestDataMessage);
31+
Task<(DicomFile dicomFile, ExportRequestDataMessage exportRequestDataMessage)> ExecuteAsync(DicomFile dicomFile, ExportRequestDataMessage exportRequestDataMessage);
3232
}
3333
}

src/Api/IOutputDataPluginEngine.cs renamed to src/Api/PlugIns/IOutputDataPluginEngine.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@
1717
using System.Collections.Generic;
1818
using System.Threading.Tasks;
1919

20-
namespace Monai.Deploy.InformaticsGateway.Api
20+
namespace Monai.Deploy.InformaticsGateway.Api.PlugIns
2121
{
2222
/// <summary>
23-
/// <c>IOutputDataPluginEngine</c> processes each file before exporting to its destination
24-
/// through a list of plug-ins based on <see cref="IOutputDataPlugin"/>.
23+
/// <c>IOutputDataPlugInEngine</c> processes each file before exporting to its destination
24+
/// through a list of plug-ins based on <see cref="IOutputDataPlugIn"/>.
2525
/// Rules:
2626
/// <list type="bullet">
2727
/// <item>A list of plug-ins can be included with each export request, and each plug-in is executed in the order stored, processing one file at a time, enabling piping of the data before each file is exported.</item>
28-
/// <item>Plugins MUST be lightweight and not hinder the export process.</item>
29-
/// <item>Plugins SHALL not accumulate files in memory or storage for bulk processing.</item>
28+
/// <item>Plug-ins MUST be lightweight and not hinder the export process.</item>
29+
/// <item>Plug-ins SHALL not accumulate files in memory or storage for bulk processing.</item>
3030
/// </list>
3131
/// </summary>
32-
public interface IOutputDataPluginEngine
32+
public interface IOutputDataPlugInEngine
3333
{
3434
void Configure(IReadOnlyList<string> pluginAssemblies);
3535

36-
Task<ExportRequestDataMessage> ExecutePlugins(ExportRequestDataMessage exportRequestDataMessage);
36+
Task<ExportRequestDataMessage> ExecutePlugInsAsync(ExportRequestDataMessage exportRequestDataMessage);
3737
}
3838
}

src/Api/PluginNameAttribute.cs renamed to src/Api/PlugIns/PluginNameAttribute.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
using System;
1818
using Ardalis.GuardClauses;
1919

20-
namespace Monai.Deploy.InformaticsGateway.Api
20+
namespace Monai.Deploy.InformaticsGateway.Api.PlugIns
2121
{
2222
[AttributeUsage(AttributeTargets.Class)]
23-
public class PluginNameAttribute : Attribute
23+
public class PlugInNameAttribute : Attribute
2424
{
2525
public string Name { get; set; }
2626

27-
public PluginNameAttribute(string name)
27+
public PlugInNameAttribute(string name)
2828
{
2929
Guard.Against.NullOrWhiteSpace(name, nameof(name));
3030

src/InformaticsGateway/Common/SR.cs renamed to src/Api/PlugIns/SR.cs

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

17-
using System.IO;
1817
using System;
18+
using System.IO;
1919

20-
namespace Monai.Deploy.InformaticsGateway.Common
20+
namespace Monai.Deploy.InformaticsGateway.Api.PlugIns
2121
{
22-
internal static class SR
22+
public static class SR
2323
{
2424
public const string PlugInDirectoryName = "plug-ins";
2525
public static readonly string PlugInDirectoryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, SR.PlugInDirectoryName);

src/Api/RemoteAppExecution.cs

Lines changed: 0 additions & 58 deletions
This file was deleted.

src/Api/Storage/DicomFileStorageMetadata.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ public DicomFileStorageMetadata(string associationId, string identifier, string
100100
{
101101
Guard.Against.NullOrWhiteSpace(associationId, nameof(associationId));
102102
Guard.Against.NullOrWhiteSpace(identifier, nameof(identifier));
103-
Guard.Against.NullOrWhiteSpace(identifier, nameof(identifier));
104-
Guard.Against.NullOrWhiteSpace(identifier, nameof(identifier));
105-
Guard.Against.NullOrWhiteSpace(identifier, nameof(identifier));
103+
Guard.Against.NullOrWhiteSpace(studyInstanceUid, nameof(studyInstanceUid));
104+
Guard.Against.NullOrWhiteSpace(seriesInstanceUid, nameof(seriesInstanceUid));
105+
Guard.Against.NullOrWhiteSpace(sopInstanceUid, nameof(sopInstanceUid));
106106

107107
StudyInstanceUid = studyInstanceUid;
108108
SeriesInstanceUid = seriesInstanceUid;

src/Api/Storage/FileStorageMetadata.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021-2022 MONAI Consortium
2+
* Copyright 2021-2023 MONAI Consortium
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
1818
using System.Collections.Generic;
1919
using System.Text.Json.Serialization;
2020
using Ardalis.GuardClauses;
21+
using Microsoft.Extensions.Logging;
2122

2223
namespace Monai.Deploy.InformaticsGateway.Api.Storage
2324
{
@@ -60,7 +61,7 @@ public abstract record FileStorageMetadata
6061
/// For ACR retrieved DICOM/FHIR files: use the original transaction ID embedded in the request.
6162
/// </summary>
6263
[JsonPropertyName("correlationId")]
63-
public string CorrelationId { get; init; } = default!;
64+
public string CorrelationId { get; set; } = default!;
6465

6566
/// <summary>
6667
/// Gets or sets the source of the file.
@@ -131,6 +132,12 @@ public virtual void SetFailed()
131132
File.SetFailed();
132133
}
133134

135+
public void ChangeCorrelationId(ILogger logger, string correlationId)
136+
{
137+
logger.LogWarning($"Changing correlation ID from {CorrelationId} to {correlationId}.");
138+
CorrelationId = correlationId;
139+
}
140+
134141
public string? PayloadId { get; set; }
135142
}
136143
}

0 commit comments

Comments
 (0)