Skip to content

Commit 24ea606

Browse files
authored
Merge pull request #780 from Project-MONAI/release/0.1.11
Release/0.1.11
2 parents 8e2664b + ac8393e commit 24ea606

File tree

99 files changed

+2674
-1616
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+2674
-1616
lines changed

docs/api/rest/workflow-manager/payload.md

Lines changed: 170 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,197 @@
1616

1717
# Workflow Manager - Payload APIs
1818

19-
**TEMPLATE**
19+
## GET /payloads
2020

21-
## GET/POST/PUT/DELETE /payloads/
21+
Returns a paginated list of Payloads with additional computed property of payloadStatus.
2222

23-
*description*
23+
- If any of the workflow Instances status' attached to that payload are “Created” then the payloadStatus would be “In Progress”
24+
25+
- If all workflow Instances status' attached to that payload are not “Created” then the payloadStatus would be “Complete”
26+
27+
- If there are no workflow Instances attached to that payload then the payloadStatus would be “Complete”
2428

2529
### Parameters
2630

27-
*parameters*
31+
(Query) pageNumber: int
32+
33+
(Query) pageSize: int
34+
35+
(Query) maxPageSize: int (default of 10)
36+
37+
(Query) patientId: string
38+
39+
(Query) patientName: string
2840

2941
### Responses
3042

3143
Response Content Type: JSON
3244

33-
*response type*
34-
3545
| Code | Description |
3646
| ---- | --------------------------------------------------------------------------------------------------------------------------------------- |
37-
| 200 | Service is healthy. |
38-
| 503 | Service is unhealthy. |
47+
| 200 | List of payloads. |
3948
| 500 | Server error. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |
4049

4150
### Example Request
4251

4352
```bash
44-
curl --location --request GET 'http://localhost:5000/workflows'
53+
curl --location --request GET 'http://localhost:5000/payloads'
4554
```
4655

4756
### Example Response
4857

4958
```json
50-
*sample output*
59+
{
60+
"PageNumber": 1,
61+
"PageSize": 10,
62+
"FirstPage": "/payload?pageNumber=1&pageSize=10",
63+
"LastPage": "/payload?pageNumber=1&pageSize=10",
64+
"TotalPages": 1,
65+
"TotalRecords": 3,
66+
"NextPage": null,
67+
"PreviousPage": null,
68+
"Data":
69+
[
70+
{
71+
"Version": "1.0.0",
72+
"id": "3042cac6-b8b8-4f65-a2b2-8ec340652c9b",
73+
"payload_id": "c5c3636b-81dd-44a9-8c4b-71adec7d47b2",
74+
"workflows": ["1e7b49f2-a3a2-4ded-b489-86ad9b2da9c8"],
75+
"workflow_instance_ids": [],
76+
"file_count": 50,
77+
"correlation_id": "68ccea88-1f40-4eb3-ad23-7f444ac12910",
78+
"bucket": "bucket_1",
79+
"calling_aetitle": "Basic_AE",
80+
"called_aetitle": "MIG",
81+
"timestamp": "2023-05-03T12:47:59.046Z",
82+
"files": [],
83+
"patient_details":
84+
{
85+
"patient_id": "732ca351-6267-41e9-a6e8-21b3a74abe7c",
86+
"patient_name": "Steve Jobs",
87+
"patient_sex": "male",
88+
"patient_dob": "1996-02-05T00:00:00Z",
89+
"patient_age": null,
90+
"patient_hospital_id": null
91+
},
92+
"payload_status": "Completed",
93+
"payload_deleted": 1
94+
},
95+
{
96+
"Version": "1.0.0",
97+
"id": "2435a8d7-84f4-407d-9d0e-941bb87b0190",
98+
"payload_id": "86c0f117-4021-412e-b163-0dc621df672a",
99+
"workflows": ["3d517d26-118c-4241-beb8-6b51d462c746"],
100+
"workflow_instance_ids": [],
101+
"file_count": 3,
102+
"correlation_id": "1ef12067-0fda-45c6-87b4-bcc4b245e8d9",
103+
"bucket": "bucket_1",
104+
"calling_aetitle": "Basic_AE",
105+
"called_aetitle": "MIG",
106+
"timestamp": "2023-05-03T12:47:59.046Z",
107+
"files": [],
108+
"patient_details":
109+
{
110+
"patient_id": "dae4a6d1-573d-4a3f-978f-ed056f628de6",
111+
"patient_name": "Jane Doe",
112+
"patient_sex": "female",
113+
"patient_dob": null,
114+
"patient_age": null,
115+
"patient_hospital_id": null
116+
},
117+
"payload_status": "Completed",
118+
"payload_deleted": 1
119+
},
120+
{
121+
"Version": "1.0.0",
122+
"id": "39d599bc-6635-4f94-9b55-b72a5b11c849",
123+
"payload_id": "30a8e0c6-e6c4-458f-aa4d-b224b493d3c0",
124+
"workflows": ["db52fafe-1035-436a-b4ff-50ab850f5f68"],
125+
"workflow_instance_ids": [],
126+
"file_count": 3,
127+
"correlation_id": "40544d26-b4bb-4f67-b4ae-68ff3a237cf2",
128+
"bucket": "bucket_2",
129+
"calling_aetitle": "Basic_AE",
130+
"called_aetitle": "MIG",
131+
"timestamp": "2023-05-03T12:47:59.046Z",
132+
"files": [],
133+
"patient_details":
134+
{
135+
"patient_id": null,
136+
"patient_name": null,
137+
"patient_sex": null,
138+
"patient_dob": null,
139+
"patient_age": null,
140+
"patient_hospital_id": null
141+
},
142+
"payload_status": "Completed",
143+
"payload_deleted": 1
144+
}
145+
],
146+
"Succeeded": true,
147+
"Errors": null,
148+
"Message": null
149+
}
51150
```
52151

