Skip to content

Commit

Permalink
creating new queue and scp port
Browse files Browse the repository at this point in the history
Signed-off-by: Neil South <neil.south@answerdigital.com>
  • Loading branch information
neildsouth committed Nov 20, 2023
1 parent 076cc86 commit 95cebbb
Show file tree
Hide file tree
Showing 157 changed files with 3,292 additions and 823 deletions.
8 changes: 4 additions & 4 deletions doc/dependency_decisions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -774,16 +774,16 @@
- :who: neilsouth
:why: Apache-2.0 (https://github.com/Project-MONAI/monai-deploy-messaging/raw/main/LICENSE)
:versions:
- 1.0.3
- 1.0.4
- 1.0.5-rc0006
- 1.0.5
:when: 2023-10-13 18:06:21.511789690 Z
- - :approve
- Monai.Deploy.Messaging.RabbitMQ
- :who: neilsouth
:why: Apache-2.0 (https://github.com/Project-MONAI/monai-deploy-messaging/raw/main/LICENSE)
:versions:
- 1.0.3
- 1.0.4
- 1.0.5-rc0006
- 1.0.5
:when: 2023-10-13 18:06:21.511789690 Z
- - :approve
- Monai.Deploy.Storage
Expand Down
3 changes: 2 additions & 1 deletion src/Api/BaseApplicationEntity.cs → src/Api/Models/BaseApplicationEntity.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@

using System;
using System.Security.Claims;
using Monai.Deploy.InformaticsGateway.Api.Storage;

namespace Monai.Deploy.InformaticsGateway.Api
namespace Monai.Deploy.InformaticsGateway.Api.Models
{
/// <summary>
/// DICOM Application Entity or AE.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

namespace Monai.Deploy.InformaticsGateway.Api
namespace Monai.Deploy.InformaticsGateway.Api.Models
{
/// <summary>
/// Destination Application Entity
Expand Down
3 changes: 2 additions & 1 deletion src/Api/DicomAssociationInfo.cs → src/Api/Models/DicomAssociationInfo.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

using System;
using System.Collections.Generic;
using Monai.Deploy.InformaticsGateway.Api.Storage;

namespace Monai.Deploy.InformaticsGateway.Api
namespace Monai.Deploy.InformaticsGateway.Api.Models
{
public class DicomAssociationInfo : MongoDBEntityBase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using Monai.Deploy.InformaticsGateway.Api.PlugIns;
using Monai.Deploy.Messaging.Events;

namespace Monai.Deploy.InformaticsGateway.Api
namespace Monai.Deploy.InformaticsGateway.Api.Models
{
public class ExportRequestDataMessage
{
Expand Down
39 changes: 39 additions & 0 deletions src/Api/Models/ExternalAppDetails.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* 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 Monai.Deploy.InformaticsGateway.Api.Storage;

namespace Monai.Deploy.InformaticsGateway.Api.Models
{
public class ExternalAppDetails : MongoDBEntityBase
{
public string StudyInstanceUid { get; set; } = string.Empty;

public string StudyInstanceUidOutBound { get; set; } = string.Empty;

public string WorkflowInstanceId { get; set; } = string.Empty;

public string ExportTaskID { get; set; } = string.Empty;

public string CorrelationId { get; set; } = string.Empty;

public string? DestinationFolder { get; set; }

public string PatientId { get; set; } = string.Empty;

public string PatientIdOutBound { get; set; } = string.Empty;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Security.Claims;
using Monai.Deploy.InformaticsGateway.Api.PlugIns;
using Monai.Deploy.InformaticsGateway.Api.Storage;

namespace Monai.Deploy.InformaticsGateway.Api
namespace Monai.Deploy.InformaticsGateway.Api.Models
{
/// <summary>
/// MONAI Application Entity
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Monai.Deploy.InformaticsGateway.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
<PackageReference Include="fo-dicom" Version="5.1.1" />
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="6.0.22" />
<PackageReference Include="Monai.Deploy.Messaging" Version="1.0.4" />
<PackageReference Include="Monai.Deploy.Messaging.RabbitMQ" Version="1.0.4" />
<PackageReference Include="Monai.Deploy.Messaging" Version="1.0.5-rc0006" />
<PackageReference Include="Monai.Deploy.Messaging.RabbitMQ" Version="1.0.5-rc0006" />
<PackageReference Include="Monai.Deploy.Storage" Version="0.2.18" />
</ItemGroup>

Expand Down
1 change: 1 addition & 0 deletions src/Api/PlugIns/IOutputDataPlugin.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

using System.Threading.Tasks;
using FellowOakDicom;
using Monai.Deploy.InformaticsGateway.Api.Models;

namespace Monai.Deploy.InformaticsGateway.Api.PlugIns
{
Expand Down
1 change: 1 addition & 0 deletions src/Api/PlugIns/IOutputDataPluginEngine.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

using System.Collections.Generic;
using System.Threading.Tasks;
using Monai.Deploy.InformaticsGateway.Api.Models;

namespace Monai.Deploy.InformaticsGateway.Api.PlugIns
{
Expand Down
2 changes: 2 additions & 0 deletions src/Api/SourceApplicationEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

using Monai.Deploy.InformaticsGateway.Api.Models;

namespace Monai.Deploy.InformaticsGateway.Api
{
/// <summary>
Expand Down
48 changes: 43 additions & 5 deletions src/Api/Storage/DicomFileStorageMetadata.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public sealed record DicomFileStorageMetadata : FileStorageMetadata
/// Gets or set the Study Instance UID of the DICOM instance.
/// </summary>
[JsonPropertyName("studyInstanceUid")]
public string StudyInstanceUid { get; init; } = default!;
public string StudyInstanceUid { get; private set; } = default!;

/// <summary>
/// Gets or set the Series Instance UID of the DICOM instance.
Expand Down Expand Up @@ -93,6 +93,15 @@ public DicomFileStorageMetadata(string associationId, string identifier, string
StudyInstanceUid = studyInstanceUid;
SeriesInstanceUid = seriesInstanceUid;
SopInstanceUid = sopInstanceUid;
SetupFilePaths(associationId);

DataOrigin.DataService = dataService;
DataOrigin.Source = callingAeTitle;
DataOrigin.Destination = calledAeTitle;
}

private void SetupFilePaths(string associationId)
{
File = new StorageObjectMetadata(FileExtension)
{
TemporaryPath = string.Join(PathSeparator, associationId, DataTypeDirectoryName, $"{Guid.NewGuid()}{FileExtension}"),
Expand All @@ -106,16 +115,45 @@ public DicomFileStorageMetadata(string associationId, string identifier, string
UploadPath = $"{File.UploadPath}{DicomJsonFileExtension}",
ContentType = DicomJsonContentType,
};
}

DataOrigin.DataService = dataService;
DataOrigin.Source = callingAeTitle;
DataOrigin.Destination = calledAeTitle;
public void SetupGivenFilePaths(string? DestinationFolder)
{
if (DestinationFolder is null)
{
return;
}

if (DestinationFolder.EndsWith('/'))
{
DestinationFolder = DestinationFolder.Remove(DestinationFolder.Length - 1);
}

File = new StorageObjectMetadata(FileExtension)
{
TemporaryPath = string.Join(PathSeparator, DestinationFolder, $"Temp{PathSeparator}{Guid.NewGuid()}{FileExtension}"),
UploadPath = string.Join(PathSeparator, DestinationFolder, $"{SopInstanceUid}{FileExtension}"),
ContentType = DicomContentType,
DestinationFolderOverride = true,
};

JsonFile = new StorageObjectMetadata(DicomJsonFileExtension)
{
TemporaryPath = $"{File.TemporaryPath}{DicomJsonFileExtension}",
UploadPath = $"{File.UploadPath}{DicomJsonFileExtension}",
ContentType = DicomJsonContentType,
DestinationFolderOverride = true,
};

//DestinationFolderNeil = DestinationFolder;

Check warning on line 148 in src/Api/Storage/DicomFileStorageMetadata.cs

View workflow job for this annotation

GitHub Actions / unit-test

Remove this commented out code.

Check warning on line 148 in src/Api/Storage/DicomFileStorageMetadata.cs

View workflow job for this annotation

GitHub Actions / unit-test

Remove this commented out code.

Check warning on line 148 in src/Api/Storage/DicomFileStorageMetadata.cs

View workflow job for this annotation

GitHub Actions / unit-test

Remove this commented out code.
}

public void SetStudyInstanceUid(string newStudyInstanceUid) => StudyInstanceUid = newStudyInstanceUid;

public override void SetFailed()
{
base.SetFailed();
JsonFile.SetFailed();
}
}
}
}
5 changes: 4 additions & 1 deletion src/Api/Storage/FileStorageMetadata.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ public abstract record FileStorageMetadata
[JsonPropertyName("payloadId")]
public string? PayloadId { get; set; }

// [JsonPropertyName("destinationFolder")]
//public string? DestinationFolderNeil { get; set; }

Check warning on line 108 in src/Api/Storage/FileStorageMetadata.cs

View workflow job for this annotation

GitHub Actions / unit-test

Remove this commented out code.

Check warning on line 108 in src/Api/Storage/FileStorageMetadata.cs

View workflow job for this annotation

GitHub Actions / unit-test

Remove this commented out code.

Check warning on line 108 in src/Api/Storage/FileStorageMetadata.cs

View workflow job for this annotation

GitHub Actions / unit-test

Remove this commented out code.

/// <summary>
/// DO NOT USE
/// This constructor is intended for JSON serializer.
Expand Down Expand Up @@ -162,4 +165,4 @@ public static string IpAddress()
return "127.0.0.1";
}
}
}
}
2 changes: 1 addition & 1 deletion src/Api/MongoDBEntityBase.cs → src/Api/Storage/MongoDBEntityBase.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

using System;

namespace Monai.Deploy.InformaticsGateway.Api
namespace Monai.Deploy.InformaticsGateway.Api.Storage
{
public abstract class MongoDBEntityBase
{
Expand Down
10 changes: 9 additions & 1 deletion src/Api/Storage/Payload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ public TimeSpan Elapsed

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

public string DestinationFolder { get; set; } = string.Empty;

public Payload(string key, string correlationId, string? workflowInstanceId, string? taskId, DataOrigin dataTrigger, uint timeout)
{
Guard.Against.NullOrWhiteSpace(key, nameof(key));
Expand All @@ -106,7 +108,7 @@ public Payload(string key, string correlationId, string? workflowInstanceId, str
DataTrigger = dataTrigger;
}

public Payload(string key, string correlationId, string? workflowInstanceId, string? taskId, DataOrigin dataTrigger, uint timeout, string? payloadId = null) :
public Payload(string key, string correlationId, string? workflowInstanceId, string? taskId, DataOrigin dataTrigger, uint timeout, string? payloadId = null, string? DestinationFolder = null) :

Check warning on line 111 in src/Api/Storage/Payload.cs

View workflow job for this annotation

GitHub Actions / unit-test

This method signature overlaps the one defined on line 91, the default parameter value can only be used with named arguments.

Check warning on line 111 in src/Api/Storage/Payload.cs

View workflow job for this annotation

GitHub Actions / unit-test

This method signature overlaps the one defined on line 91, the default parameter value can only be used with named arguments.
this(key, correlationId, workflowInstanceId, taskId, dataTrigger, timeout)
{
Guard.Against.NullOrWhiteSpace(key, nameof(key));
Expand All @@ -119,6 +121,7 @@ public Payload(string key, string correlationId, string? workflowInstanceId, str
{
PayloadId = Guid.Parse(payloadId);
}
DestinationFolder ??= string.Empty;
}

public void Add(FileStorageMetadata value)
Expand All @@ -132,6 +135,11 @@ public void Add(FileStorageMetadata value)
DataOrigins.Add(value.DataOrigin);
}

//if (string.IsNullOrWhiteSpace(value.DestinationFolderNeil) is false)
//{

Check warning on line 139 in src/Api/Storage/Payload.cs

View workflow job for this annotation

GitHub Actions / unit-test

Remove this commented out code.

Check warning on line 139 in src/Api/Storage/Payload.cs

View workflow job for this annotation

GitHub Actions / unit-test

Remove this commented out code.

Check warning on line 139 in src/Api/Storage/Payload.cs

View workflow job for this annotation

GitHub Actions / unit-test

Remove this commented out code.
// DestinationFolder = value.DestinationFolderNeil;
//}

_lastReceived.Reset();
_lastReceived.Start();
}
Expand Down
9 changes: 8 additions & 1 deletion src/Api/Storage/StorageObjectMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ public class StorageObjectMetadata
[JsonPropertyName("isMoveCompleted"), JsonInclude]
public bool IsMoveCompleted { get; private set; } = default!;

[JsonPropertyName("destinationFolderOverride")]
public bool DestinationFolderOverride { get; set; } = false;

public StorageObjectMetadata(string fileExtension)
{
Guard.Against.NullOrWhiteSpace(fileExtension, nameof(fileExtension));
Expand All @@ -111,7 +114,11 @@ public string GetPayloadPath(Guid payloadId)
{
Guard.Against.Null(payloadId, nameof(payloadId));

return $"{payloadId}{FileStorageMetadata.PathSeparator}{UploadPath}";
if (DestinationFolderOverride is false)

Check warning on line 117 in src/Api/Storage/StorageObjectMetadata.cs

View workflow job for this annotation

GitHub Actions / unit-test

Remove the unnecessary Boolean literal(s).

Check warning on line 117 in src/Api/Storage/StorageObjectMetadata.cs

View workflow job for this annotation

GitHub Actions / unit-test

Remove the unnecessary Boolean literal(s).
{
return $"{payloadId}{FileStorageMetadata.PathSeparator}{UploadPath}";
}
return $"{UploadPath}";
}

public void SetUploaded(string bucketName)
Expand Down
1 change: 1 addition & 0 deletions src/Api/Test/BaseApplicationEntityTest.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

using Monai.Deploy.InformaticsGateway.Api.Models;
using Xunit;

namespace Monai.Deploy.InformaticsGateway.Api.Test
Expand Down
1 change: 1 addition & 0 deletions src/Api/Test/DestinationApplicationEntityTest.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

using Monai.Deploy.InformaticsGateway.Api.Models;
using Xunit;

namespace Monai.Deploy.InformaticsGateway.Api.Test
Expand Down
1 change: 1 addition & 0 deletions src/Api/Test/MonaiApplicationEntityTest.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

using Monai.Deploy.InformaticsGateway.Api.Models;
using Xunit;

namespace Monai.Deploy.InformaticsGateway.Api.Test
Expand Down
14 changes: 7 additions & 7 deletions src/Api/Test/packages.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@
},
"Monai.Deploy.Messaging": {
"type": "Transitive",
"resolved": "1.0.4",
"contentHash": "K6RrbDh7upokvt+sKuKEhQ+B1Xj46DF4sHxqwE6ymZazwmRULzsD0u/1IeDDJCGuRs3iG64QWwCt32j30PSZLg==",
"resolved": "1.0.5-rc0006",
"contentHash": "Yr6Ix8AeKdciz7t9aeteYuDAiNpmv3FmpF9bvdvjVh46gBazf+HBdvXdbWWXgzNTd3yevsQGBKazQXN9ecqwog==",
"dependencies": {
"Ardalis.GuardClauses": "4.1.1",
"Microsoft.Extensions.Diagnostics.HealthChecks": "6.0.21",
Expand All @@ -260,10 +260,10 @@
},
"Monai.Deploy.Messaging.RabbitMQ": {
"type": "Transitive",
"resolved": "1.0.4",
"contentHash": "2llZ4XbE91Km2Q+JEKSSeTyhZLWRq3lN5xQ6+Klqow3V8SXBAlOQQ+b5//BEm6x0QdoycFberMOVAsZYYM0j7g==",
"resolved": "1.0.5-rc0006",
"contentHash": "luSfBhU4hFwyGk7SS05sfKHwxcCYjXimfmaTjNDjFKKjIYbd3IPm8lYDPSiszbZB53jpgNvYDy+aWJY8YlVXZg==",
"dependencies": {
"Monai.Deploy.Messaging": "1.0.4",
"Monai.Deploy.Messaging": "1.0.5-rc0006",
"Polly": "7.2.4",
"RabbitMQ.Client": "6.5.0"
}
Expand Down Expand Up @@ -1280,8 +1280,8 @@
"Macross.Json.Extensions": "[3.0.0, )",
"Microsoft.EntityFrameworkCore.Abstractions": "[6.0.22, )",
"Monai.Deploy.InformaticsGateway.Common": "[1.0.0, )",
"Monai.Deploy.Messaging": "[1.0.4, )",
"Monai.Deploy.Messaging.RabbitMQ": "[1.0.4, )",
"Monai.Deploy.Messaging": "[1.0.5-rc0006, )",
"Monai.Deploy.Messaging.RabbitMQ": "[1.0.5-rc0006, )",
"Monai.Deploy.Storage": "[0.2.18, )",
"fo-dicom": "[5.1.1, )"
}
Expand Down
1 change: 1 addition & 0 deletions src/Api/VirtualApplicationEntity.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Security.Claims;
using Monai.Deploy.InformaticsGateway.Api.PlugIns;
using Monai.Deploy.InformaticsGateway.Api.Storage;

namespace Monai.Deploy.InformaticsGateway.Api
{
Expand Down
Loading

0 comments on commit 95cebbb

Please sign in to comment.