Skip to content

Commit 6b89607

Browse files
committed
gh-418 Implement data input plug-in engine and integration with SCP service
- Implement IInputDataPluginEngine and IInputDataPlugin - Add unit tests - Update SCP feature in integration test
1 parent b44839a commit 6b89607

29 files changed

+1152
-188
lines changed

src/Api/IInputDataPlugin.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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 FellowOakDicom;
19+
using Monai.Deploy.InformaticsGateway.Api.Storage;
20+
21+
namespace Monai.Deploy.InformaticsGateway.Api
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="IInputDataPluginEngine" /> for additional details.
27+
/// </summary>
28+
public interface IInputDataPlugin
29+
{
30+
Task<(DicomFile dicomFile, FileStorageMetadata fileMetadata)> Execute(DicomFile dicomFile, FileStorageMetadata fileMetadata);
31+
}
32+
}

src/Api/IInputDataPluginEngine.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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.Collections.Generic;
18+
using System.Threading.Tasks;
19+
using FellowOakDicom;
20+
using Monai.Deploy.InformaticsGateway.Api.Storage;
21+
22+
namespace Monai.Deploy.InformaticsGateway.Api
23+
{
24+
/// <summary>
25+
/// <c>IInputDataPluginEngine</c> processes incoming data receivied from various supported services through
26+
/// a list of plug-ins based on <see cref="IInputDataPlugin"/>.
27+
/// Rules:
28+
/// <list type="bullet">
29+
/// <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>
30+
/// <item>Plugins MUST be lightweight and not hinder the export process</item>
31+
/// <item>Plugins SHALL not accumulate files in memory or storage for bulk processing</item>
32+
/// </list>
33+
/// </summary>
34+
public interface IInputDataPluginEngine
35+
{
36+
void Configure(IReadOnlyList<string> pluginAssemblies);
37+
38+
Task<(DicomFile dicomFile, FileStorageMetadata fileMetadata)> ExecutePlugins(DicomFile dicomFile, FileStorageMetadata fileMetadata);
39+
}
40+
}

src/Api/MonaiApplicationEntity.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public class MonaiApplicationEntity : MongoDBEntityBase
7272
/// </summary>
7373
public List<string> Workflows { get; set; } = default!;
7474

75+
public List<string> PluginAssemblies { get; set; } = default!;
76+
7577
/// <summary>
7678
/// Optional field to specify SOP Class UIDs to ignore.
7779
/// <see cref="IgnoredSopClasses"/> and <see cref="AllowedSopClasses"/> are mutually exclusive.
@@ -128,6 +130,8 @@ public void SetDefaultValues()
128130
IgnoredSopClasses ??= new List<string>();
129131

130132
AllowedSopClasses ??= new List<string>();
133+
134+
PluginAssemblies ??= new List<string>();
131135
}
132136

133137
public override string ToString()

src/Database/EntityFramework/Configuration/MonaiApplicationEntityConfiguration.cs

Lines changed: 8 additions & 1 deletion
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 2021 NVIDIA Corporation
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,6 +25,7 @@
2525
namespace Monai.Deploy.InformaticsGateway.Database.EntityFramework.Configuration
2626
{
2727
#pragma warning disable CS8604, CS8603
28+
2829
internal class MonaiApplicationEntityConfiguration : IEntityTypeConfiguration<MonaiApplicationEntity>
2930
{
3031
public void Configure(EntityTypeBuilder<MonaiApplicationEntity> builder)
@@ -51,6 +52,11 @@ public void Configure(EntityTypeBuilder<MonaiApplicationEntity> builder)
5152
v => JsonSerializer.Serialize(v, jsonSerializerSettings),
5253
v => JsonSerializer.Deserialize<List<string>>(v, jsonSerializerSettings))
5354
.Metadata.SetValueComparer(valueComparer);
55+
builder.Property(j => j.PluginAssemblies)
56+
.HasConversion(
57+
v => JsonSerializer.Serialize(v, jsonSerializerSettings),
58+
v => JsonSerializer.Deserialize<List<string>>(v, jsonSerializerSettings))
59+
.Metadata.SetValueComparer(valueComparer);
5460
builder.Property(j => j.IgnoredSopClasses)
5561
.HasConversion(
5662
v => JsonSerializer.Serialize(v, jsonSerializerSettings),
@@ -67,5 +73,6 @@ public void Configure(EntityTypeBuilder<MonaiApplicationEntity> builder)
6773
builder.Ignore(p => p.Id);
6874
}
6975
}
76+
7077
#pragma warning restore CS8604, CS8603
7178
}

0 commit comments

Comments
 (0)