From 54b047d0c94d093dd5037da5c3474b23c17b901f Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Mon, 21 Aug 2023 16:00:10 -0700 Subject: [PATCH] gh-127 New data trigger and data origins to support multiple data sources/modalities Signed-off-by: Victor Chang --- src/Messaging/Events/WorkflowRequestEvent.cs | 66 ++++++++++++++++--- .../Tests/WorkflowRequestMessageTest.cs | 36 +++++++++- 2 files changed, 91 insertions(+), 11 deletions(-) diff --git a/src/Messaging/Events/WorkflowRequestEvent.cs b/src/Messaging/Events/WorkflowRequestEvent.cs index 1f0be31..3438f69 100755 --- a/src/Messaging/Events/WorkflowRequestEvent.cs +++ b/src/Messaging/Events/WorkflowRequestEvent.cs @@ -20,6 +20,56 @@ namespace Monai.Deploy.Messaging.Events { + public class DataOrigin + { + [JsonProperty(PropertyName = "type")] + public DataType DataType { get; set; } + + /// + /// Gets or sets the source of the data: + /// + /// DIMSE: the sender or calling AE Title of the DICOM dataset. + /// ACR inference request: the transaction ID. + /// FHIR/HL7: host name or IP address. + /// DICOMWeb: host name or IP address. + /// + /// + [JsonProperty(PropertyName = "source")] + [Required] + public string Source { get; set; } = default!; + + /// + /// Gets or set the receiving service. + /// + /// DIMSE: the MONAI Deploy AE Title that received the DICOM dataset. + /// ACR inference request: IP address of the receiving service. + /// FHIR/HL7: IP address of the receiving service. + /// DICOMWeb: IP address of the receiving service or the named virtual AE Title. + /// + /// + [JsonProperty(PropertyName = "destination")] + public string Destination { get; set; } = default!; + } + public enum DataType + { + /// + /// Data received via DIMSE services + /// + DIMSE, + /// + /// Data received via DICOMWeb services + /// + DICOMWEB, + /// + /// Data received via FHIR services + /// + FHIR, + /// + /// Data received via HL7 services + /// + HL7, + } + public class WorkflowRequestEvent : EventBase { private readonly List _payload; @@ -60,19 +110,16 @@ public class WorkflowRequestEvent : EventBase public string Bucket { get; set; } = default!; /// - /// For DIMSE, the sender or calling AE Title of the DICOM dataset. - /// For an ACR inference request, the transaction ID. + /// Gets or sets the service that received the original request. /// - [JsonProperty(PropertyName = "calling_aetitle")] - [Required] - public string CallingAeTitle { get; set; } = default!; + [JsonProperty(PropertyName = "trigger")] + public DataOrigin DataTrigger { get; set; } = default!; /// - /// For DIMSE, the MONAI Deploy AE Title received the DICOM dataset. - /// For an ACR inference request, this field is empty. + /// Gets or sets the data origins that were involved in triggering this workflow request. /// - [JsonProperty(PropertyName = "called_aetitle")] - public string CalledAeTitle { get; set; } = default!; + [JsonProperty(PropertyName = "data_origins")] + public List DataOrigins { get; private set; } /// /// Gets or sets the time the data was received. @@ -108,6 +155,7 @@ public WorkflowRequestEvent() { _payload = new List(); Workflows = new List(); + DataOrigins = new List(); } public void AddFiles(IEnumerable files) diff --git a/src/Messaging/Tests/WorkflowRequestMessageTest.cs b/src/Messaging/Tests/WorkflowRequestMessageTest.cs index dcec857..517d478 100644 --- a/src/Messaging/Tests/WorkflowRequestMessageTest.cs +++ b/src/Messaging/Tests/WorkflowRequestMessageTest.cs @@ -30,8 +30,12 @@ public void ConvertsJsonMessageToMessage() var input = new WorkflowRequestEvent() { Bucket = Guid.NewGuid().ToString(), - CalledAeTitle = Guid.NewGuid().ToString(), - CallingAeTitle = Guid.NewGuid().ToString(), + DataTrigger = new DataOrigin + { + DataType = DataType.DIMSE, + Source = Guid.NewGuid().ToString(), + Destination = Guid.NewGuid().ToString(), + }, CorrelationId = Guid.NewGuid().ToString(), FileCount = 10, PayloadId = Guid.NewGuid(), @@ -40,6 +44,34 @@ public void ConvertsJsonMessageToMessage() WorkflowInstanceId = Guid.NewGuid().ToString(), TaskId = Guid.NewGuid().ToString(), }; + input.DataOrigins.Add(new DataOrigin + { + DataType = DataType.DICOMWEB, + Source = Guid.NewGuid().ToString(), + Destination = Guid.NewGuid().ToString(), + + }); + input.DataOrigins.Add(new DataOrigin + { + DataType = DataType.FHIR, + Source = Guid.NewGuid().ToString(), + Destination = Guid.NewGuid().ToString(), + + }); + input.DataOrigins.Add(new DataOrigin + { + DataType = DataType.DIMSE, + Source = Guid.NewGuid().ToString(), + Destination = Guid.NewGuid().ToString(), + + }); + input.DataOrigins.Add(new DataOrigin + { + DataType = DataType.HL7, + Source = Guid.NewGuid().ToString(), + Destination = Guid.NewGuid().ToString(), + + }); var files = new List() {