Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support new Workflow Request event data structure #455

Merged
merged 5 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2022 MONAI Consortium
# Copyright 2022-2023 MONAI Consortium
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,7 @@
root = true

# Copyright File Header
file_header_template = SPDX-FileCopyrightText: © [year file created] - [last year file modified], MONAI Consortium\nSPDX-License-Identifier: Apache License 2.0
file_header_template = SPDX-FileCopyrightText: © [year file created] - [last year file modified], MONAI Consortium\nSPDX-License-Identifier: Apache License 2.0
dotnet_diagnostic.IDE0073.severity = error

# Default settings:
Expand Down Expand Up @@ -309,3 +309,7 @@ max_line_length = 88
[*.json]
indent_size = 2
insert_final_newline = ignore


# Spelling
spelling_error_severity = information
12 changes: 6 additions & 6 deletions doc/dependency_decisions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
:why: MIT (https://github.com/microsoft/vstest/raw/main/LICENSE)
:versions:
- 17.4.1
- 17.6.3
- 17.7.1
:when: 2022-08-16 23:05:48.342748414 Z
- - :approve
- Microsoft.Data.Sqlite.Core
Expand Down Expand Up @@ -682,7 +682,7 @@
:why: MIT (https://raw.githubusercontent.com/microsoft/vstest/main/LICENSE)
:versions:
- 17.4.1
- 17.6.3
- 17.7.1
:when: 2022-09-01 23:06:13.008314524 Z
- - :approve
- Microsoft.NETCore.Platforms
Expand Down Expand Up @@ -733,15 +733,15 @@
:why: MIT (https://github.com/microsoft/vstest/raw/v17.4.0/LICENSE)
:versions:
- 17.4.1
- 17.6.3
- 17.7.1
:when: 2022-08-16 23:06:16.175705981 Z
- - :approve
- Microsoft.TestPlatform.TestHost
- :who: mocsharp
:why: MIT (https://github.com/microsoft/vstest/raw/v17.4.0/LICENSE)
:versions:
- 17.4.1
- 17.6.3
- 17.7.1
:when: 2022-08-16 23:06:17.671459450 Z
- - :approve
- Microsoft.Toolkit.HighPerformance
Expand Down Expand Up @@ -783,14 +783,14 @@
- :who: neilsouth
:why: Apache-2.0 (https://github.com/Project-MONAI/monai-deploy-messaging/raw/main/LICENSE)
:versions:
- 0.1.25
- 1.0.0
:when: 2022-08-16 23:06:21.051573547 Z
- - :approve
- Monai.Deploy.Messaging.RabbitMQ
- :who: neilsouth
:why: Apache-2.0 (https://github.com/Project-MONAI/monai-deploy-messaging/raw/main/LICENSE)
:versions:
- 0.1.25
- 1.0.0
:when: 2022-08-16 23:06:21.511789690 Z
- - :approve
- Monai.Deploy.Storage
Expand Down
3 changes: 2 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
[GitHub Milestone 0.4.0](https://github.com/Project-MONAI/monai-deploy-informatics-gateway/milestone/5)

- gh-435 Fix CLI to read log dir path from NLog config file.
- New Virtual Application Entity support for DICOMWeb STOW-RS APIs to enable dynamic endpoints.
- gh-425 New Virtual Application Entity support for DICOMWeb STOW-RS APIs to enable dynamic endpoints.
- gh-421 Integrate updated Workflow Request data structure to support multiple sources.
- New data [plug-ins](./plug-ins/overview.md) feature to manipulate incoming outgoing data.


Expand Down
12 changes: 6 additions & 6 deletions docs/compliance/third-party-licenses.md
Original file line number Diff line number Diff line change
Expand Up @@ -7304,14 +7304,14 @@ Apache License


<details>
<summary>Monai.Deploy.Messaging 0.1.25</summary>
<summary>Monai.Deploy.Messaging 1.0.0</summary>

## Monai.Deploy.Messaging

- Version: 0.1.25
- Version: 1.0.0
- Authors: MONAI Consortium
- Project URL: https://github.com/Project-MONAI/monai-deploy-messaging
- Source: [NuGet](https://www.nuget.org/packages/Monai.Deploy.Messaging/0.1.25)
- Source: [NuGet](https://www.nuget.org/packages/Monai.Deploy.Messaging/1.0.0)
- License: [Apache-2.0](https://github.com/Project-MONAI/monai-deploy-messaging/raw/main/LICENSE)


Expand Down Expand Up @@ -7532,14 +7532,14 @@ By downloading this software, you agree to the license terms & all licenses list


<details>
<summary>Monai.Deploy.Messaging.RabbitMQ 0.1.25</summary>
<summary>Monai.Deploy.Messaging.RabbitMQ 1.0.0</summary>

## Monai.Deploy.Messaging.RabbitMQ

- Version: 0.1.25
- Version: 1.0.0
- Authors: MONAI Consortium
- Project URL: https://github.com/Project-MONAI/monai-deploy-messaging
- Source: [NuGet](https://www.nuget.org/packages/Monai.Deploy.Messaging.RabbitMQ/0.1.25)
- Source: [NuGet](https://www.nuget.org/packages/Monai.Deploy.Messaging.RabbitMQ/1.0.0)
- License: [Apache-2.0](https://github.com/Project-MONAI/monai-deploy-messaging/raw/main/LICENSE)


Expand Down
55 changes: 20 additions & 35 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,51 +27,36 @@ MIG uses standard protocols like DICOM and FHIR. It stores studies and resources
After inference completes, MIG receives notifications for exporting the results to the proper consumers, usually PACS or viewers for visualization, VNAs for storage, and EHRs (Electronic Healthcare Records).


## Services
A list of supported protocols and services are available on the [MONAI Deploy Informatics Gateway Services](./setup/services.md) page.

MIG contains the following standard protocols for communicating with medical devices:

* **DICOM SCP**: C-ECHO, C-STORE
* **DICOM SCU**: C-STORE
* **HL7 Server**: A HL7 MLLP listener.
* **ACR DSI API**: [The American College of Radiology’s Data Science Institute API](https://www.acrdsi.org/-/media/DSI/Files/ACR-DSI-Model-API.pdf)
* **DICOMweb client**: QIDO-RS, WADO-RS, STOW-RS
* **FHIR client**: GET
## Contributing
For guidance on making a contribution, see the [contributing guidelines](https://github.com/Project-MONAI/monai-deploy/blob/main/CONTRIBUTING.md).

> [!Note]
> The ACR DSI API uses the DICOMweb client and FHIR client.
## Community
To participate, please join the MONAI Deploy App SDK weekly meetings on the [calendar](https://calendar.google.com/calendar/u/0/[email protected]&ctz=America/New_York) and review the [meeting notes](https://docs.google.com/document/d/1nw7JX-1kVaHiK8wBteM96xAWE3dh5wRUeC691bGuFjk/edit?usp=sharing).

### DICOM SCP
Join the conversation on Twitter [@ProjectMONAI](https://twitter.com/ProjectMONAI) or join our [Slack channel](https://forms.gle/QTxJq3hFictp31UM9).

The *DICOM SCP Service* accepts standard DICOM C-ECHO and C-STORE commands, which receive DICOM instances for processing. In addition, the Informatics Gateway groups received DICOM instances by the study or series based on the configuration. Once DICOM instances are grouped, they are assembled into a payload for the [MONAI Deploy Workflow Manager](https://github.com/Project-MONAI/monai-deploy-workflow-manager) to consume.
Ask and answer questions over on [MONAI Deploy Informatics Gateway's GitHub Discussions tab](https://github.com/Project-MONAI/monai-deploy-informatics-gateway/discussions).

### DICOM SCU
## License

The *DICOM SCU Service* enables users to export application-generated DICOM results to external DICOM devices. It subscribes to the `md.export.request.monaiscu` events generated by the [MONAI Deploy Workflow Manager](https://github.com/Project-MONAI/monai-deploy-workflow-manager) and then exports the data to user-configured DICOM destination(s).
Copyright (c) MONAI Consortium. All rights reserved.
Licensed under the [Apache-2.0](https://github.com/Project-MONAI/monai-deploy-informatics-gateway/blob/develop/LICENSE) license.

> [!Note]
> DICOM instances are sent as-is; no codec conversion is done as part of the SCU process.
> See the [DICOM Interface SCU](./compliance/dicom.md#dimse-services-scu) section for more information.
This software uses the Microsoft .NET 6.0 library, and the use of this software is subject to the [Microsoft software license terms](https://dotnet.microsoft.com/en-us/dotnet_library_license.htm).

### DICOMWeb STOW-RS
By downloading this software, you agree to the license terms & all licenses listed on the [third-party licenses](./compliance/third-party-licenses.md) page.

The *DICOMWeb STOW-RS Service* allows users to trigger a new workflow request by uploading a DICOM dataset. The entire DICOM dataset is assembled into a payload for the [MONAI Deploy Workflow Manager](https://github.com/Project-MONAI/monai-deploy-workflow-manager) to consume.
It provides options to trigger a workflow with or without specifying a workflow ID/name. See the
[DICOMWeb STOW-RS](./api/rest/dicomweb-stow.md) section for more information.
## Links

### HL7 MLLP Server
- Website: <https://monai.io>
- API documentation: <https://docs.monai.io/projects/monai-deploy-informatics-gateway>
- Code: <https://github.com/Project-MONAI/monai-deploy-informatics-gateway>
- Project tracker: <https://github.com/Project-MONAI/monai-deploy-informatics-gateway/projects>
- Issue tracker: <https://github.com/Project-MONAI/monai-deploy-informatics-gateway/issues>
- Wiki: <https://github.com/Project-MONAI/monai-deploy-informatics-gateway/wiki>
- Test status: <https://github.com/Project-MONAI/monai-deploy-informatics-gateway/actions>

The *HL7 MLLP Server* accepts Health Level 7 messages via the MLLP (Minimal Lower Layer Protocol). The received messages are validated and assembled into a payload for the [MONAI Deploy Workflow Manager](https://github.com/Project-MONAI/monai-deploy-workflow-manager) to consume.

### ACR DSI API

The ACR DSI API allows users to trigger inference requests via RESTful calls, utilizing DICOMweb and FHIR to
retrieve data specified in the request. Upon data retrieval, the Informatics Gateway uploads the data to the
shared storage and generates an `md.workflow.request` event, which notifies the
[MONAI Deploy Workflow Manager](https://github.com/Project-MONAI/monai-deploy-workflow-manager) for processing.

### DICOMweb Export

A DICOMweb export agent can export any user-generated DICOM content to configured DICOM destinations. The agent
subscribes to the `md.export.request.monaidicomweb` events generated by the [MONAI Deploy Workflow Manager](https://github.com/Project-MONAI/monai-deploy-workflow-manager)
and then exports the data to user-configured DICOMweb destination(s).
113 changes: 113 additions & 0 deletions docs/setup/services.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<!--
~ Copyright 2021-2023 MONAI Consortium
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->


# MONAI Deploy Informatics Gateway Services

MONAI Deploy Informatics Gateway supports the following standard protocols for communicating with medical devices:

* **DICOM SCP**: C-ECHO, C-STORE
* **DICOM SCU**: C-STORE
* **HL7 Server**: A HL7 MLLP listener.
* **ACR DSI API**: [The American College of Radiology�s Data Science Institute API](https://www.acrdsi.org/-/media/DSI/Files/ACR-DSI-Model-API.pdf)
* **DICOMweb client**: QIDO-RS, WADO-RS, STOW-RS
* **FHIR Server**: POST
* **FHIR client**: GET

> [!Note]
> The ACR DSI API uses the DICOMweb client and FHIR client.

## DICOM SCP

The *DICOM SCP Service* accepts standard DICOM C-ECHO and C-STORE commands, which receive DICOM instances for processing. In addition, the Informatics Gateway groups received DICOM instances by the study or series based on the configuration. Once DICOM instances are grouped, they are assembled into a payload for the [MONAI Deploy Workflow Manager](https://github.com/Project-MONAI/monai-deploy-workflow-manager) to consume.

### Workflow Request

With a DICOM SCP triggered workflow request, the data trigger contains the following:

- `DataService`: `DataService.DIMSE`
- `Source`: `<calling AE Title>`
- `Destination`: `<called AE Title>`

## DICOM SCU

The *DICOM SCU Service* enables users to export application-generated DICOM results to external DICOM devices. It subscribes to the `md.export.request.monaiscu` events generated by the [MONAI Deploy Workflow Manager](https://github.com/Project-MONAI/monai-deploy-workflow-manager) and then exports the data to user-configured DICOM destination(s).

> [!Note]
> DICOM instances are sent as-is; no codec conversion is done as part of the SCU process.
> See the [DICOM Interface SCU](../compliance/dicom.md#dimse-services-scu) section for more information.

## DICOMWeb STOW-RS

The *DICOMWeb STOW-RS Service* allows users to trigger a new workflow request by uploading a DICOM dataset. The entire DICOM dataset is assembled into a payload for the [MONAI Deploy Workflow Manager](https://github.com/Project-MONAI/monai-deploy-workflow-manager) to consume.
It provides options to trigger a workflow with or without specifying a workflow ID/name. See the
[DICOMWeb STOW-RS](../api/rest/dicomweb-stow.md) section for more information.

### Workflow Request

With a DICOMWeb STOW-RS triggered workflow request, the data trigger contains the following:

- `DataService`: `DataService.DicomWeb`
- `Source`: `<caller's IP address>`
- `Destination`: `default` or `<name of Virtual AE Title>`

## HL7 MLLP Server

The *HL7 MLLP Server* accepts Health Level 7 messages via the MLLP (Minimal Lower Layer Protocol). The received messages are validated and assembled into a payload for the [MONAI Deploy Workflow Manager](https://github.com/Project-MONAI/monai-deploy-workflow-manager) to consume.

### Workflow Request

With an HL7 MLLP Server triggered workflow request, the data trigger contains the following:

- `DataService`: `DataService.HL7`
- `Source`: `<caller's IP address>`
- `Destination`: `<MIG's IP address>`

## ACR DSI API

The ACR DSI API allows users to trigger inference requests via RESTful calls, utilizing DICOMweb and FHIR to
retrieve data specified in the request. Upon data retrieval, the Informatics Gateway uploads the data to the
shared storage and generates an `md.workflow.request` event, which notifies the
[MONAI Deploy Workflow Manager](https://github.com/Project-MONAI/monai-deploy-workflow-manager) for processing.
See the [Inference API](../api/rest/inference.md) for more information.

### Workflow Request

With an ACR DSI API triggered workflow request, the data trigger contains the following:

- `DataService`: `DataService.ACR`
- `Source`: `<transaction ID from the ACR request>`
- `Destination`: `<MIG's IP address>`

## DICOMweb Export

A DICOMweb export agent can export any user-generated DICOM content to configured DICOM destinations. The agent
subscribes to the `md.export.request.monaidicomweb` events generated by the [MONAI Deploy Workflow Manager](https://github.com/Project-MONAI/monai-deploy-workflow-manager)
and then exports the data to user-configured DICOMweb destination(s).

## FHIR Server

The *FHIR Server* accepts FHIR resources as described in the [FHIR API](../api/rest/fhir.md) section. When data arrives at the service, each resource is packaged into a payload and a workflow request is
sent to the [MONAI Deploy Workflow Manager](https://github.com/Project-MONAI/monai-deploy-workflow-manager).


### Workflow Request

With an FHIR Server triggered workflow request, the data trigger contains the following:

- `DataService`: `DataService.FHIR`
- `Source`: `<caller's IP address>`
- `Destination`: `<MIG's IP address>`
1 change: 1 addition & 0 deletions docs/setup/toc.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
# [Setup](setup.md)
# [Configuration](schema.md)
# [CLI](cli.md)
# [Services](services.md)
4 changes: 2 additions & 2 deletions src/Api/Monai.Deploy.InformaticsGateway.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--
~ Copyright 2021-2022 MONAI Consortium
~ Copyright 2021-2023 MONAI Consortium
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -31,7 +31,7 @@
<PackageReference Include="fo-dicom" Version="5.1.1" />
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="6.0.21" />
<PackageReference Include="Monai.Deploy.Messaging" Version="0.1.25" />
<PackageReference Include="Monai.Deploy.Messaging" Version="1.0.0" />
<PackageReference Include="Monai.Deploy.Storage" Version="0.2.18" />
</ItemGroup>

Expand Down
24 changes: 7 additions & 17 deletions src/Api/Storage/DicomFileStorageMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using System;
using System.Text.Json.Serialization;
using Ardalis.GuardClauses;
using Monai.Deploy.Messaging.Events;

namespace Monai.Deploy.InformaticsGateway.Api.Storage
{
Expand All @@ -31,21 +32,6 @@ public sealed record DicomFileStorageMetadata : FileStorageMetadata
public static readonly string DicomContentType = "application/dicom";
public static readonly string DicomJsonContentType = System.Net.Mime.MediaTypeNames.Application.Json;

/// <summary>
/// The calling AE title of the DICOM instance.
/// For ACR, this is the Transaction ID of the original request.
/// Note: this value is same as <see cref="FileStorageMetadata.Source"/>
/// </summary>
[JsonIgnore]
public string CallingAeTitle { get => Source; }

/// <summary>
/// The MONAI AE Title that received the DICOM instance.
/// For ACR request, this field is empty.
/// </summary>
[JsonPropertyName("calledAeTitle")]
public string CalledAeTitle { get; set; } = default!;

/// <summary>
/// Gets or set the Study Instance UID of the DICOM instance.
/// </summary>
Expand Down Expand Up @@ -95,7 +81,7 @@ public sealed record DicomFileStorageMetadata : FileStorageMetadata
[JsonConstructor]
public DicomFileStorageMetadata() { }

public DicomFileStorageMetadata(string associationId, string identifier, string studyInstanceUid, string seriesInstanceUid, string sopInstanceUid)
public DicomFileStorageMetadata(string associationId, string identifier, string studyInstanceUid, string seriesInstanceUid, string sopInstanceUid, DataService dataService, string callingAeTitle, string calledAeTitle)
: base(associationId.ToString(), identifier)
{
Guard.Against.NullOrWhiteSpace(associationId, nameof(associationId));
Expand All @@ -120,6 +106,10 @@ public DicomFileStorageMetadata(string associationId, string identifier, string
UploadPath = $"{File.UploadPath}{DicomJsonFileExtension}",
ContentType = DicomJsonContentType,
};

DataOrigin.DataService = dataService;
DataOrigin.Source = callingAeTitle;
DataOrigin.Destination = calledAeTitle;
}

public override void SetFailed()
Expand All @@ -128,4 +118,4 @@ public override void SetFailed()
JsonFile.SetFailed();
}
}
}
}
Loading
Loading