From 26d0b3842849d1023f082b774aacee6bce1d78b8 Mon Sep 17 00:00:00 2001 From: Neil South Date: Thu, 12 Oct 2023 11:33:19 +0100 Subject: [PATCH 1/7] adding fields from workflow request Signed-off-by: Neil South --- src/Messaging/Common/Artifact.cs | 7 ++ .../Events/ArtifactsReceivedEvent.cs | 72 ++++++++++++++++--- 2 files changed, 69 insertions(+), 10 deletions(-) diff --git a/src/Messaging/Common/Artifact.cs b/src/Messaging/Common/Artifact.cs index 5da5d01..24a5b4f 100755 --- a/src/Messaging/Common/Artifact.cs +++ b/src/Messaging/Common/Artifact.cs @@ -18,7 +18,14 @@ namespace Monai.Deploy.Messaging.Common { public class Artifact { + /// + /// Type of the artifact + /// public ArtifactType Type { get; set; } = ArtifactType.Unset; + + /// + /// relative path from the bucket to the artifact + /// public string Path { get; set; } = string.Empty; } } diff --git a/src/Messaging/Events/ArtifactsReceivedEvent.cs b/src/Messaging/Events/ArtifactsReceivedEvent.cs index e7ac819..64bee0a 100755 --- a/src/Messaging/Events/ArtifactsReceivedEvent.cs +++ b/src/Messaging/Events/ArtifactsReceivedEvent.cs @@ -24,31 +24,83 @@ namespace Monai.Deploy.Messaging.Events public class ArtifactsReceivedEvent : EventBase { /// - /// Gets or sets the workflow instanceID generated by the Workflow Manager. + /// Gets or sets the ID of the payload which is also used as the root path of the payload. /// - [JsonProperty(PropertyName = "workflow_instance_id")] - [JsonPropertyName("workflow_instance_id")] + [JsonProperty(PropertyName = "payload_id")] + [JsonPropertyName("payload_id")] [Required] - public string WorkflowInstanceId { get; set; } = default!; + public Guid PayloadId { get; set; } /// - /// Gets or sets the export task ID generated by the Workflow Manager. + /// Gets or sets the associated workflows to be launched. /// - [JsonProperty(PropertyName = "task_id")] - [JsonPropertyName("task_id")] + [JsonProperty(PropertyName = "workflows")] + [JsonPropertyName("workflows")] + public IEnumerable Workflows { get; set; } = new List(); + + /// + /// Gets or sets number of files in the payload. + /// + [JsonProperty(PropertyName = "file_count")] + [JsonPropertyName("file_count")] [Required] - public string TaskId { get; set; } = default!; + public int FileCount { get; set; } /// - /// 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. + /// For an ACR inference request, the correlation ID is the Transaction ID in the original request. /// [JsonProperty(PropertyName = "correlation_id")] [JsonPropertyName("correlation_id")] [Required] public string CorrelationId { get; set; } = default!; + /// + /// Gets or set the name of the bucket where the files in are stored. + /// + [JsonProperty(PropertyName = "bucket")] + [JsonPropertyName("bucket")] + [Required] + public string Bucket { get; set; } = default!; + + /// + /// Gets or sets the service that received the original request. + /// + [JsonProperty(PropertyName = "trigger")] + [JsonPropertyName("trigger")] + public DataOrigin DataTrigger { get; set; } = default!; + + /// + /// Gets or sets the data origins that were involved in triggering this workflow request. + /// + [JsonProperty(PropertyName = "data_origins")] + [JsonPropertyName("data_origins")] + public List DataOrigins { get; private set; } = new List(); + + /// + /// Gets or sets the time the data was received. + /// + [JsonProperty(PropertyName = "timestamp")] + [JsonPropertyName("timestamp")] + [Required] + public DateTime Timestamp { get; set; } + + /// + /// Gets or sets the workflow instanceID generated by the Workflow Manager. + /// + [JsonProperty(PropertyName = "workflow_instance_id")] + [JsonPropertyName("workflow_instance_id")] + [Required] + public string? WorkflowInstanceId { get; set; } = default!; + + /// + /// Gets or sets the export task ID generated by the Workflow Manager. + /// + [JsonProperty(PropertyName = "task_id")] + [JsonPropertyName("task_id")] + [Required] + public string? TaskId { get; set; } = default!; + /// /// Gets or set the list of artifacts. /// From d27f30406ba5c33bd1e3baa16539cd74001aea12 Mon Sep 17 00:00:00 2001 From: Neil South Date: Thu, 12 Oct 2023 14:47:14 +0100 Subject: [PATCH 2/7] adding artifactType to dataOrigin Signed-off-by: Neil South --- src/Messaging/Events/WorkflowRequestEvent.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Messaging/Events/WorkflowRequestEvent.cs b/src/Messaging/Events/WorkflowRequestEvent.cs index 92402df..6f40a66 100755 --- a/src/Messaging/Events/WorkflowRequestEvent.cs +++ b/src/Messaging/Events/WorkflowRequestEvent.cs @@ -58,6 +58,8 @@ public class DataOrigin [JsonPropertyName("fromExternalApp")] public bool FromExternalApp { get; set; } = false; + public ArtifactType ArtifactType { get; set; } = ArtifactType.Unset; + public override int GetHashCode() { return HashCode.Combine(Source, Destination, DataService); From cde81578beb865cda2003348f45dade6872bfe76 Mon Sep 17 00:00:00 2001 From: Lillie Dae <61380713+lillie-dae@users.noreply.github.com> Date: Fri, 13 Oct 2023 09:55:54 +0100 Subject: [PATCH 3/7] added folder artifact type (#238) Signed-off-by: Lillie Dae --- src/Messaging/Common/ArtifactType.cs | 1 + src/Messaging/Common/ArtifactTypes.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Messaging/Common/ArtifactType.cs b/src/Messaging/Common/ArtifactType.cs index ca8069f..745e3a2 100644 --- a/src/Messaging/Common/ArtifactType.cs +++ b/src/Messaging/Common/ArtifactType.cs @@ -19,6 +19,7 @@ namespace Monai.Deploy.Messaging.Common public enum ArtifactType { Unset, //Unset + Folder, // Folder AR, //Autorefraction ASMT, //Content Assessment Results AU, //Audio diff --git a/src/Messaging/Common/ArtifactTypes.cs b/src/Messaging/Common/ArtifactTypes.cs index d708486..70ed844 100755 --- a/src/Messaging/Common/ArtifactTypes.cs +++ b/src/Messaging/Common/ArtifactTypes.cs @@ -21,6 +21,7 @@ public static class ArtifactTypes private static readonly Dictionary ListOfModularity = new() { { ArtifactType.Unset, "Unset" }, + { ArtifactType.Folder, "Folders" }, { ArtifactType.AR, "Autorefract" }, { ArtifactType.ASMT, "Content Assessment Results" }, { ArtifactType.AU, "Audio" }, From 4af2feacc13889cad0caa50b1efcb3f885d6b3bc Mon Sep 17 00:00:00 2001 From: Lillie Dae Date: Fri, 13 Oct 2023 10:47:54 +0100 Subject: [PATCH 4/7] make list of modalities public Signed-off-by: Lillie Dae --- src/Messaging/Common/ArtifactTypes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Messaging/Common/ArtifactTypes.cs b/src/Messaging/Common/ArtifactTypes.cs index 70ed844..bd1771b 100755 --- a/src/Messaging/Common/ArtifactTypes.cs +++ b/src/Messaging/Common/ArtifactTypes.cs @@ -18,7 +18,7 @@ namespace Monai.Deploy.Messaging.Common { public static class ArtifactTypes { - private static readonly Dictionary ListOfModularity = new() + public static readonly Dictionary ListOfModularity = new() { { ArtifactType.Unset, "Unset" }, { ArtifactType.Folder, "Folders" }, From 662e1d207f0dea08c7a44cf4b17d5d7e5b4f5a30 Mon Sep 17 00:00:00 2001 From: Neil South Date: Fri, 13 Oct 2023 15:45:15 +0100 Subject: [PATCH 5/7] removed unused fromExternalApp Signed-off-by: Neil South --- src/Messaging/Events/WorkflowRequestEvent.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Messaging/Events/WorkflowRequestEvent.cs b/src/Messaging/Events/WorkflowRequestEvent.cs index 6f40a66..3755c37 100755 --- a/src/Messaging/Events/WorkflowRequestEvent.cs +++ b/src/Messaging/Events/WorkflowRequestEvent.cs @@ -54,10 +54,6 @@ public class DataOrigin [JsonPropertyName("destination")] public string Destination { get; set; } = default!; - [JsonProperty(PropertyName = "fromExternalApp")] - [JsonPropertyName("fromExternalApp")] - public bool FromExternalApp { get; set; } = false; - public ArtifactType ArtifactType { get; set; } = ArtifactType.Unset; public override int GetHashCode() From e11de4ceb6407b02ed7b6738e21eaf97f8ae9ea9 Mon Sep 17 00:00:00 2001 From: Neil South Date: Fri, 13 Oct 2023 15:48:09 +0100 Subject: [PATCH 6/7] added missing attributes Signed-off-by: Neil South --- src/Messaging/Events/WorkflowRequestEvent.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Messaging/Events/WorkflowRequestEvent.cs b/src/Messaging/Events/WorkflowRequestEvent.cs index 3755c37..13040b7 100755 --- a/src/Messaging/Events/WorkflowRequestEvent.cs +++ b/src/Messaging/Events/WorkflowRequestEvent.cs @@ -54,6 +54,8 @@ public class DataOrigin [JsonPropertyName("destination")] public string Destination { get; set; } = default!; + [JsonProperty(PropertyName = "artifactType")] + [JsonPropertyName("artifactType")] public ArtifactType ArtifactType { get; set; } = ArtifactType.Unset; public override int GetHashCode() From adba9154f72b9ccac79dd4b7523bd6a3c493f020 Mon Sep 17 00:00:00 2001 From: Neil South Date: Fri, 13 Oct 2023 16:16:48 +0100 Subject: [PATCH 7/7] small typo Signed-off-by: Neil South --- .../RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs b/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs index 64d8767..18affed 100755 --- a/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs +++ b/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs @@ -188,7 +188,7 @@ private EventingBasicConsumer CreateConsumer(Func