Skip to content

Commit f45656b

Browse files
authored
New APIs to get a list of input/output data plug-ins (#437)
* gh-434 New APIs to get a list of input/output data plug-ins New PluginAttribute to provide names for the plug-ins * gh-434 Update documentation * gh-434 Update documentation * gh-434 Update CLI with aet plugins and dst plugins commands * Add AttributeUsage to PluginNameAttribute * Update user guide * Fix typo in setup guide * Add unit test for Plug-ins client Signed-off-by: Victor Chang <[email protected]>
1 parent 0ff1963 commit f45656b

33 files changed

+992
-46
lines changed

docs/api/rest/config.md

+71-1
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.
@@ -285,6 +285,41 @@ curl --location --request DELETE 'http://localhost:5000/config/ae/breast-tumor'
285285

286286
---
287287

288+
## GET /config/ae/plug-ins
289+
290+
Returns a list of data input plug-ins that can be used with SCP Application Entity.
291+
292+
### Parameters
293+
294+
N/A
295+
296+
### Responses
297+
298+
Response Content Type: JSON - An object containing zero or more key-value pairs where the key is the name of the plug-in and the value is the fully qualified assembly type name of the plug-in.
299+
300+
| Code | Description |
301+
| ---- | --------------------------------------------------------------------------------------------------------------------------------------- |
302+
| 200 | Plug-ins retrieved successfully. |
303+
| 500 | Server error. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |
304+
305+
### Example Request
306+
307+
```bash
308+
curl --location --request GET 'http://localhost:5000/config/ae/plug-ins'
309+
```
310+
311+
### Example Response
312+
313+
```json
314+
{
315+
"testInputDataPluginAddWorkflow": "Monai.Deploy.InformaticsGateway.Test.Plugins.TestInputDataPluginAddWorkflow, Monai.Deploy.InformaticsGateway.Test.Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
316+
"testInputDataPluginResumeWorkflow": "Monai.Deploy.InformaticsGateway.Test.Plugins.TestInputDataPluginResumeWorkflow, Monai.Deploy.InformaticsGateway.Test.Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
317+
"testInputDataPluginModifyDicomFile": "Monai.Deploy.InformaticsGateway.Test.Plugins.TestInputDataPluginModifyDicomFile, Monai.Deploy.InformaticsGateway.Test.Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
318+
}
319+
```
320+
321+
---
322+
288323
## GET /config/source
289324

290325
Returns a list of calling (source) AE Titles configured on the Informatics Gateway.
@@ -768,3 +803,38 @@ curl --location --request DELETE 'http://localhost:5000/config/destination/USEAS
768803
"hostIp": "10.20.3.4"
769804
}
770805
```
806+
---
807+
808+
## GET /config/destination/plug-ins
809+
810+
Returns a list of data output plug-ins that can be used with SCP Application Entity.
811+
812+
### Parameters
813+
814+
N/A
815+
816+
### Responses
817+
818+
Response Content Type: JSON - An object containing zero or more key-value pairs where the key is the name of the plug-in and the value is the fully qualified assembly type name of the plug-in.
819+
820+
| Code | Description |
821+
| ---- | --------------------------------------------------------------------------------------------------------------------------------------- |
822+
| 200 | Plug-ins retrieved successfully. |
823+
| 500 | Server error. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |
824+
825+
### Example Request
826+
827+
```bash
828+
curl --location --request GET 'http://localhost:5000/config/destination/plug-ins'
829+
```
830+
831+
### Example Response
832+
833+
```json
834+
{
835+
"testOutputDataPluginAddMessage": "Monai.Deploy.InformaticsGateway.Test.Plugins.TestOutputDataPluginAddMessage, Monai.Deploy.InformaticsGateway.Test.Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null",
836+
"testOutputDataPluginModifyDicomFile": "Monai.Deploy.InformaticsGateway.Test.Plugins.TestOutputDataPluginModifyDicomFile, Monai.Deploy.InformaticsGateway.Test.Plugins, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
837+
}
838+
```
839+
840+
---

docs/docfx.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
"src": [
55
{
66
"files": [
7-
"Api/bin/Release/net6.0/Monai.Deploy.InformaticsGateway.Api.dll",
8-
"Client/bin/Release/net6.0/Monai.Deploy.InformaticsGateway.Client.dll",
9-
"Client.Common/bin/Release/net6.0/Monai.Deploy.InformaticsGateway.Client.Common.dll",
10-
"Common/bin/Release/net6.0/Monai.Deploy.InformaticsGateway.Common.dll",
11-
"Configuration/bin/Release/net6.0/Monai.Deploy.InformaticsGateway.Configuration.dll",
12-
"Database/bin/Release/net6.0/Monai.Deploy.InformaticsGateway.Database.dll",
13-
"Database/Api/bin/Release/net6.0/Monai.Deploy.InformaticsGateway.Database.Api.dll",
14-
"DicomWebClient/bin/Release/net6.0/Monai.Deploy.InformaticsGateway.DicomWeb.Client.dll"
7+
"Api/Monai.Deploy.InformaticsGateway.Api.csproj",
8+
"Client/Monai.Deploy.InformaticsGateway.Client.csproj",
9+
"Client.Common/Monai.Deploy.InformaticsGateway.Client.Common.csproj",
10+
"Common/Monai.Deploy.InformaticsGateway.Common.csproj",
11+
"Configuration/Monai.Deploy.InformaticsGateway.Configuration.csproj",
12+
"Database/Monai.Deploy.InformaticsGateway.Database.csproj",
13+
"Database/Api/Monai.Deploy.InformaticsGateway.Database.Api.csproj",
14+
"DicomWebClient/Monai.Deploy.InformaticsGateway.DicomWeb.Client.csproj"
1515
],
1616
"exclude": [
1717
"**/obj/**",
@@ -61,7 +61,7 @@
6161
"_enableSearch": true,
6262
"_appFaviconPath": "images/favicon.ico",
6363
"_appLogoPath": "images/MONAI-logo-color.svg",
64-
"_appFooter": "Copyright © 2022 <a href=\"https://monai.io/\">Project MONAI</a><br>Generated by <strong>DocFX</strong>",
64+
"_appFooter": "Copyright © 2022-2023 <a href=\"https://monai.io/\">Project MONAI</a><br>Generated by <strong>DocFX</strong>",
6565
"_gitContribute": {
6666
"repo": "https://github.com/Project-MONAI/monai-deploy-informatics-gateway.git",
6767
"branch": "main",

docs/index.md

+3-3
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.
@@ -38,8 +38,8 @@ MIG contains the following standard protocols for communicating with medical dev
3838
* **DICOMweb client**: QIDO-RS, WADO-RS, STOW-RS
3939
* **FHIR client**: GET
4040

41-
[!Note]
42-
The ACR DSI API uses the DICOMweb client and FHIR client.
41+
> [!Note]
42+
> The ACR DSI API uses the DICOMweb client and FHIR client.
4343
4444
### DICOM SCP
4545

docs/setup/cli.md

+7-2
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.
@@ -127,8 +127,10 @@ Options:
127127

128128
Commands:
129129
add Add a new SCP Application Entity
130+
update Update a SCP Application Entities
130131
del, rm Remove a SCP Application Entity
131132
list, ls List all SCP Application Entities
133+
plugins List all available plug-ins for SCP Application Entities
132134
```
133135

