Skip to content

Commit a124376

Browse files
authored
Merge branch 'develop' into vchang/gh-347
2 parents a3120c7 + a8caee3 commit a124376

28 files changed

+1114
-115
lines changed

doc/dependency_decisions.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,21 +2401,21 @@
24012401
- :who: mocsharp
24022402
:why: Apache-2.0 (https://github.com/mongodb/mongo-csharp-driver/raw/master/License.txt)
24032403
:versions:
2404-
- 2.19.0
2404+
- 2.19.1
24052405
:when: 2022-11-16 23:38:53.891380809 Z
24062406
- - :approve
24072407
- MongoDB.Driver
24082408
- :who: mocsharp
24092409
:why: Apache-2.0 (https://github.com/mongodb/mongo-csharp-driver/raw/master/License.txt)
24102410
:versions:
2411-
- 2.19.0
2411+
- 2.19.1
24122412
:when: 2022-11-16 23:38:54.213853364 Z
24132413
- - :approve
24142414
- MongoDB.Driver.Core
24152415
- :who: mocsharp
24162416
:why: Apache-2.0 (https://github.com/mongodb/mongo-csharp-driver/raw/master/License.txt)
24172417
:versions:
2418-
- 2.19.0
2418+
- 2.19.1
24192419
:when: 2022-11-16 23:38:54.553730219 Z
24202420
- - :approve
24212421
- MongoDB.Libmongocrypt

docs/api/rest/config.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,65 @@ curl --location --request POST 'http://localhost:5000/config/ae/' \
168168

169169
---
170170

171+
## PUT /config/ae
172+
173+
Updates an existing MONAI SCP Application Entity.
174+
175+
> [!Note]
176+
> The MONAI SCP AE Title cannot be changed.
177+
178+
> [!Note]
179+
> The DICOM tag used for `grouping` can be either a Study Instance UID (0020,000D) or Series Instance UID (0020,000E).
180+
> The default is set to a Study Instance UID (0020,000D) if not specified.
181+
182+
> [!Note]
183+
> `timeout` is the number of seconds the AE Title will wait between each instance before assembling a payload and publishing
184+
> a workflow request. We recommend calculating this value based on the network speed and the maximum size of each
185+
> DICOM instance.
186+
187+
### Parameters
188+
189+
See the [MonaiApplicationEntity](xref:Monai.Deploy.InformaticsGateway.Api.MonaiApplicationEntity)
190+
class definition for details.
191+
192+
### Responses
193+
194+
Response Content Type: JSON - [MonaiApplicationEntity](xref:Monai.Deploy.InformaticsGateway.Api.MonaiApplicationEntity).
195+
196+
| Code | Description |
197+
| ---- | ------------------------------------------------------------------------------------------------------------------------------------------- |
198+
| 200 | AE Title updated successfully. |
199+
| 400 | Validation error. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |
200+
| 404 | Named MONAI AE not found. |
201+
| 500 | Server error. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |
202+
203+
### Example Request
204+
205+
```bash
206+
curl --location --request PUT 'http://localhost:5000/config/ae/' \
207+
--header 'Content-Type: application/json' \
208+
--data-raw '{
209+
"name": "breast-tumor",
210+
"timeout": 3,
211+
"workflows": [
212+
"3f6a08a1-0dea-44e9-ab82-1ff1adf43a8e"
213+
]
214+
}
215+
}'
216+
```
217+
218+
### Example Response
219+
220+
```json
221+
{
222+
"name": "breast-tumor",
223+
"aeTitle": "BREASTV1",
224+
"workflows": ["3f6a08a1-0dea-44e9-ab82-1ff1adf43a8e"],
225+
"timeout": 3
226+
}
227+
```
228+
229+
---
171230
## DELETE /config/ae/{name}
172231

173232
Deletes the specified MONAI SCP Application Entity.

docs/changelog.md

Lines changed: 38 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
~
44
~ Licensed under the Apache License, Version 2.0 (the "License");
55
~ you may not use this file except in compliance with the License.
@@ -17,6 +17,43 @@
1717

1818
# Changelog
1919

20+
## 0.3.15
21+
22+
[GitHub Milestone 0.3.15](https://github.com/Project-MONAI/monai-deploy-informatics-gateway/milestone/20)
23+
24+
- New APIs for managing SCP AE Titles
25+
- `PUT /config/ae`: [Update SCP AE TItle](./api/rest/config.md#put-configae)
26+
27+
## 0.3.14
28+
29+
[GitHub Milestone 0.3.14](https://github.com/Project-MONAI/monai-deploy-informatics-gateway/milestone/19)
30+
31+
- Fixes RabbitMQ startup issues.
32+
33+
## 0.3.13
34+
35+
[GitHub Milestone 0.3.13](https://github.com/Project-MONAI/monai-deploy-informatics-gateway/milestone/18)
36+
37+
- Fixes an issue where failure uploads caused payload to stuck in the queue and stops processing any incoming data.
38+
39+
## 0.3.12
40+
41+
[GitHub Milestone 0.3.12](https://github.com/Project-MONAI/monai-deploy-informatics-gateway/milestone/17)
42+
43+
- Fixes exception handling for unavailable previously created dead-letter queues
44+
45+
## 0.3.11
46+
47+
[GitHub Milestone 0.3.11](https://github.com/Project-MONAI/monai-deploy-informatics-gateway/milestone/16)
48+
49+
- Adds exception handling for unavailable previously created dead-letter queues
50+
51+
## 0.3.10
52+
53+
[GitHub Milestone 0.3.10](https://github.com/Project-MONAI/monai-deploy-informatics-gateway/milestone/15)
54+
55+
- Fixes payload assembler not respecting user configured timeout window
56+
2057
## 0.3.8
2158

2259
[GitHub Milestone 0.3.8](https://github.com/Project-MONAI/monai-deploy-informatics-gateway/milestone/14)

docs/compliance/third-party-licenses.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8672,14 +8672,14 @@ By downloading this software, you agree to the license terms & all licenses list
86728672

86738673

86748674
<details>
8675-
<summary>MongoDB.Bson 2.19.0</summary>
8675+
<summary>MongoDB.Bson 2.19.1</summary>
86768676

86778677
## MongoDB.Bson
86788678

8679-
- Version: 2.19.0
8679+
- Version: 2.19.1
86808680
- Authors: MongoDB Inc.
86818681
- Project URL: https://www.mongodb.com/docs/drivers/csharp/
8682-
- Source: [NuGet](https://www.nuget.org/packages/MongoDB.Bson/2.19.0)
8682+
- Source: [NuGet](https://www.nuget.org/packages/MongoDB.Bson/2.19.1)
86838683
- License: [Apache-2.0](https://github.com/mongodb/mongo-csharp-driver/raw/master/License.txt)
86848684

86858685

@@ -8704,14 +8704,14 @@ By downloading this software, you agree to the license terms & all licenses list
87048704

87058705

87068706
<details>
8707-
<summary>MongoDB.Driver 2.19.0</summary>
8707+
<summary>MongoDB.Driver 2.19.1</summary>
87088708

87098709
## MongoDB.Driver
87108710

8711-
- Version: 2.19.0
8711+
- Version: 2.19.1
87128712
- Authors: MongoDB Inc.
87138713
- Project URL: https://www.mongodb.com/docs/drivers/csharp/
8714-
- Source: [NuGet](https://www.nuget.org/packages/MongoDB.Driver/2.19.0)
8714+
- Source: [NuGet](https://www.nuget.org/packages/MongoDB.Driver/2.19.1)
87158715
- License: [Apache-2.0](https://github.com/mongodb/mongo-csharp-driver/raw/master/License.txt)
87168716

87178717

@@ -8736,14 +8736,14 @@ By downloading this software, you agree to the license terms & all licenses list
87368736

87378737

87388738
<details>
8739-
<summary>MongoDB.Driver.Core 2.19.0</summary>
8739+
<summary>MongoDB.Driver.Core 2.19.1</summary>
87408740

87418741
## MongoDB.Driver.Core
87428742

8743-
- Version: 2.19.0
8743+
- Version: 2.19.1
87448744
- Authors: MongoDB Inc.
87458745
- Project URL: https://www.mongodb.com/docs/drivers/csharp/
8746-
- Source: [NuGet](https://www.nuget.org/packages/MongoDB.Driver.Core/2.19.0)
8746+
- Source: [NuGet](https://www.nuget.org/packages/MongoDB.Driver.Core/2.19.1)
87478747
- License: [Apache-2.0](https://github.com/mongodb/mongo-csharp-driver/raw/master/License.txt)
87488748

87498749

src/Api/MonaiApplicationEntity.cs

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

18+
using System;
1819
using System.Collections.Generic;
1920
using System.ComponentModel.DataAnnotations;
2021
using System.ComponentModel.DataAnnotations.Schema;
@@ -95,6 +96,16 @@ public class MonaiApplicationEntity : MongoDBEntityBase
9596
/// </summary>
9697
public string? CreatedBy { get; set; }
9798

99+
/// <summary>
100+
/// Gets or set the most recent user who updated the DICOM entity.
101+
/// </summary>
102+
public string? UpdatedBy { get; set; }
103+
104+
/// <summary>
105+
/// Gets or set the most recent date time the DICOM entity was updated.
106+
/// </summary>
107+
public DateTime? DateTimeUpdated { get; set; }
108+
98109
public MonaiApplicationEntity()
99110
{
100111
SetDefaultValues();
@@ -124,9 +135,21 @@ public override string ToString()
124135
return $"Name: {Name}/AET: {AeTitle}";
125136
}
126137

127-
public void SetAuthor(ClaimsPrincipal user)
138+
public void SetAuthor(ClaimsPrincipal user, EditMode editMode)
128139
{
129-
CreatedBy = user.Identity?.Name;
140+
if (editMode == EditMode.Update)
141+
{
142+
DateTimeUpdated = DateTime.UtcNow;
143+
}
144+
145+
if (editMode == EditMode.Create)
146+
{
147+
CreatedBy = user.Identity?.Name;
148+
}
149+
else if (editMode == EditMode.Update)
150+
{
151+
UpdatedBy = user.Identity?.Name;
152+
}
130153
}
131154
}
132155
}

src/CLI/Commands/AetCommand.cs

Lines changed: 88 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
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,6 +40,7 @@ public AetCommand() : base("aet", "Configure SCP Application Entities")
4040
AddAlias("aetitle");
4141

4242
SetupAddAetCommand();
43+
SetupEditAetCommand();
4344
SetupRemoveAetCommand();
4445
SetupListAetCommand();
4546
}
@@ -100,6 +101,39 @@ private void SetupAddAetCommand()
100101
addCommand.Handler = CommandHandler.Create<MonaiApplicationEntity, IHost, bool, CancellationToken>(AddAeTitlehandlerAsync);
101102
}
102103

104+
private void SetupEditAetCommand()
105+
{
106+
var addCommand = new Command("update", "Update a SCP Application Entities");
107+
AddCommand(addCommand);
108+
109+
var nameOption = new Option<string>(new string[] { "-n", "--name" }, "Name of the SCP Application Entity") { IsRequired = false };
110+
addCommand.AddOption(nameOption);
111+
var groupingOption = new Option<string>(new string[] { "-g", "--grouping" }, getDefaultValue: () => "0020,000D", "DICOM tag used to group instances") { IsRequired = false };
112+
addCommand.AddOption(groupingOption);
113+
var timeoutOption = new Option<uint>(new string[] { "-t", "--timeout" }, getDefaultValue: () => 5, "Timeout, in seconds, to wait for instances") { IsRequired = false };
114+
addCommand.AddOption(timeoutOption);
115+
var workflowsOption = new Option<List<string>>(new string[] { "-w", "--workflows" }, description: "A space separated list of workflow names or IDs to be associated with the SCP AE Title")
116+
{
117+
AllowMultipleArgumentsPerToken = true,
118+
IsRequired = false,
119+
};
120+
addCommand.AddOption(workflowsOption);
121+
var ignoredSopsOption = new Option<List<string>>(new string[] { "-i", "--ignored-sop-classes" }, description: "A space separated list of SOP Class UIDs to be ignored")
122+
{
123+
AllowMultipleArgumentsPerToken = true,
124+
IsRequired = false,
125+
};
126+
addCommand.AddOption(ignoredSopsOption);
127+
var allowedSopsOption = new Option<List<string>>(new string[] { "-s", "--allowed-sop-classes" }, description: "A space separated list of SOP Class UIDs to be accepted")
128+
{
129+
AllowMultipleArgumentsPerToken = true,
130+
IsRequired = false,
131+
};
132+
addCommand.AddOption(allowedSopsOption);
133+
134+
addCommand.Handler = CommandHandler.Create<MonaiApplicationEntity, IHost, bool, CancellationToken>(EditAeTitleHandlerAsync);
135+
}
136+
103137
private async Task<int> ListAeTitlehandlerAsync(IHost host, bool verbose, CancellationToken cancellationToken)
104138
{
105139
Guard.Against.Null(host);
@@ -256,5 +290,58 @@ private async Task<int> AddAeTitlehandlerAsync(MonaiApplicationEntity entity, IH
256290
}
257291
return ExitCodes.Success;
258292
}
293+
294+
private async Task<int> EditAeTitleHandlerAsync(MonaiApplicationEntity entity, IHost host, bool verbose, CancellationToken cancellationToken)
295+
{
296+
Guard.Against.Null(entity);
297+
Guard.Against.Null(host);
298+
299+
LogVerbose(verbose, host, "Configuring services...");
300+
var configService = host.Services.GetRequiredService<IConfigurationService>();
301+
var client = host.Services.GetRequiredService<IInformaticsGatewayClient>();
302+
var logger = CreateLogger<DestinationCommand>(host);
303+
304+
Guard.Against.Null(logger, nameof(logger), "Logger is unavailable.");
305+
Guard.Against.Null(configService, nameof(configService), "Configuration service is unavailable.");
306+
Guard.Against.Null(client, nameof(client), $"{Strings.ApplicationName} client is unavailable.");
307+
308+
try
309+
{
310+
CheckConfiguration(configService);
311+
client.ConfigureServiceUris(configService.Configurations.InformaticsGatewayServerUri);
312+
313+
LogVerbose(verbose, host, $"Connecting to {Strings.ApplicationName} at {configService.Configurations.InformaticsGatewayServerEndpoint}...");
314+
LogVerbose(verbose, host, $"Updating SCP AE Title {entity.AeTitle}...");
315+
var result = await client.MonaiScpAeTitle.Update(entity, cancellationToken).ConfigureAwait(false);
316+
317+
logger.MonaiAeTitleUpdated(result.Name, result.AeTitle, result.Grouping, result.Timeout);
318+
if (result.Workflows.Any())
319+
{
320+
logger.MonaiAeWorkflows(string.Join(',', result.Workflows));
321+
logger.WorkflowWarning();
322+
}
323+
if (result.IgnoredSopClasses.Any())
324+
{
325+
logger.MonaiAeIgnoredSops(string.Join(',', result.IgnoredSopClasses));
326+
logger.IgnoredSopClassesWarning();
327+
}
328+
if (result.AllowedSopClasses.Any())
329+
{
330+
logger.MonaiAeAllowedSops(string.Join(',', result.AllowedSopClasses));
331+
logger.AcceptedSopClassesWarning();
332+
}
333+
}
334+
catch (ConfigurationException ex)
335+
{
336+
logger.ConfigurationException(ex.Message);
337+
return ExitCodes.Config_NotConfigured;
338+
}
339+
catch (Exception ex)
340+
{
341+
logger.ErrorUpdatingMonaiApplicationEntity(entity.AeTitle, ex.Message);
342+
return ExitCodes.MonaiScp_ErrorUpdate;
343+
}
344+
return ExitCodes.Success;
345+
}
259346
}
260347
}

src/CLI/ExitCodes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public static class ExitCodes
2828
public const int MonaiScp_ErrorList = 200;
2929
public const int MonaiScp_ErrorDelete = 201;
3030
public const int MonaiScp_ErrorCreate = 202;
31+
public const int MonaiScp_ErrorUpdate = 203;
3132

3233
public const int DestinationAe_ErrorList = 300;
3334
public const int DestinationAe_ErrorDelete = 301;

src/CLI/Logging/Log.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 MONAI Consortium
2+
* Copyright 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.
@@ -181,6 +181,12 @@ public static partial class Log
181181
[LoggerMessage(EventId = 30059, Level = LogLevel.Critical, Message = "Error updating DICOM source {aeTitle}: {message}")]
182182
public static partial void ErrorUpdatingDicomSource(this ILogger logger, string aeTitle, string message);
183183

184+
[LoggerMessage(EventId = 30060, Level = LogLevel.Information, Message = "MONAI Deploy SCP Application Entity updated:\r\n\tName: {name}\r\n\tAE Title: {aeTitle}\r\n\tGrouping: {grouping}\r\n\tTimeout: {timeout}")]
185+
public static partial void MonaiAeTitleUpdated(this ILogger logger, string name, string aeTitle, string grouping, uint timeout);
186+
187+
[LoggerMessage(EventId = 30061, Level = LogLevel.Critical, Message = "Error updating SCP Application Entity {aeTitle}: {message}")]
188+
public static partial void ErrorUpdatingMonaiApplicationEntity(this ILogger logger, string aeTitle, string message);
189+
184190
// Docker Runner
185191
[LoggerMessage(EventId = 31000, Level = LogLevel.Debug, Message = "Checking for existing {applicationName} ({version}) containers...")]
186192
public static partial void CheckingExistingAppContainer(this ILogger logger, string applicationName, string version);

0 commit comments

Comments
 (0)