Skip to content

Commit

Permalink
Merge pull request #237 from Project-MONAI/AI-230
Browse files Browse the repository at this point in the history
adding fields from workflow request
  • Loading branch information
neildsouth authored Oct 13, 2023
2 parents cde8157 + e11de4c commit 76d725e
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 13 deletions.
7 changes: 7 additions & 0 deletions src/Messaging/Common/Artifact.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ namespace Monai.Deploy.Messaging.Common
{
public class Artifact
{
/// <summary>
/// Type of the artifact
/// </summary>
public ArtifactType Type { get; set; } = ArtifactType.Unset;

/// <summary>
/// relative path from the bucket to the artifact
/// </summary>
public string Path { get; set; } = string.Empty;
}
}
72 changes: 62 additions & 10 deletions src/Messaging/Events/ArtifactsReceivedEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,31 +24,83 @@ namespace Monai.Deploy.Messaging.Events
public class ArtifactsReceivedEvent : EventBase
{
/// <summary>
/// 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.
/// </summary>
[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; }

/// <summary>
/// Gets or sets the export task ID generated by the Workflow Manager.
/// Gets or sets the associated workflows to be launched.
/// </summary>
[JsonProperty(PropertyName = "task_id")]
[JsonPropertyName("task_id")]
[JsonProperty(PropertyName = "workflows")]
[JsonPropertyName("workflows")]
public IEnumerable<string> Workflows { get; set; } = new List<string>();

/// <summary>
/// Gets or sets number of files in the payload.
/// </summary>
[JsonProperty(PropertyName = "file_count")]
[JsonPropertyName("file_count")]
[Required]
public string TaskId { get; set; } = default!;
public int FileCount { get; set; }

/// <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.
/// For an ACR inference request, the correlation ID is 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 set the name of the bucket where the files in are stored.
/// </summary>
[JsonProperty(PropertyName = "bucket")]
[JsonPropertyName("bucket")]
[Required]
public string Bucket { get; set; } = default!;

/// <summary>
/// Gets or sets the service that received the original request.
/// </summary>
[JsonProperty(PropertyName = "trigger")]
[JsonPropertyName("trigger")]
public DataOrigin DataTrigger { get; set; } = default!;

/// <summary>
/// Gets or sets the data origins that were involved in triggering this workflow request.
/// </summary>
[JsonProperty(PropertyName = "data_origins")]
[JsonPropertyName("data_origins")]
public List<DataOrigin> DataOrigins { get; private set; } = new List<DataOrigin>();

/// <summary>
/// Gets or sets the time the data was received.
/// </summary>
[JsonProperty(PropertyName = "timestamp")]
[JsonPropertyName("timestamp")]
[Required]
public DateTime Timestamp { get; set; }

/// <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 = "task_id")]
[JsonPropertyName("task_id")]
[Required]
public string? TaskId { get; set; } = default!;

/// <summary>
/// Gets or set the list of artifacts.
/// </summary>
Expand Down
6 changes: 3 additions & 3 deletions src/Messaging/Events/WorkflowRequestEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public class DataOrigin
[JsonPropertyName("destination")]
public string Destination { get; set; } = default!;

[JsonProperty(PropertyName = "fromExternalApp")]
[JsonPropertyName("fromExternalApp")]
public bool FromExternalApp { get; set; } = false;
[JsonProperty(PropertyName = "artifactType")]
[JsonPropertyName("artifactType")]
public ArtifactType ArtifactType { get; set; } = ArtifactType.Unset;

public override int GetHashCode()
{
Expand Down

0 comments on commit 76d725e

Please sign in to comment.