├── demos └── app_runner │ ├── requirements.txt │ ├── demo-apprunner.png │ └── config.json ├── tests └── Integration.Test │ ├── data │ ├── hl7 │ │ ├── 2.3.1 │ │ │ ├── 001.txt │ │ │ └── 002.txt │ │ ├── 2.6 │ │ │ └── 001.txt │ │ ├── 2.3 │ │ │ ├── 004.txt │ │ │ ├── 005.txt │ │ │ ├── 006.txt │ │ │ └── 003.txt │ │ ├── 2.8 │ │ │ └── 001.txt │ │ ├── 2.5.1 │ │ │ ├── 005.txt │ │ │ └── 002.txt │ │ └── 2.4 │ │ │ └── 001.txt │ └── fhir │ │ ├── copyright │ │ ├── 4.0.1 R4 │ │ ├── OperationOutcome.xml │ │ └── OperationOutcome.json │ │ ├── 3.0.2 STU3 │ │ └── Bundle.json │ │ └── 1.0.2 DSTU2 │ │ └── Patient.xml │ ├── appsettings.ef.json │ ├── appsettings.ext.json │ ├── appsettings.mongodb.json │ ├── Features │ ├── .gitignore │ ├── ExternalApp.feature │ ├── HL7Export.feature │ └── Fhir.feature │ ├── .gitignore │ ├── TestConfig.cs │ ├── ImplicitUsings.cs │ ├── .editorconfig │ ├── Drivers │ └── IDatabaseDataProvider.cs │ ├── Common │ ├── IDataClient.cs │ ├── Hl7Messages.cs │ └── FhirMessages.cs │ ├── study.json │ └── study.json.dev ├── global.json ├── docs ├── images │ └── favicon.ico ├── api │ ├── toc.yml │ └── rest │ │ └── toc.yml ├── plug-ins │ └── toc.yml ├── compliance │ └── toc.md ├── setup │ └── toc.md ├── toc.yml └── filterConfig.yml ├── guidelines └── diagrams │ ├── mig.png │ ├── mig-acr.png │ ├── mig-scp.png │ ├── storage.png │ ├── mig-export.png │ └── message-broker.png ├── src ├── .sonarlint │ ├── sonar.settings.json │ └── Monai.Deploy.InformaticsGateway.slconfig ├── Database │ ├── EntityFramework │ │ ├── appsettings.json │ │ ├── Migrations │ │ │ ├── 20221010184458_R3_0.3.2.cs │ │ │ ├── 20230131233123_R3_0.3.8.cs │ │ │ ├── 20230907182457_R4_0.4.1.cs │ │ │ ├── 20231207154732_Hl7Plugins.cs │ │ │ ├── 20230327190827_R3_0.3.15.cs │ │ │ └── 20220211175051_R1_Patch.cs │ │ └── Test │ │ │ └── Usings.cs │ ├── Api │ │ ├── Test │ │ │ └── Usings.cs │ │ ├── DatabaseTypes.cs │ │ ├── SR.cs │ │ ├── DatabaseException.cs │ │ ├── DatabaseRegistrationBase.cs │ │ ├── IDatabaseMigrationManager.cs │ │ └── Repositories │ │ │ └── IExternalAppDeatilsRepository.cs │ └── MongoDB │ │ ├── Integration.Test │ │ └── Usings.cs │ │ └── Configurations │ │ ├── ExternalAppDetailsConfiguration.cs │ │ ├── SourceApplicationEntityConfiguration.cs │ │ ├── VirtualApplicationEntityConfiguration.cs │ │ ├── DicomAssociationInfoConfiguration.cs │ │ ├── HL7DestinationEntityConfiguration.cs │ │ ├── MonaiApplicationEntityConfiguration.cs │ │ ├── StorageMetadataWrapperEntityConfiguration.cs │ │ ├── DestinationApplicationEntityConfiguration.cs │ │ ├── MongoDBEntityBaseConfiguration.cs │ │ └── InferenceRequestConfiguration.cs ├── Plug-ins │ └── RemoteAppExecution │ │ ├── appsettings.json │ │ ├── InternalVisibleTo.cs │ │ ├── SR.cs │ │ └── Database │ │ ├── MongoDb │ │ ├── MigrationManager.cs │ │ └── RemoteAppExecutionConfiguration.cs │ │ └── IRemoteAppExecutionRepository.cs ├── InformaticsGateway │ ├── Test │ │ ├── xunit.runner.json │ │ ├── .editorconfig │ │ ├── ProgramTest.cs │ │ ├── Plug-ins │ │ │ └── Monai.Deploy.InformaticsGateway.Test.PlugIns.csproj │ │ └── Common │ │ │ └── StudySerieSopUidsTest.cs │ ├── Logging │ │ └── Log.2000.InferenceRequestRepository.cs │ ├── Services │ │ ├── Common │ │ │ ├── ScpInputTypeEnum.cs │ │ │ ├── IMonaiService.cs │ │ │ ├── ITcpClientAdapter.cs │ │ │ ├── ITcpListenerFactory.cs │ │ │ └── INetworkStream.cs │ │ ├── DicomWeb │ │ │ ├── StowResult.cs │ │ │ ├── SR.cs │ │ │ ├── IStowService.cs │ │ │ ├── IStowRequestReader.cs │ │ │ └── ConvertStreamException.cs │ │ ├── Fhir │ │ │ ├── ContentTypes.cs │ │ │ ├── IFhirService.cs │ │ │ ├── IFHirRequestReader.cs │ │ │ └── Resources.cs │ │ ├── HealthLevel7 │ │ │ ├── Hl7SendException.cs │ │ │ ├── Resources.cs │ │ │ └── IMllpClientFactory.cs │ │ ├── Export │ │ │ └── ExternalAppExeception.cs │ │ └── UriService │ │ │ └── IUriService.cs │ ├── Common │ │ ├── Constants.cs │ │ ├── PlugInLoadingException.cs │ │ ├── PlugInInitializationException.cs │ │ ├── ServiceException.cs │ │ ├── IDicomToolkit.cs │ │ ├── StudySerieSopUids.cs │ │ ├── FileUploadException.cs │ │ ├── ObjectExistsException.cs │ │ ├── ApplicationEntityNotFoundException.cs │ │ ├── DestinationNotSuppliedException.cs │ │ └── FileMoveException.cs │ ├── InternalVisibleTo.cs │ └── Repositories │ │ └── IMonaiServiceLocator.cs ├── CLI │ ├── Properties │ │ └── launchSettings.json │ ├── InternalVIsibleTo.cs │ ├── Strings.cs │ ├── Services │ │ ├── Runner.cs │ │ ├── IContainerRunnerFactory.cs │ │ ├── ConsoleRegion.cs │ │ ├── EmbeddedResource.cs │ │ └── ConfirmationPrompt.cs │ ├── Test │ │ ├── .editorconfig │ │ ├── TestConsoleRegion.cs │ │ └── ProgramTest.cs │ ├── ExtensionMethods.cs │ ├── Commands │ │ └── ConfigurationException.cs │ └── ControlException.cs ├── DicomWebClient │ ├── CLI │ │ ├── Properties │ │ │ └── launchSettings.json │ │ ├── OutputFormat.cs │ │ └── GlobalSuppressions.cs │ ├── Third-party │ │ └── Microsoft │ │ │ ├── README.md │ │ │ ├── Extensions.cs │ │ │ └── MultipartMemoryStreamProvider.cs │ ├── InternalVisibleTo.cs │ ├── Test │ │ └── .editorconfig │ └── API │ │ ├── IServiceBase.cs │ │ ├── ResponseDecodeException.cs │ │ ├── UnsupportedReturnTypeException.cs │ │ ├── DicomWebResponse.cs │ │ └── DicomWebClientException.cs ├── Client.Common │ ├── packages.lock.json │ ├── ProblemDetails.cs │ ├── UriExtensions.cs │ └── ProblemException.cs ├── Client │ ├── InternalVisibleTo.cs │ ├── Test │ │ └── .editorconfig │ ├── Services │ │ └── ServiceBase.cs │ └── HttpContentExtensions.cs ├── AssemblyInfo.cs ├── Api │ ├── EditMode.cs │ ├── Rest │ │ ├── FileMetadataKeys.cs │ │ ├── InferenceStatusResponse.cs │ │ ├── InferenceRequestResponse.cs │ │ ├── InferenceRequestException.cs │ │ └── RequestedInstance.cs │ ├── Mllp │ │ ├── IMllpService.cs │ │ ├── IMllpClient.cs │ │ ├── IMllpExtract.cs │ │ └── MllpClientResult.cs │ ├── PlugIns │ │ ├── SR.cs │ │ ├── PluginNameAttribute.cs │ │ ├── IInputDataPlugin.cs │ │ ├── IInputHL7DataPlugIn.cs │ │ └── IOutputDataPlugin.cs │ ├── IsExternalinit.cs │ ├── GlobalSuppressions.cs │ ├── Test │ │ ├── LoggingDataDictionaryTest.cs │ │ └── HL7DestinationEntityTest.cs │ ├── LoggingDataDictionary.cs │ ├── Storage │ │ └── MongoDBEntityBase.cs │ ├── HL7DestinationEntity.cs │ └── Models │ │ └── ExternalAppDetails.cs ├── Configuration │ ├── TemporaryDataStorageLocation.cs │ ├── PluginConfiguration.cs │ ├── HttpEndpointSettings.cs │ ├── DataExportConfiguration.cs │ ├── DatabaseOptions.cs │ ├── DicomJsonOptions.cs │ └── ConfigurationException.cs ├── coverlet.runsettings └── Common │ └── FileSystemExtensions.cs ├── .vscode └── settings.json ├── .github ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── dependabot.yml ├── pull_request_template.md └── .gitversion.yml ├── .dockleignore ├── docker-compose ├── configs │ ├── pipeline.yml │ ├── logstash.yml │ ├── elasticsearch.yml │ ├── kibana.yml │ └── pipeline │ │ └── monai-deploy.conf ├── .env └── init.sh ├── .trivyignore ├── NuGetDefense.json └── codecov.yml /demos/app_runner/requirements.txt: -------------------------------------------------------------------------------- 1 | monai-deploy-app-sdk>=0.2 2 | minio>=7.1 3 | pika>=1.2 4 | -------------------------------------------------------------------------------- /tests/Integration.Test/data/hl7/2.3.1/001.txt: -------------------------------------------------------------------------------- 1 | MSH|^~\&|||||20220808145711.766-0700||ADT^A09|301|T|2.3.1 2 | -------------------------------------------------------------------------------- /tests/Integration.Test/data/hl7/2.3.1/002.txt: -------------------------------------------------------------------------------- 1 | MSH|^~\&|||||20220808145738.123-0700||OSQ^Q06|401|T|2.3.1 2 | -------------------------------------------------------------------------------- /tests/Integration.Test/data/hl7/2.6/001.txt: -------------------------------------------------------------------------------- 1 | MSH|^~\&|||||20220808145751.997-0700||VXR^V03^VXR_V03|501|T|2.6 2 | -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "8.0.411", 4 | "rollForward": "latestFeature" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /docs/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/monai-deploy-informatics-gateway/HEAD/docs/images/favicon.ico -------------------------------------------------------------------------------- /guidelines/diagrams/mig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/monai-deploy-informatics-gateway/HEAD/guidelines/diagrams/mig.png -------------------------------------------------------------------------------- /src/.sonarlint/sonar.settings.json: -------------------------------------------------------------------------------- 1 | {"sonar.exclusions":[],"sonar.global.exclusions":["**/build-wrapper-dump.json"],"sonar.inclusions":[]} -------------------------------------------------------------------------------- /guidelines/diagrams/mig-acr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/monai-deploy-informatics-gateway/HEAD/guidelines/diagrams/mig-acr.png -------------------------------------------------------------------------------- /guidelines/diagrams/mig-scp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/monai-deploy-informatics-gateway/HEAD/guidelines/diagrams/mig-scp.png -------------------------------------------------------------------------------- /guidelines/diagrams/storage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/monai-deploy-informatics-gateway/HEAD/guidelines/diagrams/storage.png -------------------------------------------------------------------------------- /src/Database/EntityFramework/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "InformaticsGatewayDatabase": "Data Source=mig.db" 4 | } 5 | } -------------------------------------------------------------------------------- /demos/app_runner/demo-apprunner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/monai-deploy-informatics-gateway/HEAD/demos/app_runner/demo-apprunner.png -------------------------------------------------------------------------------- /guidelines/diagrams/mig-export.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/monai-deploy-informatics-gateway/HEAD/guidelines/diagrams/mig-export.png -------------------------------------------------------------------------------- /src/Plug-ins/RemoteAppExecution/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "InformaticsGatewayDatabase": "Data Source=mig.db" 4 | } 5 | } -------------------------------------------------------------------------------- /guidelines/diagrams/message-broker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Project-MONAI/monai-deploy-informatics-gateway/HEAD/guidelines/diagrams/message-broker.png -------------------------------------------------------------------------------- /src/InformaticsGateway/Test/xunit.runner.json: -------------------------------------------------------------------------------- 1 | { 2 | $schema": "https://xunit.net/schema/current/xunit.runner.schema.json", 3 | "diagnosticMessages": true 4 | } 5 | -------------------------------------------------------------------------------- /tests/Integration.Test/appsettings.ef.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "Type": "sqlite", 4 | "InformaticsGatewayDatabase": "Data Source=./mig.db" 5 | } 6 | } -------------------------------------------------------------------------------- /tests/Integration.Test/data/fhir/copyright: -------------------------------------------------------------------------------- 1 | http://hl7.org/fhir/ 2 | 3 | All test/example files sourced from http://hl7.org/fhir/ and are subject to HL7's copyright if any. -------------------------------------------------------------------------------- /src/CLI/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Monai.Deploy.InformaticsGateway.CLI": { 4 | "commandName": "Project", 5 | "commandLineArgs": "start" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /tests/Integration.Test/appsettings.ext.json: -------------------------------------------------------------------------------- 1 | { 2 | "OrthancSettings": { 3 | "Host": "127.0.0.1", 4 | "dimsePort": 1114, 5 | "dicomWebRoot": "http://127.0.0.1:8089/dicom-web/", 6 | "username": "monai", 7 | "password": "monai!" 8 | } 9 | } -------------------------------------------------------------------------------- /src/DicomWebClient/CLI/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "profiles": { 3 | "Nvidia.Clara.Dicom.DicomWeb.Client.CLI": { 4 | "commandName": "Project", 5 | "commandLineArgs": "stow store -r http://clara-ds-01:8088/dicom-web/ -u clara -p clara! -i C:\\sc\\dicom\\SiemensBTO\\" 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "dotnet-test-explorer.testProjectPath": "**/*Test.@(csproj|vbproj|fsproj)", 3 | "dotnet-test-explorer.autoWatch": true, 4 | "cSpell.words": [ 5 | "Monai", 6 | "MONAI", 7 | "QIDO", 8 | "WADO" 9 | ], 10 | "liveServer.settings.port": 5501, 11 | } -------------------------------------------------------------------------------- /tests/Integration.Test/appsettings.mongodb.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | "Type": "mongodb", 4 | "InformaticsGatewayDatabase": "mongodb://root:rootpassword@localhost:27017", 5 | "DatabaseOptions": { 6 | "DatabaseName": "InformaticsGateway", 7 | "retries": { 8 | "delays": [ 9 | "750", 10 | "1201", 11 | "2500" 12 | ] 13 | } 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /tests/Integration.Test/data/hl7/2.3/004.txt: -------------------------------------------------------------------------------- 1 | MSH|^~\&|AccMgr|1|||20050110114442||ADT^A02|59910287|P|2.3||| 2 | EVN|A02|20050110114442||||| 3 | PID|1||10006579^^^1^MRN^1||DUCK^DONALD^D||19241010|M||1|111^DUCK ST^^FOWL^CA^999990000^^M|1|8885551212|8885551212|1|2||40007716^^^AccMgr^VN^1|123121234|||||||||||NO 4 | PV1|1|I|IN1^214^1^1^^^S|3||PREOP^101^|37^DISNEY^WALT^^^^^^AccMgr^^^^CI|||01||||1|||37^DISNEY^WALT^^^^^^AccMgr^^^^CI|2|40007716^^^AccMgr^VN|4|||||||||||||||||||1||I|||20050110045253|||||| -------------------------------------------------------------------------------- /src/.sonarlint/Monai.Deploy.InformaticsGateway.slconfig: -------------------------------------------------------------------------------- 1 | { 2 | "ServerUri": "https://sonarcloud.io/", 3 | "Organization": { 4 | "Key": "project-monai", 5 | "Name": "Project MONAI" 6 | }, 7 | "ProjectKey": "Project-MONAI_monai-deploy-informatics-gateway", 8 | "ProjectName": "monai-deploy-informatics-gateway", 9 | "Profiles": { 10 | "CSharp": { 11 | "ProfileKey": "AX96ONQSnTk2GEVJ9ILJ", 12 | "ProfileTimestamp": "2022-07-05T10:19:10Z" 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/DicomWebClient/Third-party/Microsoft/README.md: -------------------------------------------------------------------------------- 1 | All files in this directory sourced from https://github.com/aspnet/AspNetWebStack/tree/1231b77d79956152831b75ad7f094f844251b97f and are needed in order to parse multipart/related content. 2 | 3 | All files in this directory are copyrighted and licensed with the following: 4 | 5 | // Copyright (c) .NET Foundation. All rights reserved. 6 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 7 | 8 | 9 | -------------------------------------------------------------------------------- /demos/app_runner/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "storage": { 3 | "endpoint": "10.105.3.254", 4 | "username": "minio", 5 | "password": "monaideploy", 6 | "bucket": "monaideploy" 7 | }, 8 | "messaging": { 9 | "username": "mdig", 10 | "password": "gidm", 11 | "host": "10.110.54.121", 12 | "virtual_host": "monaideploy", 13 | "exchange": "monaideploy", 14 | "topic": "md.workflow.request" 15 | }, 16 | "working_dir": "jobs/", 17 | "ignore_json": false 18 | } 19 | -------------------------------------------------------------------------------- /tests/Integration.Test/data/hl7/2.8/001.txt: -------------------------------------------------------------------------------- 1 | MSH|^~\&|ADT1|GOOD HEALTH HOSPITAL|GHH LAB, INC.|GOOD HEALTH HOSPITAL|198808181126|SECURITY|ADT^A01^ADT_A01|MSG00001|P|2.8|| 2 | EVN|A01|200708181123|| 3 | PID|1||PATID1234^5^M11^ADT1^MR^GOOD HEALTH HOSPITAL~123456789^^^USSSA^SS||EVERYMAN^ADAM^A^III||19610615|M||C|2222 HOME STREET^^GREENSBORO^NC^27401-1020|GL|(555) 555-2004|(555)555-2004||S||PATID12345001^2^M10^ADT1^AN^A|444333333|987654^NC| 4 | NK1|1|NUCLEAR^NELDA^W|SPO^SPOUSE||||NK^NEXT OF KIN 5 | PV1|1|I|2000^2012^01||||004777^ATTEND^AARON^A|||SUR||||ADM|A0| -------------------------------------------------------------------------------- /tests/Integration.Test/data/fhir/4.0.1 R4/OperationOutcome.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 |

All OK

9 |
10 |
11 | 12 | 13 | 14 |
15 | 16 |
17 |
18 |
19 | -------------------------------------------------------------------------------- /tests/Integration.Test/data/hl7/2.3/005.txt: -------------------------------------------------------------------------------- 1 | MSH|^~\&|HL7|CG3_SICU|CE_CENTRAL|GH_CSF|20251014154001||ORU^R01|20251014154001-425|P|2.3||||||UNICODE UTF-8 2 | PID|||10002^^^A^MR||RAPID^^|^^|||||^^^^^^^|||||||||||||||||| 3 | PV1||E|G52008||||||||||||||||||||||||||||||||||||||||| 4 | OBR|1||||||20251014154001||||||||||||||||||||^^^^||||||||| 5 | OBX|1|ST|HR||68|/min|||||R 6 | OBX|2|ST|PVC||0|#/min|||||R 7 | OBX|3|ST|RR||14|breaths/min|||||R 8 | OBX|4|ST|CO2EX||28|mm(hg)|||||R 9 | OBX|5|ST|CO2IN||3|mm(hg)|||||R 10 | OBX|6|ST|CO2RR||14|breaths/min|||||R 11 | OBX|7|ST|SPO2R||71|/min|||||R 12 | OBX|8|ST|SPO2P||100|%|||||R 13 | -------------------------------------------------------------------------------- /src/Database/EntityFramework/Migrations/20221010184458_R3_0.3.2.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace Monai.Deploy.InformaticsGateway.Database.Migrations 6 | { 7 | public partial class R3_032 : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | // know that this is empty, can it be removed ? 12 | } 13 | 14 | protected override void Down(MigrationBuilder migrationBuilder) 15 | { 16 | // know that this is empty, can it be removed ? 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Client.Common/packages.lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "dependencies": { 4 | "net8.0": { 5 | "Ardalis.GuardClauses": { 6 | "type": "Direct", 7 | "requested": "[4.6.0, )", 8 | "resolved": "4.6.0", 9 | "contentHash": "ckLr6V8tRXHu0kGVlen70sjXkZcbe6ZFknM3UDkeNzY75kXEe4Z5xru5weMU5IEAsuuqMKvVb7ikbUZ7JcHUSQ==" 10 | }, 11 | "Microsoft.NET.ILLink.Tasks": { 12 | "type": "Direct", 13 | "requested": "[8.0.17, )", 14 | "resolved": "8.0.17", 15 | "contentHash": "x5/y4l8AtshpBOrCZdlE4txw8K3e3s9meBFeZeR3l8hbbku2V7kK6ojhXvrbjg1rk3G+JqL1BI26gtgc1ZrdUw==" 16 | } 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /tests/Integration.Test/Features/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright 2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | *.feature.cs 16 | -------------------------------------------------------------------------------- /src/Database/Api/Test/Usings.cs: -------------------------------------------------------------------------------- 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 | global using Xunit; -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /src/Database/EntityFramework/Test/Usings.cs: -------------------------------------------------------------------------------- 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 | global using Xunit; 18 | -------------------------------------------------------------------------------- /tests/Integration.Test/.gitignore: -------------------------------------------------------------------------------- 1 | # Copyright 2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | .run 16 | LivingDoc.html 17 | service.log 18 | metrics.log 19 | -------------------------------------------------------------------------------- /src/Database/MongoDB/Integration.Test/Usings.cs: -------------------------------------------------------------------------------- 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 | global using Xunit; 18 | -------------------------------------------------------------------------------- /docs/api/toc.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021-2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | - name: REST API 16 | href: rest/toc.yml 17 | - name: .NET 18 | href: ../obj/api/dotnet/toc.yml 19 | -------------------------------------------------------------------------------- /tests/Integration.Test/TestConfig.cs: -------------------------------------------------------------------------------- 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 | [assembly: CollectionBehavior(DisableTestParallelization = true)] 17 | -------------------------------------------------------------------------------- /.dockleignore: -------------------------------------------------------------------------------- 1 | # Copyright 2023 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Checked and no actual secrets found in dockerfile, just some environment variables for compatibility 16 | CIS-DI-0010 17 | 18 | -------------------------------------------------------------------------------- /tests/Integration.Test/data/hl7/2.5.1/005.txt: -------------------------------------------------------------------------------- 1 | MSH|^~\&|NISTEHRAPP|NISTEHRFAC|NISTIISAPP|NISTIISFAC|20150625072816.601-0500||VXU^V04^VXU_V04|NIST-IZ-AD-10.1_Send_V04_Z22|P|2.5.1||||AL|||||Z22^CDCPHINVS|NISTEHRFAC|NISTIISFAC 2 | PID|1||21142^^^NIST-MPI-1^MR||Vasquez^Manuel^Diego^^^^L||19470215|M||2106-3^White^CDCREC|227 Park Ave^^Bozeman^MT^59715^USA^P||^PRN^PH^^^406^5555815~^NET^^Manuel.Vasquez@isp.com|||||||||2135-2^Hispanic or Latino^CDCREC||N|1|||||N 3 | PD1|||||||||||01^No reminder/recall^HL70215|N|20150625|||A|20150625|20150625ORC|RE||31165^NIST-AA-IZ-2|||||||7824^Jackson^Lily^Suzanne^^^^^NIST-PI-1^L^^^PRN|||||||NISTEHRFAC^NISTEHRFacility^HL70362 4 | RXA|0|1|20141021||152^Pneumococcal Conjugate, unspecified formulation^CVX|999|||01^Historical Administration^NIP001|||||||||||CP|A -------------------------------------------------------------------------------- /docs/plug-ins/toc.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021-2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | - name: Data Plug-ins 16 | href: overview.md 17 | - name: Remote App Execution Plug-ins 18 | href: remote-app.md 19 | -------------------------------------------------------------------------------- /docker-compose/configs/pipeline.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | - pipeline.id: monei-deploy 15 | path.config: "/usr/share/logstash/pipeline/monai-deploy.conf" 16 | queue.type: persisted 17 | -------------------------------------------------------------------------------- /tests/Integration.Test/ImplicitUsings.cs: -------------------------------------------------------------------------------- 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 | global using FluentAssertions; 18 | global using TechTalk.SpecFlow; 19 | global using Xunit; 20 | -------------------------------------------------------------------------------- /docs/compliance/toc.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | # [DICOM](dicom.md) 18 | # [HL7](hl7.md) 19 | # [Third-Party Licenses](third-party-licenses.md) 20 | -------------------------------------------------------------------------------- /docs/setup/toc.md: -------------------------------------------------------------------------------- 1 | 16 | 17 | # [Setup](setup.md) 18 | # [Configuration](schema.md) 19 | # [CLI](cli.md) 20 | # [Services](services.md) 21 | -------------------------------------------------------------------------------- /tests/Integration.Test/data/hl7/2.5.1/002.txt: -------------------------------------------------------------------------------- 1 | MSH|^~\&#|NIST EHR|NIST EHR Facility|NIST Test Lab APP|NIST Lab Facility|20130211184101-0500||OML^O21^OML_O21|NIST-LOI_5.0_1.1-NG|T|2.5.1|||AL|AL||||| 2 | PID|1||PATID5421^^^NIST MPI^MR||Wilson^Patrice^Natasha^^^^L||19820304|F||2106-3^White^HL70005|144 East 12th Street^^Los Angeles^CA^90012^^H||^PRN^PH^^^203^2290210|||||||||N^Not Hispanic or Latino^HL70189 3 | NK1|1|Wilson^Phillip^Arthur^^^^L|SPO^Spouse^HL70063|144 East 12th Street^^Los Angeles^CA^90012^^H||||||||| 4 | ORC|NW|ORD448811^NIST EHR|||||||20120628070100|||5742200012^Radon^Nicholas^^^^^^NPI^L^^^NPI 5 | OBR|1|ORD448811^NIST EHR||1000^Hepatitis A B C Panel^99USL|||20120628070100|||||||||5742200012^Radon^Nicholas^^^^^^NPI^L^^^NPI 6 | DG1|1||F11.129^Opioid abuse with intoxication,unspecified^I10C|||W|||||||||1 -------------------------------------------------------------------------------- /tests/Integration.Test/data/fhir/4.0.1 R4/OperationOutcome.json: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "OperationOutcome", 3 | "id": "OperationOutcome", 4 | "text": { 5 | "status": "generated", 6 | "div": "
\n

The code "W" is not known and not legal Patient.gender.

\n
" 7 | }, 8 | "issue": [ 9 | { 10 | "severity": "error", 11 | "code": "code-invalid", 12 | "details": { 13 | "text": "The code \"W\" is not known and not legal in this context" 14 | }, 15 | "diagnostics": "Acme.Interop.FHIRProcessors.Patient.processGender line 2453", 16 | "location": [ 17 | "/f:Patient/f:gender" 18 | ], 19 | "expression": [ 20 | "Patient.gender" 21 | ] 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /src/CLI/InternalVIsibleTo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 System.Runtime.CompilerServices; 18 | 19 | [assembly: InternalsVisibleTo("Monai.Deploy.InformaticsGateway.CLI.Test")] 20 | -------------------------------------------------------------------------------- /src/Client/InternalVisibleTo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 System.Runtime.CompilerServices; 18 | 19 | [assembly: InternalsVisibleTo("Monai.Deploy.InformaticsGateway.Client.Test")] 20 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "nuget" 9 | directory: "/" 10 | schedule: 11 | interval: "weekly" 12 | open-pull-requests-limit: 5 13 | - package-ecosystem: "docker" 14 | directory: "/" 15 | schedule: 16 | interval: "weekly" 17 | open-pull-requests-limit: 5 18 | - package-ecosystem: "github-actions" 19 | directory: "/" 20 | schedule: 21 | interval: "weekly" 22 | open-pull-requests-limit: 5 23 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### Description 2 | 3 | Fixes # . 4 | 5 | A few sentences describing the changes proposed in this pull request. 6 | 7 | ### Status 8 | **Ready/Work in progress/Hold** 9 | 10 | ### Types of changes 11 | 12 | - [ ] Non-breaking change (fix or new feature that would not break existing functionality). 13 | - [ ] Breaking change (fix or new feature that would cause existing functionality to change). 14 | - [ ] New tests added to cover the changes. 15 | - [ ] All tests passed locally. 16 | - [ ] [Documentation comments](https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/documentation-comments) included/updated. 17 | - [ ] User guide updated. 18 | - [ ] I have updated the changelog 19 | -------------------------------------------------------------------------------- /src/Database/EntityFramework/Migrations/20230131233123_R3_0.3.8.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace Monai.Deploy.InformaticsGateway.Database.Migrations 6 | { 7 | public partial class R3_038 : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "MachineName", 13 | table: "Payloads", 14 | type: "TEXT", 15 | nullable: true); 16 | } 17 | 18 | protected override void Down(MigrationBuilder migrationBuilder) 19 | { 20 | migrationBuilder.DropColumn( 21 | name: "MachineName", 22 | table: "Payloads"); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /.trivyignore: -------------------------------------------------------------------------------- 1 | # Copyright 2023 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # https://github.com/Project-MONAI/monai-deploy-informatics-gateway/issues/450 16 | CVE-2018-8292 17 | 18 | # https://github.com/Project-MONAI/monai-deploy-informatics-gateway/issues/451 19 | CVE-2019-0820 20 | -------------------------------------------------------------------------------- /tests/Integration.Test/data/hl7/2.3/006.txt: -------------------------------------------------------------------------------- 1 | MSH|^~\&|HL7|CG3_SICU|CE_CENTRAL|GH_CSF|20251014154101||ORU^R01|20251014154101-639|P|2.3||||||UNICODE UTF-8 2 | PID|||100002^^^A^MR||RAPID^^|^^|||||^^^^^^^|||||||||||||||||| 3 | PV1||E|G52008||||||||||||||||||||||||||||||||||||||||| 4 | OBR|1||||||20251014154101||||||||||||||||||||^^^^||||||||| 5 | OBX|1|ST|HR||73|/min|||||R 6 | OBX|2|ST|PVC||15|#/min|||||R 7 | OBX|3|ST|STI||-0.5|mm|||||R 8 | OBX|4|ST|STII||0.0|mm|||||R 9 | OBX|5|ST|STIII||0.5|mm|||||R 10 | OBX|6|ST|STV1||0.0|mm|||||R 11 | OBX|7|ST|STAVR||0.2|mm|||||R 12 | OBX|8|ST|STAVL||-0.5|mm|||||R 13 | OBX|9|ST|STAVF||0.2|mm|||||R 14 | OBX|10|ST|RR||15|breaths/min|||||R 15 | OBX|11|ST|CO2EX||32|mm(hg)|||||R 16 | OBX|12|ST|CO2IN||0|mm(hg)|||||R 17 | OBX|13|ST|CO2RR||14|breaths/min|||||R 18 | OBX|14|ST|SPO2R||73|/min|||||R 19 | OBX|15|ST|SPO2P||99|%|||||R 20 | -------------------------------------------------------------------------------- /src/AssemblyInfo.cs: -------------------------------------------------------------------------------- 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 | using System.Reflection; 18 | 19 | [assembly: AssemblyVersion("0.0.0.0")] 20 | [assembly: AssemblyFileVersion("0.0.0.0")] 21 | [assembly: AssemblyInformationalVersion("0.0.0")] 22 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Logging/Log.2000.InferenceRequestRepository.cs: -------------------------------------------------------------------------------- 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 | namespace Monai.Deploy.InformaticsGateway.Logging 18 | { 19 | public static partial class Log 20 | { 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /docker-compose/configs/logstash.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | --- 15 | ## Default Logstash configuration from Logstash base image. 16 | ## https://github.com/elastic/logstash/blob/main/docker/data/logstash/config/logstash-full.yml 17 | # 18 | http.host: "0.0.0.0" 19 | -------------------------------------------------------------------------------- /src/Plug-ins/RemoteAppExecution/InternalVisibleTo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 System.Runtime.CompilerServices; 18 | 19 | [assembly: InternalsVisibleTo("Monai.Deploy.InformaticsGateway.PlugIns.RemoteAppExecution.Test")] 20 | -------------------------------------------------------------------------------- /src/Database/Api/DatabaseTypes.cs: -------------------------------------------------------------------------------- 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.InformaticsGateway.Database.Api 18 | { 19 | public enum DatabaseType 20 | { 21 | EntityFramework, 22 | MongoDb 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Api/EditMode.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | namespace Monai.Deploy.InformaticsGateway.Api 19 | { 20 | public enum EditMode 21 | { 22 | Create, 23 | Update, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/DicomWebClient/InternalVisibleTo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 MONAI Consortium 3 | * Copyright 2019-2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System.Runtime.CompilerServices; 19 | 20 | [assembly: InternalsVisibleTo("Monai.Deploy.InformaticsGateway.DicomWeb.Client.Test")] 21 | -------------------------------------------------------------------------------- /src/Configuration/TemporaryDataStorageLocation.cs: -------------------------------------------------------------------------------- 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 | namespace Monai.Deploy.InformaticsGateway.Configuration 18 | { 19 | public enum TemporaryDataStorageLocation 20 | { 21 | Memory, 22 | Disk 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/CLI/Strings.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 | namespace Monai.Deploy.InformaticsGateway.CLI 18 | { 19 | internal static class Strings 20 | { 21 | public const string ApplicationName = "MONAI Deploy Informatics Gateway"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /docs/api/rest/toc.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021-2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | - name: Configuration 16 | href: config.md 17 | - name: DICOMWeb STOW 18 | href: dicomweb-stow.md 19 | - name: FHIR 20 | href: fhir.md 21 | - name: Health 22 | href: health.md 23 | - name: Inference Request 24 | href: inference.md 25 | -------------------------------------------------------------------------------- /src/CLI/Services/Runner.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 | namespace Monai.Deploy.InformaticsGateway.CLI.Services 18 | { 19 | public enum Runner 20 | { 21 | Unknown, 22 | Docker, 23 | Kubernetes, 24 | Helm, 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/DicomWebClient/Third-party/Microsoft/Extensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.Diagnostics.Contracts; 5 | using System.Net.Http.Headers; 6 | 7 | 8 | namespace System.Net.Http 9 | { 10 | internal static class Extensions 11 | { 12 | public static void CopyTo(this HttpContentHeaders fromHeaders, HttpContentHeaders toHeaders) 13 | { 14 | Contract.Assert(fromHeaders != null, "fromHeaders cannot be null."); 15 | Contract.Assert(toHeaders != null, "toHeaders cannot be null."); 16 | 17 | foreach (var header in fromHeaders) 18 | { 19 | toHeaders.TryAddWithoutValidation(header.Key, header.Value); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/CLI/Services/IContainerRunnerFactory.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 | namespace Monai.Deploy.InformaticsGateway.CLI.Services 18 | { 19 | public interface IContainerRunnerFactory 20 | { 21 | IContainerRunner GetContainerRunner(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/CLI/Test/.editorconfig: -------------------------------------------------------------------------------- 1 | # Copyright 2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # editorconfig.org 16 | 17 | # top-most EditorConfig file 18 | root = false 19 | 20 | 21 | [*.cs] 22 | 23 | # Default severity for all analyzer diagnostics 24 | dotnet_analyzer_diagnostic.severity = none 25 | dotnet_diagnostic.CA2007.severity = none -------------------------------------------------------------------------------- /src/Client/Test/.editorconfig: -------------------------------------------------------------------------------- 1 | # Copyright 2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # editorconfig.org 16 | 17 | # top-most EditorConfig file 18 | root = false 19 | 20 | 21 | [*.cs] 22 | 23 | # Default severity for all analyzer diagnostics 24 | dotnet_analyzer_diagnostic.severity = none 25 | dotnet_diagnostic.CA2007.severity = none -------------------------------------------------------------------------------- /tests/Integration.Test/data/hl7/2.4/001.txt: -------------------------------------------------------------------------------- 1 | MSH|^~\&|ADT1|MCM|LABADT|MCM|198808181126|SECURITY|ADT^A04|MSG00001|P|2.4 2 | EVN|A01-|198808181123 3 | PID|||PATID1234^5^M11||JONES^WILLIAM^A^III||19610615|M-||2106-3|1200 N ELM STREET^^GREENSBORO^NC^27401-1020|GL|(919)379-1212|(919)271-3434~(919)277-3114||S||PATID12345001^2^M10|123456789|9-87654^NC 4 | NK1|1|JONES^BARBARA^K|SPO|||||20011105 5 | NK1|1|JONES^MICHAEL^A|FTH 6 | PV1|1|I|2000^2012^01||||004777^LEBAUER^SIDNEY^J.|||SUR||-||1|A0- 7 | AL1|1||^PENICILLIN||PRODUCES HIVES~RASH 8 | AL1|2||^CAT DANDER 9 | DG1|001|I9|1550|MAL NEO LIVER, PRIMARY|19880501103005|F|| 10 | PR1|2234|M11|111^CODE151|COMMON PROCEDURES|198809081123 11 | ROL|45^RECORDER^ROLE MASTER LIST|AD|CP|KATE^SMITH^ELLEN|199505011201 12 | GT1|1122|1519|BILL^GATES^A 13 | IN1|001|A357|1234|BCMD|||||132987 14 | IN2|ID1551001|SSN12345678 15 | ROL|45^RECORDER^ROLE MASTER LIST|AD|CP|KATE^ELLEN|199505011201 -------------------------------------------------------------------------------- /src/Database/EntityFramework/Migrations/20230907182457_R4_0.4.1.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace Monai.Deploy.InformaticsGateway.Database.Migrations 6 | { 7 | public partial class R4_041 : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "PayloadIds", 13 | table: "DicomAssociationHistories", 14 | type: "TEXT", 15 | nullable: false, 16 | defaultValue: ""); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.DropColumn( 22 | name: "PayloadIds", 23 | table: "DicomAssociationHistories"); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/DicomWebClient/Test/.editorconfig: -------------------------------------------------------------------------------- 1 | # Copyright 2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # editorconfig.org 16 | 17 | # top-most EditorConfig file 18 | root = false 19 | 20 | 21 | [*.cs] 22 | 23 | # Default severity for all analyzer diagnostics 24 | dotnet_analyzer_diagnostic.severity = none 25 | dotnet_diagnostic.CA2007.severity = none -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/Common/ScpInputTypeEnum.cs: -------------------------------------------------------------------------------- 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.InformaticsGateway.Services.Common 18 | { 19 | public enum ScpInputTypeEnum 20 | { 21 | WorkflowTrigger, 22 | ExternalAppReturn 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/Integration.Test/.editorconfig: -------------------------------------------------------------------------------- 1 | # Copyright 2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # editorconfig.org 16 | 17 | # top-most EditorConfig file 18 | root = false 19 | 20 | 21 | [*.cs] 22 | 23 | # Default severity for all analyzer diagnostics 24 | dotnet_analyzer_diagnostic.severity = none 25 | dotnet_diagnostic.CA2007.severity = none -------------------------------------------------------------------------------- /src/InformaticsGateway/Test/.editorconfig: -------------------------------------------------------------------------------- 1 | # Copyright 2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # editorconfig.org 16 | 17 | # top-most EditorConfig file 18 | root = false 19 | 20 | 21 | [*.cs] 22 | 23 | # Default severity for all analyzer diagnostics 24 | dotnet_analyzer_diagnostic.severity = none 25 | dotnet_diagnostic.CA2007.severity = none -------------------------------------------------------------------------------- /src/DicomWebClient/CLI/OutputFormat.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | namespace Monai.Deploy.InformaticsGateway.DicomWeb.Client.CLI 19 | { 20 | public enum OutputFormat 21 | { 22 | Dicom, 23 | Json, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Common/Constants.cs: -------------------------------------------------------------------------------- 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 | namespace Monai.Deploy.InformaticsGateway.Common 18 | { 19 | public static class Constants 20 | { 21 | public const int ERROR_HANDLE_DISK_FULL = 0x27; 22 | public const int ERROR_DISK_FULL = 0x70; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /docs/toc.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021-2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | - name: MONAI Deploy Informatics Gateway 16 | href: index.md 17 | - name: Get Started 18 | href: setup/ 19 | - name: API Documentation 20 | href: api/ 21 | - name: Plug-ins 22 | href: plug-ins/ 23 | - name: Compliance 24 | href: compliance/ 25 | - name: Changelog 26 | href: changelog.md 27 | -------------------------------------------------------------------------------- /src/Api/Rest/FileMetadataKeys.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 | namespace Monai.Deploy.InformaticsGateway.Api.Rest 18 | { 19 | public static class FileMetadataKeys 20 | { 21 | public const string Source = "FILESOURCE"; 22 | 23 | public const string Workflows = "WORKFLOWS"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/Integration.Test/Drivers/IDatabaseDataProvider.cs: -------------------------------------------------------------------------------- 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 | namespace Monai.Deploy.InformaticsGateway.Integration.Test.Hooks 18 | { 19 | public interface IDatabaseDataProvider 20 | { 21 | void ClearAllData(); 22 | 23 | Task InjectAcrRequest(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/Integration.Test/data/fhir/3.0.2 STU3/Bundle.json: -------------------------------------------------------------------------------- 1 | { 2 | "resourceType": "Bundle", 3 | "id": "Bundle", 4 | "type": "batch", 5 | "entry": [ 6 | { 7 | "request": { 8 | "method": "GET", 9 | "url": "/Patient/example" 10 | } 11 | }, 12 | { 13 | "request": { 14 | "method": "GET", 15 | "url": "/MedicationStatement?patient=example&_list=$current-medications" 16 | } 17 | }, 18 | { 19 | "request": { 20 | "method": "GET", 21 | "url": "/AllergyIntolernce?patient=example&_list=$current-allergies" 22 | } 23 | }, 24 | { 25 | "request": { 26 | "method": "GET", 27 | "url": "/Condition?patient=example&_list=$current-problems" 28 | } 29 | }, 30 | { 31 | "request": { 32 | "method": "GET", 33 | "url": "/MedicationStatement?patient=example¬given:not=true" 34 | } 35 | } 36 | ] 37 | } -------------------------------------------------------------------------------- /docker-compose/.env: -------------------------------------------------------------------------------- 1 | # Copyright 2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ELASTIC_VERSION=8.4.2 16 | 17 | 18 | # Elastic Search 19 | # User 'elastic' (built-in) 20 | ELASTIC_PASSWORD='monai' 21 | 22 | # Logstash 23 | # User 'logstash_internal' (custom) 24 | LOGSTASH_INTERNAL_PASSWORD='monai' 25 | 26 | # Kibana 27 | # User 'kibana_system' (built-in) 28 | KIBANA_SYSTEM_PASSWORD='monai' 29 | -------------------------------------------------------------------------------- /src/Database/EntityFramework/Migrations/20231207154732_Hl7Plugins.cs: -------------------------------------------------------------------------------- 1 | 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | 4 | #nullable disable 5 | 6 | namespace Monai.Deploy.InformaticsGateway.Database.Migrations 7 | { 8 | public partial class Hl7Plugins : Migration 9 | { 10 | protected override void Up(MigrationBuilder migrationBuilder) 11 | { 12 | migrationBuilder.AddColumn( 13 | name: "LastModified", 14 | table: "Hl7ApplicationConfig", 15 | type: "TEXT", 16 | nullable: false, 17 | defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); 18 | } 19 | 20 | protected override void Down(MigrationBuilder migrationBuilder) 21 | { 22 | migrationBuilder.DropColumn( 23 | name: "LastModified", 24 | table: "Hl7ApplicationConfig"); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/coverlet.runsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | opencover 8 | [coverlet.*.tests?]*,[*]Coverlet.Core*,[xunit.*]*,[Grpc.Core*]*,[System.*]*,[Microsoft.*]*,[Integration.Test.*]* 9 | 10 | 11 | 12 | 13 | false 14 | true 15 | true 16 | true 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/filterConfig.yml: -------------------------------------------------------------------------------- 1 | ### YamlMime:ManagedReference 2 | # Copyright 2021-2025 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 | apiRules: 17 | - exclude: 18 | hasAttribute: 19 | uid: Newtonsoft.Json.JsonIgnoreAttribute 20 | - exclude: 21 | uidRegex: ^FellowOakDicom\.Serialization\..*$ 22 | type: Type 23 | - exclude: 24 | # inherited Object methods 25 | uidRegex: ^System\.Object\..*$ 26 | type: Method 27 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/DicomWeb/StowResult.cs: -------------------------------------------------------------------------------- 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 FellowOakDicom; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Services.DicomWeb 20 | { 21 | public class StowResult 22 | { 23 | public int StatusCode { get; internal set; } 24 | public DicomDataset? Data { get; internal set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/Fhir/ContentTypes.cs: -------------------------------------------------------------------------------- 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 | namespace Monai.Deploy.InformaticsGateway.Services.Fhir 18 | { 19 | internal static class ContentTypes 20 | { 21 | public const string ApplicationFhirXml = "application/fhir+xml"; 22 | public const string ApplicationFhirJson = "application/fhir+json"; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /docker-compose/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 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 | RUNDIR=$PWD/.run 17 | 18 | echo "Initializing directories..." 19 | [ -d $RUNDIR ] && echo "Removing existin $RUNDIR" && sudo rm -r $RUNDIR 20 | mkdir -p $RUNDIR/esdata/ && echo "Created $RUNDIR/" 21 | sudo chown 1000:1000 -R $RUNDIR/esdata && echo "Permission updated" 22 | echo "Directories setup" 23 | echo "Ready to run docker compose up" 24 | -------------------------------------------------------------------------------- /src/Client.Common/ProblemDetails.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | namespace Monai.Deploy.InformaticsGateway.Client.Common 19 | { 20 | public class ProblemDetails 21 | { 22 | public string Title { get; set; } 23 | public int Status { get; set; } 24 | public string Detail { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/Integration.Test/Common/IDataClient.cs: -------------------------------------------------------------------------------- 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 | namespace Monai.Deploy.InformaticsGateway.Integration.Test.Common 18 | { 19 | internal interface IDataClient 20 | { 21 | Task SendAsync(DataProvider dataProvider, params object[] args); 22 | 23 | Task SaveHl7Async(DataProvider dataProvider, params object[] args); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Api/Mllp/IMllpService.cs: -------------------------------------------------------------------------------- 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 | using System.Net; 18 | using System.Threading; 19 | using System.Threading.Tasks; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Api.Mllp 22 | { 23 | public interface IMllpService 24 | { 25 | Task SendMllp(IPAddress address, int port, string hl7Message, CancellationToken cancellationToken); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/InformaticsGateway/InternalVisibleTo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 System.Runtime.CompilerServices; 18 | 19 | [assembly: InternalsVisibleTo("Monai.Deploy.InformaticsGateway.Test")] 20 | [assembly: InternalsVisibleTo("Monai.Deploy.InformaticsGateway.Integration.Test")] 21 | 22 | // ILogger 23 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] 24 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/DicomWeb/SR.cs: -------------------------------------------------------------------------------- 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 | namespace Monai.Deploy.InformaticsGateway.Services.DicomWeb 18 | { 19 | internal static class SR 20 | { 21 | public const string TypeParameterName = "type"; 22 | public const string StartParameterName = "start"; 23 | public const string BoundaryParameterName = "boundary"; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/DicomWebClient/API/IServiceBase.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 MONAI Consortium 3 | * Copyright 2019-2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | namespace Monai.Deploy.InformaticsGateway.DicomWeb.Client.API 19 | { 20 | public interface IServiceBase 21 | { 22 | #pragma warning disable CA1054 23 | 24 | bool TryConfigureServiceUriPrefix(string uriPrefix); 25 | 26 | #pragma warning restore CA1054 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/DicomWebClient/API/ResponseDecodeException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.DicomWeb.Client.API 21 | { 22 | public class ResponseDecodeException : Exception 23 | { 24 | public ResponseDecodeException(string message) : base(message) 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/Common/IMonaiService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 MONAI Consortium 3 | * Copyright 2019-2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using Monai.Deploy.InformaticsGateway.Api.Rest; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Services.Common 21 | { 22 | public interface IMonaiService 23 | { 24 | ServiceStatus Status { get; set; } 25 | string ServiceName { get; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/Common/ITcpClientAdapter.cs: -------------------------------------------------------------------------------- 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 System; 18 | using System.Net; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Services.Common 21 | { 22 | internal interface ITcpClientAdapter : IDisposable 23 | { 24 | EndPoint RemoteEndPoint { get; } 25 | 26 | INetworkStream GetStream(); 27 | 28 | void Close(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Api/PlugIns/SR.cs: -------------------------------------------------------------------------------- 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 | using System; 18 | using System.IO; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Api.PlugIns 21 | { 22 | public static class SR 23 | { 24 | public const string PlugInDirectoryName = "plug-ins"; 25 | public static readonly string PlugInDirectoryPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, SR.PlugInDirectoryName); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/DicomWebClient/API/UnsupportedReturnTypeException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 MONAI Consortium 3 | * Copyright 2019-2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.DicomWeb.Client.API 21 | { 22 | public class UnsupportedReturnTypeException : Exception 23 | { 24 | public UnsupportedReturnTypeException(string message) : base(message) 25 | { 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/Integration.Test/data/fhir/1.0.2 DSTU2/Patient.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 |

