Skip to content

Commit

Permalink
Merge pull request #979 from Project-MONAI/AI-437
Browse files Browse the repository at this point in the history
refactor to match ticked field name predicate
  • Loading branch information
neildsouth authored Apr 16, 2024
2 parents a818376 + 76cef11 commit c44cded
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
9 changes: 7 additions & 2 deletions guidelines/mwm-workflow-spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ This is the top-level object in a workflow spec. It contains the following prope
|description|Optional[str] (200)|
|informatics_gateway|[InformaticsGateway](#informatics-gateway)|
|tasks|list[[Task](#tasks)]|
|dataRetentionDays|int|
|predicate|string[]|

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

Expand All @@ -134,8 +136,9 @@ The following is an example of the structure of a workflow.
┗ tasks\
    ┣ task1\
    ┣ task2\
    ┗ task3

    ┗ task3\
┣ dataRetentionDays\
┣ 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)


#### Examples
Expand All @@ -159,6 +162,8 @@ An example of a workflow with two tasks:
"ORTHANC"
]
},
"dataRetentionDays": -1,
"predicate" : []
"tasks": [
{
"id": "mean-pixel-calc",
Expand Down
4 changes: 2 additions & 2 deletions src/WorkflowManager/Contracts/Models/Workflow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public class Workflow
[JsonProperty(PropertyName = "dataRetentionDays")]
public int? DataRetentionDays { get; set; } = 3;// note. -1 = never delete

[JsonProperty(PropertyName = "conditions")]
public string[] Conditions { get; set; } = [];
[JsonProperty(PropertyName = "predicate")]
public string[] Predicate { get; set; } = [];

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1120,9 +1120,9 @@ private async Task<bool> ClinicalReviewTimeOutEvent(WorkflowInstance workflowIns

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

if (workflow.Workflow.Conditions.Length != 0)
if (workflow.Workflow.Predicate.Length != 0)
{
var conditionalMet = _conditionalParameterParser.TryParse(workflow.Workflow.Conditions, workflowInstance, out var resolvedConditional);
var conditionalMet = _conditionalParameterParser.TryParse(workflow.Workflow.Predicate, workflowInstance, out var resolvedConditional);
if (conditionalMet is false)
{
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3903,7 +3903,7 @@ public async Task ProcessPayload_With_Failing_Workflow_Conditional_Should_Not_Pr
Description = "taskdesc"
}
],
Conditions = ["{{ context.dicom.series.any('0010','0040') }} == 'lordge'"]
Predicate = ["{{ context.dicom.series.any('0010','0040') }} == 'lordge'"]
}
}
};
Expand Down Expand Up @@ -3956,7 +3956,7 @@ public async Task ProcessPayload_With_Passing_Workflow_Conditional_Should_Procce
Description = "taskdesc"
}
],
Conditions = ["{{ context.dicom.series.any('0010','0040') }} == 'lordge'"]
Predicate = ["{{ context.dicom.series.any('0010','0040') }} == 'lordge'"]
}
}
};
Expand Down

0 comments on commit c44cded

Please sign in to comment.