Skip to content

Commit c44cded

Browse files
authored
Merge pull request #979 from Project-MONAI/AI-437
refactor to match ticked field name predicate
2 parents a818376 + 76cef11 commit c44cded

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

guidelines/mwm-workflow-spec.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ This is the top-level object in a workflow spec. It contains the following prope
120120
|description|Optional[str] (200)|
121121
|informatics_gateway|[InformaticsGateway](#informatics-gateway)|
122122
|tasks|list[[Task](#tasks)]|
123+
|dataRetentionDays|int|
124+
|predicate|string[]|
123125

124126
The following is an example of the structure of a workflow.
125127

@@ -134,8 +136,9 @@ The following is an example of the structure of a workflow.
134136
┗ tasks\
135137
    ┣ task1\
136138
    ┣ task2\
137-
    ┗ task3
138-
139+
    ┗ task3\
140+
┣ dataRetentionDays\
141+
┣ predicate [A detailed breakdown of predicate logic can be found here.](https://github.com/Project-MONAI/monai-deploy-workflow-manager/blob/develop/guidelines/mwm-conditionals.md)
139142

140143

141144
#### Examples
@@ -159,6 +162,8 @@ An example of a workflow with two tasks:
159162
"ORTHANC"
160163
]
161164
},
165+
"dataRetentionDays": -1,
166+
"predicate" : []
162167
"tasks": [
163168
{
164169
"id": "mean-pixel-calc",

src/WorkflowManager/Contracts/Models/Workflow.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public class Workflow
3939
[JsonProperty(PropertyName = "dataRetentionDays")]
4040
public int? DataRetentionDays { get; set; } = 3;// note. -1 = never delete
4141

42-
[JsonProperty(PropertyName = "conditions")]
43-
public string[] Conditions { get; set; } = [];
42+
[JsonProperty(PropertyName = "predicate")]
43+
public string[] Predicate { get; set; } = [];
4444

4545
}
4646
}

src/WorkflowManager/WorkflowExecuter/Services/WorkflowExecuterService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,9 +1120,9 @@ private async Task<bool> ClinicalReviewTimeOutEvent(WorkflowInstance workflowIns
11201120

11211121
// check if the conditionals allow the workflow to be created
11221122

1123-
if (workflow.Workflow.Conditions.Length != 0)
1123+
if (workflow.Workflow.Predicate.Length != 0)
11241124
{
1125-
var conditionalMet = _conditionalParameterParser.TryParse(workflow.Workflow.Conditions, workflowInstance, out var resolvedConditional);
1125+
var conditionalMet = _conditionalParameterParser.TryParse(workflow.Workflow.Predicate, workflowInstance, out var resolvedConditional);
11261126
if (conditionalMet is false)
11271127
{
11281128
return null;

tests/UnitTests/WorkflowExecuter.Tests/Services/WorkflowExecuterServiceTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3903,7 +3903,7 @@ public async Task ProcessPayload_With_Failing_Workflow_Conditional_Should_Not_Pr
39033903
Description = "taskdesc"
39043904
}
39053905
],
3906-
Conditions = ["{{ context.dicom.series.any('0010','0040') }} == 'lordge'"]
3906+
Predicate = ["{{ context.dicom.series.any('0010','0040') }} == 'lordge'"]
39073907
}
39083908
}
39093909
};
@@ -3956,7 +3956,7 @@ public async Task ProcessPayload_With_Passing_Workflow_Conditional_Should_Procce
39563956
Description = "taskdesc"
39573957
}
39583958
],
3959-
Conditions = ["{{ context.dicom.series.any('0010','0040') }} == 'lordge'"]
3959+
Predicate = ["{{ context.dicom.series.any('0010','0040') }} == 'lordge'"]
39603960
}
39613961
}
39623962
};

0 commit comments

Comments
 (0)