134136
### Source AE Titles
@@ -148,6 +150,7 @@ Options:
148150

149151
Commands:
150152
add Add a new DICOM source
153+
update Update a new DICOM source
151154
del, rm Remove a DICOM source
152155
list, ls List all DICOM sources
153156

@@ -170,7 +173,9 @@ Options:
170173

171174
Commands:
172175
add Add a new DICOM destination
173-
cecho C-ECHO a DICOM destination
176+
update Update a new DICOM destination
174177
del, rm Remove a DICOM destination
175178
list, ls List all DICOM destinations
179+
cecho C-ECHO a DICOM destination
180+
plugins List all available plug-ins for DICOM destinations
176181
```

docs/setup/setup.md

+50-3
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.
@@ -20,16 +20,30 @@ This section outlines the steps to download and install the Informatics Gateway
2020
## Runtime Requirements
2121

2222
* Docker 20.10.12 or higher
23+
* [Database service](#database-configuration)
24+
* [Message Broker service](#message-broker)
25+
* [Storage service](#storage-service)
2326

2427
For development requirements, refer to the [Informatics Gateway README.md](https://github.com/Project-MONAI/monai-deploy-informatics-gateway).
2528

29+
> [!Note]
30+
> Use [MONAI Deploy Express](https://github.com/Project-MONAI/monai-deploy/tree/main/deploy/monai-deploy-express) to quickly
31+
> bring up all required services, including the Informatics Gateway.
32+
>
33+
> Skip to [Configure Informatics Gateway](#configure-informatics-gateway) if you are using MONAI Deploy Express.
34+
35+
36+
2637
## Installation
2738

2839
### Informatics Gateway CLI
2940

3041
Download and install the Informatics Gateway CLI from the [Releases](https://github.com/Project-MONAI/monai-deploy-informatics-gateway/releases) section of
3142
the repository and install it.
3243

44+
> [!Note]
45+
> We use `v0.2.0` release as an example here, always download the latest from the [Releases](https://github.com/Project-MONAI/monai-deploy-informatics-gateway/releases) section.
46+
3347
#### On Linux
3448

3549
```bash
@@ -80,6 +94,9 @@ mig-cli.exe config init
8094
mig-cli.exe config endpoint http://localhost:5000 #skip if running locally
8195
```
8296

97+
> [!Note]
98+
> For [MONAI Deploy Express](https://github.com/Project-MONAI/monai-deploy/tree/main/deploy/monai-deploy-express), use `http://localhost:5003`.
99+
83100
The first command extracts the default `appsettings.json` file into the home directory:
84101

