Skip to content

Commit

Permalink
adding external App repo
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 8, 2023
1 parent 9676541 commit f7eb708
Show file tree
Hide file tree
Showing 93 changed files with 810 additions and 85 deletions.
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
31 changes: 31 additions & 0 deletions src/Api/Models/ExternalAppDetails.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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 WorkflowInstanceId { get; set; } = string.Empty;

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

public string CorrelationId { 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
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
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
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
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
2 changes: 1 addition & 1 deletion src/CLI/Commands/AetCommand.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
using Ardalis.GuardClauses;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;
using Monai.Deploy.InformaticsGateway.CLI.Services;
using Monai.Deploy.InformaticsGateway.Client;
using Monai.Deploy.InformaticsGateway.Common;
Expand Down
2 changes: 1 addition & 1 deletion src/CLI/Commands/DestinationCommand.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
using Ardalis.GuardClauses;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;
using Monai.Deploy.InformaticsGateway.CLI.Services;
using Monai.Deploy.InformaticsGateway.Client;
using Monai.Deploy.InformaticsGateway.Common;
Expand Down
2 changes: 1 addition & 1 deletion src/CLI/Test/AetCommandTest.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;
using Monai.Deploy.InformaticsGateway.CLI.Services;
using Monai.Deploy.InformaticsGateway.Client;
using Monai.Deploy.InformaticsGateway.SharedTest;
Expand Down
2 changes: 1 addition & 1 deletion src/CLI/Test/DestinationCommandTest.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;
using Monai.Deploy.InformaticsGateway.CLI.Services;
using Monai.Deploy.InformaticsGateway.Client;
using Monai.Deploy.InformaticsGateway.SharedTest;
Expand Down
1 change: 1 addition & 0 deletions src/Client/IInformaticsGatewayClient.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using System;
using System.Net.Http.Headers;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;
using Monai.Deploy.InformaticsGateway.Client.Services;

namespace Monai.Deploy.InformaticsGateway.Client
Expand Down
1 change: 1 addition & 0 deletions src/Client/InformaticsGatewayClient.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Ardalis.GuardClauses;
using Microsoft.Extensions.Logging;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;
using Monai.Deploy.InformaticsGateway.Client.Common;
using Monai.Deploy.InformaticsGateway.Client.Services;

Expand Down
2 changes: 1 addition & 1 deletion src/Client/Services/AeTitle{T}Service.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using System.Threading.Tasks;
using Ardalis.GuardClauses;
using Microsoft.Extensions.Logging;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;

namespace Monai.Deploy.InformaticsGateway.Client.Services
{
Expand Down
1 change: 1 addition & 0 deletions src/Client/Test/AeTitleServiceTest.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;
using Monai.Deploy.InformaticsGateway.Client.Common;
using Monai.Deploy.InformaticsGateway.Client.Services;
using Moq;
Expand Down
1 change: 1 addition & 0 deletions src/Configuration/Test/ValidationExtensionsTest.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using System.Collections.Generic;
using FellowOakDicom;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;
using Xunit;

namespace Monai.Deploy.InformaticsGateway.Configuration.Test
Expand Down
1 change: 1 addition & 0 deletions src/Configuration/ValidationExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using Ardalis.GuardClauses;
using FellowOakDicom;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;

namespace Monai.Deploy.InformaticsGateway.Configuration
{
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Api/Repositories/IDestinationApplicationEntityRepository.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

using System.Linq.Expressions;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;

namespace Monai.Deploy.InformaticsGateway.Database.Api.Repositories
{
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Api/Repositories/IDicomAssociationInfoRepository.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

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

namespace Monai.Deploy.InformaticsGateway.Database.Api.Repositories
{
Expand Down
27 changes: 27 additions & 0 deletions src/Database/Api/Repositories/IExternalAppDeatilsRepository.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2022 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.Models;

namespace Monai.Deploy.InformaticsGateway.Database.Api.Repositories
{
public interface IExternalAppDetailsRepository
{
Task AddAsync(ExternalAppDetails details, CancellationToken cancellationToken);

Task<ExternalAppDetails> GetAsync(string studyInstanceId, CancellationToken cancellationToken);
}
}
2 changes: 1 addition & 1 deletion src/Database/Api/Repositories/IMonaiApplicationEntityRepository.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

using System.Linq.Expressions;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;

namespace Monai.Deploy.InformaticsGateway.Database.Api.Repositories
{
Expand Down
1 change: 0 additions & 1 deletion src/Database/Api/StorageMetadataWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using Ardalis.GuardClauses;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Storage;

namespace Monai.Deploy.InformaticsGateway.Database.Api
Expand Down
2 changes: 2 additions & 0 deletions src/Database/DatabaseManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public static IServiceCollection ConfigureDatabase(this IServiceCollection servi
services.AddScoped(typeof(IPayloadRepository), typeof(EntityFramework.Repositories.PayloadRepository));
services.AddScoped(typeof(IDicomAssociationInfoRepository), typeof(EntityFramework.Repositories.DicomAssociationInfoRepository));
services.AddScoped(typeof(IVirtualApplicationEntityRepository), typeof(EntityFramework.Repositories.VirtualApplicationEntityRepository));
services.AddScoped(typeof(IExternalAppDetailsRepository), typeof(EntityFramework.Repositories.ExternalAppDetailsRepository));

services.ConfigureDatabaseFromPlugIns(DatabaseType.EntityFramework, fileSystem, connectionStringConfigurationSection, pluginsConfigurationSection, loggerFactory);
return services;
Expand All @@ -106,6 +107,7 @@ public static IServiceCollection ConfigureDatabase(this IServiceCollection servi
services.AddScoped(typeof(IPayloadRepository), typeof(MongoDB.Repositories.PayloadRepository));
services.AddScoped(typeof(IDicomAssociationInfoRepository), typeof(MongoDB.Repositories.DicomAssociationInfoRepository));
services.AddScoped(typeof(IVirtualApplicationEntityRepository), typeof(MongoDB.Repositories.VirtualApplicationEntityRepository));
services.AddScoped(typeof(IExternalAppDetailsRepository), typeof(MongoDB.Repositories.ExternalAppDetailsRepository));

services.ConfigureDatabaseFromPlugIns(DatabaseType.MongoDb, fileSystem, connectionStringConfigurationSection, pluginsConfigurationSection, loggerFactory);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;

namespace Monai.Deploy.InformaticsGateway.Database.EntityFramework.Configuration
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;

namespace Monai.Deploy.InformaticsGateway.Database.EntityFramework.Configuration
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* 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.Text.Json.Serialization;
using System.Text.Json;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Monai.Deploy.InformaticsGateway.Api.Models;

namespace Monai.Deploy.InformaticsGateway.Database.EntityFramework.Configuration
{
internal class ExternalAppDetailsConfiguration : IEntityTypeConfiguration<ExternalAppDetails>
{
public void Configure(EntityTypeBuilder<ExternalAppDetails> builder)
{
var jsonSerializerSettings = new JsonSerializerOptions
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull
};

builder.HasKey(j => j.Id);

builder.Property(j => j.StudyInstanceUid).IsRequired();
builder.Property(j => j.WorkflowInstanceId).IsRequired();
builder.Property(j => j.DateTimeCreated).IsRequired();
builder.Property(j => j.CorrelationId).IsRequired();
builder.Property(j => j.ExportTaskID).IsRequired();
}
}
}
2 changes: 1 addition & 1 deletion src/Database/EntityFramework/Configuration/MonaiApplicationEntityConfiguration.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Monai.Deploy.InformaticsGateway.Api;
using Monai.Deploy.InformaticsGateway.Api.Models;

namespace Monai.Deploy.InformaticsGateway.Database.EntityFramework.Configuration
{
Expand Down
Loading

0 comments on commit f7eb708

Please sign in to comment.