152+
---
153+
154+
## GET /payloads/{id}
155+
156+
Returns specific payload for given id.
157+
158+
### Parameters
159+
(Route) id: string - UUID
160+
161+
### Responses
162+
163+
Response Content Type: JSON
164+
165+
| Code | Description |
166+
| ---- | --------------------------------------------------------------------------------------------------------------------------------------- |
167+
| 200 | List of payloads. |
168+
| 400 | [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) Failed to validate id. |
169+
| 404 | [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) Failed to find payload with payload id. |
170+
| 500 | Server error. The response will be a [Problem details](https://datatracker.ietf.org/doc/html/rfc7807) object with server error details. |
171+
172+
173+
### Example Request
174+
175+
```bash
176+
curl --location --request GET 'http://localhost:5000/payloads/3042cac6-b8b8-4f65-a2b2-8ec340652c9b'
177+
```
178+
179+
### Example Response
180+
```json
181+
{
182+
"Version": "1.0.0",
183+
"id": "3042cac6-b8b8-4f65-a2b2-8ec340652c9b",
184+
"payload_id": "c5c3636b-81dd-44a9-8c4b-71adec7d47b2",
185+
"workflows": ["1e7b49f2-a3a2-4ded-b489-86ad9b2da9c8"],
186+
"workflow_instance_ids": [],
187+
"file_count": 50,
188+
"correlation_id": "68ccea88-1f40-4eb3-ad23-7f444ac12910",
189+
"bucket": "bucket_1",
190+
"calling_aetitle": "Basic_AE",
191+
"called_aetitle": "MIG",
192+
"timestamp": "2023-05-03T12:47:59.046Z",
193+
"files": [],
194+
"patient_details":
195+
{
196+
"patient_id": "732ca351-6267-41e9-a6e8-21b3a74abe7c",
197+
"patient_name": "Steve Jobs",
198+
"patient_sex": "male",
199+
"patient_dob": "1996-02-05T00:00:00Z",
200+
"patient_age": null,
201+
"patient_hospital_id": null
202+
},
203+
}
204+
```
205+
206+
---
207+
208+
## DELETE /payloads/{id}
209+
210+
TODO
211+
212+
---

docs/setup/mwm-workflow-spec.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ Workflows can be created or updated via the [Workflow API](https://github.com/Pr
4848
- [Plugin](#plugin)
4949
- [Task Arguments](#task-arguments)
5050
- [Argo](#argo)
51-
- [Resource Request Object](#resource-request-object)
5251
- [Clinical Review](#clinical-review)
5352
- [Router](#router-1)
5453
- [Export](#export-1)
@@ -69,6 +68,7 @@ Workflows can be created or updated via the [Workflow API](https://github.com/Pr
6968
- [Execution Context](#execution-context)
7069
- [Result Metadata \& Execution Stats - Using Dictionary Values](#result-metadata--execution-stats---using-dictionary-values)
7170
- [Argo Metadata](#argo-metadata)
71+
- [Handled Exception Metadata](#handled-exception-metadata)
7272
- [DICOM Tags](#dicom-tags)
7373
- [Patient Details Context](#patient-details-context)
7474
- [Workflow Context](#workflow-context)
@@ -711,7 +711,7 @@ Conditional evaluators are logical statement strings that may be used to determi
711711

712712
NOT_CONTAINS (Valid for integers and strings compared to lists)
713713

714-
more information on conditionals can be found [Conditionals Docs](guidelines\mwm-conditionals.md)
714+
more information on conditionals can be found [Conditionals Docs](..\..\guidelines\mwm-conditionals.md)
715715

716716
### Context
717717
The workflow metadata is any data that can be used by Evaluators. This includes metadata added by previous tasks, but can also include metadata about the input files (most notably DICOM tags).
@@ -799,6 +799,33 @@ An example format of the metadata.json can be found below:
799799

800800
execution stats are populated from the argo execution values returned automatically.
801801

802+
#### Handled Exception Metadata
803+
Application models can throw handled exceptions, to do this your application model should output the properties "exception" and "exception_message" to the `metadata.json`
804+
805+
Example...
806+
```json
807+
{
808+
"exception": "NoDicomFilesException",
809+
"exception_message": "No dicom files found."
810+
}
811+
```
812+
813+
We recommend your application exits execution once the metadata.json has been written.
814+
815+
This exception can be used in the workflow task destinations queries for example like the following examples...
816+
817+
```python
818+
{{ context.executions.task_id.result.exception }} == 'NoDicomFilesException' && {{ context.executions.task_id.result.exception_message }} == 'No dicom files found.'
819+
```
820+
821+
```python
822+
{{ context.executions.task_id.result.exception_message }} CONTAINS 'No dicom files'
823+
```
824+
825+
```python
826+
{{ context.executions.task_id.result.exception }} == NULL
827+
```
828+
802829

803830
#### DICOM Tags
804831
When the input data is DICOM, Evaluators can use DICOM tag values in conditional statements.

src/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818

1919
[assembly: AssemblyFileVersion("0.0.0.0")]
2020
[assembly: AssemblyVersion("0.0.0.0")]
21-
[assembly: AssemblyInformationalVersion("0.0.0-development")]
21+
[assembly: AssemblyInformationalVersion("0.0.0-development")]

src/Monai.Deploy.WorkflowManager.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Monai.Deploy.WorkflowManage
8282
EndProject
8383
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Monai.Deploy.WorkflowManager.Common.Tests", "..\tests\UnitTests\Common.Tests\Monai.Deploy.WorkflowManager.Common.Tests.csproj", "{75A4AEDA-0386-4B2D-9DBA-BC9AE733660E}"
8484
EndProject
85+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Monai.Deploy.WorkflowManager.Services", "WorkflowManager\Monai.Deploy.WorkflowManager.Services\Monai.Deploy.WorkflowManager.Services.csproj", "{526FF10C-1C7F-4C26-8E8A-D7ACD65F5467}"
86+
EndProject
87+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Monai.Deploy.WorkflowManager.Services.Tests", "..\tests\UnitTests\WorkflowManager.Services.Tests\Monai.Deploy.WorkflowManager.Services.Tests.csproj", "{0D40F7D6-3747-4280-8EB3-9F3A18AC1125}"
88+
EndProject
8589
Global
8690
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8791
Debug|Any CPU = Debug|Any CPU
@@ -228,6 +232,14 @@ Global
228232
{75A4AEDA-0386-4B2D-9DBA-BC9AE733660E}.Debug|Any CPU.Build.0 = Debug|Any CPU
229233
{75A4AEDA-0386-4B2D-9DBA-BC9AE733660E}.Release|Any CPU.ActiveCfg = Release|Any CPU
230234
{75A4AEDA-0386-4B2D-9DBA-BC9AE733660E}.Release|Any CPU.Build.0 = Release|Any CPU
235+
{526FF10C-1C7F-4C26-8E8A-D7ACD65F5467}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
236+
{526FF10C-1C7F-4C26-8E8A-D7ACD65F5467}.Debug|Any CPU.Build.0 = Debug|Any CPU
237+
{526FF10C-1C7F-4C26-8E8A-D7ACD65F5467}.Release|Any CPU.ActiveCfg = Release|Any CPU
238+
{526FF10C-1C7F-4C26-8E8A-D7ACD65F5467}.Release|Any CPU.Build.0 = Release|Any CPU
239+
{0D40F7D6-3747-4280-8EB3-9F3A18AC1125}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
240+
{0D40F7D6-3747-4280-8EB3-9F3A18AC1125}.Debug|Any CPU.Build.0 = Debug|Any CPU
241+
{0D40F7D6-3747-4280-8EB3-9F3A18AC1125}.Release|Any CPU.ActiveCfg = Release|Any CPU
242+
{0D40F7D6-3747-4280-8EB3-9F3A18AC1125}.Release|Any CPU.Build.0 = Release|Any CPU
231243
EndGlobalSection
232244
GlobalSection(SolutionProperties) = preSolution
233245
HideSolutionNode = FALSE
@@ -269,6 +281,8 @@ Global
269281
{81E3F943-B992-4C81-AA09-A17C05081236} = {37A19144-CEA5-47A2-9FFD-22C522E8B895}
270282
{C853A9E3-C53D-4B1A-BFDA-228689A8C94C} = {71DDEE7B-E213-4E39-A7F4-4646783A27F7}
271283
{75A4AEDA-0386-4B2D-9DBA-BC9AE733660E} = {71DDEE7B-E213-4E39-A7F4-4646783A27F7}
284+
{526FF10C-1C7F-4C26-8E8A-D7ACD65F5467} = {AC5B198A-C3F2-4AD2-B532-E71B4630BDD5}
285+
{0D40F7D6-3747-4280-8EB3-9F3A18AC1125} = {71DDEE7B-E213-4E39-A7F4-4646783A27F7}
272286
EndGlobalSection
273287
GlobalSection(ExtensibilityGlobals) = postSolution
274288
SolutionGuid = {DC0D56C8-D8CB-45CE-B528-F3DCF86D63ED}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright 2022 MONAI Consortium
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
using Microsoft.Extensions.Configuration;
18+
19+
namespace Monai.Deploy.WorkflowManager.Configuration
20+
{
21+
public class InformaticsGatewayConfiguration
22+
{
23+
[ConfigurationKeyName("apiHost")]
24+
public string ApiHost { get; set; }
25+
}
26+
}

src/Shared/Shared/ApiControllerBase.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
using Monai.Deploy.WorkflowManager.Shared.Filter;
2323
using Monai.Deploy.WorkflowManager.Shared.Wrappers;
2424
using Monai.Deploy.WorkflowManager.Shared.Services;
25-
using Microsoft.AspNetCore.Routing;
2625

2726
namespace Monai.Deploy.WorkflowManager.ControllersShared
2827
{
@@ -85,7 +84,7 @@ public PagedResponse<IEnumerable<T>> CreatePagedReponse<T>(IEnumerable<T> pagedD
8584

8685
public StatsPagedResponse<IEnumerable<T>> CreateStatsPagedReponse<T>(IEnumerable<T> pagedData, PaginationFilter validFilter, long totalRecords, IUriService uriService, string route)
8786
{
88-
var response = new StatsPagedResponse<IEnumerable<T>>(pagedData, validFilter.PageNumber, validFilter.PageSize.Value);
87+
var response = new StatsPagedResponse<IEnumerable<T>>(pagedData, validFilter.PageNumber, validFilter.PageSize ?? 10);
8988
response.SetUp(validFilter, totalRecords, uriService, route);
9089
return response;
9190
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2023 MONAI Consortium
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
namespace Monai.Deploy.WorkflowManager.Shared.Filter
18+
{
19+
public class TimeFilter : PaginationFilter
20+
{
21+
public DateTime StartTime { get; set; }
22+
23+
public DateTime EndTime { get; set; }
24+
}
25+
}

src/Shared/Shared/MonaiServiceLocator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public Dictionary<string, ServiceStatus> GetServiceStatus()
4141
return _runningServices.ToDictionary(k => k.ServiceName, v => v.Status);
4242
}
4343

44-
private IMonaiService GetService(Type type)
44+
private IMonaiService? GetService(Type type)
4545
{
4646
Guard.Against.Null(type, nameof(type));
4747

@@ -58,7 +58,7 @@ private static List<Type> LocateTypes()
5858
serviceType.IsAssignableFrom(p) &&
5959
p != serviceType &&
6060
!p.IsAbstract &&
61-
p.FullName.StartsWith("Monai", StringComparison.InvariantCulture));
61+
p.FullName is not null && p.FullName.StartsWith("Monai", StringComparison.InvariantCulture));
6262
return services.Distinct().ToList();
6363
}
6464

File renamed without changes.

0 commit comments

Comments
 (0)