85102
* Linux: `~/.mig/appsettings.json`
@@ -144,6 +161,27 @@ If the database system is supported by [Microsoft Entity Framework](https://lear
144161
For other database systems that are not listed in the link above, simply implement the [Repository APIs](xref:Monai.Deploy.InformaticsGateway.Database.Api.Repositories), update the [Database Manager](xref:Monai.Deploy.InformaticsGateway.Database.DatabaseManager) to support the new database type and optionally, implement the [IDabaseMigrationManager](xref:Monai.Deploy.InformaticsGateway.Database.Api.IDatabaseMigrationManager).
145162

146163

164+
## Authentication
165+
166+
Authentication is disabled by default. To enable authentication using OpenID, edit the `appsettings.json` file and set `bypassAuthentication` to `true`:
167+
168+
```json
169+
{
170+
"MonaiDeployAuthentication": {
171+
"bypassAuthentication": true,
172+
"openId": {
173+
"realm": "{realm}",
174+
"realmKey": "{realm-secret-key}",
175+
"clientId": "{client-id}",
176+
"audiences": [ "{audiences}" ],
177+
"roleClaimType": "{roles}",
178+
...
179+
}
180+
```
181+
182+
Refer to [Authentication Setup Using Keycloak](https://github.com/Project-MONAI/monai-deploy-workflow-manager/blob/develop/guidelines/mwm-auth.md) for additional details.
183+
184+
147185
## Storage Consideration & Configuration
148186

149187
The Informatics Gateway operates on two storage locations. In the first location, the incoming data for data grouping is temporarily stored. In the second location, the Informatics Gateway uploads grouped datasets to final storage shared by other MONAI Deploy sub-systems.
@@ -314,7 +352,7 @@ will group instances by the Series Instance UID (0020,000E) with a timeout value
314352

315353
### Optional: Input Data Plug-ins
316354

317-
Each listening AE Title may be configured with zero or more plug-ins to maniulate incoming DICOM files before saving to the storage
355+
Each listening AE Title may be configured with zero or more plug-ins to manipulate incoming DICOM files before saving to the storage
318356
service and dispatching a workflow request. To include input data plug-ins, first create your plug-ins by implementing the
319357
[IInputDataPlugin](xref:Monai.Deploy.InformaticsGateway.Api.IInputDataPlugin) interface and then use `-p` argument with the fully
320358
qualified type name with the `mig-cli aet add` command. For example, the following command adds `MyNamespace.AnonymizePlugin`
@@ -327,7 +365,7 @@ mig-cli aet add -a BrainAET -grouping 0020,000E, -t 30 -p "MyNamespace.Anonymize
327365
> [!Note]
328366
> `-grouping` is optional, with a default value of 0020,000D.
329367
> `-t` is optional, with a default value of 5 seconds.
330-
> For complete reference, refer to the [Config API](../api/rest/config.md).
368+
> For complete reference, refer to the [Configuration API](../api/rest/config.md).
331369

332370
2. Enable the receiving of DICOM instances from external DICOM devices:
333371

@@ -358,3 +396,12 @@ The command adds a DICOM export destination with AE Title `WORKSTATION1` at IP `
358396
## Logging
359397

360398
See [schema](./schema.md#logging) page for additional information on logging.
399+
400+
## Data Plug-ins
401+
402+
You may write your own data plug-ins to manipulate incoming data before they are saved to the storage service or outgoing data right before they are exported.
403+
404+
To write an input data plug-in, implement the [IInputDataPlugin](xref:Monai.Deploy.InformaticsGateway.Api.IInputDataPlugin) interface and put the [dynamic link library](https://learn.microsoft.com/en-us/troubleshoot/windows-client/deployment/dynamic-link-library) (DLL) in the
405+
plug-ins directories. Similarly for output data plug-ins, implement the [IOutputDataPlugin](xref:Monai.Deploy.InformaticsGateway.Api.IOutputDataPlugin) interface.
406+
407+
Refer to [Configuration API](../api/rest/config.md) page to retrieve available [input](../api/rest/config.md#get-configaeplug-ins) and [output](../api/rest/config.md#get-configdestinationplug-ins) data plug-ins.

src/Api/PluginNameAttribute.cs

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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 Ardalis.GuardClauses;
19+
20+
namespace Monai.Deploy.InformaticsGateway.Api
21+
{
22+
[AttributeUsage(AttributeTargets.Class)]
23+
public class PluginNameAttribute : Attribute
24+
{
25+
public string Name { get; set; }
26+
27+
public PluginNameAttribute(string name)
28+
{
29+
Guard.Against.NullOrWhiteSpace(name, nameof(name));
30+
31+
Name = name;
32+
}
33+
}
34+
}

src/Api/Storage/DicomFileStorageMetadata.cs

+2-2
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.
@@ -34,7 +34,7 @@ public sealed record DicomFileStorageMetadata : FileStorageMetadata
3434
/// <summary>
3535
/// The calling AE title of the DICOM instance.
3636
/// For ACR, this is the Transaction ID of the original request.
37-
/// Note: this value is same as <seealso cref="Source"></c>
37+
/// Note: this value is same as <see cref="FileStorageMetadata.Source"/>
3838
/// </summary>
3939
[JsonIgnore]
4040
public string CallingAeTitle { get => Source; }

src/Api/Storage/FhirFileStorageMetadata.cs

+2-2
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.
@@ -32,7 +32,7 @@ public sealed record FhirFileStorageMetadata : FileStorageMetadata
3232

3333
/// <summary>
3434
/// The transaction ID of the original ACR request.
35-
/// Note: this value is same as <seealso cref="Source"></c>
35+
/// Note: this value is same as <see cref="FileStorageMetadata.Source"/>
3636
/// </summary>
3737
[JsonIgnore]
3838
public string TransactionId { get => Source; }

0 commit comments

Comments
 (0)