Henry Levin the 7th

8 |
9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
33 | -------------------------------------------------------------------------------- /src/Configuration/PluginConfiguration.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 | using System.Collections.Generic; 18 | using Microsoft.Extensions.Configuration; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Configuration 21 | { 22 | public class PlugInConfiguration 23 | { 24 | [ConfigurationKeyName("remoteApp")] 25 | public Dictionary RemoteAppConfigurations { get; set; } = new(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Plug-ins/RemoteAppExecution/SR.cs: -------------------------------------------------------------------------------- 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.InformaticsGateway.PlugIns.RemoteAppExecution 18 | { 19 | internal static class SR 20 | { 21 | public const string ConfigKey_ReplaceTags = "ReplaceTags"; 22 | 23 | public const string DatabaseConnectionStringKey = "InformaticsGatewayDatabase"; 24 | 25 | public const string DatabaseNameKey = "DatabaseName"; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/Integration.Test/Common/Hl7Messages.cs: -------------------------------------------------------------------------------- 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 | namespace Monai.Deploy.InformaticsGateway.Integration.Test.Common 18 | { 19 | internal class Hl7Messages 20 | { 21 | public Dictionary Files { get; set; } = new Dictionary(); 22 | public Dictionary Responses { get; set; } = new Dictionary(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/CLI/Test/TestConsoleRegion.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 System.CommandLine.Rendering; 18 | using Monai.Deploy.InformaticsGateway.CLI.Services; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.CLI.Test 21 | { 22 | internal class TestConsoleRegion : IConsoleRegion 23 | { 24 | public Region GetDefaultConsoleRegion() 25 | { 26 | return new Region(0, 0, 100, 100, false); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/CLI/Test/ProgramTest.cs: -------------------------------------------------------------------------------- 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 xRetry; 18 | using Xunit; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.CLI.Test 21 | { 22 | public class ProgramTest 23 | { 24 | [RetryFact(DisplayName = "Program - runs properly")] 25 | public void Startup_RunsProperly() 26 | { 27 | var host = Program.BuildParser(); 28 | 29 | Assert.NotNull(host); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Api/IsExternalinit.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 System.ComponentModel; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Api 20 | { 21 | /// 22 | /// Reserved to be used by the compiler for tracking metadata. 23 | /// This class should not be used by developers in source code. 24 | /// 25 | [EditorBrowsable(EditorBrowsableState.Never)] 26 | internal static class IsExternalInit 27 | { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/Fhir/IFhirService.cs: -------------------------------------------------------------------------------- 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 System.Threading; 18 | using System.Threading.Tasks; 19 | using Microsoft.AspNetCore.Http; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Services.Fhir 22 | { 23 | internal interface IFhirService 24 | { 25 | Task StoreAsync(HttpRequest request, string correlationId, string resourceType, CancellationToken cancellationToken); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Api/Mllp/IMllpClient.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-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 | using System; 18 | using System.Threading; 19 | using System.Threading.Tasks; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Api.Mllp 22 | { 23 | public interface IMllpClient : IDisposable 24 | { 25 | Guid ClientId { get; } 26 | 27 | string ClientIp { get; } 28 | 29 | Task Start(Func onDisconnect, CancellationToken cancellationToken); 30 | } 31 | } -------------------------------------------------------------------------------- /src/CLI/ExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 System.CommandLine.Rendering; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.CLI 20 | { 21 | public static class ExtensionMethods 22 | { 23 | public static TextSpan Underline(this string value) => 24 | new ContainerSpan(StyleSpan.UnderlinedOn(), 25 | new ContentSpan(value), 26 | StyleSpan.UnderlinedOff()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Common/PlugInLoadingException.cs: -------------------------------------------------------------------------------- 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 | using System; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Common 20 | { 21 | public class PlugInLoadingException : Exception 22 | { 23 | public PlugInLoadingException(string message) : base(message) 24 | { 25 | } 26 | 27 | public PlugInLoadingException(string message, Exception innerException) : base(message, innerException) 28 | { 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/DicomWeb/IStowService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-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 | using System.Threading; 18 | using System.Threading.Tasks; 19 | using Microsoft.AspNetCore.Http; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Services.DicomWeb 22 | { 23 | internal interface IStowService 24 | { 25 | Task StoreAsync(HttpRequest request, string? studyInstanceUid, string? aet, string? workflowName, string correlationId, CancellationToken cancellationToken); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Api/Mllp/IMllpExtract.cs: -------------------------------------------------------------------------------- 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 | 18 | using System.Threading.Tasks; 19 | using HL7.Dotnetcore; 20 | using Monai.Deploy.InformaticsGateway.Api.Storage; 21 | 22 | namespace Monai.Deploy.InformaticsGateway.Api.Mllp 23 | { 24 | public interface IMllpExtract 25 | { 26 | Task ExtractInfo(Hl7FileStorageMetadata meta, Message message, Hl7ApplicationConfigEntity configItem); 27 | 28 | Task GetConfigItem(Message message); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Database/Api/SR.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | namespace Monai.Deploy.InformaticsGateway.Database.Api 19 | { 20 | public static class SR 21 | { 22 | /// 23 | /// Name of the key for retrieve database connection string. 24 | /// 25 | public const string DatabaseConnectionStringKey = "InformaticsGatewayDatabase"; 26 | 27 | public const string DatabaseNameKey = "DatabaseName"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Repositories/IMonaiServiceLocator.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 System.Collections.Generic; 18 | using Monai.Deploy.InformaticsGateway.Api.Rest; 19 | using Monai.Deploy.InformaticsGateway.Services.Common; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Repositories 22 | { 23 | public interface IMonaiServiceLocator 24 | { 25 | IEnumerable GetMonaiServices(); 26 | 27 | Dictionary GetServiceStatus(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /docker-compose/configs/elasticsearch.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | 17 | ## Default Elasticsearch configuration from Elasticsearch base image. 18 | ## https://github.com/elastic/elasticsearch/blob/main/distribution/docker/src/docker/config/elasticsearch.yml 19 | # 20 | cluster.name: "docker-cluster" 21 | network.host: 0.0.0.0 22 | 23 | ## X-Pack settings 24 | ## see https://www.elastic.co/guide/en/elasticsearch/reference/current/security-settings.html 25 | # 26 | xpack.security.enabled: false 27 | xpack.license.self_generated.type: basic 28 | -------------------------------------------------------------------------------- /tests/Integration.Test/Common/FhirMessages.cs: -------------------------------------------------------------------------------- 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 static Monai.Deploy.InformaticsGateway.Integration.Test.StepDefinitions.FhirDefinitions; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Integration.Test.Common 20 | { 21 | internal class FhirMessages 22 | { 23 | public string MediaType { get; set; } 24 | public FileFormat FileFormat { get; set; } 25 | public Dictionary Files { get; set; } = new Dictionary(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /docker-compose/configs/kibana.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | --- 16 | ## Default Kibana configuration from Kibana base image. 17 | ## https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/templates/kibana_yml.template.ts 18 | # 19 | server.name: kibana 20 | server.host: 0.0.0.0 21 | elasticsearch.hosts: [ "http://elasticsearch:9200" ] 22 | monitoring.ui.container.elasticsearch.enabled: true 23 | 24 | ## X-Pack security credentials 25 | # 26 | elasticsearch.username: kibana_system 27 | elasticsearch.password: monai 28 | -------------------------------------------------------------------------------- /src/Configuration/HttpEndpointSettings.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2023 MONAI Consortium 3 | * Copyright 2019-2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using Microsoft.Extensions.Configuration; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Configuration 21 | { 22 | public class HttpEndpointSettings 23 | { 24 | [ConfigurationKeyName("defaultPageSize")] 25 | public int DefaultPageSize { get; set; } = 10; 26 | 27 | [ConfigurationKeyName("maxPageSize")] 28 | public int MaxPageSize { get; set; } = 10; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Database/Api/DatabaseException.cs: -------------------------------------------------------------------------------- 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 | namespace Monai.Deploy.InformaticsGateway.Database.Api 18 | { 19 | public class DatabaseException : Exception 20 | { 21 | public DatabaseException() 22 | { 23 | } 24 | 25 | public DatabaseException(string? message) : base(message) 26 | { 27 | } 28 | 29 | public DatabaseException(string? message, Exception? innerException) : base(message, innerException) 30 | { 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Common/PlugInInitializationException.cs: -------------------------------------------------------------------------------- 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 | using System; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Common 20 | { 21 | public class PlugInInitializationException : Exception 22 | { 23 | public PlugInInitializationException(string message) : base(message) 24 | { 25 | } 26 | 27 | public PlugInInitializationException(string message, Exception innerException) : base(message, innerException) 28 | { 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Api/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 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 | // This file is used by Code Analysis to maintain SuppressMessage 18 | // attributes that are applied to this project. 19 | // Project-level suppressions either have no target or are given 20 | // a specific target and scoped to a namespace, type, member, etc. 21 | 22 | using System.Diagnostics.CodeAnalysis; 23 | 24 | [assembly: SuppressMessage("Sonar Code Smell", "S2094: Remove this empty class, write its code or make it an \"interface\"", Justification = "placeholder code")] 25 | -------------------------------------------------------------------------------- /src/Api/Rest/InferenceStatusResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | namespace Monai.Deploy.InformaticsGateway.Api.Rest 19 | { 20 | /// 21 | /// Response message of a inference status query. 22 | /// 23 | public class InferenceStatusResponse 24 | { 25 | /// 26 | /// Gets or set the transaction ID of a request. 27 | /// 28 | public string TransactionId { get; set; } = default!; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/Common/ITcpListenerFactory.cs: -------------------------------------------------------------------------------- 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 System.Net; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Services.Common 20 | { 21 | internal interface ITcpListenerFactory 22 | { 23 | ITcpListener CreateTcpListener(IPAddress ipaddress, int port); 24 | } 25 | 26 | internal class TcpListenerFactory : ITcpListenerFactory 27 | { 28 | public ITcpListener CreateTcpListener(IPAddress ipaddress, int port) => new TcpListener(ipaddress, port); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Api/PlugIns/PluginNameAttribute.cs: -------------------------------------------------------------------------------- 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 | using System; 18 | using Ardalis.GuardClauses; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Api.PlugIns 21 | { 22 | [AttributeUsage(AttributeTargets.Class)] 23 | public class PlugInNameAttribute : Attribute 24 | { 25 | public string Name { get; set; } 26 | 27 | public PlugInNameAttribute(string name) 28 | { 29 | Guard.Against.NullOrWhiteSpace(name, nameof(name)); 30 | 31 | Name = name; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Api/Rest/InferenceRequestResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | namespace Monai.Deploy.InformaticsGateway.Api.Rest 19 | { 20 | /// 21 | /// Response message of a successful inference request. 22 | /// 23 | public class InferenceRequestResponse 24 | { 25 | /// 26 | /// Gets or sets the original request transaction ID. 27 | /// 28 | public string TransactionId { get; set; } = default!; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/DicomWebClient/API/DicomWebResponse.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022 MONAI Consortium 3 | * Copyright 2019-2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System.Net; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.DicomWeb.Client.API 21 | { 22 | public class DicomWebResponse 23 | { 24 | public HttpStatusCode StatusCode { get; } 25 | public T Result { get; } 26 | 27 | public DicomWebResponse(HttpStatusCode statusCode, T result) 28 | { 29 | StatusCode = statusCode; 30 | Result = result; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Common/ServiceException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-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 | using System; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Common 20 | { 21 | public class ServiceException : Exception 22 | { 23 | public ServiceException(string message) : base(message) 24 | { 25 | } 26 | 27 | public ServiceException(string message, Exception innerException) : base(message, innerException) 28 | { 29 | } 30 | 31 | public ServiceException() 32 | { 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/Fhir/IFHirRequestReader.cs: -------------------------------------------------------------------------------- 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 System.Threading; 18 | using System.Threading.Tasks; 19 | using Microsoft.AspNetCore.Http; 20 | using Microsoft.Net.Http.Headers; 21 | 22 | namespace Monai.Deploy.InformaticsGateway.Services.Fhir 23 | { 24 | internal interface IFHirRequestReader 25 | { 26 | Task GetContentAsync(HttpRequest request, string correlationId, string resourceType, MediaTypeHeaderValue mediaTypeHeaderValue, CancellationToken cancellationToken); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/CLI/Services/ConsoleRegion.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 System; 18 | using System.CommandLine.Rendering; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.CLI.Services 21 | { 22 | public interface IConsoleRegion 23 | { 24 | Region GetDefaultConsoleRegion(); 25 | } 26 | 27 | internal class ConsoleRegion : IConsoleRegion 28 | { 29 | public Region GetDefaultConsoleRegion() 30 | { 31 | return new Region(0, 0, Console.WindowWidth, Console.WindowHeight, false); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Plug-ins/RemoteAppExecution/Database/MongoDb/MigrationManager.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2022-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 | using Microsoft.Extensions.Hosting; 18 | using Monai.Deploy.InformaticsGateway.Database.Api; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.PlugIns.RemoteAppExecution.Database.MongoDb 21 | { 22 | public class MigrationManager : IDatabaseMigrationManagerForPlugIns 23 | { 24 | public IHost Migrate(IHost host) 25 | { 26 | RemoteAppExecutionConfiguration.Configure(); 27 | return host; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /NuGetDefense.json: -------------------------------------------------------------------------------- 1 | { 2 | "WarnOnly": false, 3 | "VulnerabilityReports": { 4 | "OutputTextReport": true 5 | }, 6 | "CheckTransitiveDependencies": true, 7 | "CheckReferencedProjects": false, 8 | "ErrorSettings": { 9 | "ErrorSeverityThreshold": "any", 10 | "Cvss3Threshold": -1, 11 | "IgnoredPackages": [ 12 | { 13 | "Id": "NugetDefense" 14 | } 15 | ], 16 | "IgnoredCvEs": [], 17 | "AllowedPackages": [], 18 | "WhiteListedPackages": [], 19 | "BlockedPackages": [], 20 | "BlacklistedPackages": [] 21 | }, 22 | "OssIndex": { 23 | "ApiToken": "OSSINDEXAPI_TOKEN", 24 | "Username": "OSSINDEXAPI_USERNAME", 25 | "Enabled": true, 26 | "BreakIfCannotRun": false 27 | }, 28 | "GitHubAdvisoryDatabase": { 29 | "ApiToken": "", 30 | "Username": "", 31 | "Enabled": false, 32 | "BreakIfCannotRun": false 33 | }, 34 | "NVD": { 35 | "SelfUpdate": false, 36 | "TimeoutInSeconds": 15, 37 | "Enabled": true, 38 | "BreakIfCannotRun": true 39 | }, 40 | "SensitivePackages": [] 41 | } -------------------------------------------------------------------------------- /src/CLI/Commands/ConfigurationException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 System; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.CLI 20 | { 21 | public class ConfigurationException : Exception 22 | { 23 | private ConfigurationException() 24 | { 25 | } 26 | 27 | public ConfigurationException(string message) : base(message) 28 | { 29 | } 30 | 31 | public ConfigurationException(string message, Exception innerException) : base(message, innerException) 32 | { 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Configuration/DataExportConfiguration.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using Microsoft.Extensions.Configuration; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Configuration 21 | { 22 | public class DataExportConfiguration 23 | { 24 | /// 25 | /// Gets or sets retry configuration for data export agents. 26 | /// 27 | [ConfigurationKeyName("retries")] 28 | public RetryConfiguration Retries { get; set; } = new RetryConfiguration(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/DicomWeb/IStowRequestReader.cs: -------------------------------------------------------------------------------- 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 System.Collections.Generic; 18 | using System.IO; 19 | using System.Threading; 20 | using System.Threading.Tasks; 21 | using Microsoft.AspNetCore.Http; 22 | using Microsoft.Net.Http.Headers; 23 | 24 | namespace Monai.Deploy.InformaticsGateway.Services.DicomWeb 25 | { 26 | internal interface IStowRequestReader 27 | { 28 | Task> GetStreams(HttpRequest request, MediaTypeHeaderValue mediaTypeHeaderValue, CancellationToken cancellationToken); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/HealthLevel7/Hl7SendException.cs: -------------------------------------------------------------------------------- 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 | using System; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Services.HealthLevel7 20 | { 21 | internal class Hl7SendException : Exception 22 | { 23 | public Hl7SendException() 24 | { 25 | } 26 | 27 | public Hl7SendException(string message) : base(message) 28 | { 29 | } 30 | 31 | public Hl7SendException(string message, Exception innerException) : base(message, innerException) 32 | { 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Common/IDicomToolkit.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System.IO; 19 | using System.Threading.Tasks; 20 | using FellowOakDicom; 21 | 22 | namespace Monai.Deploy.InformaticsGateway.Common 23 | { 24 | public interface IDicomToolkit 25 | { 26 | Task OpenAsync(Stream stream, FileReadOption fileReadOption = FileReadOption.Default); 27 | 28 | DicomFile Load(byte[] fileContent); 29 | 30 | StudySerieSopUids GetStudySeriesSopInstanceUids(DicomFile dicomFile); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Common/StudySerieSopUids.cs: -------------------------------------------------------------------------------- 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 | namespace Monai.Deploy.InformaticsGateway.Common 18 | { 19 | public record StudySerieSopUids 20 | { 21 | public string SopClassUid { get; set; } = string.Empty; 22 | public string StudyInstanceUid { get; set; } = string.Empty; 23 | public string SeriesInstanceUid { get; set; } = string.Empty; 24 | public string SopInstanceUid { get; set; } = string.Empty; 25 | public string Identifier { get => $"{StudyInstanceUid}/{SeriesInstanceUid}/{SopInstanceUid}"; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/Export/ExternalAppExeception.cs: -------------------------------------------------------------------------------- 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 | using System; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Services.Export 20 | { 21 | public class ExternalAppExeception : Exception 22 | { 23 | public ExternalAppExeception() 24 | { 25 | } 26 | 27 | public ExternalAppExeception(string message) : base(message) 28 | { 29 | } 30 | 31 | public ExternalAppExeception(string message, Exception innerException) : base(message, innerException) 32 | { 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/DicomWeb/ConvertStreamException.cs: -------------------------------------------------------------------------------- 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 System; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Services.DicomWeb 20 | { 21 | public class ConvertStreamException : Exception 22 | { 23 | public ConvertStreamException() 24 | { 25 | } 26 | 27 | public ConvertStreamException(string message) : base(message) 28 | { 29 | } 30 | 31 | public ConvertStreamException(string message, Exception innerException) : base(message, innerException) 32 | { 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Database/Api/DatabaseRegistrationBase.cs: -------------------------------------------------------------------------------- 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 | using Microsoft.Extensions.Configuration; 18 | using Microsoft.Extensions.DependencyInjection; 19 | using Microsoft.Extensions.Logging; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Database.Api 22 | { 23 | public abstract class DatabaseRegistrationBase 24 | { 25 | public abstract IServiceCollection Configure(IServiceCollection services, DatabaseType databaseType, IConfigurationSection? connectionstringConfigurationSection, IConfigurationSection? pluginsConfigurationSection, ILoggerFactory loggerFactory); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Database/EntityFramework/Migrations/20230327190827_R3_0.3.15.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | 3 | #nullable disable 4 | 5 | namespace Monai.Deploy.InformaticsGateway.Database.Migrations 6 | { 7 | public partial class R3_0315 : Migration 8 | { 9 | protected override void Up(MigrationBuilder migrationBuilder) 10 | { 11 | migrationBuilder.AddColumn( 12 | name: "DateTimeUpdated", 13 | table: "MonaiApplicationEntities", 14 | type: "TEXT", 15 | nullable: true); 16 | 17 | migrationBuilder.AddColumn( 18 | name: "UpdatedBy", 19 | table: "MonaiApplicationEntities", 20 | type: "TEXT", 21 | nullable: true); 22 | } 23 | 24 | protected override void Down(MigrationBuilder migrationBuilder) 25 | { 26 | migrationBuilder.DropColumn( 27 | name: "DateTimeUpdated", 28 | table: "MonaiApplicationEntities"); 29 | 30 | migrationBuilder.DropColumn( 31 | name: "UpdatedBy", 32 | table: "MonaiApplicationEntities"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Common/FileUploadException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Common 21 | { 22 | public class FileUploadException : Exception 23 | { 24 | public FileUploadException() 25 | { 26 | } 27 | 28 | public FileUploadException(string message) : base(message) 29 | { 30 | } 31 | 32 | public FileUploadException(string message, Exception innerException) : base(message, innerException) 33 | { 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Common/ObjectExistsException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Common 21 | { 22 | public class ObjectExistsException : Exception 23 | { 24 | public ObjectExistsException() 25 | { 26 | } 27 | 28 | public ObjectExistsException(string message) : base(message) 29 | { 30 | } 31 | 32 | public ObjectExistsException(string message, Exception innerException) : base(message, innerException) 33 | { 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/Integration.Test/Features/ExternalApp.feature: -------------------------------------------------------------------------------- 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 | # @ignored 17 | 18 | Feature: External App Execution 19 | 20 | This feature tests the External App Execution for saving and 21 | re-identifying data sent and received by the MIG respectively. 22 | 23 | @messaging_workflow_request @messaging 24 | Scenario: End-to-end test of external App scp incomming 25 | Given a externalApp study that is exported to the test host 26 | When the externalApp study is received and sent back to Informatics Gateway with 1 message 27 | Then ensure the original externalApp study and the received study are the same 28 | -------------------------------------------------------------------------------- /src/Api/Test/LoggingDataDictionaryTest.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 Xunit; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Api.Test 20 | { 21 | public class LoggingDataDictionaryTest 22 | { 23 | [Fact(DisplayName = "ToString")] 24 | public void ToStringOverride() 25 | { 26 | var input = new LoggingDataDictionary 27 | { 28 | { "A", "1" }, 29 | { "B", "2" }, 30 | { "C", "3" } 31 | }; 32 | 33 | Assert.Equal("A=1, B=2, C=3", input.ToString()); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/Integration.Test/study.json: -------------------------------------------------------------------------------- 1 | { 2 | "MR": { 3 | "SeriesMin": 1, 4 | "SeriesMax": 2, 5 | "InstanceMin": 64, 6 | "InstanceMax": 128, 7 | "SizeMin": 0.36, 8 | "SizeMax": 2 9 | }, 10 | "CT": { 11 | "SeriesMin": 1, 12 | "SeriesMax": 2, 13 | "InstanceMin": 50, 14 | "InstanceMax": 300, 15 | "SizeMin": 0.5, 16 | "SizeMax": 1 17 | }, 18 | "MG": { 19 | "SeriesMin": 4, 20 | "SeriesMax": 8, 21 | "InstanceMin": 1, 22 | "InstanceMax": 1, 23 | "SizeMin": 5, 24 | "SizeMax": 75 25 | }, 26 | "TOMO": { 27 | "SeriesMin": 4, 28 | "SeriesMax": 8, 29 | "InstanceMin": 1, 30 | "InstanceMax": 1, 31 | "SizeMin": 300, 32 | "SizeMax": 750 33 | }, 34 | "US": { 35 | "SeriesMin": 1, 36 | "SeriesMax": 4, 37 | "InstanceMin": 1, 38 | "InstanceMax": 1, 39 | "SizeMin": 25, 40 | "SizeMax": 100 41 | }, 42 | "Pathology": { 43 | "SeriesMin": 1, 44 | "SeriesMax": 4, 45 | "InstanceMin": 1, 46 | "InstanceMax": 1, 47 | "SizeMin": 10000, 48 | "SizeMax": 20000 49 | }, 50 | "Tiny": { 51 | "SeriesMin": 1, 52 | "SeriesMax": 1, 53 | "InstanceMin": 1, 54 | "InstanceMax": 1, 55 | "SizeMin": 1, 56 | "SizeMax": 2 57 | } 58 | } -------------------------------------------------------------------------------- /src/Database/MongoDB/Configurations/ExternalAppDetailsConfiguration.cs: -------------------------------------------------------------------------------- 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 | using Monai.Deploy.InformaticsGateway.Api.Models; 18 | using MongoDB.Bson.Serialization; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Database.MongoDB.Configurations 21 | { 22 | internal static class ExternalAppDetailsConfiguration 23 | { 24 | public static void Configure() 25 | { 26 | BsonClassMap.RegisterClassMap(j => 27 | { 28 | j.AutoMap(); 29 | j.SetIgnoreExtraElements(true); 30 | }); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Configuration/DatabaseOptions.cs: -------------------------------------------------------------------------------- 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.InformaticsGateway.Configuration 20 | { 21 | public class DatabaseOptions 22 | { 23 | [ConfigurationKeyName("DatabaseName")] 24 | public string DatabaseName { get; set; } = string.Empty; 25 | 26 | /// 27 | /// Gets or sets retry options relate to reading/writing to the database. 28 | /// 29 | [ConfigurationKeyName("retries")] 30 | public RetryConfiguration Retries { get; set; } = new RetryConfiguration(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Database/MongoDB/Configurations/SourceApplicationEntityConfiguration.cs: -------------------------------------------------------------------------------- 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 Monai.Deploy.InformaticsGateway.Api; 18 | using MongoDB.Bson.Serialization; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Database.MongoDB.Configurations 21 | { 22 | internal static class SourceApplicationEntityConfiguration 23 | { 24 | public static void Configure() 25 | { 26 | BsonClassMap.RegisterClassMap(j => 27 | { 28 | j.AutoMap(); 29 | j.SetIgnoreExtraElements(true); 30 | }); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Common/ApplicationEntityNotFoundException.cs: -------------------------------------------------------------------------------- 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 | using System; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Common 20 | { 21 | public class ApplicationEntityNotFoundException : Exception 22 | { 23 | public ApplicationEntityNotFoundException() 24 | { 25 | } 26 | 27 | public ApplicationEntityNotFoundException(string message) : base(message) 28 | { 29 | } 30 | 31 | public ApplicationEntityNotFoundException(string message, Exception innerException) : base(message, innerException) 32 | { 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Test/ProgramTest.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 | using System; 18 | using xRetry; 19 | using Xunit; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Test 22 | { 23 | public class ProgramTest 24 | { 25 | [RetryFact(maxRetries: 10, delayBetweenRetriesMs: 500, DisplayName = "Program - runs properly")] 26 | public void Startup_RunsProperly() 27 | { 28 | var workingDirectory = Environment.CurrentDirectory; 29 | var host = Program.CreateHostBuilder(System.Array.Empty()).Build(); 30 | 31 | Assert.NotNull(host); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Api/Mllp/MllpClientResult.cs: -------------------------------------------------------------------------------- 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 System; 18 | using System.Collections.Generic; 19 | using HL7.Dotnetcore; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Api.Mllp 22 | { 23 | public class MllpClientResult 24 | { 25 | public IList Messages { get; } 26 | public AggregateException? AggregateException { get; } 27 | 28 | public MllpClientResult(IList messages, AggregateException? aggregateException) 29 | { 30 | Messages = messages ?? new List(); 31 | AggregateException = aggregateException; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Database/MongoDB/Configurations/VirtualApplicationEntityConfiguration.cs: -------------------------------------------------------------------------------- 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 | using Monai.Deploy.InformaticsGateway.Api; 18 | using MongoDB.Bson.Serialization; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Database.MongoDB.Configurations 21 | { 22 | internal static class VirtualApplicationEntityConfiguration 23 | { 24 | public static void Configure() 25 | { 26 | BsonClassMap.RegisterClassMap(j => 27 | { 28 | j.AutoMap(); 29 | j.SetIgnoreExtraElements(true); 30 | }); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Test/Plug-ins/Monai.Deploy.InformaticsGateway.Test.PlugIns.csproj: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | Monai.Deploy.InformaticsGateway.Test.PlugIns 19 | Monai.Deploy.InformaticsGateway.Test.PlugIns 20 | net8.0 21 | enable 22 | enable 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/CLI/Services/EmbeddedResource.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 System.IO; 18 | using Ardalis.GuardClauses; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.CLI.Services 21 | { 22 | public interface IEmbeddedResource 23 | { 24 | Stream? GetManifestResourceStream(string name); 25 | } 26 | 27 | public class EmbeddedResource : IEmbeddedResource 28 | { 29 | public Stream? GetManifestResourceStream(string name) 30 | { 31 | Guard.Against.NullOrWhiteSpace(name, nameof(name)); 32 | 33 | return GetType().Assembly.GetManifestResourceStream(name); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Common/FileSystemExtensions.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System.IO.Abstractions; 19 | using Ardalis.GuardClauses; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Common 22 | { 23 | public static class FileSystemExtensions 24 | { 25 | public static void CreateDirectoryIfNotExists(this IDirectory directory, string path) 26 | { 27 | Guard.Against.NullOrWhiteSpace(path, nameof(path)); 28 | if (!directory.Exists(path)) 29 | { 30 | directory.CreateDirectory(path); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Configuration/DicomJsonOptions.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | namespace Monai.Deploy.InformaticsGateway.Configuration 19 | { 20 | public enum DicomJsonOptions 21 | { 22 | /// 23 | /// Do not write DICOM to JSON 24 | /// 25 | None, 26 | 27 | /// 28 | /// Writes DICOM to JSON exception VR types of OB, OD, OF, OL, OV, OW, and UN. 29 | /// 30 | IgnoreOthers, 31 | 32 | /// 33 | /// Writes DICOM to JSON 34 | /// 35 | Complete 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | ### Description 11 | A clear and concise description of what the bug is. 12 | 13 | ### Steps to reproduce 14 | Please share a clear and concise description of the problem. 15 | 1. Go to '...' 16 | 2. Install '....' 17 | 3. Run commands '....' 18 | ... 19 | 20 | ### Expected behavior 21 | A clear and concise description of what you expected to happen. 22 | 23 | ### Actual behavior 24 | A clear and concise description of what actually happened. 25 | 26 | ### Configuration 27 | 28 | * Informatics Gateway version/commit: 29 | * OS and version (distro if applicable): 30 | * Kubernetes version (if applicable): 31 | * Docker version (if applicable): 32 | * Installation source (NGC, Dockerhub, or something else): 33 | * Hardware configuration (CPU, GPU, memory, storage, etc...): 34 | 35 | ### Regression? 36 | Did this work in the previous build or release of the Informatics Gateway? If you can try a previous release or build to find out, that can help us narrow down the problem. If you don't know, that's OK. 37 | 38 | ### Other information 39 | (Please attach any logs available and remember to anonymize any PHI before sharing). 40 | -------------------------------------------------------------------------------- /src/Database/Api/IDatabaseMigrationManager.cs: -------------------------------------------------------------------------------- 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.Hosting; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Database.Api 20 | { 21 | /// 22 | /// Interface for the main application to migrate and configure databases 23 | /// 24 | public interface IDatabaseMigrationManager 25 | { 26 | IHost Migrate(IHost host); 27 | } 28 | 29 | /// 30 | /// Interface for the plug-ins to migrate and configure databases 31 | /// 32 | public interface IDatabaseMigrationManagerForPlugIns 33 | { 34 | IHost Migrate(IHost host); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Common/DestinationNotSuppliedException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2023 MONAI Consortium 3 | * Copyright 2019-2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Common 21 | { 22 | public class DestinationNotSuppliedException : Exception 23 | { 24 | public DestinationNotSuppliedException() 25 | { 26 | } 27 | 28 | public DestinationNotSuppliedException(string message) : base(message) 29 | { 30 | } 31 | 32 | public DestinationNotSuppliedException(string message, Exception innerException) : base(message, innerException) 33 | { 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/DicomWebClient/Third-party/Microsoft/MultipartMemoryStreamProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. 3 | 4 | using System.IO; 5 | using System.Net.Http.Headers; 6 | using Ardalis.GuardClauses; 7 | 8 | namespace System.Net.Http 9 | { 10 | /// 11 | /// Provides a implementation that returns a instance. 12 | /// This facilitates deserialization or other manipulation of the contents in memory. 13 | /// 14 | public class MultipartMemoryStreamProvider : MultipartStreamProvider 15 | { 16 | /// 17 | /// This implementation returns a instance. 18 | /// This facilitates deserialization or other manipulation of the contents in memory. 19 | /// 20 | public override Stream GetStream(HttpContent parent, HttpContentHeaders headers) 21 | { 22 | Guard.Against.Null(parent, nameof(parent)); 23 | Guard.Against.Null(headers, nameof(headers)); 24 | 25 | return new MemoryStream(); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Database/MongoDB/Configurations/DicomAssociationInfoConfiguration.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using Monai.Deploy.InformaticsGateway.Api.Models; 19 | using MongoDB.Bson.Serialization; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Database.MongoDB.Configurations 22 | { 23 | internal static class DicomAssociationInfoConfiguration 24 | { 25 | public static void Configure() 26 | { 27 | BsonClassMap.RegisterClassMap(j => 28 | { 29 | j.AutoMap(); 30 | j.SetIgnoreExtraElements(true); 31 | }); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Database/MongoDB/Configurations/HL7DestinationEntityConfiguration.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using Monai.Deploy.InformaticsGateway.Api.Models; 19 | using MongoDB.Bson.Serialization; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Database.MongoDB.Configurations 22 | { 23 | internal static class HL7DestinationEntityConfiguration 24 | { 25 | public static void Configure() 26 | { 27 | BsonClassMap.RegisterClassMap(j => 28 | { 29 | j.AutoMap(); 30 | j.SetIgnoreExtraElements(true); 31 | }); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Database/MongoDB/Configurations/MonaiApplicationEntityConfiguration.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using Monai.Deploy.InformaticsGateway.Api.Models; 19 | using MongoDB.Bson.Serialization; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Database.MongoDB.Configurations 22 | { 23 | internal static class MonaiApplicationEntityConfiguration 24 | { 25 | public static void Configure() 26 | { 27 | BsonClassMap.RegisterClassMap(j => 28 | { 29 | j.AutoMap(); 30 | j.SetIgnoreExtraElements(true); 31 | }); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /.github/.gitversion.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021-2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | workflow: GitHubFlow/v1 16 | assembly-versioning-scheme: MajorMinorPatchTag 17 | assembly-file-versioning-scheme: MajorMinorPatchTag 18 | mode: ContinuousDelivery 19 | branches: 20 | main: 21 | label: '' 22 | regex: ^main$ 23 | release: 24 | label: rc 25 | regex: ^releases?[/-](?.+) 26 | develop: 27 | label: beta 28 | increment: Patch 29 | regex: ^develop$ 30 | feature: 31 | label: alpha.{BranchName} 32 | regex: ^features?[/-](?.+) 33 | pull-request: 34 | label: pr 35 | increment: Patch 36 | regex: ^(pull|pull\-requests|pr)[/-] 37 | 38 | ignore: 39 | sha: [] 40 | merge-message-formats: {} 41 | -------------------------------------------------------------------------------- /src/DicomWebClient/CLI/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 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 | // This file is used by Code Analysis to maintain SuppressMessage 18 | // attributes that are applied to this project. 19 | // Project-level suppressions either have no target or are given 20 | // a specific target and scoped to a namespace, type, member, etc. 21 | 22 | using System.Diagnostics.CodeAnalysis; 23 | 24 | [assembly: SuppressMessage("Design", "CA1054:URI-like parameters should not be strings", Justification = "User input from CLI", Scope = "module")] 25 | [assembly: SuppressMessage("Sonar Code Smell", "S2094: Remove this empty class, write its code or make it an \"interface\"", Justification = "placeholder code")] 26 | -------------------------------------------------------------------------------- /src/Database/MongoDB/Configurations/StorageMetadataWrapperEntityConfiguration.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using Monai.Deploy.InformaticsGateway.Database.Api; 19 | using MongoDB.Bson.Serialization; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Database.MongoDB.Configurations 22 | { 23 | internal static class StorageMetadataWrapperEntityConfiguration 24 | { 25 | public static void Configure() 26 | { 27 | BsonClassMap.RegisterClassMap(j => 28 | { 29 | j.AutoMap(); 30 | j.SetIgnoreExtraElements(true); 31 | }); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Api/LoggingDataDictionary.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System.Collections.Generic; 19 | using System.Globalization; 20 | using System.Linq; 21 | 22 | namespace Monai.Deploy.InformaticsGateway.Api 23 | { 24 | public class LoggingDataDictionary : Dictionary where TKey : notnull 25 | { 26 | public LoggingDataDictionary() 27 | { 28 | } 29 | 30 | public override string ToString() 31 | { 32 | var pairs = this.Select(x => string.Format(CultureInfo.InvariantCulture, "{0}={1}", x.Key, x.Value)); 33 | return string.Join(", ", pairs); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Database/MongoDB/Configurations/DestinationApplicationEntityConfiguration.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using Monai.Deploy.InformaticsGateway.Api.Models; 19 | using MongoDB.Bson.Serialization; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Database.MongoDB.Configurations 22 | { 23 | internal static class DestinationApplicationEntityConfiguration 24 | { 25 | public static void Configure() 26 | { 27 | BsonClassMap.RegisterClassMap(j => 28 | { 29 | j.AutoMap(); 30 | j.SetIgnoreExtraElements(true); 31 | }); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/HealthLevel7/Resources.cs: -------------------------------------------------------------------------------- 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 | namespace Monai.Deploy.InformaticsGateway.Services.HealthLevel7 18 | { 19 | internal static class Resources 20 | { 21 | public const int AcceptAcknowledgementType = 15; 22 | 23 | public const char AsciiVT = (char)0x0B; 24 | public const char AsciiFS = (char)0x1C; 25 | public const char AcsiiCR = (char)13; 26 | 27 | public const string AcknowledgmentTypeNever = "NE"; 28 | public const string AcknowledgmentTypeError = "ER"; 29 | public const string AcknowledgmentTypeSuccessful = "SU"; 30 | 31 | public const string MessageHeaderSegment = "MSH"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Api/Rest/InferenceRequestException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Api.Rest 21 | { 22 | /// 23 | /// Inference request exception. 24 | /// 25 | public class InferenceRequestException : Exception 26 | { 27 | public InferenceRequestException() 28 | { 29 | } 30 | 31 | public InferenceRequestException(string message) : base(message) 32 | { 33 | } 34 | 35 | public InferenceRequestException(string message, Exception innerException) : base(message, innerException) 36 | { 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/Common/INetworkStream.cs: -------------------------------------------------------------------------------- 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 System; 18 | using System.Threading; 19 | using System.Threading.Tasks; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Services.Common 22 | { 23 | internal interface INetworkStream : IDisposable 24 | { 25 | int ReadTimeout { get; set; } 26 | int WriteTimeout { get; set; } 27 | 28 | ValueTask WriteAsync(ReadOnlyMemory ackData, CancellationToken cancellationToken = default); 29 | 30 | Task FlushAsync(CancellationToken cancellationToken = default); 31 | 32 | ValueTask ReadAsync(Memory messageBuffer, CancellationToken cancellationToken = default); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Client/Services/ServiceBase.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 System; 18 | using System.Net.Http; 19 | using Microsoft.Extensions.Logging; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Client.Services 22 | { 23 | internal abstract class ServiceBase 24 | { 25 | protected readonly HttpClient HttpClient; 26 | protected readonly ILogger Logger; 27 | protected string RequestServicePrefix { get; private set; } = string.Empty; 28 | 29 | protected ServiceBase(HttpClient httpClient, ILogger logger = null) 30 | { 31 | HttpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); 32 | Logger = logger; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Api/Storage/MongoDBEntityBase.cs: -------------------------------------------------------------------------------- 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 System; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Api.Storage 20 | { 21 | public abstract class MongoDBEntityBase 22 | { 23 | /// 24 | /// Gets or set the MongoDB associated identifier. 25 | /// 26 | public Guid Id { get; set; } 27 | 28 | /// 29 | /// Gets or set the date and time the objects first created. 30 | /// 31 | public DateTime DateTimeCreated { get; set; } 32 | 33 | protected MongoDBEntityBase() 34 | { 35 | Id = Guid.NewGuid(); 36 | DateTimeCreated = DateTime.UtcNow; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/DicomWebClient/API/DicomWebClientException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2023 MONAI Consortium 3 | * Copyright 2019-2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | using System.Net; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.DicomWeb.Client.API 22 | { 23 | public class DicomWebClientException : Exception 24 | { 25 | public HttpStatusCode? StatusCode { get; } 26 | public string ResponseMessage { get; } 27 | 28 | public DicomWebClientException(HttpStatusCode? statusCode, string responseMessage, Exception innerException) 29 | : base(responseMessage, innerException) 30 | { 31 | StatusCode = statusCode; 32 | ResponseMessage = responseMessage; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/CLI/ControlException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 System; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.CLI 20 | { 21 | public class ControlException : Exception 22 | { 23 | public int ErrorCode { get; } 24 | 25 | protected ControlException() 26 | { 27 | } 28 | 29 | protected ControlException(string message) : base(message) 30 | { 31 | } 32 | 33 | protected ControlException(string message, Exception innerException) : base(message, innerException) 34 | { 35 | } 36 | 37 | public ControlException(int errorCode, string message) : base(message) 38 | { 39 | ErrorCode = errorCode; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Configuration/ConfigurationException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Configuration 21 | { 22 | /// 23 | /// Represents an exception based upon invalid configuration. 24 | /// 25 | 26 | public class ConfigurationException : Exception 27 | { 28 | public ConfigurationException() 29 | { 30 | } 31 | 32 | public ConfigurationException(string message) : base(message) 33 | { 34 | } 35 | 36 | public ConfigurationException(string message, Exception innerException) : base(message, innerException) 37 | { 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Common/FileMoveException.cs: -------------------------------------------------------------------------------- 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 System; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Common 20 | { 21 | public class FileMoveException : Exception 22 | { 23 | public FileMoveException() 24 | { 25 | } 26 | 27 | public FileMoveException(string message) : base(message) 28 | { 29 | } 30 | 31 | public FileMoveException(string message, Exception innerException) : base(message, innerException) 32 | { 33 | } 34 | 35 | public FileMoveException(string source, string destination, Exception ex) 36 | : this($"Exception moving file from {source} to {destination}.", ex) 37 | { 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Plug-ins/RemoteAppExecution/Database/MongoDb/RemoteAppExecutionConfiguration.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using MongoDB.Bson.Serialization; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.PlugIns.RemoteAppExecution.Database.MongoDb 21 | { 22 | internal static class RemoteAppExecutionConfiguration 23 | { 24 | public static void Configure() 25 | { 26 | BsonClassMap.RegisterClassMap(j => 27 | { 28 | j.AutoMap(); 29 | j.SetIdMember(j.GetMemberMap(c => c.Id)); 30 | j.MapIdMember(c => c.Id); 31 | j.SetIgnoreExtraElements(true); 32 | }); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/Integration.Test/Features/HL7Export.feature: -------------------------------------------------------------------------------- 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 | # @ignored 17 | 18 | Feature: HL7 Export 19 | 20 | This feature tests the Export Hl7. 21 | 22 | @messaging_workflow_request @messaging 23 | Scenario: End-to-end test of HL7 exporting 24 | Given a HL7 message that is exported to the test host 25 | When the HL7 Export message is received with 6 messages acked true 26 | Then ensure that exportcomplete messages are sent with success 27 | 28 | 29 | Scenario: End-to-end test of HL7 exporting with no Ack 30 | Given a HL7 message that is exported to the test host 31 | When the HL7 Export message is received with 6 messages acked false 32 | Then ensure that exportcomplete messages are sent with failure 33 | -------------------------------------------------------------------------------- /src/Database/Api/Repositories/IExternalAppDeatilsRepository.cs: -------------------------------------------------------------------------------- 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 Monai.Deploy.InformaticsGateway.Api.Models; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Database.Api.Repositories 20 | { 21 | public interface IExternalAppDetailsRepository 22 | { 23 | Task AddAsync(ExternalAppDetails details, CancellationToken cancellationToken); 24 | 25 | Task> GetAsync(string studyInstanceId, CancellationToken cancellationToken); 26 | 27 | Task GetByPatientIdOutboundAsync(string patientId, CancellationToken cancellationToken); 28 | 29 | Task GetByStudyIdOutboundAsync(string studyInstanceId, CancellationToken cancellationToken); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Api/PlugIns/IInputDataPlugin.cs: -------------------------------------------------------------------------------- 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 | using System.Threading.Tasks; 18 | using FellowOakDicom; 19 | using Monai.Deploy.InformaticsGateway.Api.Storage; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Api.PlugIns 22 | { 23 | /// 24 | /// IInputDataPlugIn enables lightweight data processing over incoming data received from supported data ingestion 25 | /// services. 26 | /// Refer to for additional details. 27 | /// 28 | public interface IInputDataPlugIn 29 | { 30 | string Name { get; } 31 | 32 | Task<(DicomFile dicomFile, FileStorageMetadata fileMetadata)> ExecuteAsync(DicomFile dicomFile, FileStorageMetadata fileMetadata); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/UriService/IUriService.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2023 MONAI Consortium 3 | * Copyright 2019-2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using Monai.Deploy.InformaticsGateway.Services.Common.Pagination; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Services.UriService 21 | { 22 | /// 23 | /// Uri Service. 24 | /// 25 | public interface IUriService 26 | { 27 | /// 28 | /// Gets Relative Uri path with filters as a string. 29 | /// 30 | /// Filters. 31 | /// Route. 32 | /// Relative Uri string. 33 | public string GetPageUriString(PaginationFilter filter, string route); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Test/Common/StudySerieSopUidsTest.cs: -------------------------------------------------------------------------------- 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 Monai.Deploy.InformaticsGateway.Common; 18 | using Xunit; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Test.Common 21 | { 22 | public class StudySerieSopUidsTest 23 | { 24 | [Fact] 25 | public void GivenAStudySerieSopUids_WithUidsSet_ExpectIdentifierToHaveCorrectValue() 26 | { 27 | var uids = new StudySerieSopUids 28 | { 29 | StudyInstanceUid = "STUDY", 30 | SeriesInstanceUid = "SERIES", 31 | SopClassUid = "CLASS", 32 | SopInstanceUid = "SOP" 33 | }; 34 | 35 | Assert.Equal("STUDY/SERIES/SOP", uids.Identifier); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Api/PlugIns/IInputHL7DataPlugIn.cs: -------------------------------------------------------------------------------- 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 | using System.Threading.Tasks; 18 | using HL7.Dotnetcore; 19 | using Monai.Deploy.InformaticsGateway.Api.Storage; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Api.PlugIns 22 | { 23 | /// 24 | /// IInputDataPlugIn enables lightweight data processing over incoming data received from supported data ingestion 25 | /// services. 26 | /// Refer to for additional details. 27 | /// 28 | public interface IInputHL7DataPlugIn 29 | { 30 | string Name { get; } 31 | 32 | Task<(Message hl7Message, FileStorageMetadata fileMetadata)> ExecuteAsync(Message hl7File, FileStorageMetadata fileMetadata); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/Api/Rest/RequestedInstance.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System.Collections.Generic; 19 | using System.Text.Json.Serialization; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Api.Rest 22 | { 23 | /// 24 | /// Details of a DICOM instance to be retrieved for an inference request. 25 | /// 26 | /// 27 | /// SopInstanceUid> is required. 28 | /// 29 | public class RequestedInstance 30 | { 31 | /// 32 | /// Gets or sets the SOP Instance UID to be retrieved. 33 | /// 34 | [JsonPropertyName("SOPInstanceUID")] 35 | public IList? SopInstanceUid { get; set; } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/HealthLevel7/IMllpClientFactory.cs: -------------------------------------------------------------------------------- 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.Logging; 18 | using Monai.Deploy.InformaticsGateway.Configuration; 19 | using Monai.Deploy.InformaticsGateway.Services.Common; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Api.Mllp 22 | { 23 | internal interface IMllpClientFactory 24 | { 25 | IMllpClient CreateClient(ITcpClientAdapter client, Hl7Configuration configurations, ILogger logger); 26 | } 27 | 28 | internal class MllpClientFactory : IMllpClientFactory 29 | { 30 | public IMllpClient CreateClient(ITcpClientAdapter client, Hl7Configuration configurations, ILogger logger) 31 | => new MllpClient(client, configurations, logger); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Client/HttpContentExtensions.cs: -------------------------------------------------------------------------------- 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 | using System.Net.Http; 18 | using System.Text.Json; 19 | using System.Threading; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Client 22 | { 23 | internal static class HttpContentExtensions 24 | { 25 | public static async System.Threading.Tasks.Task ReadAsAsync(this HttpContent httpContent, CancellationToken cancellationToken) 26 | { 27 | using (var contentStream = await httpContent.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false)) 28 | { 29 | return await JsonSerializer.DeserializeAsync(contentStream, Configuration.JsonSerializationOptions, cancellationToken: cancellationToken).ConfigureAwait(false); 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Database/MongoDB/Configurations/MongoDBEntityBaseConfiguration.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using Monai.Deploy.InformaticsGateway.Api.Storage; 19 | using MongoDB.Bson.Serialization; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Database.MongoDB.Configurations 22 | { 23 | internal static class MongoDBEntityBaseConfiguration 24 | { 25 | public static void Configure() 26 | { 27 | BsonClassMap.RegisterClassMap(j => 28 | { 29 | j.SetIsRootClass(true); 30 | j.SetIdMember(j.GetMemberMap(c => c.Id)); 31 | j.MapIdMember(c => c.Id); 32 | j.MapMember(c => c.DateTimeCreated); 33 | }); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Api/PlugIns/IOutputDataPlugin.cs: -------------------------------------------------------------------------------- 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 | using System.Threading.Tasks; 18 | using FellowOakDicom; 19 | using Monai.Deploy.InformaticsGateway.Api.Models; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Api.PlugIns 22 | { 23 | /// 24 | /// IOutputDataPlugIn enables lightweight data processing over incoming data received from supported data ingestion 25 | /// services. 26 | /// Refer to for additional details. 27 | /// 28 | public interface IOutputDataPlugIn 29 | { 30 | string Name { get; } 31 | 32 | Task<(DicomFile dicomFile, ExportRequestDataMessage exportRequestDataMessage)> ExecuteAsync(DicomFile dicomFile, ExportRequestDataMessage exportRequestDataMessage); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/InformaticsGateway/Services/Fhir/Resources.cs: -------------------------------------------------------------------------------- 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 | namespace Monai.Deploy.InformaticsGateway.Services.Fhir 18 | { 19 | internal static class Resources 20 | { 21 | public const string RouteNameResourceType = "resourceType"; 22 | public const string ResourceTypeRouteConstraint = "fhirResource"; 23 | 24 | public const string ResourceOperationOutcome = "OperationOutcome"; 25 | 26 | public const string FhirXmlNamespace = "http://hl7.org/fhir"; 27 | public const string XmlNamespacePrefix = "hl7"; 28 | public const string PropertyResourceType = "resourceType"; 29 | public const string PropertyId = "id"; 30 | public const string AttributeValue = "value"; 31 | public const uint PayloadAssemblerTimeout = 5; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | # Copyright 2021-2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | codecov: 16 | require_ci_to_pass: yes 17 | 18 | coverage: 19 | precision: 5 20 | round: down 21 | range: "70...100" 22 | status: 23 | project: 24 | default: 25 | target: auto 26 | threshold: 1% 27 | base: auto 28 | if_not_found: success 29 | informational: false 30 | only_pulls: false 31 | 32 | parsers: 33 | gcov: 34 | branch_detection: 35 | conditional: yes 36 | loop: yes 37 | method: no 38 | macro: no 39 | 40 | comment: 41 | layout: "reach,diff,flags,files,footer" 42 | behavior: default 43 | require_changes: false 44 | require_base: no 45 | require_head: yes 46 | 47 | fixes: 48 | - "/home/runner/work/Informatics-Gateway/Informatics-Gateway/src/::src/" 49 | -------------------------------------------------------------------------------- /src/Plug-ins/RemoteAppExecution/Database/IRemoteAppExecutionRepository.cs: -------------------------------------------------------------------------------- 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.InformaticsGateway.PlugIns.RemoteAppExecution.Database 18 | { 19 | public interface IRemoteAppExecutionRepository 20 | { 21 | Task AddAsync(RemoteAppExecution item, CancellationToken cancellationToken = default); 22 | 23 | Task GetAsync(string sopInstanceUid, CancellationToken cancellationToken = default); 24 | 25 | Task GetAsync(string workflowInstanceId, string exportTaskId, string studyInstanceUid, string seriesInstanceUid, CancellationToken cancellationToken = default); 26 | 27 | Task RemoveAsync(RemoteAppExecution remoteAppExecution, CancellationToken cancellationToken = default); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/Integration.Test/study.json.dev: -------------------------------------------------------------------------------- 1 | { 2 | "MR": { 3 | "SeriesMin": 1, 4 | "SeriesMax": 2, 5 | "InstanceMin": 64, 6 | "InstanceMax": 128, 7 | "SizeMin": 0.36, 8 | "SizeMax": 2 9 | }, 10 | "CT": { 11 | "SeriesMin": 1, 12 | "SeriesMax": 2, 13 | "InstanceMin": 60, 14 | "InstanceMax": 1000, 15 | "SizeMin": 0.5, 16 | "SizeMax": 1 17 | }, 18 | "MG": { 19 | "SeriesMin": 4, 20 | "SeriesMax": 8, 21 | "InstanceMin": 1, 22 | "InstanceMax": 1, 23 | "SizeMin": 5, 24 | "SizeMax": 75 25 | }, 26 | "TOMO": { 27 | "SeriesMin": 4, 28 | "SeriesMax": 8, 29 | "InstanceMin": 1, 30 | "InstanceMax": 1, 31 | "SizeMin": 300, 32 | "SizeMax": 750 33 | }, 34 | "US": { 35 | "SeriesMin": 1, 36 | "SeriesMax": 4, 37 | "InstanceMin": 1, 38 | "InstanceMax": 1, 39 | "SizeMin": 25, 40 | "SizeMax": 100 41 | }, 42 | "Pathology": { 43 | "SeriesMin": 1, 44 | "SeriesMax": 4, 45 | "InstanceMin": 1, 46 | "InstanceMax": 1, 47 | "SizeMin": 10000, 48 | "SizeMax": 20000 49 | }, 50 | "Tiny": { 51 | "SeriesMin": 1, 52 | "SeriesMax": 1, 53 | "InstanceMin": 1, 54 | "InstanceMax": 1, 55 | "SizeMin": 1, 56 | "SizeMax": 2 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /docker-compose/configs/pipeline/monai-deploy.conf: -------------------------------------------------------------------------------- 1 | # Copyright 2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | input { 17 | tcp { 18 | port => 50000 19 | type => nlog 20 | } 21 | } 22 | 23 | filter { 24 | if [type] == "nlog" { 25 | mutate { 26 | remove_field => [ "host" ] 27 | } 28 | json { 29 | source => "message" 30 | remove_field => [ "message" ] 31 | } 32 | date{ 33 | match => [ "Timestamp", "yyyy-MM-dd'T'HH:mm:ss.SSSSSSSZ" ] 34 | } 35 | 36 | mutate { 37 | remove_field => [ "time" ] 38 | } 39 | } 40 | } 41 | 42 | output { 43 | elasticsearch { 44 | hosts => "elasticsearch:9200" 45 | index => "monai-deploy-%{+YYYY.MM.dd}" 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/Api/Test/HL7DestinationEntityTest.cs: -------------------------------------------------------------------------------- 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 Monai.Deploy.InformaticsGateway.Api.Models; 18 | using Xunit; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.Api.Test 21 | { 22 | public class HL7DestinationEntityTest 23 | { 24 | 25 | 26 | [Fact] 27 | public void GivenAMonaiApplicationEntity_WhenNameIsSet_ExepectSetDefaultValuesToNotOverwrite() 28 | { 29 | var entity = new HL7DestinationEntity 30 | { 31 | Port = 1104, 32 | HostIp = "IP", 33 | Name = "Name" 34 | }; 35 | 36 | entity.SetDefaultValues(); 37 | 38 | Assert.Equal("IP", entity.HostIp); 39 | Assert.Equal("Name", entity.Name); 40 | Assert.Equal(1104, entity.Port); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Client.Common/UriExtensions.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | using Ardalis.GuardClauses; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Client.Common 22 | { 23 | public static class UriExtensions 24 | { 25 | public static Uri EnsureUriEndsWithSlash(this Uri input) 26 | { 27 | Guard.Against.MalformUri(input, nameof(input)); 28 | 29 | var str = input.ToString(); 30 | 31 | if (!string.IsNullOrWhiteSpace(str) && !str.EndsWith('/')) 32 | { 33 | #pragma warning disable S1075 // URIs should not be hardcoded 34 | return new Uri(str + '/'); 35 | #pragma warning restore S1075 // URIs should not be hardcoded 36 | } 37 | 38 | return input; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/Integration.Test/Features/Fhir.feature: -------------------------------------------------------------------------------- 1 | # Copyright 2022 MONAI Consortium 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # @ignored 16 | Feature: FHIR 17 | 18 | @messaging_workflow_request @messaging 19 | Scenario Outline: Ability to store FHIR messages in different formats 20 | Given FHIR message in 21 | When the FHIR messages are sent to Informatics Gateway 22 | Then workflow requests are sent to message broker 23 | And FHIR resources are uploaded to storage service 24 | 25 | Examples: 26 | | version | format | 27 | | 1.0.2 DSTU2 | XML | 28 | | 1.0.2 DSTU2 | JSON | 29 | | 3.0.2 STU3 | XML | 30 | | 3.0.2 STU3 | JSON | 31 | | 4.0.1 R4 | XML | 32 | | 4.0.1 R4 | JSON | 33 | | 4.3.0 R4B | XML | 34 | | 4.3.0 R4B | JSON | 35 | -------------------------------------------------------------------------------- /src/Api/HL7DestinationEntity.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2019-2020 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | namespace Monai.Deploy.InformaticsGateway.Api.Models 19 | { 20 | /// 21 | /// HL7 Destination Entity 22 | /// 23 | /// 24 | /// 25 | /// { 26 | /// "name": "MYPACS", 27 | /// "hostIp": "10.20.100.200", 28 | /// "port": 1104 29 | /// } 30 | /// 31 | /// 32 | public class HL7DestinationEntity : BaseApplicationEntity 33 | { 34 | /// 35 | /// Gets or sets the port to connect to. 36 | /// 37 | public int Port { get; set; } 38 | 39 | public override string ToString() 40 | { 41 | return $"Name: {Name}/Host: {HostIp}/Port: {Port}"; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/CLI/Services/ConfirmationPrompt.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-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 System; 18 | using Ardalis.GuardClauses; 19 | 20 | namespace Monai.Deploy.InformaticsGateway.CLI.Services 21 | { 22 | public interface IConfirmationPrompt 23 | { 24 | bool ShowConfirmationPrompt(string message); 25 | } 26 | 27 | internal class ConfirmationPrompt : IConfirmationPrompt 28 | { 29 | public bool ShowConfirmationPrompt(string message) 30 | { 31 | Guard.Against.NullOrWhiteSpace(message, nameof(message)); 32 | 33 | Console.Write($"{message} [y/N]: "); 34 | var key = Console.ReadKey(); 35 | Console.WriteLine(); 36 | if (key.Key == ConsoleKey.Y) 37 | { 38 | return true; 39 | } 40 | return false; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Database/EntityFramework/Migrations/20220211175051_R1_Patch.cs: -------------------------------------------------------------------------------- 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.EntityFrameworkCore.Migrations; 18 | 19 | #nullable disable 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Database.Migrations 22 | { 23 | public partial class R1_Patch : Migration 24 | { 25 | protected override void Up(MigrationBuilder migrationBuilder) 26 | { 27 | migrationBuilder.AddColumn( 28 | name: "Workflows", 29 | table: "Payload", 30 | type: "TEXT", 31 | nullable: true); 32 | } 33 | 34 | protected override void Down(MigrationBuilder migrationBuilder) 35 | { 36 | migrationBuilder.DropColumn( 37 | name: "Workflows", 38 | table: "Payload"); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /tests/Integration.Test/data/hl7/2.3/003.txt: -------------------------------------------------------------------------------- 1 | MSH|^~\&|AccMgr|1|||20050110045504||ADT^A01|599102|P|2.3||| 2 | EVN|A01|20050110045502||||| 3 | PID|1||10006579^^^1^MRN^1||DUCK^DONALD^D||19241010|M||1|111 DUCK ST^^FOWL^CA^999990000^^M|1|8885551212|8885551212|1|2||40007716^^^AccMgr^VN^1|123121234|||||||||||NO NK1|1|DUCK^HUEY|SO|3583 DUCK RD^^FOWL^CA^999990000|8885552222||Y|||||||||||||| 4 | PV1|1|I|PREOP^101^1^1^^^S|3|||37^DISNEY^WALT^^^^^^AccMgr^^^^CI|||01||||1|||37^DISNEY^WALT^^^^^^AccMgr^^^^CI|2|40007716^^^AccMgr^VN|4|||||||||||||||||||1||G|||20050110045253|||||| 5 | GT1|1|8291|DUCK^DONALD^D||111^DUCKST^^FOWL^CA^999990000|8885551212||19241010|M||1|123121234||||#Cartoon Ducks Inc|111^DUCK ST^^FOWL^CA^999990000|8885551212||PT| 6 | DG1|1|I9|71596^OSTEOARTHROS NOS-L/LEG ^I9|OSTEOARTHROS NOS-L/LEG ||A| IN1|1|MEDICARE|3|MEDICARE|||||||Cartoon Ducks Inc|19891001|||4|DUCK^DONALD^D|1|19241010|111^DUCK ST^^FOWL^CA^999990000|||||||||||||||||123121234A||||||PT|M|111 DUCK ST^^FOWL^CA^999990000|||||8291 7 | IN2|1||123121234|Cartoon Ducks Inc|||123121234A|||||||||||||||||||||||||||||||||||||||||||||||||||||||||8885551212 8 | IN1|2|NON-PRIMARY|9|MEDICAL MUTUAL CALIF.|PO BOX 94776^^HOLLYWOOD^CA^441414776||8003621279|PUBSUMB|||Cartoon Ducks Inc||||7|DUCK^DONALD^D|1|19241010|111 DUCK ST^^FOWL^CA^999990000|||||||||||||||||056269770||||||PT|M|111^DUCK ST^^FOWL^CA^999990000|||||8291 9 | IN2|2||123121234|Cartoon Ducks Inc||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||8885551212 10 | IN1|3|SELF PAY|1|SELF PAY|||||||||||5||1 -------------------------------------------------------------------------------- /src/Api/Models/ExternalAppDetails.cs: -------------------------------------------------------------------------------- 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 | using Monai.Deploy.InformaticsGateway.Api.Storage; 18 | 19 | namespace Monai.Deploy.InformaticsGateway.Api.Models 20 | { 21 | public class ExternalAppDetails : MongoDBEntityBase 22 | { 23 | public string StudyInstanceUid { get; set; } = string.Empty; 24 | 25 | public string StudyInstanceUidOutBound { get; set; } = string.Empty; 26 | 27 | public string WorkflowInstanceId { get; set; } = string.Empty; 28 | 29 | public string ExportTaskID { get; set; } = string.Empty; 30 | 31 | public string CorrelationId { get; set; } = string.Empty; 32 | 33 | public string? DestinationFolder { get; set; } 34 | 35 | public string PatientId { get; set; } = string.Empty; 36 | 37 | public string PatientIdOutBound { get; set; } = string.Empty; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Client.Common/ProblemException.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using System; 19 | using Ardalis.GuardClauses; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Client.Common 22 | { 23 | public class ProblemException : Exception 24 | { 25 | public ProblemDetails ProblemDetails { get; private set; } 26 | 27 | public ProblemException(ProblemDetails problemDetails) : base(problemDetails?.Detail) 28 | { 29 | Guard.Against.Null(problemDetails, nameof(problemDetails)); 30 | 31 | ProblemDetails = problemDetails; 32 | } 33 | 34 | public override string Message => ToString(); 35 | 36 | public override string ToString() 37 | { 38 | return $"HTTP Status: {ProblemDetails.Status}. {ProblemDetails.Detail}"; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Database/MongoDB/Configurations/InferenceRequestConfiguration.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021-2022 MONAI Consortium 3 | * Copyright 2021 NVIDIA Corporation 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | using Monai.Deploy.InformaticsGateway.Api.Rest; 19 | using MongoDB.Bson.Serialization; 20 | 21 | namespace Monai.Deploy.InformaticsGateway.Database.MongoDB.Configurations 22 | { 23 | internal static class InferenceRequestConfiguration 24 | { 25 | public static void Configure() 26 | { 27 | BsonClassMap.RegisterClassMap(j => 28 | { 29 | j.AutoMap(); 30 | j.SetIdMember(j.GetMemberMap(c => c.InferenceRequestId)); 31 | j.MapIdMember(c => c.InferenceRequestId); 32 | j.SetIgnoreExtraElements(true); 33 | 34 | j.UnmapProperty(p => p.Application); 35 | }); 36 | } 37 | } 38 | } 39 | --------------------------------------------------------------------------------