Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PUT /config/ae #371

Merged
merged 11 commits into from
Mar 28, 2023
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,21 @@ jobs:
uses: gittools/actions/gitversion/execute@v0.10.2
with:
useConfigFile: true
updateAssemblyInfo: true
updateAssemblyInfoFilename: src/AssemblyInfo.cs
configFilePath: .github/.gitversion.yml

- name: Print AssemblyInfo
run: cat src/AssemblyInfo.cs

- name: Upload AssemblyInfo
uses: actions/upload-artifact@v3.1.2
if: always()
with:
name: assembly-info
path: src/AssemblyInfo.cs
retention-days: 30

CodeQL-Analyze:
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -330,6 +343,16 @@ jobs:
restore-keys: |
${{ runner.os }}-nuget

- name: Download AssemblyInfo.cs
id: download
uses: actions/download-artifact@v3
with:
name: assembly-info
path: src/

- name: Print AssemblyInfo
run: cat src/AssemblyInfo.cs

- name: Restore dependencies
run: dotnet restore
working-directory: ./src
Expand Down
6 changes: 3 additions & 3 deletions doc/dependency_decisions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2401,21 +2401,21 @@
- :who: mocsharp
:why: Apache-2.0 (https://github.com/mongodb/mongo-csharp-driver/raw/master/License.txt)
:versions:
- 2.19.0
- 2.19.1
:when: 2022-11-16 23:38:53.891380809 Z
- - :approve
- MongoDB.Driver
- :who: mocsharp
:why: Apache-2.0 (https://github.com/mongodb/mongo-csharp-driver/raw/master/License.txt)
:versions:
- 2.19.0
- 2.19.1
:when: 2022-11-16 23:38:54.213853364 Z
- - :approve
- MongoDB.Driver.Core
- :who: mocsharp
:why: Apache-2.0 (https://github.com/mongodb/mongo-csharp-driver/raw/master/License.txt)
:versions:
- 2.19.0
- 2.19.1
:when: 2022-11-16 23:38:54.553730219 Z
- - :approve
- MongoDB.Libmongocrypt
Expand Down
59 changes: 59 additions & 0 deletions docs/api/rest/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,65 @@ curl --location --request POST 'http://localhost:5000/config/ae/' \

---

## PUT /config/ae

Updates an existing MONAI SCP Application Entity.

> [!Note]
> The MONAI SCP AE Title cannot be changed.

> [!Note]
> The DICOM tag used for `grouping` can be either a Study Instance UID (0020,000D) or Series Instance UID (0020,000E).
> The default is set to a Study Instance UID (0020,000D) if not specified.

> [!Note]
> `timeout` is the number of seconds the AE Title will wait between each instance before assembling a payload and publishing
> a workflow request. We recommend calculating this value based on the network speed and the maximum size of each
> DICOM instance.

### Parameters

See the [MonaiApplicationEntity](xref:Monai.Deploy.InformaticsGateway.Api.MonaiApplicationEntity)
class definition for details.

### Responses

Response Content Type: JSON - [MonaiApplicationEntity](xref:Monai.Deploy.InformaticsGateway.Api.MonaiApplicationEntity).

| Code | Description |
| ---- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| 200 | AE Title updated successfully. |
| 400 | Validation error. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |
| 404 | Named MONAI AE not found. |
| 500 | Server error. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |

### Example Request

```bash
curl --location --request PUT 'http://localhost:5000/config/ae/' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "breast-tumor",
"timeout": 3,
"workflows": [
"3f6a08a1-0dea-44e9-ab82-1ff1adf43a8e"
]
}
}'
```

### Example Response

```json
{
"name": "breast-tumor",
"aeTitle": "BREASTV1",
"workflows": ["3f6a08a1-0dea-44e9-ab82-1ff1adf43a8e"],
"timeout": 3
}
```

---
## DELETE /config/ae/{name}

Deletes the specified MONAI SCP Application Entity.
Expand Down
39 changes: 38 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
~ Copyright 2021-2022 MONAI Consortium
~ Copyright 2021-2023 MONAI Consortium
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,43 @@

# Changelog

## 0.3.15

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

- New APIs for managing SCP AE Titles
- `PUT /config/ae`: [Update SCP AE TItle](./api/rest/config.md#put-configae)

## 0.3.14

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

- Fixes RabbitMQ startup issues.

## 0.3.13

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

- Fixes an issue where failure uploads caused payload to stuck in the queue and stops processing any incoming data.

## 0.3.12

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

- Fixes exception handling for unavailable previously created dead-letter queues

## 0.3.11

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

- Adds exception handling for unavailable previously created dead-letter queues

## 0.3.10

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

- Fixes payload assembler not respecting user configured timeout window

## 0.3.8

[GitHub Milestone 0.3.8](https://github.com/Project-MONAI/monai-deploy-informatics-gateway/milestone/14)
Expand Down
18 changes: 9 additions & 9 deletions docs/compliance/third-party-licenses.md
Original file line number Diff line number Diff line change
Expand Up @@ -8672,14 +8672,14 @@ By downloading this software, you agree to the license terms & all licenses list


<details>
<summary>MongoDB.Bson 2.19.0</summary>
<summary>MongoDB.Bson 2.19.1</summary>

## MongoDB.Bson

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


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


<details>
<summary>MongoDB.Driver 2.19.0</summary>
<summary>MongoDB.Driver 2.19.1</summary>

## MongoDB.Driver

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


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


<details>
<summary>MongoDB.Driver.Core 2.19.0</summary>
<summary>MongoDB.Driver.Core 2.19.1</summary>

## MongoDB.Driver.Core

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


Expand Down
8 changes: 5 additions & 3 deletions src/Api/Monai.Deploy.InformaticsGateway.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@
<CodeAnalysisRuleSet>..\.sonarlint\project-monai_monai-deploy-informatics-gatewaycsharp.ruleset</CodeAnalysisRuleSet>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

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

<ItemGroup>
<Compile Include="..\AssemblyInfo.cs" Link="AssemblyInfo.cs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Common\Monai.Deploy.InformaticsGateway.Common.csproj" />
</ItemGroup>
Expand Down
27 changes: 25 additions & 2 deletions src/Api/MonaiApplicationEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* limitations under the License.
*/

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
Expand Down Expand Up @@ -95,6 +96,16 @@ public class MonaiApplicationEntity : MongoDBEntityBase
/// </summary>
public string? CreatedBy { get; set; }

/// <summary>
/// Gets or set the most recent user who updated the DICOM entity.
/// </summary>
public string? UpdatedBy { get; set; }

/// <summary>
/// Gets or set the most recent date time the DICOM entity was updated.
/// </summary>
public DateTime? DateTimeUpdated { get; set; }

public MonaiApplicationEntity()
{
SetDefaultValues();
Expand Down Expand Up @@ -124,9 +135,21 @@ public override string ToString()
return $"Name: {Name}/AET: {AeTitle}";
}

public void SetAuthor(ClaimsPrincipal user)
public void SetAuthor(ClaimsPrincipal user, EditMode editMode)
{
CreatedBy = user.Identity?.Name;
if (editMode == EditMode.Update)
{
DateTimeUpdated = DateTime.UtcNow;
}

if (editMode == EditMode.Create)
{
CreatedBy = user.Identity?.Name;
}
else if (editMode == EditMode.Update)
{
UpdatedBy = user.Identity?.Name;
}
}
}
}
3 changes: 3 additions & 0 deletions src/Api/Storage/Payload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ public TimeSpan Elapsed

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

public int FilesUploaded { get => Files.Count(p => p.IsUploaded); }
public int FilesFailedToUpload { get => Files.Count(p => p.IsUploadFailed); }

public Payload(string key, string correlationId, uint timeout)
{
Guard.Against.NullOrWhiteSpace(key);
Expand Down
6 changes: 0 additions & 6 deletions src/Api/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
"version": 1,
"dependencies": {
"net6.0": {
"GitVersion.MsBuild": {
"type": "Direct",
"requested": "[5.12.0, )",
"resolved": "5.12.0",
"contentHash": "dJuigXycpJNOiLT9or7mkHSkGFHgGW3/p6cNNYEKZBa7Hhp1FdX/cvqYWWYhRLpfoZOedeA7aRbYiOB3vW/dvA=="
},
"Macross.Json.Extensions": {
"type": "Direct",
"requested": "[3.0.0, )",
Expand Down
22 changes: 22 additions & 0 deletions src/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2023 MONAI Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System.Reflection;

[assembly: AssemblyVersion("0.0.0.0")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0")]

Loading