Skip to content

Commit a8caee3

Browse files
authored
Add PUT /config/ae (#371)
Signed-off-by: Victor Chang <[email protected]>
1 parent 222c747 commit a8caee3

File tree

61 files changed

+1237
-211
lines changed

Some content is hidden

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

61 files changed

+1237
-211
lines changed

.github/workflows/ci.yml

+23
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,21 @@ jobs:
5757
uses: gittools/actions/gitversion/[email protected]
5858
with:
5959
useConfigFile: true
60+
updateAssemblyInfo: true
61+
updateAssemblyInfoFilename: src/AssemblyInfo.cs
6062
configFilePath: .github/.gitversion.yml
6163

64+
- name: Print AssemblyInfo
65+
run: cat src/AssemblyInfo.cs
66+
67+
- name: Upload AssemblyInfo
68+
uses: actions/[email protected]
69+
if: always()
70+
with:
71+
name: assembly-info
72+
path: src/AssemblyInfo.cs
73+
retention-days: 30
74+
6275
CodeQL-Analyze:
6376
runs-on: ubuntu-latest
6477
permissions:
@@ -330,6 +343,16 @@ jobs:
330343
restore-keys: |
331344
${{ runner.os }}-nuget
332345
346+
- name: Download AssemblyInfo.cs
347+
id: download
348+
uses: actions/download-artifact@v3
349+
with:
350+
name: assembly-info
351+
path: src/
352+
353+
- name: Print AssemblyInfo
354+
run: cat src/AssemblyInfo.cs
355+
333356
- name: Restore dependencies
334357
run: dotnet restore
335358
working-directory: ./src

doc/dependency_decisions.yml

+3-3
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

+59
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

+38-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.
@@ -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

+9-9
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/Monai.Deploy.InformaticsGateway.Api.csproj

+5-3
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@
2424
<CodeAnalysisRuleSet>..\.sonarlint\project-monai_monai-deploy-informatics-gatewaycsharp.ruleset</CodeAnalysisRuleSet>
2525
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
2626
<Nullable>enable</Nullable>
27+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
2728
</PropertyGroup>
2829

2930
<ItemGroup>
30-
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
31-
<PrivateAssets>All</PrivateAssets>
32-
</PackageReference>
3331
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
3432
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="6.0.15" />
3533
<PackageReference Include="Monai.Deploy.Messaging" Version="0.1.22" />
@@ -46,6 +44,10 @@
4644
<AdditionalFiles Include="..\.sonarlint\project-monai_monai-deploy-informatics-gateway\CSharp\SonarLint.xml" Link="SonarLint.xml" />
4745
</ItemGroup>
4846

47+
<ItemGroup>
48+
<Compile Include="..\AssemblyInfo.cs" Link="AssemblyInfo.cs" />
49+
</ItemGroup>
50+
4951
<ItemGroup>
5052
<ProjectReference Include="..\Common\Monai.Deploy.InformaticsGateway.Common.csproj" />
5153
</ItemGroup>

src/Api/MonaiApplicationEntity.cs

+25-2
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/Api/Storage/Payload.cs

+3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ public TimeSpan Elapsed
7575

7676
public string? CalledAeTitle { get => Files.OfType<DicomFileStorageMetadata>().Select(p => p.CalledAeTitle).FirstOrDefault(); }
7777

78+
public int FilesUploaded { get => Files.Count(p => p.IsUploaded); }
79+
public int FilesFailedToUpload { get => Files.Count(p => p.IsUploadFailed); }
80+
7881
public Payload(string key, string correlationId, uint timeout)
7982
{
8083
Guard.Against.NullOrWhiteSpace(key);

src/Api/packages.lock.json

-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
"version": 1,
33
"dependencies": {
44
"net6.0": {
5-
"GitVersion.MsBuild": {
6-
"type": "Direct",
7-
"requested": "[5.12.0, )",
8-
"resolved": "5.12.0",
9-
"contentHash": "dJuigXycpJNOiLT9or7mkHSkGFHgGW3/p6cNNYEKZBa7Hhp1FdX/cvqYWWYhRLpfoZOedeA7aRbYiOB3vW/dvA=="
10-
},
115
"Macross.Json.Extensions": {
126
"type": "Direct",
137
"requested": "[3.0.0, )",

src/AssemblyInfo.cs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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.Reflection;
18+
19+
[assembly: AssemblyVersion("0.0.0.0")]
20+
[assembly: AssemblyFileVersion("0.0.0.0")]
21+
[assembly: AssemblyInformationalVersion("0.0.0")]
22+

0 commit comments

Comments
 (0)