Skip to content

Commit

Permalink
Merge pull request #263 from Project-MONAI/release/1.0.5
Browse files Browse the repository at this point in the history
Release/1.0.5
  • Loading branch information
neildsouth authored Nov 23, 2023
2 parents 51e6ae7 + 086ec7d commit fcb0b80
Show file tree
Hide file tree
Showing 4 changed files with 156 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Messaging/Common/ArtifactType.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public enum ArtifactType
{
Unset, //Unset
Folder, // Folder
HL7, //HL7 Structured Document
AR, //Autorefraction
ASMT, //Content Assessment Results
AU, //Audio
Expand Down
5 changes: 5 additions & 0 deletions src/Messaging/Events/ExportCompleteEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ public class ExportCompleteEvent : EventBase
[JsonPropertyName("file_statuses")]
public Dictionary<string, FileExportStatus> FileStatuses { get; set; }

/// <summary>
/// the target to export too
/// </summary>
public DataOrigin? Target { get; set; }

[Newtonsoft.Json.JsonConstructor]
[System.Text.Json.Serialization.JsonConstructor]
public ExportCompleteEvent()
Expand Down
5 changes: 5 additions & 0 deletions src/Messaging/Events/ExportRequestEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ public class ExportRequestEvent : EventBase
[JsonPropertyName("plug_in_assemblies")]
public List<string> PluginAssemblies { get; private set; }

/// <summary>
/// the target to export too
/// </summary>
public DataOrigin? Target { get; set; }

public ExportRequestEvent()
{
ErrorMessages = new List<string>();
Expand Down
145 changes: 145 additions & 0 deletions src/Messaging/Events/ExternalAppRequestEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
/*
* 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.
* 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.ComponentModel.DataAnnotations;
using System.Text.Json.Serialization;
using Ardalis.GuardClauses;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Monai.Deploy.Messaging.Events
{
public class ExternalAppRequestEvent
{
/// <summary>
/// Gets or sets the workflow instanceID generated by the Workflow Manager.
/// </summary>
[JsonProperty(PropertyName = "workflow_instance_id")]
[JsonPropertyName("workflow_instance_id")]
[Required]
public string WorkflowInstanceId { get; set; } = default!;

/// <summary>
/// Gets or sets the export task ID generated by the Workflow Manager.
/// </summary>
[JsonProperty(PropertyName = "export_task_id")]
[JsonPropertyName("export_task_id")]
[Required]
public string ExportTaskId { get; set; } = default!;

/// <summary>
/// Gets or set the correlation ID.
/// For DIMSE, the correlation ID is the UUID associated with the first DICOM association received.
/// For ACR, use the Transaction ID in the original request.
/// </summary>
[JsonProperty(PropertyName = "correlation_id")]
[JsonPropertyName("correlation_id")]
[Required]
public string CorrelationId { get; set; } = default!;

/// <summary>
/// Gets or sets the delivery tag or acknowledge token for the task.
/// </summary>
[JsonProperty(PropertyName = "delivery_tag")]
[JsonPropertyName("delivery_tag")]
public string DeliveryTag { get; set; } = default!;

/// <summary>
/// Gets or sets the message ID set by the message broker.
/// </summary>
[JsonProperty(PropertyName = "message_id")]
[JsonPropertyName("message_id")]
public string MessageId { get; set; } = default!;

/// <summary>
/// Gets or sets the state of the export task.
/// </summary>
[JsonProperty(PropertyName = "status")]
[JsonPropertyName("status")]
[Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))]
[System.Text.Json.Serialization.JsonConverter(typeof(JsonStringEnumConverter))]
[Required]
public ExportStatus Status { get; set; }

/// <summary>
/// Gets or sets error messages, if any, when exporting.
/// </summary>
[JsonProperty(PropertyName = "message")]
[JsonPropertyName("message")]
public string Message { get; set; } = default!;

/// <summary>
/// Gets or sets a list of files to be exported.
/// </summary>
[JsonProperty(PropertyName = "files")]
[JsonPropertyName("files")]
[Required, MinLength(1)]
public IEnumerable<string> Files { get; set; } = default!;

/// <summary>
/// Gets or sets files exported with its status
/// </summary>
[JsonProperty(PropertyName = "file_statuses")]
[JsonPropertyName("file_statuses")]
public Dictionary<string, FileExportStatus> FileStatuses { get; set; }

/// <summary>
/// Gets or sets error messages related to this export task.
/// </summary>
[JsonProperty(PropertyName = "error_messages")]
[JsonPropertyName("error_messages")]
public List<string> ErrorMessages { get; private set; } = new List<string>();

/// <summary>
/// A list of data output plug-in type names to be executed by the export services.
/// Each string must be a fully-qualified type name.
/// E.g. <code>MyCompnay.MyProject.MyNamepsace.MyPlugin, MyCompnay.MyProject.MyNamepsace</code> where
/// <code>MyCompnay.MyProject.MyNamepsace</code> is the name of the assembly (DLL).
/// </summary>
[JsonProperty(PropertyName = "plug_in_assemblies")]
[JsonPropertyName("plug_in_assemblies")]
public List<string> PluginAssemblies { get; private set; } = new List<string>();

/// <summary>
/// the targets to export too
/// </summary>
public List<DataOrigin> Targets { get; set; } = new List<DataOrigin>();

[JsonProperty(PropertyName = "destination_folder")]
[JsonPropertyName("destination_folder")]
public string? DestinationFolder { get; set; }

[Newtonsoft.Json.JsonConstructor]
[System.Text.Json.Serialization.JsonConstructor]
public ExternalAppRequestEvent()
{
Status = ExportStatus.Unknown;
FileStatuses = new Dictionary<string, FileExportStatus>();
}

public ExternalAppRequestEvent(ExportRequestEvent exportRequest, ExportStatus exportStatus, Dictionary<string, FileExportStatus> fileStatuses)
{
Guard.Against.Null(exportRequest, nameof(exportRequest));
Guard.Against.Null(exportStatus, nameof(exportStatus));
Guard.Against.Null(fileStatuses, nameof(fileStatuses));

WorkflowInstanceId = exportRequest.WorkflowInstanceId;
ExportTaskId = exportRequest.ExportTaskId;
Message = string.Join(System.Environment.NewLine, exportRequest.ErrorMessages);
Status = exportStatus;
FileStatuses = fileStatuses;
}
}
}

0 comments on commit fcb0b80

Please sign in to comment.