From 14c18ae2f6a67a35b6e81dc18267f1e4beb6295c Mon Sep 17 00:00:00 2001 From: Reto Wettstein Date: Fri, 15 Jan 2021 11:32:04 +0100 Subject: [PATCH 001/125] initial data sharing sceleton --- dsf-bpe-process-data-sharing/pom.xml | 192 ++++++++++++ .../highmed/dsf/bpe/ConstantsDataSharing.java | 41 +++ .../DataSharingProcessPluginDefinition.java | 90 ++++++ .../dsf/bpe/message/SendMedicRequest.java | 71 +++++ .../dsf/bpe/message/SendMultiMedicErrors.java | 42 +++ .../bpe/message/SendMultiMedicResults.java | 27 ++ .../bpe/message/SendSingleMedicResults.java | 27 ++ .../dsf/bpe/message/SendTtpRequest.java | 45 +++ .../service/CheckDataSharingResources.java | 25 ++ .../bpe/service/CheckMultiMedicResults.java | 24 ++ .../bpe/service/CheckSingleMedicResults.java | 25 ++ .../CheckTtpComputedMultiMedicResults.java | 24 ++ .../dsf/bpe/service/CreatePseudonym.java | 25 ++ .../service/DownloadDataSharingResources.java | 194 ++++++++++++ .../DownloadResearchStudyResource.java | 108 +++++++ .../dsf/bpe/service/DownloadResultSets.java | 25 ++ .../highmed/dsf/bpe/service/EncryptMdat.java | 25 ++ .../dsf/bpe/service/ExecuteQueries.java | 25 ++ .../dsf/bpe/service/ExecuteRecordLink.java | 25 ++ .../service/FilterQueryResultsByConsent.java | 25 ++ .../dsf/bpe/service/GenerateBloomFilters.java | 25 ++ .../service/HandleErrorMultiMedicResults.java | 24 ++ .../dsf/bpe/service/ModifyQueries.java | 25 ++ .../bpe/service/ProvideLocalPseudonyms.java | 24 ++ .../dsf/bpe/service/SelectRequestTargets.java | 113 +++++++ .../service/SelectResponseTargetMedic.java | 32 ++ .../bpe/service/SelectResponseTargetTtp.java | 54 ++++ .../dsf/bpe/service/StoreCorrelationKeys.java | 51 ++++ .../highmed/dsf/bpe/service/StoreResults.java | 25 ++ .../bpe/spring/config/DataSharingConfig.java | 228 ++++++++++++++ .../config/DataSharingSerializerConfig.java | 21 ++ .../dsf/bpe/variable/BloomFilterConfig.java | 111 +++++++ .../variable/BloomFilterConfigSerializer.java | 71 +++++ .../bpe/variable/BloomFilterConfigValues.java | 54 ++++ ...rg.highmed.dsf.bpe.ProcessPluginDefinition | 1 + .../resources/bpe/computeDataSharing.bpmn | 282 ++++++++++++++++++ .../resources/bpe/executeDataSharing.bpmn | 259 ++++++++++++++++ .../resources/bpe/requestDataSharing.bpmn | 197 ++++++++++++ .../highmed-computeDataSharing.xml | 92 ++++++ .../highmed-executeDataSharing.xml | 66 ++++ .../highmed-requestDataSharing.xml | 124 ++++++++ .../fhir/CodeSystem/highmed-data-sharing.xml | 68 +++++ .../fhir/CodeSystem/highmed-query-type.xml | 28 ++ .../highmed-research-study-identifier.xml | 21 ++ .../highmed-extension-group-id.xml | 57 ++++ .../highmed-extension-participating-medic.xml | 69 +++++ .../highmed-extension-participating-ttp.xml | 69 +++++ .../highmed-extension-query.xml | 51 ++++ .../StructureDefinition/highmed-group.xml | 52 ++++ .../highmed-research-study-data-sharing.xml | 95 ++++++ .../highmed-task-compute-data-sharing.xml | 142 +++++++++ .../highmed-task-execute-data-sharing.xml | 224 ++++++++++++++ ...ed-task-multi-medic-error-data-sharing.xml | 100 +++++++ ...d-task-multi-medic-result-data-sharing.xml | 63 ++++ .../highmed-task-request-data-sharing.xml | 192 ++++++++++++ ...-task-single-medic-result-data-sharing.xml | 62 ++++ .../fhir/ValueSet/highmed-data-sharing.xml | 25 ++ .../fhir/ValueSet/highmed-query-type.xml | 37 +++ ...ringFromMedicsViaMedic1ExampleStarter.java | 159 ++++++++++ .../java/org/highmed/dsf/fhir/profile/.keep | 0 .../src/test/resources/log4j2.xml | 67 +++++ pom.xml | 13 +- 62 files changed, 4556 insertions(+), 2 deletions(-) create mode 100644 dsf-bpe-process-data-sharing/pom.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java create mode 100755 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java create mode 100755 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java create mode 100755 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java create mode 100755 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java create mode 100755 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CreatePseudonym.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptMdat.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java create mode 100755 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigValues.java create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/META-INF/services/org.highmed.dsf.bpe.ProcessPluginDefinition create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn create mode 100755 dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-query-type.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/NamingSystem/highmed-research-study-identifier.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-group-id.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-medic.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-ttp.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-query.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-group.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-query-type.xml create mode 100644 dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java create mode 100644 dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/.keep create mode 100644 dsf-bpe-process-data-sharing/src/test/resources/log4j2.xml diff --git a/dsf-bpe-process-data-sharing/pom.xml b/dsf-bpe-process-data-sharing/pom.xml new file mode 100644 index 00000000..0dbdbc08 --- /dev/null +++ b/dsf-bpe-process-data-sharing/pom.xml @@ -0,0 +1,192 @@ + + + 4.0.0 + + dsf-bpe-process-data-sharing + + + dsf-bpe-highmed-processes-pom + org.highmed.dsf + 0.4.0-SNAPSHOT + + + + + org.highmed.dsf + dsf-bpe-process-base + provided + + + + org.highmed.dsf + dsf-fhir-validation + test + + + de.hs-heilbronn.mi + log4j2-utils + test + + + junit + junit + test + + + org.highmed.dsf + dsf-bpe-process-base + test + test-jar + + + + + + copy-to-highmed-dsf-process + + + + org.apache.maven.plugins + maven-dependency-plugin + + + copy-process-to-docker-test-setup + package + + copy + + + + + ${project.groupId} + ${project.artifactId} + ${project.version} + + + ../../highmed-dsf/dsf-docker-test-setup/bpe/app/process + + + + copy-process-to-docker-test-setup-3medic-ttp/medic1 + package + + copy + + + + + ${project.groupId} + ${project.artifactId} + ${project.version} + + + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process + + + + + copy-process-to-docker-test-setup-3medic-ttp/medic2 + package + + copy + + + + + ${project.groupId} + ${project.artifactId} + ${project.version} + + + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process + + + + + copy-process-to-docker-test-setup-3medic-ttp/medic3 + package + + copy + + + + + ${project.groupId} + ${project.artifactId} + ${project.version} + + + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process + + + + + copy-process-to-docker-test-setup-3medic-ttp/ttp + package + + copy + + + + + ${project.groupId} + ${project.artifactId} + ${project.version} + + + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process + + + + + + + org.apache.maven.plugins + maven-clean-plugin + + + + ../../highmed-dsf/dsf-docker-test-setup/bpe/app/process + + ${project.artifactId}-${project.version}.jar + + false + + + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process + + ${project.artifactId}-${project.version}.jar + + false + + + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process + + ${project.artifactId}-${project.version}.jar + + false + + + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process + + ${project.artifactId}-${project.version}.jar + + false + + + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process + + ${project.artifactId}-${project.version}.jar + + false + + + + + + + + + \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java new file mode 100644 index 00000000..490d9de0 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -0,0 +1,41 @@ +package org.highmed.dsf.bpe; + +import static org.highmed.dsf.bpe.ConstantsBase.PROCESS_HIGHMED_URI_BASE; +import static org.highmed.dsf.bpe.DataSharingProcessPluginDefinition.VERSION; + +public interface ConstantsDataSharing +{ + String BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY = "researchStudy"; + String BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK = "needsConsentCheck"; + String BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE = "needsRecordLinkage"; + String BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG = "bloomFilterConfig"; + String BPMN_EXECUTION_VARIABLE_COHORTS = "cohorts"; + String BPMN_EXECUTION_VARIABLE_QUERIES = "queries"; + + String PROFILE_HIGHMED_GROUP = "http://highmed.org/fhir/StructureDefinition/group"; + String PROFILE_HIGHMED_RESEARCH_STUDY_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/research-study-data-sharing"; + + String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing"; + String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestDataSharing/"; + String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = + PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI + VERSION; + String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME = "requestDataSharingMessage"; + + String CODESYSTEM_HIGHMED_DATA_SHARING = "http://highmed.org/fhir/CodeSystem/data-sharing"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE = "research-study-reference"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE = "needs-record-linkage"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK = "needs-consent-check"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG = "bloom-filter-configuration"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY = "medic-correlation-key"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT = "single-medic-result"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE = "single-medic-result-reference"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT = "multi-medic-result"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS = "participating-medics"; + + String NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER = "http://highmed.org/fhir/NamingSystem/research-study-identifier"; + + String EXTENSION_HIGHMED_PARTICIPATING_MEDIC = "http://highmed.org/fhir/StructureDefinition/extension-participating-medic"; + String EXTENSION_HIGHMED_PARTICIPATING_TTP = "http://highmed.org/fhir/StructureDefinition/extension-participating-ttp"; + String EXTENSION_HIGHMED_GROUP_ID = "http://highmed.org/fhir/StructureDefinition/extension-group-id"; + String EXTENSION_HIGHMED_QUERY = "http://highmed.org/fhir/StructureDefinition/extension-query"; +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java new file mode 100644 index 00000000..35bc05e5 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java @@ -0,0 +1,90 @@ +package org.highmed.dsf.bpe; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; + +import org.highmed.dsf.bpe.spring.config.DataSharingConfig; +import org.highmed.dsf.bpe.spring.config.DataSharingSerializerConfig; +import org.highmed.dsf.fhir.resources.AbstractResource; +import org.highmed.dsf.fhir.resources.ActivityDefinitionResource; +import org.highmed.dsf.fhir.resources.CodeSystemResource; +import org.highmed.dsf.fhir.resources.NamingSystemResource; +import org.highmed.dsf.fhir.resources.ResourceProvider; +import org.highmed.dsf.fhir.resources.StructureDefinitionResource; +import org.highmed.dsf.fhir.resources.ValueSetResource; + +import ca.uhn.fhir.context.FhirContext; + +public class DataSharingProcessPluginDefinition implements ProcessPluginDefinition +{ + public static final String VERSION = "0.4.0"; + + @Override + public String getName() + { + return "dsf-bpe-process-data-sharing"; + } + + @Override + public String getVersion() + { + return VERSION; + } + + @Override + public Stream getBpmnFiles() + { + return Stream.of("bpe/requestDataSharing.bpmn", "bpe/executeDataSharing.bpmn", "bpe/computeDataSharing.bpmn"); + } + + @Override + public Stream> getSpringConfigClasses() + { + return Stream.of(DataSharingConfig.class, DataSharingSerializerConfig.class); + } + + @Override + public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader) + { + var aCom = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-computeDataSharing.xml"); + var aExe = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeDataSharing.xml"); + var aReq = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-requestDataSharing.xml"); + + var cF = CodeSystemResource.file("fhir/CodeSystem/highmed-data-sharing.xml"); + var cQT = CodeSystemResource.file("fhir/CodeSystem/highmed-query-type.xml"); + + var n = NamingSystemResource.file("fhir/NamingSystem/highmed-research-study-identifier.xml"); + + var sExtG = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-extension-group-id.xml"); + var sExtPartMeDic = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-extension-participating-medic.xml"); + var sExtPartTtp = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-extension-participating-ttp.xml"); + var sExtQ = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-extension-query.xml"); + var sG = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-group.xml"); + var sR = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-research-study-data-sharing.xml"); + var sTCom = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-compute-data-sharing.xml"); + var sTExe = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-execute-data-sharing.xml"); + var sTErr = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml"); + var sTResM = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml"); + var sTReq = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-request-data-sharing.xml"); + var sTResS = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml"); + + var vF = ValueSetResource.file("fhir/ValueSet/highmed-data-sharing.xml"); + var vQT = ValueSetResource.file("fhir/ValueSet/highmed-query-type.xml"); + + Map> resourcesByProcessKeyAndVersion = Map.of( + "computeDataSharing/" + VERSION, Arrays.asList(aCom, cF, sExtG, sG, sTCom, sTResS, vF), + "executeDataSharing/" + VERSION, Arrays.asList(aExe, cF, cQT, n, sR, sExtPartMeDic, sExtPartTtp, sExtQ, sG, sTExe, vF, vQT), + "requestDataSharing/" + VERSION, Arrays.asList(aReq, cF, cQT, n, sExtG, sExtPartMeDic, sExtPartTtp, sG, sR, sExtQ, sTReq, sTResM, sTErr, vF, vQT)); + + return ResourceProvider + .read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, + resourcesByProcessKeyAndVersion); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java new file mode 100755 index 00000000..3e3b6cb9 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java @@ -0,0 +1,71 @@ +package org.highmed.dsf.bpe.message; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; + +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.variable.BloomFilterConfig; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResearchStudy; +import org.hl7.fhir.r4.model.Task.ParameterComponent; + +import ca.uhn.fhir.context.FhirContext; + +public class SendMedicRequest extends AbstractTaskMessageSend +{ + public SendMedicRequest(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider, FhirContext fhirContext) + { + super(clientProvider, taskHelper, organizationProvider, fhirContext); + } + + @Override + protected Stream getAdditionalInputParameters(DelegateExecution execution) + { + ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); + IdType researchStudyId = new IdType( + getFhirWebserviceClientProvider().getLocalBaseUrl() + "/" + researchStudy.getId()); + + ParameterComponent inputResearchStudyReference = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE, + new Reference().setReference(researchStudyId.toVersionless().getValueAsString())); + + boolean needsConsentCheck = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); + ParameterComponent inputNeedsConsentCheck = getTaskHelper() + .createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK, + needsConsentCheck); + + boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE); + ParameterComponent inputNeedsRecordLinkage = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + + if (needsRecordLinkage) + { + BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution + .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); + ParameterComponent inputBloomFilterConfig = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG, bloomFilterConfig.toBytes()); + + return Stream.of(inputResearchStudyReference, inputNeedsConsentCheck, inputNeedsRecordLinkage, + inputBloomFilterConfig); + } + else + { + return Stream.of(inputResearchStudyReference, inputNeedsConsentCheck, inputNeedsRecordLinkage); + } + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java new file mode 100755 index 00000000..1abe1434 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java @@ -0,0 +1,42 @@ +package org.highmed.dsf.bpe.message; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; + +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.ParameterComponent; + +import ca.uhn.fhir.context.FhirContext; + +public class SendMultiMedicErrors extends AbstractTaskMessageSend +{ + public SendMultiMedicErrors(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider, FhirContext fhirContext) + { + super(clientProvider, taskHelper, organizationProvider, fhirContext); + } + + @Override + protected Stream getAdditionalInputParameters(DelegateExecution execution) + { + Task task = getLeadingTaskFromExecutionVariables(); + + String taskUrl = new Reference(new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl() + "/Task", + task.getIdElement().getIdPart())).getReference(); + + Task.ParameterComponent input = getTaskHelper() + .createInput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, + "An error occurred while calculating the multi medic data sharing result for " + + "all defined cohorts, see task with url='" + taskUrl + "'"); + return Stream.of(input); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java new file mode 100755 index 00000000..3aabc6be --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java @@ -0,0 +1,27 @@ +package org.highmed.dsf.bpe.message; + +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Task.ParameterComponent; + +import ca.uhn.fhir.context.FhirContext; + +public class SendMultiMedicResults extends AbstractTaskMessageSend +{ + public SendMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider, FhirContext fhirContext) + { + super(clientProvider, taskHelper, organizationProvider, fhirContext); + } + + @Override + protected Stream getAdditionalInputParameters(DelegateExecution execution) + { + return Stream.empty(); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java new file mode 100755 index 00000000..833ecc7b --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -0,0 +1,27 @@ +package org.highmed.dsf.bpe.message; + +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Task.ParameterComponent; + +import ca.uhn.fhir.context.FhirContext; + +public class SendSingleMedicResults extends AbstractTaskMessageSend +{ + public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider, FhirContext fhirContext) + { + super(clientProvider, taskHelper, organizationProvider, fhirContext); + } + + @Override + protected Stream getAdditionalInputParameters(DelegateExecution execution) + { + return Stream.empty(); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java new file mode 100644 index 00000000..e7d9adfd --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java @@ -0,0 +1,45 @@ +package org.highmed.dsf.bpe.message; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; + +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Targets; +import org.hl7.fhir.r4.model.Task; + +import ca.uhn.fhir.context.FhirContext; + +public class SendTtpRequest extends AbstractTaskMessageSend +{ + public SendTtpRequest(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider, FhirContext fhirContext) + { + super(clientProvider, taskHelper, organizationProvider, fhirContext); + } + + @Override + protected Stream getAdditionalInputParameters(DelegateExecution execution) + { + Targets multiInstanceTargets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); + + Stream inputTargets = multiInstanceTargets.getEntries().stream() + .map(target -> getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY, + target.getCorrelationKey())); + + boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE); + Task.ParameterComponent inputNeedsRecordLinkage = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + + return Stream.concat(inputTargets, Stream.of(inputNeedsRecordLinkage)); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java new file mode 100644 index 00000000..21a38e5c --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java @@ -0,0 +1,25 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CheckDataSharingResources extends AbstractServiceDelegate +{ + + private static final Logger logger = LoggerFactory.getLogger(CheckDataSharingResources.class); + + public CheckDataSharingResources(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java new file mode 100755 index 00000000..ac2ec7ea --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java @@ -0,0 +1,24 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CheckMultiMedicResults extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(CheckMultiMedicResults.class); + + public CheckMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java new file mode 100644 index 00000000..be2e2436 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java @@ -0,0 +1,25 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CheckSingleMedicResults extends AbstractServiceDelegate +{ + + private static final Logger logger = LoggerFactory.getLogger(CheckSingleMedicResults.class); + + public CheckSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java new file mode 100644 index 00000000..8c5a335e --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java @@ -0,0 +1,24 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CheckTtpComputedMultiMedicResults extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(CheckTtpComputedMultiMedicResults.class); + + public CheckTtpComputedMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CreatePseudonym.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CreatePseudonym.java new file mode 100644 index 00000000..3e710eac --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CreatePseudonym.java @@ -0,0 +1,25 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CreatePseudonym extends AbstractServiceDelegate +{ + + private static final Logger logger = LoggerFactory.getLogger(CreatePseudonym.class); + + public CreatePseudonym(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java new file mode 100644 index 00000000..ffeb0bed --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java @@ -0,0 +1,194 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_TTP; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.BloomFilterConfig; +import org.highmed.dsf.bpe.variable.BloomFilterConfigValues; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.FhirResourceValues; +import org.highmed.dsf.fhir.variables.FhirResourcesListValues; +import org.highmed.fhir.client.FhirWebserviceClient; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Group; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResearchStudy; +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DownloadDataSharingResources extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(DownloadDataSharingResources.class); + + private final OrganizationProvider organizationProvider; + + public DownloadDataSharingResources(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider) + { + super(clientProvider, taskHelper); + this.organizationProvider = organizationProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + Objects.requireNonNull(organizationProvider, "organizationProvider"); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + Task task = getCurrentTaskFromExecutionVariables(); + + IdType researchStudyId = getResearchStudyId(task); + FhirWebserviceClient client = getWebserviceClient(researchStudyId); + Bundle bundle = getResearchStudyAndCohortDefinitions(researchStudyId, client); + + ResearchStudy researchStudy = (ResearchStudy) bundle.getEntryFirstRep().getResource(); + execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY, FhirResourceValues.create(researchStudy)); + + List cohortDefinitions = getCohortDefinitions(bundle, client.getBaseUrl()); + execution.setVariable(BPMN_EXECUTION_VARIABLE_COHORTS, FhirResourcesListValues.create(cohortDefinitions)); + + String ttpIdentifier = getTtpIdentifier(researchStudy); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER, ttpIdentifier); + + boolean needsConsentCheck = getNeedsConsentCheck(task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK, needsConsentCheck); + + boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); + execution.setVariable(BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + + if (needsRecordLinkage) + { + BloomFilterConfig bloomFilterConfig = getBloomFilterConfig(task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG, + BloomFilterConfigValues.create(bloomFilterConfig)); + } + } + + private IdType getResearchStudyId(Task task) + { + Reference researchStudyReference = getTaskHelper() + .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE).findFirst().get(); + + return new IdType(researchStudyReference.getReference()); + } + + private FhirWebserviceClient getWebserviceClient(IdType researchStudyId) + { + if (researchStudyId.getBaseUrl() == null || researchStudyId.getBaseUrl() + .equals(getFhirWebserviceClientProvider().getLocalBaseUrl())) + { + return getFhirWebserviceClientProvider().getLocalWebserviceClient(); + } + else + { + return getFhirWebserviceClientProvider().getRemoteWebserviceClient(researchStudyId.getBaseUrl()); + } + } + + private Bundle getResearchStudyAndCohortDefinitions(IdType researchStudyId, FhirWebserviceClient client) + { + try + { + Bundle bundle = client.searchWithStrictHandling(ResearchStudy.class, + Map.of("_id", Collections.singletonList(researchStudyId.getIdPart()), "_include", + Collections.singletonList("ResearchStudy:enrollment"))); + + if (bundle.getEntry().size() < 2) + { + throw new RuntimeException("Returned search-set contained less then two entries"); + } + else if (!bundle.getEntryFirstRep().hasResource() || !(bundle.getEntryFirstRep() + .getResource() instanceof ResearchStudy)) + { + throw new RuntimeException("Returned search-set did not contain ResearchStudy at index == 0"); + } + else if (bundle.getEntry().stream().skip(1).map(c -> c.hasResource() && c.getResource() instanceof Group) + .filter(b -> !b).findAny().isPresent()) + { + throw new RuntimeException("Returned search-set contained unexpected resource at index >= 1"); + } + + return bundle; + } + catch (Exception e) + { + logger.warn("Error while reading ResearchStudy with id {} including Groups from {}: {}", + researchStudyId.getIdPart(), client.getBaseUrl(), e.getMessage()); + throw e; + } + } + + private List getCohortDefinitions(Bundle bundle, String baseUrl) + { + return bundle.getEntry().stream().skip(1).map(e -> { + Group group = (Group) e.getResource(); + IdType oldId = group.getIdElement(); + group.setIdElement( + new IdType(baseUrl, oldId.getResourceType(), oldId.getIdPart(), oldId.getVersionIdPart())); + return group; + }).collect(Collectors.toList()); + } + + private String getTtpIdentifier(ResearchStudy researchStudy) + { + Extension ext = researchStudy.getExtensionByUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP); + Reference ref = (Reference) ext.getValue(); + return ref.getIdentifier().getValue(); + } + + private boolean getNeedsConsentCheck(Task task) + { + return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK).orElseThrow( + () -> new IllegalArgumentException( + "NeedsConsentCheck boolean is not set in task with id='" + task.getId() + + "', this error should " + "have been caught by resource validation")); + } + + private boolean getNeedsRecordLinkageCheck(Task task) + { + return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( + () -> new IllegalArgumentException( + "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() + + "', this error should " + "have been caught by resource validation")); + } + + private BloomFilterConfig getBloomFilterConfig(Task task) + { + return BloomFilterConfig.fromBytes(getTaskHelper() + .getFirstInputParameterByteValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG).orElseThrow( + () -> new IllegalArgumentException( + "BloomFilterConfig byte[] is not set in task with id='" + task.getId() + + "', this error should " + "have been caught by resource validation"))); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java new file mode 100644 index 00000000..06333e9d --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -0,0 +1,108 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; + +import java.util.Objects; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.fhir.client.FhirWebserviceClient; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResearchStudy; +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +public class DownloadResearchStudyResource extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(DownloadResearchStudyResource.class); + + private final OrganizationProvider organizationProvider; + + public DownloadResearchStudyResource(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider) + { + super(clientProvider, taskHelper); + + this.organizationProvider = organizationProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(organizationProvider, "organizationProvider"); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + Task task = getLeadingTaskFromExecutionVariables(); + FhirWebserviceClient client = getFhirWebserviceClientProvider().getLocalWebserviceClient(); + + IdType researchStudyId = getResearchStudyId(task); + ResearchStudy researchStudy = getResearchStudy(researchStudyId, client); + boolean needsConsentCheck = getNeedsConsentCheck(task); + boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY, researchStudy); + execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK, needsConsentCheck); + execution.setVariable(BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + } + + private IdType getResearchStudyId(Task task) + { + Reference researchStudyReference = getTaskHelper() + .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE).findFirst().orElseThrow( + () -> new IllegalArgumentException( + "ResearchStudy reference is not set in task with id='" + task.getId() + + "', this error should have been caught by resource validation")); + + return new IdType(researchStudyReference.getReference()); + } + + private ResearchStudy getResearchStudy(IdType researchStudyid, FhirWebserviceClient client) + { + try + { + return client.read(ResearchStudy.class, researchStudyid.getIdPart()); + } + catch (Exception e) + { + logger.warn("Error while reading ResearchStudy with id {} from {}", researchStudyid.getIdPart(), + client.getBaseUrl()); + throw e; + } + } + + private boolean getNeedsConsentCheck(Task task) + { + return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK).orElseThrow( + () -> new IllegalArgumentException( + "NeedsConsentCheck boolean is not set in task with id='" + task.getId() + + "', this error should " + "have been caught by resource validation")); + } + + private boolean getNeedsRecordLinkageCheck(Task task) + { + return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( + () -> new IllegalArgumentException( + "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() + + "', this error should " + "have been caught by resource validation")); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java new file mode 100644 index 00000000..8806d2bf --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java @@ -0,0 +1,25 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DownloadResultSets extends AbstractServiceDelegate +{ + + private static final Logger logger = LoggerFactory.getLogger(DownloadResultSets.class); + + public DownloadResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptMdat.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptMdat.java new file mode 100644 index 00000000..d8b4c785 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptMdat.java @@ -0,0 +1,25 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class EncryptMdat extends AbstractServiceDelegate +{ + + private static final Logger logger = LoggerFactory.getLogger(EncryptMdat.class); + + public EncryptMdat(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java new file mode 100644 index 00000000..28896922 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -0,0 +1,25 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ExecuteQueries extends AbstractServiceDelegate +{ + + private static final Logger logger = LoggerFactory.getLogger(ExecuteQueries.class); + + public ExecuteQueries(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java new file mode 100644 index 00000000..fc5eef34 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java @@ -0,0 +1,25 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ExecuteRecordLink extends AbstractServiceDelegate +{ + + private static final Logger logger = LoggerFactory.getLogger(ExecuteRecordLink.class); + + public ExecuteRecordLink(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java new file mode 100644 index 00000000..94654e5b --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java @@ -0,0 +1,25 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class FilterQueryResultsByConsent extends AbstractServiceDelegate +{ + + private static final Logger logger = LoggerFactory.getLogger(FilterQueryResultsByConsent.class); + + public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java new file mode 100644 index 00000000..31c6bbcc --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -0,0 +1,25 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class GenerateBloomFilters extends AbstractServiceDelegate +{ + + private static final Logger logger = LoggerFactory.getLogger(GenerateBloomFilters.class); + + public GenerateBloomFilters(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java new file mode 100644 index 00000000..174f9a4b --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java @@ -0,0 +1,24 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class HandleErrorMultiMedicResults extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(HandleErrorMultiMedicResults.class); + + public HandleErrorMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java new file mode 100644 index 00000000..d736b6c9 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java @@ -0,0 +1,25 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ModifyQueries extends AbstractServiceDelegate +{ + + private static final Logger logger = LoggerFactory.getLogger(ModifyQueries.class); + + public ModifyQueries(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java new file mode 100644 index 00000000..9297ba1a --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java @@ -0,0 +1,24 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ProvideLocalPseudonyms extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(ProvideLocalPseudonyms.class); + + public ProvideLocalPseudonyms(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java new file mode 100644 index 00000000..548ce6bf --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -0,0 +1,113 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; +import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_TTP; + +import java.security.NoSuchAlgorithmException; +import java.util.List; +import java.util.Objects; +import java.util.Random; +import java.util.UUID; +import java.util.stream.Collectors; + +import javax.crypto.KeyGenerator; + +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.BloomFilterConfig; +import org.highmed.dsf.bpe.variable.BloomFilterConfigValues; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Target; +import org.highmed.dsf.fhir.variables.TargetValues; +import org.highmed.dsf.fhir.variables.Targets; +import org.highmed.dsf.fhir.variables.TargetsValues; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResearchStudy; +import org.springframework.beans.factory.InitializingBean; + +public class SelectRequestTargets extends AbstractServiceDelegate implements InitializingBean +{ + private final Random random = new Random(); + + private final OrganizationProvider organizationProvider; + private final KeyGenerator hmacSha2Generator; + private final KeyGenerator hmacSha3Generator; + + public SelectRequestTargets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider, BouncyCastleProvider bouncyCastleProvider) + { + super(clientProvider, taskHelper); + + this.organizationProvider = organizationProvider; + + try + { + Objects.requireNonNull(bouncyCastleProvider, "bouncyCastleProvider"); + + hmacSha2Generator = KeyGenerator.getInstance("HmacSHA256", bouncyCastleProvider); + hmacSha3Generator = KeyGenerator.getInstance("HmacSHA3-256", bouncyCastleProvider); + } + catch (NoSuchAlgorithmException e) + { + throw new RuntimeException(e); + } + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + Objects.requireNonNull(organizationProvider, "organizationProvider"); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(getMedicTargets(researchStudy))); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(getTtpTarget(researchStudy))); + + Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE); + + if (Boolean.TRUE.equals(needsRecordLinkage)) + { + execution.setVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG, + BloomFilterConfigValues.create(createBloomFilterConfig())); + } + } + + private Targets getMedicTargets(ResearchStudy researchStudy) + { + List targets = researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).stream() + .filter(e -> e.getValue() instanceof Reference).map(e -> (Reference) e.getValue()) + .map(r -> Target.createBiDirectionalTarget(r.getIdentifier().getValue(), UUID.randomUUID().toString())) + .collect(Collectors.toList()); + + return new Targets(targets); + } + + private Target getTtpTarget(ResearchStudy researchStudy) + { + return researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP).stream() + .filter(e -> e.getValue() instanceof Reference).map(e -> (Reference) e.getValue()) + .map(r -> Target.createUniDirectionalTarget(r.getIdentifier().getValue())).findFirst().orElseThrow( + () -> new IllegalArgumentException( + "Participating TTP is not set in ResearchStudy with id='" + researchStudy.getId() + + "', this error should " + "have been caught by resource validation")); + } + + private BloomFilterConfig createBloomFilterConfig() + { + return new BloomFilterConfig(random.nextLong(), hmacSha2Generator.generateKey(), + hmacSha3Generator.generateKey()); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java new file mode 100644 index 00000000..ac28275b --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java @@ -0,0 +1,32 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.ConstantsBase; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Target; +import org.highmed.dsf.fhir.variables.TargetValues; +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SelectResponseTargetMedic extends AbstractServiceDelegate +{ + + private static final Logger logger = LoggerFactory.getLogger(SelectResponseTargetMedic.class); + + public SelectResponseTargetMedic(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + Task task = getLeadingTaskFromExecutionVariables(); + + Target medicTarget = Target.createUniDirectionalTarget(task.getRequester().getIdentifier().getValue()); + execution.setVariable(ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(medicTarget)); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java new file mode 100644 index 00000000..23ece239 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java @@ -0,0 +1,54 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; + +import java.util.Objects; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Target; +import org.highmed.dsf.fhir.variables.TargetValues; +import org.hl7.fhir.r4.model.Task; + +public class SelectResponseTargetTtp extends AbstractServiceDelegate +{ + private final OrganizationProvider organizationProvider; + + public SelectResponseTargetTtp(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider) + { + super(clientProvider, taskHelper); + this.organizationProvider = organizationProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + Objects.requireNonNull(organizationProvider, "organizationProvider"); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + String ttpIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); + String correlationKey = getCorrelationKey(); + + Target ttpTarget = Target.createBiDirectionalTarget(ttpIdentifier, correlationKey); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(ttpTarget)); + } + + private String getCorrelationKey() + { + Task task = getCurrentTaskFromExecutionVariables(); + return getTaskHelper().getFirstInputParameterStringValue(task, CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY).orElseThrow(() -> new IllegalStateException( + "No correlation key found, this error should have been caught by resource validation")); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java new file mode 100644 index 00000000..4896857b --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java @@ -0,0 +1,51 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; + +import java.util.List; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Target; +import org.highmed.dsf.fhir.variables.Targets; +import org.highmed.dsf.fhir.variables.TargetsValues; +import org.hl7.fhir.r4.model.Task; + +public class StoreCorrelationKeys extends AbstractServiceDelegate +{ + public StoreCorrelationKeys(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + Task task = getCurrentTaskFromExecutionVariables(); + + List targets = getTaskHelper().getInputParameterStringValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY) + .map(correlationKey -> Target.createBiDirectionalTarget("", correlationKey)) + .collect(Collectors.toList()); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(new Targets(targets))); + + boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); + execution.setVariable(BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + } + + private boolean getNeedsRecordLinkageCheck(Task task) + { + return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( + () -> new IllegalArgumentException( + "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() + + "', this error should " + "have been caught by resource validation")); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java new file mode 100644 index 00000000..ba7c16d9 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java @@ -0,0 +1,25 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class StoreResults extends AbstractServiceDelegate +{ + + private static final Logger logger = LoggerFactory.getLogger(StoreResults.class); + + public StoreResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java new file mode 100755 index 00000000..005242c9 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -0,0 +1,228 @@ +package org.highmed.dsf.bpe.spring.config; + +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.highmed.dsf.bpe.message.SendMedicRequest; +import org.highmed.dsf.bpe.message.SendMultiMedicErrors; +import org.highmed.dsf.bpe.message.SendMultiMedicResults; +import org.highmed.dsf.bpe.message.SendSingleMedicResults; +import org.highmed.dsf.bpe.message.SendTtpRequest; +import org.highmed.dsf.bpe.service.CheckDataSharingResources; +import org.highmed.dsf.bpe.service.CheckMultiMedicResults; +import org.highmed.dsf.bpe.service.CheckSingleMedicResults; +import org.highmed.dsf.bpe.service.CheckTtpComputedMultiMedicResults; +import org.highmed.dsf.bpe.service.CreatePseudonym; +import org.highmed.dsf.bpe.service.DownloadDataSharingResources; +import org.highmed.dsf.bpe.service.DownloadResearchStudyResource; +import org.highmed.dsf.bpe.service.DownloadResultSets; +import org.highmed.dsf.bpe.service.EncryptMdat; +import org.highmed.dsf.bpe.service.ExecuteQueries; +import org.highmed.dsf.bpe.service.ExecuteRecordLink; +import org.highmed.dsf.bpe.service.FilterQueryResultsByConsent; +import org.highmed.dsf.bpe.service.GenerateBloomFilters; +import org.highmed.dsf.bpe.service.HandleErrorMultiMedicResults; +import org.highmed.dsf.bpe.service.ModifyQueries; +import org.highmed.dsf.bpe.service.ProvideLocalPseudonyms; +import org.highmed.dsf.bpe.service.SelectRequestTargets; +import org.highmed.dsf.bpe.service.SelectResponseTargetMedic; +import org.highmed.dsf.bpe.service.SelectResponseTargetTtp; +import org.highmed.dsf.bpe.service.StoreCorrelationKeys; +import org.highmed.dsf.bpe.service.StoreResults; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import ca.uhn.fhir.context.FhirContext; + +@Configuration +public class DataSharingConfig +{ + + @Autowired + private FhirWebserviceClientProvider fhirClientProvider; + + @Autowired + private OrganizationProvider organizationProvider; + + @Autowired + private TaskHelper taskHelper; + + @Autowired + private FhirContext fhirContext; + + @Value("${org.highmed.dsf.bpe.openehr.subject_external_id.path:/ehr_status/subject/external_ref/id/value}") + private String ehrIdColumnPath; + + @Bean + public DownloadResearchStudyResource downloadResearchStudyResourceDS() + { + return new DownloadResearchStudyResource(fhirClientProvider, taskHelper, organizationProvider); + } + + @Bean + public SelectRequestTargets selectRequestTargets() + { + return new SelectRequestTargets(fhirClientProvider, taskHelper, organizationProvider, bouncyCastleProvider()); + } + + @Bean + public SendTtpRequest sendTtpRequest() + { + return new SendTtpRequest(fhirClientProvider, taskHelper, organizationProvider, fhirContext); + } + + @Bean + public SendMedicRequest sendMedicRequest() + { + return new SendMedicRequest(fhirClientProvider, taskHelper, organizationProvider, fhirContext); + } + + @Bean + public CheckMultiMedicResults checkMultiMedicResults() + { + return new CheckMultiMedicResults(fhirClientProvider, taskHelper); + } + + // + // process computeDataSharing implementations + // + + @Bean + public StoreCorrelationKeys storeCorrelationKeys() + { + return new StoreCorrelationKeys(fhirClientProvider, taskHelper); + } + + @Bean + public StoreResults storeResults() + { + return new StoreResults(fhirClientProvider, taskHelper); + } + + @Bean + public DownloadResultSets downloadResultSets() + { + return new DownloadResultSets(fhirClientProvider, taskHelper); + } + + @Bean + public ExecuteRecordLink executeRecordLink() + { + return new ExecuteRecordLink(fhirClientProvider, taskHelper); + } + + @Bean + public CreatePseudonym createPseudonym() + { + return new CreatePseudonym(fhirClientProvider, taskHelper); + } + + @Bean + public SelectResponseTargetMedic selectResponseTargetMedic() + { + return new SelectResponseTargetMedic(fhirClientProvider, taskHelper); + } + + @Bean + public CheckTtpComputedMultiMedicResults checkTtpComputedMultiMedicResults() + { + return new CheckTtpComputedMultiMedicResults(fhirClientProvider, taskHelper); + } + + @Bean + public SendMultiMedicResults sendMultiMedicResults() + { + return new SendMultiMedicResults(fhirClientProvider, taskHelper, organizationProvider, fhirContext); + } + + @Bean + public SendMultiMedicErrors sendMultiMedicErrors() + { + return new SendMultiMedicErrors(fhirClientProvider, taskHelper, organizationProvider, fhirContext); + } + + @Bean + public HandleErrorMultiMedicResults handleErrorMultiMedicResults() + { + return new HandleErrorMultiMedicResults(fhirClientProvider, taskHelper); + } + + // + // process executeDataSharing implementations + // + + @Bean + public DownloadDataSharingResources downloadDataSharingResources() + { + return new DownloadDataSharingResources(fhirClientProvider, taskHelper, organizationProvider); + } + + @Bean + public CheckDataSharingResources checkDataSharingResources() + { + return new CheckDataSharingResources(fhirClientProvider, taskHelper); + } + + @Bean + public ModifyQueries modifyQueries() + { + return new ModifyQueries(fhirClientProvider, taskHelper); + } + + @Bean + public ExecuteQueries executeQueries() + { + return new ExecuteQueries(fhirClientProvider, taskHelper); + } + + @Bean + public ProvideLocalPseudonyms provideLocalPseudonyms() + { + return new ProvideLocalPseudonyms(fhirClientProvider, taskHelper); + } + + @Bean + public EncryptMdat encryptMdat() + { + return new EncryptMdat(fhirClientProvider, taskHelper); + } + + @Bean + public FilterQueryResultsByConsent filterQueryResultsByConsent() + { + return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper); + } + + @Bean + public GenerateBloomFilters generateBloomFilters() + { + return new GenerateBloomFilters(fhirClientProvider, taskHelper); + } + + @Bean + public BouncyCastleProvider bouncyCastleProvider() + { + return new BouncyCastleProvider(); + } + + @Bean + public CheckSingleMedicResults checkSingleMedicResults() + { + return new CheckSingleMedicResults(fhirClientProvider, taskHelper); + } + + @Bean + public SelectResponseTargetTtp selectResponseTargetTtp() + { + return new SelectResponseTargetTtp(fhirClientProvider, taskHelper, organizationProvider); + } + + @Bean + public SendSingleMedicResults sendSingleMedicResults() + { + return new SendSingleMedicResults(fhirClientProvider, taskHelper, organizationProvider, fhirContext); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java new file mode 100644 index 00000000..dfc10c39 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java @@ -0,0 +1,21 @@ +package org.highmed.dsf.bpe.spring.config; + +import org.highmed.dsf.bpe.variable.BloomFilterConfigSerializer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@Configuration +public class DataSharingSerializerConfig +{ + @Autowired + private ObjectMapper objectMapper; + + @Bean + public BloomFilterConfigSerializer bloomFilterConfigSerializer() + { + return new BloomFilterConfigSerializer(objectMapper); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java new file mode 100644 index 00000000..867d23a2 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java @@ -0,0 +1,111 @@ +package org.highmed.dsf.bpe.variable; + +import java.security.Key; + +import javax.crypto.spec.SecretKeySpec; + +import org.highmed.dsf.fhir.variables.KeyDeserializer; +import org.highmed.dsf.fhir.variables.KeySerializer; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; + +public class BloomFilterConfig +{ + private static final int SEED_LENGTH = 8; + private static final int HMAC_SHA2_KEY_LENGTH = 32; + private static final int HMAC_SHA3_KEY_LENGTH = 32; + + private final long permutationSeed; + + @JsonDeserialize(using = KeyDeserializer.class) + @JsonSerialize(using = KeySerializer.class) + private final Key hmacSha2Key; + + @JsonDeserialize(using = KeyDeserializer.class) + @JsonSerialize(using = KeySerializer.class) + private final Key hmacSha3Key; + + public static BloomFilterConfig fromBytes(byte[] bytes) + { + if (bytes.length != SEED_LENGTH + HMAC_SHA2_KEY_LENGTH + HMAC_SHA3_KEY_LENGTH) + throw new IllegalArgumentException( + "bytes.length = " + (SEED_LENGTH + HMAC_SHA2_KEY_LENGTH + HMAC_SHA3_KEY_LENGTH) + + " expected, but got " + bytes.length); + + byte[] seed = new byte[SEED_LENGTH]; + byte[] key1 = new byte[HMAC_SHA2_KEY_LENGTH]; + byte[] key2 = new byte[HMAC_SHA3_KEY_LENGTH]; + + System.arraycopy(bytes, 0, seed, 0, seed.length); + System.arraycopy(bytes, seed.length, key1, 0, key1.length); + System.arraycopy(bytes, seed.length + key1.length, key2, 0, key2.length); + + long permutationSeed = bigEndianToLong(seed); + Key hmacSha2Key = new SecretKeySpec(key1, "HmacSHA256"); + Key hmacSha3Key = new SecretKeySpec(key2, "HmacSHA3-256"); + + return new BloomFilterConfig(permutationSeed, hmacSha2Key, hmacSha3Key); + } + + @JsonCreator + public BloomFilterConfig( + @JsonProperty("permutationSeed") + long permutationSeed, + @JsonProperty("hmacSha2Key") + Key hmacSha2Key, + @JsonProperty("hmacSha3Key") + Key hmacSha3Key) + { + this.permutationSeed = permutationSeed; + this.hmacSha2Key = hmacSha2Key; + this.hmacSha3Key = hmacSha3Key; + } + + public long getPermutationSeed() + { + return permutationSeed; + } + + public Key getHmacSha2Key() + { + return hmacSha2Key; + } + + public Key getHmacSha3Key() + { + return hmacSha3Key; + } + + @JsonIgnore + public byte[] toBytes() + { + byte[] bytes = new byte[SEED_LENGTH + HMAC_SHA2_KEY_LENGTH + HMAC_SHA3_KEY_LENGTH]; + + byte[] seed = longToBigEndian(permutationSeed); + byte[] key1 = hmacSha2Key.getEncoded(); + byte[] key2 = hmacSha3Key.getEncoded(); + + System.arraycopy(seed, 0, bytes, 0, seed.length); + System.arraycopy(key1, 0, bytes, SEED_LENGTH, key1.length); + System.arraycopy(key2, 0, bytes, SEED_LENGTH + HMAC_SHA2_KEY_LENGTH, key2.length); + + return bytes; + } + + private static byte[] longToBigEndian(long l) + { + return new byte[] { (byte) (l >>> 56), (byte) (l >>> 48), (byte) (l >>> 40), (byte) (l >>> 32), + (byte) (l >>> 24), (byte) (l >>> 16), (byte) (l >>> 8), (byte) (l >>> 0) }; + } + + private static long bigEndianToLong(byte[] b) + { + return (((long) b[0] << 56) + ((long) (b[1] & 255) << 48) + ((long) (b[2] & 255) << 40) + ((long) (b[3] & 255) + << 32) + ((long) (b[4] & 255) << 24) + ((b[5] & 255) << 16) + ((b[6] & 255) << 8) + ((b[7] & 255) + << 0)); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java new file mode 100644 index 00000000..0173ac3a --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java @@ -0,0 +1,71 @@ +package org.highmed.dsf.bpe.variable; + +import java.io.IOException; +import java.util.Objects; + +import org.camunda.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer; +import org.camunda.bpm.engine.impl.variable.serializer.ValueFields; +import org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl; +import org.highmed.dsf.bpe.variable.BloomFilterConfigValues.BloomFilterConfigValue; +import org.springframework.beans.factory.InitializingBean; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class BloomFilterConfigSerializer extends PrimitiveValueSerializer + implements InitializingBean +{ + private final ObjectMapper objectMapper; + + public BloomFilterConfigSerializer(ObjectMapper objectMapper) + { + super(BloomFilterConfigValues.VALUE_TYPE); + + this.objectMapper = objectMapper; + } + + @Override + public void afterPropertiesSet() throws Exception + { + Objects.requireNonNull(objectMapper, "objectMapper"); + } + + @Override + public void writeValue(BloomFilterConfigValue value, ValueFields valueFields) + { + BloomFilterConfig target = value.getValue(); + try + { + if (target != null) + valueFields.setByteArrayValue(objectMapper.writeValueAsBytes(target)); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } + } + + @Override + public BloomFilterConfigValue convertToTypedValue(UntypedValueImpl untypedValue) + { + return BloomFilterConfigValues.create((BloomFilterConfig) untypedValue.getValue()); + } + + @Override + public BloomFilterConfigValue readValue(ValueFields valueFields, boolean asTransientValue) + { + byte[] bytes = valueFields.getByteArrayValue(); + + try + { + BloomFilterConfig target = (bytes == null || bytes.length <= 0) ? + null : + objectMapper.readValue(bytes, BloomFilterConfig.class); + return BloomFilterConfigValues.create(target); + } + catch (IOException e) + { + throw new RuntimeException(e); + } + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigValues.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigValues.java new file mode 100644 index 00000000..0f6b2570 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigValues.java @@ -0,0 +1,54 @@ +package org.highmed.dsf.bpe.variable; + +import java.util.Map; + +import org.camunda.bpm.engine.variable.impl.type.PrimitiveValueTypeImpl; +import org.camunda.bpm.engine.variable.impl.value.PrimitiveTypeValueImpl; +import org.camunda.bpm.engine.variable.type.PrimitiveValueType; +import org.camunda.bpm.engine.variable.value.PrimitiveValue; +import org.camunda.bpm.engine.variable.value.TypedValue; + +public class BloomFilterConfigValues +{ + public static interface BloomFilterConfigValue extends PrimitiveValue + { + } + + private static class BloomFilterConfigValueImpl extends PrimitiveTypeValueImpl + implements BloomFilterConfigValues.BloomFilterConfigValue + { + private static final long serialVersionUID = 1L; + + public BloomFilterConfigValueImpl(BloomFilterConfig value, PrimitiveValueType type) + { + super(value, type); + } + } + + public static class BloomFilterConfigValueTypeImpl extends PrimitiveValueTypeImpl + { + private static final long serialVersionUID = 1L; + + private BloomFilterConfigValueTypeImpl() + { + super(BloomFilterConfig.class); + } + + @Override + public TypedValue createValue(Object value, Map valueInfo) + { + return new BloomFilterConfigValues.BloomFilterConfigValueImpl((BloomFilterConfig) value, VALUE_TYPE); + } + } + + public static final PrimitiveValueType VALUE_TYPE = new BloomFilterConfigValues.BloomFilterConfigValueTypeImpl(); + + private BloomFilterConfigValues() + { + } + + public static BloomFilterConfigValues.BloomFilterConfigValue create(BloomFilterConfig value) + { + return new BloomFilterConfigValues.BloomFilterConfigValueImpl(value, VALUE_TYPE); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/resources/META-INF/services/org.highmed.dsf.bpe.ProcessPluginDefinition b/dsf-bpe-process-data-sharing/src/main/resources/META-INF/services/org.highmed.dsf.bpe.ProcessPluginDefinition new file mode 100644 index 00000000..5f28df5d --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/META-INF/services/org.highmed.dsf.bpe.ProcessPluginDefinition @@ -0,0 +1 @@ +org.highmed.dsf.bpe.DataSharingProcessPluginDefinition \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn new file mode 100644 index 00000000..f6cd8636 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn @@ -0,0 +1,282 @@ + + + + + SequenceFlow_1lfe4wr + SequenceFlow_0xxpamp + + + SequenceFlow_0mj024w + + + SequenceFlow_0by0at7 + SequenceFlow_0mj024w + + + + + ${target.correlationKey} + + + SequenceFlow_0qjt33w + SequenceFlow_0by0at7 + + + SequenceFlow_0qjt33w + + + + + + + SequenceFlow_0h3to47 + + PT5M + + + + SequenceFlow_01pjftq + + + + + + requestDataSharing + http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing + 0.4.0 + resultMultiMedicDataSharingMessage + + + Flow_1r6dq8y + + + + + + Flow_0gx8n5k + SequenceFlow_0t4lx4v + SequenceFlow_0calilw + + + + + ${!needsRecordLinkage} + + + SequenceFlow_0calilw + SequenceFlow_02zmrer + + + + SequenceFlow_02zmrer + SequenceFlow_0t4lx4v + Flow_1ixeke2 + + + SequenceFlow_01pjftq + SequenceFlow_1lfe4wr + + + Flow_1rtrx8w + Flow_1k0sqwo + + + + + requestDataSharing + http://highmed.org/fhir/StructureDefinition/task-error-data-sharing + 0.4.0 + errorMultiMedicDataSharingMessage + + + Flow_1tmnvhl + + + + Flow_1k0sqwo + Flow_1r6dq8y + + + + + + Flow_1tmnvhl + + + + + ${needsRecordLinkage} + + + SequenceFlow_0xxpamp + SequenceFlow_0h3to47 + Flow_0b5n9vc + + + + + Flow_0b5n9vc + Flow_0gx8n5k + + + + Flow_1ixeke2 + Flow_1rtrx8w + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn new file mode 100755 index 00000000..ca9128b9 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -0,0 +1,259 @@ + + + + + SequenceFlow_0q803rh + SequenceFlow_04ouilq + + + SequenceFlow_1etju4m + Flow_1kp6eaq + + + SequenceFlow_14cn0vs + + + + + + + SequenceFlow_14cn0vs + SequenceFlow_1etju4m + + + + + resultSingleMedicDataSharingMessage + 0.4.0 + computeDataSharing + http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing + + + SequenceFlow_0ascyjc + + + + + Flow_0fabwum + SequenceFlow_05r9whd + SequenceFlow_0isxkuy + + + ${!needsConsentCheck} + + + ${needsConsentCheck} + + + SequenceFlow_0isxkuy + SequenceFlow_0kzp6tl + + + SequenceFlow_05r9whd + SequenceFlow_0kzp6tl + SequenceFlow_1b4h5qz + + + + + SequenceFlow_1b4h5qz + SequenceFlow_1futlo2 + SequenceFlow_17otl7p + + + ${needsRecordLinkage} + + + SequenceFlow_1futlo2 + SequenceFlow_1ug2kru + + + SequenceFlow_1ug2kru + SequenceFlow_17otl7p + SequenceFlow_0q803rh + + + + + + SequenceFlow_04ouilq + SequenceFlow_0ascyjc + + + Flow_0qsitvp + SequenceFlow_1rmqv20 + + + + ${!needsRecordLinkage} + + + + Flow_1kp6eaq + Flow_0qsitvp + + + + Flow_0bkkg7n + Flow_0fabwum + + + + SequenceFlow_1rmqv20 + Flow_0bkkg7n + + + uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn new file mode 100644 index 00000000..3b278606 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn @@ -0,0 +1,197 @@ + + + + + + + Flow_0dd6nmz + + + + Flow_0dd6nmz + Flow_06otxko + + + + + + executeDataSharing + 0.4.0 + executeDataSharingMessage + http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing + + + Flow_18ie7l6 + Flow_1lw96cm + + + + Flow_1q5jnli + Flow_1gf3n6o + + + + Flow_1harl90 + Flow_1id9r0h + + + + Flow_1lw96cm + Flow_1q5jnli + Flow_1harl90 + + + Flow_1gf3n6o + Flow_0rwo9pn + + + Flow_1id9r0h + Flow_1s74o06 + + + Flow_0rwo9pn + Flow_1s74o06 + Flow_0amk6ah + + + Flow_0amk6ah + + + + + + + + + + + + + computeDataSharing + 0.4.0 + computeDataSharingMessage + http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing + + + Flow_0cx3xe1 + Flow_18ie7l6 + + + + + Flow_06otxko + Flow_0cx3xe1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml new file mode 100644 index 00000000..5296d7a5 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <subtitle value="Process to compute a data sharing result" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-16" /> + <publisher value="HiGHmed" /> + <contact> + <name value="HiGHmed" /> + <telecom> + <system value="email" /> + <value value="pmo@highmed.org" /> + </telecom> + </contact> + <description value="Process to compute a data sharing result and to send the result back to the requesting organization" /> + <kind value="Task" /> +</ActivityDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml new file mode 100644 index 00000000..42d1c229 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml @@ -0,0 +1,66 @@ +<ActivityDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> + <extension url="message-name"> + <valueString value="executeDataSharingMessage" /> + </extension> + <extension url="authorization-roles"> + <extension url="authorization-role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="LOCAL" /> + </valueCoding> + </extension> + <extension url="authorization-role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </valueCoding> + </extension> + </extension> + <extension url="requester-organization-types"> + <extension url="requester-organization-type"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <extension url="recipient-organization-types"> + <extension url="recipient-organization-type"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing" /> + </extension> + </extension> + <url value="http://highmed.org/bpe/Process/executeDataSharing" /> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="ExecuteDataSharing" /> + <title value="Execute Data Sharing" /> + <subtitle value="Process to execute a data sharing query" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-16" /> + <publisher value="HiGHmed" /> + <contact> + <name value="HiGHmed" /> + <telecom> + <system value="email" /> + <value value="pmo@highmed.org" /> + </telecom> + </contact> + <description value="Process to execute a data sharing query received from a MeDIC and to send result to a TTP" /> + <kind value="Task" /> +</ActivityDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml new file mode 100644 index 00000000..04d44a1c --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml @@ -0,0 +1,124 @@ +<ActivityDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> + <extension url="message-name"> + <valueString value="requestDataSharingMessage" /> + </extension> + <extension url="authorization-roles"> + <extension url="authorization-role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="LOCAL" /> + </valueCoding> + </extension> + </extension> + <extension url="requester-organization-types"> + <extension url="requester-organization-type"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <extension url="recipient-organization-types"> + <extension url="recipient-organization-type"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-request-data-sharing" /> + </extension> + </extension> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> + <extension url="message-name"> + <valueString value="resultMultiMedicDataSharingMessage" /> + </extension> + <extension url="authorization-roles"> + <extension url="authorization-role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </valueCoding> + </extension> + </extension> + <extension url="requester-organization-types"> + <extension url="requester-organization-type"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="TTP" /> + </valueCoding> + </extension> + </extension> + <extension url="recipient-organization-types"> + <extension url="recipient-organization-type"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing" /> + </extension> + </extension> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> + <extension url="message-name"> + <valueString value="errorMultiMedicDataSharingMessage" /> + </extension> + <extension url="authorization-roles"> + <extension url="authorization-role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </valueCoding> + </extension> + </extension> + <extension url="requester-organization-types"> + <extension url="requester-organization-type"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="TTP" /> + </valueCoding> + </extension> + </extension> + <extension url="recipient-organization-types"> + <extension url="recipient-organization-type"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing" /> + </extension> + </extension> + <url value="http://highmed.org/bpe/Process/requestDataSharing" /> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="RequestDataSharing" /> + <title value="Request Data Sharing" /> + <subtitle value="Process to request data sharing" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-16" /> + <publisher value="HiGHmed" /> + <contact> + <name value="HiGHmed" /> + <telecom> + <system value="email" /> + <value value="pmo@highmed.org" /> + </telecom> + </contact> + <description value="Process to start a data sharing project, process sends messages to all MeDICs and a TTP, receives result from TTP" /> + <kind value="Task" /> +</ActivityDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml new file mode 100644 index 00000000..7fd9f970 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml @@ -0,0 +1,68 @@ +<CodeSystem xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> + <code value="REMOTE"/> + </tag> + </meta> + <url value="http://highmed.org/fhir/CodeSystem/data-sharing"/> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="HiGHmed_Data_Sharing"/> + <title value="HiGHmed Data Sharing"/> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false"/> + <date value="2020-11-23"/> + <publisher value="HiGHmed"/> + <description value="CodeSystem with standard values for HiGhmed data sharing processes"/> + <caseSensitive value="true"/> + <hierarchyMeaning value="grouped-by"/> + <versionNeeded value="false"/> + <content value="complete"/> + <concept> + <code value="research-study-reference"/> + <display value="Research Study Reference"/> + <definition value="HiGHmed Research Study Reference to define what data is requested from which MeDICs and for what purpose"/> + </concept> + <concept> + <code value="needs-record-linkage"/> + <display value="Needs Record Linkage"/> + <definition value="Boolean indicating if a data analysis needs record linkage"/> + </concept> + <concept> + <code value="needs-consent-check"/> + <display value="Needs Consent Check"/> + <definition value="Boolean indicating if a data analysis needs consent check"/> + </concept> + <concept> + <code value="bloom-filter-configuration"/> + <display value="Bloom Filter Cconfiguration"/> + <definition value="Base64 binary encoded bloom filter configuration"/> + </concept> + <concept> + <code value="medic-correlation-key"/> + <display value="MeDIC Correlation Key"/> + <definition value="MeDIC Correlation Key transferred to TTP for correlating incoming medic results"/> + </concept> + <concept> + <code value="single-medic-result"/> + <display value="Single MeDIC Result"/> + <definition value="Result of a single query execution"/> + </concept> + <concept> + <code value="single-medic-result-reference"/> + <display value="Single MeDIC Result Reference"/> + <definition value="Reference to an openEHR ResultSet as a result of a single query execution"/> + </concept> + <concept> + <code value="multi-medic-result"/> + <display value="Multi MeDIC Result"/> + <definition value="Aggregated result of all single medic results"/> + </concept> + <concept> + <code value="participating-medics"/> + <display value="Participating MeDICs"/> + <definition value="Count of all MeDICs who participated in a data sharing request"/> + </concept> +</CodeSystem> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-query-type.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-query-type.xml new file mode 100644 index 00000000..5904bf42 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-query-type.xml @@ -0,0 +1,28 @@ +<CodeSystem xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> + <code value="REMOTE"/> + </tag> + </meta> + <url value="http://highmed.org/fhir/CodeSystem/query-type"/> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="HiGHmed_Query_Type"/> + <title value="HiGHmed Query Type"/> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false"/> + <date value="2020-11-23"/> + <publisher value="HiGHmed"/> + <description value="CodeSystem with HiGHmed query types for medical data stored in the data lake repositories"/> + <caseSensitive value="true"/> + <hierarchyMeaning value="grouped-by"/> + <versionNeeded value="false"/> + <content value="complete"/> + <concept> + <code value="application/x-aql-query"/> + <display value="AQL Query"/> + <definition value="Archetype Query Language."/> + </concept> +</CodeSystem> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/NamingSystem/highmed-research-study-identifier.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/NamingSystem/highmed-research-study-identifier.xml new file mode 100644 index 00000000..5ee14d02 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/NamingSystem/highmed-research-study-identifier.xml @@ -0,0 +1,21 @@ +<NamingSystem xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> + <code value="REMOTE"/> + </tag> + </meta> + <name value="HiGHmed_ResearchStudy_Identifier"/> + <!-- status managed by bpe --> + <status value="unknown" /> + <kind value="identifier"/> + <date value="2020-11-23"/> + <publisher value="HiGHmed"/> + <responsible value="HiGHmed"/> + <description value="UUID used to identify a ResearchStudy"/> + <usage value="Used withing HiGHmed to identify research studies"/> + <uniqueId> + <type value="uuid"/> + <value value="http://highmed.org/fhir/NamingSystem/research-study-identifier"/> + </uniqueId> +</NamingSystem> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-group-id.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-group-id.xml new file mode 100644 index 00000000..0a100f49 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-group-id.xml @@ -0,0 +1,57 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="GroupId" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-23" /> + <fhirVersion value="4.0.1" /> + <mapping> + <identity value="rim" /> + <uri value="http://hl7.org/v3" /> + <name value="RIM Mapping" /> + </mapping> + <kind value="complex-type" /> + <abstract value="false" /> + <context> + <type value="element" /> + <expression value="BackboneElement" /> + </context> + <type value="Extension" /> + <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension" /> + <derivation value="constraint" /> + <differential> + <element id="Extension"> + <path value="Extension" /> + <max value="1" /> + </element> + <element id="Extension.url"> + <path value="Extension.url" /> + <fixedUri value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> + </element> + <element id="Extension.value[x]"> + <path value="Extension.value[x]" /> + <min value="1" /> + <type> + <code value="Reference" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/group" /> + </type> + </element> + <element id="Extension.value[x].reference"> + <path value="Extension.value[x].reference" /> + <min value="1" /> + </element> + <element id="Extension.value[x].identifier"> + <path value="Extension.value[x].identifier" /> + <max value="0" /> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-medic.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-medic.xml new file mode 100644 index 00000000..6730b226 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-medic.xml @@ -0,0 +1,69 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/extension-participating-medic" /> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="ParticipatingMedic" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-23" /> + <fhirVersion value="4.0.1" /> + <kind value="complex-type" /> + <abstract value="false" /> + <context> + <type value="element" /> + <expression value="ResearchStudy" /> + </context> + <type value="Extension" /> + <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension" /> + <derivation value="constraint" /> + <differential> + <element id="Extension"> + <path value="Extension" /> + <short value="ParticipatingMedic" /> + <definition value="Used to denote the medic organizations that are requested to supply data for the study at hand." /> + </element> + <element id="Extension.url"> + <path value="Extension.url" /> + <fixedUri value="http://highmed.org/fhir/StructureDefinition/extension-participating-medic" /> + </element> + <element id="Extension.value[x]"> + <path value="Extension.value[x]" /> + <short value="ParticipatingMedic" /> + <definition value="Organization reference used to denote the medic organizations that are requested to supply data for the study at hand." /> + <min value="1" /> + <type> + <code value="Reference" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/organization" /> + </type> + </element> + <element id="Extension.value[x].reference"> + <path value="Extension.value[x].reference" /> + <max value="0" /> + </element> + <element id="Extension.value[x].type"> + <path value="Extension.value[x].type" /> + <min value="1" /> + <fixedUri value="Organization" /> + </element> + <element id="Extension.value[x].identifier"> + <path value="Extension.value[x].identifier" /> + <min value="1" /> + </element> + <element id="Extension.value[x].identifier.system"> + <path value="Extension.value[x].identifier.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/NamingSystem/organization-identifier" /> + </element> + <element id="Extension.value[x].identifier.value"> + <path value="Extension.value[x].identifier.value" /> + <min value="1" /> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-ttp.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-ttp.xml new file mode 100644 index 00000000..14fe8497 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-ttp.xml @@ -0,0 +1,69 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/extension-participating-ttp" /> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="ParticipatingTtp" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-23" /> + <fhirVersion value="4.0.1" /> + <kind value="complex-type" /> + <abstract value="false" /> + <context> + <type value="element" /> + <expression value="ResearchStudy" /> + </context> + <type value="Extension" /> + <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension" /> + <derivation value="constraint" /> + <differential> + <element id="Extension"> + <path value="Extension" /> + <short value="ParticipatingTtp" /> + <definition value="Used to denote the TTP organization that is used to record link and pseudonymize data." /> + </element> + <element id="Extension.url"> + <path value="Extension.url" /> + <fixedUri value="http://highmed.org/fhir/StructureDefinition/extension-participating-ttp" /> + </element> + <element id="Extension.value[x]"> + <path value="Extension.value[x]" /> + <short value="ParticipatingMedic" /> + <definition value="Organization reference used to denote the TTP organization that is used to record link and pseudonymize data." /> + <min value="1" /> + <type> + <code value="Reference" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/organization" /> + </type> + </element> + <element id="Extension.value[x].reference"> + <path value="Extension.value[x].reference" /> + <max value="0" /> + </element> + <element id="Extension.value[x].type"> + <path value="Extension.value[x].type" /> + <min value="1" /> + <fixedUri value="Organization" /> + </element> + <element id="Extension.value[x].identifier"> + <path value="Extension.value[x].identifier" /> + <min value="1" /> + </element> + <element id="Extension.value[x].identifier.system"> + <path value="Extension.value[x].identifier.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/NamingSystem/organization-identifier" /> + </element> + <element id="Extension.value[x].identifier.value"> + <path value="Extension.value[x].identifier.value" /> + <min value="1" /> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-query.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-query.xml new file mode 100644 index 00000000..59aef12e --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-query.xml @@ -0,0 +1,51 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/extension-query" /> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="Query" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-23" /> + <fhirVersion value="4.0.1" /> + <kind value="complex-type" /> + <abstract value="false" /> + <context> + <type value="element" /> + <expression value="Group" /> + </context> + <type value="Extension" /> + <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension" /> + <derivation value="constraint" /> + <differential> + <element id="Extension.url"> + <path value="Extension.url" /> + <fixedUri value="http://highmed.org/fhir/StructureDefinition/extension-query" /> + </element> + <element id="Extension.value[x]"> + <path value="Extension.value[x]" /> + <min value="1" /> + <type> + <code value="Expression" /> + </type> + </element> + <element id="Extension.value[x].language"> + <path value="Extension.value[x].language" /> + <short value="application/x-fhir-query | application/x-aql-query" /> + <binding> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/query-type" /> + </binding> + </element> + <element id="Extension.value[x].expression"> + <path value="Extension.value[x].expression" /> + <min value="1" /> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-group.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-group.xml new file mode 100644 index 00000000..35e706a2 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-group.xml @@ -0,0 +1,52 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/group" /> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="Group" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-23" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Group" /> + <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Group" /> + <derivation value="constraint" /> + <differential> + <element id="Group.extension"> + <path value="Group.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + </element> + <element id="Group.extension:query"> + <path value="Group.extension" /> + <sliceName value="query" /> + <min value="1" /> + <max value="1" /> + <type> + <code value="Extension" /> + <profile value="http://highmed.org/fhir/StructureDefinition/extension-query" /> + </type> + </element> + <element id="Group.type"> + <path value="Group.type" /> + <fixedCode value="person" /> + </element> + <element id="Group.actual"> + <path value="Group.actual" /> + <fixedBoolean value="false" /> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml new file mode 100644 index 00000000..b78e1d28 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml @@ -0,0 +1,95 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/research-study-data-sharing" /> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="ResearchStudyDataSharing" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-23" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="ResearchStudy" /> + <baseDefinition value="http://hl7.org/fhir/StructureDefinition/ResearchStudy" /> + <derivation value="constraint" /> + <differential> + <element id="ResearchStudy.extension"> + <path value="ResearchStudy.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + </element> + <element id="ResearchStudy.extension:participating-ttp"> + <path value="ResearchStudy.extension" /> + <sliceName value="participating-ttp" /> + <min value="1" /> + <max value="1" /> + <type> + <code value="Extension" /> + <profile value="http://highmed.org/fhir/StructureDefinition/extension-participating-ttp" /> + </type> + </element> + <element id="ResearchStudy.extension:participating-medic"> + <path value="ResearchStudy.extension" /> + <sliceName value="participating-medic" /> + <min value="1" /> + <type> + <code value="Extension" /> + <profile value="http://highmed.org/fhir/StructureDefinition/extension-participating-medic" /> + </type> + </element> + <element id="ResearchStudy.identifier"> + <path value="ResearchStudy.identifier" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="system" /> + </discriminator> + <rules value="open" /> + </slicing> + <min value="1" /> + </element> + <element id="ResearchStudy.identifier:highmedIdentifier"> + <path value="ResearchStudy.identifier" /> + <sliceName value="highmedIdentifier" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="ResearchStudy.identifier:highmedIdentifier.system"> + <path value="ResearchStudy.identifier.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/NamingSystem/research-study-identifier" /> + </element> + <element id="ResearchStudy.identifier:highmedIdentifier.value"> + <path value="ResearchStudy.identifier.value" /> + <min value="1" /> + </element> + <element id="ResearchStudy.enrollment"> + <path value="ResearchStudy.enrollment" /> + <min value="1" /> + <type> + <code value="Reference" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/group" /> + </type> + </element> + <element id="ResearchStudy.enrollment.reference"> + <path value="ResearchStudy.enrollment.reference" /> + <min value="1" /> + </element> + <element id="ResearchStudy.enrollment.identifier"> + <path value="ResearchStudy.enrollment.identifier" /> + <max value="0" /> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml new file mode 100644 index 00000000..e437015d --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml @@ -0,0 +1,142 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing" /> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="TaskComputeDataSharing" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-16" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Task" /> + <baseDefinition value="http://highmed.org/fhir/StructureDefinition/task-base" /> + <derivation value="constraint" /> + <differential> + <element id="Task.instantiatesUri"> + <path value="Task.instantiatesUri" /> + <fixedUri value="http://highmed.org/bpe/Process/computeDataSharing/0.4.0" /> + </element> + <element id="Task.input"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <min value="4" /> + </element> + <element id="Task.input:message-name"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="message-name" /> + </element> + <element id="Task.input:message-name.value[x]"> + <path value="Task.input.value[x]" /> + <fixedString value="computeDataSharingMessage" /> + </element> + <element id="Task.input:business-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="business-key" /> + <min value="1" /> + </element> + <element id="Task.input:correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="correlation-key" /> + <min value="0" /> + <max value="0" /> + </element> + <element id="Task.input:medic-correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="medic-correlation-key" /> + <min value="1" /> + </element> + <element id="Task.input:medic-correlation-key.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:medic-correlation-key.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:medic-correlation-key.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:medic-correlation-key.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="medic-correlation-key" /> + </element> + <element id="Task.input:medic-correlation-key.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="string" /> + </type> + </element> + <element id="Task.input:needs-record-linkage"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="needs-record-linkage" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:needs-record-linkage.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:needs-record-linkage.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:needs-record-linkage.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:needs-record-linkage.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="needs-record-linkage" /> + </element> + <element id="Task.input:needs-record-linkage.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="boolean" /> + </type> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml new file mode 100644 index 00000000..cf2365ca --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml @@ -0,0 +1,224 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing" /> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="TaskExecuteDataSharing" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-16" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Task" /> + <baseDefinition value="http://highmed.org/fhir/StructureDefinition/task-base" /> + <derivation value="constraint" /> + <differential> + <element id="Task.instantiatesUri"> + <path value="Task.instantiatesUri" /> + <fixedUri value="http://highmed.org/bpe/Process/executeDataSharing/0.4.0" /> + </element> + <element id="Task.input"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <min value="6" /> + <max value="7" /> + </element> + <element id="Task.input:message-name"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="message-name" /> + </element> + <element id="Task.input:message-name.value[x]"> + <path value="Task.input.value[x]" /> + <fixedString value="executeDataSharingMessage" /> + </element> + <element id="Task.input:business-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="business-key" /> + <min value="1" /> + </element> + <element id="Task.input:correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="correlation-key" /> + <min value="1" /> + </element> + <element id="Task.input:research-study"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="research-study" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:research-study.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:research-study.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:research-study.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:research-study.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="research-study-reference" /> + </element> + <element id="Task.input:research-study.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="Reference" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/research-study-data-sharing" /> + </type> + </element> + <element id="Task.input:needs-record-linkage"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="needs-record-linkage" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:needs-record-linkage.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:needs-record-linkage.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:needs-record-linkage.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:needs-record-linkage.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="needs-record-linkage" /> + </element> + <element id="Task.input:needs-record-linkage.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="boolean" /> + </type> + </element> + <element id="Task.input:needs-consent-check"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="needs-consent-check" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:needs-consent-check.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:needs-consent-check.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:needs-consent-check.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:needs-consent-check.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="needs-consent-check" /> + </element> + <element id="Task.input:needs-consent-check.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="boolean" /> + </type> + </element> + <element id="Task.input:bloom-filter-configuration"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="bloom-filter-configuration" /> + <min value="0" /> + <max value="1" /> + </element> + <element id="Task.input:bloom-filter-configuration.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:bloom-filter-configuration.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:bloom-filter-configuration.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:bloom-filter-configuration.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="bloom-filter-configuration" /> + </element> + <element id="Task.input:bloom-filter-configuration.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="base64Binary" /> + </type> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml new file mode 100644 index 00000000..8eabdfe8 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml @@ -0,0 +1,100 @@ +<?xml version="1.0" encoding="utf-8"?> +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing" /> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="TaskErrorDataSharing" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-16" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Task" /> + <baseDefinition value="http://highmed.org/fhir/StructureDefinition/task-base" /> + <derivation value="constraint" /> + <differential> + <element id="Task.instantiatesUri"> + <path value="Task.instantiatesUri" /> + <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/0.4.0" /> + </element> + <element id="Task.input"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <min value="3" /> + </element> + <element id="Task.input:message-name"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="message-name" /> + </element> + <element id="Task.input:message-name.value[x]"> + <path value="Task.input.value[x]" /> + <fixedString value="errorMultiMedicDataSharingMessage" /> + </element> + <element id="Task.input:business-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="business-key" /> + <min value="1" /> + </element> + <element id="Task.input:correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="correlation-key" /> + <min value="0" /> + <max value="0" /> + </element> + <element id="Task.input:error"> + <path value="Task.input" /> + <sliceName value="error" /> + <min value="1" /> + </element> + <element id="Task.input:error.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/bpmn-message" /> + </binding> + </element> + <element id="Task.input:error.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:error.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/bpmn-message" /> + </element> + <element id="Task.input:error.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="error" /> + </element> + <element id="Task.input:error.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="string" /> + </type> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml new file mode 100644 index 00000000..d56e929f --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml @@ -0,0 +1,63 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing" /> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="TaskMultiMedicResultDataSharing" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-16" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Task" /> + <baseDefinition value="http://highmed.org/fhir/StructureDefinition/task-base" /> + <derivation value="constraint" /> + <differential> + <element id="Task.instantiatesUri"> + <path value="Task.instantiatesUri" /> + <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/0.4.0" /> + </element> + <element id="Task.input"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <min value="2" /> + </element> + <element id="Task.input:message-name"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="message-name" /> + </element> + <element id="Task.input:message-name.value[x]"> + <path value="Task.input.value[x]" /> + <fixedString value="resultMultiMedicDataSharingMessage" /> + </element> + <element id="Task.input:business-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="business-key" /> + <min value="1" /> + </element> + <element id="Task.input:correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="correlation-key" /> + <min value="0" /> + <max value="0" /> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml new file mode 100644 index 00000000..b60674fa --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml @@ -0,0 +1,192 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/task-request-data-sharing" /> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="TaskRequestDataSharing" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-16" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Task" /> + <baseDefinition value="http://highmed.org/fhir/StructureDefinition/task-base" /> + <derivation value="constraint" /> + <differential> + <element id="Task.instantiatesUri"> + <path value="Task.instantiatesUri" /> + <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/0.4.0" /> + </element> + <element id="Task.input"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <min value="4" /> + <max value="4" /> + </element> + <element id="Task.input:message-name"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="message-name" /> + </element> + <element id="Task.input:message-name.value[x]"> + <path value="Task.input.value[x]" /> + <fixedString value="requestDataSharingMessage" /> + </element> + <element id="Task.input:business-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="business-key" /> + <max value="0" /> + </element> + <element id="Task.input:correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="correlation-key" /> + <max value="0" /> + </element> + <element id="Task.input:research-study-reference"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="research-study-reference" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:research-study-reference.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:research-study-reference.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:research-study-reference.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:research-study-reference.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="research-study-reference" /> + </element> + <element id="Task.input:research-study-reference.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="Reference" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/research-study-data-sharing" /> + </type> + </element> + <element id="Task.input:research-study-reference.value[x].reference"> + <path value="Task.input.value[x].reference" /> + <min value="1" /> + </element> + <element id="Task.input:research-study-reference.value[x].identifier"> + <path value="Task.input.value[x].identifier" /> + <max value="0" /> + </element> + <element id="Task.input:needs-record-linkage"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="needs-record-linkage" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:needs-record-linkage.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:needs-record-linkage.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:needs-record-linkage.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:needs-record-linkage.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="needs-record-linkage" /> + </element> + <element id="Task.input:needs-record-linkage.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="boolean" /> + </type> + </element> + <element id="Task.input:needs-consent-check"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="needs-consent-check" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:needs-consent-check.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:needs-consent-check.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:needs-consent-check.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:needs-consent-check.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="needs-consent-check" /> + </element> + <element id="Task.input:needs-consent-check.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="boolean" /> + </type> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml new file mode 100644 index 00000000..84e0251a --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml @@ -0,0 +1,62 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing" /> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="TaskSingleMedicResultDataSharing" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2020-11-16" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Task" /> + <baseDefinition value="http://highmed.org/fhir/StructureDefinition/task-base" /> + <derivation value="constraint" /> + <differential> + <element id="Task.instantiatesUri"> + <path value="Task.instantiatesUri" /> + <fixedUri value="http://highmed.org/bpe/Process/computeDataSharing/0.4.0" /> + </element> + <element id="Task.input"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <min value="3" /> + </element> + <element id="Task.input:message-name"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="message-name" /> + </element> + <element id="Task.input:message-name.value[x]"> + <path value="Task.input.value[x]" /> + <fixedString value="resultSingleMedicDataSharingMessage" /> + </element> + <element id="Task.input:business-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="business-key" /> + <min value="1" /> + </element> + <element id="Task.input:correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="correlation-key" /> + <min value="1" /> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml new file mode 100644 index 00000000..d04ccfdf --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml @@ -0,0 +1,25 @@ +<ValueSet xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> + <code value="REMOTE"/> + </tag> + </meta> + <url value="http://highmed.org/fhir/ValueSet/data-sharing"/> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="HiGHmed_Data_Sharing"/> + <title value="HiGHmed Data Sharing"/> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false"/> + <date value="2020-11-23"/> + <publisher value="HiGHmed"/> + <description value="ValueSet with standard values for HiGhmed data sharing processes"/> + <immutable value="true"/> + <compose> + <include> + <system value="http://highmed.org/fhir/CodeSystem/data-sharing"/> + </include> + </compose> +</ValueSet> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-query-type.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-query-type.xml new file mode 100644 index 00000000..6cde8914 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-query-type.xml @@ -0,0 +1,37 @@ +<ValueSet xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> + <code value="REMOTE"/> + </tag> + </meta> + <url value="http://highmed.org/fhir/ValueSet/query-type"/> + <!-- version managed by bpe --> + <version value="bpe-managed" /> + <name value="HiGHmed_Query_Type"/> + <title value="HiGHmed Query Type"/> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false"/> + <date value="2020-11-23"/> + <publisher value="HiGHmed"/> + <description + value="ValueSet with HiGHmed query types used in Group resources query extension of the expression datatype"/> + <immutable value="true"/> + <compose> + <include> + <system value="http://hl7.org/fhir/expression-language"/> + <concept> + <code value="application/x-fhir-query"/> + <display value="FHIR Query"/> + </concept> + </include> + <include> + <system value="http://highmed.org/fhir/CodeSystem/query-type"/> + <concept> + <code value="application/x-aql-query"/> + <display value="AQL Query"/> + </concept> + </include> + </compose> +</ValueSet> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java new file mode 100644 index 00000000..32bc94c6 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -0,0 +1,159 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsBase.CODE_TYPE_AQL_QUERY; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; +import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_TTP; +import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_QUERY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_GROUP; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_RESEARCH_STUDY_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.MEDIC_1_FHIR_BASE_URL; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; + +import java.util.Date; +import java.util.UUID; + +import org.hl7.fhir.r4.model.BooleanType; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.Expression; +import org.hl7.fhir.r4.model.Group; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Narrative; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResearchStudy; +import org.hl7.fhir.r4.model.ResourceType; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.TaskIntent; +import org.hl7.fhir.r4.model.Task.TaskStatus; + +public class RequestDataSharingFromMedicsViaMedic1ExampleStarter +{ + // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate + // password + public static void main(String[] args) throws Exception + { + Bundle bundle = createStartResource(); + ExampleStarter.forServer(args, MEDIC_1_FHIR_BASE_URL).startWith(bundle); + } + + private static Bundle createStartResource() + { + Group group1 = createGroup("Group 1"); + Group group2 = createGroup("Group 2"); + ResearchStudy researchStudy = createResearchStudy(group1, group2); + Task task = createTask(researchStudy); + + Bundle bundle = new Bundle(); + bundle.setType(Bundle.BundleType.TRANSACTION); + bundle.addEntry().setResource(group1).setFullUrl(group1.getIdElement().getIdPart()).getRequest() + .setMethod(Bundle.HTTPVerb.POST).setUrl(ResourceType.Group.name()); + bundle.addEntry().setResource(group2).setFullUrl(group2.getIdElement().getIdPart()).getRequest() + .setMethod(Bundle.HTTPVerb.POST).setUrl(ResourceType.Group.name()); + bundle.addEntry().setResource(researchStudy).setFullUrl(researchStudy.getIdElement().getIdPart()).getRequest() + .setMethod(Bundle.HTTPVerb.POST).setUrl(ResourceType.ResearchStudy.name()); + bundle.addEntry().setResource(task).setFullUrl(task.getIdElement().getIdPart()).getRequest() + .setMethod(Bundle.HTTPVerb.POST).setUrl(ResourceType.Task.name()); + + return bundle; + } + + private static Group createGroup(String name) + { + Group group = new Group(); + group.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); + + group.getMeta().addProfile(PROFILE_HIGHMED_GROUP); + group.getText().getDiv().addText("This is the description"); + group.getText().setStatus(Narrative.NarrativeStatus.ADDITIONAL); + group.setType(Group.GroupType.PERSON); + group.setActual(false); + group.setActive(true); + group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY).setValue( + new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression("SELECT COUNT(e) FROM EHR e")); + group.setName(name); + + return group; + } + + private static ResearchStudy createResearchStudy(Group group1, Group group2) + { + ResearchStudy researchStudy = new ResearchStudy(); + researchStudy.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); + + researchStudy.getMeta().addProfile(PROFILE_HIGHMED_RESEARCH_STUDY_DATA_SHARING); + researchStudy.addIdentifier().setSystem(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER) + .setValue(UUID.randomUUID().toString()); + researchStudy.setStatus(ResearchStudy.ResearchStudyStatus.ACTIVE); + researchStudy.addEnrollment().setReference(group1.getIdElement().getIdPart()); + researchStudy.addEnrollment().setReference(group2.getIdElement().getIdPart()); + + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( + new Reference().setType(ResourceType.Organization.name()).setIdentifier( + new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1))); + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( + new Reference().setType(ResourceType.Organization.name()).setIdentifier( + new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2))); + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( + new Reference().setType(ResourceType.Organization.name()).setIdentifier( + new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3))); + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP).setValue( + new Reference().setType(ResourceType.Organization.name()).setIdentifier( + new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP))); + + return researchStudy; + } + + private static Task createTask(ResearchStudy researchStudy) + { + Task task = new Task(); + task.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); + + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME)).getType() + .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart()) + .setType(ResourceType.ResearchStudy.name())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); + task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); + task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); + + return task; + } +} diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/.keep b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/.keep new file mode 100644 index 00000000..e69de29b diff --git a/dsf-bpe-process-data-sharing/src/test/resources/log4j2.xml b/dsf-bpe-process-data-sharing/src/test/resources/log4j2.xml new file mode 100644 index 00000000..f1afe81d --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/test/resources/log4j2.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Configuration status="INFO" monitorInterval="30" + verbose="false"> + + <Appenders> + <Console name="CONSOLE" target="SYSTEM_OUT"> + <PatternLayout pattern="%p\t%t - %C{1}.%M(%L) | %m%n"/> + </Console> + <!-- <RollingFile name="FILE" fileName="log/adt_db.log" + filePattern="log/adt_db_%d{MM-dd-yyyy}_%i.log.gz" + ignoreExceptions="false"> + <PatternLayout> + <Pattern>%d [%t] %-5p %c - %m%n</Pattern> + </PatternLayout> + <Policies> + <OnStartupTriggeringPolicy /> + <TimeBasedTriggeringPolicy /> + </Policies> + </RollingFile> --> + + <!-- <SMTP name="MAIL" subject="Production RWH LAB Gateway Error" + to="hauke.hund@med.uni-heidelberg.de, thomas.hilbel@med.uni-heidelberg.de" + from="med3-kvm15@med.uni-heidelberg.de" + replyTo="hauke.hund@med.uni-heidelberg.de" smtpHost="localhost" + smtpPort="25" bufferSize="50"> + </SMTP> + <SMTP name="MAIL_CERTIFICATE" subject="Production RWH LAB Gateway Certificate Warning" + to="hauke.hund@med.uni-heidelberg.de, thomas.hilbel@med.uni-heidelberg.de" + from="med3-kvm15@med.uni-heidelberg.de" + replyTo="hauke.hund@med.uni-heidelberg.de" smtpHost="localhost" + smtpPort="25" bufferSize="1"> + <ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY"/> + </SMTP> + <SMTP name="MAIL_HL7" subject="Production RWH ADT Gateway HL7 Warning" + to="hauke.hund@med.uni-heidelberg.de, thomas.hilbel@med.uni-heidelberg.de" + from="med3-kvm15@med.uni-heidelberg.de" + replyTo="hauke.hund@med.uni-heidelberg.de" smtpHost="localhost" + smtpPort="25" bufferSize="1"> + <ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY"/> + </SMTP> --> + </Appenders> + + <Loggers> + <Logger name="de.rwh" level="TRACE"/> + <Logger name="org.highmed" level="TRACE"/> + <Logger name="org.apache" level="WARN"/> + <Logger name="org.springframework" level="WARN"/> + <Logger name="jndi" level="WARN"/> + <Logger name="org.eclipse.jetty" level="INFO"/> + <Logger name="com.sun.jersey" level="WARN"/> + <Logger name="liquibase" level="WARN"/> + <Logger name="ca.uhn.hl7v2" level="WARN"/> + + <!-- <Logger name="certificate-warning-logger" level="INFO"> + <AppenderRef ref="MAIL_CERTIFICATE" /> + </Logger> + <Logger name="async-message-handler-warning-logger" level="INFO"> + <AppenderRef ref="MAIL_HL7" /> + </Logger> --> + + <Root level="WARN"> + <AppenderRef ref="CONSOLE"/> + <!-- <AppenderRef ref="FILE" /> --> + <!-- <AppenderRef ref="MAIL" /> --> + </Root> + </Loggers> +</Configuration> \ No newline at end of file diff --git a/pom.xml b/pom.xml index d0bd9c59..2e5ee322 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,11 @@ <artifactId>dsf-bpe-highmed-processes-pom</artifactId> <version>0.4.0-SNAPSHOT</version> <packaging>pom</packaging> - + + <modules> + <module>dsf-bpe-process-data-sharing</module> + </modules> + <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <compileSource>11</compileSource> @@ -16,7 +20,7 @@ </properties> <name>highmed-processes</name> - <description>HiGHmed Processes</description> + <description>HiGHmed DSF HiGHmed Processes</description> <url>https://github.com/highmed/highmed-processes</url> <scm> @@ -41,6 +45,11 @@ <artifactId>dsf-bpe-process-base</artifactId> <version>0.4.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>org.highmed.dsf.processes</groupId> + <artifactId>dsf-bpe-process-data-sharing</artifactId> + <version>0.4.0-SNAPSHOT</version> + </dependency> <dependency> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-fhir-validation</artifactId> From 654aa23e971f0b0fc0a87bb348068c98007042f9 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 15 Jan 2021 16:05:37 +0100 Subject: [PATCH 002/125] move common highmed classes and resources in its own module --- .../dependency-reduced-pom.xml | 237 ++++++++++++++++++ dsf-bpe-process-data-sharing/pom.xml | 21 ++ .../DataSharingProcessPluginDefinition.java | 2 + dsf-bpe-process-highmed-base/pom.xml | 28 +++ .../dsf/bpe/variable/BloomFilterConfig.java | 0 .../variable/BloomFilterConfigSerializer.java | 0 .../bpe/variable/BloomFilterConfigValues.java | 0 .../fhir/CodeSystem/highmed-query-type.xml | 0 .../highmed-research-study-identifier.xml | 0 .../highmed-extension-group-id.xml | 0 .../highmed-extension-participating-medic.xml | 0 .../highmed-extension-participating-ttp.xml | 0 .../highmed-extension-query.xml | 0 .../StructureDefinition/highmed-group.xml | 0 .../fhir/ValueSet/highmed-query-type.xml | 0 pom.xml | 8 +- 16 files changed, 294 insertions(+), 2 deletions(-) create mode 100644 dsf-bpe-process-data-sharing/dependency-reduced-pom.xml create mode 100644 dsf-bpe-process-highmed-base/pom.xml rename {dsf-bpe-process-data-sharing => dsf-bpe-process-highmed-base}/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java (100%) rename {dsf-bpe-process-data-sharing => dsf-bpe-process-highmed-base}/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java (100%) rename {dsf-bpe-process-data-sharing => dsf-bpe-process-highmed-base}/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigValues.java (100%) rename {dsf-bpe-process-data-sharing => dsf-bpe-process-highmed-base}/src/main/resources/fhir/CodeSystem/highmed-query-type.xml (100%) rename {dsf-bpe-process-data-sharing => dsf-bpe-process-highmed-base}/src/main/resources/fhir/NamingSystem/highmed-research-study-identifier.xml (100%) rename {dsf-bpe-process-data-sharing => dsf-bpe-process-highmed-base}/src/main/resources/fhir/StructureDefinition/highmed-extension-group-id.xml (100%) rename {dsf-bpe-process-data-sharing => dsf-bpe-process-highmed-base}/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-medic.xml (100%) rename {dsf-bpe-process-data-sharing => dsf-bpe-process-highmed-base}/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-ttp.xml (100%) rename {dsf-bpe-process-data-sharing => dsf-bpe-process-highmed-base}/src/main/resources/fhir/StructureDefinition/highmed-extension-query.xml (100%) rename {dsf-bpe-process-data-sharing => dsf-bpe-process-highmed-base}/src/main/resources/fhir/StructureDefinition/highmed-group.xml (100%) rename {dsf-bpe-process-data-sharing => dsf-bpe-process-highmed-base}/src/main/resources/fhir/ValueSet/highmed-query-type.xml (100%) diff --git a/dsf-bpe-process-data-sharing/dependency-reduced-pom.xml b/dsf-bpe-process-data-sharing/dependency-reduced-pom.xml new file mode 100644 index 00000000..2f034075 --- /dev/null +++ b/dsf-bpe-process-data-sharing/dependency-reduced-pom.xml @@ -0,0 +1,237 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <parent> + <artifactId>dsf-bpe-highmed-processes-pom</artifactId> + <groupId>org.highmed.dsf</groupId> + <version>0.4.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <artifactId>dsf-bpe-process-data-sharing</artifactId> + <build> + <plugins> + <plugin> + <artifactId>maven-shade-plugin</artifactId> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + <profiles> + <profile> + <id>copy-to-highmed-dsf-process</id> + <build> + <plugins> + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-process-to-docker-test-setup</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp/medic1</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp/medic2</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp/medic3</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp/ttp</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + </filesets> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles> + <dependencies> + <dependency> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-base</artifactId> + <version>0.4.0-SNAPSHOT</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-fhir-validation</artifactId> + <version>0.4.0-SNAPSHOT</version> + <scope>test</scope> + <exclusions> + <exclusion> + <artifactId>hapi-fhir-structures-r5</artifactId> + <groupId>ca.uhn.hapi.fhir</groupId> + </exclusion> + <exclusion> + <artifactId>hapi-fhir-validation</artifactId> + <groupId>ca.uhn.hapi.fhir</groupId> + </exclusion> + <exclusion> + <artifactId>hapi-fhir-validation-resources-r4</artifactId> + <groupId>ca.uhn.hapi.fhir</groupId> + </exclusion> + <exclusion> + <artifactId>hapi-fhir-validation-resources-r5</artifactId> + <groupId>ca.uhn.hapi.fhir</groupId> + </exclusion> + <exclusion> + <artifactId>dsf-tools-bundle-generator</artifactId> + <groupId>org.highmed.dsf</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>de.hs-heilbronn.mi</groupId> + <artifactId>log4j2-utils</artifactId> + <version>0.7.0</version> + <scope>test</scope> + <exclusions> + <exclusion> + <artifactId>log4j-slf4j-impl</artifactId> + <groupId>org.apache.logging.log4j</groupId> + </exclusion> + <exclusion> + <artifactId>log4j-core</artifactId> + <groupId>org.apache.logging.log4j</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.13.1</version> + <scope>test</scope> + <exclusions> + <exclusion> + <artifactId>hamcrest-core</artifactId> + <groupId>org.hamcrest</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-base</artifactId> + <version>0.4.0-SNAPSHOT</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/dsf-bpe-process-data-sharing/pom.xml b/dsf-bpe-process-data-sharing/pom.xml index 0dbdbc08..d3eada4d 100644 --- a/dsf-bpe-process-data-sharing/pom.xml +++ b/dsf-bpe-process-data-sharing/pom.xml @@ -18,6 +18,10 @@ <artifactId>dsf-bpe-process-base</artifactId> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-highmed-base</artifactId> + </dependency> <dependency> <groupId>org.highmed.dsf</groupId> @@ -42,6 +46,23 @@ </dependency> </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + <profiles> <profile> <id>copy-to-highmed-dsf-process</id> diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java index 35bc05e5..43a61e0c 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java @@ -48,6 +48,8 @@ public Stream<Class<?>> getSpringConfigClasses() @Override public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader) { + // Some FHIR resource files are located in the module 'dsf-bpe-process-highmed-base' + var aCom = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-computeDataSharing.xml"); var aExe = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeDataSharing.xml"); var aReq = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-requestDataSharing.xml"); diff --git a/dsf-bpe-process-highmed-base/pom.xml b/dsf-bpe-process-highmed-base/pom.xml new file mode 100644 index 00000000..3e965463 --- /dev/null +++ b/dsf-bpe-process-highmed-base/pom.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <artifactId>dsf-bpe-process-highmed-base</artifactId> + + <parent> + <artifactId>dsf-bpe-highmed-processes-pom</artifactId> + <groupId>org.highmed.dsf</groupId> + <version>0.4.0-SNAPSHOT</version> + </parent> + + <dependencies> + <dependency> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-base</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>de.hs-heilbronn.mi</groupId> + <artifactId>log4j2-utils</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java b/dsf-bpe-process-highmed-base/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java similarity index 100% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java rename to dsf-bpe-process-highmed-base/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java b/dsf-bpe-process-highmed-base/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java similarity index 100% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java rename to dsf-bpe-process-highmed-base/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigValues.java b/dsf-bpe-process-highmed-base/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigValues.java similarity index 100% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigValues.java rename to dsf-bpe-process-highmed-base/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigValues.java diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-query-type.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/CodeSystem/highmed-query-type.xml similarity index 100% rename from dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-query-type.xml rename to dsf-bpe-process-highmed-base/src/main/resources/fhir/CodeSystem/highmed-query-type.xml diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/NamingSystem/highmed-research-study-identifier.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/NamingSystem/highmed-research-study-identifier.xml similarity index 100% rename from dsf-bpe-process-data-sharing/src/main/resources/fhir/NamingSystem/highmed-research-study-identifier.xml rename to dsf-bpe-process-highmed-base/src/main/resources/fhir/NamingSystem/highmed-research-study-identifier.xml diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-group-id.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-group-id.xml similarity index 100% rename from dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-group-id.xml rename to dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-group-id.xml diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-medic.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-medic.xml similarity index 100% rename from dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-medic.xml rename to dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-medic.xml diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-ttp.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-ttp.xml similarity index 100% rename from dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-ttp.xml rename to dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-ttp.xml diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-query.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-query.xml similarity index 100% rename from dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-extension-query.xml rename to dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-query.xml diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-group.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-group.xml similarity index 100% rename from dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-group.xml rename to dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-group.xml diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-query-type.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/ValueSet/highmed-query-type.xml similarity index 100% rename from dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-query-type.xml rename to dsf-bpe-process-highmed-base/src/main/resources/fhir/ValueSet/highmed-query-type.xml diff --git a/pom.xml b/pom.xml index 2e5ee322..27de6b8d 100644 --- a/pom.xml +++ b/pom.xml @@ -11,6 +11,7 @@ <modules> <module>dsf-bpe-process-data-sharing</module> + <module>dsf-bpe-process-highmed-base</module> </modules> <properties> @@ -45,6 +46,11 @@ <artifactId>dsf-bpe-process-base</artifactId> <version>0.4.0-SNAPSHOT</version> </dependency> + <dependency> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-highmed-base</artifactId> + <version>0.4.0-SNAPSHOT</version> + </dependency> <dependency> <groupId>org.highmed.dsf.processes</groupId> <artifactId>dsf-bpe-process-data-sharing</artifactId> @@ -113,13 +119,11 @@ </archive> </configuration> </plugin> - <!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>3.2.4</version> </plugin> - --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> From 591444928b5778adbf6620e5a51556ce26484906 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 18 Jan 2021 18:52:51 +0100 Subject: [PATCH 003/125] moves generally valid profiles to fhir-validation, use static imports for constants --- .../dependency-reduced-pom.xml | 90 ++++++++++++++---- .../highmed/dsf/bpe/ConstantsDataSharing.java | 3 - .../DataSharingProcessPluginDefinition.java | 22 +---- .../service/SelectResponseTargetMedic.java | 4 +- .../highmed-research-study-data-sharing.xml | 95 ------------------- .../highmed-task-execute-data-sharing.xml | 2 +- .../highmed-task-request-data-sharing.xml | 2 +- ...ringFromMedicsViaMedic1ExampleStarter.java | 6 +- .../fhir/CodeSystem/highmed-data-sharing.xml | 0 .../fhir/CodeSystem/highmed-query-type.xml | 28 ------ .../highmed-research-study-identifier.xml | 21 ---- .../highmed-extension-group-id.xml | 57 ----------- .../highmed-extension-participating-medic.xml | 69 -------------- .../highmed-extension-participating-ttp.xml | 69 -------------- .../highmed-extension-query.xml | 51 ---------- .../StructureDefinition/highmed-group.xml | 52 ---------- .../fhir/ValueSet/highmed-data-sharing.xml | 0 .../fhir/ValueSet/highmed-query-type.xml | 37 -------- 18 files changed, 83 insertions(+), 525 deletions(-) delete mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml rename {dsf-bpe-process-data-sharing => dsf-bpe-process-highmed-base}/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml (100%) delete mode 100644 dsf-bpe-process-highmed-base/src/main/resources/fhir/CodeSystem/highmed-query-type.xml delete mode 100644 dsf-bpe-process-highmed-base/src/main/resources/fhir/NamingSystem/highmed-research-study-identifier.xml delete mode 100644 dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-group-id.xml delete mode 100644 dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-medic.xml delete mode 100644 dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-ttp.xml delete mode 100644 dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-query.xml delete mode 100644 dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-group.xml rename {dsf-bpe-process-data-sharing => dsf-bpe-process-highmed-base}/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml (100%) delete mode 100644 dsf-bpe-process-highmed-base/src/main/resources/fhir/ValueSet/highmed-query-type.xml diff --git a/dsf-bpe-process-data-sharing/dependency-reduced-pom.xml b/dsf-bpe-process-data-sharing/dependency-reduced-pom.xml index 2f034075..51c0e44e 100644 --- a/dsf-bpe-process-data-sharing/dependency-reduced-pom.xml +++ b/dsf-bpe-process-data-sharing/dependency-reduced-pom.xml @@ -29,6 +29,7 @@ <plugins> <plugin> <artifactId>maven-dependency-plugin</artifactId> + <version>3.1.2</version> <executions> <execution> <id>copy-process-to-docker-test-setup</id> @@ -39,9 +40,9 @@ <configuration> <artifactItems> <artifactItem> - <groupId>${project.groupId}</groupId> - <artifactId>${project.artifactId}</artifactId> - <version>${project.version}</version> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-data-sharing</artifactId> + <version>0.4.0-SNAPSHOT</version> </artifactItem> </artifactItems> <outputDirectory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</outputDirectory> @@ -56,9 +57,9 @@ <configuration> <artifactItems> <artifactItem> - <groupId>${project.groupId}</groupId> - <artifactId>${project.artifactId}</artifactId> - <version>${project.version}</version> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-data-sharing</artifactId> + <version>0.4.0-SNAPSHOT</version> </artifactItem> </artifactItems> <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</outputDirectory> @@ -73,9 +74,9 @@ <configuration> <artifactItems> <artifactItem> - <groupId>${project.groupId}</groupId> - <artifactId>${project.artifactId}</artifactId> - <version>${project.version}</version> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-data-sharing</artifactId> + <version>0.4.0-SNAPSHOT</version> </artifactItem> </artifactItems> <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</outputDirectory> @@ -90,9 +91,9 @@ <configuration> <artifactItems> <artifactItem> - <groupId>${project.groupId}</groupId> - <artifactId>${project.artifactId}</artifactId> - <version>${project.version}</version> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-data-sharing</artifactId> + <version>0.4.0-SNAPSHOT</version> </artifactItem> </artifactItems> <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</outputDirectory> @@ -107,9 +108,9 @@ <configuration> <artifactItems> <artifactItem> - <groupId>${project.groupId}</groupId> - <artifactId>${project.artifactId}</artifactId> - <version>${project.version}</version> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-data-sharing</artifactId> + <version>0.4.0-SNAPSHOT</version> </artifactItem> </artifactItems> <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</outputDirectory> @@ -119,40 +120,89 @@ </plugin> <plugin> <artifactId>maven-clean-plugin</artifactId> + <version>3.1.0</version> + <executions> + <execution> + <id>default-clean</id> + <phase>clean</phase> + <goals> + <goal>clean</goal> + </goals> + <configuration> + <filesets> + <fileset> + <directory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</directory> + <includes> + <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</directory> + <includes> + <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</directory> + <includes> + <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</directory> + <includes> + <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</directory> + <includes> + <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + </filesets> + </configuration> + </execution> + </executions> <configuration> <filesets> <fileset> <directory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</directory> <includes> - <include>${project.artifactId}-${project.version}.jar</include> + <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</directory> <includes> - <include>${project.artifactId}-${project.version}.jar</include> + <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</directory> <includes> - <include>${project.artifactId}-${project.version}.jar</include> + <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</directory> <includes> - <include>${project.artifactId}-${project.version}.jar</include> + <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</directory> <includes> - <include>${project.artifactId}-${project.version}.jar</include> + <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index 490d9de0..b4b3dfb2 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -12,9 +12,6 @@ public interface ConstantsDataSharing String BPMN_EXECUTION_VARIABLE_COHORTS = "cohorts"; String BPMN_EXECUTION_VARIABLE_QUERIES = "queries"; - String PROFILE_HIGHMED_GROUP = "http://highmed.org/fhir/StructureDefinition/group"; - String PROFILE_HIGHMED_RESEARCH_STUDY_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/research-study-data-sharing"; - String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestDataSharing/"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java index 43a61e0c..b8c0362a 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java @@ -54,19 +54,8 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var aExe = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeDataSharing.xml"); var aReq = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-requestDataSharing.xml"); - var cF = CodeSystemResource.file("fhir/CodeSystem/highmed-data-sharing.xml"); - var cQT = CodeSystemResource.file("fhir/CodeSystem/highmed-query-type.xml"); + var cDS = CodeSystemResource.file("fhir/CodeSystem/highmed-data-sharing.xml"); - var n = NamingSystemResource.file("fhir/NamingSystem/highmed-research-study-identifier.xml"); - - var sExtG = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-extension-group-id.xml"); - var sExtPartMeDic = StructureDefinitionResource - .file("fhir/StructureDefinition/highmed-extension-participating-medic.xml"); - var sExtPartTtp = StructureDefinitionResource - .file("fhir/StructureDefinition/highmed-extension-participating-ttp.xml"); - var sExtQ = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-extension-query.xml"); - var sG = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-group.xml"); - var sR = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-research-study-data-sharing.xml"); var sTCom = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-compute-data-sharing.xml"); var sTExe = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-execute-data-sharing.xml"); var sTErr = StructureDefinitionResource @@ -77,13 +66,12 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var sTResS = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml"); - var vF = ValueSetResource.file("fhir/ValueSet/highmed-data-sharing.xml"); - var vQT = ValueSetResource.file("fhir/ValueSet/highmed-query-type.xml"); + var vDS = ValueSetResource.file("fhir/ValueSet/highmed-data-sharing.xml"); Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( - "computeDataSharing/" + VERSION, Arrays.asList(aCom, cF, sExtG, sG, sTCom, sTResS, vF), - "executeDataSharing/" + VERSION, Arrays.asList(aExe, cF, cQT, n, sR, sExtPartMeDic, sExtPartTtp, sExtQ, sG, sTExe, vF, vQT), - "requestDataSharing/" + VERSION, Arrays.asList(aReq, cF, cQT, n, sExtG, sExtPartMeDic, sExtPartTtp, sG, sR, sExtQ, sTReq, sTResM, sTErr, vF, vQT)); + "computeDataSharing/" + VERSION, Arrays.asList(aCom, cDS, sTCom, sTResS, vDS), + "executeDataSharing/" + VERSION, Arrays.asList(aExe, cDS, sTExe, vDS), + "requestDataSharing/" + VERSION, Arrays.asList(aReq, cDS, sTReq, sTResM, sTErr, vDS)); return ResourceProvider .read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java index ac28275b..e9178c75 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java @@ -1,5 +1,7 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.ConstantsBase; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; @@ -27,6 +29,6 @@ protected void doExecute(DelegateExecution execution) Task task = getLeadingTaskFromExecutionVariables(); Target medicTarget = Target.createUniDirectionalTarget(task.getRequester().getIdentifier().getValue()); - execution.setVariable(ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(medicTarget)); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(medicTarget)); } } diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml deleted file mode 100644 index b78e1d28..00000000 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml +++ /dev/null @@ -1,95 +0,0 @@ -<StructureDefinition xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> - </tag> - </meta> - <url value="http://highmed.org/fhir/StructureDefinition/research-study-data-sharing" /> - <!-- version managed by bpe --> - <version value="bpe-managed" /> - <name value="ResearchStudyDataSharing" /> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <date value="2020-11-23" /> - <fhirVersion value="4.0.1" /> - <kind value="resource" /> - <abstract value="false" /> - <type value="ResearchStudy" /> - <baseDefinition value="http://hl7.org/fhir/StructureDefinition/ResearchStudy" /> - <derivation value="constraint" /> - <differential> - <element id="ResearchStudy.extension"> - <path value="ResearchStudy.extension" /> - <slicing> - <discriminator> - <type value="value" /> - <path value="url" /> - </discriminator> - <rules value="open" /> - </slicing> - </element> - <element id="ResearchStudy.extension:participating-ttp"> - <path value="ResearchStudy.extension" /> - <sliceName value="participating-ttp" /> - <min value="1" /> - <max value="1" /> - <type> - <code value="Extension" /> - <profile value="http://highmed.org/fhir/StructureDefinition/extension-participating-ttp" /> - </type> - </element> - <element id="ResearchStudy.extension:participating-medic"> - <path value="ResearchStudy.extension" /> - <sliceName value="participating-medic" /> - <min value="1" /> - <type> - <code value="Extension" /> - <profile value="http://highmed.org/fhir/StructureDefinition/extension-participating-medic" /> - </type> - </element> - <element id="ResearchStudy.identifier"> - <path value="ResearchStudy.identifier" /> - <slicing> - <discriminator> - <type value="value" /> - <path value="system" /> - </discriminator> - <rules value="open" /> - </slicing> - <min value="1" /> - </element> - <element id="ResearchStudy.identifier:highmedIdentifier"> - <path value="ResearchStudy.identifier" /> - <sliceName value="highmedIdentifier" /> - <min value="1" /> - <max value="1" /> - </element> - <element id="ResearchStudy.identifier:highmedIdentifier.system"> - <path value="ResearchStudy.identifier.system" /> - <min value="1" /> - <fixedUri value="http://highmed.org/fhir/NamingSystem/research-study-identifier" /> - </element> - <element id="ResearchStudy.identifier:highmedIdentifier.value"> - <path value="ResearchStudy.identifier.value" /> - <min value="1" /> - </element> - <element id="ResearchStudy.enrollment"> - <path value="ResearchStudy.enrollment" /> - <min value="1" /> - <type> - <code value="Reference" /> - <targetProfile value="http://highmed.org/fhir/StructureDefinition/group" /> - </type> - </element> - <element id="ResearchStudy.enrollment.reference"> - <path value="ResearchStudy.enrollment.reference" /> - <min value="1" /> - </element> - <element id="ResearchStudy.enrollment.identifier"> - <path value="ResearchStudy.enrollment.identifier" /> - <max value="0" /> - </element> - </differential> -</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml index cf2365ca..736c742b 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml @@ -97,7 +97,7 @@ <path value="Task.input.value[x]" /> <type> <code value="Reference" /> - <targetProfile value="http://highmed.org/fhir/StructureDefinition/research-study-data-sharing" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/research-study" /> </type> </element> <element id="Task.input:needs-record-linkage"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml index b60674fa..e93c0261 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml @@ -97,7 +97,7 @@ <path value="Task.input.value[x]" /> <type> <code value="Reference" /> - <targetProfile value="http://highmed.org/fhir/StructureDefinition/research-study-data-sharing" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/research-study" /> </type> </element> <element id="Task.input:research-study-reference.value[x].reference"> diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java index 32bc94c6..179d56aa 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -4,6 +4,8 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsBase.CODE_TYPE_AQL_QUERY; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHMED_GROUP; +import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHEMD_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; @@ -12,8 +14,6 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_TTP; import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_QUERY; import static org.highmed.dsf.bpe.ConstantsDataSharing.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_GROUP; -import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_RESEARCH_STUDY_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION; @@ -97,7 +97,7 @@ private static ResearchStudy createResearchStudy(Group group1, Group group2) ResearchStudy researchStudy = new ResearchStudy(); researchStudy.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); - researchStudy.getMeta().addProfile(PROFILE_HIGHMED_RESEARCH_STUDY_DATA_SHARING); + researchStudy.getMeta().addProfile(PROFILE_HIGHEMD_RESEARCH_STUDY); researchStudy.addIdentifier().setSystem(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER) .setValue(UUID.randomUUID().toString()); researchStudy.setStatus(ResearchStudy.ResearchStudyStatus.ACTIVE); diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml similarity index 100% rename from dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml rename to dsf-bpe-process-highmed-base/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml diff --git a/dsf-bpe-process-highmed-base/src/main/resources/fhir/CodeSystem/highmed-query-type.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/CodeSystem/highmed-query-type.xml deleted file mode 100644 index 5904bf42..00000000 --- a/dsf-bpe-process-highmed-base/src/main/resources/fhir/CodeSystem/highmed-query-type.xml +++ /dev/null @@ -1,28 +0,0 @@ -<CodeSystem xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> - <code value="REMOTE"/> - </tag> - </meta> - <url value="http://highmed.org/fhir/CodeSystem/query-type"/> - <!-- version managed by bpe --> - <version value="bpe-managed" /> - <name value="HiGHmed_Query_Type"/> - <title value="HiGHmed Query Type"/> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false"/> - <date value="2020-11-23"/> - <publisher value="HiGHmed"/> - <description value="CodeSystem with HiGHmed query types for medical data stored in the data lake repositories"/> - <caseSensitive value="true"/> - <hierarchyMeaning value="grouped-by"/> - <versionNeeded value="false"/> - <content value="complete"/> - <concept> - <code value="application/x-aql-query"/> - <display value="AQL Query"/> - <definition value="Archetype Query Language."/> - </concept> -</CodeSystem> \ No newline at end of file diff --git a/dsf-bpe-process-highmed-base/src/main/resources/fhir/NamingSystem/highmed-research-study-identifier.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/NamingSystem/highmed-research-study-identifier.xml deleted file mode 100644 index 5ee14d02..00000000 --- a/dsf-bpe-process-highmed-base/src/main/resources/fhir/NamingSystem/highmed-research-study-identifier.xml +++ /dev/null @@ -1,21 +0,0 @@ -<NamingSystem xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> - <code value="REMOTE"/> - </tag> - </meta> - <name value="HiGHmed_ResearchStudy_Identifier"/> - <!-- status managed by bpe --> - <status value="unknown" /> - <kind value="identifier"/> - <date value="2020-11-23"/> - <publisher value="HiGHmed"/> - <responsible value="HiGHmed"/> - <description value="UUID used to identify a ResearchStudy"/> - <usage value="Used withing HiGHmed to identify research studies"/> - <uniqueId> - <type value="uuid"/> - <value value="http://highmed.org/fhir/NamingSystem/research-study-identifier"/> - </uniqueId> -</NamingSystem> \ No newline at end of file diff --git a/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-group-id.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-group-id.xml deleted file mode 100644 index 0a100f49..00000000 --- a/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-group-id.xml +++ /dev/null @@ -1,57 +0,0 @@ -<StructureDefinition xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> - </tag> - </meta> - <url value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> - <!-- version managed by bpe --> - <version value="bpe-managed" /> - <name value="GroupId" /> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <date value="2020-11-23" /> - <fhirVersion value="4.0.1" /> - <mapping> - <identity value="rim" /> - <uri value="http://hl7.org/v3" /> - <name value="RIM Mapping" /> - </mapping> - <kind value="complex-type" /> - <abstract value="false" /> - <context> - <type value="element" /> - <expression value="BackboneElement" /> - </context> - <type value="Extension" /> - <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension" /> - <derivation value="constraint" /> - <differential> - <element id="Extension"> - <path value="Extension" /> - <max value="1" /> - </element> - <element id="Extension.url"> - <path value="Extension.url" /> - <fixedUri value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> - </element> - <element id="Extension.value[x]"> - <path value="Extension.value[x]" /> - <min value="1" /> - <type> - <code value="Reference" /> - <targetProfile value="http://highmed.org/fhir/StructureDefinition/group" /> - </type> - </element> - <element id="Extension.value[x].reference"> - <path value="Extension.value[x].reference" /> - <min value="1" /> - </element> - <element id="Extension.value[x].identifier"> - <path value="Extension.value[x].identifier" /> - <max value="0" /> - </element> - </differential> -</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-medic.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-medic.xml deleted file mode 100644 index 6730b226..00000000 --- a/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-medic.xml +++ /dev/null @@ -1,69 +0,0 @@ -<StructureDefinition xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> - </tag> - </meta> - <url value="http://highmed.org/fhir/StructureDefinition/extension-participating-medic" /> - <!-- version managed by bpe --> - <version value="bpe-managed" /> - <name value="ParticipatingMedic" /> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <date value="2020-11-23" /> - <fhirVersion value="4.0.1" /> - <kind value="complex-type" /> - <abstract value="false" /> - <context> - <type value="element" /> - <expression value="ResearchStudy" /> - </context> - <type value="Extension" /> - <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension" /> - <derivation value="constraint" /> - <differential> - <element id="Extension"> - <path value="Extension" /> - <short value="ParticipatingMedic" /> - <definition value="Used to denote the medic organizations that are requested to supply data for the study at hand." /> - </element> - <element id="Extension.url"> - <path value="Extension.url" /> - <fixedUri value="http://highmed.org/fhir/StructureDefinition/extension-participating-medic" /> - </element> - <element id="Extension.value[x]"> - <path value="Extension.value[x]" /> - <short value="ParticipatingMedic" /> - <definition value="Organization reference used to denote the medic organizations that are requested to supply data for the study at hand." /> - <min value="1" /> - <type> - <code value="Reference" /> - <targetProfile value="http://highmed.org/fhir/StructureDefinition/organization" /> - </type> - </element> - <element id="Extension.value[x].reference"> - <path value="Extension.value[x].reference" /> - <max value="0" /> - </element> - <element id="Extension.value[x].type"> - <path value="Extension.value[x].type" /> - <min value="1" /> - <fixedUri value="Organization" /> - </element> - <element id="Extension.value[x].identifier"> - <path value="Extension.value[x].identifier" /> - <min value="1" /> - </element> - <element id="Extension.value[x].identifier.system"> - <path value="Extension.value[x].identifier.system" /> - <min value="1" /> - <fixedUri value="http://highmed.org/fhir/NamingSystem/organization-identifier" /> - </element> - <element id="Extension.value[x].identifier.value"> - <path value="Extension.value[x].identifier.value" /> - <min value="1" /> - </element> - </differential> -</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-ttp.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-ttp.xml deleted file mode 100644 index 14fe8497..00000000 --- a/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-participating-ttp.xml +++ /dev/null @@ -1,69 +0,0 @@ -<StructureDefinition xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> - </tag> - </meta> - <url value="http://highmed.org/fhir/StructureDefinition/extension-participating-ttp" /> - <!-- version managed by bpe --> - <version value="bpe-managed" /> - <name value="ParticipatingTtp" /> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <date value="2020-11-23" /> - <fhirVersion value="4.0.1" /> - <kind value="complex-type" /> - <abstract value="false" /> - <context> - <type value="element" /> - <expression value="ResearchStudy" /> - </context> - <type value="Extension" /> - <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension" /> - <derivation value="constraint" /> - <differential> - <element id="Extension"> - <path value="Extension" /> - <short value="ParticipatingTtp" /> - <definition value="Used to denote the TTP organization that is used to record link and pseudonymize data." /> - </element> - <element id="Extension.url"> - <path value="Extension.url" /> - <fixedUri value="http://highmed.org/fhir/StructureDefinition/extension-participating-ttp" /> - </element> - <element id="Extension.value[x]"> - <path value="Extension.value[x]" /> - <short value="ParticipatingMedic" /> - <definition value="Organization reference used to denote the TTP organization that is used to record link and pseudonymize data." /> - <min value="1" /> - <type> - <code value="Reference" /> - <targetProfile value="http://highmed.org/fhir/StructureDefinition/organization" /> - </type> - </element> - <element id="Extension.value[x].reference"> - <path value="Extension.value[x].reference" /> - <max value="0" /> - </element> - <element id="Extension.value[x].type"> - <path value="Extension.value[x].type" /> - <min value="1" /> - <fixedUri value="Organization" /> - </element> - <element id="Extension.value[x].identifier"> - <path value="Extension.value[x].identifier" /> - <min value="1" /> - </element> - <element id="Extension.value[x].identifier.system"> - <path value="Extension.value[x].identifier.system" /> - <min value="1" /> - <fixedUri value="http://highmed.org/fhir/NamingSystem/organization-identifier" /> - </element> - <element id="Extension.value[x].identifier.value"> - <path value="Extension.value[x].identifier.value" /> - <min value="1" /> - </element> - </differential> -</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-query.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-query.xml deleted file mode 100644 index 59aef12e..00000000 --- a/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-extension-query.xml +++ /dev/null @@ -1,51 +0,0 @@ -<StructureDefinition xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> - </tag> - </meta> - <url value="http://highmed.org/fhir/StructureDefinition/extension-query" /> - <!-- version managed by bpe --> - <version value="bpe-managed" /> - <name value="Query" /> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <date value="2020-11-23" /> - <fhirVersion value="4.0.1" /> - <kind value="complex-type" /> - <abstract value="false" /> - <context> - <type value="element" /> - <expression value="Group" /> - </context> - <type value="Extension" /> - <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension" /> - <derivation value="constraint" /> - <differential> - <element id="Extension.url"> - <path value="Extension.url" /> - <fixedUri value="http://highmed.org/fhir/StructureDefinition/extension-query" /> - </element> - <element id="Extension.value[x]"> - <path value="Extension.value[x]" /> - <min value="1" /> - <type> - <code value="Expression" /> - </type> - </element> - <element id="Extension.value[x].language"> - <path value="Extension.value[x].language" /> - <short value="application/x-fhir-query | application/x-aql-query" /> - <binding> - <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/query-type" /> - </binding> - </element> - <element id="Extension.value[x].expression"> - <path value="Extension.value[x].expression" /> - <min value="1" /> - </element> - </differential> -</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-group.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-group.xml deleted file mode 100644 index 35e706a2..00000000 --- a/dsf-bpe-process-highmed-base/src/main/resources/fhir/StructureDefinition/highmed-group.xml +++ /dev/null @@ -1,52 +0,0 @@ -<StructureDefinition xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> - <code value="REMOTE" /> - </tag> - </meta> - <url value="http://highmed.org/fhir/StructureDefinition/group" /> - <!-- version managed by bpe --> - <version value="bpe-managed" /> - <name value="Group" /> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <date value="2020-11-23" /> - <fhirVersion value="4.0.1" /> - <kind value="resource" /> - <abstract value="false" /> - <type value="Group" /> - <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Group" /> - <derivation value="constraint" /> - <differential> - <element id="Group.extension"> - <path value="Group.extension" /> - <slicing> - <discriminator> - <type value="value" /> - <path value="url" /> - </discriminator> - <rules value="open" /> - </slicing> - </element> - <element id="Group.extension:query"> - <path value="Group.extension" /> - <sliceName value="query" /> - <min value="1" /> - <max value="1" /> - <type> - <code value="Extension" /> - <profile value="http://highmed.org/fhir/StructureDefinition/extension-query" /> - </type> - </element> - <element id="Group.type"> - <path value="Group.type" /> - <fixedCode value="person" /> - </element> - <element id="Group.actual"> - <path value="Group.actual" /> - <fixedBoolean value="false" /> - </element> - </differential> -</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml similarity index 100% rename from dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml rename to dsf-bpe-process-highmed-base/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml diff --git a/dsf-bpe-process-highmed-base/src/main/resources/fhir/ValueSet/highmed-query-type.xml b/dsf-bpe-process-highmed-base/src/main/resources/fhir/ValueSet/highmed-query-type.xml deleted file mode 100644 index 6cde8914..00000000 --- a/dsf-bpe-process-highmed-base/src/main/resources/fhir/ValueSet/highmed-query-type.xml +++ /dev/null @@ -1,37 +0,0 @@ -<ValueSet xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> - <code value="REMOTE"/> - </tag> - </meta> - <url value="http://highmed.org/fhir/ValueSet/query-type"/> - <!-- version managed by bpe --> - <version value="bpe-managed" /> - <name value="HiGHmed_Query_Type"/> - <title value="HiGHmed Query Type"/> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false"/> - <date value="2020-11-23"/> - <publisher value="HiGHmed"/> - <description - value="ValueSet with HiGHmed query types used in Group resources query extension of the expression datatype"/> - <immutable value="true"/> - <compose> - <include> - <system value="http://hl7.org/fhir/expression-language"/> - <concept> - <code value="application/x-fhir-query"/> - <display value="FHIR Query"/> - </concept> - </include> - <include> - <system value="http://highmed.org/fhir/CodeSystem/query-type"/> - <concept> - <code value="application/x-aql-query"/> - <display value="AQL Query"/> - </concept> - </include> - </compose> -</ValueSet> \ No newline at end of file From 11edba8a5a6219856da892db58b724b364d4ff30 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 18 Jan 2021 18:58:37 +0100 Subject: [PATCH 004/125] do not create dependancy reduced pom --- .../dependency-reduced-pom.xml | 287 ------------------ dsf-bpe-process-data-sharing/pom.xml | 3 + 2 files changed, 3 insertions(+), 287 deletions(-) delete mode 100644 dsf-bpe-process-data-sharing/dependency-reduced-pom.xml diff --git a/dsf-bpe-process-data-sharing/dependency-reduced-pom.xml b/dsf-bpe-process-data-sharing/dependency-reduced-pom.xml deleted file mode 100644 index 51c0e44e..00000000 --- a/dsf-bpe-process-data-sharing/dependency-reduced-pom.xml +++ /dev/null @@ -1,287 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <artifactId>dsf-bpe-highmed-processes-pom</artifactId> - <groupId>org.highmed.dsf</groupId> - <version>0.4.0-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <artifactId>dsf-bpe-process-data-sharing</artifactId> - <build> - <plugins> - <plugin> - <artifactId>maven-shade-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - <profiles> - <profile> - <id>copy-to-highmed-dsf-process</id> - <build> - <plugins> - <plugin> - <artifactId>maven-dependency-plugin</artifactId> - <version>3.1.2</version> - <executions> - <execution> - <id>copy-process-to-docker-test-setup</id> - <phase>package</phase> - <goals> - <goal>copy</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.highmed.dsf</groupId> - <artifactId>dsf-bpe-process-data-sharing</artifactId> - <version>0.4.0-SNAPSHOT</version> - </artifactItem> - </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</outputDirectory> - </configuration> - </execution> - <execution> - <id>copy-process-to-docker-test-setup-3medic-ttp/medic1</id> - <phase>package</phase> - <goals> - <goal>copy</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.highmed.dsf</groupId> - <artifactId>dsf-bpe-process-data-sharing</artifactId> - <version>0.4.0-SNAPSHOT</version> - </artifactItem> - </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</outputDirectory> - </configuration> - </execution> - <execution> - <id>copy-process-to-docker-test-setup-3medic-ttp/medic2</id> - <phase>package</phase> - <goals> - <goal>copy</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.highmed.dsf</groupId> - <artifactId>dsf-bpe-process-data-sharing</artifactId> - <version>0.4.0-SNAPSHOT</version> - </artifactItem> - </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</outputDirectory> - </configuration> - </execution> - <execution> - <id>copy-process-to-docker-test-setup-3medic-ttp/medic3</id> - <phase>package</phase> - <goals> - <goal>copy</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.highmed.dsf</groupId> - <artifactId>dsf-bpe-process-data-sharing</artifactId> - <version>0.4.0-SNAPSHOT</version> - </artifactItem> - </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</outputDirectory> - </configuration> - </execution> - <execution> - <id>copy-process-to-docker-test-setup-3medic-ttp/ttp</id> - <phase>package</phase> - <goals> - <goal>copy</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>org.highmed.dsf</groupId> - <artifactId>dsf-bpe-process-data-sharing</artifactId> - <version>0.4.0-SNAPSHOT</version> - </artifactItem> - </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</outputDirectory> - </configuration> - </execution> - </executions> - </plugin> - <plugin> - <artifactId>maven-clean-plugin</artifactId> - <version>3.1.0</version> - <executions> - <execution> - <id>default-clean</id> - <phase>clean</phase> - <goals> - <goal>clean</goal> - </goals> - <configuration> - <filesets> - <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</directory> - <includes> - <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> - </includes> - <followSymlinks>false</followSymlinks> - </fileset> - <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</directory> - <includes> - <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> - </includes> - <followSymlinks>false</followSymlinks> - </fileset> - <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</directory> - <includes> - <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> - </includes> - <followSymlinks>false</followSymlinks> - </fileset> - <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</directory> - <includes> - <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> - </includes> - <followSymlinks>false</followSymlinks> - </fileset> - <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</directory> - <includes> - <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> - </includes> - <followSymlinks>false</followSymlinks> - </fileset> - </filesets> - </configuration> - </execution> - </executions> - <configuration> - <filesets> - <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</directory> - <includes> - <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> - </includes> - <followSymlinks>false</followSymlinks> - </fileset> - <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</directory> - <includes> - <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> - </includes> - <followSymlinks>false</followSymlinks> - </fileset> - <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</directory> - <includes> - <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> - </includes> - <followSymlinks>false</followSymlinks> - </fileset> - <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</directory> - <includes> - <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> - </includes> - <followSymlinks>false</followSymlinks> - </fileset> - <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</directory> - <includes> - <include>dsf-bpe-process-data-sharing-0.4.0-SNAPSHOT.jar</include> - </includes> - <followSymlinks>false</followSymlinks> - </fileset> - </filesets> - </configuration> - </plugin> - </plugins> - </build> - </profile> - </profiles> - <dependencies> - <dependency> - <groupId>org.highmed.dsf</groupId> - <artifactId>dsf-bpe-process-base</artifactId> - <version>0.4.0-SNAPSHOT</version> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>org.highmed.dsf</groupId> - <artifactId>dsf-fhir-validation</artifactId> - <version>0.4.0-SNAPSHOT</version> - <scope>test</scope> - <exclusions> - <exclusion> - <artifactId>hapi-fhir-structures-r5</artifactId> - <groupId>ca.uhn.hapi.fhir</groupId> - </exclusion> - <exclusion> - <artifactId>hapi-fhir-validation</artifactId> - <groupId>ca.uhn.hapi.fhir</groupId> - </exclusion> - <exclusion> - <artifactId>hapi-fhir-validation-resources-r4</artifactId> - <groupId>ca.uhn.hapi.fhir</groupId> - </exclusion> - <exclusion> - <artifactId>hapi-fhir-validation-resources-r5</artifactId> - <groupId>ca.uhn.hapi.fhir</groupId> - </exclusion> - <exclusion> - <artifactId>dsf-tools-bundle-generator</artifactId> - <groupId>org.highmed.dsf</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>de.hs-heilbronn.mi</groupId> - <artifactId>log4j2-utils</artifactId> - <version>0.7.0</version> - <scope>test</scope> - <exclusions> - <exclusion> - <artifactId>log4j-slf4j-impl</artifactId> - <groupId>org.apache.logging.log4j</groupId> - </exclusion> - <exclusion> - <artifactId>log4j-core</artifactId> - <groupId>org.apache.logging.log4j</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.13.1</version> - <scope>test</scope> - <exclusions> - <exclusion> - <artifactId>hamcrest-core</artifactId> - <groupId>org.hamcrest</groupId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.highmed.dsf</groupId> - <artifactId>dsf-bpe-process-base</artifactId> - <version>0.4.0-SNAPSHOT</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - </dependencies> -</project> diff --git a/dsf-bpe-process-data-sharing/pom.xml b/dsf-bpe-process-data-sharing/pom.xml index d3eada4d..5cc4cd4d 100644 --- a/dsf-bpe-process-data-sharing/pom.xml +++ b/dsf-bpe-process-data-sharing/pom.xml @@ -59,6 +59,9 @@ </goals> </execution> </executions> + <configuration> + <createDependencyReducedPom>false</createDependencyReducedPom> + </configuration> </plugin> </plugins> </build> From 5352260a0e0313b3d5a0d2c2b58f190064a52035 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 25 Jan 2021 14:44:03 +0100 Subject: [PATCH 005/125] use BloomFilter classes from highmed-base process --- dsf-bpe-process-feasibility/pom.xml | 25 +++++ .../dsf/bpe/message/SendMedicRequest.java | 2 +- .../service/DownloadFeasibilityResources.java | 4 +- .../dsf/bpe/service/GenerateBloomFilters.java | 2 +- .../dsf/bpe/service/SelectRequestTargets.java | 4 +- .../config/FeasibilitySerializerConfig.java | 2 +- .../dsf/bpe/variables/BloomFilterConfig.java | 106 ------------------ .../BloomFilterConfigSerializer.java | 70 ------------ .../variables/BloomFilterConfigValues.java | 54 --------- .../bpe/variables/BloomFilterConfigTest.java | 1 + .../dsf/bpe/service/ExtractInputValues.java | 4 +- .../LocalServicesMedic1ExampleStarter.java | 2 +- 12 files changed, 36 insertions(+), 240 deletions(-) delete mode 100644 dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/BloomFilterConfig.java delete mode 100644 dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/BloomFilterConfigSerializer.java delete mode 100644 dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/BloomFilterConfigValues.java diff --git a/dsf-bpe-process-feasibility/pom.xml b/dsf-bpe-process-feasibility/pom.xml index 98a16ca8..860c8705 100644 --- a/dsf-bpe-process-feasibility/pom.xml +++ b/dsf-bpe-process-feasibility/pom.xml @@ -17,6 +17,11 @@ <artifactId>dsf-bpe-process-base</artifactId> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-highmed-base</artifactId> + </dependency> + <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> @@ -40,6 +45,26 @@ <type>test-jar</type> </dependency> </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + </execution> + </executions> + <configuration> + <createDependencyReducedPom>false</createDependencyReducedPom> + </configuration> + </plugin> + </plugins> + </build> <profiles> <profile> diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java index efd4d718..41479bcc 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java @@ -13,7 +13,7 @@ import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.variables.BloomFilterConfig; +import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java index d750ca40..a067f420 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java @@ -21,8 +21,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.ConstantsBase; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variables.BloomFilterConfig; -import org.highmed.dsf.bpe.variables.BloomFilterConfigValues; +import org.highmed.dsf.bpe.variable.BloomFilterConfig; +import org.highmed.dsf.bpe.variable.BloomFilterConfigValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java index 6a10c6b1..98335b0f 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -15,7 +15,7 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variables.BloomFilterConfig; +import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.highmed.dsf.bpe.variables.FeasibilityQueryResult; import org.highmed.dsf.bpe.variables.FeasibilityQueryResults; import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index 016da37b..2cba4e96 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -19,8 +19,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.ConstantsBase; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variables.BloomFilterConfig; -import org.highmed.dsf.bpe.variables.BloomFilterConfigValues; +import org.highmed.dsf.bpe.variable.BloomFilterConfig; +import org.highmed.dsf.bpe.variable.BloomFilterConfigValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilitySerializerConfig.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilitySerializerConfig.java index 05418ecd..5104ae34 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilitySerializerConfig.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilitySerializerConfig.java @@ -1,6 +1,6 @@ package org.highmed.dsf.bpe.spring.config; -import org.highmed.dsf.bpe.variables.BloomFilterConfigSerializer; +import org.highmed.dsf.bpe.variable.BloomFilterConfigSerializer; import org.highmed.dsf.bpe.variables.FeasibilityQueryResultSerializer; import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsSerializer; import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResultSerializer; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/BloomFilterConfig.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/BloomFilterConfig.java deleted file mode 100644 index bbf4ac18..00000000 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/BloomFilterConfig.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.highmed.dsf.bpe.variables; - -import java.security.Key; - -import javax.crypto.spec.SecretKeySpec; - -import org.highmed.dsf.fhir.variables.KeyDeserializer; -import org.highmed.dsf.fhir.variables.KeySerializer; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.annotation.JsonSerialize; - -public class BloomFilterConfig -{ - private static final int SEED_LENGTH = 8; - private static final int HMAC_SHA2_KEY_LENGTH = 32; - private static final int HMAC_SHA3_KEY_LENGTH = 32; - - private final long permutationSeed; - - @JsonDeserialize(using = KeyDeserializer.class) - @JsonSerialize(using = KeySerializer.class) - private final Key hmacSha2Key; - - @JsonDeserialize(using = KeyDeserializer.class) - @JsonSerialize(using = KeySerializer.class) - private final Key hmacSha3Key; - - public static BloomFilterConfig fromBytes(byte[] bytes) - { - if (bytes.length != SEED_LENGTH + HMAC_SHA2_KEY_LENGTH + HMAC_SHA3_KEY_LENGTH) - throw new IllegalArgumentException( - "bytes.length = " + (SEED_LENGTH + HMAC_SHA2_KEY_LENGTH + HMAC_SHA3_KEY_LENGTH) - + " expected, but got " + bytes.length); - - byte[] seed = new byte[SEED_LENGTH]; - byte[] key1 = new byte[HMAC_SHA2_KEY_LENGTH]; - byte[] key2 = new byte[HMAC_SHA3_KEY_LENGTH]; - - System.arraycopy(bytes, 0, seed, 0, seed.length); - System.arraycopy(bytes, seed.length, key1, 0, key1.length); - System.arraycopy(bytes, seed.length + key1.length, key2, 0, key2.length); - - long permutationSeed = bigEndianToLong(seed); - Key hmacSha2Key = new SecretKeySpec(key1, "HmacSHA256"); - Key hmacSha3Key = new SecretKeySpec(key2, "HmacSHA3-256"); - - return new BloomFilterConfig(permutationSeed, hmacSha2Key, hmacSha3Key); - } - - @JsonCreator - public BloomFilterConfig(@JsonProperty("permutationSeed") long permutationSeed, - @JsonProperty("hmacSha2Key") Key hmacSha2Key, @JsonProperty("hmacSha3Key") Key hmacSha3Key) - { - this.permutationSeed = permutationSeed; - this.hmacSha2Key = hmacSha2Key; - this.hmacSha3Key = hmacSha3Key; - } - - public long getPermutationSeed() - { - return permutationSeed; - } - - public Key getHmacSha2Key() - { - return hmacSha2Key; - } - - public Key getHmacSha3Key() - { - return hmacSha3Key; - } - - @JsonIgnore - public byte[] toBytes() - { - byte[] bytes = new byte[SEED_LENGTH + HMAC_SHA2_KEY_LENGTH + HMAC_SHA3_KEY_LENGTH]; - - byte[] seed = longToBigEndian(permutationSeed); - byte[] key1 = hmacSha2Key.getEncoded(); - byte[] key2 = hmacSha3Key.getEncoded(); - - System.arraycopy(seed, 0, bytes, 0, seed.length); - System.arraycopy(key1, 0, bytes, SEED_LENGTH, key1.length); - System.arraycopy(key2, 0, bytes, SEED_LENGTH + HMAC_SHA2_KEY_LENGTH, key2.length); - - return bytes; - } - - private static byte[] longToBigEndian(long l) - { - return new byte[] { (byte) (l >>> 56), (byte) (l >>> 48), (byte) (l >>> 40), (byte) (l >>> 32), - (byte) (l >>> 24), (byte) (l >>> 16), (byte) (l >>> 8), (byte) (l >>> 0) }; - } - - private static long bigEndianToLong(byte[] b) - { - return (((long) b[0] << 56) + ((long) (b[1] & 255) << 48) + ((long) (b[2] & 255) << 40) - + ((long) (b[3] & 255) << 32) + ((long) (b[4] & 255) << 24) + ((b[5] & 255) << 16) + ((b[6] & 255) << 8) - + ((b[7] & 255) << 0)); - } -} diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/BloomFilterConfigSerializer.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/BloomFilterConfigSerializer.java deleted file mode 100644 index b6d6c8cb..00000000 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/BloomFilterConfigSerializer.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.highmed.dsf.bpe.variables; - -import java.io.IOException; -import java.util.Objects; - -import org.camunda.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer; -import org.camunda.bpm.engine.impl.variable.serializer.ValueFields; -import org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl; -import org.highmed.dsf.bpe.variables.BloomFilterConfigValues.BloomFilterConfigValue; -import org.springframework.beans.factory.InitializingBean; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class BloomFilterConfigSerializer extends PrimitiveValueSerializer<BloomFilterConfigValue> - implements InitializingBean -{ - private final ObjectMapper objectMapper; - - public BloomFilterConfigSerializer(ObjectMapper objectMapper) - { - super(BloomFilterConfigValues.VALUE_TYPE); - - this.objectMapper = objectMapper; - } - - @Override - public void afterPropertiesSet() throws Exception - { - Objects.requireNonNull(objectMapper, "objectMapper"); - } - - @Override - public void writeValue(BloomFilterConfigValue value, ValueFields valueFields) - { - BloomFilterConfig target = value.getValue(); - try - { - if (target != null) - valueFields.setByteArrayValue(objectMapper.writeValueAsBytes(target)); - } - catch (JsonProcessingException e) - { - throw new RuntimeException(e); - } - } - - @Override - public BloomFilterConfigValue convertToTypedValue(UntypedValueImpl untypedValue) - { - return BloomFilterConfigValues.create((BloomFilterConfig) untypedValue.getValue()); - } - - @Override - public BloomFilterConfigValue readValue(ValueFields valueFields, boolean asTransientValue) - { - byte[] bytes = valueFields.getByteArrayValue(); - - try - { - BloomFilterConfig target = (bytes == null || bytes.length <= 0) ? null - : objectMapper.readValue(bytes, BloomFilterConfig.class); - return BloomFilterConfigValues.create(target); - } - catch (IOException e) - { - throw new RuntimeException(e); - } - } -} diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/BloomFilterConfigValues.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/BloomFilterConfigValues.java deleted file mode 100644 index 4640b0b0..00000000 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/BloomFilterConfigValues.java +++ /dev/null @@ -1,54 +0,0 @@ -package org.highmed.dsf.bpe.variables; - -import java.util.Map; - -import org.camunda.bpm.engine.variable.impl.type.PrimitiveValueTypeImpl; -import org.camunda.bpm.engine.variable.impl.value.PrimitiveTypeValueImpl; -import org.camunda.bpm.engine.variable.type.PrimitiveValueType; -import org.camunda.bpm.engine.variable.value.PrimitiveValue; -import org.camunda.bpm.engine.variable.value.TypedValue; - -public class BloomFilterConfigValues -{ - public static interface BloomFilterConfigValue extends PrimitiveValue<BloomFilterConfig> - { - } - - private static class BloomFilterConfigValueImpl extends PrimitiveTypeValueImpl<BloomFilterConfig> - implements BloomFilterConfigValues.BloomFilterConfigValue - { - private static final long serialVersionUID = 1L; - - public BloomFilterConfigValueImpl(BloomFilterConfig value, PrimitiveValueType type) - { - super(value, type); - } - } - - public static class BloomFilterConfigValueTypeImpl extends PrimitiveValueTypeImpl - { - private static final long serialVersionUID = 1L; - - private BloomFilterConfigValueTypeImpl() - { - super(BloomFilterConfig.class); - } - - @Override - public TypedValue createValue(Object value, Map<String, Object> valueInfo) - { - return new BloomFilterConfigValues.BloomFilterConfigValueImpl((BloomFilterConfig) value, VALUE_TYPE); - } - } - - public static final PrimitiveValueType VALUE_TYPE = new BloomFilterConfigValues.BloomFilterConfigValueTypeImpl(); - - private BloomFilterConfigValues() - { - } - - public static BloomFilterConfigValues.BloomFilterConfigValue create(BloomFilterConfig value) - { - return new BloomFilterConfigValues.BloomFilterConfigValueImpl(value, VALUE_TYPE); - } -} diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigTest.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigTest.java index db543402..6475a784 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigTest.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigTest.java @@ -7,6 +7,7 @@ import javax.crypto.spec.SecretKeySpec; +import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java index 6a020529..bddac760 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java @@ -15,8 +15,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.ConstantsFeasibility; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variables.BloomFilterConfig; -import org.highmed.dsf.bpe.variables.BloomFilterConfigValues; +import org.highmed.dsf.bpe.variable.BloomFilterConfig; +import org.highmed.dsf.bpe.variable.BloomFilterConfigValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.FhirResourcesListValues; diff --git a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java index c7cee546..483d8d6e 100644 --- a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java +++ b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java @@ -21,7 +21,7 @@ import javax.crypto.KeyGenerator; import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.highmed.dsf.bpe.variables.BloomFilterConfig; +import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.hl7.fhir.r4.model.Base64BinaryType; import org.hl7.fhir.r4.model.BooleanType; import org.hl7.fhir.r4.model.ResourceType; From 34bae082e6ec97673a9cf07d804846735161cf70 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 27 Jan 2021 09:41:18 +0100 Subject: [PATCH 006/125] also increase data sharing process into new dev cycle 0.5.0 --- dsf-bpe-process-data-sharing/pom.xml | 2 +- dsf-bpe-process-highmed-base/pom.xml | 2 +- pom.xml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dsf-bpe-process-data-sharing/pom.xml b/dsf-bpe-process-data-sharing/pom.xml index 5cc4cd4d..e73f6d05 100644 --- a/dsf-bpe-process-data-sharing/pom.xml +++ b/dsf-bpe-process-data-sharing/pom.xml @@ -9,7 +9,7 @@ <parent> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> <groupId>org.highmed.dsf</groupId> - <version>0.4.0-SNAPSHOT</version> + <version>0.5.0-SNAPSHOT</version> </parent> <dependencies> diff --git a/dsf-bpe-process-highmed-base/pom.xml b/dsf-bpe-process-highmed-base/pom.xml index 3e965463..8ea538c9 100644 --- a/dsf-bpe-process-highmed-base/pom.xml +++ b/dsf-bpe-process-highmed-base/pom.xml @@ -9,7 +9,7 @@ <parent> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> <groupId>org.highmed.dsf</groupId> - <version>0.4.0-SNAPSHOT</version> + <version>0.5.0-SNAPSHOT</version> </parent> <dependencies> diff --git a/pom.xml b/pom.xml index bbcf0a5b..1dfa98bd 100644 --- a/pom.xml +++ b/pom.xml @@ -69,12 +69,12 @@ <dependency> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-process-highmed-base</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.5.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.highmed.dsf.processes</groupId> <artifactId>dsf-bpe-process-data-sharing</artifactId> - <version>0.4.0-SNAPSHOT</version> + <version>0.5.0-SNAPSHOT</version> </dependency> <dependency> <groupId>org.highmed.dsf</groupId> From 503da14682b50154a14dfd4026362bd722e3709d Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 3 Feb 2021 14:48:52 +0100 Subject: [PATCH 007/125] Adds dependency of data sharing process to local services and feasibility processes, replaces bpe-managed versions with ${version} --- dsf-bpe-process-data-sharing/pom.xml | 24 ---- .../highmed/dsf/bpe/ConstantsDataSharing.java | 4 +- .../DataSharingProcessPluginDefinition.java | 4 +- .../dsf/bpe/message/SendMedicRequest.java | 4 +- .../dsf/bpe/message/SendTtpRequest.java | 4 +- .../service/DownloadDataSharingResources.java | 4 +- .../DownloadResearchStudyResource.java | 4 +- .../dsf/bpe/service/SelectRequestTargets.java | 4 +- .../dsf/bpe/service/StoreCorrelationKeys.java | 4 +- .../dsf/bpe/variable/BloomFilterConfig.java | 0 .../variable/BloomFilterConfigSerializer.java | 0 .../bpe/variable/BloomFilterConfigValues.java | 0 .../resources/bpe/computeDataSharing.bpmn | 6 +- .../resources/bpe/executeDataSharing.bpmn | 4 +- .../resources/bpe/requestDataSharing.bpmn | 6 +- .../highmed-computeDataSharing.xml | 2 +- .../highmed-executeDataSharing.xml | 2 +- .../highmed-requestDataSharing.xml | 2 +- .../fhir/CodeSystem/highmed-data-sharing.xml | 4 +- .../highmed-task-compute-data-sharing.xml | 4 +- .../highmed-task-execute-data-sharing.xml | 4 +- ...ed-task-multi-medic-error-data-sharing.xml | 4 +- ...d-task-multi-medic-result-data-sharing.xml | 4 +- .../highmed-task-request-data-sharing.xml | 4 +- ...-task-single-medic-result-data-sharing.xml | 4 +- .../fhir/ValueSet/highmed-data-sharing.xml | 2 +- .../bpe/variables/BloomFilterConfigTest.java | 0 dsf-bpe-process-feasibility/pom.xml | 62 +++++----- .../highmed/dsf/bpe/ConstantsFeasibility.java | 21 ---- .../FeasibilityProcessPluginDefinition.java | 28 +++-- .../dsf/bpe/message/SendMedicRequest.java | 30 ++--- .../bpe/message/SendMultiMedicResults.java | 16 +-- .../bpe/message/SendSingleMedicResults.java | 16 +-- .../dsf/bpe/message/SendTtpRequest.java | 14 +-- .../service/CalculateMultiMedicResults.java | 4 +- .../service/CheckFeasibilityResources.java | 4 +- .../bpe/service/CheckMultiMedicResults.java | 22 ++-- .../highmed/dsf/bpe/service/CheckQueries.java | 7 +- .../bpe/service/CheckSingleMedicResults.java | 6 +- .../CheckTtpComputedMultiMedicResults.java | 2 +- .../service/DownloadFeasibilityResources.java | 36 +++--- .../DownloadResearchStudyResource.java | 26 ++--- .../dsf/bpe/service/DownloadResultSets.java | 2 +- .../dsf/bpe/service/ExecuteQueries.java | 13 ++- .../dsf/bpe/service/ExecuteRecordLink.java | 7 +- .../service/FilterQueryResultsByConsent.java | 6 +- .../dsf/bpe/service/GenerateBloomFilters.java | 4 +- .../dsf/bpe/service/GenerateCountFromIds.java | 6 +- .../dsf/bpe/service/ModifyQueries.java | 6 +- .../dsf/bpe/service/SelectRequestTargets.java | 6 +- .../dsf/bpe/service/StoreCorrelationKeys.java | 18 +-- .../highmed/dsf/bpe/service/StoreResults.java | 18 +-- .../config/FeasibilitySerializerConfig.java | 7 -- .../resources/bpe/computeFeasibility.bpmn | 6 +- .../resources/bpe/executeFeasibility.bpmn | 4 +- .../resources/bpe/requestFeasibility.bpmn | 6 +- .../fhir/CodeSystem/highmed-feasibility.xml | 68 ----------- .../highmed-task-compute-feasibility.xml | 8 +- .../highmed-task-execute-feasibility.xml | 16 +-- ...ed-task-multi-medic-result-feasibility.xml | 8 +- .../highmed-task-request-feasibility.xml | 20 ++-- ...d-task-single-medic-result-feasibility.xml | 8 +- .../fhir/ValueSet/highmed-feasibility.xml | 25 ---- ...lityFromMedicsViaMedic1ExampleStarter.java | 20 ++-- .../dsf/fhir/profile/TaskProfileTest.java | 110 +++++++++--------- dsf-bpe-process-highmed-base/pom.xml | 28 ----- dsf-bpe-process-local-services/pom.xml | 5 + .../LocalServicesProcessPluginDefinition.java | 16 +-- .../dsf/bpe/service/ExtractInputValues.java | 41 ++++--- .../highmed/dsf/bpe/service/StoreResult.java | 14 ++- .../bpe/localServicesIntegration.bpmn | 4 +- ...ighmed-task-local-services-integration.xml | 20 ++-- .../LocalServicesMedic1ExampleStarter.java | 21 ++-- .../dsf/fhir/profile/TaskProfileTest.java | 24 ++-- .../src/main/resources/bpe/ping.bpmn | 4 +- .../src/main/resources/bpe/pong.bpmn | 4 +- .../main/resources/bpe/downloadAllowList.bpmn | 2 +- .../main/resources/bpe/updateAllowList.bpmn | 2 +- .../resources/bpe/executeUpdateResources.bpmn | 2 +- .../resources/bpe/requestUpdateResources.bpmn | 4 +- pom.xml | 14 +-- 81 files changed, 432 insertions(+), 567 deletions(-) rename {dsf-bpe-process-highmed-base => dsf-bpe-process-data-sharing}/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java (100%) rename {dsf-bpe-process-highmed-base => dsf-bpe-process-data-sharing}/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java (100%) rename {dsf-bpe-process-highmed-base => dsf-bpe-process-data-sharing}/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigValues.java (100%) rename {dsf-bpe-process-highmed-base => dsf-bpe-process-data-sharing}/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml (96%) rename {dsf-bpe-process-highmed-base => dsf-bpe-process-data-sharing}/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml (95%) rename {dsf-bpe-process-feasibility => dsf-bpe-process-data-sharing}/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigTest.java (100%) delete mode 100644 dsf-bpe-process-feasibility/src/main/resources/fhir/CodeSystem/highmed-feasibility.xml delete mode 100644 dsf-bpe-process-feasibility/src/main/resources/fhir/ValueSet/highmed-feasibility.xml delete mode 100644 dsf-bpe-process-highmed-base/pom.xml diff --git a/dsf-bpe-process-data-sharing/pom.xml b/dsf-bpe-process-data-sharing/pom.xml index e73f6d05..b5e46e81 100644 --- a/dsf-bpe-process-data-sharing/pom.xml +++ b/dsf-bpe-process-data-sharing/pom.xml @@ -18,10 +18,6 @@ <artifactId>dsf-bpe-process-base</artifactId> <scope>provided</scope> </dependency> - <dependency> - <groupId>org.highmed.dsf</groupId> - <artifactId>dsf-bpe-process-highmed-base</artifactId> - </dependency> <dependency> <groupId>org.highmed.dsf</groupId> @@ -46,26 +42,6 @@ </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - </execution> - </executions> - <configuration> - <createDependencyReducedPom>false</createDependencyReducedPom> - </configuration> - </plugin> - </plugins> - </build> - <profiles> <profile> <id>copy-to-highmed-dsf-process</id> diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index b4b3dfb2..dfc4bc7e 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -7,10 +7,12 @@ public interface ConstantsDataSharing { String BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY = "researchStudy"; String BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK = "needsConsentCheck"; - String BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE = "needsRecordLinkage"; + String BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE = "needsRecordLinkage"; String BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG = "bloomFilterConfig"; String BPMN_EXECUTION_VARIABLE_COHORTS = "cohorts"; String BPMN_EXECUTION_VARIABLE_QUERIES = "queries"; + String BPMN_EXECUTION_VARIABLE_QUERY_RESULTS = "queryResults"; + String BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS = "finalQueryResults"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestDataSharing/"; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java index b8c0362a..76139154 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java @@ -19,7 +19,7 @@ public class DataSharingProcessPluginDefinition implements ProcessPluginDefinition { - public static final String VERSION = "0.4.0"; + public static final String VERSION = "0.5.0"; @Override public String getName() @@ -48,8 +48,6 @@ public Stream<Class<?>> getSpringConfigClasses() @Override public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader) { - // Some FHIR resource files are located in the module 'dsf-bpe-process-highmed-base' - var aCom = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-computeDataSharing.xml"); var aExe = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeDataSharing.xml"); var aReq = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-requestDataSharing.xml"); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java index 3e3b6cb9..974a6b3e 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java @@ -1,6 +1,6 @@ package org.highmed.dsf.bpe.message; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; @@ -49,7 +49,7 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut .createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK, needsConsentCheck); - boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE); + boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); ParameterComponent inputNeedsRecordLinkage = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java index e7d9adfd..6eda01e6 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.message; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; @@ -36,7 +36,7 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY, target.getCorrelationKey())); - boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE); + boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); Task.ParameterComponent inputNeedsRecordLinkage = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java index ffeb0bed..dc2d5d61 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; @@ -81,7 +81,7 @@ protected void doExecute(DelegateExecution execution) execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK, needsConsentCheck); boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); - execution.setVariable(BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); if (needsRecordLinkage) { diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java index 06333e9d..47e8ded1 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -1,6 +1,6 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; @@ -59,7 +59,7 @@ protected void doExecute(DelegateExecution execution) execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY, researchStudy); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK, needsConsentCheck); - execution.setVariable(BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); } private IdType getResearchStudyId(Task task) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index 548ce6bf..0bb864fd 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -2,7 +2,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; @@ -76,7 +76,7 @@ protected void doExecute(DelegateExecution execution) execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(getMedicTargets(researchStudy))); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(getTtpTarget(researchStudy))); - Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE); + Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); if (Boolean.TRUE.equals(needsRecordLinkage)) { diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java index 4896857b..5e0c9847 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; @@ -37,7 +37,7 @@ protected void doExecute(DelegateExecution execution) execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(new Targets(targets))); boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); - execution.setVariable(BPMN_EXCEUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); } private boolean getNeedsRecordLinkageCheck(Task task) diff --git a/dsf-bpe-process-highmed-base/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java similarity index 100% rename from dsf-bpe-process-highmed-base/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java diff --git a/dsf-bpe-process-highmed-base/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java similarity index 100% rename from dsf-bpe-process-highmed-base/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java diff --git a/dsf-bpe-process-highmed-base/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigValues.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigValues.java similarity index 100% rename from dsf-bpe-process-highmed-base/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigValues.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigValues.java diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn index f6cd8636..28c014d2 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yff9tp" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> - <bpmn:process id="computeDataSharing" isExecutable="true" camunda:versionTag="0.4.0"> + <bpmn:process id="computeDataSharing" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:subProcess id="SubProcess_1gopxt4"> <bpmn:incoming>SequenceFlow_1lfe4wr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0xxpamp</bpmn:outgoing> @@ -43,7 +43,7 @@ <camunda:inputOutput> <camunda:inputParameter name="processDefinitionKey">requestDataSharing</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.0</camunda:inputParameter> + <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="messageName">resultMultiMedicDataSharingMessage</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> @@ -85,7 +85,7 @@ <camunda:inputOutput> <camunda:inputParameter name="processDefinitionKey">requestDataSharing</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-error-data-sharing</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.0</camunda:inputParameter> + <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="messageName">errorMultiMedicDataSharingMessage</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index ca9128b9..97abe1a2 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> - <bpmn:process id="executeDataSharing" isExecutable="true" camunda:versionTag="0.4.0"> + <bpmn:process id="executeDataSharing" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResults"> <bpmn:incoming>SequenceFlow_0q803rh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> @@ -24,7 +24,7 @@ <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="messageName">resultSingleMedicDataSharingMessage</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.0</camunda:inputParameter> + <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="processDefinitionKey">computeDataSharing</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing</camunda:inputParameter> </camunda:inputOutput> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn index 3b278606..7f706457 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1flneil" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> - <bpmn:process id="requestDataSharing" isExecutable="true" camunda:versionTag="0.4.0"> + <bpmn:process id="requestDataSharing" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:sequenceFlow id="Flow_0dd6nmz" sourceRef="StartEvent" targetRef="downloadResearchStudyResource" /> <bpmn:sequenceFlow id="Flow_06otxko" sourceRef="downloadResearchStudyResource" targetRef="selectRequestTargetsAndGenerateKeys" /> <bpmn:startEvent id="StartEvent" name="start"> @@ -16,7 +16,7 @@ <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="processDefinitionKey">executeDataSharing</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.0</camunda:inputParameter> + <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="messageName">executeDataSharingMessage</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing</camunda:inputParameter> </camunda:inputOutput> @@ -68,7 +68,7 @@ <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="processDefinitionKey">computeDataSharing</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.0</camunda:inputParameter> + <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="messageName">computeDataSharingMessage</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing</camunda:inputParameter> </camunda:inputOutput> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml index 5296d7a5..e5c1c879 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml @@ -71,7 +71,7 @@ </extension> <url value="http://highmed.org/bpe/Process/computeDataSharing" /> <!-- version managed by bpe --> - <version value="bpe-managed" /> + <version value="${version}" /> <name value="ComputeDataSharing" /> <title value="Compute Data Sharing" /> <subtitle value="Process to compute a data sharing result" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml index 42d1c229..8f92e4b8 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml @@ -45,7 +45,7 @@ </extension> <url value="http://highmed.org/bpe/Process/executeDataSharing" /> <!-- version managed by bpe --> - <version value="bpe-managed" /> + <version value="${version}" /> <name value="ExecuteDataSharing" /> <title value="Execute Data Sharing" /> <subtitle value="Process to execute a data sharing query" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml index 04d44a1c..b3217047 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml @@ -103,7 +103,7 @@ </extension> <url value="http://highmed.org/bpe/Process/requestDataSharing" /> <!-- version managed by bpe --> - <version value="bpe-managed" /> + <version value="${version}" /> <name value="RequestDataSharing" /> <title value="Request Data Sharing" /> <subtitle value="Process to request data sharing" /> diff --git a/dsf-bpe-process-highmed-base/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml similarity index 96% rename from dsf-bpe-process-highmed-base/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml rename to dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml index 7fd9f970..34a12a3e 100644 --- a/dsf-bpe-process-highmed-base/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml @@ -7,7 +7,7 @@ </meta> <url value="http://highmed.org/fhir/CodeSystem/data-sharing"/> <!-- version managed by bpe --> - <version value="bpe-managed" /> + <version value="${version}" /> <name value="HiGHmed_Data_Sharing"/> <title value="HiGHmed Data Sharing"/> <!-- status managed by bpe --> @@ -37,7 +37,7 @@ </concept> <concept> <code value="bloom-filter-configuration"/> - <display value="Bloom Filter Cconfiguration"/> + <display value="Bloom Filter Configuration"/> <definition value="Base64 binary encoded bloom filter configuration"/> </concept> <concept> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml index e437015d..8843f8be 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml @@ -7,7 +7,7 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing" /> <!-- version managed by bpe --> - <version value="bpe-managed" /> + <version value="${version}" /> <name value="TaskComputeDataSharing" /> <!-- status managed by bpe --> <status value="unknown" /> @@ -22,7 +22,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/computeDataSharing/0.4.0" /> + <fixedUri value="http://highmed.org/bpe/Process/computeDataSharing/0.5.0" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml index 736c742b..e10863df 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml @@ -7,7 +7,7 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing" /> <!-- version managed by bpe --> - <version value="bpe-managed" /> + <version value="${version}" /> <name value="TaskExecuteDataSharing" /> <!-- status managed by bpe --> <status value="unknown" /> @@ -22,7 +22,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/executeDataSharing/0.4.0" /> + <fixedUri value="http://highmed.org/bpe/Process/executeDataSharing/0.5.0" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml index 8eabdfe8..b59298e3 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml @@ -8,7 +8,7 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing" /> <!-- version managed by bpe --> - <version value="bpe-managed" /> + <version value="${version}" /> <name value="TaskErrorDataSharing" /> <!-- status managed by bpe --> <status value="unknown" /> @@ -23,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/0.4.0" /> + <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/0.5.0" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml index d56e929f..9327eaae 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml @@ -7,7 +7,7 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing" /> <!-- version managed by bpe --> - <version value="bpe-managed" /> + <version value="${version}" /> <name value="TaskMultiMedicResultDataSharing" /> <!-- status managed by bpe --> <status value="unknown" /> @@ -22,7 +22,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/0.4.0" /> + <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/0.5.0" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml index e93c0261..5f01406f 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml @@ -7,7 +7,7 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-request-data-sharing" /> <!-- version managed by bpe --> - <version value="bpe-managed" /> + <version value="${version}" /> <name value="TaskRequestDataSharing" /> <!-- status managed by bpe --> <status value="unknown" /> @@ -22,7 +22,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/0.4.0" /> + <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/0.5.0" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml index 84e0251a..3cec4283 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml @@ -7,7 +7,7 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing" /> <!-- version managed by bpe --> - <version value="bpe-managed" /> + <version value="${version}" /> <name value="TaskSingleMedicResultDataSharing" /> <!-- status managed by bpe --> <status value="unknown" /> @@ -22,7 +22,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/computeDataSharing/0.4.0" /> + <fixedUri value="http://highmed.org/bpe/Process/computeDataSharing/0.5.0" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-highmed-base/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml similarity index 95% rename from dsf-bpe-process-highmed-base/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml rename to dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml index d04ccfdf..fbcb51ba 100644 --- a/dsf-bpe-process-highmed-base/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml @@ -7,7 +7,7 @@ </meta> <url value="http://highmed.org/fhir/ValueSet/data-sharing"/> <!-- version managed by bpe --> - <version value="bpe-managed" /> + <version value="${version}" /> <name value="HiGHmed_Data_Sharing"/> <title value="HiGHmed Data Sharing"/> <!-- status managed by bpe --> diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigTest.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigTest.java similarity index 100% rename from dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigTest.java rename to dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigTest.java diff --git a/dsf-bpe-process-feasibility/pom.xml b/dsf-bpe-process-feasibility/pom.xml index 00d0aa90..7c0c52fb 100644 --- a/dsf-bpe-process-feasibility/pom.xml +++ b/dsf-bpe-process-feasibility/pom.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>dsf-bpe-process-feasibility</artifactId> @@ -19,7 +20,8 @@ </dependency> <dependency> <groupId>org.highmed.dsf</groupId> - <artifactId>dsf-bpe-process-highmed-base</artifactId> + <artifactId>dsf-bpe-process-data-sharing</artifactId> + <scope>provided</scope> </dependency> <dependency> @@ -46,26 +48,6 @@ </dependency> </dependencies> - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - </execution> - </executions> - <configuration> - <createDependencyReducedPom>false</createDependencyReducedPom> - </configuration> - </plugin> - </plugins> - </build> - <profiles> <profile> <id>copy-to-highmed-dsf-process</id> @@ -89,7 +71,8 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process</outputDirectory> + <outputDirectory>../../highmed-dsf/dsf-docker-test-setup/bpe/app/process + </outputDirectory> </configuration> </execution> <execution> @@ -106,7 +89,9 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</outputDirectory> + <outputDirectory> + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process + </outputDirectory> </configuration> </execution> <execution> @@ -123,7 +108,9 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</outputDirectory> + <outputDirectory> + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process + </outputDirectory> </configuration> </execution> <execution> @@ -140,7 +127,9 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</outputDirectory> + <outputDirectory> + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process + </outputDirectory> </configuration> </execution> <execution> @@ -157,7 +146,9 @@ <version>${project.version}</version> </artifactItem> </artifactItems> - <outputDirectory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</outputDirectory> + <outputDirectory> + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process + </outputDirectory> </configuration> </execution> </executions> @@ -175,28 +166,35 @@ <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process</directory> + <directory> + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic1/bpe/app/process + </directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process</directory> + <directory> + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic2/bpe/app/process + </directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process</directory> + <directory> + ../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/medic3/bpe/app/process + </directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> <followSymlinks>false</followSymlinks> </fileset> <fileset> - <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process</directory> + <directory>../../highmed-dsf/dsf-docker-test-setup-3medic-ttp/ttp/bpe/app/process + </directory> <includes> <include>${project.artifactId}-${project.version}.jar</include> </includes> diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java index 1a1b047e..3126f99e 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java @@ -5,15 +5,6 @@ public interface ConstantsFeasibility { - String BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY = "researchStudy"; - String BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK = "needsConsentCheck"; - String BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE = "needsRecordLinkage"; - String BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG = "bloomFilterConfig"; - String BPMN_EXECUTION_VARIABLE_COHORTS = "cohorts"; - String BPMN_EXECUTION_VARIABLE_QUERIES = "queries"; - String BPMN_EXECUTION_VARIABLE_QUERY_RESULTS = "queryResults"; - String BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS = "finalQueryResults"; - String BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_RESULT = "errorMultiMedicFeasibilityResult"; // Must be 3 or larger, as otherwise it is possible to draw conclusions about the individual MeDICs @@ -22,18 +13,6 @@ public interface ConstantsFeasibility int MIN_COHORT_DEFINITIONS = 1; String FEASIBILITY_QUERY_PREFIX = "select count"; - String CODESYSTEM_HIGHMED_FEASIBILITY = "http://highmed.org/fhir/CodeSystem/feasibility"; - String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY = "medic-correlation-key"; - String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK = "needs-consent-check"; - String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE = "needs-record-linkage"; - String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG = "bloom-filter-configuration"; - String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT = "single-medic-result"; - String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT_REFERENCE = "single-medic-result-reference"; - String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT = "participating-medics"; - String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NOT_ENOUGH_PARTICIPATION = "not-enough-participation"; - String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_MULTI_MEDIC_RESULT = "multi-medic-result"; - String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE = "research-study-reference"; - String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-request-feasibility"; String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestFeasibility/"; String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java index 7713c894..81921c31 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java @@ -5,6 +5,7 @@ import java.util.Map; import java.util.stream.Stream; +import org.highmed.dsf.bpe.spring.config.DataSharingSerializerConfig; import org.highmed.dsf.bpe.spring.config.FeasibilityConfig; import org.highmed.dsf.bpe.spring.config.FeasibilitySerializerConfig; import org.highmed.dsf.fhir.resources.AbstractResource; @@ -20,6 +21,9 @@ public class FeasibilityProcessPluginDefinition implements ProcessPluginDefiniti { public static final String VERSION = "0.5.0"; + private static final String DEPENDENCY_DATA_SHARING_VERSION = "0.5.0"; + private static final String DEPENDENCY_DATA_SHARING_NAME_AND_VERSION = "dsf-bpe-process-data-sharing-0.5.0"; + @Override public String getName() { @@ -41,7 +45,13 @@ public Stream<String> getBpmnFiles() @Override public Stream<Class<?>> getSpringConfigClasses() { - return Stream.of(FeasibilityConfig.class, FeasibilitySerializerConfig.class); + return Stream.of(FeasibilityConfig.class, FeasibilitySerializerConfig.class, DataSharingSerializerConfig.class); + } + + @Override + public List<String> getDependencyNamesAndVersions() + { + return Arrays.asList(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION); } @Override @@ -51,7 +61,9 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var aExe = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeFeasibility.xml"); var aReq = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-requestFeasibility.xml"); - var cF = CodeSystemResource.file("fhir/CodeSystem/highmed-feasibility.xml"); + var cDS = CodeSystemResource + .dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/CodeSystem/data-sharing", + DEPENDENCY_DATA_SHARING_VERSION); var sTCom = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-compute-feasibility.xml"); var sTErr = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-error-feasibility.xml"); @@ -62,12 +74,14 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var sTResS = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml"); - var vF = ValueSetResource.file("fhir/ValueSet/highmed-feasibility.xml"); + var vDS = ValueSetResource + .dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/ValueSet/data-sharing", + DEPENDENCY_DATA_SHARING_VERSION); - Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( - "computeFeasibility/" + VERSION, Arrays.asList(aCom, cF, sTCom, sTResS, vF), - "executeFeasibility/" + VERSION, Arrays.asList(aExe, cF, sTExe, vF), - "requestFeasibility/" + VERSION, Arrays.asList(aReq, cF, sTReq, sTResM, sTErr, vF)); + Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map + .of("computeFeasibility/" + VERSION, Arrays.asList(aCom, cDS, sTCom, sTResS, vDS), + "executeFeasibility/" + VERSION, Arrays.asList(aExe, cDS, sTExe, vDS), + "requestFeasibility/" + VERSION, Arrays.asList(aReq, cDS, sTReq, sTResM, sTErr, vDS)); return ResourceProvider .read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java index 41479bcc..f8528ed8 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java @@ -1,14 +1,14 @@ package org.highmed.dsf.bpe.message; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; import java.util.stream.Stream; @@ -40,26 +40,26 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut IdType researchStudyId = new IdType( getFhirWebserviceClientProvider().getLocalBaseUrl() + "/" + researchStudy.getId()); - ParameterComponent inputResearchStudyReference = getTaskHelper().createInput(CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE, + ParameterComponent inputResearchStudyReference = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE, new Reference().setReference(researchStudyId.toVersionless().getValueAsString())); boolean needsConsentCheck = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); ParameterComponent inputNeedsConsentCheck = getTaskHelper() - .createInput(CODESYSTEM_HIGHMED_FEASIBILITY, CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK, + .createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK, needsConsentCheck); boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); ParameterComponent inputNeedsRecordLinkage = getTaskHelper() - .createInput(CODESYSTEM_HIGHMED_FEASIBILITY, CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE, + .createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); if (needsRecordLinkage) { BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); - ParameterComponent inputBloomFilterConfig = getTaskHelper().createInput(CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG, bloomFilterConfig.toBytes()); + ParameterComponent inputBloomFilterConfig = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG, bloomFilterConfig.toBytes()); return Stream.of(inputResearchStudyReference, inputNeedsConsentCheck, inputNeedsRecordLinkage, inputBloomFilterConfig); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java index 8597de85..7ac90703 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java @@ -3,10 +3,10 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_MULTI_MEDIC_RESULT; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS; import java.util.List; import java.util.stream.Stream; @@ -49,14 +49,14 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut private Stream<ParameterComponent> toInputs(FinalFeasibilityQueryResult result) { ParameterComponent input1 = getTaskHelper() - .createInputUnsignedInt(CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_MULTI_MEDIC_RESULT, + .createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT, result.getCohortSize()); input1.addExtension(createCohortIdExtension(result.getCohortId())); ParameterComponent input2 = getTaskHelper() - .createInputUnsignedInt(CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT, + .createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS, result.getParticipatingMedics()); input2.addExtension(createCohortIdExtension(result.getCohortId())); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java index e28c582d..57d8ecc6 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -1,10 +1,10 @@ package org.highmed.dsf.bpe.message; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE; import java.util.stream.Stream; @@ -47,15 +47,15 @@ private Task.ParameterComponent toInput(FeasibilityQueryResult result) { if (result.isCohortSizeResult()) { - ParameterComponent input = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT, result.getCohortSize()); + ParameterComponent input = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT, result.getCohortSize()); input.addExtension(createCohortIdExtension(result.getCohortId())); return input; } else if (result.isIdResultSetUrlResult()) { - ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT_REFERENCE, + ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE, new Reference(result.getResultSetUrl())); input.addExtension(createCohortIdExtension(result.getCohortId())); return input; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java index 385d5bfb..87259dd7 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java @@ -1,10 +1,10 @@ package org.highmed.dsf.bpe.message; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; import java.util.stream.Stream; @@ -32,13 +32,13 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE Targets multiInstanceTargets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); Stream<Task.ParameterComponent> inputTargets = multiInstanceTargets.getEntries().stream() - .map(target -> getTaskHelper().createInput(CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY, + .map(target -> getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY, target.getCorrelationKey())); boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); Task.ParameterComponent inputNeedsRecordLinkage = getTaskHelper() - .createInput(CODESYSTEM_HIGHMED_FEASIBILITY, CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE, + .createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); return Stream.concat(inputTargets, Stream.of(inputNeedsRecordLinkage)); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java index 4508c07e..44ba14b7 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import java.util.List; import java.util.Map; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java index edbca48c..347d98cb 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java @@ -2,8 +2,8 @@ import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_COHORTS; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsFeasibility.MIN_COHORT_DEFINITIONS; import static org.highmed.dsf.bpe.ConstantsFeasibility.MIN_PARTICIPATING_MEDICS; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java index 96a62cc1..c8a65670 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java @@ -3,9 +3,9 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_MULTI_MEDIC_RESULT; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS; import java.util.List; import java.util.stream.Collectors; @@ -61,9 +61,9 @@ private void addFinalFeasibilityQueryErrorsToLeadingTask(Task toRead, Task toWri private FinalFeasibilityQueryResults readFinalFeasibilityQueryResultsFromCurrentTask(Task task) { List<FinalFeasibilityQueryResult> results = task.getInput().stream() - .filter(in -> in.hasType() && in.getType().hasCoding() && CODESYSTEM_HIGHMED_FEASIBILITY + .filter(in -> in.hasType() && in.getType().hasCoding() && CODESYSTEM_HIGHMED_DATA_SHARING .equals(in.getType().getCodingFirstRep().getSystem()) - && CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_MULTI_MEDIC_RESULT + && CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT .equals(in.getType().getCodingFirstRep().getCode())).map(in -> toResult(task, in)) .collect(Collectors.toList()); return new FinalFeasibilityQueryResults(results); @@ -80,9 +80,9 @@ private FinalFeasibilityQueryResult toResult(Task task, ParameterComponent in) private int getParticipatingMedicsCountByCohortId(Task task, String cohortId) { return task.getInput().stream() - .filter(in -> in.hasType() && in.getType().hasCoding() && CODESYSTEM_HIGHMED_FEASIBILITY + .filter(in -> in.hasType() && in.getType().hasCoding() && CODESYSTEM_HIGHMED_DATA_SHARING .equals(in.getType().getCodingFirstRep().getSystem()) - && CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT + && CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS .equals(in.getType().getCodingFirstRep().getCode()) && cohortId .equals(((Reference) in.getExtensionByUrl(EXTENSION_HIGHMED_GROUP_ID).getValue()) .getReference())).mapToInt(in -> ((UnsignedIntType) in.getValue()).getValue()) @@ -103,13 +103,13 @@ private void addFinalFeasibilityQueryResultsToLeadingTask(FinalFeasibilityQueryR private void addResultOutput(FinalFeasibilityQueryResult result, Task toWrite) { - TaskOutputComponent output1 = getTaskHelper().createOutputUnsignedInt(CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_MULTI_MEDIC_RESULT, result.getCohortSize()); + TaskOutputComponent output1 = getTaskHelper().createOutputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT, result.getCohortSize()); output1.addExtension(createCohortIdExtension(result.getCohortId())); toWrite.addOutput(output1); - TaskOutputComponent output2 = getTaskHelper().createOutputUnsignedInt(CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT, result.getParticipatingMedics()); + TaskOutputComponent output2 = getTaskHelper().createOutputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS, result.getParticipatingMedics()); output2.addExtension(createCohortIdExtension(result.getCohortId())); toWrite.addOutput(output2); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java index 73965e0e..e0001363 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java @@ -1,5 +1,8 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; + import java.util.HashMap; import java.util.List; import java.util.Map; @@ -43,7 +46,7 @@ public void afterPropertiesSet() throws Exception protected void doExecute(DelegateExecution execution) throws Exception { List<Group> cohorts = ((FhirResourcesList) execution - .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_COHORTS)).getResourcesAndCast(); + .getVariable(BPMN_EXECUTION_VARIABLE_COHORTS)).getResourcesAndCast(); Map<String, String> queries = new HashMap<>(); @@ -69,6 +72,6 @@ protected void doExecute(DelegateExecution execution) throws Exception } }); - execution.setVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERIES, queries); + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERIES, queries); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java index 6dd391ae..ed0f8548 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java @@ -1,5 +1,7 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + import java.util.ArrayList; import java.util.List; import java.util.Optional; @@ -30,7 +32,7 @@ public CheckSingleMedicResults(FhirWebserviceClientProvider clientProvider, Task protected void doExecute(DelegateExecution execution) throws Exception { FeasibilityQueryResults results = (FeasibilityQueryResults) execution - .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); Task currentTask = getCurrentTaskFromExecutionVariables(); List<FeasibilityQueryResult> filteredResults = filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(results, @@ -38,7 +40,7 @@ protected void doExecute(DelegateExecution execution) throws Exception // TODO: add percentage filter over results - execution.setVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(filteredResults))); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java index 77bbd244..3dfeedc9 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java @@ -5,7 +5,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_RESULT; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsFeasibility.MIN_PARTICIPATING_MEDICS; import java.util.List; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java index a067f420..47ac7754 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java @@ -1,16 +1,16 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_COHORTS; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; import java.util.Collections; import java.util.List; @@ -95,8 +95,8 @@ protected void doExecute(DelegateExecution execution) throws Exception private IdType getResearchStudyId(Task task) { Reference researchStudyReference = getTaskHelper() - .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE).findFirst().get(); + .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE).findFirst().get(); return new IdType(researchStudyReference.getReference()); } @@ -167,8 +167,8 @@ private String getTtpIdentifier(ResearchStudy researchStudy, FhirWebserviceClien private boolean getNeedsConsentCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK).orElseThrow( + return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK).orElseThrow( () -> new IllegalArgumentException( "NeedsConsentCheck boolean is not set in task with id='" + task.getId() + "', this error should " + "have been caught by resource validation")); @@ -176,8 +176,8 @@ private boolean getNeedsConsentCheck(Task task) private boolean getNeedsRecordLinkageCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( + return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( () -> new IllegalArgumentException( "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() + "', this error should " + "have been caught by resource validation")); @@ -186,8 +186,8 @@ private boolean getNeedsRecordLinkageCheck(Task task) private BloomFilterConfig getBloomFilterConfig(Task task) { return BloomFilterConfig.fromBytes(getTaskHelper() - .getFirstInputParameterByteValue(task, CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG).orElseThrow( + .getFirstInputParameterByteValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG).orElseThrow( () -> new IllegalArgumentException( "BloomFilterConfig byte[] is not set in task with id='" + task.getId() + "', this error should " + "have been caught by resource validation"))); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java index 90b18e53..5d15ac25 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -3,13 +3,13 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; import java.util.List; import java.util.Objects; @@ -74,8 +74,8 @@ protected void doExecute(DelegateExecution execution) throws Exception private IdType getResearchStudyId(Task task) { Reference researchStudyReference = getTaskHelper() - .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE).findFirst().orElseThrow( + .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE).findFirst().orElseThrow( () -> new IllegalArgumentException( "ResearchStudy reference is not set in task with id='" + task.getId() + "', this error should " + "have been caught by resource validation")); @@ -146,8 +146,8 @@ private ResearchStudy update(ResearchStudy researchStudy, FhirWebserviceClient c private boolean getNeedsConsentCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK).orElseThrow( + return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK).orElseThrow( () -> new IllegalArgumentException( "NeedsConsentCheck boolean is not set in task with id='" + task.getId() + "', this error should " + "have been caught by resource validation")); @@ -155,8 +155,8 @@ private boolean getNeedsConsentCheck(Task task) private boolean getNeedsRecordLinkageCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( + return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( () -> new IllegalArgumentException( "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() + "', this error should " + "have been caught by resource validation")); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java index 5df78880..d10b431c 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import java.io.IOException; import java.io.InputStream; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java index c4fb0365..84ae0e54 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -1,5 +1,10 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + import java.util.List; import java.util.Map; import java.util.Objects; @@ -47,18 +52,18 @@ protected void doExecute(DelegateExecution execution) throws Exception // <groupId, query> @SuppressWarnings("unchecked") Map<String, String> queries = (Map<String, String>) execution - .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERIES); + .getVariable(BPMN_EXECUTION_VARIABLE_QUERIES); Boolean needsConsentCheck = (Boolean) execution - .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); + .getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); Boolean needsRecordLinkage = (Boolean) execution - .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); + .getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); boolean idQuery = Boolean.TRUE.equals(needsConsentCheck) || Boolean.TRUE.equals(needsRecordLinkage); List<FeasibilityQueryResult> results = queries.entrySet().stream() .map(entry -> executeQuery(entry.getKey(), entry.getValue(), idQuery)).collect(Collectors.toList()); - execution.setVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(results))); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java index da6d2119..9b7bff31 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java @@ -1,5 +1,8 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + import java.util.List; import java.util.Map; import java.util.Objects; @@ -50,7 +53,7 @@ public void afterPropertiesSet() throws Exception protected void doExecute(DelegateExecution execution) throws Exception { FeasibilityQueryResults results = (FeasibilityQueryResults) execution - .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); Map<String, List<FeasibilityQueryResult>> byCohortId = results.getResults().stream() .collect(Collectors.groupingBy(FeasibilityQueryResult::getCohortId)); @@ -60,7 +63,7 @@ protected void doExecute(DelegateExecution execution) throws Exception List<FinalFeasibilityQueryResult> matchedResults = byCohortId.entrySet().stream() .map(e -> match(matcher, e.getKey(), e.getValue())).collect(Collectors.toList()); - execution.setVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS, FinalFeasibilityQueryResultsValues.create(new FinalFeasibilityQueryResults(matchedResults))); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java index ebdb9f02..68b038e6 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java @@ -1,5 +1,7 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + import java.util.List; import java.util.stream.Collectors; @@ -24,11 +26,11 @@ public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, protected void doExecute(DelegateExecution execution) throws Exception { FeasibilityQueryResults results = (FeasibilityQueryResults) execution - .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); List<FeasibilityQueryResult> filteredResults = filterResults(results.getResults()); - execution.setVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(filteredResults))); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java index 98335b0f..fa4ddae0 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -3,8 +3,8 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI; import java.security.Key; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java index ef41cf4e..f9549505 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java @@ -1,5 +1,7 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + import java.util.List; import java.util.stream.Collectors; @@ -23,11 +25,11 @@ public GenerateCountFromIds(FhirWebserviceClientProvider clientProvider, TaskHel protected void doExecute(DelegateExecution execution) throws Exception { FeasibilityQueryResults results = (FeasibilityQueryResults) execution - .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); List<FeasibilityQueryResult> filteredResults = count(results.getResults()); - execution.setVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(filteredResults))); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java index 82fec146..c93ebc8f 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java @@ -1,8 +1,8 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERIES; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; import java.util.HashMap; import java.util.Map; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index 2cba4e96..68997ea1 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -2,9 +2,9 @@ import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import java.security.NoSuchAlgorithmException; import java.util.List; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java index d4f3962f..6e55b8ea 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java @@ -1,10 +1,10 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; import java.util.List; import java.util.stream.Collectors; @@ -33,8 +33,8 @@ protected void doExecute(DelegateExecution execution) throws Exception { Task task = getCurrentTaskFromExecutionVariables(); - List<Target> targets = getTaskHelper().getInputParameterStringValues(task, CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY) + List<Target> targets = getTaskHelper().getInputParameterStringValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY) .map(correlationKey -> Target.createBiDirectionalTarget("", correlationKey)) .collect(Collectors.toList()); @@ -50,8 +50,8 @@ protected void doExecute(DelegateExecution execution) throws Exception private boolean getNeedsRecordLinkageCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( + return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( () -> new IllegalArgumentException( "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() + "', this error should " + "have been caught by resource validation")); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java index 322a8f9e..27a61553 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java @@ -1,11 +1,11 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE; import java.util.ArrayList; import java.util.List; @@ -71,8 +71,8 @@ private List<FeasibilityQueryResult> getResults(Task task, boolean needsRecordLi if (needsRecordLinkage) { - return taskHelper.getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT_REFERENCE, EXTENSION_HIGHMED_GROUP_ID) + return taskHelper.getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE, EXTENSION_HIGHMED_GROUP_ID) .map(input -> { String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); String resultSetUrl = ((Reference) input.getValue()).getReference(); @@ -83,8 +83,8 @@ private List<FeasibilityQueryResult> getResults(Task task, boolean needsRecordLi } else { - return taskHelper.getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_FEASIBILITY, - CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT, EXTENSION_HIGHMED_GROUP_ID).map(input -> { + return taskHelper.getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT, EXTENSION_HIGHMED_GROUP_ID).map(input -> { String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); int cohortSize = ((UnsignedIntType) input.getValue()).getValue(); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilitySerializerConfig.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilitySerializerConfig.java index 5104ae34..064fb440 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilitySerializerConfig.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilitySerializerConfig.java @@ -1,6 +1,5 @@ package org.highmed.dsf.bpe.spring.config; -import org.highmed.dsf.bpe.variable.BloomFilterConfigSerializer; import org.highmed.dsf.bpe.variables.FeasibilityQueryResultSerializer; import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsSerializer; import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResultSerializer; @@ -40,10 +39,4 @@ public FinalFeasibilityQueryResultsSerializer finalFeasibilityQueryResultsSerial { return new FinalFeasibilityQueryResultsSerializer(objectMapper); } - - @Bean - public BloomFilterConfigSerializer bloomFilterConfigSerializer() - { - return new BloomFilterConfigSerializer(objectMapper); - } } diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn index 753a9f97..18ccd7a4 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn +++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yff9tp" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> - <bpmn:process id="computeFeasibility" isExecutable="true" camunda:versionTag="0.4.0"> + <bpmn:process id="computeFeasibility" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:subProcess id="SubProcess_1gopxt4"> <bpmn:incoming>SequenceFlow_1lfe4wr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0xxpamp</bpmn:outgoing> @@ -47,7 +47,7 @@ <camunda:inputOutput> <camunda:inputParameter name="processDefinitionKey">requestFeasibility</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-feasibility</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.0</camunda:inputParameter> + <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="messageName">resultMultiMedicFeasibilityMessage</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> @@ -99,7 +99,7 @@ <camunda:inputOutput> <camunda:inputParameter name="processDefinitionKey">requestFeasibility</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-feasibility</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.0</camunda:inputParameter> + <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="messageName">errorMultiMedicFeasibilityMessage</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn index bbb01ebe..28ecd7dc 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn +++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> - <bpmn:process id="executeFeasibility" isExecutable="true" camunda:versionTag="0.4.0"> + <bpmn:process id="executeFeasibility" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResults"> <bpmn:incoming>SequenceFlow_0q803rh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> @@ -25,7 +25,7 @@ <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="messageName">resultSingleMedicFeasibilityMessage</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.0</camunda:inputParameter> + <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="processDefinitionKey">computeFeasibility</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility</camunda:inputParameter> </camunda:inputOutput> diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn index 884b99ca..120b1ce3 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn +++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0inb4ax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> - <bpmn:process id="requestFeasibility" isExecutable="true" camunda:versionTag="0.4.0"> + <bpmn:process id="requestFeasibility" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:startEvent id="StartEvent" name="start"> <bpmn:outgoing>SequenceFlow_11k77gx</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_10c2suu" messageRef="Message_1pq9qxp" /> @@ -13,7 +13,7 @@ <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="processDefinitionKey">executeFeasibility</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.0</camunda:inputParameter> + <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="messageName">executeFeasibilityMessage</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-feasibility</camunda:inputParameter> </camunda:inputOutput> @@ -34,7 +34,7 @@ <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="processDefinitionKey">computeFeasibility</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.0</camunda:inputParameter> + <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="messageName">computeFeasibilityMessage</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-compute-feasibility</camunda:inputParameter> </camunda:inputOutput> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/CodeSystem/highmed-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/CodeSystem/highmed-feasibility.xml deleted file mode 100644 index dc13d98e..00000000 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/CodeSystem/highmed-feasibility.xml +++ /dev/null @@ -1,68 +0,0 @@ -<CodeSystem xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> - <code value="REMOTE"/> - </tag> - </meta> - <url value="http://highmed.org/fhir/CodeSystem/feasibility"/> - <!-- version managed by bpe --> - <version value="${version}" /> - <name value="HiGHmed_Feasibility"/> - <title value="HiGHmed Feasibility"/> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false"/> - <date value="2021-01-26"/> - <publisher value="HiGHmed"/> - <description value="CodeSystem with standard values for feasibility processes"/> - <caseSensitive value="true"/> - <hierarchyMeaning value="grouped-by"/> - <versionNeeded value="false"/> - <content value="complete"/> - <concept> - <code value="research-study-reference"/> - <display value="Research Study Reference"/> - <definition value="HiGHmed Research Study Reference to define what data is requested from which MeDICs and for what purpose"/> - </concept> - <concept> - <code value="needs-record-linkage"/> - <display value="Needs Record Linkage"/> - <definition value="Boolean indicating if a data analysis needs record linkage"/> - </concept> - <concept> - <code value="needs-consent-check"/> - <display value="Needs Consent Check"/> - <definition value="Boolean indicating if a data analysis needs consent check"/> - </concept> - <concept> - <code value="bloom-filter-configuration"/> - <display value="Bloom Filter Cconfiguration"/> - <definition value="Base64 binary encoded bloom filter configuration"/> - </concept> - <concept> - <code value="medic-correlation-key"/> - <display value="MeDIC Correlation Key"/> - <definition value="MeDIC Correlation Key transfered to TTP for correlating incoming medic results"/> - </concept> - <concept> - <code value="single-medic-result"/> - <display value="Single MeDIC Result"/> - <definition value="Result of a single feasibility query execution"/> - </concept> - <concept> - <code value="single-medic-result-reference"/> - <display value="Single MeDIC Result Reference"/> - <definition value="Reference to an openEHR ResultSet as a result of a single feasibility query execution"/> - </concept> - <concept> - <code value="participating-medics"/> - <display value="Participating MeDICs"/> - <definition value="Count of all MeDICs who participated in a feasibility query"/> - </concept> - <concept> - <code value="multi-medic-result"/> - <display value="Multi MeDIC Result"/> - <definition value="Aggregated result of all single medic results"/> - </concept> -</CodeSystem> \ No newline at end of file diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-compute-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-compute-feasibility.xml index 748ad5d0..21044cf2 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-compute-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-compute-feasibility.xml @@ -74,7 +74,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:medic-correlation-key.type.coding"> @@ -85,7 +85,7 @@ <element id="Task.input:medic-correlation-key.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:medic-correlation-key.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -114,7 +114,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:needs-record-linkage.type.coding"> @@ -125,7 +125,7 @@ <element id="Task.input:needs-record-linkage.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:needs-record-linkage.type.coding.code"> <path value="Task.input.type.coding.code" /> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility.xml index 613de1d9..c60d73ea 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility.xml @@ -75,7 +75,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:research-study.type.coding"> @@ -86,7 +86,7 @@ <element id="Task.input:research-study.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:research-study.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -116,7 +116,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:needs-record-linkage.type.coding"> @@ -127,7 +127,7 @@ <element id="Task.input:needs-record-linkage.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:needs-record-linkage.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -156,7 +156,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:needs-consent-check.type.coding"> @@ -167,7 +167,7 @@ <element id="Task.input:needs-consent-check.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:needs-consent-check.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -196,7 +196,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:bloom-filter-configuration.type.coding"> @@ -207,7 +207,7 @@ <element id="Task.input:bloom-filter-configuration.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:bloom-filter-configuration.type.coding.code"> <path value="Task.input.type.coding.code" /> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml index 26ee63ab..d8835fd3 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml @@ -93,7 +93,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:participating-medics.type.coding"> @@ -104,7 +104,7 @@ <element id="Task.input:participating-medics.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:participating-medics.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -151,7 +151,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:multi-medic-result.type.coding"> @@ -162,7 +162,7 @@ <element id="Task.input:multi-medic-result.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:multi-medic-result.type.coding.code"> <path value="Task.input.type.coding.code" /> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml index 40c7c523..4eb3106e 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml @@ -75,7 +75,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:research-study-reference.type.coding"> @@ -86,7 +86,7 @@ <element id="Task.input:research-study-reference.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:research-study-reference.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -124,7 +124,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:needs-record-linkage.type.coding"> @@ -135,7 +135,7 @@ <element id="Task.input:needs-record-linkage.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:needs-record-linkage.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -164,7 +164,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:needs-consent-check.type.coding"> @@ -175,7 +175,7 @@ <element id="Task.input:needs-consent-check.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:needs-consent-check.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -218,7 +218,7 @@ <valueString value="TaskOutputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.output:participating-medics.type.coding"> @@ -229,7 +229,7 @@ <element id="Task.output:participating-medics.type.coding.system"> <path value="Task.output.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.output:participating-medics.type.coding.code"> <path value="Task.output.type.coding.code" /> @@ -272,7 +272,7 @@ <valueString value="TaskOutputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.output:multi-medic-result.type.coding"> @@ -283,7 +283,7 @@ <element id="Task.output:multi-medic-result.type.coding.system"> <path value="Task.output.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.output:multi-medic-result.type.coding.code"> <path value="Task.output.type.coding.code" /> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml index e93132dc..e0b65ae4 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml @@ -93,7 +93,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:single-medic-result.type.coding"> @@ -104,7 +104,7 @@ <element id="Task.input:single-medic-result.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:single-medic-result.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -152,7 +152,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:single-medic-result-reference.type.coding"> @@ -163,7 +163,7 @@ <element id="Task.input:single-medic-result-reference.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:single-medic-result-reference.type.coding.code"> <path value="Task.input.type.coding.code" /> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/ValueSet/highmed-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/ValueSet/highmed-feasibility.xml deleted file mode 100644 index 1595f413..00000000 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/ValueSet/highmed-feasibility.xml +++ /dev/null @@ -1,25 +0,0 @@ -<ValueSet xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> - <code value="REMOTE"/> - </tag> - </meta> - <url value="http://highmed.org/fhir/ValueSet/feasibility"/> - <!-- version managed by bpe --> - <version value="${version}" /> - <name value="HiGHmed_Feasibility"/> - <title value="HiGHmed Feasibility"/> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false"/> - <date value="2021-01-26"/> - <publisher value="HiGHmed"/> - <description value="ValueSet with standard values for feasibility processes"/> - <immutable value="true"/> - <compose> - <include> - <system value="http://highmed.org/fhir/CodeSystem/feasibility"/> - </include> - </compose> -</ValueSet> \ No newline at end of file diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java index f400ae3e..adc513f0 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java @@ -5,10 +5,10 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODE_TYPE_AQL_QUERY; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_QUERY; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; @@ -149,12 +149,12 @@ private static Task createTask(ResearchStudy researchStudy) .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); task.addInput().setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart()) .setType(ResourceType.ResearchStudy.name())).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE); - task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE); - task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); + task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); + task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); return task; } diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index 67935edc..192fd55a 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -7,16 +7,16 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_MULTI_MEDIC_RESULT; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION; @@ -74,9 +74,9 @@ public class TaskProfileTest "highmed-task-single-medic-result-feasibility.xml", "highmed-task-compute-feasibility.xml", "highmed-task-multi-medic-result-feasibility.xml", "highmed-task-error-feasibility.xml"), Arrays.asList("highmed-authorization-role-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", - "highmed-feasibility.xml"), + "highmed-data-sharing.xml"), Arrays.asList("highmed-authorization-role-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", - "highmed-feasibility.xml")); + "highmed-data-sharing.xml")); private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), validationRule.getValidationSupport()); @@ -103,24 +103,24 @@ public void testTaskRequestFeasibilityValidWithOutput() throws Exception TaskOutputComponent outParticipatingMedics1 = task.addOutput(); outParticipatingMedics1.setValue(new UnsignedIntType(5)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS); outParticipatingMedics1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); TaskOutputComponent outMultiMedicResult1 = task.addOutput(); outMultiMedicResult1.setValue(new UnsignedIntType(25)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY).setCode("multi-medic-result"); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING).setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT); outMultiMedicResult1.addExtension("http://highmed.org/fhir/StructureDefinition/extension-group-id", new Reference(groupId1)); TaskOutputComponent outParticipatingMedics2 = task.addOutput(); outParticipatingMedics2.setValue(new UnsignedIntType(5)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS); outParticipatingMedics2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); TaskOutputComponent outMultiMedicResult2 = task.addOutput(); outMultiMedicResult2.setValue(new UnsignedIntType(25)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_MULTI_MEDIC_RESULT); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT); outMultiMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); ValidationResult result = resourceValidator.validate(task); @@ -146,12 +146,12 @@ private Task createValidTaskRequestFeasibility() task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MESSAGE_NAME)).getType() .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); task.addInput().setValue(new Reference("ResearchStudy/" + UUID.randomUUID().toString())).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE); - task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE); - task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); + task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); + task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); return task; } @@ -173,8 +173,8 @@ public void testTaskExecuteFeasibilityValidWithBloomFilterConfig() throws Except { Task task = createValidTaskExecuteFeasibility(); task.addInput().setValue(new Base64BinaryType("TEST".getBytes(StandardCharsets.UTF_8))).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -204,12 +204,12 @@ private Task createValidTaskExecuteFeasibility() .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY); task.addInput().setValue(new Reference("ResearchStudy/" + UUID.randomUUID().toString())).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE); - task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE); - task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); + task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); + task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); return task; } @@ -271,13 +271,13 @@ private Task createValidTaskSingleMedicResultFeasibilityUnsignedIntResult() ParameterComponent inSingleMedicResult1 = task.addInput(); inSingleMedicResult1.setValue(new UnsignedIntType(5)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT); inSingleMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); ParameterComponent inSingleMedicResult2 = task.addInput(); inSingleMedicResult2.setValue(new UnsignedIntType(10)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT); inSingleMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); return task; @@ -292,13 +292,13 @@ private Task createValidTaskSingleMedicResultFeasibilityReferenceResult() ParameterComponent inSingleMedicResult1 = task.addInput(); inSingleMedicResult1.setValue(new Reference("Binary/" + UUID.randomUUID().toString())).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT_REFERENCE); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE); inSingleMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); ParameterComponent inSingleMedicResult2 = task.addInput(); inSingleMedicResult2.setValue(new Reference("Binary/" + UUID.randomUUID().toString())).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT_REFERENCE); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE); inSingleMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); return task; @@ -335,14 +335,14 @@ private Task createValidTaskComputeFeasibility() .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY); task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY); - task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE); + task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); return task; } @@ -383,24 +383,24 @@ private Task createValidTaskMultiMedicResultFeasibility() ParameterComponent inParticipatingMedics1 = task.addInput(); inParticipatingMedics1.setValue(new UnsignedIntType(5)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS); inParticipatingMedics1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); ParameterComponent inMultiMedicResult1 = task.addInput(); inMultiMedicResult1.setValue(new UnsignedIntType(25)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_MULTI_MEDIC_RESULT); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT); inMultiMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); ParameterComponent inParticipatingMedics2 = task.addInput(); inParticipatingMedics2.setValue(new UnsignedIntType(5)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_PARTICIPATING_MEDICS_COUNT); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS); inParticipatingMedics2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); ParameterComponent inMultiMedicResult2 = task.addInput(); inMultiMedicResult2.setValue(new UnsignedIntType(25)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_MULTI_MEDIC_RESULT); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT); inMultiMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); return task; diff --git a/dsf-bpe-process-highmed-base/pom.xml b/dsf-bpe-process-highmed-base/pom.xml deleted file mode 100644 index 8ea538c9..00000000 --- a/dsf-bpe-process-highmed-base/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> - - <artifactId>dsf-bpe-process-highmed-base</artifactId> - - <parent> - <artifactId>dsf-bpe-highmed-processes-pom</artifactId> - <groupId>org.highmed.dsf</groupId> - <version>0.5.0-SNAPSHOT</version> - </parent> - - <dependencies> - <dependency> - <groupId>org.highmed.dsf</groupId> - <artifactId>dsf-bpe-process-base</artifactId> - <scope>provided</scope> - </dependency> - - <dependency> - <groupId>de.hs-heilbronn.mi</groupId> - <artifactId>log4j2-utils</artifactId> - <scope>test</scope> - </dependency> - </dependencies> -</project> \ No newline at end of file diff --git a/dsf-bpe-process-local-services/pom.xml b/dsf-bpe-process-local-services/pom.xml index 7f0053f6..2bd2fe72 100644 --- a/dsf-bpe-process-local-services/pom.xml +++ b/dsf-bpe-process-local-services/pom.xml @@ -23,6 +23,11 @@ <artifactId>dsf-bpe-process-feasibility</artifactId> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-data-sharing</artifactId> + <scope>provided</scope> + </dependency> <dependency> <groupId>de.hs-heilbronn.mi</groupId> diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java index 206962b5..043770c5 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java @@ -5,6 +5,7 @@ import java.util.Map; import java.util.stream.Stream; +import org.highmed.dsf.bpe.spring.config.DataSharingSerializerConfig; import org.highmed.dsf.bpe.spring.config.FeasibilitySerializerConfig; import org.highmed.dsf.bpe.spring.config.LocalServicesConfig; import org.highmed.dsf.fhir.resources.AbstractResource; @@ -20,7 +21,8 @@ public class LocalServicesProcessPluginDefinition implements ProcessPluginDefini { public static final String VERSION = "0.5.0"; - private static final String DEPENDENCY_FEASIBILITY_VERSION = "0.5.0"; + private static final String DEPENDENCY_DATA_SHARING_VERSION = "0.5.0"; + private static final String DEPENDENCY_DATA_SHARING_NAME_AND_VERSION = "dsf-bpe-process-data-sharing-0.5.0"; private static final String DEPENDENCY_FEASIBILITY_NAME_AND_VERSION = "dsf-bpe-process-feasibility-0.5.0"; @Override @@ -44,13 +46,13 @@ public Stream<String> getBpmnFiles() @Override public Stream<Class<?>> getSpringConfigClasses() { - return Stream.of(LocalServicesConfig.class, FeasibilitySerializerConfig.class); + return Stream.of(LocalServicesConfig.class, FeasibilitySerializerConfig.class, DataSharingSerializerConfig.class); } @Override public List<String> getDependencyNamesAndVersions() { - return Arrays.asList(DEPENDENCY_FEASIBILITY_NAME_AND_VERSION); + return Arrays.asList(DEPENDENCY_FEASIBILITY_NAME_AND_VERSION, DEPENDENCY_DATA_SHARING_NAME_AND_VERSION); } @Override @@ -61,11 +63,11 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader .file("fhir/StructureDefinition/highmed-task-local-services-integration.xml"); var vF = ValueSetResource - .dependency(DEPENDENCY_FEASIBILITY_NAME_AND_VERSION, "http://highmed.org/fhir/ValueSet/feasibility", - DEPENDENCY_FEASIBILITY_VERSION); + .dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/ValueSet/data-sharing", + DEPENDENCY_DATA_SHARING_VERSION); var cF = CodeSystemResource - .dependency(DEPENDENCY_FEASIBILITY_NAME_AND_VERSION, "http://highmed.org/fhir/CodeSystem/feasibility", - DEPENDENCY_FEASIBILITY_VERSION); + .dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/CodeSystem/data-sharing", + DEPENDENCY_DATA_SHARING_VERSION); Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map .of("localServicesIntegration/" + VERSION, Arrays.asList(aL, sTL, vF, cF)); diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java index bddac760..08f27028 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java @@ -4,8 +4,14 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGMED_QUERY_TYPE_VALUE_AQL; import static org.highmed.dsf.bpe.ConstantsBase.CODE_TYPE_AQL_QUERY; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_QUERY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_COHORTS; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import java.util.List; import java.util.UUID; @@ -13,7 +19,6 @@ import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.ConstantsFeasibility; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.highmed.dsf.bpe.variable.BloomFilterConfigValues; @@ -46,12 +51,12 @@ protected void doExecute(DelegateExecution execution) throws Exception execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK, needsConsentCheck); boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); - execution.setVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); if (needsRecordLinkage) { BloomFilterConfig bloomFilterConfig = getBloomFilterConfig(task); - execution.setVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG, + execution.setVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG, BloomFilterConfigValues.create(bloomFilterConfig)); } } @@ -75,29 +80,27 @@ private List<Group> getCohortDefinitions(Stream<String> queries) private boolean getNeedsConsentCheck(Task task) { - return getTaskHelper() - .getFirstInputParameterBooleanValue(task, ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY, - ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK).orElseThrow( - () -> new IllegalArgumentException( - "NeedsConsentCheck boolean is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK).orElseThrow( + () -> new IllegalArgumentException( + "NeedsConsentCheck boolean is not set in task with id='" + task.getId() + + "', this error should " + "have been caught by resource validation")); } private boolean getNeedsRecordLinkageCheck(Task task) { - return getTaskHelper() - .getFirstInputParameterBooleanValue(task, ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY, - ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( - () -> new IllegalArgumentException( - "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( + () -> new IllegalArgumentException( + "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() + + "', this error should " + "have been caught by resource validation")); } private BloomFilterConfig getBloomFilterConfig(Task task) { return BloomFilterConfig.fromBytes(getTaskHelper() - .getFirstInputParameterByteValue(task, ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY, - ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG).orElseThrow( + .getFirstInputParameterByteValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG).orElseThrow( () -> new IllegalArgumentException( "BloomFilterConfig byte[] is not set in task with id='" + task.getId() + "', this error should " + "have been caught by resource validation"))); diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java index da4623b0..3def9cff 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java @@ -1,6 +1,10 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.ConstantsFeasibility; @@ -30,7 +34,7 @@ protected void doExecute(DelegateExecution execution) throws Exception { Task task = getCurrentTaskFromExecutionVariables(); FeasibilityQueryResults results = (FeasibilityQueryResults) execution - .getVariable(ConstantsFeasibility.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); addOutputs(task, results); } @@ -45,8 +49,8 @@ private void addOutput(Task task, FeasibilityQueryResult result) if (result.isCohortSizeResult()) { Task.TaskOutputComponent output = getTaskHelper() - .createOutputUnsignedInt(ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY, - ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT, + .createOutputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT, result.getCohortSize()); output.addExtension(createCohortIdExtension(result.getCohortId())); task.addOutput(output); @@ -54,8 +58,8 @@ private void addOutput(Task task, FeasibilityQueryResult result) else if (result.isIdResultSetUrlResult()) { Task.TaskOutputComponent output = getTaskHelper() - .createOutput(ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY, - ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_SINGLE_MEDIC_RESULT_REFERENCE, + .createOutput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE, new Reference(result.getResultSetUrl())); output.addExtension(createCohortIdExtension(result.getCohortId())); task.addOutput(output); diff --git a/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn b/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn index 6228d6d8..64d97c45 100644 --- a/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn +++ b/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> - <bpmn:process id="localServicesIntegration" isExecutable="true" camunda:versionTag="0.4.0"> + <bpmn:process id="localServicesIntegration" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResults"> <bpmn:incoming>SequenceFlow_0q803rh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> @@ -95,7 +95,7 @@ <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="messageName">resultSingleMedicFeasibilityMessage</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.0</camunda:inputParameter> + <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="processDefinitionKey">computeFeasibility</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility</camunda:inputParameter> </camunda:inputOutput> diff --git a/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml b/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml index 809557d6..cbc20e33 100644 --- a/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml +++ b/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml @@ -75,7 +75,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:needs-record-linkage.type.coding"> @@ -86,7 +86,7 @@ <element id="Task.input:needs-record-linkage.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:needs-record-linkage.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -115,7 +115,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:needs-consent-check.type.coding"> @@ -126,7 +126,7 @@ <element id="Task.input:needs-consent-check.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:needs-consent-check.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -155,7 +155,7 @@ <valueString value="TaskInputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.input:bloom-filter-configuration.type.coding"> @@ -166,7 +166,7 @@ <element id="Task.input:bloom-filter-configuration.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.input:bloom-filter-configuration.type.coding.code"> <path value="Task.input.type.coding.code" /> @@ -245,7 +245,7 @@ <valueString value="TaskOutputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.output:single-medic-result.type.coding"> @@ -256,7 +256,7 @@ <element id="Task.output:single-medic-result.type.coding.system"> <path value="Task.output.type.coding.system" /> <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.output:single-medic-result.type.coding.code"> <path value="Task.output.type.coding.code" /> @@ -302,7 +302,7 @@ <valueString value="TaskOutputParameterType" /> </extension> <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/feasibility" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> <element id="Task.output:single-medic-result-reference.type.coding"> @@ -313,7 +313,7 @@ <element id="Task.output:single-medic-result-reference.type.coding.system"> <path value="Task.output.type.coding.system" /> <min value="0" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/feasibility" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> <element id="Task.output:single-medic-result-reference.type.coding.code"> <path value="Task.output.type.coding.code" /> diff --git a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java index 483d8d6e..5972351d 100644 --- a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java +++ b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java @@ -5,10 +5,10 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_QUERY_TYPE; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGMED_QUERY_TYPE_VALUE_AQL; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES; import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION; @@ -21,6 +21,7 @@ import javax.crypto.KeyGenerator; import org.bouncycastle.jce.provider.BouncyCastleProvider; + import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.hl7.fhir.r4.model.Base64BinaryType; import org.hl7.fhir.r4.model.BooleanType; @@ -66,11 +67,11 @@ private static Task createStartResource() task.addInput().setValue(new StringType("SELECT COUNT(e) FROM EHR e;")).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_QUERY_TYPE).setCode(CODESYSTEM_HIGMED_QUERY_TYPE_VALUE_AQL); task.addInput().setValue(new BooleanType(NEEDS_CONSENT_CHECK)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); task.addInput().setValue(new BooleanType(NEEDS_RECORD_LINKAGE)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); if (NEEDS_RECORD_LINKAGE) { @@ -82,8 +83,8 @@ private static Task createStartResource() KeyGenerator.getInstance("HmacSHA3-256", bouncyCastleProvider).generateKey()); task.addInput().setValue(new Base64BinaryType(bloomFilterConfig.toBytes())).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG); } catch (Exception exception) { diff --git a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index 6be24426..d3aaa16f 100644 --- a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -5,10 +5,10 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_QUERY_TYPE; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGMED_QUERY_TYPE_VALUE_AQL; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES; import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION; @@ -45,9 +45,9 @@ public class TaskProfileTest "highmed-extension-group-id-0.5.0.xml", "highmed-extension-query-0.5.0.xml", "highmed-task-local-services-integration.xml"), Arrays.asList("highmed-authorization-role-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", - "highmed-feasibility.xml", "highmed-query-type-0.5.0.xml"), + "highmed-data-sharing.xml", "highmed-query-type-0.5.0.xml"), Arrays.asList("highmed-authorization-role-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", - "highmed-feasibility.xml", "highmed-query-type-0.5.0.xml")); + "highmed-data-sharing.xml", "highmed-query-type-0.5.0.xml")); private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), validationRule.getValidationSupport()); @@ -84,17 +84,17 @@ private Task createValidTaskLocalServiceIntegration() task.addInput().setValue(new StringType("SELECT COUNT(e) FROM EHR e;")).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_QUERY_TYPE).setCode(CODESYSTEM_HIGMED_QUERY_TYPE_VALUE_AQL); - task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK); - task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE); + task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); + task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); byte[] bloomFilterConfig = Base64.getDecoder().decode( "CIw/x19d3Oj+GLOKgYAX5KrFAl11q6qMi0qkDiyUOCvMXuF2KffVvSnjUjkTvqh4z8Xs+MuQdK6FqTedM5FY9t4qm+k92A+P"); task.addInput().setValue(new Base64BinaryType(bloomFilterConfig)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_FEASIBILITY) - .setCode(CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG); return task; } diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn index 6bf868a0..2d32fb25 100644 --- a/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn +++ b/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0azvmx1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> - <bpmn:process id="ping" isExecutable="true" camunda:versionTag="0.4.0"> + <bpmn:process id="ping" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:sequenceFlow id="SequenceFlow_0k1j79c" sourceRef="StartEvent_1" targetRef="selectTargets" /> <bpmn:sequenceFlow id="SequenceFlow_05ia6lz" sourceRef="selectTargets" targetRef="sendPing" /> <bpmn:serviceTask id="selectTargets" name="selectTargets" camunda:class="org.highmed.dsf.bpe.service.SelectPingTargets"> @@ -11,7 +11,7 @@ <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="processDefinitionKey">pong</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.0</camunda:inputParameter> + <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="messageName">pingMessage</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-ping</camunda:inputParameter> </camunda:inputOutput> diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn index 4d207a6a..e3af4ee4 100644 --- a/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn +++ b/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_15v05m6" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0"> - <bpmn:process id="pong" isExecutable="true" camunda:versionTag="0.4.0"> + <bpmn:process id="pong" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:startEvent id="StartEvent_1"> <bpmn:outgoing>SequenceFlow_07w11cw</bpmn:outgoing> <bpmn:messageEventDefinition messageRef="Message_0u91abp" /> @@ -10,7 +10,7 @@ <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="messageName">pongMessage</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.0</camunda:inputParameter> + <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="processDefinitionKey">ping</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-pong</camunda:inputParameter> </camunda:inputOutput> diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn index d3b32105..a325e15c 100644 --- a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn +++ b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1yb5vw3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.2.0"> - <bpmn:process id="downloadAllowList" isExecutable="true" camunda:versionTag="0.4.0"> + <bpmn:process id="downloadAllowList" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:sequenceFlow id="SequenceFlow_0bbhq2r" sourceRef="StartEvent_1" targetRef="downloadAllowListTask" /> <bpmn:endEvent id="EndEvent_0xd0x8k"> <bpmn:incoming>SequenceFlow_0oyvmcd</bpmn:incoming> diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn index a4f87744..f3b5263b 100644 --- a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn +++ b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1yb5vw3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0"> - <bpmn:process id="updateAllowList" isExecutable="true" camunda:versionTag="0.4.0"> + <bpmn:process id="updateAllowList" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:sequenceFlow id="SequenceFlow_0bbhq2r" sourceRef="StartEvent_1" targetRef="updateAllowListTask" /> <bpmn:endEvent id="EndEvent_0xd0x8k"> <bpmn:incoming>SequenceFlow_0oyvmcd</bpmn:incoming> diff --git a/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn b/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn index 38905763..163eaf4c 100644 --- a/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn +++ b/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0k0v4i2" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0"> - <bpmn:process id="executeUpdateResources" isExecutable="true" camunda:versionTag="0.4.0"> + <bpmn:process id="executeUpdateResources" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:startEvent id="StartEvent_1"> <bpmn:outgoing>SequenceFlow_0djh0eg</bpmn:outgoing> <bpmn:messageEventDefinition messageRef="Message_1r6vnvn" /> diff --git a/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn b/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn index 13825c35..a8cc6c39 100644 --- a/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn +++ b/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0os0n0z" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> - <bpmn:process id="requestUpdateResources" isExecutable="true" camunda:versionTag="0.4.0"> + <bpmn:process id="requestUpdateResources" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:sequenceFlow id="SequenceFlow_1ryplwc" sourceRef="StartEvent_1" targetRef="selectResourceAndTargets" /> <bpmn:sequenceFlow id="SequenceFlow_1u4zxix" sourceRef="selectResourceAndTargets" targetRef="sendRequest" /> <bpmn:endEvent id="EndEvent_1f9cjs7"> @@ -11,7 +11,7 @@ <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="processDefinitionKey">executeUpdateResources</camunda:inputParameter> - <camunda:inputParameter name="versionTag">0.4.0</camunda:inputParameter> + <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="messageName">executeUpdateResourcesMessage</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-update-resources</camunda:inputParameter> </camunda:inputOutput> diff --git a/pom.xml b/pom.xml index 1dfa98bd..7b3941bf 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,6 @@ <packaging>pom</packaging> <modules> - <module>dsf-bpe-process-highmed-base</module> <module>dsf-bpe-process-data-sharing</module> <module>dsf-bpe-process-feasibility</module> <module>dsf-bpe-process-local-services</module> @@ -68,20 +67,15 @@ </dependency> <dependency> <groupId>org.highmed.dsf</groupId> - <artifactId>dsf-bpe-process-highmed-base</artifactId> - <version>0.5.0-SNAPSHOT</version> - </dependency> - <dependency> - <groupId>org.highmed.dsf.processes</groupId> - <artifactId>dsf-bpe-process-data-sharing</artifactId> + <artifactId>dsf-fhir-validation</artifactId> <version>0.5.0-SNAPSHOT</version> </dependency> + <dependency> <groupId>org.highmed.dsf</groupId> - <artifactId>dsf-fhir-validation</artifactId> - <version>0.5.0-SNAPSHOT</version> + <artifactId>dsf-bpe-process-data-sharing</artifactId> + <version>${project.version}</version> </dependency> - <dependency> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-process-feasibility</artifactId> From ea412c0458eb36076594cfbea7c06b4e1b471458 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 8 Feb 2021 14:21:38 +0100 Subject: [PATCH 008/125] data sharing process until query exection --- .../service/CheckDataSharingResources.java | 21 +++ .../dsf/bpe/service/ExecuteQueries.java | 47 +++++- .../dsf/bpe/service/ExtractQueries.java | 55 ++++++ .../dsf/bpe/service/ModifyQueries.java | 48 +++++- .../service/SelectResponseTargetMedic.java | 1 - .../bpe/spring/config/DataSharingConfig.java | 30 +++- .../resources/bpe/executeDataSharing.bpmn | 156 ++++++++++-------- ...ringFromMedicsViaMedic1ExampleStarter.java | 18 +- .../highmed/dsf/bpe/ConstantsFeasibility.java | 4 +- .../service/CheckFeasibilityResources.java | 12 +- .../highmed/dsf/bpe/service/CheckQueries.java | 24 +-- .../CheckTtpComputedMultiMedicResults.java | 4 +- .../service/DownloadFeasibilityResources.java | 4 +- .../service/SelectResponseTargetMedic.java | 5 +- .../bpe/service/SelectResponseTargetTtp.java | 7 +- .../highmed/dsf/bpe/service/StoreResult.java | 1 - 16 files changed, 319 insertions(+), 118 deletions(-) create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExtractQueries.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java index 21a38e5c..5c1cb5ae 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java @@ -1,9 +1,15 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; + +import java.util.List; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.FhirResourcesList; +import org.hl7.fhir.r4.model.Group; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,5 +27,20 @@ public CheckDataSharingResources(FhirWebserviceClientProvider clientProvider, Ta protected void doExecute(DelegateExecution execution) { logger.info(this.getClass().getName() + " doExecute called"); + + List<Group> cohorts = ((FhirResourcesList) execution.getVariable(BPMN_EXECUTION_VARIABLE_COHORTS)) + .getResourcesAndCast(); + + checkFullyQualifiedCohortIds(cohorts); + + // TODO: Define further checks + } + + private void checkFullyQualifiedCohortIds(List<Group> cohorts) + { + if (cohorts.stream().anyMatch(g -> !g.getIdElement().hasBaseUrl())) + { + throw new RuntimeException("Not all cohorts have fully qualified ids (containing server base url)"); + } } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java index 28896922..949b76d1 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -1,25 +1,56 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; + +import java.util.Map; +import java.util.Objects; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.highmed.openehr.client.OpenEhrClient; +import org.highmed.openehr.model.structure.ResultSet; public class ExecuteQueries extends AbstractServiceDelegate { + private final OpenEhrClient openehrClient; + private final OrganizationProvider organizationProvider; - private static final Logger logger = LoggerFactory.getLogger(ExecuteQueries.class); - - public ExecuteQueries(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + public ExecuteQueries(FhirWebserviceClientProvider clientProvider, OpenEhrClient openehrClient, + TaskHelper taskHelper, OrganizationProvider organizationProvider) { super(clientProvider, taskHelper); + + this.openehrClient = openehrClient; + this.organizationProvider = organizationProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(openehrClient, "openehrClient"); + Objects.requireNonNull(organizationProvider, "organizationProvider"); } @Override - protected void doExecute(DelegateExecution execution) + protected void doExecute(DelegateExecution execution) throws Exception { - logger.info(this.getClass().getName() + " doExecute called"); + // <groupId, query> + @SuppressWarnings("unchecked") + Map<String, String> queries = (Map<String, String>) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERIES); + + queries.forEach(this::executeQuery); + } + + private void executeQuery(String cohortId, String cohortQuery) + { + // TODO We might want to introduce a more complex result type to represent a count, + // errors and possible meta-data. + + ResultSet resultSet = openehrClient.query(cohortQuery, null); } -} +} \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExtractQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExtractQueries.java new file mode 100644 index 00000000..cf77f92a --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExtractQueries.java @@ -0,0 +1,55 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.group.GroupHelper; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.FhirResourcesList; +import org.hl7.fhir.r4.model.Group; +import org.springframework.beans.factory.InitializingBean; + +public class ExtractQueries extends AbstractServiceDelegate implements InitializingBean +{ + private final GroupHelper groupHelper; + + public ExtractQueries(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, GroupHelper groupHelper) + { + super(clientProvider, taskHelper); + this.groupHelper = groupHelper; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + Objects.requireNonNull(groupHelper, "groupHelper"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + List<Group> cohorts = ((FhirResourcesList) execution.getVariable(BPMN_EXECUTION_VARIABLE_COHORTS)) + .getResourcesAndCast(); + + // <groupId, query> + Map<String, String> queries = new HashMap<>(); + + cohorts.forEach(group -> { + String aqlQuery = groupHelper.extractAqlQuery(group); + String groupId = group.getId(); + + queries.put(groupId, aqlQuery); + }); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERIES, queries); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java index d736b6c9..3ceccd18 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java @@ -1,25 +1,67 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; -public class ModifyQueries extends AbstractServiceDelegate +public class ModifyQueries extends AbstractServiceDelegate implements InitializingBean { private static final Logger logger = LoggerFactory.getLogger(ModifyQueries.class); - public ModifyQueries(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + private final String ehrIdColumnPath; + + public ModifyQueries(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, String ehrIdColumnPath) { super(clientProvider, taskHelper); + this.ehrIdColumnPath = ehrIdColumnPath; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath"); } @Override protected void doExecute(DelegateExecution execution) { - logger.info(this.getClass().getName() + " doExecute called"); + // <groupId, query> + @SuppressWarnings("unchecked") + Map<String, String> queries = (Map<String, String>) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERIES); + + Map<String, String> modifiedQueries = checkAndModifyQueries(queries); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERIES, modifiedQueries); + } + + private Map<String, String> checkAndModifyQueries(Map<String, String> queries) + { + Map<String, String> modifiedQueries = new HashMap<>(); + + for (Map.Entry<String, String> entry : queries.entrySet()) { + String query = entry.getValue(); + + // TODO Implement correct check for default id query + if (!query.startsWith("SELECT e" + ehrIdColumnPath + " as EHRID")) { + query = query.replace("SELECT", "SELECT e" + ehrIdColumnPath + " as EHRID,"); + logger.warn("Query does not start with '{}', adapting SELECT statement", "SELECT e" + ehrIdColumnPath + " as EHRID"); + } + + modifiedQueries.put(entry.getKey(), query); + } + + return modifiedQueries; } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java index e9178c75..c5dec8bf 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java @@ -3,7 +3,6 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.ConstantsBase; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index 005242c9..139cc5c9 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -17,6 +17,7 @@ import org.highmed.dsf.bpe.service.EncryptMdat; import org.highmed.dsf.bpe.service.ExecuteQueries; import org.highmed.dsf.bpe.service.ExecuteRecordLink; +import org.highmed.dsf.bpe.service.ExtractQueries; import org.highmed.dsf.bpe.service.FilterQueryResultsByConsent; import org.highmed.dsf.bpe.service.GenerateBloomFilters; import org.highmed.dsf.bpe.service.HandleErrorMultiMedicResults; @@ -28,12 +29,16 @@ import org.highmed.dsf.bpe.service.StoreCorrelationKeys; import org.highmed.dsf.bpe.service.StoreResults; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.group.GroupHelper; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.openehr.client.OpenEhrClient; +import org.highmed.openehr.client.OpenEhrClientFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; import ca.uhn.fhir.context.FhirContext; @@ -44,18 +49,27 @@ public class DataSharingConfig @Autowired private FhirWebserviceClientProvider fhirClientProvider; + @Autowired + private OpenEhrClientFactory openEhrClientFactory; + @Autowired private OrganizationProvider organizationProvider; @Autowired private TaskHelper taskHelper; + @Autowired + private GroupHelper groupHelper; + @Autowired private FhirContext fhirContext; @Value("${org.highmed.dsf.bpe.openehr.subject_external_id.path:/ehr_status/subject/external_ref/id/value}") private String ehrIdColumnPath; + @Autowired + private Environment environment; + @Bean public DownloadResearchStudyResource downloadResearchStudyResourceDS() { @@ -166,16 +180,28 @@ public CheckDataSharingResources checkDataSharingResources() return new CheckDataSharingResources(fhirClientProvider, taskHelper); } + @Bean + public ExtractQueries extractQueries() + { + return new ExtractQueries(fhirClientProvider, taskHelper, groupHelper); + } + @Bean public ModifyQueries modifyQueries() { - return new ModifyQueries(fhirClientProvider, taskHelper); + return new ModifyQueries(fhirClientProvider, taskHelper, ehrIdColumnPath); + } + + @Bean + public OpenEhrClient openEhrClient() + { + return openEhrClientFactory.createClient(environment::getProperty); } @Bean public ExecuteQueries executeQueries() { - return new ExecuteQueries(fhirClientProvider, taskHelper); + return new ExecuteQueries(fhirClientProvider, openEhrClient(), taskHelper, organizationProvider); } @Bean diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index 97abe1a2..a69e293e 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -83,13 +83,13 @@ <bpmn:incoming>Flow_0qsitvp</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1rmqv20</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_1kp6eaq" sourceRef="checkDataSharingRequest" targetRef="addIdSelectionIfMissing" /> + <bpmn:sequenceFlow id="Flow_1kp6eaq" sourceRef="checkDataSharingRequest" targetRef="extractQueries" /> <bpmn:sequenceFlow id="SequenceFlow_17otl7p" name="else" sourceRef="ExclusiveGateway_0sff9xb" targetRef="ExclusiveGateway_002t87f"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_0qsitvp" sourceRef="addIdSelectionIfMissing" targetRef="executeQueries" /> <bpmn:serviceTask id="addIdSelectionIfMissing" name="Add id selection if missing" camunda:class="org.highmed.dsf.bpe.service.ModifyQueries"> - <bpmn:incoming>Flow_1kp6eaq</bpmn:incoming> + <bpmn:incoming>Flow_1ecoehc</bpmn:incoming> <bpmn:outgoing>Flow_0qsitvp</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_0fabwum" sourceRef="EncryptMdat" targetRef="ExclusiveGateway_0bq7zdz" /> @@ -102,6 +102,11 @@ <bpmn:incoming>SequenceFlow_1rmqv20</bpmn:incoming> <bpmn:outgoing>Flow_0bkkg7n</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1ecoehc" sourceRef="extractQueries" targetRef="addIdSelectionIfMissing" /> + <bpmn:serviceTask id="extractQueries" name="extract queries" camunda:class="org.highmed.dsf.bpe.service.ExtractQueries"> + <bpmn:incoming>Flow_1kp6eaq</bpmn:incoming> + <bpmn:outgoing>Flow_1ecoehc</bpmn:outgoing> + </bpmn:serviceTask> <bpmn:textAnnotation id="TextAnnotation_0euut3n"> <bpmn:text>uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc.</bpmn:text> </bpmn:textAnnotation> @@ -111,148 +116,155 @@ <bpmn:message id="Message_1dr71re" name="resultSingleMedicDataSharingMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="executeDataSharing"> + <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> + <dc:Bounds x="330" y="80" width="267" height="56" /> + </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Flow_0bkkg7n_di" bpmnElement="Flow_0bkkg7n"> - <di:waypoint x="1030" y="212" /> - <di:waypoint x="1100" y="212" /> + <di:waypoint x="1150" y="212" /> + <di:waypoint x="1220" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0fabwum_di" bpmnElement="Flow_0fabwum"> - <di:waypoint x="1200" y="212" /> - <di:waypoint x="1265" y="212" /> + <di:waypoint x="1320" y="212" /> + <di:waypoint x="1385" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0qsitvp_di" bpmnElement="Flow_0qsitvp"> - <di:waypoint x="690" y="212" /> - <di:waypoint x="760" y="212" /> + <di:waypoint x="810" y="212" /> + <di:waypoint x="880" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_17otl7p_di" bpmnElement="SequenceFlow_17otl7p"> - <di:waypoint x="1575" y="212" /> - <di:waypoint x="1678" y="212" /> + <di:waypoint x="1695" y="212" /> + <di:waypoint x="1798" y="212" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1577" y="194" width="21" height="14" /> + <dc:Bounds x="1697" y="194" width="21" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1kp6eaq_di" bpmnElement="Flow_1kp6eaq"> - <di:waypoint x="520" y="212" /> - <di:waypoint x="590" y="212" /> + <di:waypoint x="500" y="212" /> + <di:waypoint x="560" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ascyjc_di" bpmnElement="SequenceFlow_0ascyjc"> - <di:waypoint x="2090" y="212" /> - <di:waypoint x="2162" y="212" /> + <di:waypoint x="2210" y="212" /> + <di:waypoint x="2282" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ug2kru_di" bpmnElement="SequenceFlow_1ug2kru"> - <di:waypoint x="1703" y="315" /> - <di:waypoint x="1703" y="237" /> + <di:waypoint x="1823" y="315" /> + <di:waypoint x="1823" y="237" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0q803rh_di" bpmnElement="SequenceFlow_0q803rh"> - <di:waypoint x="1728" y="212" /> - <di:waypoint x="1810" y="212" /> + <di:waypoint x="1848" y="212" /> + <di:waypoint x="1930" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1futlo2_di" bpmnElement="SequenceFlow_1futlo2"> - <di:waypoint x="1550" y="237" /> - <di:waypoint x="1550" y="355" /> - <di:waypoint x="1653" y="355" /> + <di:waypoint x="1670" y="237" /> + <di:waypoint x="1670" y="355" /> + <di:waypoint x="1773" y="355" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1557" y="320" width="65" height="27" /> + <dc:Bounds x="1677" y="320" width="65" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kzp6tl_di" bpmnElement="SequenceFlow_0kzp6tl"> - <di:waypoint x="1450" y="315" /> - <di:waypoint x="1450" y="237" /> + <di:waypoint x="1570" y="315" /> + <di:waypoint x="1570" y="237" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1b4h5qz_di" bpmnElement="SequenceFlow_1b4h5qz"> - <di:waypoint x="1475" y="212" /> - <di:waypoint x="1525" y="212" /> + <di:waypoint x="1595" y="212" /> + <di:waypoint x="1645" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0isxkuy_di" bpmnElement="SequenceFlow_0isxkuy"> - <di:waypoint x="1290" y="237" /> - <di:waypoint x="1290" y="355" /> - <di:waypoint x="1400" y="355" /> + <di:waypoint x="1410" y="237" /> + <di:waypoint x="1410" y="355" /> + <di:waypoint x="1520" y="355" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1297" y="323" width="72" height="27" /> + <dc:Bounds x="1417" y="323" width="72" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_05r9whd_di" bpmnElement="SequenceFlow_05r9whd"> - <di:waypoint x="1315" y="212" /> - <di:waypoint x="1425" y="212" /> + <di:waypoint x="1435" y="212" /> + <di:waypoint x="1545" y="212" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1321" y="195" width="21" height="14" /> + <dc:Bounds x="1441" y="195" width="21" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_04ouilq_di" bpmnElement="SequenceFlow_04ouilq"> - <di:waypoint x="1910" y="212" /> - <di:waypoint x="1990" y="212" /> + <di:waypoint x="2030" y="212" /> + <di:waypoint x="2110" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1etju4m_di" bpmnElement="SequenceFlow_1etju4m"> - <di:waypoint x="350" y="212" /> - <di:waypoint x="420" y="212" /> + <di:waypoint x="340" y="212" /> + <di:waypoint x="400" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_14cn0vs_di" bpmnElement="SequenceFlow_14cn0vs"> - <di:waypoint x="178" y="212" /> - <di:waypoint x="250" y="212" /> + <di:waypoint x="188" y="212" /> + <di:waypoint x="240" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1rmqv20_di" bpmnElement="SequenceFlow_1rmqv20"> - <di:waypoint x="860" y="212" /> - <di:waypoint x="930" y="212" /> + <di:waypoint x="980" y="212" /> + <di:waypoint x="1050" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1ecoehc_di" bpmnElement="Flow_1ecoehc"> + <di:waypoint x="660" y="212" /> + <di:waypoint x="710" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> - <dc:Bounds x="1810" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkDataSharingRequest"> - <dc:Bounds x="420" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="StartEvent_1fzso6r_di" bpmnElement="StartEvent"> - <dc:Bounds x="142" y="194" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="150" y="237" width="22" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0b8j3ka_di" bpmnElement="downloadDataSharingResources"> - <dc:Bounds x="250" y="172" width="100" height="80" /> + <dc:Bounds x="1930" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> - <dc:Bounds x="2162" y="194" width="36" height="36" /> + <dc:Bounds x="2282" y="194" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2136" y="237" width="90" height="14" /> + <dc:Bounds x="2256" y="237" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0bq7zdz_di" bpmnElement="ExclusiveGateway_0bq7zdz" isMarkerVisible="true"> - <dc:Bounds x="1265" y="187" width="50" height="50" /> + <dc:Bounds x="1385" y="187" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0l3b9as_di" bpmnElement="filterByConsent"> - <dc:Bounds x="1400" y="315" width="100" height="80" /> + <dc:Bounds x="1520" y="315" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0lecmy5_di" bpmnElement="ExclusiveGateway_0lecmy5" isMarkerVisible="true"> - <dc:Bounds x="1425" y="187" width="50" height="50" /> + <dc:Bounds x="1545" y="187" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0sff9xb_di" bpmnElement="ExclusiveGateway_0sff9xb" isMarkerVisible="true"> - <dc:Bounds x="1525" y="187" width="50" height="50" /> + <dc:Bounds x="1645" y="187" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="generateBloomFilters"> - <dc:Bounds x="1653" y="315" width="100" height="80" /> + <dc:Bounds x="1773" y="315" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_002t87f_di" bpmnElement="ExclusiveGateway_002t87f" isMarkerVisible="true"> - <dc:Bounds x="1678" y="187" width="50" height="50" /> + <dc:Bounds x="1798" y="187" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> - <dc:Bounds x="1990" y="172" width="100" height="80" /> + <dc:Bounds x="2110" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0u5pb4i_di" bpmnElement="executeQueries"> - <dc:Bounds x="760" y="172" width="100" height="80" /> + <dc:Bounds x="880" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1ok9q8j_di" bpmnElement="addIdSelectionIfMissing"> - <dc:Bounds x="590" y="172" width="100" height="80" /> + <dc:Bounds x="710" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1e2gm4u_di" bpmnElement="EncryptMdat"> - <dc:Bounds x="1100" y="172" width="100" height="80" /> + <dc:Bounds x="1220" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0attf5g_di" bpmnElement="provideLocalPseudonyms"> - <dc:Bounds x="930" y="172" width="100" height="80" /> + <dc:Bounds x="1050" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> - <dc:Bounds x="310" y="80" width="267" height="56" /> + <bpmndi:BPMNShape id="StartEvent_1fzso6r_di" bpmnElement="StartEvent"> + <dc:Bounds x="152" y="194" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="160" y="237" width="22" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0b8j3ka_di" bpmnElement="downloadDataSharingResources"> + <dc:Bounds x="240" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkDataSharingRequest"> + <dc:Bounds x="400" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1vlv5ud_di" bpmnElement="extractQueries"> + <dc:Bounds x="560" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> - <di:waypoint x="460" y="172" /> - <di:waypoint x="451" y="136" /> + <di:waypoint x="455" y="172" /> + <di:waypoint x="460" y="136" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java index 179d56aa..4bafd7db 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -4,8 +4,8 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsBase.CODE_TYPE_AQL_QUERY; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHMED_GROUP; import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHEMD_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHMED_GROUP; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; @@ -43,6 +43,18 @@ public class RequestDataSharingFromMedicsViaMedic1ExampleStarter { + private static final String QUERY = + "SELECT " + + "e/ehr_status/subject/external_ref/id/value as EHRID, " + + "v/items[at0024,'Bezeichnung']/value, " + + "v/items [at0001,'Messwert'], " + + "v/items[at0006,'Dokumentationsdatum Untersuchung']/value " + + "FROM EHR e " + + "CONTAINS COMPOSITION c " + + "CONTAINS CLUSTER v[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1] " + + "WHERE v/items[at0024,'Bezeichnung']/value/value = 'Natrium' " + + "OFFSET 0 LIMIT 15"; + // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate @@ -85,8 +97,8 @@ private static Group createGroup(String name) group.setType(Group.GroupType.PERSON); group.setActual(false); group.setActive(true); - group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY).setValue( - new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression("SELECT COUNT(e) FROM EHR e")); + group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY) + .setValue(new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression(QUERY)); group.setName(name); return group; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java index 3126f99e..369d4919 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java @@ -9,8 +9,8 @@ public interface ConstantsFeasibility // Must be 3 or larger, as otherwise it is possible to draw conclusions about the individual MeDICs // (if I already know the cohort size in my MeDIC) - int MIN_PARTICIPATING_MEDICS = 3; - int MIN_COHORT_DEFINITIONS = 1; + int MIN_PARTICIPATING_MEDICS_FOR_FEASIBILITY = 3; + int MIN_COHORT_DEFINITIONS_FOR_FEASIBILITY = 1; String FEASIBILITY_QUERY_PREFIX = "select count"; String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-request-feasibility"; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java index 347d98cb..ded79d20 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java @@ -4,8 +4,8 @@ import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; -import static org.highmed.dsf.bpe.ConstantsFeasibility.MIN_COHORT_DEFINITIONS; -import static org.highmed.dsf.bpe.ConstantsFeasibility.MIN_PARTICIPATING_MEDICS; +import static org.highmed.dsf.bpe.ConstantsFeasibility.MIN_COHORT_DEFINITIONS_FOR_FEASIBILITY; +import static org.highmed.dsf.bpe.ConstantsFeasibility.MIN_PARTICIPATING_MEDICS_FOR_FEASIBILITY; import java.util.List; @@ -46,10 +46,10 @@ private void checkNumberOfParticipatingMedics(ResearchStudy researchStudy) .filter(i -> NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER.equals(i.getSystem())).map(i -> i.getValue()) .distinct().count(); - if (medics < MIN_PARTICIPATING_MEDICS) + if (medics < MIN_PARTICIPATING_MEDICS_FOR_FEASIBILITY) { throw new RuntimeException( - "Number of distinct participanting MeDICs is < " + MIN_PARTICIPATING_MEDICS + ", got " + medics); + "Number of distinct participanting MeDICs is < " + MIN_PARTICIPATING_MEDICS_FOR_FEASIBILITY + ", got " + medics); } } @@ -64,10 +64,10 @@ private void checkFullyQualifiedCohortIds(List<Group> cohorts) private void checkNumberOfCohortDefinitions(List<Group> cohorts) { int size = cohorts.size(); - if (size < MIN_COHORT_DEFINITIONS) + if (size < MIN_COHORT_DEFINITIONS_FOR_FEASIBILITY) { throw new RuntimeException( - "Number of defined cohorts is < " + MIN_COHORT_DEFINITIONS + ", got " + cohorts.size()); + "Number of defined cohorts is < " + MIN_COHORT_DEFINITIONS_FOR_FEASIBILITY + ", got " + cohorts.size()); } } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java index e0001363..b60fe36a 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java @@ -1,7 +1,10 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; +import static org.highmed.dsf.bpe.ConstantsFeasibility.FEASIBILITY_QUERY_PREFIX; import java.util.HashMap; import java.util.List; @@ -9,9 +12,6 @@ import java.util.Objects; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; -import org.highmed.dsf.bpe.ConstantsBase; -import org.highmed.dsf.bpe.ConstantsFeasibility; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.group.GroupHelper; @@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; -public class CheckQueries extends AbstractServiceDelegate implements InitializingBean, JavaDelegate +public class CheckQueries extends AbstractServiceDelegate implements InitializingBean { private static final Logger logger = LoggerFactory.getLogger(CheckQueries.class); @@ -45,8 +45,8 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - List<Group> cohorts = ((FhirResourcesList) execution - .getVariable(BPMN_EXECUTION_VARIABLE_COHORTS)).getResourcesAndCast(); + List<Group> cohorts = ((FhirResourcesList) execution.getVariable(BPMN_EXECUTION_VARIABLE_COHORTS)) + .getResourcesAndCast(); Map<String, String> queries = new HashMap<>(); @@ -55,16 +55,16 @@ protected void doExecute(DelegateExecution execution) throws Exception String aqlQuery = groupHelper.extractAqlQuery(group).toLowerCase(); String groupId = group.getId(); - if (!aqlQuery.startsWith(ConstantsFeasibility.FEASIBILITY_QUERY_PREFIX)) + if (!aqlQuery.startsWith(FEASIBILITY_QUERY_PREFIX)) { String errorMessage = - "Initial single medic feasibility query check failed, wrong format for query of group with id '" - + groupId + "', expected query to start with '" - + ConstantsFeasibility.FEASIBILITY_QUERY_PREFIX + "' but got '" + aqlQuery + "'"; + "Single medic feasibility query check failed, wrong format for query of group with id '" + + groupId + "', expected query to start with '" + FEASIBILITY_QUERY_PREFIX + + "' but got '" + aqlQuery + "'"; logger.info(errorMessage); - leadingTask.getOutput().add(getTaskHelper().createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN, - ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage)); + leadingTask.getOutput().add(getTaskHelper() + .createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage)); } else { diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java index 3dfeedc9..c5ac4ba9 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java @@ -6,7 +6,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_RESULT; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsFeasibility.MIN_PARTICIPATING_MEDICS; +import static org.highmed.dsf.bpe.ConstantsFeasibility.MIN_PARTICIPATING_MEDICS_FOR_FEASIBILITY; import java.util.List; import java.util.stream.Collectors; @@ -62,7 +62,7 @@ private List<FinalFeasibilityQueryResult> filterResultsByParticipatingMedics(Tas CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY).orElse(null); return results.getResults().stream().filter(result -> { - if (result.getParticipatingMedics() < MIN_PARTICIPATING_MEDICS) + if (result.getParticipatingMedics() < MIN_PARTICIPATING_MEDICS_FOR_FEASIBILITY) { logger.warn("Removed result with cohort id='{}' from feasibility request with task-id='{}', " + "business-key='{}' and correlation-key='{}' because of not enough participating MeDICs", diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java index 47ac7754..110eea18 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java @@ -1,5 +1,6 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; @@ -19,7 +20,6 @@ import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.ConstantsBase; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.highmed.dsf.bpe.variable.BloomFilterConfigValues; @@ -76,7 +76,7 @@ protected void doExecute(DelegateExecution execution) throws Exception execution.setVariable(BPMN_EXECUTION_VARIABLE_COHORTS, FhirResourcesListValues.create(cohortDefinitions)); String ttpIdentifier = getTtpIdentifier(researchStudy, client); - execution.setVariable(ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER, ttpIdentifier); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER, ttpIdentifier); boolean needsConsentCheck = getNeedsConsentCheck(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK, needsConsentCheck); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java index 5e078184..fecdbadf 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java @@ -1,9 +1,10 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; + import java.util.Objects; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.ConstantsBase; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; @@ -39,6 +40,6 @@ protected void doExecute(DelegateExecution execution) throws Exception Task task = getLeadingTaskFromExecutionVariables(); Target medicTarget = Target.createUniDirectionalTarget(task.getRequester().getIdentifier().getValue()); - execution.setVariable(ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(medicTarget)); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(medicTarget)); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java index 2677e6be..8cc7bdeb 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java @@ -1,5 +1,8 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; + import java.util.Objects; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -34,11 +37,11 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - String ttpIdentifier = (String) execution.getVariable(ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); + String ttpIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); String correlationKey = getCorrelationKey(execution); Target ttpTarget = Target.createBiDirectionalTarget(ttpIdentifier, correlationKey); - execution.setVariable(ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(ttpTarget)); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(ttpTarget)); } private String getCorrelationKey(DelegateExecution execution) diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java index 3def9cff..bc3c0fcb 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java @@ -7,7 +7,6 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.ConstantsFeasibility; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variables.FeasibilityQueryResult; import org.highmed.dsf.bpe.variables.FeasibilityQueryResults; From eb9d0356bbbd1ed0ebe18a6dc2435042d5907b07 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 8 Feb 2021 19:37:15 +0100 Subject: [PATCH 009/125] rename and move feasibility query results --- .../dsf/bpe/service/ExecuteQueries.java | 2 ++ .../dsf/bpe/service/ModifyQueries.java | 4 +-- .../config/DataSharingSerializerConfig.java | 14 ++++++++ .../highmed/dsf/bpe/variable/QueryResult.java | 32 +++++++++---------- .../bpe/variable/QueryResultSerializer.java | 20 ++++++------ .../dsf/bpe/variable/QueryResultValues.java | 24 +++++++------- .../dsf/bpe/variable/QueryResults.java | 14 ++++---- .../bpe/variable/QueryResultsSerializer.java | 20 ++++++------ .../dsf/bpe/variable/QueryResultsValues.java | 24 +++++++------- .../bpe/message/SendSingleMedicResults.java | 10 +++--- .../service/CalculateMultiMedicResults.java | 16 +++++----- .../bpe/service/CheckSingleMedicResults.java | 23 +++++++------ .../dsf/bpe/service/DownloadResultSets.java | 18 +++++------ .../dsf/bpe/service/ExecuteQueries.java | 17 +++++----- .../dsf/bpe/service/ExecuteRecordLink.java | 15 ++++----- .../service/FilterQueryResultsByConsent.java | 19 ++++++----- .../dsf/bpe/service/GenerateBloomFilters.java | 18 +++++------ .../dsf/bpe/service/GenerateCountFromIds.java | 19 ++++++----- .../dsf/bpe/service/StoreCorrelationKeys.java | 6 ++-- .../highmed/dsf/bpe/service/StoreResults.java | 20 ++++++------ .../config/FeasibilitySerializerConfig.java | 14 -------- .../highmed/dsf/bpe/service/StoreResult.java | 12 +++---- 22 files changed, 179 insertions(+), 182 deletions(-) rename dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResult.java => dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java (53%) rename dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultSerializer.java => dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultSerializer.java (65%) rename dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultValues.java => dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultValues.java (51%) rename dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResults.java => dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResults.java (52%) rename dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultsSerializer.java => dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultsSerializer.java (64%) rename dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultsValues.java => dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultsValues.java (51%) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java index 949b76d1..0cae1c22 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -1,5 +1,7 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; import java.util.Map; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java index 3ceccd18..dcb0dead 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java @@ -41,12 +41,12 @@ protected void doExecute(DelegateExecution execution) @SuppressWarnings("unchecked") Map<String, String> queries = (Map<String, String>) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERIES); - Map<String, String> modifiedQueries = checkAndModifyQueries(queries); + Map<String, String> modifiedQueries = modifyQueries(queries); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERIES, modifiedQueries); } - private Map<String, String> checkAndModifyQueries(Map<String, String> queries) + private Map<String, String> modifyQueries(Map<String, String> queries) { Map<String, String> modifiedQueries = new HashMap<>(); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java index dfc10c39..3ac056e3 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java @@ -1,6 +1,8 @@ package org.highmed.dsf.bpe.spring.config; import org.highmed.dsf.bpe.variable.BloomFilterConfigSerializer; +import org.highmed.dsf.bpe.variable.QueryResultSerializer; +import org.highmed.dsf.bpe.variable.QueryResultsSerializer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -18,4 +20,16 @@ public BloomFilterConfigSerializer bloomFilterConfigSerializer() { return new BloomFilterConfigSerializer(objectMapper); } + + @Bean + public QueryResultSerializer queryResultSerializer() + { + return new QueryResultSerializer(objectMapper); + } + + @Bean + public QueryResultsSerializer queryResultsSerializer() + { + return new QueryResultsSerializer(objectMapper); + } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResult.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java similarity index 53% rename from dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResult.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java index d168aff7..4dd1a792 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResult.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java @@ -1,4 +1,4 @@ -package org.highmed.dsf.bpe.variables; +package org.highmed.dsf.bpe.variable; import org.highmed.openehr.model.structure.ResultSet; @@ -6,40 +6,40 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -public class FeasibilityQueryResult +public class QueryResult { private final String organizationIdentifier; private final String cohortId; - private final int cohortSize; + private final int count; private final ResultSet resultSet; private final String resultSetUrl; - public static FeasibilityQueryResult countResult(String organizationIdentifier, String cohortId, int cohortSize) + public static QueryResult count(String organizationIdentifier, String cohortId, int count) { - if (cohortSize < 0) - throw new IllegalArgumentException("cohortSize >= 0 expected"); + if (count < 0) + throw new IllegalArgumentException("count >= 0 expected"); - return new FeasibilityQueryResult(organizationIdentifier, cohortId, cohortSize, null, null); + return new QueryResult(organizationIdentifier, cohortId, count, null, null); } - public static FeasibilityQueryResult idResult(String organizationIdentifier, String cohortId, ResultSet resultSet) + public static QueryResult resultSet(String organizationIdentifier, String cohortId, ResultSet resultSet) { - return new FeasibilityQueryResult(organizationIdentifier, cohortId, -1, resultSet, null); + return new QueryResult(organizationIdentifier, cohortId, -1, resultSet, null); } - public static FeasibilityQueryResult idResult(String organizationIdentifier, String cohortId, String resultSetUrl) + public static QueryResult resultSet(String organizationIdentifier, String cohortId, String resultSetUrl) { - return new FeasibilityQueryResult(organizationIdentifier, cohortId, -1, null, resultSetUrl); + return new QueryResult(organizationIdentifier, cohortId, -1, null, resultSetUrl); } @JsonCreator - public FeasibilityQueryResult(@JsonProperty("organizationIdentifier") String organizationIdentifier, - @JsonProperty("cohortId") String cohortId, @JsonProperty("cohortSize") int cohortSize, + public QueryResult(@JsonProperty("organizationIdentifier") String organizationIdentifier, + @JsonProperty("cohortId") String cohortId, @JsonProperty("count") int count, @JsonProperty("resultSet") ResultSet resultSet, @JsonProperty("resultSetUrl") String resultSetUrl) { this.organizationIdentifier = organizationIdentifier; this.cohortId = cohortId; - this.cohortSize = cohortSize; + this.count = count; this.resultSet = resultSet; this.resultSetUrl = resultSetUrl; } @@ -54,9 +54,9 @@ public String getCohortId() return cohortId; } - public int getCohortSize() + public int getCount() { - return cohortSize; + return count; } public ResultSet getResultSet() diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultSerializer.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultSerializer.java similarity index 65% rename from dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultSerializer.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultSerializer.java index a6623fac..a0a43873 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultSerializer.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultSerializer.java @@ -1,4 +1,4 @@ -package org.highmed.dsf.bpe.variables; +package org.highmed.dsf.bpe.variable; import java.io.IOException; import java.util.Objects; @@ -6,20 +6,20 @@ import org.camunda.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer; import org.camunda.bpm.engine.impl.variable.serializer.ValueFields; import org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResultValues.FeasibilityQueryResultValue; +import org.highmed.dsf.bpe.variable.QueryResultValues.FeasibilityQueryResultValue; import org.springframework.beans.factory.InitializingBean; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -public class FeasibilityQueryResultSerializer extends PrimitiveValueSerializer<FeasibilityQueryResultValue> +public class QueryResultSerializer extends PrimitiveValueSerializer<FeasibilityQueryResultValue> implements InitializingBean { private final ObjectMapper objectMapper; - public FeasibilityQueryResultSerializer(ObjectMapper objectMapper) + public QueryResultSerializer(ObjectMapper objectMapper) { - super(FeasibilityQueryResultValues.VALUE_TYPE); + super(QueryResultValues.VALUE_TYPE); this.objectMapper = objectMapper; } @@ -33,7 +33,7 @@ public void afterPropertiesSet() throws Exception @Override public void writeValue(FeasibilityQueryResultValue value, ValueFields valueFields) { - FeasibilityQueryResult result = value.getValue(); + QueryResult result = value.getValue(); try { if (result != null) @@ -48,7 +48,7 @@ public void writeValue(FeasibilityQueryResultValue value, ValueFields valueField @Override public FeasibilityQueryResultValue convertToTypedValue(UntypedValueImpl untypedValue) { - return FeasibilityQueryResultValues.create((FeasibilityQueryResult) untypedValue.getValue()); + return QueryResultValues.create((QueryResult) untypedValue.getValue()); } @Override @@ -58,9 +58,9 @@ public FeasibilityQueryResultValue readValue(ValueFields valueFields, boolean as try { - FeasibilityQueryResult result = (bytes == null || bytes.length <= 0) ? null - : objectMapper.readValue(bytes, FeasibilityQueryResult.class); - return FeasibilityQueryResultValues.create(result); + QueryResult result = (bytes == null || bytes.length <= 0) ? null + : objectMapper.readValue(bytes, QueryResult.class); + return QueryResultValues.create(result); } catch (IOException e) { diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultValues.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultValues.java similarity index 51% rename from dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultValues.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultValues.java index 5f5c2fe9..bebc28ea 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultValues.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultValues.java @@ -1,4 +1,4 @@ -package org.highmed.dsf.bpe.variables; +package org.highmed.dsf.bpe.variable; import java.util.Map; @@ -8,18 +8,18 @@ import org.camunda.bpm.engine.variable.value.PrimitiveValue; import org.camunda.bpm.engine.variable.value.TypedValue; -public class FeasibilityQueryResultValues +public class QueryResultValues { - public static interface FeasibilityQueryResultValue extends PrimitiveValue<FeasibilityQueryResult> + public static interface FeasibilityQueryResultValue extends PrimitiveValue<QueryResult> { } - private static class FeasibilityQueryResultValueImpl extends PrimitiveTypeValueImpl<FeasibilityQueryResult> - implements FeasibilityQueryResultValues.FeasibilityQueryResultValue + private static class FeasibilityQueryResultValueImpl extends PrimitiveTypeValueImpl<QueryResult> + implements QueryResultValues.FeasibilityQueryResultValue { private static final long serialVersionUID = 1L; - public FeasibilityQueryResultValueImpl(FeasibilityQueryResult value, PrimitiveValueType type) + public FeasibilityQueryResultValueImpl(QueryResult value, PrimitiveValueType type) { super(value, type); } @@ -31,24 +31,24 @@ public static class FeasibilityQueryResultValueTypeImpl extends PrimitiveValueTy private FeasibilityQueryResultValueTypeImpl() { - super(FeasibilityQueryResult.class); + super(QueryResult.class); } @Override public TypedValue createValue(Object value, Map<String, Object> valueInfo) { - return new FeasibilityQueryResultValues.FeasibilityQueryResultValueImpl((FeasibilityQueryResult) value, VALUE_TYPE); + return new QueryResultValues.FeasibilityQueryResultValueImpl((QueryResult) value, VALUE_TYPE); } } - public static final PrimitiveValueType VALUE_TYPE = new FeasibilityQueryResultValues.FeasibilityQueryResultValueTypeImpl(); + public static final PrimitiveValueType VALUE_TYPE = new QueryResultValues.FeasibilityQueryResultValueTypeImpl(); - private FeasibilityQueryResultValues() + private QueryResultValues() { } - public static FeasibilityQueryResultValues.FeasibilityQueryResultValue create(FeasibilityQueryResult value) + public static QueryResultValues.FeasibilityQueryResultValue create(QueryResult value) { - return new FeasibilityQueryResultValues.FeasibilityQueryResultValueImpl(value, VALUE_TYPE); + return new QueryResultValues.FeasibilityQueryResultValueImpl(value, VALUE_TYPE); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResults.java similarity index 52% rename from dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResults.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResults.java index e999bd24..ff3cd0ec 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResults.java @@ -1,4 +1,4 @@ -package org.highmed.dsf.bpe.variables; +package org.highmed.dsf.bpe.variable; import java.util.ArrayList; import java.util.Collection; @@ -8,30 +8,30 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; -public class FeasibilityQueryResults +public class QueryResults { - private final List<FeasibilityQueryResult> results = new ArrayList<>(); + private final List<QueryResult> results = new ArrayList<>(); @JsonCreator - public FeasibilityQueryResults(@JsonProperty("results") Collection<? extends FeasibilityQueryResult> results) + public QueryResults(@JsonProperty("results") Collection<? extends QueryResult> results) { if (results != null) this.results.addAll(results); } - public void add(FeasibilityQueryResult newResult) + public void add(QueryResult newResult) { if (newResult != null) results.add(newResult); } - public void addAll(Collection<FeasibilityQueryResult> results) + public void addAll(Collection<QueryResult> results) { if (results != null) this.results.addAll(results); } - public List<FeasibilityQueryResult> getResults() + public List<QueryResult> getResults() { return Collections.unmodifiableList(results); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultsSerializer.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultsSerializer.java similarity index 64% rename from dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultsSerializer.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultsSerializer.java index 26022a95..b4a5e4c2 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultsSerializer.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultsSerializer.java @@ -1,4 +1,4 @@ -package org.highmed.dsf.bpe.variables; +package org.highmed.dsf.bpe.variable; import java.io.IOException; import java.util.Objects; @@ -6,20 +6,20 @@ import org.camunda.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer; import org.camunda.bpm.engine.impl.variable.serializer.ValueFields; import org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues.FeasibilityQueryResultsValue; +import org.highmed.dsf.bpe.variable.QueryResultsValues.FeasibilityQueryResultsValue; import org.springframework.beans.factory.InitializingBean; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -public class FeasibilityQueryResultsSerializer extends PrimitiveValueSerializer<FeasibilityQueryResultsValue> +public class QueryResultsSerializer extends PrimitiveValueSerializer<FeasibilityQueryResultsValue> implements InitializingBean { private final ObjectMapper objectMapper; - public FeasibilityQueryResultsSerializer(ObjectMapper objectMapper) + public QueryResultsSerializer(ObjectMapper objectMapper) { - super(FeasibilityQueryResultsValues.VALUE_TYPE); + super(QueryResultsValues.VALUE_TYPE); this.objectMapper = objectMapper; } @@ -33,7 +33,7 @@ public void afterPropertiesSet() throws Exception @Override public void writeValue(FeasibilityQueryResultsValue value, ValueFields valueFields) { - FeasibilityQueryResults results = value.getValue(); + QueryResults results = value.getValue(); try { if (results != null) @@ -48,7 +48,7 @@ public void writeValue(FeasibilityQueryResultsValue value, ValueFields valueFiel @Override public FeasibilityQueryResultsValue convertToTypedValue(UntypedValueImpl untypedValue) { - return FeasibilityQueryResultsValues.create((FeasibilityQueryResults) untypedValue.getValue()); + return QueryResultsValues.create((QueryResults) untypedValue.getValue()); } @Override @@ -58,9 +58,9 @@ public FeasibilityQueryResultsValue readValue(ValueFields valueFields, boolean a try { - FeasibilityQueryResults results = (bytes == null || bytes.length <= 0) ? null - : objectMapper.readValue(bytes, FeasibilityQueryResults.class); - return FeasibilityQueryResultsValues.create(results); + QueryResults results = (bytes == null || bytes.length <= 0) ? null + : objectMapper.readValue(bytes, QueryResults.class); + return QueryResultsValues.create(results); } catch (IOException e) { diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultsValues.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultsValues.java similarity index 51% rename from dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultsValues.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultsValues.java index 7151c4cc..88b274be 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FeasibilityQueryResultsValues.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultsValues.java @@ -1,4 +1,4 @@ -package org.highmed.dsf.bpe.variables; +package org.highmed.dsf.bpe.variable; import java.util.Map; @@ -8,18 +8,18 @@ import org.camunda.bpm.engine.variable.value.PrimitiveValue; import org.camunda.bpm.engine.variable.value.TypedValue; -public class FeasibilityQueryResultsValues +public class QueryResultsValues { - public static interface FeasibilityQueryResultsValue extends PrimitiveValue<FeasibilityQueryResults> + public static interface FeasibilityQueryResultsValue extends PrimitiveValue<QueryResults> { } - private static class FeasibilityQueryResultsValueImpl extends PrimitiveTypeValueImpl<FeasibilityQueryResults> - implements FeasibilityQueryResultsValues.FeasibilityQueryResultsValue + private static class FeasibilityQueryResultsValueImpl extends PrimitiveTypeValueImpl<QueryResults> + implements QueryResultsValues.FeasibilityQueryResultsValue { private static final long serialVersionUID = 1L; - public FeasibilityQueryResultsValueImpl(FeasibilityQueryResults value, PrimitiveValueType type) + public FeasibilityQueryResultsValueImpl(QueryResults value, PrimitiveValueType type) { super(value, type); } @@ -31,25 +31,25 @@ public static class FeasibilityQueryResultsValueTypeImpl extends PrimitiveValueT private FeasibilityQueryResultsValueTypeImpl() { - super(FeasibilityQueryResults.class); + super(QueryResults.class); } @Override public TypedValue createValue(Object value, Map<String, Object> valueInfo) { - return new FeasibilityQueryResultsValues.FeasibilityQueryResultsValueImpl((FeasibilityQueryResults) value, + return new QueryResultsValues.FeasibilityQueryResultsValueImpl((QueryResults) value, VALUE_TYPE); } } - public static final PrimitiveValueType VALUE_TYPE = new FeasibilityQueryResultsValues.FeasibilityQueryResultsValueTypeImpl(); + public static final PrimitiveValueType VALUE_TYPE = new QueryResultsValues.FeasibilityQueryResultsValueTypeImpl(); - private FeasibilityQueryResultsValues() + private QueryResultsValues() { } - public static FeasibilityQueryResultsValues.FeasibilityQueryResultsValue create(FeasibilityQueryResults value) + public static QueryResultsValues.FeasibilityQueryResultsValue create(QueryResults value) { - return new FeasibilityQueryResultsValues.FeasibilityQueryResultsValueImpl(value, VALUE_TYPE); + return new QueryResultsValues.FeasibilityQueryResultsValueImpl(value, VALUE_TYPE); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java index 57d8ecc6..a1c7bc0d 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -9,8 +9,8 @@ import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResult; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResults; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; @@ -37,18 +37,18 @@ public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskH @Override protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { - FeasibilityQueryResults results = (FeasibilityQueryResults) execution + QueryResults results = (QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); return results.getResults().stream().map(result -> toInput(result)); } - private Task.ParameterComponent toInput(FeasibilityQueryResult result) + private Task.ParameterComponent toInput(QueryResult result) { if (result.isCohortSizeResult()) { ParameterComponent input = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT, result.getCohortSize()); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT, result.getCount()); input.addExtension(createCohortIdExtension(result.getCohortId())); return input; } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java index 44ba14b7..c07596a7 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java @@ -9,8 +9,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResult; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResults; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResult; import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResults; import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResultsValues; @@ -27,7 +27,7 @@ public CalculateMultiMedicResults(FhirWebserviceClientProvider clientProvider, T @Override protected void doExecute(DelegateExecution execution) throws Exception { - List<FeasibilityQueryResult> results = ((FeasibilityQueryResults) execution + List<QueryResult> results = ((QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS)).getResults(); List<FinalFeasibilityQueryResult> finalResults = calculateResults(results); @@ -36,14 +36,14 @@ protected void doExecute(DelegateExecution execution) throws Exception FinalFeasibilityQueryResultsValues.create(new FinalFeasibilityQueryResults(finalResults))); } - private List<FinalFeasibilityQueryResult> calculateResults(List<FeasibilityQueryResult> results) + private List<FinalFeasibilityQueryResult> calculateResults(List<QueryResult> results) { - Map<String, List<FeasibilityQueryResult>> byCohortId = results.stream() - .collect(Collectors.groupingBy(FeasibilityQueryResult::getCohortId)); + Map<String, List<QueryResult>> byCohortId = results.stream() + .collect(Collectors.groupingBy(QueryResult::getCohortId)); return byCohortId.entrySet().stream().map(e -> new FinalFeasibilityQueryResult(e.getKey(), - toInt(e.getValue().stream().filter(r -> r.getCohortSize() > 0).count()), - toInt(e.getValue().stream().mapToLong(FeasibilityQueryResult::getCohortSize).sum()))) + toInt(e.getValue().stream().filter(r -> r.getCount() > 0).count()), + toInt(e.getValue().stream().mapToLong(QueryResult::getCount).sum()))) .collect(Collectors.toList()); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java index ed0f8548..5bc21eb4 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java @@ -8,11 +8,10 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.ConstantsBase; -import org.highmed.dsf.bpe.ConstantsFeasibility; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResult; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResults; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.hl7.fhir.r4.model.Task; @@ -31,24 +30,24 @@ public CheckSingleMedicResults(FhirWebserviceClientProvider clientProvider, Task @Override protected void doExecute(DelegateExecution execution) throws Exception { - FeasibilityQueryResults results = (FeasibilityQueryResults) execution + QueryResults results = (QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); Task currentTask = getCurrentTaskFromExecutionVariables(); - List<FeasibilityQueryResult> filteredResults = filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(results, + List<QueryResult> filteredResults = filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(results, currentTask); // TODO: add percentage filter over results execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(filteredResults))); + QueryResultsValues.create(new QueryResults(filteredResults))); } - private List<FeasibilityQueryResult> filterErroneousResultsAndAddErrorsToCurrentTaskOutputs( - FeasibilityQueryResults results, Task task) + private List<QueryResult> filterErroneousResultsAndAddErrorsToCurrentTaskOutputs( + QueryResults results, Task task) { - List<FeasibilityQueryResult> filteredResults = new ArrayList<>(); - for (FeasibilityQueryResult result : results.getResults()) + List<QueryResult> filteredResults = new ArrayList<>(); + for (QueryResult result : results.getResults()) { Optional<String> errorReason = testResultAndReturnErrorReason(result); if (errorReason.isPresent()) @@ -60,7 +59,7 @@ private List<FeasibilityQueryResult> filterErroneousResultsAndAddErrorsToCurrent return filteredResults; } - protected Optional<String> testResultAndReturnErrorReason(FeasibilityQueryResult result) + protected Optional<String> testResultAndReturnErrorReason(QueryResult result) { // TODO: implement check // cohort size > 0 diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java index d10b431c..2ae6d711 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java @@ -13,9 +13,9 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResult; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResults; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.fhir.client.FhirWebserviceClient; @@ -51,21 +51,21 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - FeasibilityQueryResults results = (FeasibilityQueryResults) execution + QueryResults results = (QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - List<FeasibilityQueryResult> resultsWithResultSets = download(results); + List<QueryResult> resultsWithResultSets = download(results); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(resultsWithResultSets))); + QueryResultsValues.create(new QueryResults(resultsWithResultSets))); } - private List<FeasibilityQueryResult> download(FeasibilityQueryResults results) + private List<QueryResult> download(QueryResults results) { return results.getResults().stream().map(r -> download(r)).collect(Collectors.toList()); } - private FeasibilityQueryResult download(FeasibilityQueryResult result) + private QueryResult download(QueryResult result) { IdType id = new IdType(result.getResultSetUrl()); FhirWebserviceClient client = getFhirWebserviceClientProvider().getRemoteWebserviceClient(id.getBaseUrl()); @@ -73,7 +73,7 @@ private FeasibilityQueryResult download(FeasibilityQueryResult result) InputStream binary = readBinaryResource(client, id.getIdPart()); ResultSet resultSet = deserializeResultSet(binary); - return FeasibilityQueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), resultSet); + return QueryResult.resultSet(result.getOrganizationIdentifier(), result.getCohortId(), resultSet); } private InputStream readBinaryResource(FhirWebserviceClient client, String id) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java index 84ae0e54..b5c72749 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -11,11 +11,10 @@ import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.ConstantsFeasibility; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResult; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResults; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -60,14 +59,14 @@ protected void doExecute(DelegateExecution execution) throws Exception .getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); boolean idQuery = Boolean.TRUE.equals(needsConsentCheck) || Boolean.TRUE.equals(needsRecordLinkage); - List<FeasibilityQueryResult> results = queries.entrySet().stream() + List<QueryResult> results = queries.entrySet().stream() .map(entry -> executeQuery(entry.getKey(), entry.getValue(), idQuery)).collect(Collectors.toList()); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(results))); + QueryResultsValues.create(new QueryResults(results))); } - private FeasibilityQueryResult executeQuery(String cohortId, String cohortQuery, boolean idQuery) + private QueryResult executeQuery(String cohortId, String cohortQuery, boolean idQuery) { // TODO We might want to introduce a more complex result type to represent a count, // errors and possible meta-data. @@ -76,12 +75,12 @@ private FeasibilityQueryResult executeQuery(String cohortId, String cohortQuery, if (idQuery) { - return FeasibilityQueryResult.idResult(organizationProvider.getLocalIdentifierValue(), cohortId, resultSet); + return QueryResult.resultSet(organizationProvider.getLocalIdentifierValue(), cohortId, resultSet); } else { int count = Integer.parseInt(resultSet.getRow(0).get(0).getValueAsString()); - return FeasibilityQueryResult.countResult(organizationProvider.getLocalIdentifierValue(), cohortId, count); + return QueryResult.count(organizationProvider.getLocalIdentifierValue(), cohortId, count); } } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java index 9b7bff31..0d7fe6b2 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java @@ -10,10 +10,9 @@ import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.ConstantsFeasibility; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResult; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResults; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResult; import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResults; import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResultsValues; @@ -52,11 +51,11 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - FeasibilityQueryResults results = (FeasibilityQueryResults) execution + QueryResults results = (QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - Map<String, List<FeasibilityQueryResult>> byCohortId = results.getResults().stream() - .collect(Collectors.groupingBy(FeasibilityQueryResult::getCohortId)); + Map<String, List<QueryResult>> byCohortId = results.getResults().stream() + .collect(Collectors.groupingBy(QueryResult::getCohortId)); FederatedMatcherImpl<PersonWithMdat> matcher = createMatcher(); @@ -68,7 +67,7 @@ protected void doExecute(DelegateExecution execution) throws Exception } private FinalFeasibilityQueryResult match(FederatedMatcherImpl<PersonWithMdat> matcher, String cohortId, - List<FeasibilityQueryResult> results) + List<QueryResult> results) { logger.debug("Matching results for cohort {}", cohortId); @@ -81,7 +80,7 @@ private FinalFeasibilityQueryResult match(FederatedMatcherImpl<PersonWithMdat> m toInt(matchedPersons.size())); } - private List<PersonWithMdat> translate(FeasibilityQueryResult result) + private List<PersonWithMdat> translate(QueryResult result) { return translator.translate(result.getOrganizationIdentifier(), result.getResultSet()); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java index 68b038e6..c6c033c0 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java @@ -6,11 +6,10 @@ import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.ConstantsFeasibility; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResult; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResults; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.openehr.model.structure.ResultSet; @@ -25,23 +24,23 @@ public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, @Override protected void doExecute(DelegateExecution execution) throws Exception { - FeasibilityQueryResults results = (FeasibilityQueryResults) execution + QueryResults results = (QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - List<FeasibilityQueryResult> filteredResults = filterResults(results.getResults()); + List<QueryResult> filteredResults = filterResults(results.getResults()); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(filteredResults))); + QueryResultsValues.create(new QueryResults(filteredResults))); } - private List<FeasibilityQueryResult> filterResults(List<FeasibilityQueryResult> results) + private List<QueryResult> filterResults(List<QueryResult> results) { return results.stream().map(this::filterResult).collect(Collectors.toList()); } - protected FeasibilityQueryResult filterResult(FeasibilityQueryResult result) + protected QueryResult filterResult(QueryResult result) { - return FeasibilityQueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), + return QueryResult.resultSet(result.getOrganizationIdentifier(), result.getCohortId(), filterResultSet(result.getResultSet())); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java index fa4ddae0..1b7271d9 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -16,9 +16,9 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.BloomFilterConfig; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResult; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResults; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.mpi.client.MasterPatientIndexClient; @@ -83,7 +83,7 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - FeasibilityQueryResults results = (FeasibilityQueryResults) execution + QueryResults results = (QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); String securityIdentifier = getSecurityIdentifier(execution); @@ -93,12 +93,12 @@ protected void doExecute(DelegateExecution execution) throws Exception ResultSetTranslatorToTtpRbfOnly resultSetTranslator = createResultSetTranslator(bloomFilterConfig); - List<FeasibilityQueryResult> translatedResults = results.getResults().stream() + List<QueryResult> translatedResults = results.getResults().stream() .map(result -> translateAndCreateBinary(resultSetTranslator, result, securityIdentifier)) .collect(Collectors.toList()); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(translatedResults))); + QueryResultsValues.create(new QueryResults(translatedResults))); } private String getSecurityIdentifier(DelegateExecution execution) @@ -127,13 +127,13 @@ protected RecordBloomFilterGenerator createRecordBloomFilterGenerator(long permu bouncyCastleProvider)); } - private FeasibilityQueryResult translateAndCreateBinary(ResultSetTranslatorToTtpRbfOnly resultSetTranslator, - FeasibilityQueryResult result, String ttpIdentifier) + private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtpRbfOnly resultSetTranslator, + QueryResult result, String ttpIdentifier) { ResultSet translatedResultSet = translate(resultSetTranslator, result.getResultSet()); String resultSetUrl = saveResultSetAsBinaryForTtp(translatedResultSet, ttpIdentifier); - return FeasibilityQueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), resultSetUrl); + return QueryResult.resultSet(result.getOrganizationIdentifier(), result.getCohortId(), resultSetUrl); } private ResultSet translate(ResultSetTranslatorToTtpRbfOnly resultSetTranslator, ResultSet resultSet) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java index f9549505..95254679 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java @@ -6,11 +6,10 @@ import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.ConstantsFeasibility; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResult; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResults; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -24,23 +23,23 @@ public GenerateCountFromIds(FhirWebserviceClientProvider clientProvider, TaskHel @Override protected void doExecute(DelegateExecution execution) throws Exception { - FeasibilityQueryResults results = (FeasibilityQueryResults) execution + QueryResults results = (QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - List<FeasibilityQueryResult> filteredResults = count(results.getResults()); + List<QueryResult> filteredResults = count(results.getResults()); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(filteredResults))); + QueryResultsValues.create(new QueryResults(filteredResults))); } - private List<FeasibilityQueryResult> count(List<FeasibilityQueryResult> results) + private List<QueryResult> count(List<QueryResult> results) { return results.stream().map(this::count).collect(Collectors.toList()); } - protected FeasibilityQueryResult count(FeasibilityQueryResult result) + protected QueryResult count(QueryResult result) { - return FeasibilityQueryResult.countResult(result.getOrganizationIdentifier(), result.getCohortId(), + return QueryResult.count(result.getOrganizationIdentifier(), result.getCohortId(), result.getResultSet().getRows().size()); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java index 6e55b8ea..4afb27ab 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java @@ -12,8 +12,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.ConstantsBase; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResults; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; @@ -45,7 +45,7 @@ protected void doExecute(DelegateExecution execution) throws Exception execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(null))); + QueryResultsValues.create(new QueryResults(null))); } private boolean getNeedsRecordLinkageCheck(Task task) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java index 27a61553..f4d86e6d 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java @@ -14,9 +14,9 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResult; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResults; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsValues; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -48,7 +48,7 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - FeasibilityQueryResults results = (FeasibilityQueryResults) execution + QueryResults results = (QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); boolean needsRecordLinkage = Boolean.TRUE @@ -56,15 +56,15 @@ protected void doExecute(DelegateExecution execution) throws Exception Task task = getCurrentTaskFromExecutionVariables(); - List<FeasibilityQueryResult> extendedResults = new ArrayList<>(); + List<QueryResult> extendedResults = new ArrayList<>(); extendedResults.addAll(results.getResults()); extendedResults.addAll(getResults(task, needsRecordLinkage)); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - FeasibilityQueryResultsValues.create(new FeasibilityQueryResults(extendedResults))); + QueryResultsValues.create(new QueryResults(extendedResults))); } - private List<FeasibilityQueryResult> getResults(Task task, boolean needsRecordLinkage) + private List<QueryResult> getResults(Task task, boolean needsRecordLinkage) { TaskHelper taskHelper = getTaskHelper(); Reference requester = task.getRequester(); @@ -77,8 +77,8 @@ private List<FeasibilityQueryResult> getResults(Task task, boolean needsRecordLi String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); String resultSetUrl = ((Reference) input.getValue()).getReference(); - return FeasibilityQueryResult - .idResult(requester.getIdentifier().getValue(), cohortId, resultSetUrl); + return QueryResult + .resultSet(requester.getIdentifier().getValue(), cohortId, resultSetUrl); }).collect(Collectors.toList()); } else @@ -88,7 +88,7 @@ private List<FeasibilityQueryResult> getResults(Task task, boolean needsRecordLi String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); int cohortSize = ((UnsignedIntType) input.getValue()).getValue(); - return FeasibilityQueryResult.countResult(requester.getIdentifier().getValue(), cohortId, cohortSize); + return QueryResult.count(requester.getIdentifier().getValue(), cohortId, cohortSize); }).collect(Collectors.toList()); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilitySerializerConfig.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilitySerializerConfig.java index 064fb440..28fc9bf4 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilitySerializerConfig.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilitySerializerConfig.java @@ -1,7 +1,5 @@ package org.highmed.dsf.bpe.spring.config; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResultSerializer; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResultsSerializer; import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResultSerializer; import org.highmed.dsf.bpe.variables.FinalFeasibilityQueryResultsSerializer; import org.springframework.beans.factory.annotation.Autowired; @@ -16,18 +14,6 @@ public class FeasibilitySerializerConfig @Autowired private ObjectMapper objectMapper; - @Bean - public FeasibilityQueryResultSerializer feasibilityQueryResultSerializer() - { - return new FeasibilityQueryResultSerializer(objectMapper); - } - - @Bean - public FeasibilityQueryResultsSerializer feasibilityQueryResultsSerializer() - { - return new FeasibilityQueryResultsSerializer(objectMapper); - } - @Bean public FinalFeasibilityQueryResultSerializer finalFeasibilityQueryResultSerializer() { diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java index bc3c0fcb..818d1845 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java @@ -8,8 +8,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResult; -import org.highmed.dsf.bpe.variables.FeasibilityQueryResults; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.hl7.fhir.r4.model.Extension; @@ -32,25 +32,25 @@ public StoreResult(FhirWebserviceClientProvider clientProvider, TaskHelper taskH protected void doExecute(DelegateExecution execution) throws Exception { Task task = getCurrentTaskFromExecutionVariables(); - FeasibilityQueryResults results = (FeasibilityQueryResults) execution + QueryResults results = (QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); addOutputs(task, results); } - private void addOutputs(Task task, FeasibilityQueryResults results) + private void addOutputs(Task task, QueryResults results) { results.getResults().forEach(result -> addOutput(task, result)); } - private void addOutput(Task task, FeasibilityQueryResult result) + private void addOutput(Task task, QueryResult result) { if (result.isCohortSizeResult()) { Task.TaskOutputComponent output = getTaskHelper() .createOutputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT, - result.getCohortSize()); + result.getCount()); output.addExtension(createCohortIdExtension(result.getCohortId())); task.addOutput(output); } From 7081525d31b62d704485aaa7c1275364f436ae28 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 9 Feb 2021 08:10:36 +0100 Subject: [PATCH 010/125] applying formatter and impsort plugin --- .github/workflows/maven-build.yml | 2 +- dsf-bpe-process-data-sharing/pom.xml | 4 + .../highmed/dsf/bpe/ConstantsDataSharing.java | 4 +- .../DataSharingProcessPluginDefinition.java | 13 +- .../dsf/bpe/message/SendMedicRequest.java | 7 +- .../dsf/bpe/message/SendMultiMedicErrors.java | 8 +- .../service/DownloadDataSharingResources.java | 47 +-- .../DownloadResearchStudyResource.java | 31 +- .../dsf/bpe/service/ExecuteQueries.java | 2 +- .../dsf/bpe/service/ExtractQueries.java | 3 +- .../dsf/bpe/service/ModifyQueries.java | 9 +- .../dsf/bpe/service/SelectRequestTargets.java | 10 +- .../bpe/service/SelectResponseTargetTtp.java | 8 +- .../dsf/bpe/service/StoreCorrelationKeys.java | 16 +- .../dsf/bpe/variable/BloomFilterConfig.java | 15 +- .../variable/BloomFilterConfigSerializer.java | 5 +- .../dsf/bpe/variable/QueryResultsValues.java | 3 +- ...ringFromMedicsViaMedic1ExampleStarter.java | 49 +-- dsf-bpe-process-feasibility/pom.xml | 4 + .../highmed/dsf/bpe/ConstantsFeasibility.java | 12 +- .../FeasibilityProcessPluginDefinition.java | 23 +- .../dsf/bpe/message/SendMedicRequest.java | 10 +- .../dsf/bpe/message/SendMultiMedicErrors.java | 12 +- .../bpe/message/SendMultiMedicResults.java | 27 +- .../bpe/message/SendSingleMedicResults.java | 11 +- .../dsf/bpe/message/SendTtpRequest.java | 6 +- .../service/CalculateMultiMedicResults.java | 11 +- .../service/CheckFeasibilityResources.java | 8 +- .../bpe/service/CheckMultiMedicResults.java | 34 +- .../highmed/dsf/bpe/service/CheckQueries.java | 14 +- .../bpe/service/CheckSingleMedicResults.java | 11 +- .../CheckTtpComputedMultiMedicResults.java | 22 +- .../service/DownloadFeasibilityResources.java | 46 +-- .../DownloadResearchStudyResource.java | 37 +- .../dsf/bpe/service/DownloadResultSets.java | 3 +- .../dsf/bpe/service/ExecuteQueries.java | 11 +- .../dsf/bpe/service/ExecuteRecordLink.java | 3 +- .../service/FilterQueryResultsByConsent.java | 3 +- .../dsf/bpe/service/GenerateBloomFilters.java | 3 +- .../dsf/bpe/service/GenerateCountFromIds.java | 3 +- .../service/HandleErrorMultiMedicResults.java | 9 +- .../bpe/service/SelectResponseTargetTtp.java | 7 +- .../dsf/bpe/service/StoreCorrelationKeys.java | 23 +- .../highmed/dsf/bpe/service/StoreResults.java | 24 +- .../FinalFeasibilityQueryResults.java | 3 +- ...lityFromMedicsViaMedic1ExampleStarter.java | 46 ++- .../dsf/fhir/profile/TaskProfileTest.java | 18 +- dsf-bpe-process-local-services/pom.xml | 4 + .../dsf/bpe/ConstantsLocalServices.java | 4 +- .../LocalServicesProcessPluginDefinition.java | 18 +- .../dsf/bpe/service/ExtractInputValues.java | 31 +- .../highmed/dsf/bpe/service/StoreResult.java | 26 +- .../spring/config/LocalServicesConfig.java | 12 +- .../LocalServicesMedic1ExampleStarter.java | 5 +- dsf-bpe-process-ping/pom.xml | 4 + .../dsf/bpe/PingProcessPluginDefinition.java | 10 +- .../dsf/bpe/service/SelectPingTargets.java | 4 +- .../Ping3MedicFromTtpExampleStarter.java | 4 +- dsf-bpe-process-update-allow-list/pom.xml | 4 + .../dsf/bpe/ConstantsUpdateAllowList.java | 8 +- ...pdateAllowListProcessPluginDefinition.java | 10 +- .../dsf/bpe/service/DownloadAllowList.java | 20 +- .../dsf/bpe/service/UpdateAllowList.java | 19 +- ...lowListFromTtpViaMedic1ExampleStarter.java | 12 +- ...pdateAllowList3MedicTtpExampleStarter.java | 4 +- dsf-bpe-process-update-resources/pom.xml | 5 +- .../dsf/bpe/ConstantsUpdateResources.java | 16 +- ...pdateResourcesProcessPluginDefinition.java | 11 +- .../highmed/dsf/bpe/message/SendRequest.java | 5 +- .../highmed/dsf/bpe/service/CheckRequest.java | 13 +- .../bpe/service/SelectResourceAndTargets.java | 6 +- .../dsf/bpe/service/UpdateResources.java | 25 +- ...UpdateResource3MedicTtpExampleStarter.java | 12 +- pom.xml | 94 +++++ .../resources/eclipse-formatter-config.xml | 382 ++++++++++++++++++ 75 files changed, 967 insertions(+), 481 deletions(-) create mode 100644 src/main/resources/eclipse-formatter-config.xml diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 8d513d6a..d1cdb9f9 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -19,4 +19,4 @@ jobs: - name: Build with Maven env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: mvn -B verify --file pom.xml + run: mvn -B verify -fae --file pom.xml diff --git a/dsf-bpe-process-data-sharing/pom.xml b/dsf-bpe-process-data-sharing/pom.xml index b5e46e81..bc987069 100644 --- a/dsf-bpe-process-data-sharing/pom.xml +++ b/dsf-bpe-process-data-sharing/pom.xml @@ -12,6 +12,10 @@ <version>0.5.0-SNAPSHOT</version> </parent> + <properties> + <main.basedir>${project.basedir}/..</main.basedir> + </properties> + <dependencies> <dependency> <groupId>org.highmed.dsf</groupId> diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index dfc4bc7e..39d2f1ad 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -16,8 +16,8 @@ public interface ConstantsDataSharing String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestDataSharing/"; - String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = - PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI + VERSION; + String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI + + VERSION; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME = "requestDataSharingMessage"; String CODESYSTEM_HIGHMED_DATA_SHARING = "http://highmed.org/fhir/CodeSystem/data-sharing"; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java index 76139154..0c6f71dc 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java @@ -66,13 +66,12 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var vDS = ValueSetResource.file("fhir/ValueSet/highmed-data-sharing.xml"); - Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( - "computeDataSharing/" + VERSION, Arrays.asList(aCom, cDS, sTCom, sTResS, vDS), - "executeDataSharing/" + VERSION, Arrays.asList(aExe, cDS, sTExe, vDS), - "requestDataSharing/" + VERSION, Arrays.asList(aReq, cDS, sTReq, sTResM, sTErr, vDS)); + Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of("computeDataSharing/" + VERSION, + Arrays.asList(aCom, cDS, sTCom, sTResS, vDS), "executeDataSharing/" + VERSION, + Arrays.asList(aExe, cDS, sTExe, vDS), "requestDataSharing/" + VERSION, + Arrays.asList(aReq, cDS, sTReq, sTResM, sTErr, vDS)); - return ResourceProvider - .read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, - resourcesByProcessKeyAndVersion); + return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), + classLoader, resourcesByProcessKeyAndVersion); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java index 974a6b3e..a1c34603 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java @@ -1,8 +1,8 @@ package org.highmed.dsf.bpe.message; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; @@ -45,9 +45,8 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut new Reference().setReference(researchStudyId.toVersionless().getValueAsString())); boolean needsConsentCheck = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); - ParameterComponent inputNeedsConsentCheck = getTaskHelper() - .createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK, - needsConsentCheck); + ParameterComponent inputNeedsConsentCheck = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK, needsConsentCheck); boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); ParameterComponent inputNeedsRecordLinkage = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java index 1abe1434..4b483b75 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java @@ -33,10 +33,10 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut String taskUrl = new Reference(new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl() + "/Task", task.getIdElement().getIdPart())).getReference(); - Task.ParameterComponent input = getTaskHelper() - .createInput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, - "An error occurred while calculating the multi medic data sharing result for " - + "all defined cohorts, see task with url='" + taskUrl + "'"); + Task.ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, + "An error occurred while calculating the multi medic data sharing result for " + + "all defined cohorts, see task with url='" + taskUrl + "'"); return Stream.of(input); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java index dc2d5d61..0ff1739d 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java @@ -1,10 +1,10 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; @@ -93,17 +93,17 @@ protected void doExecute(DelegateExecution execution) private IdType getResearchStudyId(Task task) { - Reference researchStudyReference = getTaskHelper() - .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE).findFirst().get(); + Reference researchStudyReference = getTaskHelper().getInputParameterReferenceValues(task, + CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE) + .findFirst().get(); return new IdType(researchStudyReference.getReference()); } private FhirWebserviceClient getWebserviceClient(IdType researchStudyId) { - if (researchStudyId.getBaseUrl() == null || researchStudyId.getBaseUrl() - .equals(getFhirWebserviceClientProvider().getLocalBaseUrl())) + if (researchStudyId.getBaseUrl() == null + || researchStudyId.getBaseUrl().equals(getFhirWebserviceClientProvider().getLocalBaseUrl())) { return getFhirWebserviceClientProvider().getLocalWebserviceClient(); } @@ -125,8 +125,8 @@ private Bundle getResearchStudyAndCohortDefinitions(IdType researchStudyId, Fhir { throw new RuntimeException("Returned search-set contained less then two entries"); } - else if (!bundle.getEntryFirstRep().hasResource() || !(bundle.getEntryFirstRep() - .getResource() instanceof ResearchStudy)) + else if (!bundle.getEntryFirstRep().hasResource() + || !(bundle.getEntryFirstRep().getResource() instanceof ResearchStudy)) { throw new RuntimeException("Returned search-set did not contain ResearchStudy at index == 0"); } @@ -148,7 +148,8 @@ else if (bundle.getEntry().stream().skip(1).map(c -> c.hasResource() && c.getRes private List<Group> getCohortDefinitions(Bundle bundle, String baseUrl) { - return bundle.getEntry().stream().skip(1).map(e -> { + return bundle.getEntry().stream().skip(1).map(e -> + { Group group = (Group) e.getResource(); IdType oldId = group.getIdElement(); group.setIdElement( @@ -166,29 +167,29 @@ private String getTtpIdentifier(ResearchStudy researchStudy) private boolean getNeedsConsentCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK).orElseThrow( - () -> new IllegalArgumentException( - "NeedsConsentCheck boolean is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + return getTaskHelper() + .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK) + .orElseThrow(() -> new IllegalArgumentException("NeedsConsentCheck boolean is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation")); } private boolean getNeedsRecordLinkageCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( - () -> new IllegalArgumentException( - "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + return getTaskHelper() + .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE) + .orElseThrow( + () -> new IllegalArgumentException("NeedsRecordLinkage boolean is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation")); } private BloomFilterConfig getBloomFilterConfig(Task task) { return BloomFilterConfig.fromBytes(getTaskHelper() .getFirstInputParameterByteValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG).orElseThrow( - () -> new IllegalArgumentException( - "BloomFilterConfig byte[] is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation"))); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG) + .orElseThrow(() -> new IllegalArgumentException("BloomFilterConfig byte[] is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation"))); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java index 47e8ded1..d72ecaeb 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; @@ -66,10 +66,10 @@ private IdType getResearchStudyId(Task task) { Reference researchStudyReference = getTaskHelper() .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE).findFirst().orElseThrow( - () -> new IllegalArgumentException( - "ResearchStudy reference is not set in task with id='" + task.getId() - + "', this error should have been caught by resource validation")); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("ResearchStudy reference is not set in task with id='" + + task.getId() + "', this error should have been caught by resource validation")); return new IdType(researchStudyReference.getReference()); } @@ -90,19 +90,20 @@ private ResearchStudy getResearchStudy(IdType researchStudyid, FhirWebserviceCli private boolean getNeedsConsentCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK).orElseThrow( - () -> new IllegalArgumentException( - "NeedsConsentCheck boolean is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + return getTaskHelper() + .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK) + .orElseThrow(() -> new IllegalArgumentException("NeedsConsentCheck boolean is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation")); } private boolean getNeedsRecordLinkageCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( - () -> new IllegalArgumentException( - "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + return getTaskHelper() + .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE) + .orElseThrow( + () -> new IllegalArgumentException("NeedsRecordLinkage boolean is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation")); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java index 0cae1c22..c2dd892a 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -51,7 +51,7 @@ protected void doExecute(DelegateExecution execution) throws Exception private void executeQuery(String cohortId, String cohortQuery) { // TODO We might want to introduce a more complex result type to represent a count, - // errors and possible meta-data. + // errors and possible meta-data. ResultSet resultSet = openehrClient.query(cohortQuery, null); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExtractQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExtractQueries.java index cf77f92a..c7392823 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExtractQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExtractQueries.java @@ -43,7 +43,8 @@ protected void doExecute(DelegateExecution execution) throws Exception // <groupId, query> Map<String, String> queries = new HashMap<>(); - cohorts.forEach(group -> { + cohorts.forEach(group -> + { String aqlQuery = groupHelper.extractAqlQuery(group); String groupId = group.getId(); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java index dcb0dead..05a5de5e 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java @@ -50,13 +50,16 @@ private Map<String, String> modifyQueries(Map<String, String> queries) { Map<String, String> modifiedQueries = new HashMap<>(); - for (Map.Entry<String, String> entry : queries.entrySet()) { + for (Map.Entry<String, String> entry : queries.entrySet()) + { String query = entry.getValue(); // TODO Implement correct check for default id query - if (!query.startsWith("SELECT e" + ehrIdColumnPath + " as EHRID")) { + if (!query.startsWith("SELECT e" + ehrIdColumnPath + " as EHRID")) + { query = query.replace("SELECT", "SELECT e" + ehrIdColumnPath + " as EHRID,"); - logger.warn("Query does not start with '{}', adapting SELECT statement", "SELECT e" + ehrIdColumnPath + " as EHRID"); + logger.warn("Query does not start with '{}', adapting SELECT statement", + "SELECT e" + ehrIdColumnPath + " as EHRID"); } modifiedQueries.put(entry.getKey(), query); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index 0bb864fd..33aa5e29 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -2,8 +2,8 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_TTP; @@ -99,10 +99,10 @@ private Target getTtpTarget(ResearchStudy researchStudy) { return researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP).stream() .filter(e -> e.getValue() instanceof Reference).map(e -> (Reference) e.getValue()) - .map(r -> Target.createUniDirectionalTarget(r.getIdentifier().getValue())).findFirst().orElseThrow( - () -> new IllegalArgumentException( - "Participating TTP is not set in ResearchStudy with id='" + researchStudy.getId() - + "', this error should " + "have been caught by resource validation")); + .map(r -> Target.createUniDirectionalTarget(r.getIdentifier().getValue())).findFirst() + .orElseThrow(() -> new IllegalArgumentException( + "Participating TTP is not set in ResearchStudy with id='" + researchStudy.getId() + + "', this error should " + "have been caught by resource validation")); } private BloomFilterConfig createBloomFilterConfig() diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java index 23ece239..830c03ee 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java @@ -47,8 +47,10 @@ protected void doExecute(DelegateExecution execution) private String getCorrelationKey() { Task task = getCurrentTaskFromExecutionVariables(); - return getTaskHelper().getFirstInputParameterStringValue(task, CODESYSTEM_HIGHMED_BPMN, - CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY).orElseThrow(() -> new IllegalStateException( - "No correlation key found, this error should have been caught by resource validation")); + return getTaskHelper() + .getFirstInputParameterStringValue(task, CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY) + .orElseThrow(() -> new IllegalStateException( + "No correlation key found, this error should have been caught by resource validation")); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java index 5e0c9847..566f0f7b 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java @@ -30,8 +30,9 @@ protected void doExecute(DelegateExecution execution) { Task task = getCurrentTaskFromExecutionVariables(); - List<Target> targets = getTaskHelper().getInputParameterStringValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY) + List<Target> targets = getTaskHelper() + .getInputParameterStringValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY) .map(correlationKey -> Target.createBiDirectionalTarget("", correlationKey)) .collect(Collectors.toList()); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(new Targets(targets))); @@ -42,10 +43,11 @@ protected void doExecute(DelegateExecution execution) private boolean getNeedsRecordLinkageCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( - () -> new IllegalArgumentException( - "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + return getTaskHelper() + .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE) + .orElseThrow( + () -> new IllegalArgumentException("NeedsRecordLinkage boolean is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation")); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java index 867d23a2..e4d117cb 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java @@ -52,13 +52,8 @@ public static BloomFilterConfig fromBytes(byte[] bytes) } @JsonCreator - public BloomFilterConfig( - @JsonProperty("permutationSeed") - long permutationSeed, - @JsonProperty("hmacSha2Key") - Key hmacSha2Key, - @JsonProperty("hmacSha3Key") - Key hmacSha3Key) + public BloomFilterConfig(@JsonProperty("permutationSeed") long permutationSeed, + @JsonProperty("hmacSha2Key") Key hmacSha2Key, @JsonProperty("hmacSha3Key") Key hmacSha3Key) { this.permutationSeed = permutationSeed; this.hmacSha2Key = hmacSha2Key; @@ -104,8 +99,8 @@ private static byte[] longToBigEndian(long l) private static long bigEndianToLong(byte[] b) { - return (((long) b[0] << 56) + ((long) (b[1] & 255) << 48) + ((long) (b[2] & 255) << 40) + ((long) (b[3] & 255) - << 32) + ((long) (b[4] & 255) << 24) + ((b[5] & 255) << 16) + ((b[6] & 255) << 8) + ((b[7] & 255) - << 0)); + return (((long) b[0] << 56) + ((long) (b[1] & 255) << 48) + ((long) (b[2] & 255) << 40) + + ((long) (b[3] & 255) << 32) + ((long) (b[4] & 255) << 24) + ((b[5] & 255) << 16) + ((b[6] & 255) << 8) + + ((b[7] & 255) << 0)); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java index 0173ac3a..111a0c07 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfigSerializer.java @@ -58,9 +58,8 @@ public BloomFilterConfigValue readValue(ValueFields valueFields, boolean asTrans try { - BloomFilterConfig target = (bytes == null || bytes.length <= 0) ? - null : - objectMapper.readValue(bytes, BloomFilterConfig.class); + BloomFilterConfig target = (bytes == null || bytes.length <= 0) ? null + : objectMapper.readValue(bytes, BloomFilterConfig.class); return BloomFilterConfigValues.create(target); } catch (IOException e) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultsValues.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultsValues.java index 88b274be..0171b353 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultsValues.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResultsValues.java @@ -37,8 +37,7 @@ private FeasibilityQueryResultsValueTypeImpl() @Override public TypedValue createValue(Object value, Map<String, Object> valueInfo) { - return new QueryResultsValues.FeasibilityQueryResultsValueImpl((QueryResults) value, - VALUE_TYPE); + return new QueryResultsValues.FeasibilityQueryResultsValueImpl((QueryResults) value, VALUE_TYPE); } } diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java index 4bafd7db..39f864d2 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -43,22 +43,16 @@ public class RequestDataSharingFromMedicsViaMedic1ExampleStarter { - private static final String QUERY = - "SELECT " - + "e/ehr_status/subject/external_ref/id/value as EHRID, " - + "v/items[at0024,'Bezeichnung']/value, " - + "v/items [at0001,'Messwert'], " - + "v/items[at0006,'Dokumentationsdatum Untersuchung']/value " - + "FROM EHR e " - + "CONTAINS COMPOSITION c " + private static final String QUERY = "SELECT " + "e/ehr_status/subject/external_ref/id/value as EHRID, " + + "v/items[at0024,'Bezeichnung']/value, " + "v/items [at0001,'Messwert'], " + + "v/items[at0006,'Dokumentationsdatum Untersuchung']/value " + "FROM EHR e " + "CONTAINS COMPOSITION c " + "CONTAINS CLUSTER v[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1] " - + "WHERE v/items[at0024,'Bezeichnung']/value/value = 'Natrium' " - + "OFFSET 0 LIMIT 15"; + + "WHERE v/items[at0024,'Bezeichnung']/value/value = 'Natrium' " + "OFFSET 0 LIMIT 15"; // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate - // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate - // password + // password public static void main(String[] args) throws Exception { Bundle bundle = createStartResource(); @@ -116,21 +110,21 @@ private static ResearchStudy createResearchStudy(Group group1, Group group2) researchStudy.addEnrollment().setReference(group1.getIdElement().getIdPart()); researchStudy.addEnrollment().setReference(group2.getIdElement().getIdPart()); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( - new Reference().setType(ResourceType.Organization.name()).setIdentifier( - new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) + .setValue(new Reference().setType(ResourceType.Organization.name()) + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1))); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( - new Reference().setType(ResourceType.Organization.name()).setIdentifier( - new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) + .setValue(new Reference().setType(ResourceType.Organization.name()) + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2))); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( - new Reference().setType(ResourceType.Organization.name()).setIdentifier( - new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) + .setValue(new Reference().setType(ResourceType.Organization.name()) + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3))); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP).setValue( - new Reference().setType(ResourceType.Organization.name()).setIdentifier( - new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP) + .setValue(new Reference().setType(ResourceType.Organization.name()) + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP))); return researchStudy; @@ -157,9 +151,10 @@ private static Task createTask(ResearchStudy researchStudy) task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME)).getType() .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); - task.addInput().setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart()) - .setType(ResourceType.ResearchStudy.name())).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + task.addInput() + .setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart()) + .setType(ResourceType.ResearchStudy.name())) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); diff --git a/dsf-bpe-process-feasibility/pom.xml b/dsf-bpe-process-feasibility/pom.xml index 7c0c52fb..fe745a2b 100644 --- a/dsf-bpe-process-feasibility/pom.xml +++ b/dsf-bpe-process-feasibility/pom.xml @@ -11,6 +11,10 @@ <groupId>org.highmed.dsf</groupId> <version>0.5.0-SNAPSHOT</version> </parent> + + <properties> + <main.basedir>${project.basedir}/..</main.basedir> + </properties> <dependencies> <dependency> diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java index 369d4919..d84edc8e 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java @@ -15,22 +15,22 @@ public interface ConstantsFeasibility String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-request-feasibility"; String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestFeasibility/"; - String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = - PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI + VERSION; + String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI + + VERSION; String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MESSAGE_NAME = "requestFeasibilityMessage"; String PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "localServicesIntegration/"; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-execute-feasibility"; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "executeFeasibility/"; - String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = - PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI + VERSION; + String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI + + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MESSAGE_NAME = "executeFeasibilityMessage"; String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-compute-feasibility"; String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "computeFeasibility/"; - String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = - PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI + VERSION; + String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI + + VERSION; String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_MESSAGE_NAME = "computeFeasibilityMessage"; String PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility"; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java index 81921c31..328a497d 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java @@ -61,9 +61,8 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var aExe = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeFeasibility.xml"); var aReq = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-requestFeasibility.xml"); - var cDS = CodeSystemResource - .dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/CodeSystem/data-sharing", - DEPENDENCY_DATA_SHARING_VERSION); + var cDS = CodeSystemResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, + "http://highmed.org/fhir/CodeSystem/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); var sTCom = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-compute-feasibility.xml"); var sTErr = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-error-feasibility.xml"); @@ -74,17 +73,15 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var sTResS = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml"); - var vDS = ValueSetResource - .dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/ValueSet/data-sharing", - DEPENDENCY_DATA_SHARING_VERSION); + var vDS = ValueSetResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, + "http://highmed.org/fhir/ValueSet/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); - Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map - .of("computeFeasibility/" + VERSION, Arrays.asList(aCom, cDS, sTCom, sTResS, vDS), - "executeFeasibility/" + VERSION, Arrays.asList(aExe, cDS, sTExe, vDS), - "requestFeasibility/" + VERSION, Arrays.asList(aReq, cDS, sTReq, sTResM, sTErr, vDS)); + Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of("computeFeasibility/" + VERSION, + Arrays.asList(aCom, cDS, sTCom, sTResS, vDS), "executeFeasibility/" + VERSION, + Arrays.asList(aExe, cDS, sTExe, vDS), "requestFeasibility/" + VERSION, + Arrays.asList(aReq, cDS, sTReq, sTResM, sTErr, vDS)); - return ResourceProvider - .read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, - resourcesByProcessKeyAndVersion); + return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), + classLoader, resourcesByProcessKeyAndVersion); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java index f8528ed8..20f087c2 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java @@ -45,14 +45,12 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut new Reference().setReference(researchStudyId.toVersionless().getValueAsString())); boolean needsConsentCheck = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); - ParameterComponent inputNeedsConsentCheck = getTaskHelper() - .createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK, - needsConsentCheck); + ParameterComponent inputNeedsConsentCheck = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK, needsConsentCheck); boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); - ParameterComponent inputNeedsRecordLinkage = getTaskHelper() - .createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, - needsRecordLinkage); + ParameterComponent inputNeedsRecordLinkage = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); if (needsRecordLinkage) { diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java index 999e44dc..4735ae64 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java @@ -30,13 +30,13 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut { Task task = getLeadingTaskFromExecutionVariables(); - String taskUrl = new Reference(new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl() + "/Task" , task.getIdElement().getIdPart())) - .getReference(); + String taskUrl = new Reference(new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl() + "/Task", + task.getIdElement().getIdPart())).getReference(); - Task.ParameterComponent input = getTaskHelper() - .createInput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, - "An error occurred while calculating the multi medic feasibility result for " - + "all defined cohorts, see task with url='" + taskUrl + "'"); + Task.ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, + "An error occurred while calculating the multi medic feasibility result for " + + "all defined cohorts, see task with url='" + taskUrl + "'"); return Stream.of(input); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java index 7ac90703..dd5d5efa 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java @@ -48,16 +48,12 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut private Stream<ParameterComponent> toInputs(FinalFeasibilityQueryResult result) { - ParameterComponent input1 = getTaskHelper() - .createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT, - result.getCohortSize()); + ParameterComponent input1 = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT, result.getCohortSize()); input1.addExtension(createCohortIdExtension(result.getCohortId())); - ParameterComponent input2 = getTaskHelper() - .createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS, - result.getParticipatingMedics()); + ParameterComponent input2 = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS, result.getParticipatingMedics()); input2.addExtension(createCohortIdExtension(result.getCohortId())); return Stream.of(input1, input2); @@ -79,10 +75,10 @@ private Stream<ParameterComponent> getErrorInput(DelegateExecution execution) String taskUrl = new Reference(new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl() + "/Task", task.getIdElement().getIdPart())).getReference(); - Task.ParameterComponent input = getTaskHelper() - .createInput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, - "Errors occurred for missing cohorts while calculating their multi medic feasibility " - + "result, see task with url='" + taskUrl + "'"); + Task.ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, + "Errors occurred for missing cohorts while calculating their multi medic feasibility " + + "result, see task with url='" + taskUrl + "'"); return Stream.of(input); } @@ -91,8 +87,9 @@ private Stream<ParameterComponent> getErrorInput(DelegateExecution execution) private boolean hasErrorOutput(List<Task.TaskOutputComponent> outputs) { - return outputs.stream().anyMatch(output -> output.getType().getCoding().stream().anyMatch( - coding -> coding.getSystem().equals(CODESYSTEM_HIGHMED_BPMN) && coding.getCode() - .equals(CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR))); + return outputs.stream() + .anyMatch(output -> output.getType().getCoding().stream() + .anyMatch(coding -> coding.getSystem().equals(CODESYSTEM_HIGHMED_BPMN) + && coding.getCode().equals(CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR))); } } \ No newline at end of file diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java index a1c7bc0d..0f2946dc 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -37,8 +37,7 @@ public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskH @Override protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { - QueryResults results = (QueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); return results.getResults().stream().map(result -> toInput(result)); } @@ -62,11 +61,11 @@ else if (result.isIdResultSetUrlResult()) } else { - logger.warn("Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + result - .getCohortId()); + logger.warn("Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + + result.getCohortId()); throw new RuntimeException( - "Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + result - .getCohortId()); + "Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + + result.getCohortId()); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java index 87259dd7..ff961d7a 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java @@ -37,9 +37,9 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE target.getCorrelationKey())); boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); - Task.ParameterComponent inputNeedsRecordLinkage = getTaskHelper() - .createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, - needsRecordLinkage); + + Task.ParameterComponent inputNeedsRecordLinkage = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); return Stream.concat(inputTargets, Stream.of(inputNeedsRecordLinkage)); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java index c07596a7..4cdcb7e2 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java @@ -27,8 +27,8 @@ public CalculateMultiMedicResults(FhirWebserviceClientProvider clientProvider, T @Override protected void doExecute(DelegateExecution execution) throws Exception { - List<QueryResult> results = ((QueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS)).getResults(); + List<QueryResult> results = ((QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS)) + .getResults(); List<FinalFeasibilityQueryResult> finalResults = calculateResults(results); @@ -41,9 +41,10 @@ private List<FinalFeasibilityQueryResult> calculateResults(List<QueryResult> res Map<String, List<QueryResult>> byCohortId = results.stream() .collect(Collectors.groupingBy(QueryResult::getCohortId)); - return byCohortId.entrySet().stream().map(e -> new FinalFeasibilityQueryResult(e.getKey(), - toInt(e.getValue().stream().filter(r -> r.getCount() > 0).count()), - toInt(e.getValue().stream().mapToLong(QueryResult::getCount).sum()))) + return byCohortId.entrySet().stream() + .map(e -> new FinalFeasibilityQueryResult(e.getKey(), + toInt(e.getValue().stream().filter(r -> r.getCount() > 0).count()), + toInt(e.getValue().stream().mapToLong(QueryResult::getCount).sum()))) .collect(Collectors.toList()); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java index ded79d20..95546235 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityResources.java @@ -48,8 +48,8 @@ private void checkNumberOfParticipatingMedics(ResearchStudy researchStudy) if (medics < MIN_PARTICIPATING_MEDICS_FOR_FEASIBILITY) { - throw new RuntimeException( - "Number of distinct participanting MeDICs is < " + MIN_PARTICIPATING_MEDICS_FOR_FEASIBILITY + ", got " + medics); + throw new RuntimeException("Number of distinct participanting MeDICs is < " + + MIN_PARTICIPATING_MEDICS_FOR_FEASIBILITY + ", got " + medics); } } @@ -66,8 +66,8 @@ private void checkNumberOfCohortDefinitions(List<Group> cohorts) int size = cohorts.size(); if (size < MIN_COHORT_DEFINITIONS_FOR_FEASIBILITY) { - throw new RuntimeException( - "Number of defined cohorts is < " + MIN_COHORT_DEFINITIONS_FOR_FEASIBILITY + ", got " + cohorts.size()); + throw new RuntimeException("Number of defined cohorts is < " + MIN_COHORT_DEFINITIONS_FOR_FEASIBILITY + + ", got " + cohorts.size()); } } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java index c8a65670..2c8c69f3 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java @@ -51,21 +51,22 @@ protected void doExecute(DelegateExecution execution) throws Exception private void addFinalFeasibilityQueryErrorsToLeadingTask(Task toRead, Task toWrite) { - toRead.getInput().stream().filter(in -> in.hasType() && in.getType().hasCoding() && CODESYSTEM_HIGHMED_BPMN - .equals(in.getType().getCodingFirstRep().getSystem()) && CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR - .equals(in.getType().getCodingFirstRep().getCode())).forEach(in -> toWrite.getOutput() - .add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, - in.getValue().primitiveValue()))); + toRead.getInput().stream() + .filter(in -> in.hasType() && in.getType().hasCoding() + && CODESYSTEM_HIGHMED_BPMN.equals(in.getType().getCodingFirstRep().getSystem()) + && CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR.equals(in.getType().getCodingFirstRep().getCode())) + .forEach(in -> toWrite.getOutput().add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, in.getValue().primitiveValue()))); } private FinalFeasibilityQueryResults readFinalFeasibilityQueryResultsFromCurrentTask(Task task) { List<FinalFeasibilityQueryResult> results = task.getInput().stream() - .filter(in -> in.hasType() && in.getType().hasCoding() && CODESYSTEM_HIGHMED_DATA_SHARING - .equals(in.getType().getCodingFirstRep().getSystem()) + .filter(in -> in.hasType() && in.getType().hasCoding() + && CODESYSTEM_HIGHMED_DATA_SHARING.equals(in.getType().getCodingFirstRep().getSystem()) && CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT - .equals(in.getType().getCodingFirstRep().getCode())).map(in -> toResult(task, in)) - .collect(Collectors.toList()); + .equals(in.getType().getCodingFirstRep().getCode())) + .map(in -> toResult(task, in)).collect(Collectors.toList()); return new FinalFeasibilityQueryResults(results); } @@ -79,14 +80,13 @@ private FinalFeasibilityQueryResult toResult(Task task, ParameterComponent in) private int getParticipatingMedicsCountByCohortId(Task task, String cohortId) { - return task.getInput().stream() - .filter(in -> in.hasType() && in.getType().hasCoding() && CODESYSTEM_HIGHMED_DATA_SHARING - .equals(in.getType().getCodingFirstRep().getSystem()) - && CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS - .equals(in.getType().getCodingFirstRep().getCode()) && cohortId - .equals(((Reference) in.getExtensionByUrl(EXTENSION_HIGHMED_GROUP_ID).getValue()) - .getReference())).mapToInt(in -> ((UnsignedIntType) in.getValue()).getValue()) - .findFirst().getAsInt(); + return task.getInput().stream().filter(in -> in.hasType() && in.getType().hasCoding() + && CODESYSTEM_HIGHMED_DATA_SHARING.equals(in.getType().getCodingFirstRep().getSystem()) + && CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS + .equals(in.getType().getCodingFirstRep().getCode()) + && cohortId.equals( + ((Reference) in.getExtensionByUrl(EXTENSION_HIGHMED_GROUP_ID).getValue()).getReference())) + .mapToInt(in -> ((UnsignedIntType) in.getValue()).getValue()).findFirst().getAsInt(); } protected FinalFeasibilityQueryResults checkResults(FinalFeasibilityQueryResults results) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java index b60fe36a..163bff77 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java @@ -51,20 +51,20 @@ protected void doExecute(DelegateExecution execution) throws Exception Map<String, String> queries = new HashMap<>(); Task leadingTask = getLeadingTaskFromExecutionVariables(); - cohorts.forEach(group -> { + cohorts.forEach(group -> + { String aqlQuery = groupHelper.extractAqlQuery(group).toLowerCase(); String groupId = group.getId(); if (!aqlQuery.startsWith(FEASIBILITY_QUERY_PREFIX)) { - String errorMessage = - "Single medic feasibility query check failed, wrong format for query of group with id '" - + groupId + "', expected query to start with '" + FEASIBILITY_QUERY_PREFIX - + "' but got '" + aqlQuery + "'"; + String errorMessage = "Single medic feasibility query check failed, wrong format for query of group with id '" + + groupId + "', expected query to start with '" + FEASIBILITY_QUERY_PREFIX + "' but got '" + + aqlQuery + "'"; logger.info(errorMessage); - leadingTask.getOutput().add(getTaskHelper() - .createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage)); + leadingTask.getOutput().add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage)); } else { diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java index 5bc21eb4..09fd7eb2 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java @@ -30,8 +30,7 @@ public CheckSingleMedicResults(FhirWebserviceClientProvider clientProvider, Task @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); Task currentTask = getCurrentTaskFromExecutionVariables(); List<QueryResult> filteredResults = filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(results, @@ -43,8 +42,7 @@ protected void doExecute(DelegateExecution execution) throws Exception QueryResultsValues.create(new QueryResults(filteredResults))); } - private List<QueryResult> filterErroneousResultsAndAddErrorsToCurrentTaskOutputs( - QueryResults results, Task task) + private List<QueryResult> filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(QueryResults results, Task task) { List<QueryResult> filteredResults = new ArrayList<>(); for (QueryResult result : results.getResults()) @@ -72,8 +70,7 @@ private void addError(Task task, String cohortId, String error) String errorMessage = "Feasibility query result check failed for group with id '" + cohortId + "': " + error; logger.info(errorMessage); - task.getOutput().add(getTaskHelper() - .createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN, ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, - errorMessage)); + task.getOutput().add(getTaskHelper().createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN, + ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage)); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java index c5ac4ba9..c02f3b0d 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java @@ -4,8 +4,8 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_RESULT; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_RESULT; import static org.highmed.dsf.bpe.ConstantsFeasibility.MIN_PARTICIPATING_MEDICS_FOR_FEASIBILITY; import java.util.List; @@ -61,15 +61,16 @@ private List<FinalFeasibilityQueryResult> filterResultsByParticipatingMedics(Tas String correlationKey = getTaskHelper().getFirstInputParameterStringValue(leadingTask, CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY).orElse(null); - return results.getResults().stream().filter(result -> { + return results.getResults().stream().filter(result -> + { if (result.getParticipatingMedics() < MIN_PARTICIPATING_MEDICS_FOR_FEASIBILITY) { logger.warn("Removed result with cohort id='{}' from feasibility request with task-id='{}', " - + "business-key='{}' and correlation-key='{}' because of not enough participating MeDICs", + + "business-key='{}' and correlation-key='{}' because of not enough participating MeDICs", result.getCohortId(), taskId, businessKey, correlationKey); - leadingTask.getOutput().add(getTaskHelper() - .createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, + leadingTask.getOutput() + .add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, "Removed result with cohort id='" + result.getCohortId() + "' from feasibility request because of not enough participating MeDICs")); @@ -90,12 +91,13 @@ private boolean checkIfAtLeastOneResultExists(Task leadingTask, List<FinalFeasib if (results.size() < 1) { - logger.warn("Did not receive enough results from participating MeDICs for any cohort definition in the " - + "feasibility request with task-id='{}', business-key='{}' " + "and correlation-key='{}'", taskId, - businessKey, correlationKey); + logger.warn( + "Did not receive enough results from participating MeDICs for any cohort definition in the " + + "feasibility request with task-id='{}', business-key='{}' " + "and correlation-key='{}'", + taskId, businessKey, correlationKey); - leadingTask.getOutput().add(getTaskHelper() - .createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, + leadingTask.getOutput() + .add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, "Did not receive enough results from participating MeDICs for any cohort definition")); return false; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java index 110eea18..44db9431 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityResources.java @@ -94,17 +94,16 @@ protected void doExecute(DelegateExecution execution) throws Exception private IdType getResearchStudyId(Task task) { - Reference researchStudyReference = getTaskHelper() - .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE).findFirst().get(); - + Reference researchStudyReference = getTaskHelper().getInputParameterReferenceValues(task, + CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE) + .findFirst().get(); return new IdType(researchStudyReference.getReference()); } private FhirWebserviceClient getWebserviceClient(IdType researchStudyId) { - if (researchStudyId.getBaseUrl() == null || researchStudyId.getBaseUrl() - .equals(getFhirWebserviceClientProvider().getLocalBaseUrl())) + if (researchStudyId.getBaseUrl() == null + || researchStudyId.getBaseUrl().equals(getFhirWebserviceClientProvider().getLocalBaseUrl())) { return getFhirWebserviceClientProvider().getLocalWebserviceClient(); } @@ -126,8 +125,8 @@ private Bundle getResearchStudyAndCohortDefinitions(IdType researchStudyId, Fhir { throw new RuntimeException("Returned search-set contained less then two entries"); } - else if (!bundle.getEntryFirstRep().hasResource() || !(bundle.getEntryFirstRep() - .getResource() instanceof ResearchStudy)) + else if (!bundle.getEntryFirstRep().hasResource() + || !(bundle.getEntryFirstRep().getResource() instanceof ResearchStudy)) { throw new RuntimeException("Returned search-set did not contain ResearchStudy at index == 0"); } @@ -149,7 +148,8 @@ else if (bundle.getEntry().stream().skip(1).map(c -> c.hasResource() && c.getRes private List<Group> getCohortDefinitions(Bundle bundle, String baseUrl) { - return bundle.getEntry().stream().skip(1).map(e -> { + return bundle.getEntry().stream().skip(1).map(e -> + { Group group = (Group) e.getResource(); IdType oldId = group.getIdElement(); group.setIdElement( @@ -167,29 +167,29 @@ private String getTtpIdentifier(ResearchStudy researchStudy, FhirWebserviceClien private boolean getNeedsConsentCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK).orElseThrow( - () -> new IllegalArgumentException( - "NeedsConsentCheck boolean is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + return getTaskHelper() + .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK) + .orElseThrow(() -> new IllegalArgumentException("NeedsConsentCheck boolean is not set in task with id='" + + task.getId() + "', this error should have been caught by resource validation")); } private boolean getNeedsRecordLinkageCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( - () -> new IllegalArgumentException( - "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + return getTaskHelper() + .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE) + .orElseThrow( + () -> new IllegalArgumentException("NeedsRecordLinkage boolean is not set in task with id='" + + task.getId() + "', this error should have been caught by resource validation")); } private BloomFilterConfig getBloomFilterConfig(Task task) { return BloomFilterConfig.fromBytes(getTaskHelper() .getFirstInputParameterByteValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG).orElseThrow( - () -> new IllegalArgumentException( - "BloomFilterConfig byte[] is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation"))); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG) + .orElseThrow(() -> new IllegalArgumentException("BloomFilterConfig byte[] is not set in task with id='" + + task.getId() + "', this error should have been caught by resource validation"))); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java index 5d15ac25..08bb929b 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -75,10 +75,10 @@ private IdType getResearchStudyId(Task task) { Reference researchStudyReference = getTaskHelper() .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE).findFirst().orElseThrow( - () -> new IllegalArgumentException( - "ResearchStudy reference is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("ResearchStudy reference is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation")); return new IdType(researchStudyReference.getReference()); } @@ -113,15 +113,15 @@ private ResearchStudy addMissingOrganizations(ResearchStudy researchStudy, FhirW if (!identifiers.isEmpty()) { - identifiers.forEach(identifier -> { + identifiers.forEach(identifier -> + { logger.warn( "Adding missing organization with identifier='{}' to feasibility research study with id='{}'", identifier, researchStudy.getId()); researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( - new Reference().setType(ResourceType.Organization.name()).setIdentifier( - new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - .setValue(identifier))); + new Reference().setType(ResourceType.Organization.name()).setIdentifier(new Identifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(identifier))); }); @@ -146,19 +146,20 @@ private ResearchStudy update(ResearchStudy researchStudy, FhirWebserviceClient c private boolean getNeedsConsentCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK).orElseThrow( - () -> new IllegalArgumentException( - "NeedsConsentCheck boolean is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + return getTaskHelper() + .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK) + .orElseThrow(() -> new IllegalArgumentException("NeedsConsentCheck boolean is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation")); } private boolean getNeedsRecordLinkageCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( - () -> new IllegalArgumentException( - "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + return getTaskHelper() + .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE) + .orElseThrow( + () -> new IllegalArgumentException("NeedsRecordLinkage boolean is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation")); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java index 2ae6d711..f2c4212f 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java @@ -51,8 +51,7 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); List<QueryResult> resultsWithResultSets = download(results); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java index b5c72749..618fc0f4 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -50,13 +50,10 @@ protected void doExecute(DelegateExecution execution) throws Exception { // <groupId, query> @SuppressWarnings("unchecked") - Map<String, String> queries = (Map<String, String>) execution - .getVariable(BPMN_EXECUTION_VARIABLE_QUERIES); + Map<String, String> queries = (Map<String, String>) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERIES); - Boolean needsConsentCheck = (Boolean) execution - .getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); - Boolean needsRecordLinkage = (Boolean) execution - .getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); + Boolean needsConsentCheck = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); + Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); boolean idQuery = Boolean.TRUE.equals(needsConsentCheck) || Boolean.TRUE.equals(needsRecordLinkage); List<QueryResult> results = queries.entrySet().stream() @@ -69,7 +66,7 @@ protected void doExecute(DelegateExecution execution) throws Exception private QueryResult executeQuery(String cohortId, String cohortQuery, boolean idQuery) { // TODO We might want to introduce a more complex result type to represent a count, - // errors and possible meta-data. + // errors and possible meta-data. ResultSet resultSet = openehrClient.query(cohortQuery, null); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java index 0d7fe6b2..bd6d6963 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java @@ -51,8 +51,7 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); Map<String, List<QueryResult>> byCohortId = results.getResults().stream() .collect(Collectors.groupingBy(QueryResult::getCohortId)); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java index c6c033c0..2c94ac2d 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java @@ -24,8 +24,7 @@ public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); List<QueryResult> filteredResults = filterResults(results.getResults()); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java index 1b7271d9..f2aaebc8 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -83,8 +83,7 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); String securityIdentifier = getSecurityIdentifier(execution); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java index 95254679..d7aa6cbf 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java @@ -23,8 +23,7 @@ public GenerateCountFromIds(FhirWebserviceClientProvider clientProvider, TaskHel @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); List<QueryResult> filteredResults = count(results.getResults()); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java index c00384c4..6b55accd 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java @@ -20,10 +20,11 @@ protected void doExecute(DelegateExecution execution) throws Exception Task currentTask = getCurrentTaskFromExecutionVariables(); Task leadingTask = getLeadingTaskFromExecutionVariables(); - currentTask.getInput().forEach(input -> { - boolean isErrorInput = input.getType().getCoding().stream().anyMatch( - code -> code.getSystem().equals(ConstantsBase.CODESYSTEM_HIGHMED_BPMN) && code.getCode() - .equals(ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR)); + currentTask.getInput().forEach(input -> + { + boolean isErrorInput = input.getType().getCoding().stream() + .anyMatch(code -> code.getSystem().equals(ConstantsBase.CODESYSTEM_HIGHMED_BPMN) + && code.getCode().equals(ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR)); if (isErrorInput) { diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java index 8cc7bdeb..21d7a7c0 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java @@ -48,9 +48,10 @@ private String getCorrelationKey(DelegateExecution execution) { Task task = getCurrentTaskFromExecutionVariables(); - return getTaskHelper().getFirstInputParameterStringValue(task, ConstantsBase.CODESYSTEM_HIGHMED_BPMN, - ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY).orElseThrow( - () -> new IllegalStateException( + return getTaskHelper() + .getFirstInputParameterStringValue(task, ConstantsBase.CODESYSTEM_HIGHMED_BPMN, + ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY) + .orElseThrow(() -> new IllegalStateException( "No correlation key found, this error should have been caught by resource validation")); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java index 4afb27ab..76bba58d 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java @@ -33,27 +33,28 @@ protected void doExecute(DelegateExecution execution) throws Exception { Task task = getCurrentTaskFromExecutionVariables(); - List<Target> targets = getTaskHelper().getInputParameterStringValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY) + List<Target> targets = getTaskHelper() + .getInputParameterStringValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY) .map(correlationKey -> Target.createBiDirectionalTarget("", correlationKey)) .collect(Collectors.toList()); - execution - .setVariable(ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(new Targets(targets))); + execution.setVariable(ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS, + TargetsValues.create(new Targets(targets))); boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - QueryResultsValues.create(new QueryResults(null))); + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(null))); } private boolean getNeedsRecordLinkageCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( - () -> new IllegalArgumentException( - "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + return getTaskHelper() + .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE) + .orElseThrow( + () -> new IllegalArgumentException("NeedsRecordLinkage boolean is not set in task with id='" + + task.getId() + "', this error should have been caught by resource validation")); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java index f4d86e6d..37468912 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java @@ -48,8 +48,7 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); boolean needsRecordLinkage = Boolean.TRUE .equals((Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE)); @@ -73,23 +72,26 @@ private List<QueryResult> getResults(Task task, boolean needsRecordLinkage) { return taskHelper.getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE, EXTENSION_HIGHMED_GROUP_ID) - .map(input -> { + .map(input -> + { String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); String resultSetUrl = ((Reference) input.getValue()).getReference(); - return QueryResult - .resultSet(requester.getIdentifier().getValue(), cohortId, resultSetUrl); + return QueryResult.resultSet(requester.getIdentifier().getValue(), cohortId, resultSetUrl); }).collect(Collectors.toList()); } else { - return taskHelper.getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT, EXTENSION_HIGHMED_GROUP_ID).map(input -> { - String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); - int cohortSize = ((UnsignedIntType) input.getValue()).getValue(); + return taskHelper + .getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT, EXTENSION_HIGHMED_GROUP_ID) + .map(input -> + { + String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); + int cohortSize = ((UnsignedIntType) input.getValue()).getValue(); - return QueryResult.count(requester.getIdentifier().getValue(), cohortId, cohortSize); - }).collect(Collectors.toList()); + return QueryResult.count(requester.getIdentifier().getValue(), cohortId, cohortSize); + }).collect(Collectors.toList()); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResults.java index a5905759..65f413db 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResults.java @@ -13,7 +13,8 @@ public class FinalFeasibilityQueryResults private final List<FinalFeasibilityQueryResult> results = new ArrayList<>(); @JsonCreator - public FinalFeasibilityQueryResults(@JsonProperty("results") Collection<? extends FinalFeasibilityQueryResult> results) + public FinalFeasibilityQueryResults( + @JsonProperty("results") Collection<? extends FinalFeasibilityQueryResult> results) { if (results != null) this.results.addAll(results); diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java index adc513f0..61f44897 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java @@ -3,17 +3,17 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsBase.CODE_TYPE_AQL_QUERY; +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_QUERY; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHEMD_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHMED_GROUP; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; -import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; -import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP; -import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHEMD_RESEARCH_STUDY; -import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHMED_GROUP; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION; @@ -48,9 +48,9 @@ public class RequestFeasibilityFromMedicsViaMedic1ExampleStarter { // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate - // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate - // password + // password public static void main(String[] args) throws Exception { Bundle bundle = createStartResource(); @@ -108,21 +108,21 @@ private static ResearchStudy createResearchStudy(Group group1, Group group2) researchStudy.addEnrollment().setReference(group1.getIdElement().getIdPart()); researchStudy.addEnrollment().setReference(group2.getIdElement().getIdPart()); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( - new Reference().setType(ResourceType.Organization.name()).setIdentifier( - new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) + .setValue(new Reference().setType(ResourceType.Organization.name()) + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1))); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( - new Reference().setType(ResourceType.Organization.name()).setIdentifier( - new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) + .setValue(new Reference().setType(ResourceType.Organization.name()) + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2))); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( - new Reference().setType(ResourceType.Organization.name()).setIdentifier( - new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) + .setValue(new Reference().setType(ResourceType.Organization.name()) + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3))); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP).setValue( - new Reference().setType(ResourceType.Organization.name()).setIdentifier( - new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP) + .setValue(new Reference().setType(ResourceType.Organization.name()) + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP))); return researchStudy; @@ -147,9 +147,11 @@ private static Task createTask(ResearchStudy researchStudy) task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MESSAGE_NAME)).getType() .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); - task.addInput().setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart()) - .setType(ResourceType.ResearchStudy.name())).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + + task.addInput() + .setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart()) + .setType(ResourceType.ResearchStudy.name())) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index 192fd55a..13dbda34 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -108,7 +108,8 @@ public void testTaskRequestFeasibilityValidWithOutput() throws Exception outParticipatingMedics1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); TaskOutputComponent outMultiMedicResult1 = task.addOutput(); outMultiMedicResult1.setValue(new UnsignedIntType(25)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING).setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT); + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT); outMultiMedicResult1.addExtension("http://highmed.org/fhir/StructureDefinition/extension-group-id", new Reference(groupId1)); @@ -148,9 +149,11 @@ private Task createValidTaskRequestFeasibility() task.addInput().setValue(new Reference("ResearchStudy/" + UUID.randomUUID().toString())).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); - task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + task.addInput().setValue(new BooleanType(false)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); - task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + task.addInput().setValue(new BooleanType(false)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); return task; @@ -206,9 +209,11 @@ private Task createValidTaskExecuteFeasibility() task.addInput().setValue(new Reference("ResearchStudy/" + UUID.randomUUID().toString())).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); - task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + task.addInput().setValue(new BooleanType(false)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); - task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + task.addInput().setValue(new BooleanType(false)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); return task; @@ -341,7 +346,8 @@ private Task createValidTaskComputeFeasibility() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY); - task.addInput().setValue(new BooleanType(false)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + task.addInput().setValue(new BooleanType(false)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); return task; diff --git a/dsf-bpe-process-local-services/pom.xml b/dsf-bpe-process-local-services/pom.xml index 2bd2fe72..eea76c3b 100644 --- a/dsf-bpe-process-local-services/pom.xml +++ b/dsf-bpe-process-local-services/pom.xml @@ -11,6 +11,10 @@ <groupId>org.highmed.dsf</groupId> <version>0.5.0-SNAPSHOT</version> </parent> + + <properties> + <main.basedir>${project.basedir}/..</main.basedir> + </properties> <dependencies> <dependency> diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java index 7dba0856..70562d56 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java @@ -6,7 +6,7 @@ public interface ConstantsLocalServices { String PROFILE_HIGHMED_TASK_LOCAL_SERVICES = "http://highmed.org/fhir/StructureDefinition/task-local-services-integration"; - String PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION = - PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI + VERSION; + String PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI + + VERSION; String PROFILE_HIGHMED_TASK_LOCAL_SERVICES_MESSAGE_NAME = "localServicesIntegrationMessage"; } diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java index 043770c5..f0eaf82e 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java @@ -46,7 +46,8 @@ public Stream<String> getBpmnFiles() @Override public Stream<Class<?>> getSpringConfigClasses() { - return Stream.of(LocalServicesConfig.class, FeasibilitySerializerConfig.class, DataSharingSerializerConfig.class); + return Stream.of(LocalServicesConfig.class, FeasibilitySerializerConfig.class, + DataSharingSerializerConfig.class); } @Override @@ -62,18 +63,15 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var sTL = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-local-services-integration.xml"); - var vF = ValueSetResource - .dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/ValueSet/data-sharing", - DEPENDENCY_DATA_SHARING_VERSION); - var cF = CodeSystemResource - .dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/CodeSystem/data-sharing", - DEPENDENCY_DATA_SHARING_VERSION); + var vF = ValueSetResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, + "http://highmed.org/fhir/ValueSet/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); + var cF = CodeSystemResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, + "http://highmed.org/fhir/CodeSystem/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map .of("localServicesIntegration/" + VERSION, Arrays.asList(aL, sTL, vF, cF)); - return ResourceProvider - .read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, - resourcesByProcessKeyAndVersion); + return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), + classLoader, resourcesByProcessKeyAndVersion); } } diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java index 08f27028..843e696e 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/ExtractInputValues.java @@ -69,7 +69,8 @@ private Stream<String> getQueries(Task task) private List<Group> getCohortDefinitions(Stream<String> queries) { - return queries.map(q -> { + return queries.map(q -> + { Group group = new Group(); group.setIdElement(new IdType(UUID.randomUUID().toString())); group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY) @@ -80,29 +81,29 @@ private List<Group> getCohortDefinitions(Stream<String> queries) private boolean getNeedsConsentCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK).orElseThrow( - () -> new IllegalArgumentException( - "NeedsConsentCheck boolean is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + return getTaskHelper() + .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK) + .orElseThrow(() -> new IllegalArgumentException("NeedsConsentCheck boolean is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation")); } private boolean getNeedsRecordLinkageCheck(Task task) { - return getTaskHelper().getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE).orElseThrow( - () -> new IllegalArgumentException( - "NeedsRecordLinkage boolean is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation")); + return getTaskHelper() + .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE) + .orElseThrow( + () -> new IllegalArgumentException("NeedsRecordLinkage boolean is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation")); } private BloomFilterConfig getBloomFilterConfig(Task task) { return BloomFilterConfig.fromBytes(getTaskHelper() .getFirstInputParameterByteValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG).orElseThrow( - () -> new IllegalArgumentException( - "BloomFilterConfig byte[] is not set in task with id='" + task.getId() - + "', this error should " + "have been caught by resource validation"))); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG) + .orElseThrow(() -> new IllegalArgumentException("BloomFilterConfig byte[] is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation"))); } } diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java index 818d1845..28da8c31 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java @@ -32,8 +32,7 @@ public StoreResult(FhirWebserviceClientProvider clientProvider, TaskHelper taskH protected void doExecute(DelegateExecution execution) throws Exception { Task task = getCurrentTaskFromExecutionVariables(); - QueryResults results = (QueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); addOutputs(task, results); } @@ -47,29 +46,28 @@ private void addOutput(Task task, QueryResult result) { if (result.isCohortSizeResult()) { - Task.TaskOutputComponent output = getTaskHelper() - .createOutputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT, - result.getCount()); + Task.TaskOutputComponent output = getTaskHelper().createOutputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT, result.getCount()); + output.addExtension(createCohortIdExtension(result.getCohortId())); task.addOutput(output); } else if (result.isIdResultSetUrlResult()) { - Task.TaskOutputComponent output = getTaskHelper() - .createOutput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE, - new Reference(result.getResultSetUrl())); + Task.TaskOutputComponent output = getTaskHelper().createOutput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE, + new Reference(result.getResultSetUrl())); + output.addExtension(createCohortIdExtension(result.getCohortId())); task.addOutput(output); } else { - logger.warn("Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + result - .getCohortId()); + logger.warn("Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + + result.getCohortId()); throw new RuntimeException( - "Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + result - .getCohortId()); + "Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + + result.getCohortId()); } } diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java index c351806a..1cee133b 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java @@ -40,13 +40,13 @@ public class LocalServicesConfig @Autowired private OrganizationProvider organizationProvider; - + @Autowired private TaskHelper taskHelper; @Autowired private GroupHelper groupHelper; - + @Autowired private ObjectMapper objectMapper; @@ -104,25 +104,25 @@ public BouncyCastleProvider bouncyCastleProvider() { return new BouncyCastleProvider(); } - + @Bean public GenerateCountFromIds generateCountFromIds() { return new GenerateCountFromIds(fhirClientProvider, taskHelper); } - + @Bean public ExecuteQueries executeQueries() { return new ExecuteQueries(fhirClientProvider, openEhrClient(), taskHelper, organizationProvider); } - + @Bean public OpenEhrClient openEhrClient() { return openEhrClientFactory.createClient(environment::getProperty); } - + @Bean public CheckQueries checkQueries() { diff --git a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java index 5972351d..e0889af5 100644 --- a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java +++ b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java @@ -21,7 +21,6 @@ import javax.crypto.KeyGenerator; import org.bouncycastle.jce.provider.BouncyCastleProvider; - import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.hl7.fhir.r4.model.Base64BinaryType; import org.hl7.fhir.r4.model.BooleanType; @@ -35,9 +34,9 @@ public class LocalServicesMedic1ExampleStarter private static boolean NEEDS_RECORD_LINKAGE = true; // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate - // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate - // password + // password public static void main(String[] args) throws Exception { Task task = createStartResource(); diff --git a/dsf-bpe-process-ping/pom.xml b/dsf-bpe-process-ping/pom.xml index 69b15b75..bff79a19 100644 --- a/dsf-bpe-process-ping/pom.xml +++ b/dsf-bpe-process-ping/pom.xml @@ -9,6 +9,10 @@ <artifactId>dsf-bpe-highmed-processes-pom</artifactId> <version>0.5.0-SNAPSHOT</version> </parent> + + <properties> + <main.basedir>${project.basedir}/..</main.basedir> + </properties> <dependencies> <dependency> diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java index fd3d32d4..b058d755 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java @@ -51,12 +51,10 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader .file("fhir/StructureDefinition/highmed-task-start-ping-process.xml"); var tPong = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-ping.xml"); - Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map - .of("ping/" + VERSION, Arrays.asList(aPing, tPong, tStartPing), "pong/" + VERSION, - Arrays.asList(aPong, tPing)); + Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of("ping/" + VERSION, + Arrays.asList(aPing, tPong, tStartPing), "pong/" + VERSION, Arrays.asList(aPong, tPing)); - return ResourceProvider - .read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, - resourcesByProcessKeyAndVersion); + return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), + classLoader, resourcesByProcessKeyAndVersion); } } diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java index bb91420f..79b5e30a 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java @@ -39,8 +39,8 @@ public void afterPropertiesSet() throws Exception @Override public void doExecute(DelegateExecution execution) throws Exception { - List<Target> targets = organizationProvider.getRemoteIdentifiers().stream().map(identifier -> Target - .createBiDirectionalTarget(identifier.getValue(), UUID.randomUUID().toString())) + List<Target> targets = organizationProvider.getRemoteIdentifiers().stream().map( + identifier -> Target.createBiDirectionalTarget(identifier.getValue(), UUID.randomUUID().toString())) .collect(Collectors.toList()); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(new Targets(targets))); diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/Ping3MedicFromTtpExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/Ping3MedicFromTtpExampleStarter.java index a782ab52..f08d97d5 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/Ping3MedicFromTtpExampleStarter.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/Ping3MedicFromTtpExampleStarter.java @@ -20,9 +20,9 @@ public class Ping3MedicFromTtpExampleStarter { // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate - // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate - // password + // password public static void main(String[] args) throws Exception { Task task = createStartResource(); diff --git a/dsf-bpe-process-update-allow-list/pom.xml b/dsf-bpe-process-update-allow-list/pom.xml index d41b388a..755088b6 100644 --- a/dsf-bpe-process-update-allow-list/pom.xml +++ b/dsf-bpe-process-update-allow-list/pom.xml @@ -9,6 +9,10 @@ <artifactId>dsf-bpe-highmed-processes-pom</artifactId> <version>0.5.0-SNAPSHOT</version> </parent> + + <properties> + <main.basedir>${project.basedir}/..</main.basedir> + </properties> <dependencies> <dependency> diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java index 920befdd..56a226c4 100644 --- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java +++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java @@ -10,13 +10,13 @@ public interface ConstantsUpdateAllowList String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST = "http://highmed.org/fhir/StructureDefinition/task-download-allow-list"; String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "downloadAllowList/"; - String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION = - PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI + VERSION; + String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI + + VERSION; String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_MESSAGE_NAME = "downloadAllowListMessage"; String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST = "http://highmed.org/fhir/StructureDefinition/task-update-allow-list"; String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "updateAllowList/"; - String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION = - PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI + VERSION; + String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI + + VERSION; String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_MESSAGE_NAME = "updateAllowListMessage"; } diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java index 1273f458..c2f1b9df 100644 --- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java +++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java @@ -53,12 +53,10 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var sUp = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-update-allow-list.xml"); var v = ValueSetResource.file("fhir/ValueSet/highmed-update-allow-list.xml"); - Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map - .of("downloadAllowList/" + VERSION, Arrays.asList(aDown, c, sDown, v), "updateAllowList/" + VERSION, - Arrays.asList(aUp, c, sUp, v)); + Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of("downloadAllowList/" + VERSION, + Arrays.asList(aDown, c, sDown, v), "updateAllowList/" + VERSION, Arrays.asList(aUp, c, sUp, v)); - return ResourceProvider - .read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, - resourcesByProcessKeyAndVersion); + return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), + classLoader, resourcesByProcessKeyAndVersion); } } diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/DownloadAllowList.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/DownloadAllowList.java index dda7f7a4..f59d3411 100644 --- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/DownloadAllowList.java +++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/DownloadAllowList.java @@ -64,9 +64,8 @@ protected void doExecute(DelegateExecution execution) throws Exception { logger.error("Error while reading Bundle with id {} from organization {}: {}", bundleId.getValue(), task.getRequester().getReference(), e.getMessage()); - throw new RuntimeException( - "Error while reading Bundle with id " + bundleId.getValue() + " from organization " + task - .getRequester().getReference() + ", " + e.getMessage(), e); + throw new RuntimeException("Error while reading Bundle with id " + bundleId.getValue() + + " from organization " + task.getRequester().getReference() + ", " + e.getMessage(), e); } if (!EnumSet.of(BundleType.TRANSACTION, BundleType.BATCH).contains(bundle.getType())) @@ -84,17 +83,16 @@ protected void doExecute(DelegateExecution execution) throws Exception { logger.error("Error while executing Bundle with id {} from organization {} locally: {}", bundleId.getValue(), task.getRequester().getReference(), e.getMessage()); - throw new RuntimeException( - "Error while executing Bundle with id " + bundleId.getValue() + " from organization " + task - .getRequester().getReference() + " locally, " + e.getMessage(), e); + throw new RuntimeException("Error while executing Bundle with id " + bundleId.getValue() + + " from organization " + task.getRequester().getReference() + " locally, " + e.getMessage(), e); } } private IdType getBundleId(Task task) { - List<Reference> bundleReferences = getTaskHelper() - .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST, - CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST).collect(Collectors.toList()); + List<Reference> bundleReferences = getTaskHelper().getInputParameterReferenceValues(task, + CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST, CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST) + .collect(Collectors.toList()); if (bundleReferences.size() != 1) { @@ -103,8 +101,8 @@ private IdType getBundleId(Task task) throw new RuntimeException("Task input parameter " + CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST + " contains unexpected number of Bundle IDs, expected 1, got " + bundleReferences.size()); } - else if (!bundleReferences.get(0).hasReference() || !bundleReferences.get(0).getReference() - .contains("/Bundle/")) + else if (!bundleReferences.get(0).hasReference() + || !bundleReferences.get(0).getReference().contains("/Bundle/")) { logger.error("Task input parameter {} has no Bundle reference", CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST); diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/UpdateAllowList.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/UpdateAllowList.java index 68f38815..5c8d6a04 100644 --- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/UpdateAllowList.java +++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/service/UpdateAllowList.java @@ -75,14 +75,14 @@ public void doExecute(DelegateExecution execution) throws Exception .setValue(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST); searchSet.getEntry().stream() .filter(e -> e.hasSearch() && SearchEntryMode.MATCH.equals(e.getSearch().getMode()) && e.hasResource() - && e.getResource() instanceof Organization).map(e -> (Organization) e.getResource()) - .forEach(addAllowListEntry(transaction, searchSet)); + && e.getResource() instanceof Organization) + .map(e -> (Organization) e.getResource()).forEach(addAllowListEntry(transaction, searchSet)); logger.debug("Uploading new allow list transaction bundle: {}", FhirContext.forR4().newJsonParser().encodeResourceToString(transaction)); - IdType result = client.withMinimalReturn().updateConditionaly(transaction, Map.of("identifier", Collections - .singletonList(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST + "|" + IdType result = client.withMinimalReturn().updateConditionaly(transaction, + Map.of("identifier", Collections.singletonList(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST + "|" + CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST))); Task task = getLeadingTaskFromExecutionVariables(); @@ -93,7 +93,8 @@ public void doExecute(DelegateExecution execution) throws Exception private Consumer<? super Organization> addAllowListEntry(Bundle transaction, Bundle searchSet) { - return organization -> { + return organization -> + { Identifier identifier = getDefaultIdentifier(organization).get(); BundleEntryComponent organizationEntry = transaction.addEntry(); @@ -115,7 +116,8 @@ private Consumer<? super Organization> addAllowListEntry(Bundle transaction, Bun private Function<Reference, Optional<Reference>> addAllowListEntryReturnReference(Bundle transaction, String organizationId, Bundle searchSet) { - return endpointRef -> getEndpoint(endpointRef, searchSet).map(endpoint -> { + return endpointRef -> getEndpoint(endpointRef, searchSet).map(endpoint -> + { Identifier identifier = getDefaultIdentifier(endpoint).get(); BundleEntryComponent endpointEntry = transaction.addEntry(); @@ -148,7 +150,8 @@ private Optional<Identifier> getDefaultIdentifier(Endpoint ept) private Optional<Endpoint> getEndpoint(Reference endpoint, Bundle searchSet) { return searchSet.getEntry().stream() - .filter(e -> e.hasResource() && e.getResource() instanceof Endpoint && e.getFullUrl() - .endsWith(endpoint.getReference())).map(e -> (Endpoint) e.getResource()).findFirst(); + .filter(e -> e.hasResource() && e.getResource() instanceof Endpoint + && e.getFullUrl().endsWith(endpoint.getReference())) + .map(e -> (Endpoint) e.getResource()).findFirst(); } } diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/DownloadAllowListFromTtpViaMedic1ExampleStarter.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/DownloadAllowListFromTtpViaMedic1ExampleStarter.java index 5e729dba..1338e902 100644 --- a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/DownloadAllowListFromTtpViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/DownloadAllowListFromTtpViaMedic1ExampleStarter.java @@ -29,9 +29,9 @@ public class DownloadAllowListFromTtpViaMedic1ExampleStarter { // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate - // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate - // password + // password public static void main(String[] args) throws Exception { ExampleStarter starter = ExampleStarter.forServer(args, MEDIC_1_FHIR_BASE_URL); @@ -58,10 +58,10 @@ private static Task createStartResource(ExampleStarter starter) throws Exception task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_MESSAGE_NAME)).getType() .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); - task.addInput().setValue(new Reference( - new IdType(TTP_FHIR_BASE_URL, ResourceType.Bundle.name(), allowList.getIdElement().getIdPart(), - allowList.getIdElement().getVersionIdPart()))).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST) + task.addInput() + .setValue(new Reference(new IdType(TTP_FHIR_BASE_URL, ResourceType.Bundle.name(), + allowList.getIdElement().getIdPart(), allowList.getIdElement().getVersionIdPart()))) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST) .setCode(CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST); return task; diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/UpdateAllowList3MedicTtpExampleStarter.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/UpdateAllowList3MedicTtpExampleStarter.java index 6d08e8ba..1144ff88 100644 --- a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/UpdateAllowList3MedicTtpExampleStarter.java +++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/UpdateAllowList3MedicTtpExampleStarter.java @@ -20,9 +20,9 @@ public class UpdateAllowList3MedicTtpExampleStarter { // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate - // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate - // password + // password public static void main(String[] args) throws Exception { Task task = createStartResource(); diff --git a/dsf-bpe-process-update-resources/pom.xml b/dsf-bpe-process-update-resources/pom.xml index dcc1fc4b..8461bd9a 100644 --- a/dsf-bpe-process-update-resources/pom.xml +++ b/dsf-bpe-process-update-resources/pom.xml @@ -9,6 +9,10 @@ <artifactId>dsf-bpe-highmed-processes-pom</artifactId> <version>0.5.0-SNAPSHOT</version> </parent> + + <properties> + <main.basedir>${project.basedir}/..</main.basedir> + </properties> <dependencies> <dependency> @@ -17,7 +21,6 @@ <scope>provided</scope> </dependency> - <dependency> <groupId>de.hs-heilbronn.mi</groupId> <artifactId>log4j2-utils</artifactId> diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java index d9ab66f3..d8468f53 100644 --- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java +++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java @@ -10,16 +10,16 @@ public interface ConstantsUpdateResources String CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_ORGANIZATION_IDENTIFIER_SEARCH_PARAMETER = "organization-identifier-search-parameter"; String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES = "http://highmed.org/fhir/StructureDefinition/task-request-update-resources"; - String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI = - PROCESS_HIGHMED_URI_BASE + "requestUpdateResources/"; - String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION = - PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI + VERSION; + String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + + "requestUpdateResources/"; + String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI + + VERSION; String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_MESSAGE_NAME = "requestUpdateResourcesMessage"; String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES = "http://highmed.org/fhir/StructureDefinition/task-execute-update-resources"; - String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI = - PROCESS_HIGHMED_URI_BASE + "executeUpdateResources/"; - String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION = - PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI + VERSION; + String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + + "executeUpdateResources/"; + String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI + + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_MESSAGE_NAME = "executeUpdateResourcesMessage"; } diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java index 47fb6b44..b0e87dd1 100644 --- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java +++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java @@ -55,12 +55,11 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader .file("fhir/StructureDefinition/highmed-task-request-update-resources.xml"); var v = ValueSetResource.file("fhir/ValueSet/highmed-update-resources.xml"); - Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map - .of("executeUpdateResources/" + VERSION, Arrays.asList(aExec, c, sExec, v), - "requestUpdateResources/" + VERSION, Arrays.asList(aReq, c, sReq, v)); + Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( + "executeUpdateResources/" + VERSION, Arrays.asList(aExec, c, sExec, v), + "requestUpdateResources/" + VERSION, Arrays.asList(aReq, c, sReq, v)); - return ResourceProvider - .read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, - resourcesByProcessKeyAndVersion); + return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), + classLoader, resourcesByProcessKeyAndVersion); } } diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/message/SendRequest.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/message/SendRequest.java index 9ff3a6a7..02c92293 100644 --- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/message/SendRequest.java +++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/message/SendRequest.java @@ -39,8 +39,9 @@ private ParameterComponent toInputParameterBundleReference(String localBaseUrl, if (bundleId == null || bundleId.isEmpty()) throw new IllegalArgumentException("bundleId null or empty"); - return new ParameterComponent(new CodeableConcept(new Coding(CODESYSTEM_HIGHMED_UPDATE_RESOURCE, - CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE, null)), + return new ParameterComponent( + new CodeableConcept(new Coding(CODESYSTEM_HIGHMED_UPDATE_RESOURCE, + CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE, null)), new Reference().setReference(localBaseUrl + (localBaseUrl.endsWith("/") ? "" : "/") + bundleId)); } } diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/CheckRequest.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/CheckRequest.java index dd45cb07..e05098f6 100644 --- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/CheckRequest.java +++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/CheckRequest.java @@ -51,11 +51,14 @@ protected void doExecute(DelegateExecution execution) throws Exception private boolean requesterIsNotOfTypeTtp(Identifier requester) { - Optional<Organization> organization = organizationProvider - .getOrganization(requester.getSystem(), requester.getValue()); + Optional<Organization> organization = organizationProvider.getOrganization(requester.getSystem(), + requester.getValue()); - return !organization.map(value -> value.getType().stream().anyMatch(type -> type.getCoding().stream().anyMatch( - coding -> coding.getSystem().equals(CODESYSTEM_HIGHMED_ORGANIZATION_TYPE) && coding.getCode() - .equals(CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP)))).orElse(false); + return !organization + .map(value -> value.getType().stream() + .anyMatch(type -> type.getCoding().stream() + .anyMatch(coding -> coding.getSystem().equals(CODESYSTEM_HIGHMED_ORGANIZATION_TYPE) + && coding.getCode().equals(CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP)))) + .orElse(false); } } diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/SelectResourceAndTargets.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/SelectResourceAndTargets.java index a0f13f77..648abf44 100644 --- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/SelectResourceAndTargets.java +++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/SelectResourceAndTargets.java @@ -54,9 +54,9 @@ public void afterPropertiesSet() throws Exception public void doExecute(DelegateExecution execution) throws Exception { Task task = getCurrentTaskFromExecutionVariables(); - List<Reference> references = getTaskHelper() - .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_UPDATE_RESOURCE, - CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE).collect(Collectors.toList()); + List<Reference> references = getTaskHelper().getInputParameterReferenceValues(task, + CODESYSTEM_HIGHMED_UPDATE_RESOURCE, CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE) + .collect(Collectors.toList()); if (references.size() != 1) { diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/UpdateResources.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/UpdateResources.java index 1f984efc..9c0b845d 100644 --- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/UpdateResources.java +++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/UpdateResources.java @@ -65,9 +65,8 @@ public void doExecute(DelegateExecution execution) throws Exception { logger.error("Error while reading Bundle with id {} from organization {}: {}", bundleId.getValue(), task.getRequester().getReference(), e.getMessage()); - throw new RuntimeException( - "Error while reading Bundle with id " + bundleId.getValue() + " from organization " + task - .getRequester().getReference() + ", " + e.getMessage(), e); + throw new RuntimeException("Error while reading Bundle with id " + bundleId.getValue() + + " from organization " + task.getRequester().getReference() + ", " + e.getMessage(), e); } if (!EnumSet.of(BundleType.TRANSACTION, BundleType.BATCH).contains(bundle.getType())) @@ -85,17 +84,16 @@ public void doExecute(DelegateExecution execution) throws Exception { logger.error("Error while executing Bundle with id {} from organization {} locally: {}", bundleId.getValue(), task.getRequester().getReference(), e.getMessage()); - throw new RuntimeException( - "Error while executing Bundle with id " + bundleId.getValue() + " from organization " + task - .getRequester().getReference() + " locally, " + e.getMessage(), e); + throw new RuntimeException("Error while executing Bundle with id " + bundleId.getValue() + + " from organization " + task.getRequester().getReference() + " locally, " + e.getMessage(), e); } } private IdType getBundleId(Task task) { - List<Reference> bundleReferences = getTaskHelper() - .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_UPDATE_RESOURCE, - CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE).collect(Collectors.toList()); + List<Reference> bundleReferences = getTaskHelper().getInputParameterReferenceValues(task, + CODESYSTEM_HIGHMED_UPDATE_RESOURCE, CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE) + .collect(Collectors.toList()); if (bundleReferences.size() != 1) { @@ -105,14 +103,13 @@ private IdType getBundleId(Task task) "Task input parameter " + CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE + " contains unexpected number of Bundle IDs, expected 1, got " + bundleReferences.size()); } - else if (!bundleReferences.get(0).hasReference() || !bundleReferences.get(0).getReference() - .contains("/Bundle/")) + else if (!bundleReferences.get(0).hasReference() + || !bundleReferences.get(0).getReference().contains("/Bundle/")) { logger.error("Task input parameter {} has no Bundle reference", CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE); - throw new RuntimeException( - "Task input parameter " + CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE - + " has no Bundle reference"); + throw new RuntimeException("Task input parameter " + + CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE + " has no Bundle reference"); } return new IdType(bundleReferences.get(0).getReference()); diff --git a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/UpdateResource3MedicTtpExampleStarter.java b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/UpdateResource3MedicTtpExampleStarter.java index 3cc79c9d..813fdfe7 100644 --- a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/UpdateResource3MedicTtpExampleStarter.java +++ b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/UpdateResource3MedicTtpExampleStarter.java @@ -29,9 +29,9 @@ public class UpdateResource3MedicTtpExampleStarter { // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate - // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate - // password + // password public static void main(String[] args) throws Exception { ExampleStarter starter = ExampleStarter.forServer(args, TTP_FHIR_BASE_URL); @@ -59,10 +59,10 @@ private static Task createStartResource(ExampleStarter starter) throws Exception task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_MESSAGE_NAME)).getType() .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); - task.addInput().setValue(new Reference( - new IdType(ResourceType.Bundle.name(), allowList.getIdElement().getIdPart(), - allowList.getIdElement().getVersionIdPart()))).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_UPDATE_RESOURCE) + task.addInput() + .setValue(new Reference(new IdType(ResourceType.Bundle.name(), allowList.getIdElement().getIdPart(), + allowList.getIdElement().getVersionIdPart()))) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_UPDATE_RESOURCE) .setCode(CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE); task.addInput().setValue(new StringType("http://highmed.org/fhir/NamingSystem/organization-identifier|")) diff --git a/pom.xml b/pom.xml index 7b3941bf..73e49b35 100644 --- a/pom.xml +++ b/pom.xml @@ -22,6 +22,8 @@ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <compileSource>11</compileSource> <compileTarget>11</compileTarget> + + <main.basedir>${project.basedir}</main.basedir> </properties> <name>highmed-processes</name> @@ -187,6 +189,16 @@ <artifactId>maven-clean-plugin</artifactId> <version>3.1.0</version> </plugin> + <plugin> + <groupId>net.revelc.code.formatter</groupId> + <artifactId>formatter-maven-plugin</artifactId> + <version>2.13.0</version> + </plugin> + <plugin> + <groupId>net.revelc.code</groupId> + <artifactId>impsort-maven-plugin</artifactId> + <version>1.5.0</version> + </plugin> </plugins> </pluginManagement> @@ -208,6 +220,22 @@ <useLastCommittedRevision>true</useLastCommittedRevision> </configuration> </plugin> + <plugin> + <groupId>net.revelc.code.formatter</groupId> + <artifactId>formatter-maven-plugin</artifactId> + <configuration> + <configFile>${main.basedir}/src/main/resources/eclipse-formatter-config.xml</configFile> + </configuration> + </plugin> + <plugin> + <groupId>net.revelc.code</groupId> + <artifactId>impsort-maven-plugin</artifactId> + <configuration> + <compliance>11</compliance> + <groups>java.,javax.,org.,com.</groups> + <staticGroups>java,*</staticGroups> + </configuration> + </plugin> </plugins> </build> @@ -235,4 +263,70 @@ </snapshots> </repository> </repositories> + + <profiles> + <profile> + <id>format-and-sort</id> + + <build> + <plugins> + <plugin> + <groupId>net.revelc.code.formatter</groupId> + <artifactId>formatter-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>format</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>net.revelc.code</groupId> + <artifactId>impsort-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>sort</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>validate-and-check</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + + <build> + <plugins> + <plugin> + <groupId>net.revelc.code.formatter</groupId> + <artifactId>formatter-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>validate</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>net.revelc.code</groupId> + <artifactId>impsort-maven-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + </profiles> </project> diff --git a/src/main/resources/eclipse-formatter-config.xml b/src/main/resources/eclipse-formatter-config.xml new file mode 100644 index 00000000..fa149094 --- /dev/null +++ b/src/main/resources/eclipse-formatter-config.xml @@ -0,0 +1,382 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<profiles version="20"> + <profile kind="CodeFormatterProfile" name="highmed_dsf" version="20"> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/> + <setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_record_components" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/> + <setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="2"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.text_block_indentation" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_assertion_message_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/> + <setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/> + <setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_not_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_if_empty"/> + <setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_assertion_message" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_record_constructor" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="next_line"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="0"/> + <setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/> + <setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/> + <setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/> + <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/> + </profile> +</profiles> From 493c58362ffb066d5ad4162b402fb9f50a9445b1 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 10 Feb 2021 08:15:17 +0100 Subject: [PATCH 011/125] improves checks of cohorts and research study --- .../service/CheckDataSharingResources.java | 28 ++++++++++++++----- .../dsf/bpe/service/ModifyQueries.java | 19 +++++++++---- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java index 5c1cb5ae..0a1533ff 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java @@ -1,6 +1,8 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import java.util.List; @@ -10,12 +12,12 @@ import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.FhirResourcesList; import org.hl7.fhir.r4.model.Group; +import org.hl7.fhir.r4.model.ResearchStudy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class CheckDataSharingResources extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(CheckDataSharingResources.class); public CheckDataSharingResources(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) @@ -26,18 +28,30 @@ public CheckDataSharingResources(FhirWebserviceClientProvider clientProvider, Ta @Override protected void doExecute(DelegateExecution execution) { - logger.info(this.getClass().getName() + " doExecute called"); + checkConsentCheck(execution); + checkFullyQualifiedCohortIds(execution); - List<Group> cohorts = ((FhirResourcesList) execution.getVariable(BPMN_EXECUTION_VARIABLE_COHORTS)) - .getResourcesAndCast(); + // TODO: Define further checks + } - checkFullyQualifiedCohortIds(cohorts); + private void checkConsentCheck(DelegateExecution execution) + { + Boolean needsConsentCheck = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); + + if (!needsConsentCheck) + { + ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); + logger.warn("Execution process executeDataSharing for ResearchStudy with id {} without consent check", + researchStudy.getId()); + } - // TODO: Define further checks } - private void checkFullyQualifiedCohortIds(List<Group> cohorts) + private void checkFullyQualifiedCohortIds(DelegateExecution execution) { + List<Group> cohorts = ((FhirResourcesList) execution.getVariable(BPMN_EXECUTION_VARIABLE_COHORTS)) + .getResourcesAndCast(); + if (cohorts.stream().anyMatch(g -> !g.getIdElement().hasBaseUrl())) { throw new RuntimeException("Not all cohorts have fully qualified ids (containing server base url)"); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java index 05a5de5e..2251d963 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java @@ -1,5 +1,7 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; import java.util.HashMap; @@ -37,13 +39,20 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) { - // <groupId, query> - @SuppressWarnings("unchecked") - Map<String, String> queries = (Map<String, String>) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERIES); + Boolean needsConsentCheck = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); + Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); + boolean idQuery = Boolean.TRUE.equals(needsConsentCheck) || Boolean.TRUE.equals(needsRecordLinkage); - Map<String, String> modifiedQueries = modifyQueries(queries); + if (idQuery) + { + // <groupId, query> + @SuppressWarnings("unchecked") + Map<String, String> queries = (Map<String, String>) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERIES); + + Map<String, String> modifiedQueries = modifyQueries(queries); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERIES, modifiedQueries); + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERIES, modifiedQueries); + } } private Map<String, String> modifyQueries(Map<String, String> queries) From 1b95a36c6632135ff9ba85091f0d622b19520874 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 10 Feb 2021 08:20:56 +0100 Subject: [PATCH 012/125] store query results --- .../highmed/dsf/bpe/service/ExecuteQueries.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java index c2dd892a..f0bd7cc5 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -3,12 +3,18 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -45,14 +51,19 @@ protected void doExecute(DelegateExecution execution) throws Exception @SuppressWarnings("unchecked") Map<String, String> queries = (Map<String, String>) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERIES); - queries.forEach(this::executeQuery); + List<QueryResult> results = queries.entrySet().stream() + .map(entry -> executeQuery(entry.getKey(), entry.getValue())).collect(Collectors.toList()); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(results))); } - private void executeQuery(String cohortId, String cohortQuery) + private QueryResult executeQuery(String cohortId, String cohortQuery) { // TODO We might want to introduce a more complex result type to represent a count, // errors and possible meta-data. ResultSet resultSet = openehrClient.query(cohortQuery, null); + return QueryResult.resultSet(organizationProvider.getLocalIdentifierValue(), cohortId, resultSet); } } \ No newline at end of file From 7bdc208bc78c6ca29e1b2f5facf978c761afda13 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 10 Feb 2021 09:23:39 +0100 Subject: [PATCH 013/125] change order of pseudonymisation and record linkage, implement consent sceleton --- .../service/FilterQueryResultsByConsent.java | 41 +++- .../resources/bpe/executeDataSharing.bpmn | 210 +++++++++--------- 2 files changed, 139 insertions(+), 112 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java index 94654e5b..2c94ac2d 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java @@ -1,25 +1,52 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + +import java.util.List; +import java.util.stream.Collectors; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.highmed.openehr.model.structure.ResultSet; public class FilterQueryResultsByConsent extends AbstractServiceDelegate { - - private static final Logger logger = LoggerFactory.getLogger(FilterQueryResultsByConsent.class); - public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) { super(clientProvider, taskHelper); } @Override - protected void doExecute(DelegateExecution execution) + protected void doExecute(DelegateExecution execution) throws Exception + { + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + + List<QueryResult> filteredResults = filterResults(results.getResults()); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(filteredResults))); + } + + private List<QueryResult> filterResults(List<QueryResult> results) + { + return results.stream().map(this::filterResult).collect(Collectors.toList()); + } + + protected QueryResult filterResult(QueryResult result) { - logger.info(this.getClass().getName() + " doExecute called"); + return QueryResult.resultSet(result.getOrganizationIdentifier(), result.getCohortId(), + filterResultSet(result.getResultSet())); + } + + private ResultSet filterResultSet(ResultSet resultSet) + { + // TODO implement + + return resultSet; } } diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index a69e293e..fb88476d 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -2,7 +2,7 @@ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> <bpmn:process id="executeDataSharing" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResults"> - <bpmn:incoming>SequenceFlow_0q803rh</bpmn:incoming> + <bpmn:incoming>Flow_1s1pv42</bpmn:incoming> <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="checkDataSharingRequest" name="check data sharing request" camunda:class="org.highmed.dsf.bpe.service.CheckDataSharingResources"> @@ -13,7 +13,7 @@ <bpmn:outgoing>SequenceFlow_14cn0vs</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_0sjtzj6" messageRef="Message_1yz2a31" /> </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_1rmqv20" sourceRef="executeQueries" targetRef="provideLocalPseudonyms" /> + <bpmn:sequenceFlow id="SequenceFlow_1rmqv20" sourceRef="executeQueries" targetRef="ExclusiveGateway_0bq7zdz" /> <bpmn:sequenceFlow id="SequenceFlow_14cn0vs" sourceRef="StartEvent" targetRef="downloadDataSharingResources" /> <bpmn:sequenceFlow id="SequenceFlow_1etju4m" sourceRef="downloadDataSharingResources" targetRef="checkDataSharingRequest" /> <bpmn:serviceTask id="downloadDataSharingResources" name="download data sharing resources" camunda:class="org.highmed.dsf.bpe.service.DownloadDataSharingResources"> @@ -34,7 +34,7 @@ </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_04ouilq" sourceRef="checkResults" targetRef="selectResponseTargetTtp" /> <bpmn:exclusiveGateway id="ExclusiveGateway_0bq7zdz"> - <bpmn:incoming>Flow_0fabwum</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1rmqv20</bpmn:incoming> <bpmn:outgoing>SequenceFlow_05r9whd</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_0isxkuy</bpmn:outgoing> </bpmn:exclusiveGateway> @@ -72,7 +72,7 @@ <bpmn:incoming>SequenceFlow_17otl7p</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0q803rh</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_0q803rh" sourceRef="ExclusiveGateway_002t87f" targetRef="checkResults" /> + <bpmn:sequenceFlow id="SequenceFlow_0q803rh" sourceRef="ExclusiveGateway_002t87f" targetRef="Activity_0qpfuiq" /> <bpmn:sequenceFlow id="SequenceFlow_1ug2kru" sourceRef="generateBloomFilters" targetRef="ExclusiveGateway_002t87f" /> <bpmn:sequenceFlow id="SequenceFlow_0ascyjc" sourceRef="selectResponseTargetTtp" targetRef="EndEvent" /> <bpmn:serviceTask id="selectResponseTargetTtp" name="select response target TTP" camunda:class="org.highmed.dsf.bpe.service.SelectResponseTargetTtp"> @@ -92,21 +92,21 @@ <bpmn:incoming>Flow_1ecoehc</bpmn:incoming> <bpmn:outgoing>Flow_0qsitvp</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_0fabwum" sourceRef="EncryptMdat" targetRef="ExclusiveGateway_0bq7zdz" /> - <bpmn:serviceTask id="EncryptMdat" name="encrypt MDAT" camunda:class="org.highmed.dsf.bpe.service.EncryptMdat"> - <bpmn:incoming>Flow_0bkkg7n</bpmn:incoming> - <bpmn:outgoing>Flow_0fabwum</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_0bkkg7n" sourceRef="provideLocalPseudonyms" targetRef="EncryptMdat" /> - <bpmn:serviceTask id="provideLocalPseudonyms" name="provide local pseudonyms" camunda:class="org.highmed.dsf.bpe.service.ProvideLocalPseudonyms"> - <bpmn:incoming>SequenceFlow_1rmqv20</bpmn:incoming> - <bpmn:outgoing>Flow_0bkkg7n</bpmn:outgoing> - </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1ecoehc" sourceRef="extractQueries" targetRef="addIdSelectionIfMissing" /> <bpmn:serviceTask id="extractQueries" name="extract queries" camunda:class="org.highmed.dsf.bpe.service.ExtractQueries"> <bpmn:incoming>Flow_1kp6eaq</bpmn:incoming> <bpmn:outgoing>Flow_1ecoehc</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:serviceTask id="Activity_0qpfuiq" name="provide local pseudonyms" camunda:class="org.highmed.dsf.bpe.service.ProvideLocalPseudonyms"> + <bpmn:incoming>SequenceFlow_0q803rh</bpmn:incoming> + <bpmn:outgoing>Flow_1r9brzp</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="Activity_0po7dtu" name="encrypt MDAT" camunda:class="org.highmed.dsf.bpe.service.EncryptMdat"> + <bpmn:incoming>Flow_1r9brzp</bpmn:incoming> + <bpmn:outgoing>Flow_1s1pv42</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1r9brzp" sourceRef="Activity_0qpfuiq" targetRef="Activity_0po7dtu" /> + <bpmn:sequenceFlow id="Flow_1s1pv42" sourceRef="Activity_0po7dtu" targetRef="checkResults" /> <bpmn:textAnnotation id="TextAnnotation_0euut3n"> <bpmn:text>uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc.</bpmn:text> </bpmn:textAnnotation> @@ -116,28 +116,14 @@ <bpmn:message id="Message_1dr71re" name="resultSingleMedicDataSharingMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="executeDataSharing"> - <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> - <dc:Bounds x="330" y="80" width="267" height="56" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="Flow_0bkkg7n_di" bpmnElement="Flow_0bkkg7n"> - <di:waypoint x="1150" y="212" /> - <di:waypoint x="1220" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0fabwum_di" bpmnElement="Flow_0fabwum"> - <di:waypoint x="1320" y="212" /> - <di:waypoint x="1385" y="212" /> + <bpmndi:BPMNEdge id="Flow_1ecoehc_di" bpmnElement="Flow_1ecoehc"> + <di:waypoint x="660" y="212" /> + <di:waypoint x="710" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0qsitvp_di" bpmnElement="Flow_0qsitvp"> <di:waypoint x="810" y="212" /> <di:waypoint x="880" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_17otl7p_di" bpmnElement="SequenceFlow_17otl7p"> - <di:waypoint x="1695" y="212" /> - <di:waypoint x="1798" y="212" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1697" y="194" width="21" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1kp6eaq_di" bpmnElement="Flow_1kp6eaq"> <di:waypoint x="500" y="212" /> <di:waypoint x="560" y="212" /> @@ -146,44 +132,9 @@ <di:waypoint x="2210" y="212" /> <di:waypoint x="2282" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ug2kru_di" bpmnElement="SequenceFlow_1ug2kru"> - <di:waypoint x="1823" y="315" /> - <di:waypoint x="1823" y="237" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0q803rh_di" bpmnElement="SequenceFlow_0q803rh"> - <di:waypoint x="1848" y="212" /> - <di:waypoint x="1930" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1futlo2_di" bpmnElement="SequenceFlow_1futlo2"> - <di:waypoint x="1670" y="237" /> - <di:waypoint x="1670" y="355" /> - <di:waypoint x="1773" y="355" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1677" y="320" width="65" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0kzp6tl_di" bpmnElement="SequenceFlow_0kzp6tl"> - <di:waypoint x="1570" y="315" /> - <di:waypoint x="1570" y="237" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1b4h5qz_di" bpmnElement="SequenceFlow_1b4h5qz"> - <di:waypoint x="1595" y="212" /> - <di:waypoint x="1645" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0isxkuy_di" bpmnElement="SequenceFlow_0isxkuy"> - <di:waypoint x="1410" y="237" /> - <di:waypoint x="1410" y="355" /> - <di:waypoint x="1520" y="355" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1417" y="323" width="72" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_05r9whd_di" bpmnElement="SequenceFlow_05r9whd"> - <di:waypoint x="1435" y="212" /> - <di:waypoint x="1545" y="212" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1441" y="195" width="21" height="14" /> - </bpmndi:BPMNLabel> + <di:waypoint x="1495" y="212" /> + <di:waypoint x="1580" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_04ouilq_di" bpmnElement="SequenceFlow_04ouilq"> <di:waypoint x="2030" y="212" /> @@ -199,39 +150,79 @@ </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1rmqv20_di" bpmnElement="SequenceFlow_1rmqv20"> <di:waypoint x="980" y="212" /> - <di:waypoint x="1050" y="212" /> + <di:waypoint x="1032" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1ecoehc_di" bpmnElement="Flow_1ecoehc"> - <di:waypoint x="660" y="212" /> - <di:waypoint x="710" y="212" /> + <bpmndi:BPMNEdge id="SequenceFlow_05r9whd_di" bpmnElement="SequenceFlow_05r9whd"> + <di:waypoint x="1082" y="212" /> + <di:waypoint x="1192" y="212" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1088" y="195" width="21" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0isxkuy_di" bpmnElement="SequenceFlow_0isxkuy"> + <di:waypoint x="1057" y="237" /> + <di:waypoint x="1057" y="355" /> + <di:waypoint x="1167" y="355" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1064" y="323" width="72" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0kzp6tl_di" bpmnElement="SequenceFlow_0kzp6tl"> + <di:waypoint x="1217" y="315" /> + <di:waypoint x="1217" y="237" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1b4h5qz_di" bpmnElement="SequenceFlow_1b4h5qz"> + <di:waypoint x="1242" y="212" /> + <di:waypoint x="1292" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1futlo2_di" bpmnElement="SequenceFlow_1futlo2"> + <di:waypoint x="1317" y="237" /> + <di:waypoint x="1317" y="355" /> + <di:waypoint x="1420" y="355" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1324" y="320" width="65" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_17otl7p_di" bpmnElement="SequenceFlow_17otl7p"> + <di:waypoint x="1342" y="212" /> + <di:waypoint x="1445" y="212" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1344" y="194" width="21" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ug2kru_di" bpmnElement="SequenceFlow_1ug2kru"> + <di:waypoint x="1470" y="315" /> + <di:waypoint x="1470" y="237" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1r9brzp_di" bpmnElement="Flow_1r9brzp"> + <di:waypoint x="1680" y="212" /> + <di:waypoint x="1760" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1s1pv42_di" bpmnElement="Flow_1s1pv42"> + <di:waypoint x="1860" y="212" /> + <di:waypoint x="1930" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> <dc:Bounds x="1930" y="172" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkDataSharingRequest"> + <dc:Bounds x="400" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1fzso6r_di" bpmnElement="StartEvent"> + <dc:Bounds x="152" y="194" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="160" y="237" width="22" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0b8j3ka_di" bpmnElement="downloadDataSharingResources"> + <dc:Bounds x="240" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> <dc:Bounds x="2282" y="194" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="2256" y="237" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0bq7zdz_di" bpmnElement="ExclusiveGateway_0bq7zdz" isMarkerVisible="true"> - <dc:Bounds x="1385" y="187" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0l3b9as_di" bpmnElement="filterByConsent"> - <dc:Bounds x="1520" y="315" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0lecmy5_di" bpmnElement="ExclusiveGateway_0lecmy5" isMarkerVisible="true"> - <dc:Bounds x="1545" y="187" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0sff9xb_di" bpmnElement="ExclusiveGateway_0sff9xb" isMarkerVisible="true"> - <dc:Bounds x="1645" y="187" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="generateBloomFilters"> - <dc:Bounds x="1773" y="315" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_002t87f_di" bpmnElement="ExclusiveGateway_002t87f" isMarkerVisible="true"> - <dc:Bounds x="1798" y="187" width="50" height="50" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> <dc:Bounds x="2110" y="172" width="100" height="80" /> </bpmndi:BPMNShape> @@ -241,26 +232,35 @@ <bpmndi:BPMNShape id="Activity_1ok9q8j_di" bpmnElement="addIdSelectionIfMissing"> <dc:Bounds x="710" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1e2gm4u_di" bpmnElement="EncryptMdat"> - <dc:Bounds x="1220" y="172" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_1vlv5ud_di" bpmnElement="extractQueries"> + <dc:Bounds x="560" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0attf5g_di" bpmnElement="provideLocalPseudonyms"> - <dc:Bounds x="1050" y="172" width="100" height="80" /> + <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> + <dc:Bounds x="330" y="80" width="267" height="56" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="StartEvent_1fzso6r_di" bpmnElement="StartEvent"> - <dc:Bounds x="152" y="194" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="160" y="237" width="22" height="14" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="ExclusiveGateway_0bq7zdz_di" bpmnElement="ExclusiveGateway_0bq7zdz" isMarkerVisible="true"> + <dc:Bounds x="1032" y="187" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0b8j3ka_di" bpmnElement="downloadDataSharingResources"> - <dc:Bounds x="240" y="172" width="100" height="80" /> + <bpmndi:BPMNShape id="ServiceTask_0l3b9as_di" bpmnElement="filterByConsent"> + <dc:Bounds x="1167" y="315" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkDataSharingRequest"> - <dc:Bounds x="400" y="172" width="100" height="80" /> + <bpmndi:BPMNShape id="ExclusiveGateway_0lecmy5_di" bpmnElement="ExclusiveGateway_0lecmy5" isMarkerVisible="true"> + <dc:Bounds x="1192" y="187" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1vlv5ud_di" bpmnElement="extractQueries"> - <dc:Bounds x="560" y="172" width="100" height="80" /> + <bpmndi:BPMNShape id="ExclusiveGateway_0sff9xb_di" bpmnElement="ExclusiveGateway_0sff9xb" isMarkerVisible="true"> + <dc:Bounds x="1292" y="187" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="generateBloomFilters"> + <dc:Bounds x="1420" y="315" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_002t87f_di" bpmnElement="ExclusiveGateway_002t87f" isMarkerVisible="true"> + <dc:Bounds x="1445" y="187" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0po7dtu_di" bpmnElement="Activity_0po7dtu"> + <dc:Bounds x="1760" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0qpfuiq_di" bpmnElement="Activity_0qpfuiq"> + <dc:Bounds x="1580" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> <di:waypoint x="455" y="172" /> From 6d59b57a3aef839ab511477edabd9de2e80666d0 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 10 Feb 2021 15:38:11 +0100 Subject: [PATCH 014/125] generate and store rbf's, rename execution variables and fhir inputs/outputs to distinguish between rbf and normal result set --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 6 +- .../bpe/message/SendSingleMedicResults.java | 45 ++++- .../dsf/bpe/service/GenerateBloomFilters.java | 164 +++++++++++++++++- .../bpe/service/ProvideLocalPseudonyms.java | 37 +++- .../bpe/spring/config/DataSharingConfig.java | 29 +++- .../highmed/dsf/bpe/variable/QueryResult.java | 2 +- .../fhir/CodeSystem/highmed-data-sharing.xml | 21 ++- ...-task-single-medic-result-data-sharing.xml | 70 +++++++- .../bpe/message/SendSingleMedicResults.java | 13 +- .../dsf/bpe/service/GenerateBloomFilters.java | 3 +- .../highmed/dsf/bpe/service/StoreResults.java | 10 +- ...d-task-single-medic-result-feasibility.xml | 44 ++--- .../dsf/fhir/profile/TaskProfileTest.java | 12 +- .../highmed/dsf/bpe/service/StoreResult.java | 13 +- ...ighmed-task-local-services-integration.xml | 42 ++--- 15 files changed, 417 insertions(+), 94 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index 39d2f1ad..4d3b257d 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -12,6 +12,7 @@ public interface ConstantsDataSharing String BPMN_EXECUTION_VARIABLE_COHORTS = "cohorts"; String BPMN_EXECUTION_VARIABLE_QUERIES = "queries"; String BPMN_EXECUTION_VARIABLE_QUERY_RESULTS = "queryResults"; + String BPMN_EXECUTION_VARIABLE_RBF_RESULTS = "rbfResults"; String BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS = "finalQueryResults"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing"; @@ -26,8 +27,9 @@ public interface ConstantsDataSharing String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK = "needs-consent-check"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG = "bloom-filter-configuration"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY = "medic-correlation-key"; - String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT = "single-medic-result"; - String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE = "single-medic-result-reference"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT = "single-medic-count-result"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RESULT_REFERENCE = "single-medic-result-set-result-reference"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE = "single-medic-result-set-rbf-reference"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT = "multi-medic-result"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS = "participating-medics"; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java index 833ecc7b..f3aa297c 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -1,18 +1,32 @@ package org.highmed.dsf.bpe.message; +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RBF_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE; + import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; import org.hl7.fhir.r4.model.Task.ParameterComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import ca.uhn.fhir.context.FhirContext; public class SendSingleMedicResults extends AbstractTaskMessageSend { + private static final Logger logger = LoggerFactory.getLogger(SendSingleMedicResults.class); + public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) { @@ -20,8 +34,35 @@ public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskH } @Override - protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) + protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) + { + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_RBF_RESULTS); + + return results.getResults().stream().map(result -> toInput(result)); + } + + private Task.ParameterComponent toInput(QueryResult result) + { + if (result.isIdResultSetUrlResult()) + { + ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE, + new Reference(result.getResultSetUrl())); + input.addExtension(createCohortIdExtension(result.getCohortId())); + return input; + } + else + { + logger.warn("Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + + result.getCohortId()); + throw new RuntimeException( + "Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + + result.getCohortId()); + } + } + + private Extension createCohortIdExtension(String cohortId) { - return Stream.empty(); + return new Extension(EXTENSION_HIGHMED_GROUP_ID, new Reference(cohortId)); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java index 31c6bbcc..91446eb6 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -1,25 +1,179 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RBF_RESULTS; + +import java.security.Key; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.BloomFilterConfig; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.mpi.client.MasterPatientIndexClient; +import org.highmed.openehr.model.structure.ResultSet; +import org.highmed.pseudonymization.bloomfilter.BloomFilterGenerator; +import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGenerator; +import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGeneratorImpl; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpRbfOnly; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpRbfOnlyImpl; +import org.hl7.fhir.r4.model.Binary; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResourceType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; -public class GenerateBloomFilters extends AbstractServiceDelegate -{ +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import ca.uhn.fhir.context.FhirContext; + +public class GenerateBloomFilters extends AbstractServiceDelegate implements InitializingBean +{ private static final Logger logger = LoggerFactory.getLogger(GenerateBloomFilters.class); - public GenerateBloomFilters(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + private static final int RBF_LENGTH = 3000; + private static final RecordBloomFilterGeneratorImpl.FieldWeights FBF_WEIGHTS = new RecordBloomFilterGeneratorImpl.FieldWeights( + 0.1, 0.1, 0.1, 0.2, 0.05, 0.1, 0.05, 0.2, 0.1); + private static final RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths FBF_LENGTHS = new RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths( + 500, 500, 250, 50, 500, 250, 500, 500, 500); + + private final String ehrIdColumnPath; + private final MasterPatientIndexClient masterPatientIndexClient; + private final ObjectMapper openEhrObjectMapper; + private final BouncyCastleProvider bouncyCastleProvider; + + public GenerateBloomFilters(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, ObjectMapper openEhrObjectMapper, + BouncyCastleProvider bouncyCastleProvider) { super(clientProvider, taskHelper); + + this.ehrIdColumnPath = ehrIdColumnPath; + this.masterPatientIndexClient = masterPatientIndexClient; + this.openEhrObjectMapper = openEhrObjectMapper; + this.bouncyCastleProvider = bouncyCastleProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath"); + Objects.requireNonNull(masterPatientIndexClient, "masterPatientIndexClient"); + Objects.requireNonNull(openEhrObjectMapper, "openEhrObjectMapper"); + Objects.requireNonNull(bouncyCastleProvider, "bouncyCastleProvider"); } @Override - protected void doExecute(DelegateExecution execution) + protected void doExecute(DelegateExecution execution) throws Exception + { + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + + String securityIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); + BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution + .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); + + ResultSetTranslatorToTtpRbfOnly resultSetTranslator = createResultSetTranslator(bloomFilterConfig); + + List<QueryResult> translatedResults = results.getResults().stream() + .map(result -> translateAndCreateBinary(resultSetTranslator, result, securityIdentifier)) + .collect(Collectors.toList()); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_RBF_RESULTS, + QueryResultsValues.create(new QueryResults(translatedResults))); + } + + protected ResultSetTranslatorToTtpRbfOnly createResultSetTranslator(BloomFilterConfig bloomFilterConfig) + { + return new ResultSetTranslatorToTtpRbfOnlyImpl(ehrIdColumnPath, + createRecordBloomFilterGenerator(bloomFilterConfig.getPermutationSeed(), + bloomFilterConfig.getHmacSha2Key(), bloomFilterConfig.getHmacSha3Key()), + masterPatientIndexClient, ResultSetTranslatorToTtpRbfOnlyImpl.FILTER_ON_IDAT_NOT_FOUND_EXCEPTION); + } + + protected RecordBloomFilterGenerator createRecordBloomFilterGenerator(long permutationSeed, Key hmacSha2Key, + Key hmacSha3Key) + { + return new RecordBloomFilterGeneratorImpl(RBF_LENGTH, permutationSeed, FBF_WEIGHTS, FBF_LENGTHS, + () -> new BloomFilterGenerator.HmacSha2HmacSha3BiGramHasher(hmacSha2Key, hmacSha3Key, + bouncyCastleProvider)); + } + + private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtpRbfOnly resultSetTranslator, + QueryResult result, String ttpIdentifier) + { + ResultSet translatedResultSet = translate(resultSetTranslator, result.getResultSet()); + String resultSetUrl = saveResultSetAsBinaryForTtp(translatedResultSet, ttpIdentifier); + + return QueryResult.resultSet(result.getOrganizationIdentifier(), result.getCohortId(), resultSetUrl); + } + + private ResultSet translate(ResultSetTranslatorToTtpRbfOnly resultSetTranslator, ResultSet resultSet) + { + try + { + return resultSetTranslator.translate(resultSet); + } + catch (Exception e) + { + logger.warn("Error while translating ResultSet: " + e.getMessage(), e); + throw e; + } + } + + protected String saveResultSetAsBinaryForTtp(ResultSet resultSet, String securityIdentifier) + { + byte[] content = serializeResultSet(resultSet); + Reference securityContext = new Reference(); + securityContext.setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(securityIdentifier); + Binary binary = new Binary().setContentType(OPENEHR_MIMETYPE_JSON).setSecurityContext(securityContext) + .setData(content); + + IdType created = createBinaryResource(binary); + return new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl(), ResourceType.Binary.name(), + created.getIdPart(), created.getVersionIdPart()).getValue(); + } + + private byte[] serializeResultSet(ResultSet resultSet) + { + try + { + return openEhrObjectMapper.writeValueAsBytes(resultSet); + } + catch (JsonProcessingException e) + { + logger.warn("Error while serializing ResultSet: " + e.getMessage(), e); + throw new RuntimeException(e); + } + } + + private IdType createBinaryResource(Binary binary) { - logger.info(this.getClass().getName() + " doExecute called"); + try + { + return getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().create(binary); + } + catch (Exception e) + { + logger.debug("Binary to create {}", FhirContext.forR4().newJsonParser().encodeResourceToString(binary)); + logger.warn("Error while creating Binary resoruce: " + e.getMessage(), e); + throw e; + } } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java index 9297ba1a..63a45014 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java @@ -1,19 +1,37 @@ package org.highmed.dsf.bpe.service; +import java.util.List; +import java.util.Objects; +import java.util.function.Predicate; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.openehr.model.structure.Column; +import org.highmed.pseudonymization.openehr.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; -public class ProvideLocalPseudonyms extends AbstractServiceDelegate +public class ProvideLocalPseudonyms extends AbstractServiceDelegate implements InitializingBean { private static final Logger logger = LoggerFactory.getLogger(ProvideLocalPseudonyms.class); - public ProvideLocalPseudonyms(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + private final String ehrIdColumnPath; + + public ProvideLocalPseudonyms(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + String ehrIdColumnPath) { super(clientProvider, taskHelper); + this.ehrIdColumnPath = ehrIdColumnPath; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath"); } @Override @@ -21,4 +39,19 @@ protected void doExecute(DelegateExecution execution) { logger.info(this.getClass().getName() + " doExecute called"); } + + private int getEhrColumnIndex(List<Column> columns) + { + for (int i = 0; i < columns.size(); i++) + if (isEhrIdColumn().test(columns.get(i))) + return i; + + return -1; + } + + private Predicate<? super Column> isEhrIdColumn() + { + return column -> Constants.EHRID_COLUMN_NAME.equals(column.getName()) + && ehrIdColumnPath.equals(column.getPath()); + } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index 139cc5c9..cd01eda9 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -32,6 +32,8 @@ import org.highmed.dsf.fhir.group.GroupHelper; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.mpi.client.MasterPatientIndexClient; +import org.highmed.mpi.client.MasterPatientIndexClientFactory; import org.highmed.openehr.client.OpenEhrClient; import org.highmed.openehr.client.OpenEhrClientFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -40,6 +42,8 @@ import org.springframework.context.annotation.Configuration; import org.springframework.core.env.Environment; +import com.fasterxml.jackson.databind.ObjectMapper; + import ca.uhn.fhir.context.FhirContext; @Configuration @@ -49,6 +53,9 @@ public class DataSharingConfig @Autowired private FhirWebserviceClientProvider fhirClientProvider; + @Autowired + private MasterPatientIndexClientFactory masterPatientIndexClientFactory; + @Autowired private OpenEhrClientFactory openEhrClientFactory; @@ -67,6 +74,9 @@ public class DataSharingConfig @Value("${org.highmed.dsf.bpe.openehr.subject_external_id.path:/ehr_status/subject/external_ref/id/value}") private String ehrIdColumnPath; + @Autowired + private ObjectMapper objectMapper; + @Autowired private Environment environment; @@ -193,21 +203,21 @@ public ModifyQueries modifyQueries() } @Bean - public OpenEhrClient openEhrClient() + public ExecuteQueries executeQueries() { - return openEhrClientFactory.createClient(environment::getProperty); + return new ExecuteQueries(fhirClientProvider, openEhrClient(), taskHelper, organizationProvider); } @Bean - public ExecuteQueries executeQueries() + public OpenEhrClient openEhrClient() { - return new ExecuteQueries(fhirClientProvider, openEhrClient(), taskHelper, organizationProvider); + return openEhrClientFactory.createClient(environment::getProperty); } @Bean public ProvideLocalPseudonyms provideLocalPseudonyms() { - return new ProvideLocalPseudonyms(fhirClientProvider, taskHelper); + return new ProvideLocalPseudonyms(fhirClientProvider, taskHelper, ehrIdColumnPath); } @Bean @@ -225,7 +235,14 @@ public FilterQueryResultsByConsent filterQueryResultsByConsent() @Bean public GenerateBloomFilters generateBloomFilters() { - return new GenerateBloomFilters(fhirClientProvider, taskHelper); + return new GenerateBloomFilters(fhirClientProvider, taskHelper, ehrIdColumnPath, masterPatientIndexClient(), + objectMapper, bouncyCastleProvider()); + } + + @Bean + public MasterPatientIndexClient masterPatientIndexClient() + { + return masterPatientIndexClientFactory.createClient(environment::getProperty); } @Bean diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java index 4dd1a792..44e72594 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java @@ -70,7 +70,7 @@ public String getResultSetUrl() } @JsonIgnore - public boolean isCohortSizeResult() + public boolean isCountResult() { return resultSet == null && resultSetUrl == null; } diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml index 34a12a3e..d6c2b2c9 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml @@ -3,7 +3,7 @@ <tag> <system value="http://highmed.org/fhir/CodeSystem/authorization-role"/> <code value="REMOTE"/> - </tag> + </tag> </meta> <url value="http://highmed.org/fhir/CodeSystem/data-sharing"/> <!-- version managed by bpe --> @@ -20,7 +20,7 @@ <hierarchyMeaning value="grouped-by"/> <versionNeeded value="false"/> <content value="complete"/> - <concept> + <concept> <code value="research-study-reference"/> <display value="Research Study Reference"/> <definition value="HiGHmed Research Study Reference to define what data is requested from which MeDICs and for what purpose"/> @@ -46,14 +46,19 @@ <definition value="MeDIC Correlation Key transferred to TTP for correlating incoming medic results"/> </concept> <concept> - <code value="single-medic-result"/> - <display value="Single MeDIC Result"/> - <definition value="Result of a single query execution"/> + <code value="single-medic-count-result"/> + <display value="Single MeDIC Count Result"/> + <definition value="Result of a single count query execution"/> + </concept> + <concept> + <code value="single-medic-result-set-rbf-reference"/> + <display value="Single MeDIC Result Set Record-Bloom-Filter Reference"/> + <definition value="Reference to an openEHR ResultSet containing the record-bloom-filters as a result of a single id query execution"/> </concept> <concept> - <code value="single-medic-result-reference"/> - <display value="Single MeDIC Result Reference"/> - <definition value="Reference to an openEHR ResultSet as a result of a single query execution"/> + <code value="single-medic-result-set-result-reference"/> + <display value="Single MeDIC Result Set Data Reference"/> + <definition value="Reference to an openEHR ResultSet containing the actual result of a single query execution"/> </concept> <concept> <code value="multi-medic-result"/> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml index 3cec4283..99f2c990 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml @@ -29,7 +29,7 @@ <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <min value="3" /> + <min value="4" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> @@ -58,5 +58,73 @@ <sliceName value="correlation-key" /> <min value="1" /> </element> + <element id="Task.input:single-medic-result-set-rbf-reference"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="single-medic-result-set-rbf-reference" /> + <min value="0" /> + <max value="*" /> + </element> + <element id="Task.input:single-medic-result-set-rbf-reference.extension"> + <path value="Task.input.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + </element> + <element id="Task.input:single-medic-result-set-rbf-reference.extension:group-id"> + <path value="Task.input.extension" /> + <sliceName value="group-id" /> + <min value="1" /> + <type> + <code value="Extension" /> + <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> + </type> + </element> + <element id="Task.input:single-medic-result-set-rbf-reference.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:single-medic-result-set-rbf-reference.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:single-medic-result-set-rbf-reference.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:single-medic-result-set-rbf-reference.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="single-medic-result-set-rbf-reference" /> + </element> + <element id="Task.input:single-medic-result-set-rbf-reference.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="Reference" /> + <targetProfile value="http://hl7.org/fhir/StructureDefinition/Binary" /> + </type> + </element> + <element id="Task.input:single-medic-result-set-rbf-reference.value[x].reference"> + <path value="Task.input.value[x].reference" /> + <min value="1" /> + </element> + <element id="Task.input:single-medic-result-set-rbf-reference.value[x].identifier"> + <path value="Task.input.value[x].identifier" /> + <max value="0" /> + </element> </differential> </StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java index 0f2946dc..2b2cf205 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -2,9 +2,10 @@ import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RBF_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE; import java.util.stream.Stream; @@ -37,24 +38,24 @@ public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskH @Override protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_RBF_RESULTS); return results.getResults().stream().map(result -> toInput(result)); } private Task.ParameterComponent toInput(QueryResult result) { - if (result.isCohortSizeResult()) + if (result.isCountResult()) { ParameterComponent input = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT, result.getCount()); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT, result.getCount()); input.addExtension(createCohortIdExtension(result.getCohortId())); return input; } else if (result.isIdResultSetUrlResult()) { ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE, new Reference(result.getResultSetUrl())); input.addExtension(createCohortIdExtension(result.getCohortId())); return input; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java index f2aaebc8..3fd5ff61 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -5,6 +5,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RBF_RESULTS; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI; import java.security.Key; @@ -96,7 +97,7 @@ protected void doExecute(DelegateExecution execution) throws Exception .map(result -> translateAndCreateBinary(resultSetTranslator, result, securityIdentifier)) .collect(Collectors.toList()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_RBF_RESULTS, QueryResultsValues.create(new QueryResults(translatedResults))); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java index 37468912..26d427a8 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java @@ -4,8 +4,8 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE; import java.util.ArrayList; import java.util.List; @@ -71,8 +71,8 @@ private List<QueryResult> getResults(Task task, boolean needsRecordLinkage) if (needsRecordLinkage) { return taskHelper.getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE, EXTENSION_HIGHMED_GROUP_ID) - .map(input -> + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE, + EXTENSION_HIGHMED_GROUP_ID).map(input -> { String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); String resultSetUrl = ((Reference) input.getValue()).getReference(); @@ -84,7 +84,7 @@ private List<QueryResult> getResults(Task task, boolean needsRecordLinkage) { return taskHelper .getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT, EXTENSION_HIGHMED_GROUP_ID) + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT, EXTENSION_HIGHMED_GROUP_ID) .map(input -> { String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml index e0b65ae4..dde1004d 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml @@ -58,16 +58,16 @@ <sliceName value="correlation-key" /> <min value="1" /> </element> - <element id="Task.input:single-medic-result"> + <element id="Task.input:single-medic-count-result"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <sliceName value="single-medic-result" /> + <sliceName value="single-medic-count-result" /> <min value="0" /> <max value="*" /> </element> - <element id="Task.input:single-medic-result.extension"> + <element id="Task.input:single-medic-count-result.extension"> <path value="Task.input.extension" /> <slicing> <discriminator> @@ -77,7 +77,7 @@ <rules value="open" /> </slicing> </element> - <element id="Task.input:single-medic-result.extension:group-id"> + <element id="Task.input:single-medic-count-result.extension:group-id"> <path value="Task.input.extension" /> <sliceName value="group-id" /> <min value="1" /> @@ -86,7 +86,7 @@ <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> </type> </element> - <element id="Task.input:single-medic-result.type"> + <element id="Task.input:single-medic-count-result.type"> <path value="Task.input.type" /> <binding> <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> @@ -96,37 +96,37 @@ <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> - <element id="Task.input:single-medic-result.type.coding"> + <element id="Task.input:single-medic-count-result.type.coding"> <path value="Task.input.type.coding" /> <min value="1" /> <max value="1" /> </element> - <element id="Task.input:single-medic-result.type.coding.system"> + <element id="Task.input:single-medic-count-result.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> - <element id="Task.input:single-medic-result.type.coding.code"> + <element id="Task.input:single-medic-count-result.type.coding.code"> <path value="Task.input.type.coding.code" /> <min value="1" /> - <fixedCode value="single-medic-result" /> + <fixedCode value="single-medic-count-result" /> </element> - <element id="Task.input:single-medic-result.value[x]"> + <element id="Task.input:single-medic-count-result.value[x]"> <path value="Task.input.value[x]" /> <type> <code value="unsignedInt" /> </type> </element> - <element id="Task.input:single-medic-result-reference"> + <element id="Task.input:single-medic-result-set-rbf-reference"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <sliceName value="single-medic-result-reference" /> + <sliceName value="single-medic-result-set-rbf-reference" /> <min value="0" /> <max value="*" /> </element> - <element id="Task.input:single-medic-result-reference.extension"> + <element id="Task.input:single-medic-result-set-rbf-reference.extension"> <path value="Task.input.extension" /> <slicing> <discriminator> @@ -136,7 +136,7 @@ <rules value="open" /> </slicing> </element> - <element id="Task.input:single-medic-result-reference.extension:group-id"> + <element id="Task.input:single-medic-result-set-rbf-reference.extension:group-id"> <path value="Task.input.extension" /> <sliceName value="group-id" /> <min value="1" /> @@ -145,7 +145,7 @@ <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> </type> </element> - <element id="Task.input:single-medic-result-reference.type"> + <element id="Task.input:single-medic-result-set-rbf-reference.type"> <path value="Task.input.type" /> <binding> <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> @@ -155,33 +155,33 @@ <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> - <element id="Task.input:single-medic-result-reference.type.coding"> + <element id="Task.input:single-medic-result-set-rbf-reference.type.coding"> <path value="Task.input.type.coding" /> <min value="1" /> <max value="1" /> </element> - <element id="Task.input:single-medic-result-reference.type.coding.system"> + <element id="Task.input:single-medic-result-set-rbf-reference.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> - <element id="Task.input:single-medic-result-reference.type.coding.code"> + <element id="Task.input:single-medic-result-set-rbf-reference.type.coding.code"> <path value="Task.input.type.coding.code" /> <min value="1" /> - <fixedCode value="single-medic-result-reference" /> + <fixedCode value="single-medic-result-set-rbf-reference" /> </element> - <element id="Task.input:single-medic-result-reference.value[x]"> + <element id="Task.input:single-medic-result-set-rbf-reference.value[x]"> <path value="Task.input.value[x]" /> <type> <code value="Reference" /> <targetProfile value="http://hl7.org/fhir/StructureDefinition/Binary" /> </type> </element> - <element id="Task.input:single-medic-result-reference.value[x].reference"> + <element id="Task.input:single-medic-result-set-rbf-reference.value[x].reference"> <path value="Task.input.value[x].reference" /> <min value="1" /> </element> - <element id="Task.input:single-medic-result-reference.value[x].identifier"> + <element id="Task.input:single-medic-result-set-rbf-reference.value[x].identifier"> <path value="Task.input.value[x].identifier" /> <max value="0" /> </element> diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index 13dbda34..3f27ea56 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -15,8 +15,8 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION; @@ -277,12 +277,12 @@ private Task createValidTaskSingleMedicResultFeasibilityUnsignedIntResult() ParameterComponent inSingleMedicResult1 = task.addInput(); inSingleMedicResult1.setValue(new UnsignedIntType(5)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) - .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT); + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT); inSingleMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); ParameterComponent inSingleMedicResult2 = task.addInput(); inSingleMedicResult2.setValue(new UnsignedIntType(10)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) - .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT); + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT); inSingleMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); return task; @@ -298,12 +298,12 @@ private Task createValidTaskSingleMedicResultFeasibilityReferenceResult() ParameterComponent inSingleMedicResult1 = task.addInput(); inSingleMedicResult1.setValue(new Reference("Binary/" + UUID.randomUUID().toString())).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) - .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE); + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE); inSingleMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); ParameterComponent inSingleMedicResult2 = task.addInput(); inSingleMedicResult2.setValue(new Reference("Binary/" + UUID.randomUUID().toString())).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) - .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE); + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE); inSingleMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); return task; diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java index 28da8c31..c3d41ec0 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java @@ -2,9 +2,10 @@ import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RBF_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; @@ -32,7 +33,7 @@ public StoreResult(FhirWebserviceClientProvider clientProvider, TaskHelper taskH protected void doExecute(DelegateExecution execution) throws Exception { Task task = getCurrentTaskFromExecutionVariables(); - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_RBF_RESULTS); addOutputs(task, results); } @@ -44,10 +45,10 @@ private void addOutputs(Task task, QueryResults results) private void addOutput(Task task, QueryResult result) { - if (result.isCohortSizeResult()) + if (result.isCountResult()) { Task.TaskOutputComponent output = getTaskHelper().createOutputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT, result.getCount()); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT, result.getCount()); output.addExtension(createCohortIdExtension(result.getCohortId())); task.addOutput(output); @@ -55,7 +56,7 @@ private void addOutput(Task task, QueryResult result) else if (result.isIdResultSetUrlResult()) { Task.TaskOutputComponent output = getTaskHelper().createOutput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_REFERENCE, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE, new Reference(result.getResultSetUrl())); output.addExtension(createCohortIdExtension(result.getCohortId())); diff --git a/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml b/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml index cbc20e33..d949aaf1 100644 --- a/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml +++ b/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml @@ -212,14 +212,14 @@ <code value="string" /> </type> </element> - <element id="Task.output:single-medic-result"> + <element id="Task.output:single-medic-count-result"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> <valueString value="Parameter" /> </extension> <path value="Task.output" /> - <sliceName value="single-medic-result" /> + <sliceName value="single-medic-count-result" /> </element> - <element id="Task.output:single-medic-result.extension"> + <element id="Task.output:single-medic-count-result.extension"> <path value="Task.output.extension" /> <slicing> <discriminator> @@ -229,7 +229,7 @@ <rules value="open" /> </slicing> </element> - <element id="Task.output:single-medic-result.extension:group-id"> + <element id="Task.output:single-medic-count-result.extension:group-id"> <path value="Task.output.extension" /> <sliceName value="group-id" /> <min value="1" /> @@ -238,7 +238,7 @@ <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> </type> </element> - <element id="Task.output:single-medic-result.type"> + <element id="Task.output:single-medic-count-result.type"> <path value="Task.output.type" /> <binding> <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> @@ -248,35 +248,35 @@ <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> - <element id="Task.output:single-medic-result.type.coding"> + <element id="Task.output:single-medic-count-result.type.coding"> <path value="Task.output.type.coding" /> <min value="1" /> <max value="1" /> </element> - <element id="Task.output:single-medic-result.type.coding.system"> + <element id="Task.output:single-medic-count-result.type.coding.system"> <path value="Task.output.type.coding.system" /> <min value="1" /> <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> - <element id="Task.output:single-medic-result.type.coding.code"> + <element id="Task.output:single-medic-count-result.type.coding.code"> <path value="Task.output.type.coding.code" /> <min value="1" /> - <fixedCode value="single-medic-result" /> + <fixedCode value="single-medic-count-result" /> </element> - <element id="Task.output:single-medic-result.value[x]"> + <element id="Task.output:single-medic-count-result.value[x]"> <path value="Task.output.value[x]" /> <type> <code value="unsignedInt" /> </type> </element> - <element id="Task.output:single-medic-result-reference"> + <element id="Task.output:single-medic-result-set-rbf-reference"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> <valueString value="Parameter" /> </extension> <path value="Task.output" /> - <sliceName value="single-medic-result-reference" /> + <sliceName value="single-medic-result-set-rbf-reference" /> </element> - <element id="Task.output:single-medic-result-reference.extension"> + <element id="Task.output:single-medic-result-set-rbf-reference.extension"> <path value="Task.output.extension" /> <slicing> <discriminator> @@ -286,7 +286,7 @@ <rules value="open" /> </slicing> </element> - <element id="Task.output:single-medic-result-reference.extension:group-id"> + <element id="Task.output:single-medic-result-set-rbf-reference.extension:group-id"> <path value="Task.output.extension" /> <sliceName value="group-id" /> <min value="1" /> @@ -295,7 +295,7 @@ <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> </type> </element> - <element id="Task.output:single-medic-result-reference.type"> + <element id="Task.output:single-medic-result-set-rbf-reference.type"> <path value="Task.output.type" /> <binding> <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> @@ -305,33 +305,33 @@ <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> - <element id="Task.output:single-medic-result-reference.type.coding"> + <element id="Task.output:single-medic-result-set-rbf-reference.type.coding"> <path value="Task.output.type.coding" /> <min value="1" /> <max value="1" /> </element> - <element id="Task.output:single-medic-result-reference.type.coding.system"> + <element id="Task.output:single-medic-result-set-rbf-reference.type.coding.system"> <path value="Task.output.type.coding.system" /> <min value="0" /> <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> - <element id="Task.output:single-medic-result-reference.type.coding.code"> + <element id="Task.output:single-medic-result-set-rbf-reference.type.coding.code"> <path value="Task.output.type.coding.code" /> <min value="0" /> <fixedCode value="single-medic-result-reference" /> </element> - <element id="Task.output:single-medic-result-reference.value[x]"> + <element id="Task.output:single-medic-result-set-rbf-reference.value[x]"> <path value="Task.output.value[x]" /> <type> <code value="Reference" /> <targetProfile value="http://hl7.org/fhir/StructureDefinition/Binary" /> </type> </element> - <element id="Task.output:single-medic-result-reference.value[x].reference"> + <element id="Task.output:single-medic-result-set-rbf-reference.value[x].reference"> <path value="Task.output.value[x].reference" /> <min value="0" /> </element> - <element id="Task.output:single-medic-result-reference.value[x].identifier"> + <element id="Task.output:single-medic-result-set-rbf-reference.value[x].identifier"> <path value="Task.output.value[x].identifier" /> <max value="0" /> </element> From aebda8682d4a6e050b483b42ef4d1edc963a11a4 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Thu, 11 Feb 2021 08:46:16 +0100 Subject: [PATCH 015/125] add result set as binary to input of single medic result message --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 8 +- .../bpe/message/SendSingleMedicResults.java | 23 ++++- .../dsf/bpe/service/ExecuteQueries.java | 8 +- .../service/FilterQueryResultsByConsent.java | 8 +- .../dsf/bpe/service/GenerateBloomFilters.java | 10 +-- .../bpe/service/ProvideLocalPseudonyms.java | 86 ++++++++++++++++--- .../bpe/spring/config/DataSharingConfig.java | 2 +- .../highmed/dsf/bpe/variable/QueryResult.java | 57 +++++++++--- .../fhir/CodeSystem/highmed-data-sharing.xml | 2 +- ...-task-single-medic-result-data-sharing.xml | 68 +++++++++++++++ .../bpe/message/SendMultiMedicResults.java | 4 +- .../bpe/message/SendSingleMedicResults.java | 7 +- .../service/CalculateMultiMedicResults.java | 8 +- .../bpe/service/CheckSingleMedicResults.java | 6 +- .../CheckTtpComputedMultiMedicResults.java | 6 +- .../dsf/bpe/service/DownloadResultSets.java | 8 +- .../dsf/bpe/service/ExecuteQueries.java | 6 +- .../dsf/bpe/service/ExecuteRecordLink.java | 8 +- .../service/FilterQueryResultsByConsent.java | 8 +- .../dsf/bpe/service/GenerateBloomFilters.java | 10 +-- .../dsf/bpe/service/GenerateCountFromIds.java | 6 +- .../dsf/bpe/service/StoreCorrelationKeys.java | 5 +- .../highmed/dsf/bpe/service/StoreResults.java | 8 +- .../highmed/dsf/bpe/service/StoreResult.java | 7 +- 24 files changed, 273 insertions(+), 96 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index 4d3b257d..25586fca 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -11,9 +11,9 @@ public interface ConstantsDataSharing String BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG = "bloomFilterConfig"; String BPMN_EXECUTION_VARIABLE_COHORTS = "cohorts"; String BPMN_EXECUTION_VARIABLE_QUERIES = "queries"; - String BPMN_EXECUTION_VARIABLE_QUERY_RESULTS = "queryResults"; - String BPMN_EXECUTION_VARIABLE_RBF_RESULTS = "rbfResults"; - String BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS = "finalQueryResults"; + String BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS = "queryDataResults"; + String BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS = "queryRbfResults"; + String BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS = "finalQueryDataResults"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestDataSharing/"; @@ -28,7 +28,7 @@ public interface ConstantsDataSharing String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG = "bloom-filter-configuration"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY = "medic-correlation-key"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT = "single-medic-count-result"; - String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RESULT_REFERENCE = "single-medic-result-set-result-reference"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_DATA_REFERENCE = "single-medic-result-set-data-reference"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE = "single-medic-result-set-rbf-reference"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT = "multi-medic-result"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS = "participating-medics"; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java index f3aa297c..124de595 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -1,8 +1,10 @@ package org.highmed.dsf.bpe.message; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RBF_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_DATA_REFERENCE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE; import java.util.stream.Stream; @@ -36,14 +38,19 @@ public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskH @Override protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_RBF_RESULTS); + QueryResults rbfResults = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS); + Stream<ParameterComponent> inputRbfReferences = rbfResults.getResults().stream().map(result -> toInput(result)); - return results.getResults().stream().map(result -> toInput(result)); + QueryResults dataResults = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); + Stream<ParameterComponent> inputDataReferences = dataResults.getResults().stream() + .map(result -> toInput(result)); + + return Stream.concat(inputRbfReferences, inputDataReferences); } private Task.ParameterComponent toInput(QueryResult result) { - if (result.isIdResultSetUrlResult()) + if (result.isRbfResultSetUrlResult()) { ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE, @@ -51,6 +58,14 @@ private Task.ParameterComponent toInput(QueryResult result) input.addExtension(createCohortIdExtension(result.getCohortId())); return input; } + else if (result.isDataResultSetUrlResult()) + { + ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_DATA_REFERENCE, + new Reference(result.getResultSetUrl())); + input.addExtension(createCohortIdExtension(result.getCohortId())); + return input; + } else { logger.warn("Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java index f0bd7cc5..76478eb6 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -1,9 +1,7 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; import java.util.List; import java.util.Map; @@ -54,7 +52,7 @@ protected void doExecute(DelegateExecution execution) throws Exception List<QueryResult> results = queries.entrySet().stream() .map(entry -> executeQuery(entry.getKey(), entry.getValue())).collect(Collectors.toList()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, QueryResultsValues.create(new QueryResults(results))); } @@ -64,6 +62,6 @@ private QueryResult executeQuery(String cohortId, String cohortQuery) // errors and possible meta-data. ResultSet resultSet = openehrClient.query(cohortQuery, null); - return QueryResult.resultSet(organizationProvider.getLocalIdentifierValue(), cohortId, resultSet); + return QueryResult.rbfResultSet(organizationProvider.getLocalIdentifierValue(), cohortId, resultSet); } } \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java index 2c94ac2d..9d8684ba 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java @@ -1,6 +1,6 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; import java.util.List; import java.util.stream.Collectors; @@ -24,11 +24,11 @@ public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); List<QueryResult> filteredResults = filterResults(results.getResults()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, QueryResultsValues.create(new QueryResults(filteredResults))); } @@ -39,7 +39,7 @@ private List<QueryResult> filterResults(List<QueryResult> results) protected QueryResult filterResult(QueryResult result) { - return QueryResult.resultSet(result.getOrganizationIdentifier(), result.getCohortId(), + return QueryResult.rbfResultSet(result.getOrganizationIdentifier(), result.getCohortId(), filterResultSet(result.getResultSet())); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java index 91446eb6..3bde663f 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -4,8 +4,8 @@ import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RBF_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS; import java.security.Key; import java.util.List; @@ -82,7 +82,7 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); String securityIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution @@ -94,7 +94,7 @@ protected void doExecute(DelegateExecution execution) throws Exception .map(result -> translateAndCreateBinary(resultSetTranslator, result, securityIdentifier)) .collect(Collectors.toList()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_RBF_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS, QueryResultsValues.create(new QueryResults(translatedResults))); } @@ -120,7 +120,7 @@ private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtpRbfOnly res ResultSet translatedResultSet = translate(resultSetTranslator, result.getResultSet()); String resultSetUrl = saveResultSetAsBinaryForTtp(translatedResultSet, ttpIdentifier); - return QueryResult.resultSet(result.getOrganizationIdentifier(), result.getCohortId(), resultSetUrl); + return QueryResult.rbfResultSet(result.getOrganizationIdentifier(), result.getCohortId(), resultSetUrl); } private ResultSet translate(ResultSetTranslatorToTtpRbfOnly resultSetTranslator, ResultSet resultSet) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java index 63a45014..f1a723e2 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java @@ -1,30 +1,48 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; + import java.util.List; import java.util.Objects; -import java.util.function.Predicate; +import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; -import org.highmed.openehr.model.structure.Column; -import org.highmed.pseudonymization.openehr.Constants; +import org.highmed.openehr.model.structure.ResultSet; +import org.hl7.fhir.r4.model.Binary; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResourceType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import ca.uhn.fhir.context.FhirContext; + public class ProvideLocalPseudonyms extends AbstractServiceDelegate implements InitializingBean { private static final Logger logger = LoggerFactory.getLogger(ProvideLocalPseudonyms.class); private final String ehrIdColumnPath; + private final ObjectMapper openEhrObjectMapper; public ProvideLocalPseudonyms(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - String ehrIdColumnPath) + String ehrIdColumnPath, ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper); this.ehrIdColumnPath = ehrIdColumnPath; + this.openEhrObjectMapper = openEhrObjectMapper; } @Override @@ -32,26 +50,68 @@ public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath"); + Objects.requireNonNull(openEhrObjectMapper, "openEhrObjectMapper"); } @Override protected void doExecute(DelegateExecution execution) { - logger.info(this.getClass().getName() + " doExecute called"); + String securityIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); + + // TODO: replace ehrId with pseudonym first order + + List<QueryResult> binaryResults = results.getResults().stream() + .map(result -> createBinary(result, securityIdentifier)).collect(Collectors.toList()); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, + QueryResultsValues.create(new QueryResults(binaryResults))); + } + + protected QueryResult createBinary(QueryResult result, String securityIdentifier) + { + String binaryUrl = saveResultSetAsBinaryForTtp(result.getResultSet(), securityIdentifier); + return QueryResult.dataResultSet(result.getOrganizationIdentifier(), result.getCohortId(), binaryUrl); } - private int getEhrColumnIndex(List<Column> columns) + protected String saveResultSetAsBinaryForTtp(ResultSet resultSet, String securityIdentifier) { - for (int i = 0; i < columns.size(); i++) - if (isEhrIdColumn().test(columns.get(i))) - return i; + byte[] content = serializeResultSet(resultSet); + Reference securityContext = new Reference(); + securityContext.setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(securityIdentifier); + Binary binary = new Binary().setContentType(OPENEHR_MIMETYPE_JSON).setSecurityContext(securityContext) + .setData(content); - return -1; + IdType created = createBinaryResource(binary); + return new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl(), ResourceType.Binary.name(), + created.getIdPart(), created.getVersionIdPart()).getValue(); + } + + private byte[] serializeResultSet(ResultSet resultSet) + { + try + { + return openEhrObjectMapper.writeValueAsBytes(resultSet); + } + catch (JsonProcessingException e) + { + logger.warn("Error while serializing ResultSet: " + e.getMessage(), e); + throw new RuntimeException(e); + } } - private Predicate<? super Column> isEhrIdColumn() + private IdType createBinaryResource(Binary binary) { - return column -> Constants.EHRID_COLUMN_NAME.equals(column.getName()) - && ehrIdColumnPath.equals(column.getPath()); + try + { + return getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().create(binary); + } + catch (Exception e) + { + logger.debug("Binary to create {}", FhirContext.forR4().newJsonParser().encodeResourceToString(binary)); + logger.warn("Error while creating Binary resoruce: " + e.getMessage(), e); + throw e; + } } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index cd01eda9..c4da7472 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -217,7 +217,7 @@ public OpenEhrClient openEhrClient() @Bean public ProvideLocalPseudonyms provideLocalPseudonyms() { - return new ProvideLocalPseudonyms(fhirClientProvider, taskHelper, ehrIdColumnPath); + return new ProvideLocalPseudonyms(fhirClientProvider, taskHelper, ehrIdColumnPath, objectMapper); } @Bean diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java index 44e72594..9267b1a3 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java @@ -13,35 +13,48 @@ public class QueryResult private final int count; private final ResultSet resultSet; private final String resultSetUrl; + private boolean isRbfResultSet; public static QueryResult count(String organizationIdentifier, String cohortId, int count) { if (count < 0) throw new IllegalArgumentException("count >= 0 expected"); - return new QueryResult(organizationIdentifier, cohortId, count, null, null); + return new QueryResult(organizationIdentifier, cohortId, count, null, null, false); } - public static QueryResult resultSet(String organizationIdentifier, String cohortId, ResultSet resultSet) + public static QueryResult rbfResultSet(String organizationIdentifier, String cohortId, ResultSet resultSet) { - return new QueryResult(organizationIdentifier, cohortId, -1, resultSet, null); + return new QueryResult(organizationIdentifier, cohortId, -1, resultSet, null, true); } - public static QueryResult resultSet(String organizationIdentifier, String cohortId, String resultSetUrl) + public static QueryResult rbfResultSet(String organizationIdentifier, String cohortId, String resultSetUrl) { - return new QueryResult(organizationIdentifier, cohortId, -1, null, resultSetUrl); + return new QueryResult(organizationIdentifier, cohortId, -1, null, resultSetUrl, true); + } + + public static QueryResult dataResultSet(String organizationIdentifier, String cohortId, ResultSet resultSet) + { + return new QueryResult(organizationIdentifier, cohortId, -1, resultSet, null, false); + } + + public static QueryResult dataResultSet(String organizationIdentifier, String cohortId, String resultSetUrl) + { + return new QueryResult(organizationIdentifier, cohortId, -1, null, resultSetUrl, false); } @JsonCreator public QueryResult(@JsonProperty("organizationIdentifier") String organizationIdentifier, @JsonProperty("cohortId") String cohortId, @JsonProperty("count") int count, - @JsonProperty("resultSet") ResultSet resultSet, @JsonProperty("resultSetUrl") String resultSetUrl) + @JsonProperty("resultSet") ResultSet resultSet, @JsonProperty("resultSetUrl") String resultSetUrl, + @JsonProperty("isRbfResultSet") boolean isRbfResultSet) { this.organizationIdentifier = organizationIdentifier; this.cohortId = cohortId; this.count = count; this.resultSet = resultSet; this.resultSetUrl = resultSetUrl; + this.isRbfResultSet = isRbfResultSet; } public String getOrganizationIdentifier() @@ -76,14 +89,38 @@ public boolean isCountResult() } @JsonIgnore - public boolean isIdResultSetResult() + public boolean isRbfResultSetResult() + { + return isRbfResultSet && isResultSetResult(); + } + + @JsonIgnore + public boolean isRbfResultSetUrlResult() + { + return isRbfResultSet && isResultSetUrlResult(); + } + + @JsonIgnore + public boolean isDataResultSetResult() + { + return !isRbfResultSet && isResultSetResult(); + } + + @JsonIgnore + public boolean isDataResultSetUrlResult() + { + return !isRbfResultSet && isResultSetUrlResult(); + } + + @JsonIgnore + private boolean isResultSetResult() { - return resultSet != null && resultSetUrl == null; + return resultSet != null; } @JsonIgnore - public boolean isIdResultSetUrlResult() + private boolean isResultSetUrlResult() { - return resultSet == null && resultSetUrl != null; + return resultSetUrl != null; } } diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml index d6c2b2c9..405ec423 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml @@ -56,7 +56,7 @@ <definition value="Reference to an openEHR ResultSet containing the record-bloom-filters as a result of a single id query execution"/> </concept> <concept> - <code value="single-medic-result-set-result-reference"/> + <code value="single-medic-result-set-data-reference"/> <display value="Single MeDIC Result Set Data Reference"/> <definition value="Reference to an openEHR ResultSet containing the actual result of a single query execution"/> </concept> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml index 99f2c990..77a493d9 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml @@ -126,5 +126,73 @@ <path value="Task.input.value[x].identifier" /> <max value="0" /> </element> + <element id="Task.input:single-medic-result-data-data-reference"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="single-medic-result-set-data-reference" /> + <min value="0" /> + <max value="*" /> + </element> + <element id="Task.input:single-medic-result-set-data-reference.extension"> + <path value="Task.input.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + </element> + <element id="Task.input:single-medic-result-set-data-reference.extension:group-id"> + <path value="Task.input.extension" /> + <sliceName value="group-id" /> + <min value="1" /> + <type> + <code value="Extension" /> + <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> + </type> + </element> + <element id="Task.input:single-medic-result-set-data-reference.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:single-medic-result-set-data-reference.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:single-medic-result-set-data-reference.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:single-medic-result-set-data-reference.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="single-medic-result-set-data-reference" /> + </element> + <element id="Task.input:single-medic-result-set-data-reference.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="Reference" /> + <targetProfile value="http://hl7.org/fhir/StructureDefinition/Binary" /> + </type> + </element> + <element id="Task.input:single-medic-result-set-data-reference.value[x].reference"> + <path value="Task.input.value[x].reference" /> + <min value="1" /> + </element> + <element id="Task.input:single-medic-result-set-data-reference.value[x].identifier"> + <path value="Task.input.value[x].identifier" /> + <max value="0" /> + </element> </differential> </StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java index dd5d5efa..bc9c6ebb 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java @@ -3,7 +3,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS; @@ -38,7 +38,7 @@ public SendMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHe protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { FinalFeasibilityQueryResults results = (FinalFeasibilityQueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS); + .getVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS); Stream<ParameterComponent> resultInputs = results.getResults().stream().flatMap(this::toInputs); Stream<ParameterComponent> errorInput = getErrorInput(execution); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java index 2b2cf205..12cd0c4e 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -1,8 +1,7 @@ package org.highmed.dsf.bpe.message; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RBF_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE; @@ -38,7 +37,7 @@ public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskH @Override protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_RBF_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS); return results.getResults().stream().map(result -> toInput(result)); } @@ -52,7 +51,7 @@ private Task.ParameterComponent toInput(QueryResult result) input.addExtension(createCohortIdExtension(result.getCohortId())); return input; } - else if (result.isIdResultSetUrlResult()) + else if (result.isRbfResultSetUrlResult()) { ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE, diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java index 4cdcb7e2..1f9eb233 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; import java.util.List; import java.util.Map; @@ -27,12 +27,12 @@ public CalculateMultiMedicResults(FhirWebserviceClientProvider clientProvider, T @Override protected void doExecute(DelegateExecution execution) throws Exception { - List<QueryResult> results = ((QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS)) + List<QueryResult> results = ((QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS)) .getResults(); List<FinalFeasibilityQueryResult> finalResults = calculateResults(results); - execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS, FinalFeasibilityQueryResultsValues.create(new FinalFeasibilityQueryResults(finalResults))); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java index 09fd7eb2..c792047c 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java @@ -1,6 +1,6 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; import java.util.ArrayList; import java.util.List; @@ -30,7 +30,7 @@ public CheckSingleMedicResults(FhirWebserviceClientProvider clientProvider, Task @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); Task currentTask = getCurrentTaskFromExecutionVariables(); List<QueryResult> filteredResults = filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(results, @@ -38,7 +38,7 @@ protected void doExecute(DelegateExecution execution) throws Exception // TODO: add percentage filter over results - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, QueryResultsValues.create(new QueryResults(filteredResults))); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java index c02f3b0d..72210135 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java @@ -4,7 +4,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS; import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_RESULT; import static org.highmed.dsf.bpe.ConstantsFeasibility.MIN_PARTICIPATING_MEDICS_FOR_FEASIBILITY; @@ -37,12 +37,12 @@ protected void doExecute(DelegateExecution execution) throws Exception { Task leadingTask = getLeadingTaskFromExecutionVariables(); FinalFeasibilityQueryResults results = (FinalFeasibilityQueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS); + .getVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS); List<FinalFeasibilityQueryResult> resultsWithEnoughParticipatingMedics = filterResultsByParticipatingMedics( leadingTask, results); - execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS, FinalFeasibilityQueryResultsValues + execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS, FinalFeasibilityQueryResultsValues .create(new FinalFeasibilityQueryResults(resultsWithEnoughParticipatingMedics))); boolean existsAtLeastOneResult = checkIfAtLeastOneResultExists(leadingTask, diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java index f2c4212f..3c4c2a3c 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; import java.io.IOException; import java.io.InputStream; @@ -51,11 +51,11 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); List<QueryResult> resultsWithResultSets = download(results); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, QueryResultsValues.create(new QueryResults(resultsWithResultSets))); } @@ -72,7 +72,7 @@ private QueryResult download(QueryResult result) InputStream binary = readBinaryResource(client, id.getIdPart()); ResultSet resultSet = deserializeResultSet(binary); - return QueryResult.resultSet(result.getOrganizationIdentifier(), result.getCohortId(), resultSet); + return QueryResult.rbfResultSet(result.getOrganizationIdentifier(), result.getCohortId(), resultSet); } private InputStream readBinaryResource(FhirWebserviceClient client, String id) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java index 618fc0f4..12117302 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -3,7 +3,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; import java.util.List; import java.util.Map; @@ -59,7 +59,7 @@ protected void doExecute(DelegateExecution execution) throws Exception List<QueryResult> results = queries.entrySet().stream() .map(entry -> executeQuery(entry.getKey(), entry.getValue(), idQuery)).collect(Collectors.toList()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, QueryResultsValues.create(new QueryResults(results))); } @@ -72,7 +72,7 @@ private QueryResult executeQuery(String cohortId, String cohortQuery, boolean id if (idQuery) { - return QueryResult.resultSet(organizationProvider.getLocalIdentifierValue(), cohortId, resultSet); + return QueryResult.rbfResultSet(organizationProvider.getLocalIdentifierValue(), cohortId, resultSet); } else { diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java index bd6d6963..a78fa9dc 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; import java.util.List; import java.util.Map; @@ -51,7 +51,7 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); Map<String, List<QueryResult>> byCohortId = results.getResults().stream() .collect(Collectors.groupingBy(QueryResult::getCohortId)); @@ -61,7 +61,7 @@ protected void doExecute(DelegateExecution execution) throws Exception List<FinalFeasibilityQueryResult> matchedResults = byCohortId.entrySet().stream() .map(e -> match(matcher, e.getKey(), e.getValue())).collect(Collectors.toList()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS, FinalFeasibilityQueryResultsValues.create(new FinalFeasibilityQueryResults(matchedResults))); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java index 2c94ac2d..9d8684ba 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java @@ -1,6 +1,6 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; import java.util.List; import java.util.stream.Collectors; @@ -24,11 +24,11 @@ public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); List<QueryResult> filteredResults = filterResults(results.getResults()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, QueryResultsValues.create(new QueryResults(filteredResults))); } @@ -39,7 +39,7 @@ private List<QueryResult> filterResults(List<QueryResult> results) protected QueryResult filterResult(QueryResult result) { - return QueryResult.resultSet(result.getOrganizationIdentifier(), result.getCohortId(), + return QueryResult.rbfResultSet(result.getOrganizationIdentifier(), result.getCohortId(), filterResultSet(result.getResultSet())); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java index 3fd5ff61..57d8786b 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -4,8 +4,8 @@ import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RBF_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI; import java.security.Key; @@ -84,7 +84,7 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); String securityIdentifier = getSecurityIdentifier(execution); @@ -97,7 +97,7 @@ protected void doExecute(DelegateExecution execution) throws Exception .map(result -> translateAndCreateBinary(resultSetTranslator, result, securityIdentifier)) .collect(Collectors.toList()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_RBF_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS, QueryResultsValues.create(new QueryResults(translatedResults))); } @@ -133,7 +133,7 @@ private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtpRbfOnly res ResultSet translatedResultSet = translate(resultSetTranslator, result.getResultSet()); String resultSetUrl = saveResultSetAsBinaryForTtp(translatedResultSet, ttpIdentifier); - return QueryResult.resultSet(result.getOrganizationIdentifier(), result.getCohortId(), resultSetUrl); + return QueryResult.rbfResultSet(result.getOrganizationIdentifier(), result.getCohortId(), resultSetUrl); } private ResultSet translate(ResultSetTranslatorToTtpRbfOnly resultSetTranslator, ResultSet resultSet) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java index d7aa6cbf..90b1e117 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java @@ -1,6 +1,6 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; import java.util.List; import java.util.stream.Collectors; @@ -23,11 +23,11 @@ public GenerateCountFromIds(FhirWebserviceClientProvider clientProvider, TaskHel @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); List<QueryResult> filteredResults = count(results.getResults()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, QueryResultsValues.create(new QueryResults(filteredResults))); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java index 76bba58d..d289c4a1 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; @@ -45,7 +45,8 @@ protected void doExecute(DelegateExecution execution) throws Exception boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(null))); + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, + QueryResultsValues.create(new QueryResults(null))); } private boolean getNeedsRecordLinkageCheck(Task task) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java index 26d427a8..956e22ac 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java @@ -2,7 +2,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE; @@ -48,7 +48,7 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); boolean needsRecordLinkage = Boolean.TRUE .equals((Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE)); @@ -59,7 +59,7 @@ protected void doExecute(DelegateExecution execution) throws Exception extendedResults.addAll(results.getResults()); extendedResults.addAll(getResults(task, needsRecordLinkage)); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, QueryResultsValues.create(new QueryResults(extendedResults))); } @@ -77,7 +77,7 @@ private List<QueryResult> getResults(Task task, boolean needsRecordLinkage) String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); String resultSetUrl = ((Reference) input.getValue()).getReference(); - return QueryResult.resultSet(requester.getIdentifier().getValue(), cohortId, resultSetUrl); + return QueryResult.rbfResultSet(requester.getIdentifier().getValue(), cohortId, resultSetUrl); }).collect(Collectors.toList()); } else diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java index c3d41ec0..3ddebb38 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java @@ -1,8 +1,7 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RBF_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE; @@ -33,7 +32,7 @@ public StoreResult(FhirWebserviceClientProvider clientProvider, TaskHelper taskH protected void doExecute(DelegateExecution execution) throws Exception { Task task = getCurrentTaskFromExecutionVariables(); - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_RBF_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS); addOutputs(task, results); } @@ -53,7 +52,7 @@ private void addOutput(Task task, QueryResult result) output.addExtension(createCohortIdExtension(result.getCohortId())); task.addOutput(output); } - else if (result.isIdResultSetUrlResult()) + else if (result.isRbfResultSetUrlResult()) { Task.TaskOutputComponent output = getTaskHelper().createOutput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE, From e9b7a1e4a5d32d96462c873ea12fbf1740d341cf Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Thu, 11 Feb 2021 09:31:39 +0100 Subject: [PATCH 016/125] distinction between count and rbf result, fix output code fixed value --- .../highmed/dsf/bpe/message/SendSingleMedicResults.java | 8 +++++++- ...uestFeasibilityFromMedicsViaMedic1ExampleStarter.java | 9 +++++++-- .../java/org/highmed/dsf/bpe/service/StoreResult.java | 9 ++++++++- .../highmed-task-local-services-integration.xml | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java index 12cd0c4e..ca5f87d9 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -1,6 +1,8 @@ package org.highmed.dsf.bpe.message; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; @@ -37,7 +39,11 @@ public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskH @Override protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS); + Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); + + QueryResults results = needsRecordLinkage + ? (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS) + : (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); return results.getResults().stream().map(result -> toInput(result)); } diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java index 61f44897..3cf1471e 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java @@ -47,6 +47,9 @@ public class RequestFeasibilityFromMedicsViaMedic1ExampleStarter { + private static boolean NEEDS_CONSENT_CHECK = true; + private static boolean NEEDS_RECORD_LINKAGE = true; + // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate @@ -153,9 +156,11 @@ private static Task createTask(ResearchStudy researchStudy) .setType(ResourceType.ResearchStudy.name())) .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); - task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + task.addInput().setValue(new BooleanType(NEEDS_RECORD_LINKAGE)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); - task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + task.addInput().setValue(new BooleanType(NEEDS_CONSENT_CHECK)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); return task; diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java index 3ddebb38..9a3ab356 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java @@ -1,6 +1,8 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; @@ -32,7 +34,12 @@ public StoreResult(FhirWebserviceClientProvider clientProvider, TaskHelper taskH protected void doExecute(DelegateExecution execution) throws Exception { Task task = getCurrentTaskFromExecutionVariables(); - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS); + + Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); + + QueryResults results = needsRecordLinkage + ? (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS) + : (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); addOutputs(task, results); } diff --git a/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml b/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml index d949aaf1..da0db75c 100644 --- a/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml +++ b/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml @@ -318,7 +318,7 @@ <element id="Task.output:single-medic-result-set-rbf-reference.type.coding.code"> <path value="Task.output.type.coding.code" /> <min value="0" /> - <fixedCode value="single-medic-result-reference" /> + <fixedCode value="single-medic-result-set-rbf-reference" /> </element> <element id="Task.output:single-medic-result-set-rbf-reference.value[x]"> <path value="Task.output.value[x]" /> From b02f1f8b9e057e5e7a0d4e813473a0b004431c1e Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Thu, 4 Mar 2021 15:40:33 +0100 Subject: [PATCH 017/125] remove distinction between rbf and data result set, some code improvements --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 8 +- .../bpe/message/SendSingleMedicResults.java | 28 +-- .../highmed/dsf/bpe/service/EncryptMdat.java | 25 --- .../dsf/bpe/service/ExecuteQueries.java | 6 +- .../service/FilterQueryResultsByConsent.java | 38 +--- .../dsf/bpe/service/GenerateBloomFilters.java | 179 ------------------ .../dsf/bpe/service/ModifyResultSet.java | 61 ++++++ .../bpe/service/ProvideLocalPseudonyms.java | 117 ------------ .../dsf/bpe/service/StoreCorrelationKeys.java | 4 + .../highmed/dsf/bpe/service/StoreResults.java | 47 ++++- .../bpe/spring/config/DataSharingConfig.java | 20 +- .../highmed/dsf/bpe/variable/QueryResult.java | 77 ++------ .../resources/bpe/executeDataSharing.bpmn | 168 +++++----------- .../fhir/CodeSystem/highmed-data-sharing.xml | 19 +- ...-task-single-medic-result-data-sharing.xml | 92 ++------- ...ringFromMedicsViaMedic1ExampleStarter.java | 17 +- .../bpe/message/SendMultiMedicResults.java | 4 +- .../bpe/message/SendSingleMedicResults.java | 23 +-- .../service/CalculateMultiMedicResults.java | 12 +- .../bpe/service/CheckSingleMedicResults.java | 6 +- .../CheckTtpComputedMultiMedicResults.java | 6 +- .../dsf/bpe/service/DownloadResultSets.java | 8 +- .../dsf/bpe/service/ExecuteQueries.java | 8 +- .../dsf/bpe/service/ExecuteRecordLink.java | 8 +- .../service/FilterQueryResultsByConsent.java | 8 +- .../dsf/bpe/service/GenerateBloomFilters.java | 11 +- .../dsf/bpe/service/GenerateCountFromIds.java | 8 +- .../dsf/bpe/service/StoreCorrelationKeys.java | 5 +- .../highmed/dsf/bpe/service/StoreResults.java | 18 +- .../bpe/spring/config/FeasibilityConfig.java | 1 + ...d-task-single-medic-result-feasibility.xml | 24 +-- ...lityFromMedicsViaMedic1ExampleStarter.java | 6 +- .../dsf/fhir/profile/TaskProfileTest.java | 6 +- .../highmed/dsf/bpe/service/StoreResult.java | 21 +- .../bpe/localServicesIntegration.bpmn | 14 +- ...ighmed-task-local-services-integration.xml | 24 +-- .../LocalServicesMedic1ExampleStarter.java | 8 +- 37 files changed, 342 insertions(+), 793 deletions(-) delete mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptMdat.java delete mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java delete mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index 25586fca..c2374923 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -11,9 +11,8 @@ public interface ConstantsDataSharing String BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG = "bloomFilterConfig"; String BPMN_EXECUTION_VARIABLE_COHORTS = "cohorts"; String BPMN_EXECUTION_VARIABLE_QUERIES = "queries"; - String BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS = "queryDataResults"; - String BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS = "queryRbfResults"; - String BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS = "finalQueryDataResults"; + String BPMN_EXECUTION_VARIABLE_QUERY_RESULTS = "queryResults"; + String BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS = "finalQueryResults"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestDataSharing/"; @@ -28,8 +27,7 @@ public interface ConstantsDataSharing String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG = "bloom-filter-configuration"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY = "medic-correlation-key"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT = "single-medic-count-result"; - String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_DATA_REFERENCE = "single-medic-result-set-data-reference"; - String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE = "single-medic-result-set-rbf-reference"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE = "single-medic-result-set-reference"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT = "multi-medic-result"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS = "participating-medics"; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java index 124de595..f3837b23 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -1,11 +1,9 @@ package org.highmed.dsf.bpe.message; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_DATA_REFERENCE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE; import java.util.stream.Stream; @@ -38,30 +36,16 @@ public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskH @Override protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { - QueryResults rbfResults = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS); - Stream<ParameterComponent> inputRbfReferences = rbfResults.getResults().stream().map(result -> toInput(result)); - - QueryResults dataResults = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); - Stream<ParameterComponent> inputDataReferences = dataResults.getResults().stream() - .map(result -> toInput(result)); - - return Stream.concat(inputRbfReferences, inputDataReferences); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + return results.getResults().stream().map(this::toInput); } private Task.ParameterComponent toInput(QueryResult result) { - if (result.isRbfResultSetUrlResult()) - { - ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE, - new Reference(result.getResultSetUrl())); - input.addExtension(createCohortIdExtension(result.getCohortId())); - return input; - } - else if (result.isDataResultSetUrlResult()) + if (result.isIdResultSetUrlResult()) { ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_DATA_REFERENCE, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE, new Reference(result.getResultSetUrl())); input.addExtension(createCohortIdExtension(result.getCohortId())); return input; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptMdat.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptMdat.java deleted file mode 100644 index d8b4c785..00000000 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptMdat.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.highmed.dsf.bpe.service; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; -import org.highmed.dsf.fhir.task.TaskHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class EncryptMdat extends AbstractServiceDelegate -{ - - private static final Logger logger = LoggerFactory.getLogger(EncryptMdat.class); - - public EncryptMdat(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) - { - super(clientProvider, taskHelper); - } - - @Override - protected void doExecute(DelegateExecution execution) - { - logger.info(this.getClass().getName() + " doExecute called"); - } -} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java index 76478eb6..168f5b10 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import java.util.List; import java.util.Map; @@ -52,7 +52,7 @@ protected void doExecute(DelegateExecution execution) throws Exception List<QueryResult> results = queries.entrySet().stream() .map(entry -> executeQuery(entry.getKey(), entry.getValue())).collect(Collectors.toList()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(results))); } @@ -62,6 +62,6 @@ private QueryResult executeQuery(String cohortId, String cohortQuery) // errors and possible meta-data. ResultSet resultSet = openehrClient.query(cohortQuery, null); - return QueryResult.rbfResultSet(organizationProvider.getLocalIdentifierValue(), cohortId, resultSet); + return QueryResult.idResult(organizationProvider.getLocalIdentifierValue(), cohortId, resultSet); } } \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java index 9d8684ba..f577dccf 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java @@ -1,21 +1,16 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; - -import java.util.List; -import java.util.stream.Collectors; - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variable.QueryResult; -import org.highmed.dsf.bpe.variable.QueryResults; -import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; -import org.highmed.openehr.model.structure.ResultSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class FilterQueryResultsByConsent extends AbstractServiceDelegate { + private static final Logger logger = LoggerFactory.getLogger(FilterQueryResultsByConsent.class); + public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) { super(clientProvider, taskHelper); @@ -24,29 +19,6 @@ public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); - - List<QueryResult> filteredResults = filterResults(results.getResults()); - - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, - QueryResultsValues.create(new QueryResults(filteredResults))); - } - - private List<QueryResult> filterResults(List<QueryResult> results) - { - return results.stream().map(this::filterResult).collect(Collectors.toList()); - } - - protected QueryResult filterResult(QueryResult result) - { - return QueryResult.rbfResultSet(result.getOrganizationIdentifier(), result.getCohortId(), - filterResultSet(result.getResultSet())); - } - - private ResultSet filterResultSet(ResultSet resultSet) - { - // TODO implement - - return resultSet; + logger.info(this.getClass().getName() + " doExecute called"); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java deleted file mode 100644 index 3bde663f..00000000 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ /dev/null @@ -1,179 +0,0 @@ -package org.highmed.dsf.bpe.service; - -import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS; - -import java.security.Key; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variable.BloomFilterConfig; -import org.highmed.dsf.bpe.variable.QueryResult; -import org.highmed.dsf.bpe.variable.QueryResults; -import org.highmed.dsf.bpe.variable.QueryResultsValues; -import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; -import org.highmed.dsf.fhir.task.TaskHelper; -import org.highmed.mpi.client.MasterPatientIndexClient; -import org.highmed.openehr.model.structure.ResultSet; -import org.highmed.pseudonymization.bloomfilter.BloomFilterGenerator; -import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGenerator; -import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGeneratorImpl; -import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpRbfOnly; -import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpRbfOnlyImpl; -import org.hl7.fhir.r4.model.Binary; -import org.hl7.fhir.r4.model.IdType; -import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.r4.model.ResourceType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.InitializingBean; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import ca.uhn.fhir.context.FhirContext; - -public class GenerateBloomFilters extends AbstractServiceDelegate implements InitializingBean -{ - private static final Logger logger = LoggerFactory.getLogger(GenerateBloomFilters.class); - - private static final int RBF_LENGTH = 3000; - private static final RecordBloomFilterGeneratorImpl.FieldWeights FBF_WEIGHTS = new RecordBloomFilterGeneratorImpl.FieldWeights( - 0.1, 0.1, 0.1, 0.2, 0.05, 0.1, 0.05, 0.2, 0.1); - private static final RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths FBF_LENGTHS = new RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths( - 500, 500, 250, 50, 500, 250, 500, 500, 500); - - private final String ehrIdColumnPath; - private final MasterPatientIndexClient masterPatientIndexClient; - private final ObjectMapper openEhrObjectMapper; - private final BouncyCastleProvider bouncyCastleProvider; - - public GenerateBloomFilters(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, ObjectMapper openEhrObjectMapper, - BouncyCastleProvider bouncyCastleProvider) - { - super(clientProvider, taskHelper); - - this.ehrIdColumnPath = ehrIdColumnPath; - this.masterPatientIndexClient = masterPatientIndexClient; - this.openEhrObjectMapper = openEhrObjectMapper; - this.bouncyCastleProvider = bouncyCastleProvider; - } - - @Override - public void afterPropertiesSet() throws Exception - { - super.afterPropertiesSet(); - - Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath"); - Objects.requireNonNull(masterPatientIndexClient, "masterPatientIndexClient"); - Objects.requireNonNull(openEhrObjectMapper, "openEhrObjectMapper"); - Objects.requireNonNull(bouncyCastleProvider, "bouncyCastleProvider"); - } - - @Override - protected void doExecute(DelegateExecution execution) throws Exception - { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); - - String securityIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); - BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution - .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); - - ResultSetTranslatorToTtpRbfOnly resultSetTranslator = createResultSetTranslator(bloomFilterConfig); - - List<QueryResult> translatedResults = results.getResults().stream() - .map(result -> translateAndCreateBinary(resultSetTranslator, result, securityIdentifier)) - .collect(Collectors.toList()); - - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS, - QueryResultsValues.create(new QueryResults(translatedResults))); - } - - protected ResultSetTranslatorToTtpRbfOnly createResultSetTranslator(BloomFilterConfig bloomFilterConfig) - { - return new ResultSetTranslatorToTtpRbfOnlyImpl(ehrIdColumnPath, - createRecordBloomFilterGenerator(bloomFilterConfig.getPermutationSeed(), - bloomFilterConfig.getHmacSha2Key(), bloomFilterConfig.getHmacSha3Key()), - masterPatientIndexClient, ResultSetTranslatorToTtpRbfOnlyImpl.FILTER_ON_IDAT_NOT_FOUND_EXCEPTION); - } - - protected RecordBloomFilterGenerator createRecordBloomFilterGenerator(long permutationSeed, Key hmacSha2Key, - Key hmacSha3Key) - { - return new RecordBloomFilterGeneratorImpl(RBF_LENGTH, permutationSeed, FBF_WEIGHTS, FBF_LENGTHS, - () -> new BloomFilterGenerator.HmacSha2HmacSha3BiGramHasher(hmacSha2Key, hmacSha3Key, - bouncyCastleProvider)); - } - - private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtpRbfOnly resultSetTranslator, - QueryResult result, String ttpIdentifier) - { - ResultSet translatedResultSet = translate(resultSetTranslator, result.getResultSet()); - String resultSetUrl = saveResultSetAsBinaryForTtp(translatedResultSet, ttpIdentifier); - - return QueryResult.rbfResultSet(result.getOrganizationIdentifier(), result.getCohortId(), resultSetUrl); - } - - private ResultSet translate(ResultSetTranslatorToTtpRbfOnly resultSetTranslator, ResultSet resultSet) - { - try - { - return resultSetTranslator.translate(resultSet); - } - catch (Exception e) - { - logger.warn("Error while translating ResultSet: " + e.getMessage(), e); - throw e; - } - } - - protected String saveResultSetAsBinaryForTtp(ResultSet resultSet, String securityIdentifier) - { - byte[] content = serializeResultSet(resultSet); - Reference securityContext = new Reference(); - securityContext.setType(ResourceType.Organization.name()).getIdentifier() - .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(securityIdentifier); - Binary binary = new Binary().setContentType(OPENEHR_MIMETYPE_JSON).setSecurityContext(securityContext) - .setData(content); - - IdType created = createBinaryResource(binary); - return new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl(), ResourceType.Binary.name(), - created.getIdPart(), created.getVersionIdPart()).getValue(); - } - - private byte[] serializeResultSet(ResultSet resultSet) - { - try - { - return openEhrObjectMapper.writeValueAsBytes(resultSet); - } - catch (JsonProcessingException e) - { - logger.warn("Error while serializing ResultSet: " + e.getMessage(), e); - throw new RuntimeException(e); - } - } - - private IdType createBinaryResource(Binary binary) - { - try - { - return getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().create(binary); - } - catch (Exception e) - { - logger.debug("Binary to create {}", FhirContext.forR4().newJsonParser().encodeResourceToString(binary)); - logger.warn("Error while creating Binary resoruce: " + e.getMessage(), e); - throw e; - } - } -} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java new file mode 100644 index 00000000..79f77bd0 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java @@ -0,0 +1,61 @@ +package org.highmed.dsf.bpe.service; + +import java.util.Objects; + +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.mpi.client.MasterPatientIndexClient; +import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGeneratorImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class ModifyResultSet extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(ModifyResultSet.class); + + private static final int RBF_LENGTH = 3000; + private static final RecordBloomFilterGeneratorImpl.FieldWeights FBF_WEIGHTS = new RecordBloomFilterGeneratorImpl.FieldWeights( + 0.1, 0.1, 0.1, 0.2, 0.05, 0.1, 0.05, 0.2, 0.1); + private static final RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths FBF_LENGTHS = new RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths( + 500, 500, 250, 50, 500, 250, 500, 500, 500); + + private final String ehrIdColumnPath; + private final MasterPatientIndexClient masterPatientIndexClient; + private final ObjectMapper openEhrObjectMapper; + private final BouncyCastleProvider bouncyCastleProvider; + + public ModifyResultSet(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, String ehrIdColumnPath, + MasterPatientIndexClient masterPatientIndexClient, ObjectMapper openEhrObjectMapper, + BouncyCastleProvider bouncyCastleProvider) + { + super(clientProvider, taskHelper); + + this.ehrIdColumnPath = ehrIdColumnPath; + this.masterPatientIndexClient = masterPatientIndexClient; + this.openEhrObjectMapper = openEhrObjectMapper; + this.bouncyCastleProvider = bouncyCastleProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath"); + Objects.requireNonNull(masterPatientIndexClient, "masterPatientIndexClient"); + Objects.requireNonNull(openEhrObjectMapper, "openEhrObjectMapper"); + Objects.requireNonNull(bouncyCastleProvider, "bouncyCastleProvider"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + logger.info(this.getClass().getName() + " doExecute called"); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java deleted file mode 100644 index f1a723e2..00000000 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ProvideLocalPseudonyms.java +++ /dev/null @@ -1,117 +0,0 @@ -package org.highmed.dsf.bpe.service; - -import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variable.QueryResult; -import org.highmed.dsf.bpe.variable.QueryResults; -import org.highmed.dsf.bpe.variable.QueryResultsValues; -import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; -import org.highmed.dsf.fhir.task.TaskHelper; -import org.highmed.openehr.model.structure.ResultSet; -import org.hl7.fhir.r4.model.Binary; -import org.hl7.fhir.r4.model.IdType; -import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.r4.model.ResourceType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.InitializingBean; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import ca.uhn.fhir.context.FhirContext; - -public class ProvideLocalPseudonyms extends AbstractServiceDelegate implements InitializingBean -{ - private static final Logger logger = LoggerFactory.getLogger(ProvideLocalPseudonyms.class); - - private final String ehrIdColumnPath; - private final ObjectMapper openEhrObjectMapper; - - public ProvideLocalPseudonyms(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - String ehrIdColumnPath, ObjectMapper openEhrObjectMapper) - { - super(clientProvider, taskHelper); - this.ehrIdColumnPath = ehrIdColumnPath; - this.openEhrObjectMapper = openEhrObjectMapper; - } - - @Override - public void afterPropertiesSet() throws Exception - { - super.afterPropertiesSet(); - Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath"); - Objects.requireNonNull(openEhrObjectMapper, "openEhrObjectMapper"); - } - - @Override - protected void doExecute(DelegateExecution execution) - { - String securityIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); - - // TODO: replace ehrId with pseudonym first order - - List<QueryResult> binaryResults = results.getResults().stream() - .map(result -> createBinary(result, securityIdentifier)).collect(Collectors.toList()); - - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, - QueryResultsValues.create(new QueryResults(binaryResults))); - } - - protected QueryResult createBinary(QueryResult result, String securityIdentifier) - { - String binaryUrl = saveResultSetAsBinaryForTtp(result.getResultSet(), securityIdentifier); - return QueryResult.dataResultSet(result.getOrganizationIdentifier(), result.getCohortId(), binaryUrl); - } - - protected String saveResultSetAsBinaryForTtp(ResultSet resultSet, String securityIdentifier) - { - byte[] content = serializeResultSet(resultSet); - Reference securityContext = new Reference(); - securityContext.setType(ResourceType.Organization.name()).getIdentifier() - .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(securityIdentifier); - Binary binary = new Binary().setContentType(OPENEHR_MIMETYPE_JSON).setSecurityContext(securityContext) - .setData(content); - - IdType created = createBinaryResource(binary); - return new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl(), ResourceType.Binary.name(), - created.getIdPart(), created.getVersionIdPart()).getValue(); - } - - private byte[] serializeResultSet(ResultSet resultSet) - { - try - { - return openEhrObjectMapper.writeValueAsBytes(resultSet); - } - catch (JsonProcessingException e) - { - logger.warn("Error while serializing ResultSet: " + e.getMessage(), e); - throw new RuntimeException(e); - } - } - - private IdType createBinaryResource(Binary binary) - { - try - { - return getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().create(binary); - } - catch (Exception e) - { - logger.debug("Binary to create {}", FhirContext.forR4().newJsonParser().encodeResourceToString(binary)); - logger.warn("Error while creating Binary resoruce: " + e.getMessage(), e); - throw e; - } - } -} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java index 566f0f7b..40c910ee 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java @@ -2,6 +2,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; @@ -11,6 +12,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; @@ -39,6 +42,7 @@ protected void doExecute(DelegateExecution execution) boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(null))); } private boolean getNeedsRecordLinkageCheck(Task task) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java index ba7c16d9..f1b83f85 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java @@ -1,9 +1,24 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_GROUP_ID; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.ConstantsDataSharing; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,6 +35,36 @@ public StoreResults(FhirWebserviceClientProvider clientProvider, TaskHelper task @Override protected void doExecute(DelegateExecution execution) { - logger.info(this.getClass().getName() + " doExecute called"); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + List<QueryResult> extendedResults = new ArrayList<>(results.getResults()); + + Task task = getCurrentTaskFromExecutionVariables(); + extendedResults.addAll(getResults(task, + ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE)); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(extendedResults))); + + if (Boolean.TRUE.equals(execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE))) + { + // Process result rbf + } + + } + + private List<QueryResult> getResults(Task task, String code) + { + TaskHelper taskHelper = getTaskHelper(); + Reference requester = task.getRequester(); + + return taskHelper + .getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, code, EXTENSION_HIGHMED_GROUP_ID) + .map(input -> + { + String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); + String resultSetUrl = ((Reference) input.getValue()).getReference(); + + return QueryResult.idResult(requester.getIdentifier().getValue(), cohortId, resultSetUrl); + }).collect(Collectors.toList()); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index c4da7472..dd0f81f2 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -14,15 +14,13 @@ import org.highmed.dsf.bpe.service.DownloadDataSharingResources; import org.highmed.dsf.bpe.service.DownloadResearchStudyResource; import org.highmed.dsf.bpe.service.DownloadResultSets; -import org.highmed.dsf.bpe.service.EncryptMdat; import org.highmed.dsf.bpe.service.ExecuteQueries; import org.highmed.dsf.bpe.service.ExecuteRecordLink; import org.highmed.dsf.bpe.service.ExtractQueries; import org.highmed.dsf.bpe.service.FilterQueryResultsByConsent; -import org.highmed.dsf.bpe.service.GenerateBloomFilters; import org.highmed.dsf.bpe.service.HandleErrorMultiMedicResults; import org.highmed.dsf.bpe.service.ModifyQueries; -import org.highmed.dsf.bpe.service.ProvideLocalPseudonyms; +import org.highmed.dsf.bpe.service.ModifyResultSet; import org.highmed.dsf.bpe.service.SelectRequestTargets; import org.highmed.dsf.bpe.service.SelectResponseTargetMedic; import org.highmed.dsf.bpe.service.SelectResponseTargetTtp; @@ -214,18 +212,6 @@ public OpenEhrClient openEhrClient() return openEhrClientFactory.createClient(environment::getProperty); } - @Bean - public ProvideLocalPseudonyms provideLocalPseudonyms() - { - return new ProvideLocalPseudonyms(fhirClientProvider, taskHelper, ehrIdColumnPath, objectMapper); - } - - @Bean - public EncryptMdat encryptMdat() - { - return new EncryptMdat(fhirClientProvider, taskHelper); - } - @Bean public FilterQueryResultsByConsent filterQueryResultsByConsent() { @@ -233,9 +219,9 @@ public FilterQueryResultsByConsent filterQueryResultsByConsent() } @Bean - public GenerateBloomFilters generateBloomFilters() + public ModifyResultSet modifyResultSet() { - return new GenerateBloomFilters(fhirClientProvider, taskHelper, ehrIdColumnPath, masterPatientIndexClient(), + return new ModifyResultSet(fhirClientProvider, taskHelper, ehrIdColumnPath, masterPatientIndexClient(), objectMapper, bouncyCastleProvider()); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java index 9267b1a3..9ce52281 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java @@ -10,51 +10,38 @@ public class QueryResult { private final String organizationIdentifier; private final String cohortId; - private final int count; + private final int cohortSize; private final ResultSet resultSet; private final String resultSetUrl; - private boolean isRbfResultSet; - public static QueryResult count(String organizationIdentifier, String cohortId, int count) + public static QueryResult countResult(String organizationIdentifier, String cohortId, int cohortSize) { - if (count < 0) - throw new IllegalArgumentException("count >= 0 expected"); + if (cohortSize < 0) + throw new IllegalArgumentException("cohortSize >= 0 expected"); - return new QueryResult(organizationIdentifier, cohortId, count, null, null, false); + return new QueryResult(organizationIdentifier, cohortId, cohortSize, null, null); } - public static QueryResult rbfResultSet(String organizationIdentifier, String cohortId, ResultSet resultSet) + public static QueryResult idResult(String organizationIdentifier, String cohortId, ResultSet resultSet) { - return new QueryResult(organizationIdentifier, cohortId, -1, resultSet, null, true); + return new QueryResult(organizationIdentifier, cohortId, -1, resultSet, null); } - public static QueryResult rbfResultSet(String organizationIdentifier, String cohortId, String resultSetUrl) + public static QueryResult idResult(String organizationIdentifier, String cohortId, String resultSetUrl) { - return new QueryResult(organizationIdentifier, cohortId, -1, null, resultSetUrl, true); - } - - public static QueryResult dataResultSet(String organizationIdentifier, String cohortId, ResultSet resultSet) - { - return new QueryResult(organizationIdentifier, cohortId, -1, resultSet, null, false); - } - - public static QueryResult dataResultSet(String organizationIdentifier, String cohortId, String resultSetUrl) - { - return new QueryResult(organizationIdentifier, cohortId, -1, null, resultSetUrl, false); + return new QueryResult(organizationIdentifier, cohortId, -1, null, resultSetUrl); } @JsonCreator public QueryResult(@JsonProperty("organizationIdentifier") String organizationIdentifier, - @JsonProperty("cohortId") String cohortId, @JsonProperty("count") int count, - @JsonProperty("resultSet") ResultSet resultSet, @JsonProperty("resultSetUrl") String resultSetUrl, - @JsonProperty("isRbfResultSet") boolean isRbfResultSet) + @JsonProperty("cohortId") String cohortId, @JsonProperty("cohortSize") int cohortSize, + @JsonProperty("resultSet") ResultSet resultSet, @JsonProperty("resultSetUrl") String resultSetUrl) { this.organizationIdentifier = organizationIdentifier; this.cohortId = cohortId; - this.count = count; + this.cohortSize = cohortSize; this.resultSet = resultSet; this.resultSetUrl = resultSetUrl; - this.isRbfResultSet = isRbfResultSet; } public String getOrganizationIdentifier() @@ -67,9 +54,9 @@ public String getCohortId() return cohortId; } - public int getCount() + public int getCohortSize() { - return count; + return cohortSize; } public ResultSet getResultSet() @@ -83,44 +70,20 @@ public String getResultSetUrl() } @JsonIgnore - public boolean isCountResult() + public boolean isCohortSizeResult() { return resultSet == null && resultSetUrl == null; } @JsonIgnore - public boolean isRbfResultSetResult() - { - return isRbfResultSet && isResultSetResult(); - } - - @JsonIgnore - public boolean isRbfResultSetUrlResult() - { - return isRbfResultSet && isResultSetUrlResult(); - } - - @JsonIgnore - public boolean isDataResultSetResult() - { - return !isRbfResultSet && isResultSetResult(); - } - - @JsonIgnore - public boolean isDataResultSetUrlResult() - { - return !isRbfResultSet && isResultSetUrlResult(); - } - - @JsonIgnore - private boolean isResultSetResult() + public boolean isIdResultSetResult() { - return resultSet != null; + return resultSet != null && resultSetUrl == null; } @JsonIgnore - private boolean isResultSetUrlResult() + public boolean isIdResultSetUrlResult() { - return resultSetUrl != null; + return resultSet == null && resultSetUrl != null; } -} +} \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index fb88476d..69224c38 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -2,7 +2,7 @@ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> <bpmn:process id="executeDataSharing" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResults"> - <bpmn:incoming>Flow_1s1pv42</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1ug2kru</bpmn:incoming> <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="checkDataSharingRequest" name="check data sharing request" camunda:class="org.highmed.dsf.bpe.service.CheckDataSharingResources"> @@ -51,29 +51,14 @@ <bpmn:exclusiveGateway id="ExclusiveGateway_0lecmy5"> <bpmn:incoming>SequenceFlow_05r9whd</bpmn:incoming> <bpmn:incoming>SequenceFlow_0kzp6tl</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1b4h5qz</bpmn:outgoing> + <bpmn:outgoing>Flow_1t9f3m5</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_1b4h5qz" sourceRef="ExclusiveGateway_0lecmy5" targetRef="ExclusiveGateway_0sff9xb" /> <bpmn:sequenceFlow id="SequenceFlow_0kzp6tl" sourceRef="filterByConsent" targetRef="ExclusiveGateway_0lecmy5" /> - <bpmn:exclusiveGateway id="ExclusiveGateway_0sff9xb"> - <bpmn:incoming>SequenceFlow_1b4h5qz</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1futlo2</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_17otl7p</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_1futlo2" name="needs record linkage" sourceRef="ExclusiveGateway_0sff9xb" targetRef="generateBloomFilters"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsRecordLinkage}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:serviceTask id="generateBloomFilters" name="generate bloom filters" camunda:class="org.highmed.dsf.bpe.service.GenerateBloomFilters"> - <bpmn:incoming>SequenceFlow_1futlo2</bpmn:incoming> + <bpmn:serviceTask id="generateBloomFilters" name="generate RBF's, replace ID with PSN, encrypt MDAT" camunda:class="org.highmed.dsf.bpe.service.ModifyResultSet"> + <bpmn:incoming>Flow_1t9f3m5</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ug2kru</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_002t87f"> - <bpmn:incoming>SequenceFlow_1ug2kru</bpmn:incoming> - <bpmn:incoming>SequenceFlow_17otl7p</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0q803rh</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_0q803rh" sourceRef="ExclusiveGateway_002t87f" targetRef="Activity_0qpfuiq" /> - <bpmn:sequenceFlow id="SequenceFlow_1ug2kru" sourceRef="generateBloomFilters" targetRef="ExclusiveGateway_002t87f" /> + <bpmn:sequenceFlow id="SequenceFlow_1ug2kru" sourceRef="generateBloomFilters" targetRef="checkResults" /> <bpmn:sequenceFlow id="SequenceFlow_0ascyjc" sourceRef="selectResponseTargetTtp" targetRef="EndEvent" /> <bpmn:serviceTask id="selectResponseTargetTtp" name="select response target TTP" camunda:class="org.highmed.dsf.bpe.service.SelectResponseTargetTtp"> <bpmn:incoming>SequenceFlow_04ouilq</bpmn:incoming> @@ -84,9 +69,6 @@ <bpmn:outgoing>SequenceFlow_1rmqv20</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1kp6eaq" sourceRef="checkDataSharingRequest" targetRef="extractQueries" /> - <bpmn:sequenceFlow id="SequenceFlow_17otl7p" name="else" sourceRef="ExclusiveGateway_0sff9xb" targetRef="ExclusiveGateway_002t87f"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsRecordLinkage}</bpmn:conditionExpression> - </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_0qsitvp" sourceRef="addIdSelectionIfMissing" targetRef="executeQueries" /> <bpmn:serviceTask id="addIdSelectionIfMissing" name="Add id selection if missing" camunda:class="org.highmed.dsf.bpe.service.ModifyQueries"> <bpmn:incoming>Flow_1ecoehc</bpmn:incoming> @@ -97,16 +79,7 @@ <bpmn:incoming>Flow_1kp6eaq</bpmn:incoming> <bpmn:outgoing>Flow_1ecoehc</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0qpfuiq" name="provide local pseudonyms" camunda:class="org.highmed.dsf.bpe.service.ProvideLocalPseudonyms"> - <bpmn:incoming>SequenceFlow_0q803rh</bpmn:incoming> - <bpmn:outgoing>Flow_1r9brzp</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0po7dtu" name="encrypt MDAT" camunda:class="org.highmed.dsf.bpe.service.EncryptMdat"> - <bpmn:incoming>Flow_1r9brzp</bpmn:incoming> - <bpmn:outgoing>Flow_1s1pv42</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_1r9brzp" sourceRef="Activity_0qpfuiq" targetRef="Activity_0po7dtu" /> - <bpmn:sequenceFlow id="Flow_1s1pv42" sourceRef="Activity_0po7dtu" targetRef="checkResults" /> + <bpmn:sequenceFlow id="Flow_1t9f3m5" sourceRef="ExclusiveGateway_0lecmy5" targetRef="generateBloomFilters" /> <bpmn:textAnnotation id="TextAnnotation_0euut3n"> <bpmn:text>uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc.</bpmn:text> </bpmn:textAnnotation> @@ -129,35 +102,16 @@ <di:waypoint x="560" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ascyjc_di" bpmnElement="SequenceFlow_0ascyjc"> - <di:waypoint x="2210" y="212" /> - <di:waypoint x="2282" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0q803rh_di" bpmnElement="SequenceFlow_0q803rh"> - <di:waypoint x="1495" y="212" /> - <di:waypoint x="1580" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_04ouilq_di" bpmnElement="SequenceFlow_04ouilq"> - <di:waypoint x="2030" y="212" /> - <di:waypoint x="2110" y="212" /> + <di:waypoint x="1840" y="212" /> + <di:waypoint x="1952" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1etju4m_di" bpmnElement="SequenceFlow_1etju4m"> - <di:waypoint x="340" y="212" /> - <di:waypoint x="400" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_14cn0vs_di" bpmnElement="SequenceFlow_14cn0vs"> - <di:waypoint x="188" y="212" /> - <di:waypoint x="240" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1rmqv20_di" bpmnElement="SequenceFlow_1rmqv20"> - <di:waypoint x="980" y="212" /> - <di:waypoint x="1032" y="212" /> + <bpmndi:BPMNEdge id="SequenceFlow_1ug2kru_di" bpmnElement="SequenceFlow_1ug2kru"> + <di:waypoint x="1460" y="212" /> + <di:waypoint x="1540" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_05r9whd_di" bpmnElement="SequenceFlow_05r9whd"> - <di:waypoint x="1082" y="212" /> - <di:waypoint x="1192" y="212" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1088" y="195" width="21" height="14" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNEdge id="SequenceFlow_0kzp6tl_di" bpmnElement="SequenceFlow_0kzp6tl"> + <di:waypoint x="1217" y="315" /> + <di:waypoint x="1217" y="237" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0isxkuy_di" bpmnElement="SequenceFlow_0isxkuy"> <di:waypoint x="1057" y="237" /> @@ -167,44 +121,33 @@ <dc:Bounds x="1064" y="323" width="72" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0kzp6tl_di" bpmnElement="SequenceFlow_0kzp6tl"> - <di:waypoint x="1217" y="315" /> - <di:waypoint x="1217" y="237" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1b4h5qz_di" bpmnElement="SequenceFlow_1b4h5qz"> - <di:waypoint x="1242" y="212" /> - <di:waypoint x="1292" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1futlo2_di" bpmnElement="SequenceFlow_1futlo2"> - <di:waypoint x="1317" y="237" /> - <di:waypoint x="1317" y="355" /> - <di:waypoint x="1420" y="355" /> + <bpmndi:BPMNEdge id="SequenceFlow_05r9whd_di" bpmnElement="SequenceFlow_05r9whd"> + <di:waypoint x="1082" y="212" /> + <di:waypoint x="1192" y="212" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1324" y="320" width="65" height="27" /> + <dc:Bounds x="1088" y="195" width="21" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_17otl7p_di" bpmnElement="SequenceFlow_17otl7p"> - <di:waypoint x="1342" y="212" /> - <di:waypoint x="1445" y="212" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1344" y="194" width="21" height="14" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNEdge id="SequenceFlow_04ouilq_di" bpmnElement="SequenceFlow_04ouilq"> + <di:waypoint x="1640" y="212" /> + <di:waypoint x="1740" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ug2kru_di" bpmnElement="SequenceFlow_1ug2kru"> - <di:waypoint x="1470" y="315" /> - <di:waypoint x="1470" y="237" /> + <bpmndi:BPMNEdge id="SequenceFlow_1etju4m_di" bpmnElement="SequenceFlow_1etju4m"> + <di:waypoint x="340" y="212" /> + <di:waypoint x="400" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1r9brzp_di" bpmnElement="Flow_1r9brzp"> - <di:waypoint x="1680" y="212" /> - <di:waypoint x="1760" y="212" /> + <bpmndi:BPMNEdge id="SequenceFlow_14cn0vs_di" bpmnElement="SequenceFlow_14cn0vs"> + <di:waypoint x="188" y="212" /> + <di:waypoint x="240" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1s1pv42_di" bpmnElement="Flow_1s1pv42"> - <di:waypoint x="1860" y="212" /> - <di:waypoint x="1930" y="212" /> + <bpmndi:BPMNEdge id="SequenceFlow_1rmqv20_di" bpmnElement="SequenceFlow_1rmqv20"> + <di:waypoint x="980" y="212" /> + <di:waypoint x="1032" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1t9f3m5_di" bpmnElement="Flow_1t9f3m5"> + <di:waypoint x="1242" y="212" /> + <di:waypoint x="1360" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> - <dc:Bounds x="1930" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkDataSharingRequest"> <dc:Bounds x="400" y="172" width="100" height="80" /> </bpmndi:BPMNShape> @@ -217,14 +160,14 @@ <bpmndi:BPMNShape id="ServiceTask_0b8j3ka_di" bpmnElement="downloadDataSharingResources"> <dc:Bounds x="240" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> - <dc:Bounds x="2282" y="194" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2256" y="237" width="90" height="14" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="ExclusiveGateway_0bq7zdz_di" bpmnElement="ExclusiveGateway_0bq7zdz" isMarkerVisible="true"> + <dc:Bounds x="1032" y="187" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> - <dc:Bounds x="2110" y="172" width="100" height="80" /> + <bpmndi:BPMNShape id="ServiceTask_0l3b9as_di" bpmnElement="filterByConsent"> + <dc:Bounds x="1167" y="315" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0lecmy5_di" bpmnElement="ExclusiveGateway_0lecmy5" isMarkerVisible="true"> + <dc:Bounds x="1192" y="187" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0u5pb4i_di" bpmnElement="executeQueries"> <dc:Bounds x="880" y="172" width="100" height="80" /> @@ -238,29 +181,20 @@ <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> <dc:Bounds x="330" y="80" width="267" height="56" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0bq7zdz_di" bpmnElement="ExclusiveGateway_0bq7zdz" isMarkerVisible="true"> - <dc:Bounds x="1032" y="187" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0l3b9as_di" bpmnElement="filterByConsent"> - <dc:Bounds x="1167" y="315" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0lecmy5_di" bpmnElement="ExclusiveGateway_0lecmy5" isMarkerVisible="true"> - <dc:Bounds x="1192" y="187" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0sff9xb_di" bpmnElement="ExclusiveGateway_0sff9xb" isMarkerVisible="true"> - <dc:Bounds x="1292" y="187" width="50" height="50" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="generateBloomFilters"> - <dc:Bounds x="1420" y="315" width="100" height="80" /> + <dc:Bounds x="1360" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_002t87f_di" bpmnElement="ExclusiveGateway_002t87f" isMarkerVisible="true"> - <dc:Bounds x="1445" y="187" width="50" height="50" /> + <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> + <dc:Bounds x="1540" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0po7dtu_di" bpmnElement="Activity_0po7dtu"> - <dc:Bounds x="1760" y="172" width="100" height="80" /> + <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> + <dc:Bounds x="1740" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0qpfuiq_di" bpmnElement="Activity_0qpfuiq"> - <dc:Bounds x="1580" y="172" width="100" height="80" /> + <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> + <dc:Bounds x="1952" y="194" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1926" y="237" width="90" height="14" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> <di:waypoint x="455" y="172" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml index 405ec423..50002ded 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml @@ -7,11 +7,11 @@ </meta> <url value="http://highmed.org/fhir/CodeSystem/data-sharing"/> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="${version}"/> <name value="HiGHmed_Data_Sharing"/> <title value="HiGHmed Data Sharing"/> <!-- status managed by bpe --> - <status value="unknown" /> + <status value="unknown"/> <experimental value="false"/> <date value="2020-11-23"/> <publisher value="HiGHmed"/> @@ -23,7 +23,8 @@ <concept> <code value="research-study-reference"/> <display value="Research Study Reference"/> - <definition value="HiGHmed Research Study Reference to define what data is requested from which MeDICs and for what purpose"/> + <definition + value="HiGHmed Research Study Reference to define what data is requested from which MeDICs and for what purpose"/> </concept> <concept> <code value="needs-record-linkage"/> @@ -51,14 +52,10 @@ <definition value="Result of a single count query execution"/> </concept> <concept> - <code value="single-medic-result-set-rbf-reference"/> - <display value="Single MeDIC Result Set Record-Bloom-Filter Reference"/> - <definition value="Reference to an openEHR ResultSet containing the record-bloom-filters as a result of a single id query execution"/> - </concept> - <concept> - <code value="single-medic-result-set-data-reference"/> - <display value="Single MeDIC Result Set Data Reference"/> - <definition value="Reference to an openEHR ResultSet containing the actual result of a single query execution"/> + <code value="single-medic-result-set-reference"/> + <display value="Single MeDIC Result Set Reference"/> + <definition value="Reference to an openEHR ResultSet containing the result of a single query + execution and/or the record-bloom-filters of a single query execution"/> </concept> <concept> <code value="multi-medic-result"/> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml index 77a493d9..a68e6720 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml @@ -58,16 +58,16 @@ <sliceName value="correlation-key" /> <min value="1" /> </element> - <element id="Task.input:single-medic-result-set-rbf-reference"> + <element id="Task.input:single-medic-result-set-reference"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <sliceName value="single-medic-result-set-rbf-reference" /> + <sliceName value="single-medic-result-set-reference" /> <min value="0" /> <max value="*" /> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.extension"> + <element id="Task.input:single-medic-result-set-reference.extension"> <path value="Task.input.extension" /> <slicing> <discriminator> @@ -77,7 +77,7 @@ <rules value="open" /> </slicing> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.extension:group-id"> + <element id="Task.input:single-medic-result-set-reference.extension:group-id"> <path value="Task.input.extension" /> <sliceName value="group-id" /> <min value="1" /> @@ -86,7 +86,7 @@ <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> </type> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.type"> + <element id="Task.input:single-medic-result-set-reference.type"> <path value="Task.input.type" /> <binding> <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> @@ -96,101 +96,33 @@ <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.type.coding"> + <element id="Task.input:single-medic-result-set-reference.type.coding"> <path value="Task.input.type.coding" /> <min value="1" /> <max value="1" /> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.type.coding.system"> + <element id="Task.input:single-medic-result-set-reference.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.type.coding.code"> + <element id="Task.input:single-medic-result-set-reference.type.coding.code"> <path value="Task.input.type.coding.code" /> <min value="1" /> - <fixedCode value="single-medic-result-set-rbf-reference" /> + <fixedCode value="single-medic-result-set-reference" /> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.value[x]"> + <element id="Task.input:single-medic-result-set-reference.value[x]"> <path value="Task.input.value[x]" /> <type> <code value="Reference" /> <targetProfile value="http://hl7.org/fhir/StructureDefinition/Binary" /> </type> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.value[x].reference"> + <element id="Task.input:single-medic-result-set-reference.value[x].reference"> <path value="Task.input.value[x].reference" /> <min value="1" /> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.value[x].identifier"> - <path value="Task.input.value[x].identifier" /> - <max value="0" /> - </element> - <element id="Task.input:single-medic-result-data-data-reference"> - <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> - <valueString value="Parameter" /> - </extension> - <path value="Task.input" /> - <sliceName value="single-medic-result-set-data-reference" /> - <min value="0" /> - <max value="*" /> - </element> - <element id="Task.input:single-medic-result-set-data-reference.extension"> - <path value="Task.input.extension" /> - <slicing> - <discriminator> - <type value="value" /> - <path value="url" /> - </discriminator> - <rules value="open" /> - </slicing> - </element> - <element id="Task.input:single-medic-result-set-data-reference.extension:group-id"> - <path value="Task.input.extension" /> - <sliceName value="group-id" /> - <min value="1" /> - <type> - <code value="Extension" /> - <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> - </type> - </element> - <element id="Task.input:single-medic-result-set-data-reference.type"> - <path value="Task.input.type" /> - <binding> - <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> - <valueString value="TaskInputParameterType" /> - </extension> - <strength value="required" /> - <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> - </binding> - </element> - <element id="Task.input:single-medic-result-set-data-reference.type.coding"> - <path value="Task.input.type.coding" /> - <min value="1" /> - <max value="1" /> - </element> - <element id="Task.input:single-medic-result-set-data-reference.type.coding.system"> - <path value="Task.input.type.coding.system" /> - <min value="1" /> - <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> - </element> - <element id="Task.input:single-medic-result-set-data-reference.type.coding.code"> - <path value="Task.input.type.coding.code" /> - <min value="1" /> - <fixedCode value="single-medic-result-set-data-reference" /> - </element> - <element id="Task.input:single-medic-result-set-data-reference.value[x]"> - <path value="Task.input.value[x]" /> - <type> - <code value="Reference" /> - <targetProfile value="http://hl7.org/fhir/StructureDefinition/Binary" /> - </type> - </element> - <element id="Task.input:single-medic-result-set-data-reference.value[x].reference"> - <path value="Task.input.value[x].reference" /> - <min value="1" /> - </element> - <element id="Task.input:single-medic-result-set-data-reference.value[x].identifier"> + <element id="Task.input:single-medic-result-set-reference.value[x].identifier"> <path value="Task.input.value[x].identifier" /> <max value="0" /> </element> diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java index 39f864d2..fcb000be 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -43,11 +43,14 @@ public class RequestDataSharingFromMedicsViaMedic1ExampleStarter { - private static final String QUERY = "SELECT " + "e/ehr_status/subject/external_ref/id/value as EHRID, " - + "v/items[at0024,'Bezeichnung']/value, " + "v/items [at0001,'Messwert'], " - + "v/items[at0006,'Dokumentationsdatum Untersuchung']/value " + "FROM EHR e " + "CONTAINS COMPOSITION c " + private static boolean NEEDS_CONSENT_CHECK = true; + private static boolean NEEDS_RECORD_LINKAGE = true; + + private static final String QUERY = "SELECT e/ehr_status/subject/external_ref/id/value as EHRID, " + + "v/items[at0024,'Bezeichnung']/value, v/items [at0001,'Messwert'], " + + "v/items[at0006,'Dokumentationsdatum Untersuchung']/value FROM EHR e CONTAINS COMPOSITION c " + "CONTAINS CLUSTER v[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1] " - + "WHERE v/items[at0024,'Bezeichnung']/value/value = 'Natrium' " + "OFFSET 0 LIMIT 15"; + + "WHERE v/items[at0024,'Bezeichnung']/value/value = 'Natrium' OFFSET 0 LIMIT 15;"; // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 @@ -156,9 +159,11 @@ private static Task createTask(ResearchStudy researchStudy) .setType(ResourceType.ResearchStudy.name())) .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); - task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + task.addInput().setValue(new BooleanType(NEEDS_RECORD_LINKAGE)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); - task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + task.addInput().setValue(new BooleanType(NEEDS_CONSENT_CHECK)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); return task; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java index bc9c6ebb..dd5d5efa 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java @@ -3,7 +3,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS; @@ -38,7 +38,7 @@ public SendMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHe protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { FinalFeasibilityQueryResults results = (FinalFeasibilityQueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS); + .getVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS); Stream<ParameterComponent> resultInputs = results.getResults().stream().flatMap(this::toInputs); Stream<ParameterComponent> errorInput = getErrorInput(execution); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java index ca5f87d9..2627375b 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -1,12 +1,10 @@ package org.highmed.dsf.bpe.message; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE; import java.util.stream.Stream; @@ -39,28 +37,23 @@ public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskH @Override protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { - Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); - - QueryResults results = needsRecordLinkage - ? (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS) - : (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); - - return results.getResults().stream().map(result -> toInput(result)); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + return results.getResults().stream().map(this::toInput); } private Task.ParameterComponent toInput(QueryResult result) { - if (result.isCountResult()) + if (result.isCohortSizeResult()) { ParameterComponent input = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT, result.getCount()); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT, result.getCohortSize()); input.addExtension(createCohortIdExtension(result.getCohortId())); return input; } - else if (result.isRbfResultSetUrlResult()) + else if (result.isIdResultSetUrlResult()) { ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE, new Reference(result.getResultSetUrl())); input.addExtension(createCohortIdExtension(result.getCohortId())); return input; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java index 1f9eb233..0150816e 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResults.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import java.util.List; import java.util.Map; @@ -27,12 +27,12 @@ public CalculateMultiMedicResults(FhirWebserviceClientProvider clientProvider, T @Override protected void doExecute(DelegateExecution execution) throws Exception { - List<QueryResult> results = ((QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS)) + List<QueryResult> results = ((QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS)) .getResults(); List<FinalFeasibilityQueryResult> finalResults = calculateResults(results); - execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS, FinalFeasibilityQueryResultsValues.create(new FinalFeasibilityQueryResults(finalResults))); } @@ -43,8 +43,8 @@ private List<FinalFeasibilityQueryResult> calculateResults(List<QueryResult> res return byCohortId.entrySet().stream() .map(e -> new FinalFeasibilityQueryResult(e.getKey(), - toInt(e.getValue().stream().filter(r -> r.getCount() > 0).count()), - toInt(e.getValue().stream().mapToLong(QueryResult::getCount).sum()))) + toInt(e.getValue().stream().filter(r -> r.getCohortSize() > 0).count()), + toInt(e.getValue().stream().mapToLong(QueryResult::getCohortSize).sum()))) .collect(Collectors.toList()); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java index c792047c..09fd7eb2 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java @@ -1,6 +1,6 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import java.util.ArrayList; import java.util.List; @@ -30,7 +30,7 @@ public CheckSingleMedicResults(FhirWebserviceClientProvider clientProvider, Task @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); Task currentTask = getCurrentTaskFromExecutionVariables(); List<QueryResult> filteredResults = filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(results, @@ -38,7 +38,7 @@ protected void doExecute(DelegateExecution execution) throws Exception // TODO: add percentage filter over results - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(filteredResults))); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java index 72210135..c02f3b0d 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java @@ -4,7 +4,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_RESULT; import static org.highmed.dsf.bpe.ConstantsFeasibility.MIN_PARTICIPATING_MEDICS_FOR_FEASIBILITY; @@ -37,12 +37,12 @@ protected void doExecute(DelegateExecution execution) throws Exception { Task leadingTask = getLeadingTaskFromExecutionVariables(); FinalFeasibilityQueryResults results = (FinalFeasibilityQueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS); + .getVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS); List<FinalFeasibilityQueryResult> resultsWithEnoughParticipatingMedics = filterResultsByParticipatingMedics( leadingTask, results); - execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS, FinalFeasibilityQueryResultsValues + execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS, FinalFeasibilityQueryResultsValues .create(new FinalFeasibilityQueryResults(resultsWithEnoughParticipatingMedics))); boolean existsAtLeastOneResult = checkIfAtLeastOneResultExists(leadingTask, diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java index 3c4c2a3c..8354ab97 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import java.io.IOException; import java.io.InputStream; @@ -51,11 +51,11 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); List<QueryResult> resultsWithResultSets = download(results); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(resultsWithResultSets))); } @@ -72,7 +72,7 @@ private QueryResult download(QueryResult result) InputStream binary = readBinaryResource(client, id.getIdPart()); ResultSet resultSet = deserializeResultSet(binary); - return QueryResult.rbfResultSet(result.getOrganizationIdentifier(), result.getCohortId(), resultSet); + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), resultSet); } private InputStream readBinaryResource(FhirWebserviceClient client, String id) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java index 12117302..40e4a439 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -3,7 +3,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import java.util.List; import java.util.Map; @@ -59,7 +59,7 @@ protected void doExecute(DelegateExecution execution) throws Exception List<QueryResult> results = queries.entrySet().stream() .map(entry -> executeQuery(entry.getKey(), entry.getValue(), idQuery)).collect(Collectors.toList()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(results))); } @@ -72,12 +72,12 @@ private QueryResult executeQuery(String cohortId, String cohortQuery, boolean id if (idQuery) { - return QueryResult.rbfResultSet(organizationProvider.getLocalIdentifierValue(), cohortId, resultSet); + return QueryResult.idResult(organizationProvider.getLocalIdentifierValue(), cohortId, resultSet); } else { int count = Integer.parseInt(resultSet.getRow(0).get(0).getValueAsString()); - return QueryResult.count(organizationProvider.getLocalIdentifierValue(), cohortId, count); + return QueryResult.countResult(organizationProvider.getLocalIdentifierValue(), cohortId, count); } } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java index a78fa9dc..bd6d6963 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import java.util.List; import java.util.Map; @@ -51,7 +51,7 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); Map<String, List<QueryResult>> byCohortId = results.getResults().stream() .collect(Collectors.groupingBy(QueryResult::getCohortId)); @@ -61,7 +61,7 @@ protected void doExecute(DelegateExecution execution) throws Exception List<FinalFeasibilityQueryResult> matchedResults = byCohortId.entrySet().stream() .map(e -> match(matcher, e.getKey(), e.getValue())).collect(Collectors.toList()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_DATA_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS, FinalFeasibilityQueryResultsValues.create(new FinalFeasibilityQueryResults(matchedResults))); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java index 9d8684ba..60b75445 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java @@ -1,6 +1,6 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import java.util.List; import java.util.stream.Collectors; @@ -24,11 +24,11 @@ public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); List<QueryResult> filteredResults = filterResults(results.getResults()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(filteredResults))); } @@ -39,7 +39,7 @@ private List<QueryResult> filterResults(List<QueryResult> results) protected QueryResult filterResult(QueryResult result) { - return QueryResult.rbfResultSet(result.getOrganizationIdentifier(), result.getCohortId(), + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), filterResultSet(result.getResultSet())); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java index 57d8786b..2d316ba0 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -4,8 +4,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI; import java.security.Key; @@ -46,7 +45,7 @@ public class GenerateBloomFilters extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(GenerateBloomFilters.class); + private static final Logger logger = LoggerFactory.getLogger(ModifyResultSet.class); private static final int RBF_LENGTH = 3000; private static final FieldWeights FBF_WEIGHTS = new FieldWeights(0.1, 0.1, 0.1, 0.2, 0.05, 0.1, 0.05, 0.2, 0.1); @@ -84,7 +83,7 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); String securityIdentifier = getSecurityIdentifier(execution); @@ -97,7 +96,7 @@ protected void doExecute(DelegateExecution execution) throws Exception .map(result -> translateAndCreateBinary(resultSetTranslator, result, securityIdentifier)) .collect(Collectors.toList()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(translatedResults))); } @@ -133,7 +132,7 @@ private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtpRbfOnly res ResultSet translatedResultSet = translate(resultSetTranslator, result.getResultSet()); String resultSetUrl = saveResultSetAsBinaryForTtp(translatedResultSet, ttpIdentifier); - return QueryResult.rbfResultSet(result.getOrganizationIdentifier(), result.getCohortId(), resultSetUrl); + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), resultSetUrl); } private ResultSet translate(ResultSetTranslatorToTtpRbfOnly resultSetTranslator, ResultSet resultSet) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java index 90b1e117..82bffe57 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java @@ -1,6 +1,6 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import java.util.List; import java.util.stream.Collectors; @@ -23,11 +23,11 @@ public GenerateCountFromIds(FhirWebserviceClientProvider clientProvider, TaskHel @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); List<QueryResult> filteredResults = count(results.getResults()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(filteredResults))); } @@ -38,7 +38,7 @@ private List<QueryResult> count(List<QueryResult> results) protected QueryResult count(QueryResult result) { - return QueryResult.count(result.getOrganizationIdentifier(), result.getCohortId(), + return QueryResult.countResult(result.getOrganizationIdentifier(), result.getCohortId(), result.getResultSet().getRows().size()); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java index d289c4a1..76bba58d 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; @@ -45,8 +45,7 @@ protected void doExecute(DelegateExecution execution) throws Exception boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, - QueryResultsValues.create(new QueryResults(null))); + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(null))); } private boolean getNeedsRecordLinkageCheck(Task task) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java index 956e22ac..4eaf9704 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java @@ -2,10 +2,10 @@ import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE; import java.util.ArrayList; import java.util.List; @@ -48,10 +48,10 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); boolean needsRecordLinkage = Boolean.TRUE - .equals((Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE)); + .equals(execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE)); Task task = getCurrentTaskFromExecutionVariables(); @@ -59,7 +59,7 @@ protected void doExecute(DelegateExecution execution) throws Exception extendedResults.addAll(results.getResults()); extendedResults.addAll(getResults(task, needsRecordLinkage)); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS, + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(extendedResults))); } @@ -71,13 +71,13 @@ private List<QueryResult> getResults(Task task, boolean needsRecordLinkage) if (needsRecordLinkage) { return taskHelper.getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE, - EXTENSION_HIGHMED_GROUP_ID).map(input -> + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE, EXTENSION_HIGHMED_GROUP_ID) + .map(input -> { String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); String resultSetUrl = ((Reference) input.getValue()).getReference(); - return QueryResult.rbfResultSet(requester.getIdentifier().getValue(), cohortId, resultSetUrl); + return QueryResult.idResult(requester.getIdentifier().getValue(), cohortId, resultSetUrl); }).collect(Collectors.toList()); } else @@ -90,7 +90,7 @@ private List<QueryResult> getResults(Task task, boolean needsRecordLinkage) String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); int cohortSize = ((UnsignedIntType) input.getValue()).getValue(); - return QueryResult.count(requester.getIdentifier().getValue(), cohortId, cohortSize); + return QueryResult.countResult(requester.getIdentifier().getValue(), cohortId, cohortSize); }).collect(Collectors.toList()); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java index 1abc6a6a..fed54051 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java @@ -22,6 +22,7 @@ import org.highmed.dsf.bpe.service.GenerateCountFromIds; import org.highmed.dsf.bpe.service.HandleErrorMultiMedicResults; import org.highmed.dsf.bpe.service.ModifyQueries; +import org.highmed.dsf.bpe.service.ModifyResultSet; import org.highmed.dsf.bpe.service.SelectRequestTargets; import org.highmed.dsf.bpe.service.SelectResponseTargetMedic; import org.highmed.dsf.bpe.service.SelectResponseTargetTtp; diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml index dde1004d..42bb037c 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml @@ -117,16 +117,16 @@ <code value="unsignedInt" /> </type> </element> - <element id="Task.input:single-medic-result-set-rbf-reference"> + <element id="Task.input:single-medic-result-set-reference"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <sliceName value="single-medic-result-set-rbf-reference" /> + <sliceName value="single-medic-result-set-reference" /> <min value="0" /> <max value="*" /> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.extension"> + <element id="Task.input:single-medic-result-set-reference.extension"> <path value="Task.input.extension" /> <slicing> <discriminator> @@ -136,7 +136,7 @@ <rules value="open" /> </slicing> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.extension:group-id"> + <element id="Task.input:single-medic-result-set-reference.extension:group-id"> <path value="Task.input.extension" /> <sliceName value="group-id" /> <min value="1" /> @@ -145,7 +145,7 @@ <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> </type> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.type"> + <element id="Task.input:single-medic-result-set-reference.type"> <path value="Task.input.type" /> <binding> <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> @@ -155,33 +155,33 @@ <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.type.coding"> + <element id="Task.input:single-medic-result-set-reference.type.coding"> <path value="Task.input.type.coding" /> <min value="1" /> <max value="1" /> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.type.coding.system"> + <element id="Task.input:single-medic-result-set-reference.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.type.coding.code"> + <element id="Task.input:single-medic-result-set-reference.type.coding.code"> <path value="Task.input.type.coding.code" /> <min value="1" /> - <fixedCode value="single-medic-result-set-rbf-reference" /> + <fixedCode value="single-medic-result-set-reference" /> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.value[x]"> + <element id="Task.input:single-medic-result-set-reference.value[x]"> <path value="Task.input.value[x]" /> <type> <code value="Reference" /> <targetProfile value="http://hl7.org/fhir/StructureDefinition/Binary" /> </type> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.value[x].reference"> + <element id="Task.input:single-medic-result-set-reference.value[x].reference"> <path value="Task.input.value[x].reference" /> <min value="1" /> </element> - <element id="Task.input:single-medic-result-set-rbf-reference.value[x].identifier"> + <element id="Task.input:single-medic-result-set-reference.value[x].identifier"> <path value="Task.input.value[x].identifier" /> <max value="0" /> </element> diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java index 3cf1471e..2b62c137 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java @@ -50,6 +50,8 @@ public class RequestFeasibilityFromMedicsViaMedic1ExampleStarter private static boolean NEEDS_CONSENT_CHECK = true; private static boolean NEEDS_RECORD_LINKAGE = true; + private static final String QUERY = "SELECT COUNT(e) FROM EHR e;"; + // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate @@ -92,8 +94,8 @@ private static Group createGroup(String name) group.setType(GroupType.PERSON); group.setActual(false); group.setActive(true); - group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY).setValue( - new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression("SELECT COUNT(e) FROM EHR e")); + group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY) + .setValue(new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression(QUERY)); group.setName(name); return group; diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index 3f27ea56..b6b88306 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -16,7 +16,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION; @@ -298,12 +298,12 @@ private Task createValidTaskSingleMedicResultFeasibilityReferenceResult() ParameterComponent inSingleMedicResult1 = task.addInput(); inSingleMedicResult1.setValue(new Reference("Binary/" + UUID.randomUUID().toString())).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) - .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE); + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE); inSingleMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); ParameterComponent inSingleMedicResult2 = task.addInput(); inSingleMedicResult2.setValue(new Reference("Binary/" + UUID.randomUUID().toString())).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) - .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE); + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE); inSingleMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); return task; diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java index 9a3ab356..f0cd32d7 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java @@ -1,12 +1,10 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; @@ -34,12 +32,7 @@ public StoreResult(FhirWebserviceClientProvider clientProvider, TaskHelper taskH protected void doExecute(DelegateExecution execution) throws Exception { Task task = getCurrentTaskFromExecutionVariables(); - - Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); - - QueryResults results = needsRecordLinkage - ? (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RBF_RESULTS) - : (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_DATA_RESULTS); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); addOutputs(task, results); } @@ -51,18 +44,18 @@ private void addOutputs(Task task, QueryResults results) private void addOutput(Task task, QueryResult result) { - if (result.isCountResult()) + if (result.isCohortSizeResult()) { Task.TaskOutputComponent output = getTaskHelper().createOutputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT, result.getCount()); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT, result.getCohortSize()); output.addExtension(createCohortIdExtension(result.getCohortId())); task.addOutput(output); } - else if (result.isRbfResultSetUrlResult()) + else if (result.isIdResultSetUrlResult()) { Task.TaskOutputComponent output = getTaskHelper().createOutput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_RBF_REFERENCE, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE, new Reference(result.getResultSetUrl())); output.addExtension(createCohortIdExtension(result.getCohortId())); diff --git a/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn b/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn index 64d97c45..dfdd7198 100644 --- a/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn +++ b/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn @@ -123,6 +123,10 @@ <bpmn:message id="Message_1dr71re" name="resultSingleMedicFeasibilityMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="localServicesIntegration"> + <bpmndi:BPMNEdge id="SequenceFlow_07wtgee_di" bpmnElement="SequenceFlow_07wtgee"> + <di:waypoint x="599" y="272" /> + <di:waypoint x="667" y="272" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_125i149_di" bpmnElement="Flow_125i149"> <di:waypoint x="400" y="272" /> <di:waypoint x="499" y="272" /> @@ -216,10 +220,6 @@ <dc:Bounds x="722" y="254" width="21" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_07wtgee_di" bpmnElement="SequenceFlow_07wtgee"> - <di:waypoint x="599" y="272" /> - <di:waypoint x="667" y="272" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_04ouilq_di" bpmnElement="SequenceFlow_04ouilq"> <di:waypoint x="1760" y="272" /> <di:waypoint x="1860" y="272" /> @@ -237,9 +237,6 @@ <dc:Bounds x="180" y="297" width="22" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1pt9xhp_di" bpmnElement="checkQueries"> - <dc:Bounds x="499" y="232" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1dln3in_di" bpmnElement="ExclusiveGateway_1dln3in" isMarkerVisible="true"> <dc:Bounds x="667" y="247" width="50" height="50" /> </bpmndi:BPMNShape> @@ -282,6 +279,9 @@ <bpmndi:BPMNShape id="Activity_1y9z4ut_di" bpmnElement="storeResult"> <dc:Bounds x="1860" y="232" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1pt9xhp_di" bpmnElement="checkQueries"> + <dc:Bounds x="499" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml b/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml index da0db75c..fb002fc2 100644 --- a/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml +++ b/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml @@ -269,14 +269,14 @@ <code value="unsignedInt" /> </type> </element> - <element id="Task.output:single-medic-result-set-rbf-reference"> + <element id="Task.output:single-medic-result-set-reference"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> <valueString value="Parameter" /> </extension> <path value="Task.output" /> - <sliceName value="single-medic-result-set-rbf-reference" /> + <sliceName value="single-medic-result-set-reference" /> </element> - <element id="Task.output:single-medic-result-set-rbf-reference.extension"> + <element id="Task.output:single-medic-result-set-reference.extension"> <path value="Task.output.extension" /> <slicing> <discriminator> @@ -286,7 +286,7 @@ <rules value="open" /> </slicing> </element> - <element id="Task.output:single-medic-result-set-rbf-reference.extension:group-id"> + <element id="Task.output:single-medic-result-set-reference.extension:group-id"> <path value="Task.output.extension" /> <sliceName value="group-id" /> <min value="1" /> @@ -295,7 +295,7 @@ <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> </type> </element> - <element id="Task.output:single-medic-result-set-rbf-reference.type"> + <element id="Task.output:single-medic-result-set-reference.type"> <path value="Task.output.type" /> <binding> <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> @@ -305,33 +305,33 @@ <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> - <element id="Task.output:single-medic-result-set-rbf-reference.type.coding"> + <element id="Task.output:single-medic-result-set-reference.type.coding"> <path value="Task.output.type.coding" /> <min value="1" /> <max value="1" /> </element> - <element id="Task.output:single-medic-result-set-rbf-reference.type.coding.system"> + <element id="Task.output:single-medic-result-set-reference.type.coding.system"> <path value="Task.output.type.coding.system" /> <min value="0" /> <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> - <element id="Task.output:single-medic-result-set-rbf-reference.type.coding.code"> + <element id="Task.output:single-medic-result-set-reference.type.coding.code"> <path value="Task.output.type.coding.code" /> <min value="0" /> - <fixedCode value="single-medic-result-set-rbf-reference" /> + <fixedCode value="single-medic-result-set-reference" /> </element> - <element id="Task.output:single-medic-result-set-rbf-reference.value[x]"> + <element id="Task.output:single-medic-result-set-reference.value[x]"> <path value="Task.output.value[x]" /> <type> <code value="Reference" /> <targetProfile value="http://hl7.org/fhir/StructureDefinition/Binary" /> </type> </element> - <element id="Task.output:single-medic-result-set-rbf-reference.value[x].reference"> + <element id="Task.output:single-medic-result-set-reference.value[x].reference"> <path value="Task.output.value[x].reference" /> <min value="0" /> </element> - <element id="Task.output:single-medic-result-set-rbf-reference.value[x].identifier"> + <element id="Task.output:single-medic-result-set-reference.value[x].identifier"> <path value="Task.output.value[x].identifier" /> <max value="0" /> </element> diff --git a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java index e0889af5..7c51b5ed 100644 --- a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java +++ b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/LocalServicesMedic1ExampleStarter.java @@ -30,9 +30,11 @@ public class LocalServicesMedic1ExampleStarter { - private static boolean NEEDS_CONSENT_CHECK = true; + private static boolean NEEDS_CONSENT_CHECK = false; private static boolean NEEDS_RECORD_LINKAGE = true; + private static final String QUERY = "SELECT COUNT(e) FROM EHR e;"; + // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate @@ -63,8 +65,8 @@ private static Task createStartResource() task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_LOCAL_SERVICES_MESSAGE_NAME)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); - task.addInput().setValue(new StringType("SELECT COUNT(e) FROM EHR e;")).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_QUERY_TYPE).setCode(CODESYSTEM_HIGMED_QUERY_TYPE_VALUE_AQL); + task.addInput().setValue(new StringType(QUERY)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_QUERY_TYPE) + .setCode(CODESYSTEM_HIGMED_QUERY_TYPE_VALUE_AQL); task.addInput().setValue(new BooleanType(NEEDS_CONSENT_CHECK)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); From 6238458ee6b9c2687757a9dd2f2d965a6fed2afe Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 5 Mar 2021 16:36:12 +0100 Subject: [PATCH 018/125] generate and distribute mdat aes key, encrypt mdat --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 2 + .../dsf/bpe/message/SendMedicRequest.java | 13 +- .../service/DownloadDataSharingResources.java | 21 +++ .../dsf/bpe/service/ModifyResultSet.java | 154 +++++++++++++++++- .../dsf/bpe/service/SelectRequestTargets.java | 14 +- .../bpe/spring/config/DataSharingConfig.java | 4 +- .../config/DataSharingSerializerConfig.java | 7 + .../dsf/bpe/variable/SecretKeySerializer.java | 72 ++++++++ .../dsf/bpe/variable/SecretKeyValues.java | 55 +++++++ .../resources/bpe/executeDataSharing.bpmn | 34 ++-- .../fhir/CodeSystem/highmed-data-sharing.xml | 5 + .../highmed-task-execute-data-sharing.xml | 46 +++++- 12 files changed, 406 insertions(+), 21 deletions(-) create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeySerializer.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyValues.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index c2374923..3d08b552 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -9,6 +9,7 @@ public interface ConstantsDataSharing String BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK = "needsConsentCheck"; String BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE = "needsRecordLinkage"; String BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG = "bloomFilterConfig"; + String BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY = "mdatAesKey"; String BPMN_EXECUTION_VARIABLE_COHORTS = "cohorts"; String BPMN_EXECUTION_VARIABLE_QUERIES = "queries"; String BPMN_EXECUTION_VARIABLE_QUERY_RESULTS = "queryResults"; @@ -25,6 +26,7 @@ public interface ConstantsDataSharing String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE = "needs-record-linkage"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK = "needs-consent-check"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG = "bloom-filter-configuration"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY = "mdat-aes-key"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY = "medic-correlation-key"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT = "single-medic-count-result"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE = "single-medic-result-set-reference"; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java index a1c34603..27658a04 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java @@ -1,17 +1,21 @@ package org.highmed.dsf.bpe.message; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; import java.util.stream.Stream; +import javax.crypto.SecretKey; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; @@ -52,6 +56,10 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut ParameterComponent inputNeedsRecordLinkage = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + SecretKey mdatKey = (SecretKey) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); + ParameterComponent inputMdatKey = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY, mdatKey.getEncoded()); + if (needsRecordLinkage) { BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution @@ -60,11 +68,12 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG, bloomFilterConfig.toBytes()); return Stream.of(inputResearchStudyReference, inputNeedsConsentCheck, inputNeedsRecordLinkage, - inputBloomFilterConfig); + inputBloomFilterConfig, inputMdatKey); } else { - return Stream.of(inputResearchStudyReference, inputNeedsConsentCheck, inputNeedsRecordLinkage); + return Stream.of(inputResearchStudyReference, inputNeedsConsentCheck, inputNeedsRecordLinkage, + inputMdatKey); } } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java index 0ff1739d..b70263ae 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java @@ -3,11 +3,13 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; @@ -19,16 +21,21 @@ import java.util.Objects; import java.util.stream.Collectors; +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.highmed.dsf.bpe.variable.BloomFilterConfigValues; +import org.highmed.dsf.bpe.variable.SecretKeyValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.FhirResourceValues; import org.highmed.dsf.fhir.variables.FhirResourcesListValues; import org.highmed.fhir.client.FhirWebserviceClient; +import org.highmed.pseudonymization.crypto.AesGcmUtil; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.Group; @@ -83,6 +90,9 @@ protected void doExecute(DelegateExecution execution) boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + SecretKey mdatKey = getMdatKey(task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY, SecretKeyValues.create(mdatKey)); + if (needsRecordLinkage) { BloomFilterConfig bloomFilterConfig = getBloomFilterConfig(task); @@ -184,6 +194,17 @@ private boolean getNeedsRecordLinkageCheck(Task task) + task.getId() + "', this error should " + "have been caught by resource validation")); } + private SecretKey getMdatKey(Task task) + { + byte[] encodedKey = getTaskHelper() + .getFirstInputParameterByteValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY) + .orElseThrow(() -> new IllegalArgumentException("mdat aes key is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation")); + + return new SecretKeySpec(encodedKey, 0, encodedKey.length, "AES"); + } + private BloomFilterConfig getBloomFilterConfig(Task task) { return BloomFilterConfig.fromBytes(getTaskHelper() diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java index 79f77bd0..513492ac 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java @@ -1,20 +1,54 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; + +import java.security.Key; +import java.security.NoSuchAlgorithmException; +import java.util.List; import java.util.Objects; +import java.util.stream.Collectors; + +import javax.crypto.SecretKey; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.BloomFilterConfig; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.mpi.client.MasterPatientIndexClient; +import org.highmed.openehr.model.structure.ResultSet; +import org.highmed.pseudonymization.bloomfilter.BloomFilterGenerator; +import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGenerator; import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGeneratorImpl; +import org.highmed.pseudonymization.crypto.AesGcmUtil; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtp; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpImpl; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpRbfOnly; +import org.hl7.fhir.r4.model.Binary; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResearchStudy; +import org.hl7.fhir.r4.model.ResourceType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; +import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; +import ca.uhn.fhir.context.FhirContext; + public class ModifyResultSet extends AbstractServiceDelegate implements InitializingBean { private static final Logger logger = LoggerFactory.getLogger(ModifyResultSet.class); @@ -25,17 +59,20 @@ public class ModifyResultSet extends AbstractServiceDelegate implements Initiali private static final RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths FBF_LENGTHS = new RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths( 500, 500, 250, 50, 500, 250, 500, 500, 500); + private final OrganizationProvider organizationProvider; private final String ehrIdColumnPath; private final MasterPatientIndexClient masterPatientIndexClient; private final ObjectMapper openEhrObjectMapper; private final BouncyCastleProvider bouncyCastleProvider; - public ModifyResultSet(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, String ehrIdColumnPath, + public ModifyResultSet(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider, String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, ObjectMapper openEhrObjectMapper, BouncyCastleProvider bouncyCastleProvider) { super(clientProvider, taskHelper); + this.organizationProvider = organizationProvider; this.ehrIdColumnPath = ehrIdColumnPath; this.masterPatientIndexClient = masterPatientIndexClient; this.openEhrObjectMapper = openEhrObjectMapper; @@ -47,6 +84,7 @@ public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); + Objects.requireNonNull(organizationProvider, "organizationProvider"); Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath"); Objects.requireNonNull(masterPatientIndexClient, "masterPatientIndexClient"); Objects.requireNonNull(openEhrObjectMapper, "openEhrObjectMapper"); @@ -56,6 +94,118 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - logger.info(this.getClass().getName() + " doExecute called"); + String organizationIdentifier = organizationProvider.getLocalIdentifierValue(); + String researchStudyIdentifier = getResearchStudyIdentifier(execution); + BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution + .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); + ResultSetTranslatorToTtp resultSetTranslator = createResultSetTranslator(organizationIdentifier, + researchStudyIdentifier, bloomFilterConfig); + String ttpIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); + + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + List<QueryResult> translatedResults = results.getResults().stream() + .map(result -> translateAndCreateBinary(resultSetTranslator, result, ttpIdentifier)) + .collect(Collectors.toList()); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(translatedResults))); + } + + protected String getResearchStudyIdentifier(DelegateExecution execution) + { + ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); + return researchStudy.getIdentifier().stream() + .filter(s -> s.getSystem().equals(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)).findFirst() + .orElseThrow(() -> new IllegalArgumentException("Identifier is not set in research study with id='" + + researchStudy.getId() + "', this error should have been caught by resource validation")) + .getValue(); + } + + protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, + String researchStudyIdentifier, BloomFilterConfig bloomFilterConfig) throws NoSuchAlgorithmException + { + RecordBloomFilterGenerator recordBloomFilterGenerator = createRecordBloomFilterGenerator( + bloomFilterConfig.getPermutationSeed(), bloomFilterConfig.getHmacSha2Key(), + bloomFilterConfig.getHmacSha3Key()); + + SecretKey idatKey = AesGcmUtil.generateAES256Key(); // should be provided by properties or pseudonym provider + // like gPAS + SecretKey mdatKey = AesGcmUtil.generateAES256Key(); // should be provided by research study + + return new ResultSetTranslatorToTtpImpl(organizationIdentifier, idatKey, researchStudyIdentifier, mdatKey, + ehrIdColumnPath, recordBloomFilterGenerator, masterPatientIndexClient); } + + protected RecordBloomFilterGenerator createRecordBloomFilterGenerator(long permutationSeed, Key hmacSha2Key, + Key hmacSha3Key) + { + return new RecordBloomFilterGeneratorImpl(RBF_LENGTH, permutationSeed, FBF_WEIGHTS, FBF_LENGTHS, + () -> new BloomFilterGenerator.HmacSha2HmacSha3BiGramHasher(hmacSha2Key, hmacSha3Key, + bouncyCastleProvider)); + } + + private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtp resultSetTranslator, QueryResult result, + String ttpIdentifier) + { + ResultSet translatedResultSet = translate(resultSetTranslator, result.getResultSet()); + String resultSetUrl = saveResultSetAsBinaryForTtp(translatedResultSet, ttpIdentifier); + + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), resultSetUrl); + } + + private ResultSet translate(ResultSetTranslatorToTtp resultSetTranslator, ResultSet resultSet) + { + try + { + return resultSetTranslator.translate(resultSet); + } + catch (Exception e) + { + logger.warn("Error while translating ResultSet: " + e.getMessage(), e); + throw e; + } + } + + protected String saveResultSetAsBinaryForTtp(ResultSet resultSet, String securityIdentifier) + { + byte[] content = serializeResultSet(resultSet); + Reference securityContext = new Reference(); + securityContext.setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(securityIdentifier); + Binary binary = new Binary().setContentType(OPENEHR_MIMETYPE_JSON).setSecurityContext(securityContext) + .setData(content); + + IdType created = createBinaryResource(binary); + return new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl(), ResourceType.Binary.name(), + created.getIdPart(), created.getVersionIdPart()).getValue(); + } + + private byte[] serializeResultSet(ResultSet resultSet) + { + try + { + return openEhrObjectMapper.writeValueAsBytes(resultSet); + } + catch (JsonProcessingException e) + { + logger.warn("Error while serializing ResultSet: " + e.getMessage(), e); + throw new RuntimeException(e); + } + } + + private IdType createBinaryResource(Binary binary) + { + try + { + return getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().create(binary); + } + catch (Exception e) + { + logger.debug("Binary to create {}", FhirContext.forR4().newJsonParser().encodeResourceToString(binary)); + logger.warn("Error while creating Binary resoruce: " + e.getMessage(), e); + throw e; + } + } + + } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index 33aa5e29..51581342 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -3,6 +3,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; @@ -16,12 +17,14 @@ import java.util.stream.Collectors; import javax.crypto.KeyGenerator; +import javax.crypto.SecretKey; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.highmed.dsf.bpe.variable.BloomFilterConfigValues; +import org.highmed.dsf.bpe.variable.SecretKeyValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -29,6 +32,7 @@ import org.highmed.dsf.fhir.variables.TargetValues; import org.highmed.dsf.fhir.variables.Targets; import org.highmed.dsf.fhir.variables.TargetsValues; +import org.highmed.pseudonymization.crypto.AesGcmUtil; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResearchStudy; import org.springframework.beans.factory.InitializingBean; @@ -69,15 +73,16 @@ public void afterPropertiesSet() throws Exception } @Override - protected void doExecute(DelegateExecution execution) + protected void doExecute(DelegateExecution execution) throws Exception { ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(getMedicTargets(researchStudy))); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(getTtpTarget(researchStudy))); - Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); + execution.setVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY, SecretKeyValues.create(createMdatKey())); + Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); if (Boolean.TRUE.equals(needsRecordLinkage)) { execution.setVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG, @@ -110,4 +115,9 @@ private BloomFilterConfig createBloomFilterConfig() return new BloomFilterConfig(random.nextLong(), hmacSha2Generator.generateKey(), hmacSha3Generator.generateKey()); } + + private SecretKey createMdatKey() throws NoSuchAlgorithmException + { + return AesGcmUtil.generateAES256Key(); + } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index dd0f81f2..9ee5fc89 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -221,8 +221,8 @@ public FilterQueryResultsByConsent filterQueryResultsByConsent() @Bean public ModifyResultSet modifyResultSet() { - return new ModifyResultSet(fhirClientProvider, taskHelper, ehrIdColumnPath, masterPatientIndexClient(), - objectMapper, bouncyCastleProvider()); + return new ModifyResultSet(fhirClientProvider, taskHelper, organizationProvider, ehrIdColumnPath, + masterPatientIndexClient(), objectMapper, bouncyCastleProvider()); } @Bean diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java index 3ac056e3..e3757496 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java @@ -3,6 +3,7 @@ import org.highmed.dsf.bpe.variable.BloomFilterConfigSerializer; import org.highmed.dsf.bpe.variable.QueryResultSerializer; import org.highmed.dsf.bpe.variable.QueryResultsSerializer; +import org.highmed.dsf.bpe.variable.SecretKeySerializer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -21,6 +22,12 @@ public BloomFilterConfigSerializer bloomFilterConfigSerializer() return new BloomFilterConfigSerializer(objectMapper); } + @Bean + public SecretKeySerializer secretKeySerializer() + { + return new SecretKeySerializer(objectMapper); + } + @Bean public QueryResultSerializer queryResultSerializer() { diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeySerializer.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeySerializer.java new file mode 100644 index 00000000..851da83c --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeySerializer.java @@ -0,0 +1,72 @@ +package org.highmed.dsf.bpe.variable; + +import java.io.IOException; +import java.util.Objects; + +import javax.crypto.SecretKey; + +import org.camunda.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer; +import org.camunda.bpm.engine.impl.variable.serializer.ValueFields; +import org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl; +import org.highmed.dsf.bpe.variable.BloomFilterConfigValues.BloomFilterConfigValue; +import org.springframework.beans.factory.InitializingBean; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class SecretKeySerializer extends PrimitiveValueSerializer<SecretKeyValues.SecretKeyValue> + implements InitializingBean +{ + private final ObjectMapper objectMapper; + + public SecretKeySerializer(ObjectMapper objectMapper) + { + super(SecretKeyValues.VALUE_TYPE); + + this.objectMapper = objectMapper; + } + + @Override + public void afterPropertiesSet() throws Exception + { + Objects.requireNonNull(objectMapper, "objectMapper"); + } + + @Override + public void writeValue(SecretKeyValues.SecretKeyValue value, ValueFields valueFields) + { + SecretKey target = value.getValue(); + try + { + if (target != null) + valueFields.setByteArrayValue(objectMapper.writeValueAsBytes(target)); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } + } + + @Override + public SecretKeyValues.SecretKeyValue convertToTypedValue(UntypedValueImpl untypedValue) + { + return SecretKeyValues.create((SecretKey) untypedValue.getValue()); + } + + @Override + public SecretKeyValues.SecretKeyValue readValue(ValueFields valueFields, boolean asTransientValue) + { + byte[] bytes = valueFields.getByteArrayValue(); + + try + { + SecretKey target = (bytes == null || bytes.length <= 0) ? null + : objectMapper.readValue(bytes, SecretKey.class); + return SecretKeyValues.create(target); + } + catch (IOException e) + { + throw new RuntimeException(e); + } + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyValues.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyValues.java new file mode 100644 index 00000000..1d95d577 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyValues.java @@ -0,0 +1,55 @@ +package org.highmed.dsf.bpe.variable; + +import java.util.Map; + +import javax.crypto.SecretKey; + +import org.camunda.bpm.engine.variable.impl.type.PrimitiveValueTypeImpl; +import org.camunda.bpm.engine.variable.impl.value.PrimitiveTypeValueImpl; +import org.camunda.bpm.engine.variable.type.PrimitiveValueType; +import org.camunda.bpm.engine.variable.value.PrimitiveValue; +import org.camunda.bpm.engine.variable.value.TypedValue; + +public class SecretKeyValues +{ + public static interface SecretKeyValue extends PrimitiveValue<SecretKey> + { + } + + private static class SecretKeyValueImpl extends PrimitiveTypeValueImpl<SecretKey> implements SecretKeyValue + { + private static final long serialVersionUID = 1L; + + public SecretKeyValueImpl(SecretKey value, PrimitiveValueType type) + { + super(value, type); + } + } + + public static class SecretKeyValueTypeImpl extends PrimitiveValueTypeImpl + { + private static final long serialVersionUID = 1L; + + private SecretKeyValueTypeImpl() + { + super(SecretKey.class); + } + + @Override + public TypedValue createValue(Object value, Map<String, Object> valueInfo) + { + return new SecretKeyValueImpl((SecretKey) value, VALUE_TYPE); + } + } + + public static final PrimitiveValueType VALUE_TYPE = new SecretKeyValueTypeImpl(); + + private SecretKeyValues() + { + } + + public static SecretKeyValue create(SecretKey value) + { + return new SecretKeyValueImpl(value, VALUE_TYPE); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index 69224c38..047fc36a 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -84,11 +84,21 @@ <bpmn:text>uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc.</bpmn:text> </bpmn:textAnnotation> <bpmn:association id="Association_1ncewqu" sourceRef="checkDataSharingRequest" targetRef="TextAnnotation_0euut3n" /> + <bpmn:textAnnotation id="TextAnnotation_179m5lj"> + <bpmn:text>Should be split in 3 single tasks</bpmn:text> + </bpmn:textAnnotation> + <bpmn:association id="Association_1yw2wcu" sourceRef="generateBloomFilters" targetRef="TextAnnotation_179m5lj" /> </bpmn:process> <bpmn:message id="Message_1yz2a31" name="executeDataSharingMessage" /> <bpmn:message id="Message_1dr71re" name="resultSingleMedicDataSharingMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="executeDataSharing"> + <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> + <dc:Bounds x="330" y="80" width="267" height="56" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="TextAnnotation_179m5lj_di" bpmnElement="TextAnnotation_179m5lj"> + <dc:Bounds x="1450" y="88" width="100" height="40" /> + </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Flow_1ecoehc_di" bpmnElement="Flow_1ecoehc"> <di:waypoint x="660" y="212" /> <di:waypoint x="710" y="212" /> @@ -102,8 +112,8 @@ <di:waypoint x="560" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ascyjc_di" bpmnElement="SequenceFlow_0ascyjc"> - <di:waypoint x="1840" y="212" /> - <di:waypoint x="1952" y="212" /> + <di:waypoint x="1810" y="212" /> + <di:waypoint x="1892" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ug2kru_di" bpmnElement="SequenceFlow_1ug2kru"> <di:waypoint x="1460" y="212" /> @@ -130,7 +140,7 @@ </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_04ouilq_di" bpmnElement="SequenceFlow_04ouilq"> <di:waypoint x="1640" y="212" /> - <di:waypoint x="1740" y="212" /> + <di:waypoint x="1710" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1etju4m_di" bpmnElement="SequenceFlow_1etju4m"> <di:waypoint x="340" y="212" /> @@ -178,28 +188,30 @@ <bpmndi:BPMNShape id="Activity_1vlv5ud_di" bpmnElement="extractQueries"> <dc:Bounds x="560" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> - <dc:Bounds x="330" y="80" width="267" height="56" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="generateBloomFilters"> <dc:Bounds x="1360" y="172" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> + <dc:Bounds x="1710" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> <dc:Bounds x="1540" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> - <dc:Bounds x="1740" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> - <dc:Bounds x="1952" y="194" width="36" height="36" /> + <dc:Bounds x="1892" y="194" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1926" y="237" width="90" height="14" /> + <dc:Bounds x="1866" y="237" width="90" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> <di:waypoint x="455" y="172" /> <di:waypoint x="460" y="136" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Association_1yw2wcu_di" bpmnElement="Association_1yw2wcu"> + <di:waypoint x="1410" y="172" /> + <di:waypoint x="1410" y="108" /> + <di:waypoint x="1450" y="108" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml index 50002ded..489b50f5 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml @@ -41,6 +41,11 @@ <display value="Bloom Filter Configuration"/> <definition value="Base64 binary encoded bloom filter configuration"/> </concept> + <concept> + <code value="mdat-aes-key"/> + <display value="MDAT AES Secret Key"/> + <definition value="Base64 binary encoded MDAT AES secret key"/> + </concept> <concept> <code value="medic-correlation-key"/> <display value="MeDIC Correlation Key"/> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml index e10863df..5b6b66fe 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml @@ -29,8 +29,8 @@ <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <min value="6" /> - <max value="7" /> + <min value="7" /> + <max value="8" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> @@ -220,5 +220,47 @@ <code value="base64Binary" /> </type> </element> + + + <element id="Task.input:mdat-aes-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="mdat-aes-key" /> + <min value="0" /> + <max value="1" /> + </element> + <element id="Task.input:mdat-aes-key.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:mdat-aes-key.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:mdat-aes-key.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:mdat-aes-key.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="mdat-aes-key" /> + </element> + <element id="Task.input:mdat-aes-key.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="base64Binary" /> + </type> + </element> </differential> </StructureDefinition> \ No newline at end of file From d0424f4b01c70fe1f2daa31f9320665bca6ca4dc Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 8 Mar 2021 08:28:12 +0100 Subject: [PATCH 019/125] adds intial implementation of check results --- .../bpe/service/CheckSingleMedicResults.java | 52 ++++++++++++++++++- .../resources/bpe/executeDataSharing.bpmn | 52 +++++++++---------- 2 files changed, 77 insertions(+), 27 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java index be2e2436..df119219 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java @@ -1,9 +1,20 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.ConstantsBase; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,6 +31,45 @@ public CheckSingleMedicResults(FhirWebserviceClientProvider clientProvider, Task @Override protected void doExecute(DelegateExecution execution) { - logger.info(this.getClass().getName() + " doExecute called"); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + + Task currentTask = getCurrentTaskFromExecutionVariables(); + List<QueryResult> filteredResults = filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(results, + currentTask); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(filteredResults))); + } + + private List<QueryResult> filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(QueryResults results, Task task) + { + List<QueryResult> filteredResults = new ArrayList<>(); + for (QueryResult result : results.getResults()) + { + Optional<String> errorReason = testResultAndReturnErrorReason(result); + if (errorReason.isPresent()) + addError(task, result.getCohortId(), errorReason.get()); + else + filteredResults.add(result); + } + + return filteredResults; + } + + protected Optional<String> testResultAndReturnErrorReason(QueryResult result) + { + // TODO: implement check + // result size > 0 + // other filter criteria tbd + return Optional.empty(); + } + + private void addError(Task task, String cohortId, String error) + { + String errorMessage = "Data sharing query result check failed for group with id '" + cohortId + "': " + error; + logger.info(errorMessage); + + task.getOutput().add(getTaskHelper().createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN, + ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage)); } } diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index 047fc36a..c6e3e4e1 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -85,7 +85,7 @@ </bpmn:textAnnotation> <bpmn:association id="Association_1ncewqu" sourceRef="checkDataSharingRequest" targetRef="TextAnnotation_0euut3n" /> <bpmn:textAnnotation id="TextAnnotation_179m5lj"> - <bpmn:text>Should be split in 3 single tasks</bpmn:text> + <bpmn:text>Should be split in 3 single tasks, with and without RBF generation</bpmn:text> </bpmn:textAnnotation> <bpmn:association id="Association_1yw2wcu" sourceRef="generateBloomFilters" targetRef="TextAnnotation_179m5lj" /> </bpmn:process> @@ -93,12 +93,10 @@ <bpmn:message id="Message_1dr71re" name="resultSingleMedicDataSharingMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="executeDataSharing"> - <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> - <dc:Bounds x="330" y="80" width="267" height="56" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_179m5lj_di" bpmnElement="TextAnnotation_179m5lj"> - <dc:Bounds x="1450" y="88" width="100" height="40" /> - </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_1t9f3m5_di" bpmnElement="Flow_1t9f3m5"> + <di:waypoint x="1242" y="212" /> + <di:waypoint x="1360" y="212" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1ecoehc_di" bpmnElement="Flow_1ecoehc"> <di:waypoint x="660" y="212" /> <di:waypoint x="710" y="212" /> @@ -154,10 +152,9 @@ <di:waypoint x="980" y="212" /> <di:waypoint x="1032" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1t9f3m5_di" bpmnElement="Flow_1t9f3m5"> - <di:waypoint x="1242" y="212" /> - <di:waypoint x="1360" y="212" /> - </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> + <dc:Bounds x="1540" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkDataSharingRequest"> <dc:Bounds x="400" y="172" width="100" height="80" /> </bpmndi:BPMNShape> @@ -170,6 +167,12 @@ <bpmndi:BPMNShape id="ServiceTask_0b8j3ka_di" bpmnElement="downloadDataSharingResources"> <dc:Bounds x="240" y="172" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> + <dc:Bounds x="1892" y="194" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1866" y="237" width="90" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0bq7zdz_di" bpmnElement="ExclusiveGateway_0bq7zdz" isMarkerVisible="true"> <dc:Bounds x="1032" y="187" width="50" height="50" /> </bpmndi:BPMNShape> @@ -179,6 +182,12 @@ <bpmndi:BPMNShape id="ExclusiveGateway_0lecmy5_di" bpmnElement="ExclusiveGateway_0lecmy5" isMarkerVisible="true"> <dc:Bounds x="1192" y="187" width="50" height="50" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="generateBloomFilters"> + <dc:Bounds x="1360" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> + <dc:Bounds x="1710" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0u5pb4i_di" bpmnElement="executeQueries"> <dc:Bounds x="880" y="172" width="100" height="80" /> </bpmndi:BPMNShape> @@ -188,20 +197,11 @@ <bpmndi:BPMNShape id="Activity_1vlv5ud_di" bpmnElement="extractQueries"> <dc:Bounds x="560" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="generateBloomFilters"> - <dc:Bounds x="1360" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> - <dc:Bounds x="1710" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> - <dc:Bounds x="1540" y="172" width="100" height="80" /> + <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> + <dc:Bounds x="330" y="80" width="267" height="56" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> - <dc:Bounds x="1892" y="194" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1866" y="237" width="90" height="14" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="TextAnnotation_179m5lj_di" bpmnElement="TextAnnotation_179m5lj"> + <dc:Bounds x="1450" y="88" width="150" height="48" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> <di:waypoint x="455" y="172" /> @@ -209,8 +209,8 @@ </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Association_1yw2wcu_di" bpmnElement="Association_1yw2wcu"> <di:waypoint x="1410" y="172" /> - <di:waypoint x="1410" y="108" /> - <di:waypoint x="1450" y="108" /> + <di:waypoint x="1410" y="112" /> + <di:waypoint x="1450" y="112" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> From e04e1bede58ae84d822f4b2cdad212a90ecd3bcc Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 8 Mar 2021 08:48:02 +0100 Subject: [PATCH 020/125] use mdat key from task --- .../dsf/bpe/service/ModifyResultSet.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java index 513492ac..652b8b27 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java @@ -5,6 +5,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; @@ -34,12 +35,12 @@ import org.highmed.pseudonymization.crypto.AesGcmUtil; import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtp; import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpImpl; -import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpRbfOnly; import org.hl7.fhir.r4.model.Binary; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResearchStudy; import org.hl7.fhir.r4.model.ResourceType; +import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; @@ -96,13 +97,15 @@ protected void doExecute(DelegateExecution execution) throws Exception { String organizationIdentifier = organizationProvider.getLocalIdentifierValue(); String researchStudyIdentifier = getResearchStudyIdentifier(execution); + SecretKey mdatKey = (SecretKey) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); + ResultSetTranslatorToTtp resultSetTranslator = createResultSetTranslator(organizationIdentifier, - researchStudyIdentifier, bloomFilterConfig); - String ttpIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); + researchStudyIdentifier, mdatKey, bloomFilterConfig); QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + String ttpIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); List<QueryResult> translatedResults = results.getResults().stream() .map(result -> translateAndCreateBinary(resultSetTranslator, result, ttpIdentifier)) .collect(Collectors.toList()); @@ -122,15 +125,15 @@ protected String getResearchStudyIdentifier(DelegateExecution execution) } protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, - String researchStudyIdentifier, BloomFilterConfig bloomFilterConfig) throws NoSuchAlgorithmException + String researchStudyIdentifier, SecretKey mdatKey, BloomFilterConfig bloomFilterConfig) + throws NoSuchAlgorithmException { RecordBloomFilterGenerator recordBloomFilterGenerator = createRecordBloomFilterGenerator( bloomFilterConfig.getPermutationSeed(), bloomFilterConfig.getHmacSha2Key(), bloomFilterConfig.getHmacSha3Key()); - SecretKey idatKey = AesGcmUtil.generateAES256Key(); // should be provided by properties or pseudonym provider - // like gPAS - SecretKey mdatKey = AesGcmUtil.generateAES256Key(); // should be provided by research study + // TODO: should be provided by properties or pseudonym provider + SecretKey idatKey = AesGcmUtil.generateAES256Key(); return new ResultSetTranslatorToTtpImpl(organizationIdentifier, idatKey, researchStudyIdentifier, mdatKey, ehrIdColumnPath, recordBloomFilterGenerator, masterPatientIndexClient); @@ -207,5 +210,4 @@ private IdType createBinaryResource(Binary binary) } } - } From 356e1265fb4c839a817ed7565a332ce85b40a356 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 8 Mar 2021 08:56:25 +0100 Subject: [PATCH 021/125] download result sets implementation --- .../dsf/bpe/service/DownloadResultSets.java | 83 ++++++++++++++++++- .../highmed/dsf/bpe/service/StoreResults.java | 6 -- .../bpe/spring/config/DataSharingConfig.java | 2 +- 3 files changed, 81 insertions(+), 10 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java index 8806d2bf..6cba29cb 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java @@ -1,25 +1,102 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import javax.ws.rs.core.MediaType; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.fhir.client.FhirWebserviceClient; +import org.highmed.openehr.model.structure.ResultSet; +import org.hl7.fhir.r4.model.IdType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.databind.ObjectMapper; + public class DownloadResultSets extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(DownloadResultSets.class); - public DownloadResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + private final ObjectMapper openEhrObjectMapper; + + public DownloadResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper); + this.openEhrObjectMapper = openEhrObjectMapper; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + Objects.requireNonNull(openEhrObjectMapper, "openEhrObjectMapper"); } @Override protected void doExecute(DelegateExecution execution) { - logger.info(this.getClass().getName() + " doExecute called"); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + + List<QueryResult> resultsWithResultSets = download(results); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(resultsWithResultSets))); + } + + private List<QueryResult> download(QueryResults results) + { + return results.getResults().stream().map(this::download).collect(Collectors.toList()); + } + + private QueryResult download(QueryResult result) + { + IdType id = new IdType(result.getResultSetUrl()); + FhirWebserviceClient client = getFhirWebserviceClientProvider().getRemoteWebserviceClient(id.getBaseUrl()); + + InputStream binary = readBinaryResource(client, id.getIdPart()); + ResultSet resultSet = deserializeResultSet(binary); + + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), resultSet); + } + + private InputStream readBinaryResource(FhirWebserviceClient client, String id) + { + try + { + logger.info("Reading binary from {} with id {}", client.getBaseUrl(), id); + return client.readBinary(id, MediaType.valueOf(OPENEHR_MIMETYPE_JSON)); + } + catch (Exception e) + { + logger.warn("Error while reading Binary resource: " + e.getMessage(), e); + throw e; + } + } + + private ResultSet deserializeResultSet(InputStream content) + { + try (content) + { + return openEhrObjectMapper.readValue(content, ResultSet.class); + } + catch (IOException e) + { + logger.warn("Error while deserializing ResultSet: " + e.getMessage(), e); + throw new RuntimeException(e); + } } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java index f1b83f85..63b72c6b 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java @@ -44,12 +44,6 @@ protected void doExecute(DelegateExecution execution) execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(extendedResults))); - - if (Boolean.TRUE.equals(execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE))) - { - // Process result rbf - } - } private List<QueryResult> getResults(Task task, String code) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index 9ee5fc89..3e02f8c3 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -127,7 +127,7 @@ public StoreResults storeResults() @Bean public DownloadResultSets downloadResultSets() { - return new DownloadResultSets(fhirClientProvider, taskHelper); + return new DownloadResultSets(fhirClientProvider, taskHelper, objectMapper); } @Bean From b9f7344834233ce2580511e7d1482617dcf4dd19 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 8 Mar 2021 13:07:27 +0100 Subject: [PATCH 022/125] pseudymization with record linkage implementation --- .../dsf/bpe/service/DownloadResultSets.java | 2 +- .../dsf/bpe/service/ExecuteRecordLink.java | 25 --- ...tSet.java => ModifyResultSetsWithRbf.java} | 7 +- ...eudonymizeResultSetsWithRecordLinkage.java | 152 ++++++++++++++++++ .../bpe/spring/config/DataSharingConfig.java | 19 +-- .../resources/bpe/computeDataSharing.bpmn | 102 ++++++------ .../resources/bpe/executeDataSharing.bpmn | 128 +++++++++------ 7 files changed, 292 insertions(+), 143 deletions(-) delete mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{ModifyResultSet.java => ModifyResultSetsWithRbf.java} (97%) create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java index 6cba29cb..b2816405 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java @@ -79,7 +79,7 @@ private InputStream readBinaryResource(FhirWebserviceClient client, String id) { logger.info("Reading binary from {} with id {}", client.getBaseUrl(), id); return client.readBinary(id, MediaType.valueOf(OPENEHR_MIMETYPE_JSON)); - } + } catch (Exception e) { logger.warn("Error while reading Binary resource: " + e.getMessage(), e); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java deleted file mode 100644 index fc5eef34..00000000 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteRecordLink.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.highmed.dsf.bpe.service; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; -import org.highmed.dsf.fhir.task.TaskHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ExecuteRecordLink extends AbstractServiceDelegate -{ - - private static final Logger logger = LoggerFactory.getLogger(ExecuteRecordLink.class); - - public ExecuteRecordLink(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) - { - super(clientProvider, taskHelper); - } - - @Override - protected void doExecute(DelegateExecution execution) - { - logger.info(this.getClass().getName() + " doExecute called"); - } -} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java similarity index 97% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java index 652b8b27..7f510d65 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSet.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java @@ -40,7 +40,6 @@ import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResearchStudy; import org.hl7.fhir.r4.model.ResourceType; -import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; @@ -50,9 +49,9 @@ import ca.uhn.fhir.context.FhirContext; -public class ModifyResultSet extends AbstractServiceDelegate implements InitializingBean +public class ModifyResultSetsWithRbf extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(ModifyResultSet.class); + private static final Logger logger = LoggerFactory.getLogger(ModifyResultSetsWithRbf.class); private static final int RBF_LENGTH = 3000; private static final RecordBloomFilterGeneratorImpl.FieldWeights FBF_WEIGHTS = new RecordBloomFilterGeneratorImpl.FieldWeights( @@ -66,7 +65,7 @@ public class ModifyResultSet extends AbstractServiceDelegate implements Initiali private final ObjectMapper openEhrObjectMapper; private final BouncyCastleProvider bouncyCastleProvider; - public ModifyResultSet(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public ModifyResultSetsWithRbf(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, OrganizationProvider organizationProvider, String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, ObjectMapper openEhrObjectMapper, BouncyCastleProvider bouncyCastleProvider) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java new file mode 100644 index 00000000..e1064b74 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java @@ -0,0 +1,152 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + +import java.security.NoSuchAlgorithmException; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +import javax.crypto.SecretKey; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.openehr.model.structure.ResultSet; +import org.highmed.pseudonymization.crypto.AesGcmUtil; +import org.highmed.pseudonymization.domain.PersonWithMdat; +import org.highmed.pseudonymization.domain.PseudonymizedPersonWithMdat; +import org.highmed.pseudonymization.domain.impl.MatchedPersonImpl; +import org.highmed.pseudonymization.domain.impl.PseudonymizedPersonImpl; +import org.highmed.pseudonymization.psn.PseudonymGeneratorImpl; +import org.highmed.pseudonymization.psn.PseudonymizedPersonFactory; +import org.highmed.pseudonymization.recordlinkage.FederatedMatcher; +import org.highmed.pseudonymization.recordlinkage.FederatedMatcherImpl; +import org.highmed.pseudonymization.recordlinkage.MatchedPerson; +import org.highmed.pseudonymization.recordlinkage.MatchedPersonFactory; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedic; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedicImpl; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToMedic; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToMedicImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class PseudonymizeResultSetsWithRecordLinkage extends AbstractServiceDelegate +{ + + private static final Logger logger = LoggerFactory.getLogger(PseudonymizeResultSetsWithRecordLinkage.class); + + private final ObjectMapper psnObjectMapper; + + public PseudonymizeResultSetsWithRecordLinkage(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ObjectMapper psnObjectMapper) + { + super(clientProvider, taskHelper); + this.psnObjectMapper = psnObjectMapper; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + + String researchStudyIdentifier = ""; + SecretKey researchStudyKey = AesGcmUtil.generateAES256Key(); + + Map<String, List<QueryResult>> byCohortId = groupByCohortId(results); + QueryResults finalResults = createFinalResults(researchStudyIdentifier, researchStudyKey, byCohortId); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(finalResults)); + } + + protected Map<String, List<QueryResult>> groupByCohortId(QueryResults results) + { + return results.getResults().stream().collect(Collectors.groupingBy(QueryResult::getCohortId)); + } + + protected QueryResults createFinalResults(String researchStudyIdentifier, SecretKey reserchStudyKey, + Map<String, List<QueryResult>> groupedResults) throws NoSuchAlgorithmException + { + ResultSetTranslatorFromMedic translatorFromMedic = createResultSetTranslatorFromMedic(); + ResultSetTranslatorToMedic translatorToMedic = createResultSetTranslatorToMedic(); + FederatedMatcher<PersonWithMdat> matcher = createFederatedMatcher(); + PseudonymGeneratorImpl<PersonWithMdat, PseudonymizedPersonWithMdat> psnGenerator = createPseudonymGenerator( + researchStudyIdentifier, reserchStudyKey); + + List<QueryResult> finalResults = groupedResults.entrySet().stream().filter(r -> !r.getValue().isEmpty()) + .map(e -> translateMatchAndPseudonymize(translatorFromMedic, matcher, psnGenerator, translatorToMedic, + e.getKey(), e.getValue())).collect(Collectors.toList()); + + return new QueryResults(finalResults); + } + + private QueryResult translateMatchAndPseudonymize(ResultSetTranslatorFromMedic translatorFromMedic, + FederatedMatcher<PersonWithMdat> matcher, + PseudonymGeneratorImpl<PersonWithMdat, PseudonymizedPersonWithMdat> psnGenerator, + ResultSetTranslatorToMedic translatorToMedic, String cohortId, List<QueryResult> results) + { + logger.debug("Translating, matching and pseudonymizing results for cohort {}", cohortId); + + List<List<PersonWithMdat>> persons = translateFromMedicResultSets(translatorFromMedic, results); + Set<MatchedPerson<PersonWithMdat>> matchedPersons = matcher.matchPersons(persons); + List<PseudonymizedPersonWithMdat> pseudonymizedPersons = psnGenerator + .createPseudonymsAndShuffle(matchedPersons); + ResultSet resultSet = translateToMedicResultSet(results.get(0).getResultSet(), translatorToMedic, + pseudonymizedPersons); + + return QueryResult.idResult("ttp", cohortId, resultSet); + } + + private List<List<PersonWithMdat>> translateFromMedicResultSets(ResultSetTranslatorFromMedic translator, + List<QueryResult> results) + { + return results.stream().map(r -> translateFromMedic(translator, r)).collect(Collectors.toList()); + } + + private List<PersonWithMdat> translateFromMedic(ResultSetTranslatorFromMedic translator, QueryResult result) + { + return translator.translate(result.getOrganizationIdentifier(), result.getResultSet()); + } + + private ResultSet translateToMedicResultSet(ResultSet initialResultSet, ResultSetTranslatorToMedic translator, + List<PseudonymizedPersonWithMdat> pseudonymizedPersons) + { + return translator.translate(initialResultSet.getMeta(), initialResultSet.getColumns(), pseudonymizedPersons); + } + + private ResultSetTranslatorFromMedic createResultSetTranslatorFromMedic() + { + return new ResultSetTranslatorFromMedicImpl(); + } + + private ResultSetTranslatorToMedic createResultSetTranslatorToMedic() + { + return new ResultSetTranslatorToMedicImpl(); + } + + private FederatedMatcher<PersonWithMdat> createFederatedMatcher() + { + MatchedPersonFactory<PersonWithMdat> matchedPersonFactory = MatchedPersonImpl::new; + return new FederatedMatcherImpl<>(matchedPersonFactory); + } + + private PseudonymGeneratorImpl<PersonWithMdat, PseudonymizedPersonWithMdat> createPseudonymGenerator( + String researchStudyIdentifier, SecretKey researchStudyKey) throws NoSuchAlgorithmException + { + PseudonymizedPersonFactory<PersonWithMdat, PseudonymizedPersonWithMdat> psnPersonFactory = PseudonymizedPersonImpl::new; + return new PseudonymGeneratorImpl(researchStudyIdentifier, researchStudyKey, psnObjectMapper, psnPersonFactory); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index 3e02f8c3..3d4b667c 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -10,17 +10,16 @@ import org.highmed.dsf.bpe.service.CheckMultiMedicResults; import org.highmed.dsf.bpe.service.CheckSingleMedicResults; import org.highmed.dsf.bpe.service.CheckTtpComputedMultiMedicResults; -import org.highmed.dsf.bpe.service.CreatePseudonym; import org.highmed.dsf.bpe.service.DownloadDataSharingResources; import org.highmed.dsf.bpe.service.DownloadResearchStudyResource; import org.highmed.dsf.bpe.service.DownloadResultSets; import org.highmed.dsf.bpe.service.ExecuteQueries; -import org.highmed.dsf.bpe.service.ExecuteRecordLink; import org.highmed.dsf.bpe.service.ExtractQueries; import org.highmed.dsf.bpe.service.FilterQueryResultsByConsent; import org.highmed.dsf.bpe.service.HandleErrorMultiMedicResults; import org.highmed.dsf.bpe.service.ModifyQueries; -import org.highmed.dsf.bpe.service.ModifyResultSet; +import org.highmed.dsf.bpe.service.ModifyResultSetsWithRbf; +import org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithRecordLinkage; import org.highmed.dsf.bpe.service.SelectRequestTargets; import org.highmed.dsf.bpe.service.SelectResponseTargetMedic; import org.highmed.dsf.bpe.service.SelectResponseTargetTtp; @@ -131,15 +130,9 @@ public DownloadResultSets downloadResultSets() } @Bean - public ExecuteRecordLink executeRecordLink() + public PseudonymizeResultSetsWithRecordLinkage pseudonymizeResultSetsWithRecordLinkage() { - return new ExecuteRecordLink(fhirClientProvider, taskHelper); - } - - @Bean - public CreatePseudonym createPseudonym() - { - return new CreatePseudonym(fhirClientProvider, taskHelper); + return new PseudonymizeResultSetsWithRecordLinkage(fhirClientProvider, taskHelper, objectMapper); } @Bean @@ -219,9 +212,9 @@ public FilterQueryResultsByConsent filterQueryResultsByConsent() } @Bean - public ModifyResultSet modifyResultSet() + public ModifyResultSetsWithRbf modifyResultSetsWithRbf() { - return new ModifyResultSet(fhirClientProvider, taskHelper, organizationProvider, ehrIdColumnPath, + return new ModifyResultSetsWithRbf(fhirClientProvider, taskHelper, organizationProvider, ehrIdColumnPath, masterPatientIndexClient(), objectMapper, bouncyCastleProvider()); } diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn index 28c014d2..d7b3448e 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn @@ -62,11 +62,11 @@ <bpmn:sequenceFlow id="SequenceFlow_0t4lx4v" name="else" sourceRef="ExclusiveGateway_07e71aa" targetRef="ExclusiveGateway_1r8ow3i"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:serviceTask id="executeRecordLink" name="execute record link" camunda:class="org.highmed.dsf.bpe.service.ExecuteRecordLink"> + <bpmn:serviceTask id="pseudonymizeResultSetWithRecordLinkage" name="pseudonymize result sets with record linkage" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithRecordLinkage"> <bpmn:incoming>SequenceFlow_0calilw</bpmn:incoming> <bpmn:outgoing>SequenceFlow_02zmrer</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_02zmrer" sourceRef="executeRecordLink" targetRef="ExclusiveGateway_1r8ow3i" /> + <bpmn:sequenceFlow id="SequenceFlow_02zmrer" sourceRef="pseudonymizeResultSetWithRecordLinkage" targetRef="ExclusiveGateway_1r8ow3i" /> <bpmn:exclusiveGateway id="ExclusiveGateway_1r8ow3i"> <bpmn:incoming>SequenceFlow_02zmrer</bpmn:incoming> <bpmn:incoming>SequenceFlow_0t4lx4v</bpmn:incoming> @@ -77,7 +77,7 @@ <bpmn:outgoing>SequenceFlow_1lfe4wr</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="selectResponseTargetMedic" name="select response target MeDIC" camunda:class="org.highmed.dsf.bpe.service.SelectResponseTargetMedic"> - <bpmn:incoming>Flow_1rtrx8w</bpmn:incoming> + <bpmn:incoming>Flow_1qmx444</bpmn:incoming> <bpmn:outgoing>Flow_1k0sqwo</bpmn:outgoing> </bpmn:serviceTask> <bpmn:endEvent id="EndEventError" name="send error to leading MeDIC"> @@ -96,15 +96,13 @@ <bpmn:incoming>Flow_1k0sqwo</bpmn:incoming> <bpmn:outgoing>Flow_1r6dq8y</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_1ixeke2" sourceRef="ExclusiveGateway_1r8ow3i" targetRef="createPseudonyms" /> - <bpmn:sequenceFlow id="Flow_1k0sqwo" sourceRef="selectResponseTargetMedic" targetRef="checkComputedResults" /> - <bpmn:sequenceFlow id="Flow_1r6dq8y" sourceRef="checkComputedResults" targetRef="EndEventSuccess" /> + <bpmn:sequenceFlow id="Flow_1ixeke2" sourceRef="ExclusiveGateway_1r8ow3i" targetRef="Activity_0ekn4v9" /> <bpmn:boundaryEvent id="Event_1vp5qzs" attachedToRef="checkComputedResults"> <bpmn:outgoing>Flow_1tmnvhl</bpmn:outgoing> <bpmn:errorEventDefinition id="ErrorEventDefinition_05kx06m" errorRef="Error_0qub4jc" /> </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_1tmnvhl" sourceRef="Event_1vp5qzs" targetRef="EndEventError" /> - <bpmn:sequenceFlow id="SequenceFlow_0calilw" name="needs record linkage" sourceRef="ExclusiveGateway_07e71aa" targetRef="executeRecordLink"> + <bpmn:sequenceFlow id="SequenceFlow_0calilw" name="needs record linkage" sourceRef="ExclusiveGateway_07e71aa" targetRef="pseudonymizeResultSetWithRecordLinkage"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:exclusiveGateway id="Gateway_0h2eszv"> @@ -118,11 +116,13 @@ <bpmn:incoming>Flow_0b5n9vc</bpmn:incoming> <bpmn:outgoing>Flow_0gx8n5k</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_1rtrx8w" sourceRef="createPseudonyms" targetRef="selectResponseTargetMedic" /> - <bpmn:serviceTask id="createPseudonyms" name="create pseudonyms" camunda:class="org.highmed.dsf.bpe.service.CreatePseudonym"> + <bpmn:serviceTask id="Activity_0ekn4v9" name="store final results"> <bpmn:incoming>Flow_1ixeke2</bpmn:incoming> - <bpmn:outgoing>Flow_1rtrx8w</bpmn:outgoing> + <bpmn:outgoing>Flow_1qmx444</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1r6dq8y" sourceRef="checkComputedResults" targetRef="EndEventSuccess" /> + <bpmn:sequenceFlow id="Flow_1qmx444" sourceRef="Activity_0ekn4v9" targetRef="selectResponseTargetMedic" /> + <bpmn:sequenceFlow id="Flow_1k0sqwo" sourceRef="selectResponseTargetMedic" targetRef="checkComputedResults" /> </bpmn:process> <bpmn:message id="Message_0a1qxd8" name="resultSingleMedicDataSharingMessage" /> <bpmn:message id="Message_0ue93sz" name="resultMultiMedicDataSharingMessage" /> @@ -131,10 +131,6 @@ <bpmn:error id="Error_0qub4jc" name="errorMultiMedicDataSharingResult" errorCode="errorMultiMedicDataSharingResult" camunda:errorMessage="errorMultiMedicDataSharingResult" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="computeDataSharing"> - <bpmndi:BPMNEdge id="Flow_1rtrx8w_di" bpmnElement="Flow_1rtrx8w"> - <di:waypoint x="1710" y="242" /> - <di:waypoint x="1770" y="242" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0gx8n5k_di" bpmnElement="Flow_0gx8n5k"> <di:waypoint x="1260" y="242" /> <di:waypoint x="1315" y="242" /> @@ -151,22 +147,13 @@ <dc:Bounds x="1347" y="133" width="65" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1tmnvhl_di" bpmnElement="Flow_1tmnvhl"> - <di:waypoint x="2030" y="300" /> - <di:waypoint x="2030" y="350" /> - <di:waypoint x="2132" y="350" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1r6dq8y_di" bpmnElement="Flow_1r6dq8y"> - <di:waypoint x="2030" y="242" /> - <di:waypoint x="2132" y="242" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1k0sqwo_di" bpmnElement="Flow_1k0sqwo"> - <di:waypoint x="1870" y="242" /> - <di:waypoint x="1930" y="242" /> + <di:waypoint x="1880" y="242" /> + <di:waypoint x="1940" y="242" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1ixeke2_di" bpmnElement="Flow_1ixeke2"> <di:waypoint x="1545" y="242" /> - <di:waypoint x="1610" y="242" /> + <di:waypoint x="1620" y="242" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_02zmrer_di" bpmnElement="SequenceFlow_02zmrer"> <di:waypoint x="1520" y="166" /> @@ -196,6 +183,40 @@ <di:waypoint x="195" y="242" /> <di:waypoint x="279" y="242" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1r6dq8y_di" bpmnElement="Flow_1r6dq8y"> + <di:waypoint x="2040" y="242" /> + <di:waypoint x="2142" y="242" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1tmnvhl_di" bpmnElement="Flow_1tmnvhl"> + <di:waypoint x="2040" y="300" /> + <di:waypoint x="2040" y="350" /> + <di:waypoint x="2142" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1qmx444_di" bpmnElement="Flow_1qmx444"> + <di:waypoint x="1720" y="242" /> + <di:waypoint x="1780" y="242" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_0xh5o35_di" bpmnElement="EndEventSuccess"> + <dc:Bounds x="2142" y="224" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2118" y="267" width="85" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1hmug5i_di" bpmnElement="EndEventError"> + <dc:Bounds x="2142" y="332" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2124" y="375" width="73" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_13j8ce9_di" bpmnElement="checkComputedResults"> + <dc:Bounds x="1940" y="202" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0uk3eyz_di" bpmnElement="selectResponseTargetMedic"> + <dc:Bounds x="1780" y="202" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0tps18n_di" bpmnElement="Activity_0ekn4v9"> + <dc:Bounds x="1620" y="202" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_1gopxt4_di" bpmnElement="SubProcess_1gopxt4" isExpanded="true"> <dc:Bounds x="469" y="175" width="498" height="134" /> </bpmndi:BPMNShape> @@ -232,16 +253,10 @@ <dc:Bounds x="166" y="267" width="23" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0xh5o35_di" bpmnElement="EndEventSuccess"> - <dc:Bounds x="2132" y="224" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2108" y="267" width="85" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_07e71aa_di" bpmnElement="ExclusiveGateway_07e71aa" isMarkerVisible="true"> <dc:Bounds x="1315" y="217" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_093hq2s_di" bpmnElement="executeRecordLink"> + <bpmndi:BPMNShape id="ServiceTask_093hq2s_di" bpmnElement="pseudonymizeResultSetWithRecordLinkage"> <dc:Bounds x="1470" y="86" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1r8ow3i_di" bpmnElement="ExclusiveGateway_1r8ow3i" isMarkerVisible="true"> @@ -250,33 +265,18 @@ <bpmndi:BPMNShape id="ServiceTask_0bw310g_di" bpmnElement="storeCorrelationKeys"> <dc:Bounds x="279" y="202" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0uk3eyz_di" bpmnElement="selectResponseTargetMedic"> - <dc:Bounds x="1770" y="202" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_1hmug5i_di" bpmnElement="EndEventError"> - <dc:Bounds x="2132" y="332" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2114" y="375" width="73" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_13j8ce9_di" bpmnElement="checkComputedResults"> - <dc:Bounds x="1930" y="202" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0h2eszv_di" bpmnElement="Gateway_0h2eszv" isMarkerVisible="true"> <dc:Bounds x="1045" y="217" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1rzqqn0_di" bpmnElement="downloadResultSets"> <dc:Bounds x="1160" y="202" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0uhz7d7_di" bpmnElement="createPseudonyms"> - <dc:Bounds x="1610" y="202" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_155cxa9_di" bpmnElement="Event_1vp5qzs"> - <dc:Bounds x="2012" y="264" width="36" height="36" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BoundaryEvent_1g0rcyp_di" bpmnElement="TimerEnded"> <dc:Bounds x="949" y="291" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_155cxa9_di" bpmnElement="Event_1vp5qzs"> + <dc:Bounds x="2022" y="264" width="36" height="36" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index c6e3e4e1..57c5f513 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -2,7 +2,7 @@ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> <bpmn:process id="executeDataSharing" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResults"> - <bpmn:incoming>SequenceFlow_1ug2kru</bpmn:incoming> + <bpmn:incoming>Flow_0jepala</bpmn:incoming> <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="checkDataSharingRequest" name="check data sharing request" camunda:class="org.highmed.dsf.bpe.service.CheckDataSharingResources"> @@ -51,14 +51,13 @@ <bpmn:exclusiveGateway id="ExclusiveGateway_0lecmy5"> <bpmn:incoming>SequenceFlow_05r9whd</bpmn:incoming> <bpmn:incoming>SequenceFlow_0kzp6tl</bpmn:incoming> - <bpmn:outgoing>Flow_1t9f3m5</bpmn:outgoing> + <bpmn:outgoing>Flow_14nlfvk</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0kzp6tl" sourceRef="filterByConsent" targetRef="ExclusiveGateway_0lecmy5" /> - <bpmn:serviceTask id="generateBloomFilters" name="generate RBF's, replace ID with PSN, encrypt MDAT" camunda:class="org.highmed.dsf.bpe.service.ModifyResultSet"> - <bpmn:incoming>Flow_1t9f3m5</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ug2kru</bpmn:outgoing> + <bpmn:serviceTask id="generateBloomFilters" name="translate with RBF calculation" camunda:class="org.highmed.dsf.bpe.service.ModifyResultSetsWithRbf"> + <bpmn:incoming>Flow_0xt2bfn</bpmn:incoming> + <bpmn:outgoing>Flow_09yooed</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_1ug2kru" sourceRef="generateBloomFilters" targetRef="checkResults" /> <bpmn:sequenceFlow id="SequenceFlow_0ascyjc" sourceRef="selectResponseTargetTtp" targetRef="EndEvent" /> <bpmn:serviceTask id="selectResponseTargetTtp" name="select response target TTP" camunda:class="org.highmed.dsf.bpe.service.SelectResponseTargetTtp"> <bpmn:incoming>SequenceFlow_04ouilq</bpmn:incoming> @@ -79,24 +78,34 @@ <bpmn:incoming>Flow_1kp6eaq</bpmn:incoming> <bpmn:outgoing>Flow_1ecoehc</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_1t9f3m5" sourceRef="ExclusiveGateway_0lecmy5" targetRef="generateBloomFilters" /> + <bpmn:exclusiveGateway id="Gateway_118ojzy" name="needs record linkage"> + <bpmn:incoming>Flow_14nlfvk</bpmn:incoming> + <bpmn:outgoing>Flow_09dzkmp</bpmn:outgoing> + <bpmn:outgoing>Flow_0xt2bfn</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_14nlfvk" sourceRef="ExclusiveGateway_0lecmy5" targetRef="Gateway_118ojzy" /> + <bpmn:exclusiveGateway id="Gateway_13kxug8"> + <bpmn:incoming>Flow_09dzkmp</bpmn:incoming> + <bpmn:incoming>Flow_09yooed</bpmn:incoming> + <bpmn:outgoing>Flow_0jepala</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_09dzkmp" name="else" sourceRef="Gateway_118ojzy" targetRef="Gateway_13kxug8"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsRecordLinkage}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_0xt2bfn" sourceRef="Gateway_118ojzy" targetRef="generateBloomFilters"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsRecordLinkage}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_09yooed" sourceRef="generateBloomFilters" targetRef="Gateway_13kxug8" /> + <bpmn:sequenceFlow id="Flow_0jepala" sourceRef="Gateway_13kxug8" targetRef="checkResults" /> <bpmn:textAnnotation id="TextAnnotation_0euut3n"> <bpmn:text>uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc.</bpmn:text> </bpmn:textAnnotation> <bpmn:association id="Association_1ncewqu" sourceRef="checkDataSharingRequest" targetRef="TextAnnotation_0euut3n" /> - <bpmn:textAnnotation id="TextAnnotation_179m5lj"> - <bpmn:text>Should be split in 3 single tasks, with and without RBF generation</bpmn:text> - </bpmn:textAnnotation> - <bpmn:association id="Association_1yw2wcu" sourceRef="generateBloomFilters" targetRef="TextAnnotation_179m5lj" /> </bpmn:process> <bpmn:message id="Message_1yz2a31" name="executeDataSharingMessage" /> <bpmn:message id="Message_1dr71re" name="resultSingleMedicDataSharingMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="executeDataSharing"> - <bpmndi:BPMNEdge id="Flow_1t9f3m5_di" bpmnElement="Flow_1t9f3m5"> - <di:waypoint x="1242" y="212" /> - <di:waypoint x="1360" y="212" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1ecoehc_di" bpmnElement="Flow_1ecoehc"> <di:waypoint x="660" y="212" /> <di:waypoint x="710" y="212" /> @@ -109,14 +118,6 @@ <di:waypoint x="500" y="212" /> <di:waypoint x="560" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ascyjc_di" bpmnElement="SequenceFlow_0ascyjc"> - <di:waypoint x="1810" y="212" /> - <di:waypoint x="1892" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1ug2kru_di" bpmnElement="SequenceFlow_1ug2kru"> - <di:waypoint x="1460" y="212" /> - <di:waypoint x="1540" y="212" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kzp6tl_di" bpmnElement="SequenceFlow_0kzp6tl"> <di:waypoint x="1217" y="315" /> <di:waypoint x="1217" y="237" /> @@ -136,10 +137,6 @@ <dc:Bounds x="1088" y="195" width="21" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_04ouilq_di" bpmnElement="SequenceFlow_04ouilq"> - <di:waypoint x="1640" y="212" /> - <di:waypoint x="1710" y="212" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1etju4m_di" bpmnElement="SequenceFlow_1etju4m"> <di:waypoint x="340" y="212" /> <di:waypoint x="400" y="212" /> @@ -152,9 +149,38 @@ <di:waypoint x="980" y="212" /> <di:waypoint x="1032" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> - <dc:Bounds x="1540" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_14nlfvk_di" bpmnElement="Flow_14nlfvk"> + <di:waypoint x="1242" y="212" /> + <di:waypoint x="1305" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_09dzkmp_di" bpmnElement="Flow_09dzkmp"> + <di:waypoint x="1355" y="212" /> + <di:waypoint x="1465" y="212" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1361" y="195" width="21" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0xt2bfn_di" bpmnElement="Flow_0xt2bfn"> + <di:waypoint x="1330" y="187" /> + <di:waypoint x="1330" y="90" /> + <di:waypoint x="1440" y="90" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_09yooed_di" bpmnElement="Flow_09yooed"> + <di:waypoint x="1490" y="130" /> + <di:waypoint x="1490" y="187" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_04ouilq_di" bpmnElement="SequenceFlow_04ouilq"> + <di:waypoint x="1690" y="212" /> + <di:waypoint x="1760" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ascyjc_di" bpmnElement="SequenceFlow_0ascyjc"> + <di:waypoint x="1860" y="212" /> + <di:waypoint x="1942" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0jepala_di" bpmnElement="Flow_0jepala"> + <di:waypoint x="1515" y="212" /> + <di:waypoint x="1590" y="212" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkDataSharingRequest"> <dc:Bounds x="400" y="172" width="100" height="80" /> </bpmndi:BPMNShape> @@ -167,12 +193,6 @@ <bpmndi:BPMNShape id="ServiceTask_0b8j3ka_di" bpmnElement="downloadDataSharingResources"> <dc:Bounds x="240" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> - <dc:Bounds x="1892" y="194" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1866" y="237" width="90" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0bq7zdz_di" bpmnElement="ExclusiveGateway_0bq7zdz" isMarkerVisible="true"> <dc:Bounds x="1032" y="187" width="50" height="50" /> </bpmndi:BPMNShape> @@ -182,12 +202,6 @@ <bpmndi:BPMNShape id="ExclusiveGateway_0lecmy5_di" bpmnElement="ExclusiveGateway_0lecmy5" isMarkerVisible="true"> <dc:Bounds x="1192" y="187" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="generateBloomFilters"> - <dc:Bounds x="1360" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> - <dc:Bounds x="1710" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0u5pb4i_di" bpmnElement="executeQueries"> <dc:Bounds x="880" y="172" width="100" height="80" /> </bpmndi:BPMNShape> @@ -200,18 +214,34 @@ <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> <dc:Bounds x="330" y="80" width="267" height="56" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_179m5lj_di" bpmnElement="TextAnnotation_179m5lj"> - <dc:Bounds x="1450" y="88" width="150" height="48" /> + <bpmndi:BPMNShape id="Gateway_118ojzy_di" bpmnElement="Gateway_118ojzy" isMarkerVisible="true"> + <dc:Bounds x="1305" y="187" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1337" y="95" width="65" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_13kxug8_di" bpmnElement="Gateway_13kxug8" isMarkerVisible="true"> + <dc:Bounds x="1465" y="187" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="generateBloomFilters"> + <dc:Bounds x="1440" y="50" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> + <dc:Bounds x="1590" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> + <dc:Bounds x="1942" y="194" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1916" y="237" width="90" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> + <dc:Bounds x="1760" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> <di:waypoint x="455" y="172" /> <di:waypoint x="460" y="136" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Association_1yw2wcu_di" bpmnElement="Association_1yw2wcu"> - <di:waypoint x="1410" y="172" /> - <di:waypoint x="1410" y="112" /> - <di:waypoint x="1450" y="112" /> - </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> From 1e39c27be09331569bf594001ecd30b3aad49937 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 8 Mar 2021 13:09:28 +0100 Subject: [PATCH 023/125] fix wrong logger, remove unused import --- .../bpe/service/PseudonymizeResultSetsWithRecordLinkage.java | 3 ++- .../java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java | 2 +- .../org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java index e1064b74..cef36ae7 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java @@ -88,7 +88,8 @@ protected QueryResults createFinalResults(String researchStudyIdentifier, Secret List<QueryResult> finalResults = groupedResults.entrySet().stream().filter(r -> !r.getValue().isEmpty()) .map(e -> translateMatchAndPseudonymize(translatorFromMedic, matcher, psnGenerator, translatorToMedic, - e.getKey(), e.getValue())).collect(Collectors.toList()); + e.getKey(), e.getValue())) + .collect(Collectors.toList()); return new QueryResults(finalResults); } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java index 2d316ba0..029201b1 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -45,7 +45,7 @@ public class GenerateBloomFilters extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(ModifyResultSet.class); + private static final Logger logger = LoggerFactory.getLogger(GenerateBloomFilters.class); private static final int RBF_LENGTH = 3000; private static final FieldWeights FBF_WEIGHTS = new FieldWeights(0.1, 0.1, 0.1, 0.2, 0.05, 0.1, 0.05, 0.2, 0.1); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java index fed54051..1abc6a6a 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java @@ -22,7 +22,6 @@ import org.highmed.dsf.bpe.service.GenerateCountFromIds; import org.highmed.dsf.bpe.service.HandleErrorMultiMedicResults; import org.highmed.dsf.bpe.service.ModifyQueries; -import org.highmed.dsf.bpe.service.ModifyResultSet; import org.highmed.dsf.bpe.service.SelectRequestTargets; import org.highmed.dsf.bpe.service.SelectResponseTargetMedic; import org.highmed.dsf.bpe.service.SelectResponseTargetTtp; From 6ae734241c9e863cd74695f46b03d42ed2f340db Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 8 Mar 2021 15:17:14 +0100 Subject: [PATCH 024/125] store results after pseudonymization --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 3 + .../service/DownloadDataSharingResources.java | 7 +- ...ava => DownloadSingleMedicResultSets.java} | 6 +- .../bpe/service/ModifyResultSetsWithRbf.java | 73 +---------- .../service/SelectResponseTargetMedic.java | 6 +- .../dsf/bpe/service/StoreCorrelationKeys.java | 9 ++ .../service/StoreMultiMedicResultSets.java | 24 ++++ ...a => StoreReceivedSingleMedicResults.java} | 7 +- .../dsf/bpe/service/StoreResultSets.java | 115 ++++++++++++++++++ .../service/StoreSingleMedicResultSets.java | 24 ++++ .../bpe/spring/config/DataSharingConfig.java | 29 +++-- .../resources/bpe/computeDataSharing.bpmn | 20 +-- .../resources/bpe/executeDataSharing.bpmn | 110 +++++++++-------- 13 files changed, 288 insertions(+), 145 deletions(-) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{DownloadResultSets.java => DownloadSingleMedicResultSets.java} (93%) create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSets.java rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{StoreResults.java => StoreReceivedSingleMedicResults.java} (89%) create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSets.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index 3d08b552..ea50cef3 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -15,6 +15,9 @@ public interface ConstantsDataSharing String BPMN_EXECUTION_VARIABLE_QUERY_RESULTS = "queryResults"; String BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS = "finalQueryResults"; + // TODO: move into ConstantsBase from DSF implementation + String BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER = "leadingMedicIdentifier"; + String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestDataSharing/"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java index b70263ae..aa826bd3 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java @@ -3,6 +3,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; @@ -35,7 +36,6 @@ import org.highmed.dsf.fhir.variables.FhirResourceValues; import org.highmed.dsf.fhir.variables.FhirResourcesListValues; import org.highmed.fhir.client.FhirWebserviceClient; -import org.highmed.pseudonymization.crypto.AesGcmUtil; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.Group; @@ -175,6 +175,11 @@ private String getTtpIdentifier(ResearchStudy researchStudy) return ref.getIdentifier().getValue(); } + private String getLeadingMedicIdentifier(Task task) + { + return task.getRequester().getIdentifier().getValue(); + } + private boolean getNeedsConsentCheck(Task task) { return getTaskHelper() diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResultSets.java similarity index 93% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResultSets.java index b2816405..996bad46 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResultSets.java @@ -26,13 +26,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class DownloadResultSets extends AbstractServiceDelegate +public class DownloadSingleMedicResultSets extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(DownloadResultSets.class); + private static final Logger logger = LoggerFactory.getLogger(DownloadSingleMedicResultSets.class); private final ObjectMapper openEhrObjectMapper; - public DownloadResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public DownloadSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java index 7f510d65..e0803d62 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java @@ -1,9 +1,6 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; @@ -35,20 +32,11 @@ import org.highmed.pseudonymization.crypto.AesGcmUtil; import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtp; import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpImpl; -import org.hl7.fhir.r4.model.Binary; -import org.hl7.fhir.r4.model.IdType; -import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResearchStudy; -import org.hl7.fhir.r4.model.ResourceType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import ca.uhn.fhir.context.FhirContext; - public class ModifyResultSetsWithRbf extends AbstractServiceDelegate implements InitializingBean { private static final Logger logger = LoggerFactory.getLogger(ModifyResultSetsWithRbf.class); @@ -62,20 +50,17 @@ public class ModifyResultSetsWithRbf extends AbstractServiceDelegate implements private final OrganizationProvider organizationProvider; private final String ehrIdColumnPath; private final MasterPatientIndexClient masterPatientIndexClient; - private final ObjectMapper openEhrObjectMapper; private final BouncyCastleProvider bouncyCastleProvider; public ModifyResultSetsWithRbf(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, OrganizationProvider organizationProvider, String ehrIdColumnPath, - MasterPatientIndexClient masterPatientIndexClient, ObjectMapper openEhrObjectMapper, - BouncyCastleProvider bouncyCastleProvider) + MasterPatientIndexClient masterPatientIndexClient, BouncyCastleProvider bouncyCastleProvider) { super(clientProvider, taskHelper); this.organizationProvider = organizationProvider; this.ehrIdColumnPath = ehrIdColumnPath; this.masterPatientIndexClient = masterPatientIndexClient; - this.openEhrObjectMapper = openEhrObjectMapper; this.bouncyCastleProvider = bouncyCastleProvider; } @@ -87,7 +72,6 @@ public void afterPropertiesSet() throws Exception Objects.requireNonNull(organizationProvider, "organizationProvider"); Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath"); Objects.requireNonNull(masterPatientIndexClient, "masterPatientIndexClient"); - Objects.requireNonNull(openEhrObjectMapper, "openEhrObjectMapper"); Objects.requireNonNull(bouncyCastleProvider, "bouncyCastleProvider"); } @@ -95,7 +79,7 @@ public void afterPropertiesSet() throws Exception protected void doExecute(DelegateExecution execution) throws Exception { String organizationIdentifier = organizationProvider.getLocalIdentifierValue(); - String researchStudyIdentifier = getResearchStudyIdentifier(execution); + String researchStudyIdentifier = getResearchStudyIdentifier(execution); SecretKey mdatKey = (SecretKey) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); @@ -104,10 +88,8 @@ protected void doExecute(DelegateExecution execution) throws Exception researchStudyIdentifier, mdatKey, bloomFilterConfig); QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - String ttpIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); List<QueryResult> translatedResults = results.getResults().stream() - .map(result -> translateAndCreateBinary(resultSetTranslator, result, ttpIdentifier)) - .collect(Collectors.toList()); + .map(result -> translateAndCreateBinary(resultSetTranslator, result)).collect(Collectors.toList()); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(translatedResults))); @@ -146,13 +128,10 @@ protected RecordBloomFilterGenerator createRecordBloomFilterGenerator(long permu bouncyCastleProvider)); } - private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtp resultSetTranslator, QueryResult result, - String ttpIdentifier) + private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtp resultSetTranslator, QueryResult result) { ResultSet translatedResultSet = translate(resultSetTranslator, result.getResultSet()); - String resultSetUrl = saveResultSetAsBinaryForTtp(translatedResultSet, ttpIdentifier); - - return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), resultSetUrl); + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), translatedResultSet); } private ResultSet translate(ResultSetTranslatorToTtp resultSetTranslator, ResultSet resultSet) @@ -167,46 +146,4 @@ private ResultSet translate(ResultSetTranslatorToTtp resultSetTranslator, Result throw e; } } - - protected String saveResultSetAsBinaryForTtp(ResultSet resultSet, String securityIdentifier) - { - byte[] content = serializeResultSet(resultSet); - Reference securityContext = new Reference(); - securityContext.setType(ResourceType.Organization.name()).getIdentifier() - .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(securityIdentifier); - Binary binary = new Binary().setContentType(OPENEHR_MIMETYPE_JSON).setSecurityContext(securityContext) - .setData(content); - - IdType created = createBinaryResource(binary); - return new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl(), ResourceType.Binary.name(), - created.getIdPart(), created.getVersionIdPart()).getValue(); - } - - private byte[] serializeResultSet(ResultSet resultSet) - { - try - { - return openEhrObjectMapper.writeValueAsBytes(resultSet); - } - catch (JsonProcessingException e) - { - logger.warn("Error while serializing ResultSet: " + e.getMessage(), e); - throw new RuntimeException(e); - } - } - - private IdType createBinaryResource(Binary binary) - { - try - { - return getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().create(binary); - } - catch (Exception e) - { - logger.debug("Binary to create {}", FhirContext.forR4().newJsonParser().encodeResourceToString(binary)); - logger.warn("Error while creating Binary resoruce: " + e.getMessage(), e); - throw e; - } - } - } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java index c5dec8bf..b8f2295d 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java @@ -1,6 +1,7 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; @@ -25,9 +26,8 @@ public SelectResponseTargetMedic(FhirWebserviceClientProvider clientProvider, Ta @Override protected void doExecute(DelegateExecution execution) { - Task task = getLeadingTaskFromExecutionVariables(); - - Target medicTarget = Target.createUniDirectionalTarget(task.getRequester().getIdentifier().getValue()); + String medicIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER); + Target medicTarget = Target.createUniDirectionalTarget(medicIdentifier); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(medicTarget)); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java index 40c910ee..37adf98b 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java @@ -1,6 +1,7 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; @@ -33,6 +34,9 @@ protected void doExecute(DelegateExecution execution) { Task task = getCurrentTaskFromExecutionVariables(); + String leadingMedicIdentifier = getLeadingMedicIdentifier(task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER, leadingMedicIdentifier); + List<Target> targets = getTaskHelper() .getInputParameterStringValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY) @@ -45,6 +49,11 @@ protected void doExecute(DelegateExecution execution) execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(null))); } + private String getLeadingMedicIdentifier(Task task) + { + return task.getRequester().getIdentifier().getValue(); + } + private boolean getNeedsRecordLinkageCheck(Task task) { return getTaskHelper() diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSets.java new file mode 100644 index 00000000..33f67dde --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSets.java @@ -0,0 +1,24 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class StoreMultiMedicResultSets extends StoreResultSets +{ + public StoreMultiMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ObjectMapper openEhrObjectMapper) + { + super(clientProvider, taskHelper, openEhrObjectMapper); + } + + @Override + protected String getSecurityIdentifier(DelegateExecution execution) + { + return (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreReceivedSingleMedicResults.java similarity index 89% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreReceivedSingleMedicResults.java index 63b72c6b..1b5c6f14 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreReceivedSingleMedicResults.java @@ -1,6 +1,5 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_GROUP_ID; @@ -22,12 +21,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class StoreResults extends AbstractServiceDelegate +public class StoreReceivedSingleMedicResults extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(StoreResults.class); + private static final Logger logger = LoggerFactory.getLogger(StoreReceivedSingleMedicResults.class); - public StoreResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + public StoreReceivedSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) { super(clientProvider, taskHelper); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java new file mode 100644 index 00000000..d43a451e --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java @@ -0,0 +1,115 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.openehr.model.structure.ResultSet; +import org.hl7.fhir.r4.model.Binary; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResourceType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +import ca.uhn.fhir.context.FhirContext; + +public abstract class StoreResultSets extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(StoreResultSets.class); + + private final ObjectMapper openEhrObjectMapper; + + public StoreResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ObjectMapper openEhrObjectMapper) + { + super(clientProvider, taskHelper); + this.openEhrObjectMapper = openEhrObjectMapper; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + Objects.requireNonNull(openEhrObjectMapper, "openEhrObjectMapper"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + String securityIdentifier = getSecurityIdentifier(execution); + + List<QueryResult> storedResults = results.getResults().stream() + .map(result -> saveResultSetAsBinary(result, securityIdentifier)).collect(Collectors.toList()); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(storedResults))); + } + + protected abstract String getSecurityIdentifier(DelegateExecution execution); + + protected QueryResult saveResultSetAsBinary(QueryResult result, String securityIdentifier) + { + String binaryId = save(result.getResultSet(), securityIdentifier); + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), binaryId); + } + + protected String save(ResultSet resultSet, String securityIdentifier) + { + byte[] content = serializeResultSet(resultSet); + Reference securityContext = new Reference(); + securityContext.setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(securityIdentifier); + Binary binary = new Binary().setContentType(OPENEHR_MIMETYPE_JSON).setSecurityContext(securityContext) + .setData(content); + + IdType created = createBinaryResource(binary); + return new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl(), ResourceType.Binary.name(), + created.getIdPart(), created.getVersionIdPart()).getValue(); + } + + private byte[] serializeResultSet(ResultSet resultSet) + { + try + { + return openEhrObjectMapper.writeValueAsBytes(resultSet); + } + catch (JsonProcessingException e) + { + logger.warn("Error while serializing ResultSet: " + e.getMessage(), e); + throw new RuntimeException(e); + } + } + + private IdType createBinaryResource(Binary binary) + { + try + { + return getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().create(binary); + } + catch (Exception e) + { + logger.debug("Binary to create {}", FhirContext.forR4().newJsonParser().encodeResourceToString(binary)); + logger.warn("Error while creating Binary resoruce: " + e.getMessage(), e); + throw e; + } + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSets.java new file mode 100644 index 00000000..50b7a422 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSets.java @@ -0,0 +1,24 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class StoreSingleMedicResultSets extends StoreResultSets +{ + public StoreSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ObjectMapper openEhrObjectMapper) + { + super(clientProvider, taskHelper, openEhrObjectMapper); + } + + @Override + protected String getSecurityIdentifier(DelegateExecution execution) + { + return (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index 3d4b667c..a6d478e5 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -12,7 +12,7 @@ import org.highmed.dsf.bpe.service.CheckTtpComputedMultiMedicResults; import org.highmed.dsf.bpe.service.DownloadDataSharingResources; import org.highmed.dsf.bpe.service.DownloadResearchStudyResource; -import org.highmed.dsf.bpe.service.DownloadResultSets; +import org.highmed.dsf.bpe.service.DownloadSingleMedicResultSets; import org.highmed.dsf.bpe.service.ExecuteQueries; import org.highmed.dsf.bpe.service.ExtractQueries; import org.highmed.dsf.bpe.service.FilterQueryResultsByConsent; @@ -24,7 +24,10 @@ import org.highmed.dsf.bpe.service.SelectResponseTargetMedic; import org.highmed.dsf.bpe.service.SelectResponseTargetTtp; import org.highmed.dsf.bpe.service.StoreCorrelationKeys; -import org.highmed.dsf.bpe.service.StoreResults; +import org.highmed.dsf.bpe.service.StoreMultiMedicResultSets; +import org.highmed.dsf.bpe.service.StoreReceivedSingleMedicResults; +import org.highmed.dsf.bpe.service.StoreResultSets; +import org.highmed.dsf.bpe.service.StoreSingleMedicResultSets; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.group.GroupHelper; import org.highmed.dsf.fhir.organization.OrganizationProvider; @@ -118,15 +121,15 @@ public StoreCorrelationKeys storeCorrelationKeys() } @Bean - public StoreResults storeResults() + public StoreReceivedSingleMedicResults storeReceivedSingleMedicResults() { - return new StoreResults(fhirClientProvider, taskHelper); + return new StoreReceivedSingleMedicResults(fhirClientProvider, taskHelper); } @Bean - public DownloadResultSets downloadResultSets() + public DownloadSingleMedicResultSets downloadSingleMedicResultSets() { - return new DownloadResultSets(fhirClientProvider, taskHelper, objectMapper); + return new DownloadSingleMedicResultSets(fhirClientProvider, taskHelper, objectMapper); } @Bean @@ -215,7 +218,7 @@ public FilterQueryResultsByConsent filterQueryResultsByConsent() public ModifyResultSetsWithRbf modifyResultSetsWithRbf() { return new ModifyResultSetsWithRbf(fhirClientProvider, taskHelper, organizationProvider, ehrIdColumnPath, - masterPatientIndexClient(), objectMapper, bouncyCastleProvider()); + masterPatientIndexClient(), bouncyCastleProvider()); } @Bean @@ -230,6 +233,18 @@ public BouncyCastleProvider bouncyCastleProvider() return new BouncyCastleProvider(); } + @Bean + public StoreSingleMedicResultSets storeSingleMedicResultSets() + { + return new StoreSingleMedicResultSets(fhirClientProvider, taskHelper, objectMapper); + } + + @Bean + public StoreMultiMedicResultSets storeMultiMedicResultSets() + { + return new StoreMultiMedicResultSets(fhirClientProvider, taskHelper, objectMapper); + } + @Bean public CheckSingleMedicResults checkSingleMedicResults() { diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn index d7b3448e..9ef3d0e3 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn @@ -8,7 +8,7 @@ <bpmn:endEvent id="SubEndEvent"> <bpmn:incoming>SequenceFlow_0mj024w</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="temporarillyStoreQueryResults" name="temporarilly store query results" camunda:class="org.highmed.dsf.bpe.service.StoreResults"> + <bpmn:serviceTask id="temporarillyStoreQueryResults" name="temporarilly store single MeDIC results" camunda:class="org.highmed.dsf.bpe.service.StoreReceivedSingleMedicResults"> <bpmn:incoming>SequenceFlow_0by0at7</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mj024w</bpmn:outgoing> </bpmn:serviceTask> @@ -62,7 +62,7 @@ <bpmn:sequenceFlow id="SequenceFlow_0t4lx4v" name="else" sourceRef="ExclusiveGateway_07e71aa" targetRef="ExclusiveGateway_1r8ow3i"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:serviceTask id="pseudonymizeResultSetWithRecordLinkage" name="pseudonymize result sets with record linkage" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithRecordLinkage"> + <bpmn:serviceTask id="pseudonymizeResultSetWithRecordLinkage" name="pseudonymize result sets with record linkage" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeResultSetWithRecordLinkage"> <bpmn:incoming>SequenceFlow_0calilw</bpmn:incoming> <bpmn:outgoing>SequenceFlow_02zmrer</bpmn:outgoing> </bpmn:serviceTask> @@ -96,7 +96,7 @@ <bpmn:incoming>Flow_1k0sqwo</bpmn:incoming> <bpmn:outgoing>Flow_1r6dq8y</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_1ixeke2" sourceRef="ExclusiveGateway_1r8ow3i" targetRef="Activity_0ekn4v9" /> + <bpmn:sequenceFlow id="Flow_1ixeke2" sourceRef="ExclusiveGateway_1r8ow3i" targetRef="storeFinalResultSets" /> <bpmn:boundaryEvent id="Event_1vp5qzs" attachedToRef="checkComputedResults"> <bpmn:outgoing>Flow_1tmnvhl</bpmn:outgoing> <bpmn:errorEventDefinition id="ErrorEventDefinition_05kx06m" errorRef="Error_0qub4jc" /> @@ -110,18 +110,18 @@ <bpmn:incoming>SequenceFlow_0h3to47</bpmn:incoming> <bpmn:outgoing>Flow_0b5n9vc</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="Flow_0b5n9vc" sourceRef="Gateway_0h2eszv" targetRef="downloadResultSets" /> - <bpmn:sequenceFlow id="Flow_0gx8n5k" sourceRef="downloadResultSets" targetRef="ExclusiveGateway_07e71aa" /> - <bpmn:serviceTask id="downloadResultSets" name="download result sets" camunda:class="org.highmed.dsf.bpe.service.DownloadResultSets"> + <bpmn:sequenceFlow id="Flow_0b5n9vc" sourceRef="Gateway_0h2eszv" targetRef="downloadSingleMedicResultSets" /> + <bpmn:sequenceFlow id="Flow_0gx8n5k" sourceRef="downloadSingleMedicResultSets" targetRef="ExclusiveGateway_07e71aa" /> + <bpmn:serviceTask id="downloadSingleMedicResultSets" name="download single MeDIC result sets" camunda:class="org.highmed.dsf.bpe.service.DownloadSingleMedicResultSets"> <bpmn:incoming>Flow_0b5n9vc</bpmn:incoming> <bpmn:outgoing>Flow_0gx8n5k</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="Activity_0ekn4v9" name="store final results"> + <bpmn:serviceTask id="storeFinalResultSets" name="store multi MeDIC result sets" camunda:class="org.highmed.dsf.bpe.service.StoreMultiMedicResultSets"> <bpmn:incoming>Flow_1ixeke2</bpmn:incoming> <bpmn:outgoing>Flow_1qmx444</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1r6dq8y" sourceRef="checkComputedResults" targetRef="EndEventSuccess" /> - <bpmn:sequenceFlow id="Flow_1qmx444" sourceRef="Activity_0ekn4v9" targetRef="selectResponseTargetMedic" /> + <bpmn:sequenceFlow id="Flow_1qmx444" sourceRef="storeFinalResultSets" targetRef="selectResponseTargetMedic" /> <bpmn:sequenceFlow id="Flow_1k0sqwo" sourceRef="selectResponseTargetMedic" targetRef="checkComputedResults" /> </bpmn:process> <bpmn:message id="Message_0a1qxd8" name="resultSingleMedicDataSharingMessage" /> @@ -214,7 +214,7 @@ <bpmndi:BPMNShape id="ServiceTask_0uk3eyz_di" bpmnElement="selectResponseTargetMedic"> <dc:Bounds x="1780" y="202" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0tps18n_di" bpmnElement="Activity_0ekn4v9"> + <bpmndi:BPMNShape id="Activity_0tps18n_di" bpmnElement="storeFinalResultSets"> <dc:Bounds x="1620" y="202" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_1gopxt4_di" bpmnElement="SubProcess_1gopxt4" isExpanded="true"> @@ -268,7 +268,7 @@ <bpmndi:BPMNShape id="Gateway_0h2eszv_di" bpmnElement="Gateway_0h2eszv" isMarkerVisible="true"> <dc:Bounds x="1045" y="217" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1rzqqn0_di" bpmnElement="downloadResultSets"> + <bpmndi:BPMNShape id="Activity_1rzqqn0_di" bpmnElement="downloadSingleMedicResultSets"> <dc:Bounds x="1160" y="202" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BoundaryEvent_1g0rcyp_di" bpmnElement="TimerEnded"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index 57c5f513..7de5e6c8 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -2,7 +2,7 @@ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> <bpmn:process id="executeDataSharing" isExecutable="true" camunda:versionTag="0.5.0"> <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResults"> - <bpmn:incoming>Flow_0jepala</bpmn:incoming> + <bpmn:incoming>Flow_12yiiun</bpmn:incoming> <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="checkDataSharingRequest" name="check data sharing request" camunda:class="org.highmed.dsf.bpe.service.CheckDataSharingResources"> @@ -96,7 +96,12 @@ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_09yooed" sourceRef="generateBloomFilters" targetRef="Gateway_13kxug8" /> - <bpmn:sequenceFlow id="Flow_0jepala" sourceRef="Gateway_13kxug8" targetRef="checkResults" /> + <bpmn:sequenceFlow id="Flow_0jepala" sourceRef="Gateway_13kxug8" targetRef="Activity_0wzh75y" /> + <bpmn:sequenceFlow id="Flow_12yiiun" sourceRef="Activity_0wzh75y" targetRef="checkResults" /> + <bpmn:serviceTask id="Activity_0wzh75y" name="store single MeDIC result sets" camunda:class="org.highmed.dsf.bpe.service.StoreSingleMedicResultSets"> + <bpmn:incoming>Flow_0jepala</bpmn:incoming> + <bpmn:outgoing>Flow_12yiiun</bpmn:outgoing> + </bpmn:serviceTask> <bpmn:textAnnotation id="TextAnnotation_0euut3n"> <bpmn:text>uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc.</bpmn:text> </bpmn:textAnnotation> @@ -106,6 +111,34 @@ <bpmn:message id="Message_1dr71re" name="resultSingleMedicDataSharingMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="executeDataSharing"> + <bpmndi:BPMNEdge id="Flow_12yiiun_di" bpmnElement="Flow_12yiiun"> + <di:waypoint x="1690" y="212" /> + <di:waypoint x="1770" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0jepala_di" bpmnElement="Flow_0jepala"> + <di:waypoint x="1515" y="212" /> + <di:waypoint x="1590" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_09yooed_di" bpmnElement="Flow_09yooed"> + <di:waypoint x="1490" y="130" /> + <di:waypoint x="1490" y="187" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0xt2bfn_di" bpmnElement="Flow_0xt2bfn"> + <di:waypoint x="1330" y="187" /> + <di:waypoint x="1330" y="90" /> + <di:waypoint x="1440" y="90" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_09dzkmp_di" bpmnElement="Flow_09dzkmp"> + <di:waypoint x="1355" y="212" /> + <di:waypoint x="1465" y="212" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1361" y="195" width="21" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_14nlfvk_di" bpmnElement="Flow_14nlfvk"> + <di:waypoint x="1242" y="212" /> + <di:waypoint x="1305" y="212" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1ecoehc_di" bpmnElement="Flow_1ecoehc"> <di:waypoint x="660" y="212" /> <di:waypoint x="710" y="212" /> @@ -118,6 +151,10 @@ <di:waypoint x="500" y="212" /> <di:waypoint x="560" y="212" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ascyjc_di" bpmnElement="SequenceFlow_0ascyjc"> + <di:waypoint x="2040" y="212" /> + <di:waypoint x="2122" y="212" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kzp6tl_di" bpmnElement="SequenceFlow_0kzp6tl"> <di:waypoint x="1217" y="315" /> <di:waypoint x="1217" y="237" /> @@ -137,6 +174,10 @@ <dc:Bounds x="1088" y="195" width="21" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_04ouilq_di" bpmnElement="SequenceFlow_04ouilq"> + <di:waypoint x="1870" y="212" /> + <di:waypoint x="1940" y="212" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1etju4m_di" bpmnElement="SequenceFlow_1etju4m"> <di:waypoint x="340" y="212" /> <di:waypoint x="400" y="212" /> @@ -149,38 +190,9 @@ <di:waypoint x="980" y="212" /> <di:waypoint x="1032" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_14nlfvk_di" bpmnElement="Flow_14nlfvk"> - <di:waypoint x="1242" y="212" /> - <di:waypoint x="1305" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_09dzkmp_di" bpmnElement="Flow_09dzkmp"> - <di:waypoint x="1355" y="212" /> - <di:waypoint x="1465" y="212" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1361" y="195" width="21" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0xt2bfn_di" bpmnElement="Flow_0xt2bfn"> - <di:waypoint x="1330" y="187" /> - <di:waypoint x="1330" y="90" /> - <di:waypoint x="1440" y="90" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_09yooed_di" bpmnElement="Flow_09yooed"> - <di:waypoint x="1490" y="130" /> - <di:waypoint x="1490" y="187" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_04ouilq_di" bpmnElement="SequenceFlow_04ouilq"> - <di:waypoint x="1690" y="212" /> - <di:waypoint x="1760" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ascyjc_di" bpmnElement="SequenceFlow_0ascyjc"> - <di:waypoint x="1860" y="212" /> - <di:waypoint x="1942" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0jepala_di" bpmnElement="Flow_0jepala"> - <di:waypoint x="1515" y="212" /> - <di:waypoint x="1590" y="212" /> - </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> + <dc:Bounds x="1770" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkDataSharingRequest"> <dc:Bounds x="400" y="172" width="100" height="80" /> </bpmndi:BPMNShape> @@ -193,6 +205,12 @@ <bpmndi:BPMNShape id="ServiceTask_0b8j3ka_di" bpmnElement="downloadDataSharingResources"> <dc:Bounds x="240" y="172" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> + <dc:Bounds x="2122" y="194" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2096" y="237" width="90" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0bq7zdz_di" bpmnElement="ExclusiveGateway_0bq7zdz" isMarkerVisible="true"> <dc:Bounds x="1032" y="187" width="50" height="50" /> </bpmndi:BPMNShape> @@ -202,6 +220,12 @@ <bpmndi:BPMNShape id="ExclusiveGateway_0lecmy5_di" bpmnElement="ExclusiveGateway_0lecmy5" isMarkerVisible="true"> <dc:Bounds x="1192" y="187" width="50" height="50" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="generateBloomFilters"> + <dc:Bounds x="1440" y="50" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> + <dc:Bounds x="1940" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0u5pb4i_di" bpmnElement="executeQueries"> <dc:Bounds x="880" y="172" width="100" height="80" /> </bpmndi:BPMNShape> @@ -211,9 +235,6 @@ <bpmndi:BPMNShape id="Activity_1vlv5ud_di" bpmnElement="extractQueries"> <dc:Bounds x="560" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> - <dc:Bounds x="330" y="80" width="267" height="56" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_118ojzy_di" bpmnElement="Gateway_118ojzy" isMarkerVisible="true"> <dc:Bounds x="1305" y="187" width="50" height="50" /> <bpmndi:BPMNLabel> @@ -223,20 +244,11 @@ <bpmndi:BPMNShape id="Gateway_13kxug8_di" bpmnElement="Gateway_13kxug8" isMarkerVisible="true"> <dc:Bounds x="1465" y="187" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="generateBloomFilters"> - <dc:Bounds x="1440" y="50" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> + <bpmndi:BPMNShape id="Activity_1mdgvqk_di" bpmnElement="Activity_0wzh75y"> <dc:Bounds x="1590" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> - <dc:Bounds x="1942" y="194" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1916" y="237" width="90" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> - <dc:Bounds x="1760" y="172" width="100" height="80" /> + <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> + <dc:Bounds x="330" y="80" width="267" height="56" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> <di:waypoint x="455" y="172" /> From 0681182eb1baf9724fbc2c3051b05822ecebfdbc Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 8 Mar 2021 15:26:24 +0100 Subject: [PATCH 025/125] formatting and todos --- .../org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java | 2 +- .../bpe/service/PseudonymizeResultSetsWithRecordLinkage.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java index e0803d62..624602ac 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java @@ -79,7 +79,7 @@ public void afterPropertiesSet() throws Exception protected void doExecute(DelegateExecution execution) throws Exception { String organizationIdentifier = organizationProvider.getLocalIdentifierValue(); - String researchStudyIdentifier = getResearchStudyIdentifier(execution); + String researchStudyIdentifier = getResearchStudyIdentifier(execution); SecretKey mdatKey = (SecretKey) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java index cef36ae7..de85a52a 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java @@ -63,7 +63,10 @@ protected void doExecute(DelegateExecution execution) throws Exception { QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - String researchStudyIdentifier = ""; + // TODO: load ResearchStudy Id from Task + String researchStudyIdentifier = "test-id"; + + // TODO: store key with research study id SecretKey researchStudyKey = AesGcmUtil.generateAES256Key(); Map<String, List<QueryResult>> byCohortId = groupByCohortId(results); From 6c347ace8876832106a00d29e4dda3ee6cac92c2 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 9 Mar 2021 12:07:19 +0100 Subject: [PATCH 026/125] send research study id to ttp --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 2 + .../dsf/bpe/message/SendTtpRequest.java | 43 ++++++++++++++++--- ...eudonymizeResultSetsWithRecordLinkage.java | 8 ++-- .../dsf/bpe/service/StoreCorrelationKeys.java | 35 ++++++++++++--- .../fhir/CodeSystem/highmed-data-sharing.xml | 8 +++- .../highmed-task-compute-data-sharing.xml | 41 ++++++++++++++++++ 6 files changed, 118 insertions(+), 19 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index ea50cef3..6ad0328a 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -6,6 +6,7 @@ public interface ConstantsDataSharing { String BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY = "researchStudy"; + String BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER = "researchStudyIdentifier"; String BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK = "needsConsentCheck"; String BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE = "needsRecordLinkage"; String BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG = "bloomFilterConfig"; @@ -26,6 +27,7 @@ public interface ConstantsDataSharing String CODESYSTEM_HIGHMED_DATA_SHARING = "http://highmed.org/fhir/CodeSystem/data-sharing"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE = "research-study-reference"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_IDENTIFIER = "research-study-identifier"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE = "needs-record-linkage"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK = "needs-consent-check"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG = "bloom-filter-configuration"; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java index 6eda01e6..bd5fd0eb 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java @@ -2,9 +2,12 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; import java.util.stream.Stream; @@ -14,6 +17,9 @@ import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Targets; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResearchStudy; import org.hl7.fhir.r4.model.Task; import ca.uhn.fhir.context.FhirContext; @@ -30,16 +36,39 @@ public SendTtpRequest(FhirWebserviceClientProvider clientProvider, TaskHelper ta protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { Targets multiInstanceTargets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); - - Stream<Task.ParameterComponent> inputTargets = multiInstanceTargets.getEntries().stream() - .map(target -> getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY, - target.getCorrelationKey())); + Stream<Task.ParameterComponent> inputTargets = getTargetComponents(multiInstanceTargets); boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); - Task.ParameterComponent inputNeedsRecordLinkage = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + Task.ParameterComponent inputNeedsRecordLinkage = getRecordLinkageComponent(needsRecordLinkage); + + ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); + Task.ParameterComponent inputResearchStudy = getInputResearchStudyIdentifierComponent(researchStudy); + + return Stream.concat(inputTargets, Stream.of(inputNeedsRecordLinkage, inputResearchStudy)); + } + + private Stream<Task.ParameterComponent> getTargetComponents(Targets targets) + { + return targets.getEntries().stream().map(target -> getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY, target.getCorrelationKey())); + } + + private Task.ParameterComponent getRecordLinkageComponent(boolean needsRecordLinkage) + { + return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + } + + private Task.ParameterComponent getInputResearchStudyIdentifierComponent(ResearchStudy researchStudy) + { + Identifier identifier = researchStudy.getIdentifier().stream() + .filter(i -> i.getSystem().equals(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)).findFirst() + .orElseThrow(() -> new IllegalArgumentException("Identifier is not set in research study with id='" + + researchStudy.getId() + "', this error should have been caught by resource validation")); + + Reference reference = new Reference().setIdentifier(identifier); - return Stream.concat(inputTargets, Stream.of(inputNeedsRecordLinkage)); + return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_IDENTIFIER, reference); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java index de85a52a..b4c87622 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java @@ -1,6 +1,7 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER; import java.security.NoSuchAlgorithmException; import java.util.List; @@ -62,11 +63,10 @@ public void afterPropertiesSet() throws Exception protected void doExecute(DelegateExecution execution) throws Exception { QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + String researchStudyIdentifier = (String) execution + .getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER); - // TODO: load ResearchStudy Id from Task - String researchStudyIdentifier = "test-id"; - - // TODO: store key with research study id + // TODO: store key with corresponding research study id SecretKey researchStudyKey = AesGcmUtil.generateAES256Key(); Map<String, List<QueryResult>> byCohortId = groupByCohortId(results); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java index 37adf98b..b6ee815e 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java @@ -4,9 +4,11 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_IDENTIFIER; import java.util.List; import java.util.stream.Collectors; @@ -37,15 +39,15 @@ protected void doExecute(DelegateExecution execution) String leadingMedicIdentifier = getLeadingMedicIdentifier(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER, leadingMedicIdentifier); - List<Target> targets = getTaskHelper() - .getInputParameterStringValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY) - .map(correlationKey -> Target.createBiDirectionalTarget("", correlationKey)) - .collect(Collectors.toList()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(new Targets(targets))); + Targets targets = getTargets(task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(targets)); boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + + String researchStudyIdentifier = getResearchStudyIdentifier(task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER, researchStudyIdentifier); + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(null))); } @@ -54,6 +56,27 @@ private String getLeadingMedicIdentifier(Task task) return task.getRequester().getIdentifier().getValue(); } + private String getResearchStudyIdentifier(Task task) + { + return getTaskHelper() + .getFirstInputParameterReferenceValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_IDENTIFIER) + .orElseThrow(() -> new IllegalArgumentException("Research study identifier is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation")) + .getIdentifier().getValue(); + } + + private Targets getTargets(Task task) + { + List<Target> targets = getTaskHelper() + .getInputParameterStringValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY) + .map(correlationKey -> Target.createBiDirectionalTarget("", correlationKey)) + .collect(Collectors.toList()); + + return new Targets(targets); + } + private boolean getNeedsRecordLinkageCheck(Task task) { return getTaskHelper() diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml index 489b50f5..b043acc4 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml @@ -23,8 +23,12 @@ <concept> <code value="research-study-reference"/> <display value="Research Study Reference"/> - <definition - value="HiGHmed Research Study Reference to define what data is requested from which MeDICs and for what purpose"/> + <definition value="Research study resource reference"/> + </concept> + <concept> + <code value="research-study-identifier"/> + <display value="Research Study Identifier"/> + <definition value="Research study resource unique identifier"/> </concept> <concept> <code value="needs-record-linkage"/> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml index 8843f8be..27a892c2 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml @@ -138,5 +138,46 @@ <code value="boolean" /> </type> </element> + + <element id="Task.input:research-study-identifier"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="research-study-identifier" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:research-study-identifier.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:research-study-identifier.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:research-study-identifier.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:research-study-identifier.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="research-study-identifier" /> + </element> + <element id="Task.input:research-study-identifier.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="reference" /> + </type> + </element> </differential> </StructureDefinition> \ No newline at end of file From dab3f23ef641e28e5cb198bb9859600422cdec31 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 9 Mar 2021 12:08:44 +0100 Subject: [PATCH 027/125] rename class to be more precise --- ...ultSetsWithRbf.java => TranslateResultSetsWithRbf.java} | 6 +++--- .../highmed/dsf/bpe/spring/config/DataSharingConfig.java | 7 +++---- .../src/main/resources/bpe/executeDataSharing.bpmn | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{ModifyResultSetsWithRbf.java => TranslateResultSetsWithRbf.java} (95%) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateResultSetsWithRbf.java similarity index 95% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateResultSetsWithRbf.java index 624602ac..396194bf 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyResultSetsWithRbf.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateResultSetsWithRbf.java @@ -37,9 +37,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; -public class ModifyResultSetsWithRbf extends AbstractServiceDelegate implements InitializingBean +public class TranslateResultSetsWithRbf extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(ModifyResultSetsWithRbf.class); + private static final Logger logger = LoggerFactory.getLogger(TranslateResultSetsWithRbf.class); private static final int RBF_LENGTH = 3000; private static final RecordBloomFilterGeneratorImpl.FieldWeights FBF_WEIGHTS = new RecordBloomFilterGeneratorImpl.FieldWeights( @@ -52,7 +52,7 @@ public class ModifyResultSetsWithRbf extends AbstractServiceDelegate implements private final MasterPatientIndexClient masterPatientIndexClient; private final BouncyCastleProvider bouncyCastleProvider; - public ModifyResultSetsWithRbf(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public TranslateResultSetsWithRbf(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, OrganizationProvider organizationProvider, String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, BouncyCastleProvider bouncyCastleProvider) { diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index a6d478e5..d932a8ba 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -18,7 +18,7 @@ import org.highmed.dsf.bpe.service.FilterQueryResultsByConsent; import org.highmed.dsf.bpe.service.HandleErrorMultiMedicResults; import org.highmed.dsf.bpe.service.ModifyQueries; -import org.highmed.dsf.bpe.service.ModifyResultSetsWithRbf; +import org.highmed.dsf.bpe.service.TranslateResultSetsWithRbf; import org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithRecordLinkage; import org.highmed.dsf.bpe.service.SelectRequestTargets; import org.highmed.dsf.bpe.service.SelectResponseTargetMedic; @@ -26,7 +26,6 @@ import org.highmed.dsf.bpe.service.StoreCorrelationKeys; import org.highmed.dsf.bpe.service.StoreMultiMedicResultSets; import org.highmed.dsf.bpe.service.StoreReceivedSingleMedicResults; -import org.highmed.dsf.bpe.service.StoreResultSets; import org.highmed.dsf.bpe.service.StoreSingleMedicResultSets; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.group.GroupHelper; @@ -215,9 +214,9 @@ public FilterQueryResultsByConsent filterQueryResultsByConsent() } @Bean - public ModifyResultSetsWithRbf modifyResultSetsWithRbf() + public TranslateResultSetsWithRbf translateResultSetsWithRbf() { - return new ModifyResultSetsWithRbf(fhirClientProvider, taskHelper, organizationProvider, ehrIdColumnPath, + return new TranslateResultSetsWithRbf(fhirClientProvider, taskHelper, organizationProvider, ehrIdColumnPath, masterPatientIndexClient(), bouncyCastleProvider()); } diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index 7de5e6c8..3a497841 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -54,7 +54,7 @@ <bpmn:outgoing>Flow_14nlfvk</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0kzp6tl" sourceRef="filterByConsent" targetRef="ExclusiveGateway_0lecmy5" /> - <bpmn:serviceTask id="generateBloomFilters" name="translate with RBF calculation" camunda:class="org.highmed.dsf.bpe.service.ModifyResultSetsWithRbf"> + <bpmn:serviceTask id="generateBloomFilters" name="translate with RBF calculation" camunda:class="org.highmed.dsf.bpe.service.TranslateResultSetsWithRbf"> <bpmn:incoming>Flow_0xt2bfn</bpmn:incoming> <bpmn:outgoing>Flow_09yooed</bpmn:outgoing> </bpmn:serviceTask> From 8241676b699ed8c1b0e8de08c00f04b7ae86f62a Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 9 Mar 2021 12:11:13 +0100 Subject: [PATCH 028/125] reorder imports --- .../org/highmed/dsf/bpe/spring/config/DataSharingConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index d932a8ba..0eb362f8 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -18,7 +18,6 @@ import org.highmed.dsf.bpe.service.FilterQueryResultsByConsent; import org.highmed.dsf.bpe.service.HandleErrorMultiMedicResults; import org.highmed.dsf.bpe.service.ModifyQueries; -import org.highmed.dsf.bpe.service.TranslateResultSetsWithRbf; import org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithRecordLinkage; import org.highmed.dsf.bpe.service.SelectRequestTargets; import org.highmed.dsf.bpe.service.SelectResponseTargetMedic; @@ -27,6 +26,7 @@ import org.highmed.dsf.bpe.service.StoreMultiMedicResultSets; import org.highmed.dsf.bpe.service.StoreReceivedSingleMedicResults; import org.highmed.dsf.bpe.service.StoreSingleMedicResultSets; +import org.highmed.dsf.bpe.service.TranslateResultSetsWithRbf; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.group.GroupHelper; import org.highmed.dsf.fhir.organization.OrganizationProvider; From 33b4f4a5812ffde6bdcc039ad9f93ad82168dc60 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 9 Mar 2021 13:23:28 +0100 Subject: [PATCH 029/125] fix error in profile, remove not used imports, fix typo in bpmn --- .../highmed/dsf/bpe/service/StoreResultSets.java | 2 -- .../src/main/resources/bpe/computeDataSharing.bpmn | 2 +- .../highmed-task-compute-data-sharing.xml | 14 ++++++++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java index d43a451e..3b1b625d 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java @@ -1,6 +1,5 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; @@ -9,7 +8,6 @@ import java.util.Objects; import java.util.stream.Collectors; -import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.QueryResult; diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn index 9ef3d0e3..6d3c31fb 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn @@ -62,7 +62,7 @@ <bpmn:sequenceFlow id="SequenceFlow_0t4lx4v" name="else" sourceRef="ExclusiveGateway_07e71aa" targetRef="ExclusiveGateway_1r8ow3i"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:serviceTask id="pseudonymizeResultSetWithRecordLinkage" name="pseudonymize result sets with record linkage" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeResultSetWithRecordLinkage"> + <bpmn:serviceTask id="pseudonymizeResultSetWithRecordLinkage" name="pseudonymize result sets with record linkage" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithRecordLinkage"> <bpmn:incoming>SequenceFlow_0calilw</bpmn:incoming> <bpmn:outgoing>SequenceFlow_02zmrer</bpmn:outgoing> </bpmn:serviceTask> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml index 27a892c2..ae6476ad 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml @@ -138,7 +138,6 @@ <code value="boolean" /> </type> </element> - <element id="Task.input:research-study-identifier"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> <valueString value="Parameter" /> @@ -176,8 +175,19 @@ <element id="Task.input:research-study-identifier.value[x]"> <path value="Task.input.value[x]" /> <type> - <code value="reference" /> + <code value="Reference" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/research-study" /> </type> </element> + <element id="Task.input:research-study-identifier.value[x].reference"> + <path value="Task.input.value[x].reference" /> + <min value="0" /> + <max value="0" /> + </element> + <element id="Task.input:single-medic-result-set-reference.value[x].identifier"> + <path value="Task.input.value[x].identifier" /> + <min value="1" /> + <max value="1" /> + </element> </differential> </StructureDefinition> \ No newline at end of file From 31d01d5fadbb677f5809b885fb8d8cef60e6cca6 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 9 Mar 2021 14:18:40 +0100 Subject: [PATCH 030/125] increase min values in structure definition, fix meta nullpointer --- .../service/PseudonymizeResultSetsWithRecordLinkage.java | 6 +++++- .../highmed-task-compute-data-sharing.xml | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java index b4c87622..aaaf3ca4 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java @@ -18,6 +18,8 @@ import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.openehr.model.structure.Column; +import org.highmed.openehr.model.structure.Meta; import org.highmed.openehr.model.structure.ResultSet; import org.highmed.pseudonymization.crypto.AesGcmUtil; import org.highmed.pseudonymization.domain.PersonWithMdat; @@ -128,7 +130,9 @@ private List<PersonWithMdat> translateFromMedic(ResultSetTranslatorFromMedic tra private ResultSet translateToMedicResultSet(ResultSet initialResultSet, ResultSetTranslatorToMedic translator, List<PseudonymizedPersonWithMdat> pseudonymizedPersons) { - return translator.translate(initialResultSet.getMeta(), initialResultSet.getColumns(), pseudonymizedPersons); + Meta meta = initialResultSet.getMeta() == null ? new Meta("", "", "", "", "", "") : initialResultSet.getMeta(); + List<Column> columns = initialResultSet.getColumns(); + return translator.translate(meta, columns, pseudonymizedPersons); } private ResultSetTranslatorFromMedic createResultSetTranslatorFromMedic() diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml index ae6476ad..5f23c55e 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml @@ -29,7 +29,7 @@ <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <min value="4" /> + <min value="5" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> From 3ce1f4f295c281844fb249a6480d996a8599e1d3 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 9 Mar 2021 17:11:51 +0100 Subject: [PATCH 031/125] send multi medic results to leading medic --- .../dsf/bpe/message/SendMedicResults.java | 71 +++++++++++++++++++ .../bpe/message/SendMultiMedicResults.java | 27 ------- 2 files changed, 71 insertions(+), 27 deletions(-) create mode 100755 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java delete mode 100755 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java new file mode 100755 index 00000000..b3b8189d --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java @@ -0,0 +1,71 @@ +package org.highmed.dsf.bpe.message; + +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE; + +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.ParameterComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ca.uhn.fhir.context.FhirContext; + +public abstract class SendMedicResults extends AbstractTaskMessageSend +{ + private static final Logger logger = LoggerFactory.getLogger(SendMedicResults.class); + + public SendMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider, FhirContext fhirContext) + { + super(clientProvider, taskHelper, organizationProvider, fhirContext); + } + + @Override + protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) + { + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + return results.getResults().stream().map(this::toInput); + } + + protected abstract String getResultSetReferenceCodeSystemValue(); + + private Task.ParameterComponent toInput(QueryResult result) + { + if (result.isIdResultSetUrlResult()) + { + String resultSetReferenceCodeSystemValue = getResultSetReferenceCodeSystemValue(); + ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + resultSetReferenceCodeSystemValue, + new Reference(result.getResultSetUrl())); + input.addExtension(createCohortIdExtension(result.getCohortId())); + return input; + } + else + { + logger.warn("Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + + result.getCohortId()); + throw new RuntimeException( + "Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " + + result.getCohortId()); + } + } + + private Extension createCohortIdExtension(String cohortId) + { + return new Extension(EXTENSION_HIGHMED_GROUP_ID, new Reference(cohortId)); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java deleted file mode 100755 index 3aabc6be..00000000 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.highmed.dsf.bpe.message; - -import java.util.stream.Stream; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; -import org.highmed.dsf.fhir.organization.OrganizationProvider; -import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; -import org.highmed.dsf.fhir.task.TaskHelper; -import org.hl7.fhir.r4.model.Task.ParameterComponent; - -import ca.uhn.fhir.context.FhirContext; - -public class SendMultiMedicResults extends AbstractTaskMessageSend -{ - public SendMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - OrganizationProvider organizationProvider, FhirContext fhirContext) - { - super(clientProvider, taskHelper, organizationProvider, fhirContext); - } - - @Override - protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) - { - return Stream.empty(); - } -} From 9fd366c865b957f089a0fd70b98e42d89409c5f0 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 9 Mar 2021 17:13:02 +0100 Subject: [PATCH 032/125] send multi medic results to leading medic --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 3 +- .../dsf/bpe/message/SendMedicResults.java | 5 +- .../bpe/message/SendMultiMedicResults.java | 24 +++++++ .../bpe/message/SendSingleMedicResults.java | 49 +------------ .../CheckTtpComputedMultiMedicResults.java | 1 + .../fhir/CodeSystem/highmed-data-sharing.xml | 10 ++- ...d-task-multi-medic-result-data-sharing.xml | 68 +++++++++++++++++++ .../bpe/message/SendMultiMedicResults.java | 4 +- .../bpe/service/CheckMultiMedicResults.java | 6 +- ...ed-task-multi-medic-result-feasibility.xml | 20 +++--- .../highmed-task-request-feasibility.xml | 20 +++--- .../dsf/fhir/profile/TaskProfileTest.java | 10 +-- 12 files changed, 137 insertions(+), 83 deletions(-) create mode 100755 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index 6ad0328a..8541f885 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -35,7 +35,8 @@ public interface ConstantsDataSharing String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY = "medic-correlation-key"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT = "single-medic-count-result"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE = "single-medic-result-set-reference"; - String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT = "multi-medic-result"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT = "multi-medic-count-result"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE = "multi-medic-result-set-reference"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS = "participating-medics"; String NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER = "http://highmed.org/fhir/NamingSystem/research-study-identifier"; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java index b3b8189d..76786d2d 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java @@ -3,8 +3,6 @@ import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE; import java.util.stream.Stream; @@ -49,8 +47,7 @@ private Task.ParameterComponent toInput(QueryResult result) { String resultSetReferenceCodeSystemValue = getResultSetReferenceCodeSystemValue(); ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - resultSetReferenceCodeSystemValue, - new Reference(result.getResultSetUrl())); + resultSetReferenceCodeSystemValue, new Reference(result.getResultSetUrl())); input.addExtension(createCohortIdExtension(result.getCohortId())); return input; } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java new file mode 100755 index 00000000..5fa69725 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java @@ -0,0 +1,24 @@ +package org.highmed.dsf.bpe.message; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE; + +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; + +import ca.uhn.fhir.context.FhirContext; + +public class SendMultiMedicResults extends SendMedicResults +{ + public SendMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider, FhirContext fhirContext) + { + super(clientProvider, taskHelper, organizationProvider, fhirContext); + } + + @Override + protected String getResultSetReferenceCodeSystemValue() + { + return CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE; + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java index f3837b23..f9c93d08 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -1,32 +1,15 @@ package org.highmed.dsf.bpe.message; -import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE; -import java.util.stream.Stream; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.variable.QueryResult; -import org.highmed.dsf.bpe.variable.QueryResults; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; -import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; import org.highmed.dsf.fhir.task.TaskHelper; -import org.hl7.fhir.r4.model.Extension; -import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.r4.model.Task; -import org.hl7.fhir.r4.model.Task.ParameterComponent; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import ca.uhn.fhir.context.FhirContext; -public class SendSingleMedicResults extends AbstractTaskMessageSend +public class SendSingleMedicResults extends SendMedicResults { - private static final Logger logger = LoggerFactory.getLogger(SendSingleMedicResults.class); - public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) { @@ -34,34 +17,8 @@ public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskH } @Override - protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) - { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - return results.getResults().stream().map(this::toInput); - } - - private Task.ParameterComponent toInput(QueryResult result) - { - if (result.isIdResultSetUrlResult()) - { - ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE, - new Reference(result.getResultSetUrl())); - input.addExtension(createCohortIdExtension(result.getCohortId())); - return input; - } - else - { - logger.warn("Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " - + result.getCohortId()); - throw new RuntimeException( - "Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " - + result.getCohortId()); - } - } - - private Extension createCohortIdExtension(String cohortId) + protected String getResultSetReferenceCodeSystemValue() { - return new Extension(EXTENSION_HIGHMED_GROUP_ID, new Reference(cohortId)); + return CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE; } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java index 8c5a335e..bd3d2fc1 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java @@ -19,6 +19,7 @@ public CheckTtpComputedMultiMedicResults(FhirWebserviceClientProvider clientProv @Override protected void doExecute(DelegateExecution execution) { + // TODO: implement checks logger.info(this.getClass().getName() + " doExecute called"); } } diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml index b043acc4..e58c637c 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml @@ -67,9 +67,15 @@ execution and/or the record-bloom-filters of a single query execution"/> </concept> <concept> - <code value="multi-medic-result"/> + <code value="multi-medic-count-result"/> <display value="Multi MeDIC Result"/> - <definition value="Aggregated result of all single medic results"/> + <definition value="Aggregated result of all single count query execution results"/> + </concept> + <concept> + <code value="multi-medic-result-set-reference"/> + <display value="Multi MeDIC Result Set Reference"/> + <definition value="Reference to an openEHR ResultSet containing the aggregated result of a all single query + execution ResultSets"/> </concept> <concept> <code value="participating-medics"/> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml index 9327eaae..1376ce4e 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml @@ -59,5 +59,73 @@ <min value="0" /> <max value="0" /> </element> + <element id="Task.input:multi-medic-result-set-reference"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="multi-medic-result-set-reference" /> + <min value="1" /> + <max value="*" /> + </element> + <element id="Task.input:multi-medic-result-set-reference.extension"> + <path value="Task.input.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + </element> + <element id="Task.input:multi-medic-result-set-reference.extension:group-id"> + <path value="Task.input.extension" /> + <sliceName value="group-id" /> + <min value="1" /> + <type> + <code value="Extension" /> + <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> + </type> + </element> + <element id="Task.input:multi-medic-result-set-reference.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:multi-medic-result-set-reference.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:multi-medic-result-set-reference.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:multi-medic-result-set-reference.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="multi-medic-result-set-reference" /> + </element> + <element id="Task.input:multi-medic-result-set-reference.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="Reference" /> + <targetProfile value="http://hl7.org/fhir/StructureDefinition/Binary" /> + </type> + </element> + <element id="Task.input:multi-medic-result-set-reference.value[x].reference"> + <path value="Task.input.value[x].reference" /> + <min value="1" /> + </element> + <element id="Task.input:multi-medic-result-set-reference.value[x].identifier"> + <path value="Task.input.value[x].identifier" /> + <max value="0" /> + </element> </differential> </StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java index dd5d5efa..11625a87 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java @@ -5,7 +5,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS; import java.util.List; @@ -49,7 +49,7 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut private Stream<ParameterComponent> toInputs(FinalFeasibilityQueryResult result) { ParameterComponent input1 = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT, result.getCohortSize()); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT, result.getCohortSize()); input1.addExtension(createCohortIdExtension(result.getCohortId())); ParameterComponent input2 = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java index 2c8c69f3..d3251ebb 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java @@ -4,7 +4,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS; import java.util.List; @@ -64,7 +64,7 @@ private FinalFeasibilityQueryResults readFinalFeasibilityQueryResultsFromCurrent List<FinalFeasibilityQueryResult> results = task.getInput().stream() .filter(in -> in.hasType() && in.getType().hasCoding() && CODESYSTEM_HIGHMED_DATA_SHARING.equals(in.getType().getCodingFirstRep().getSystem()) - && CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT + && CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT .equals(in.getType().getCodingFirstRep().getCode())) .map(in -> toResult(task, in)).collect(Collectors.toList()); return new FinalFeasibilityQueryResults(results); @@ -104,7 +104,7 @@ private void addFinalFeasibilityQueryResultsToLeadingTask(FinalFeasibilityQueryR private void addResultOutput(FinalFeasibilityQueryResult result, Task toWrite) { TaskOutputComponent output1 = getTaskHelper().createOutputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT, result.getCohortSize()); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT, result.getCohortSize()); output1.addExtension(createCohortIdExtension(result.getCohortId())); toWrite.addOutput(output1); diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml index d8835fd3..f3933bfb 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml @@ -117,15 +117,15 @@ <code value="unsignedInt" /> </type> </element> - <element id="Task.input:multi-medic-result"> + <element id="Task.input:multi-medic-count-result"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <sliceName value="multi-medic-result" /> + <sliceName value="multi-medic-count-result" /> <min value="1" /> </element> - <element id="Task.input:multi-medic-result.extension"> + <element id="Task.input:multi-medic-count-result.extension"> <path value="Task.input.extension" /> <slicing> <discriminator> @@ -135,7 +135,7 @@ <rules value="open" /> </slicing> </element> - <element id="Task.input:multi-medic-result.extension:group-id"> + <element id="Task.input:multi-medic-count-result.extension:group-id"> <path value="Task.input.extension" /> <sliceName value="group-id" /> <min value="1" /> @@ -144,7 +144,7 @@ <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> </type> </element> - <element id="Task.input:multi-medic-result.type"> + <element id="Task.input:multi-medic-count-result.type"> <path value="Task.input.type" /> <binding> <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> @@ -154,22 +154,22 @@ <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> - <element id="Task.input:multi-medic-result.type.coding"> + <element id="Task.input:multi-medic-count-result.type.coding"> <path value="Task.input.type.coding" /> <min value="1" /> <max value="1" /> </element> - <element id="Task.input:multi-medic-result.type.coding.system"> + <element id="Task.input:multi-medic-count-result.type.coding.system"> <path value="Task.input.type.coding.system" /> <min value="1" /> <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> - <element id="Task.input:multi-medic-result.type.coding.code"> + <element id="Task.input:multi-medic-count-result.type.coding.code"> <path value="Task.input.type.coding.code" /> <min value="1" /> - <fixedCode value="multi-medic-result" /> + <fixedCode value="multi-medic-count-result" /> </element> - <element id="Task.input:multi-medic-result.value[x]"> + <element id="Task.input:multi-medic-count-result.value[x]"> <path value="Task.input.value[x]" /> <type> <code value="unsignedInt" /> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml index 4eb3106e..93455a42 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml @@ -242,11 +242,11 @@ <code value="unsignedInt" /> </type> </element> - <element id="Task.output:multi-medic-result"> + <element id="Task.output:multi-medic-count-result"> <path value="Task.output" /> - <sliceName value="multi-medic-result" /> + <sliceName value="multi-medic-count-result" /> </element> - <element id="Task.output:multi-medic-result.extension"> + <element id="Task.output:multi-medic-count-result.extension"> <path value="Task.output.extension" /> <slicing> <discriminator> @@ -256,7 +256,7 @@ <rules value="open" /> </slicing> </element> - <element id="Task.output:multi-medic-result.extension:group-id"> + <element id="Task.output:multi-medic-count-result.extension:group-id"> <path value="Task.output.extension" /> <sliceName value="group-id" /> <min value="1" /> @@ -265,7 +265,7 @@ <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> </type> </element> - <element id="Task.output:multi-medic-result.type"> + <element id="Task.output:multi-medic-count-result.type"> <path value="Task.output.type" /> <binding> <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> @@ -275,22 +275,22 @@ <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> </binding> </element> - <element id="Task.output:multi-medic-result.type.coding"> + <element id="Task.output:multi-medic-count-result.type.coding"> <path value="Task.output.type.coding" /> <min value="1" /> <max value="1" /> </element> - <element id="Task.output:multi-medic-result.type.coding.system"> + <element id="Task.output:multi-medic-count-result.type.coding.system"> <path value="Task.output.type.coding.system" /> <min value="1" /> <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> </element> - <element id="Task.output:multi-medic-result.type.coding.code"> + <element id="Task.output:multi-medic-count-result.type.coding.code"> <path value="Task.output.type.coding.code" /> <min value="1" /> - <fixedCode value="multi-medic-result" /> + <fixedCode value="multi-medic-count-result" /> </element> - <element id="Task.output:multi-medic-result.value[x]"> + <element id="Task.output:multi-medic-count-result.value[x]"> <path value="Task.output.value[x]" /> <type> <code value="unsignedInt" /> diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index b6b88306..7b936ed1 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -9,7 +9,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS; @@ -109,7 +109,7 @@ public void testTaskRequestFeasibilityValidWithOutput() throws Exception TaskOutputComponent outMultiMedicResult1 = task.addOutput(); outMultiMedicResult1.setValue(new UnsignedIntType(25)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) - .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT); + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT); outMultiMedicResult1.addExtension("http://highmed.org/fhir/StructureDefinition/extension-group-id", new Reference(groupId1)); @@ -121,7 +121,7 @@ public void testTaskRequestFeasibilityValidWithOutput() throws Exception TaskOutputComponent outMultiMedicResult2 = task.addOutput(); outMultiMedicResult2.setValue(new UnsignedIntType(25)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) - .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT); + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT); outMultiMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); ValidationResult result = resourceValidator.validate(task); @@ -395,7 +395,7 @@ private Task createValidTaskMultiMedicResultFeasibility() ParameterComponent inMultiMedicResult1 = task.addInput(); inMultiMedicResult1.setValue(new UnsignedIntType(25)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) - .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT); + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT); inMultiMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); ParameterComponent inParticipatingMedics2 = task.addInput(); @@ -406,7 +406,7 @@ private Task createValidTaskMultiMedicResultFeasibility() ParameterComponent inMultiMedicResult2 = task.addInput(); inMultiMedicResult2.setValue(new UnsignedIntType(25)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) - .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT); + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT); inMultiMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); return task; From 41c4f9805d74369ddcd0354faa446fd8fcadb6c1 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 10 Mar 2021 16:49:55 +0100 Subject: [PATCH 033/125] move some process steps, download final result sets from ttp --- ...va => CheckMedicMultiMedicResultSets.java} | 6 +- ...s.java => CheckSingleMedicResultSets.java} | 6 +- ...java => CheckTtpMultiMedicResultSets.java} | 6 +- .../service/DownloadMultiMedicResultSets.java | 52 +++++++++ .../DownloadResearchStudyResource.java | 9 +- .../dsf/bpe/service/DownloadResultSets.java | 104 ++++++++++++++++++ .../DownloadSingleMedicResultSets.java | 68 +----------- ...va => StoreSingleMedicResultSetLinks.java} | 6 +- ...ranslateSingleMedicResultSetsWithRbf.java} | 6 +- .../bpe/spring/config/DataSharingConfig.java | 51 +++++---- .../resources/bpe/computeDataSharing.bpmn | 104 +++++++++--------- .../resources/bpe/executeDataSharing.bpmn | 100 ++++++++--------- .../resources/bpe/requestDataSharing.bpmn | 76 ++++++++----- 13 files changed, 363 insertions(+), 231 deletions(-) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{CheckMultiMedicResults.java => CheckMedicMultiMedicResultSets.java} (72%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{CheckSingleMedicResults.java => CheckSingleMedicResultSets.java} (91%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{CheckTtpComputedMultiMedicResults.java => CheckTtpMultiMedicResultSets.java} (72%) create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{StoreReceivedSingleMedicResults.java => StoreSingleMedicResultSetLinks.java} (91%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{TranslateResultSetsWithRbf.java => TranslateSingleMedicResultSetsWithRbf.java} (96%) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResultSets.java similarity index 72% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResultSets.java index ac2ec7ea..e01cc565 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResultSets.java @@ -7,11 +7,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class CheckMultiMedicResults extends AbstractServiceDelegate +public class CheckMedicMultiMedicResultSets extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(CheckMultiMedicResults.class); + private static final Logger logger = LoggerFactory.getLogger(CheckMedicMultiMedicResultSets.class); - public CheckMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + public CheckMedicMultiMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) { super(clientProvider, taskHelper); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java similarity index 91% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java index df119219..b60e8786 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java @@ -18,12 +18,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class CheckSingleMedicResults extends AbstractServiceDelegate +public class CheckSingleMedicResultSets extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(CheckSingleMedicResults.class); + private static final Logger logger = LoggerFactory.getLogger(CheckSingleMedicResultSets.class); - public CheckSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + public CheckSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) { super(clientProvider, taskHelper); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java similarity index 72% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java index bd3d2fc1..82be3b9d 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java @@ -7,11 +7,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class CheckTtpComputedMultiMedicResults extends AbstractServiceDelegate +public class CheckTtpMultiMedicResultSets extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(CheckTtpComputedMultiMedicResults.class); + private static final Logger logger = LoggerFactory.getLogger(CheckTtpMultiMedicResultSets.class); - public CheckTtpComputedMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + public CheckTtpMultiMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) { super(clientProvider, taskHelper); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java new file mode 100644 index 00000000..08a995d2 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java @@ -0,0 +1,52 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_GROUP_ID; + +import java.util.List; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class DownloadMultiMedicResultSets extends DownloadResultSets +{ + public DownloadMultiMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ObjectMapper openEhrObjectMapper) + { + super(clientProvider, taskHelper, openEhrObjectMapper); + } + + @Override + protected QueryResults getQueryResults(DelegateExecution execution) + { + Task task = getCurrentTaskFromExecutionVariables(); + List<QueryResult> results = getResults(task); + + return new QueryResults(results); + } + + private List<QueryResult> getResults(Task task) + { + Reference requester = task.getRequester(); + + return getTaskHelper().getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE, EXTENSION_HIGHMED_GROUP_ID) + .map(input -> + { + String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); + String resultSetUrl = ((Reference) input.getValue()).getReference(); + + return QueryResult.idResult(requester.getIdentifier().getValue(), cohortId, resultSetUrl); + }).collect(Collectors.toList()); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java index d72ecaeb..3166ebaf 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -1,7 +1,9 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; @@ -12,6 +14,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -34,7 +38,6 @@ public DownloadResearchStudyResource(FhirWebserviceClientProvider clientProvider OrganizationProvider organizationProvider) { super(clientProvider, taskHelper); - this.organizationProvider = organizationProvider; } @@ -42,7 +45,6 @@ public DownloadResearchStudyResource(FhirWebserviceClientProvider clientProvider public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); - Objects.requireNonNull(organizationProvider, "organizationProvider"); } @@ -60,6 +62,9 @@ protected void doExecute(DelegateExecution execution) execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY, researchStudy); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK, needsConsentCheck); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER, + organizationProvider.getLocalIdentifierValue()); } private IdType getResearchStudyId(Task task) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java new file mode 100644 index 00000000..8f645851 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java @@ -0,0 +1,104 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import javax.ws.rs.core.MediaType; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.fhir.client.FhirWebserviceClient; +import org.highmed.openehr.model.structure.ResultSet; +import org.hl7.fhir.r4.model.IdType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public abstract class DownloadResultSets extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(DownloadResultSets.class); + + private final ObjectMapper openEhrObjectMapper; + + public DownloadResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ObjectMapper openEhrObjectMapper) + { + super(clientProvider, taskHelper); + this.openEhrObjectMapper = openEhrObjectMapper; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + Objects.requireNonNull(openEhrObjectMapper, "openEhrObjectMapper"); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + QueryResults results = getQueryResults(execution); + + List<QueryResult> resultsWithResultSets = download(results); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(resultsWithResultSets))); + } + + protected abstract QueryResults getQueryResults(DelegateExecution execution); + + private List<QueryResult> download(QueryResults results) + { + return results.getResults().stream().map(this::download).collect(Collectors.toList()); + } + + private QueryResult download(QueryResult result) + { + IdType id = new IdType(result.getResultSetUrl()); + FhirWebserviceClient client = getFhirWebserviceClientProvider().getRemoteWebserviceClient(id.getBaseUrl()); + + InputStream binary = readBinaryResource(client, id.getIdPart()); + ResultSet resultSet = deserializeResultSet(binary); + + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), resultSet); + } + + private InputStream readBinaryResource(FhirWebserviceClient client, String id) + { + try + { + logger.info("Reading binary from {} with id {}", client.getBaseUrl(), id); + return client.readBinary(id, MediaType.valueOf(OPENEHR_MIMETYPE_JSON)); + } + catch (Exception e) + { + logger.warn("Error while reading Binary resource: " + e.getMessage(), e); + throw e; + } + } + + private ResultSet deserializeResultSet(InputStream content) + { + try (content) + { + return openEhrObjectMapper.readValue(content, ResultSet.class); + } + catch (IOException e) + { + logger.warn("Error while deserializing ResultSet: " + e.getMessage(), e); + throw new RuntimeException(e); + } + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResultSets.java index 996bad46..0e3df1f9 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResultSets.java @@ -26,77 +26,17 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class DownloadSingleMedicResultSets extends AbstractServiceDelegate +public class DownloadSingleMedicResultSets extends DownloadResultSets { - private static final Logger logger = LoggerFactory.getLogger(DownloadSingleMedicResultSets.class); - - private final ObjectMapper openEhrObjectMapper; - public DownloadSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ObjectMapper openEhrObjectMapper) { - super(clientProvider, taskHelper); - this.openEhrObjectMapper = openEhrObjectMapper; - } - - @Override - public void afterPropertiesSet() throws Exception - { - super.afterPropertiesSet(); - Objects.requireNonNull(openEhrObjectMapper, "openEhrObjectMapper"); + super(clientProvider, taskHelper, openEhrObjectMapper); } @Override - protected void doExecute(DelegateExecution execution) - { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - - List<QueryResult> resultsWithResultSets = download(results); - - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - QueryResultsValues.create(new QueryResults(resultsWithResultSets))); - } - - private List<QueryResult> download(QueryResults results) - { - return results.getResults().stream().map(this::download).collect(Collectors.toList()); - } - - private QueryResult download(QueryResult result) - { - IdType id = new IdType(result.getResultSetUrl()); - FhirWebserviceClient client = getFhirWebserviceClientProvider().getRemoteWebserviceClient(id.getBaseUrl()); - - InputStream binary = readBinaryResource(client, id.getIdPart()); - ResultSet resultSet = deserializeResultSet(binary); - - return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), resultSet); - } - - private InputStream readBinaryResource(FhirWebserviceClient client, String id) - { - try - { - logger.info("Reading binary from {} with id {}", client.getBaseUrl(), id); - return client.readBinary(id, MediaType.valueOf(OPENEHR_MIMETYPE_JSON)); - } - catch (Exception e) - { - logger.warn("Error while reading Binary resource: " + e.getMessage(), e); - throw e; - } - } - - private ResultSet deserializeResultSet(InputStream content) + protected QueryResults getQueryResults(DelegateExecution execution) { - try (content) - { - return openEhrObjectMapper.readValue(content, ResultSet.class); - } - catch (IOException e) - { - logger.warn("Error while deserializing ResultSet: " + e.getMessage(), e); - throw new RuntimeException(e); - } + return (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreReceivedSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSetLinks.java similarity index 91% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreReceivedSingleMedicResults.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSetLinks.java index 1b5c6f14..ef7d9682 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreReceivedSingleMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSetLinks.java @@ -21,12 +21,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class StoreReceivedSingleMedicResults extends AbstractServiceDelegate +public class StoreSingleMedicResultSetLinks extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(StoreReceivedSingleMedicResults.class); + private static final Logger logger = LoggerFactory.getLogger(StoreSingleMedicResultSetLinks.class); - public StoreReceivedSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + public StoreSingleMedicResultSetLinks(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) { super(clientProvider, taskHelper); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateResultSetsWithRbf.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java similarity index 96% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateResultSetsWithRbf.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java index 396194bf..dde848ae 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateResultSetsWithRbf.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java @@ -37,9 +37,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; -public class TranslateResultSetsWithRbf extends AbstractServiceDelegate implements InitializingBean +public class TranslateSingleMedicResultSetsWithRbf extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(TranslateResultSetsWithRbf.class); + private static final Logger logger = LoggerFactory.getLogger(TranslateSingleMedicResultSetsWithRbf.class); private static final int RBF_LENGTH = 3000; private static final RecordBloomFilterGeneratorImpl.FieldWeights FBF_WEIGHTS = new RecordBloomFilterGeneratorImpl.FieldWeights( @@ -52,7 +52,7 @@ public class TranslateResultSetsWithRbf extends AbstractServiceDelegate implemen private final MasterPatientIndexClient masterPatientIndexClient; private final BouncyCastleProvider bouncyCastleProvider; - public TranslateResultSetsWithRbf(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public TranslateSingleMedicResultSetsWithRbf(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, OrganizationProvider organizationProvider, String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, BouncyCastleProvider bouncyCastleProvider) { diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index 0eb362f8..fc8594b4 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -7,10 +7,11 @@ import org.highmed.dsf.bpe.message.SendSingleMedicResults; import org.highmed.dsf.bpe.message.SendTtpRequest; import org.highmed.dsf.bpe.service.CheckDataSharingResources; -import org.highmed.dsf.bpe.service.CheckMultiMedicResults; -import org.highmed.dsf.bpe.service.CheckSingleMedicResults; -import org.highmed.dsf.bpe.service.CheckTtpComputedMultiMedicResults; +import org.highmed.dsf.bpe.service.CheckMedicMultiMedicResultSets; +import org.highmed.dsf.bpe.service.CheckSingleMedicResultSets; +import org.highmed.dsf.bpe.service.CheckTtpMultiMedicResultSets; import org.highmed.dsf.bpe.service.DownloadDataSharingResources; +import org.highmed.dsf.bpe.service.DownloadMultiMedicResultSets; import org.highmed.dsf.bpe.service.DownloadResearchStudyResource; import org.highmed.dsf.bpe.service.DownloadSingleMedicResultSets; import org.highmed.dsf.bpe.service.ExecuteQueries; @@ -24,9 +25,9 @@ import org.highmed.dsf.bpe.service.SelectResponseTargetTtp; import org.highmed.dsf.bpe.service.StoreCorrelationKeys; import org.highmed.dsf.bpe.service.StoreMultiMedicResultSets; -import org.highmed.dsf.bpe.service.StoreReceivedSingleMedicResults; +import org.highmed.dsf.bpe.service.StoreSingleMedicResultSetLinks; import org.highmed.dsf.bpe.service.StoreSingleMedicResultSets; -import org.highmed.dsf.bpe.service.TranslateResultSetsWithRbf; +import org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithRbf; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.group.GroupHelper; import org.highmed.dsf.fhir.organization.OrganizationProvider; @@ -104,9 +105,21 @@ public SendMedicRequest sendMedicRequest() } @Bean - public CheckMultiMedicResults checkMultiMedicResults() + public DownloadMultiMedicResultSets downloadMultiMedicResultSets() { - return new CheckMultiMedicResults(fhirClientProvider, taskHelper); + return new DownloadMultiMedicResultSets(fhirClientProvider, taskHelper, objectMapper); + } + + @Bean + public CheckMedicMultiMedicResultSets checkMedicMultiMedicResultSets() + { + return new CheckMedicMultiMedicResultSets(fhirClientProvider, taskHelper); + } + + @Bean + public StoreMultiMedicResultSets storeMultiMedicResultSets() + { + return new StoreMultiMedicResultSets(fhirClientProvider, taskHelper, objectMapper); } // @@ -120,9 +133,9 @@ public StoreCorrelationKeys storeCorrelationKeys() } @Bean - public StoreReceivedSingleMedicResults storeReceivedSingleMedicResults() + public StoreSingleMedicResultSetLinks storeSingleMedicResultSetLinks() { - return new StoreReceivedSingleMedicResults(fhirClientProvider, taskHelper); + return new StoreSingleMedicResultSetLinks(fhirClientProvider, taskHelper); } @Bean @@ -144,9 +157,9 @@ public SelectResponseTargetMedic selectResponseTargetMedic() } @Bean - public CheckTtpComputedMultiMedicResults checkTtpComputedMultiMedicResults() + public CheckTtpMultiMedicResultSets checkTtpMultiMedicResultSets() { - return new CheckTtpComputedMultiMedicResults(fhirClientProvider, taskHelper); + return new CheckTtpMultiMedicResultSets(fhirClientProvider, taskHelper); } @Bean @@ -214,10 +227,10 @@ public FilterQueryResultsByConsent filterQueryResultsByConsent() } @Bean - public TranslateResultSetsWithRbf translateResultSetsWithRbf() + public TranslateSingleMedicResultSetsWithRbf translateSingleMedicResultSetsWithRbf() { - return new TranslateResultSetsWithRbf(fhirClientProvider, taskHelper, organizationProvider, ehrIdColumnPath, - masterPatientIndexClient(), bouncyCastleProvider()); + return new TranslateSingleMedicResultSetsWithRbf(fhirClientProvider, taskHelper, organizationProvider, + ehrIdColumnPath, masterPatientIndexClient(), bouncyCastleProvider()); } @Bean @@ -239,15 +252,9 @@ public StoreSingleMedicResultSets storeSingleMedicResultSets() } @Bean - public StoreMultiMedicResultSets storeMultiMedicResultSets() - { - return new StoreMultiMedicResultSets(fhirClientProvider, taskHelper, objectMapper); - } - - @Bean - public CheckSingleMedicResults checkSingleMedicResults() + public CheckSingleMedicResultSets checkSingleMedicResultSets() { - return new CheckSingleMedicResults(fhirClientProvider, taskHelper); + return new CheckSingleMedicResultSets(fhirClientProvider, taskHelper); } @Bean diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn index 6d3c31fb..bfd6514c 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn @@ -8,11 +8,11 @@ <bpmn:endEvent id="SubEndEvent"> <bpmn:incoming>SequenceFlow_0mj024w</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="temporarillyStoreQueryResults" name="temporarilly store single MeDIC results" camunda:class="org.highmed.dsf.bpe.service.StoreReceivedSingleMedicResults"> + <bpmn:serviceTask id="storeResultSetLinks" name="store result set links" camunda:class="org.highmed.dsf.bpe.service.StoreSingleMedicResultSetLinks"> <bpmn:incoming>SequenceFlow_0by0at7</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mj024w</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:receiveTask id="receiveQueryResultsFromMeDIC" name="receive query results from MeDIC" messageRef="Message_0a1qxd8"> + <bpmn:receiveTask id="receiveResults" name="receive results" messageRef="Message_0a1qxd8"> <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="correlationKey">${target.correlationKey}</camunda:inputParameter> @@ -24,9 +24,9 @@ <bpmn:startEvent id="SubStartEvent"> <bpmn:outgoing>SequenceFlow_0qjt33w</bpmn:outgoing> </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_0qjt33w" sourceRef="SubStartEvent" targetRef="receiveQueryResultsFromMeDIC" /> - <bpmn:sequenceFlow id="SequenceFlow_0by0at7" sourceRef="receiveQueryResultsFromMeDIC" targetRef="temporarillyStoreQueryResults" /> - <bpmn:sequenceFlow id="SequenceFlow_0mj024w" sourceRef="temporarillyStoreQueryResults" targetRef="SubEndEvent" /> + <bpmn:sequenceFlow id="SequenceFlow_0qjt33w" sourceRef="SubStartEvent" targetRef="receiveResults" /> + <bpmn:sequenceFlow id="SequenceFlow_0by0at7" sourceRef="receiveResults" targetRef="storeResultSetLinks" /> + <bpmn:sequenceFlow id="SequenceFlow_0mj024w" sourceRef="storeResultSetLinks" targetRef="SubEndEvent" /> </bpmn:subProcess> <bpmn:boundaryEvent id="TimerEnded" attachedToRef="SubProcess_1gopxt4"> <bpmn:outgoing>SequenceFlow_0h3to47</bpmn:outgoing> @@ -38,7 +38,7 @@ <bpmn:outgoing>SequenceFlow_01pjftq</bpmn:outgoing> <bpmn:messageEventDefinition messageRef="Message_08676wn" /> </bpmn:startEvent> - <bpmn:endEvent id="EndEventSuccess" name="send final result to leading MeDIC"> + <bpmn:endEvent id="EndEventSuccess" name="send results to MeDIC"> <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="processDefinitionKey">requestDataSharing</camunda:inputParameter> @@ -47,7 +47,7 @@ <camunda:inputParameter name="messageName">resultMultiMedicDataSharingMessage</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> - <bpmn:incoming>Flow_1r6dq8y</bpmn:incoming> + <bpmn:incoming>Flow_0uaqn1r</bpmn:incoming> <bpmn:messageEventDefinition messageRef="Message_0ue93sz" camunda:class="org.highmed.dsf.bpe.message.SendMultiMedicResults" /> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_01pjftq" sourceRef="StartEvent" targetRef="storeCorrelationKeys" /> @@ -70,17 +70,17 @@ <bpmn:exclusiveGateway id="ExclusiveGateway_1r8ow3i"> <bpmn:incoming>SequenceFlow_02zmrer</bpmn:incoming> <bpmn:incoming>SequenceFlow_0t4lx4v</bpmn:incoming> - <bpmn:outgoing>Flow_1ixeke2</bpmn:outgoing> + <bpmn:outgoing>Flow_1qqffoq</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:serviceTask id="storeCorrelationKeys" name="store correlation keys" camunda:class="org.highmed.dsf.bpe.service.StoreCorrelationKeys"> <bpmn:incoming>SequenceFlow_01pjftq</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1lfe4wr</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="selectResponseTargetMedic" name="select response target MeDIC" camunda:class="org.highmed.dsf.bpe.service.SelectResponseTargetMedic"> - <bpmn:incoming>Flow_1qmx444</bpmn:incoming> - <bpmn:outgoing>Flow_1k0sqwo</bpmn:outgoing> + <bpmn:incoming>Flow_1qqffoq</bpmn:incoming> + <bpmn:outgoing>Flow_1wig1wj</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:endEvent id="EndEventError" name="send error to leading MeDIC"> + <bpmn:endEvent id="EndEventError" name="send error to MeDIC"> <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="processDefinitionKey">requestDataSharing</camunda:inputParameter> @@ -92,12 +92,11 @@ <bpmn:incoming>Flow_1tmnvhl</bpmn:incoming> <bpmn:messageEventDefinition id="MessageEventDefinition_19y5diw" messageRef="Message_0kix95m" camunda:class="org.highmed.dsf.bpe.message.SendMultiMedicErrors" /> </bpmn:endEvent> - <bpmn:serviceTask id="checkComputedResults" name="check computed result" camunda:class="org.highmed.dsf.bpe.service.CheckTtpComputedMultiMedicResults"> - <bpmn:incoming>Flow_1k0sqwo</bpmn:incoming> - <bpmn:outgoing>Flow_1r6dq8y</bpmn:outgoing> + <bpmn:serviceTask id="checkResultSets" name="check result sets" camunda:class="org.highmed.dsf.bpe.service.CheckTtpMultiMedicResultSets"> + <bpmn:incoming>Flow_1wig1wj</bpmn:incoming> + <bpmn:outgoing>Flow_0mogdyo</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_1ixeke2" sourceRef="ExclusiveGateway_1r8ow3i" targetRef="storeFinalResultSets" /> - <bpmn:boundaryEvent id="Event_1vp5qzs" attachedToRef="checkComputedResults"> + <bpmn:boundaryEvent id="Event_1vp5qzs" attachedToRef="checkResultSets"> <bpmn:outgoing>Flow_1tmnvhl</bpmn:outgoing> <bpmn:errorEventDefinition id="ErrorEventDefinition_05kx06m" errorRef="Error_0qub4jc" /> </bpmn:boundaryEvent> @@ -110,19 +109,20 @@ <bpmn:incoming>SequenceFlow_0h3to47</bpmn:incoming> <bpmn:outgoing>Flow_0b5n9vc</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="Flow_0b5n9vc" sourceRef="Gateway_0h2eszv" targetRef="downloadSingleMedicResultSets" /> - <bpmn:sequenceFlow id="Flow_0gx8n5k" sourceRef="downloadSingleMedicResultSets" targetRef="ExclusiveGateway_07e71aa" /> - <bpmn:serviceTask id="downloadSingleMedicResultSets" name="download single MeDIC result sets" camunda:class="org.highmed.dsf.bpe.service.DownloadSingleMedicResultSets"> + <bpmn:sequenceFlow id="Flow_0b5n9vc" sourceRef="Gateway_0h2eszv" targetRef="downloadResultSets" /> + <bpmn:sequenceFlow id="Flow_0gx8n5k" sourceRef="downloadResultSets" targetRef="ExclusiveGateway_07e71aa" /> + <bpmn:serviceTask id="downloadResultSets" name="download result sets" camunda:class="org.highmed.dsf.bpe.service.DownloadSingleMedicResultSets"> <bpmn:incoming>Flow_0b5n9vc</bpmn:incoming> <bpmn:outgoing>Flow_0gx8n5k</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="storeFinalResultSets" name="store multi MeDIC result sets" camunda:class="org.highmed.dsf.bpe.service.StoreMultiMedicResultSets"> - <bpmn:incoming>Flow_1ixeke2</bpmn:incoming> - <bpmn:outgoing>Flow_1qmx444</bpmn:outgoing> + <bpmn:serviceTask id="storeResultSets" name="store result sets" camunda:class="org.highmed.dsf.bpe.service.StoreMultiMedicResultSets"> + <bpmn:incoming>Flow_0mogdyo</bpmn:incoming> + <bpmn:outgoing>Flow_0uaqn1r</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_1r6dq8y" sourceRef="checkComputedResults" targetRef="EndEventSuccess" /> - <bpmn:sequenceFlow id="Flow_1qmx444" sourceRef="storeFinalResultSets" targetRef="selectResponseTargetMedic" /> - <bpmn:sequenceFlow id="Flow_1k0sqwo" sourceRef="selectResponseTargetMedic" targetRef="checkComputedResults" /> + <bpmn:sequenceFlow id="Flow_0mogdyo" sourceRef="checkResultSets" targetRef="storeResultSets" /> + <bpmn:sequenceFlow id="Flow_1qqffoq" sourceRef="ExclusiveGateway_1r8ow3i" targetRef="selectResponseTargetMedic" /> + <bpmn:sequenceFlow id="Flow_1wig1wj" sourceRef="selectResponseTargetMedic" targetRef="checkResultSets" /> + <bpmn:sequenceFlow id="Flow_0uaqn1r" sourceRef="storeResultSets" targetRef="EndEventSuccess" /> </bpmn:process> <bpmn:message id="Message_0a1qxd8" name="resultSingleMedicDataSharingMessage" /> <bpmn:message id="Message_0ue93sz" name="resultMultiMedicDataSharingMessage" /> @@ -147,14 +147,6 @@ <dc:Bounds x="1347" y="133" width="65" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1k0sqwo_di" bpmnElement="Flow_1k0sqwo"> - <di:waypoint x="1880" y="242" /> - <di:waypoint x="1940" y="242" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1ixeke2_di" bpmnElement="Flow_1ixeke2"> - <di:waypoint x="1545" y="242" /> - <di:waypoint x="1620" y="242" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_02zmrer_di" bpmnElement="SequenceFlow_02zmrer"> <di:waypoint x="1520" y="166" /> <di:waypoint x="1520" y="217" /> @@ -183,39 +175,47 @@ <di:waypoint x="195" y="242" /> <di:waypoint x="279" y="242" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1r6dq8y_di" bpmnElement="Flow_1r6dq8y"> - <di:waypoint x="2040" y="242" /> - <di:waypoint x="2142" y="242" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1tmnvhl_di" bpmnElement="Flow_1tmnvhl"> - <di:waypoint x="2040" y="300" /> - <di:waypoint x="2040" y="350" /> + <di:waypoint x="1880" y="300" /> + <di:waypoint x="1880" y="350" /> <di:waypoint x="2142" y="350" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1qmx444_di" bpmnElement="Flow_1qmx444"> - <di:waypoint x="1720" y="242" /> + <bpmndi:BPMNEdge id="Flow_0mogdyo_di" bpmnElement="Flow_0mogdyo"> + <di:waypoint x="1880" y="242" /> + <di:waypoint x="1950" y="242" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1qqffoq_di" bpmnElement="Flow_1qqffoq"> + <di:waypoint x="1545" y="242" /> + <di:waypoint x="1610" y="242" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1wig1wj_di" bpmnElement="Flow_1wig1wj"> + <di:waypoint x="1710" y="242" /> <di:waypoint x="1780" y="242" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0uaqn1r_di" bpmnElement="Flow_0uaqn1r"> + <di:waypoint x="2050" y="242" /> + <di:waypoint x="2142" y="242" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_0xh5o35_di" bpmnElement="EndEventSuccess"> <dc:Bounds x="2142" y="224" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2118" y="267" width="85" height="27" /> + <dc:Bounds x="2125" y="267" width="72" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1hmug5i_di" bpmnElement="EndEventError"> <dc:Bounds x="2142" y="332" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2124" y="375" width="73" height="27" /> + <dc:Bounds x="2129" y="375" width="63" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_13j8ce9_di" bpmnElement="checkComputedResults"> - <dc:Bounds x="1940" y="202" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_0tps18n_di" bpmnElement="storeResultSets"> + <dc:Bounds x="1950" y="202" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0uk3eyz_di" bpmnElement="selectResponseTargetMedic"> + <bpmndi:BPMNShape id="Activity_13j8ce9_di" bpmnElement="checkResultSets"> <dc:Bounds x="1780" y="202" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0tps18n_di" bpmnElement="storeFinalResultSets"> - <dc:Bounds x="1620" y="202" width="100" height="80" /> + <bpmndi:BPMNShape id="ServiceTask_0uk3eyz_di" bpmnElement="selectResponseTargetMedic"> + <dc:Bounds x="1610" y="202" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_1gopxt4_di" bpmnElement="SubProcess_1gopxt4" isExpanded="true"> <dc:Bounds x="469" y="175" width="498" height="134" /> @@ -235,10 +235,10 @@ <bpmndi:BPMNShape id="EndEvent_01cb50v_di" bpmnElement="SubEndEvent"> <dc:Bounds x="894" y="226" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0yjis46_di" bpmnElement="temporarillyStoreQueryResults"> + <bpmndi:BPMNShape id="ServiceTask_0yjis46_di" bpmnElement="storeResultSetLinks"> <dc:Bounds x="746" y="204" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ReceiveTask_0533fm9_di" bpmnElement="receiveQueryResultsFromMeDIC"> + <bpmndi:BPMNShape id="ReceiveTask_0533fm9_di" bpmnElement="receiveResults"> <dc:Bounds x="583" y="204" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_17r90ez_di" bpmnElement="SubStartEvent"> @@ -268,14 +268,14 @@ <bpmndi:BPMNShape id="Gateway_0h2eszv_di" bpmnElement="Gateway_0h2eszv" isMarkerVisible="true"> <dc:Bounds x="1045" y="217" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1rzqqn0_di" bpmnElement="downloadSingleMedicResultSets"> + <bpmndi:BPMNShape id="Activity_1rzqqn0_di" bpmnElement="downloadResultSets"> <dc:Bounds x="1160" y="202" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BoundaryEvent_1g0rcyp_di" bpmnElement="TimerEnded"> <dc:Bounds x="949" y="291" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_155cxa9_di" bpmnElement="Event_1vp5qzs"> - <dc:Bounds x="2022" y="264" width="36" height="36" /> + <dc:Bounds x="1862" y="264" width="36" height="36" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index 3a497841..d048723a 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> <bpmn:process id="executeDataSharing" isExecutable="true" camunda:versionTag="0.5.0"> - <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResults"> - <bpmn:incoming>Flow_12yiiun</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> + <bpmn:serviceTask id="checkResultSets" name="check results sets" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResultSets"> + <bpmn:incoming>Flow_1pzik8k</bpmn:incoming> + <bpmn:outgoing>Flow_08925ay</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="checkDataSharingRequest" name="check data sharing request" camunda:class="org.highmed.dsf.bpe.service.CheckDataSharingResources"> <bpmn:incoming>SequenceFlow_1etju4m</bpmn:incoming> @@ -20,7 +20,7 @@ <bpmn:incoming>SequenceFlow_14cn0vs</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1etju4m</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:endEvent id="EndEvent" name="send result to TTP"> + <bpmn:endEvent id="EndEvent" name="send results to TTP"> <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="messageName">resultSingleMedicDataSharingMessage</camunda:inputParameter> @@ -29,10 +29,9 @@ <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0ascyjc</bpmn:incoming> + <bpmn:incoming>Flow_1611vr6</bpmn:incoming> <bpmn:messageEventDefinition id="MessageEventDefinition_13swtie" messageRef="Message_1dr71re" camunda:class="org.highmed.dsf.bpe.message.SendSingleMedicResults" /> </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_04ouilq" sourceRef="checkResults" targetRef="selectResponseTargetTtp" /> <bpmn:exclusiveGateway id="ExclusiveGateway_0bq7zdz"> <bpmn:incoming>SequenceFlow_1rmqv20</bpmn:incoming> <bpmn:outgoing>SequenceFlow_05r9whd</bpmn:outgoing> @@ -54,14 +53,13 @@ <bpmn:outgoing>Flow_14nlfvk</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0kzp6tl" sourceRef="filterByConsent" targetRef="ExclusiveGateway_0lecmy5" /> - <bpmn:serviceTask id="generateBloomFilters" name="translate with RBF calculation" camunda:class="org.highmed.dsf.bpe.service.TranslateResultSetsWithRbf"> + <bpmn:serviceTask id="translateWithRbfGeneration" name="translate with RBF generation" camunda:class="org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithRbf"> <bpmn:incoming>Flow_0xt2bfn</bpmn:incoming> <bpmn:outgoing>Flow_09yooed</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_0ascyjc" sourceRef="selectResponseTargetTtp" targetRef="EndEvent" /> <bpmn:serviceTask id="selectResponseTargetTtp" name="select response target TTP" camunda:class="org.highmed.dsf.bpe.service.SelectResponseTargetTtp"> - <bpmn:incoming>SequenceFlow_04ouilq</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ascyjc</bpmn:outgoing> + <bpmn:incoming>Flow_1pgebfo</bpmn:incoming> + <bpmn:outgoing>Flow_1pzik8k</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="executeQueries" name="execute queries" camunda:class="org.highmed.dsf.bpe.service.ExecuteQueries"> <bpmn:incoming>Flow_0qsitvp</bpmn:incoming> @@ -87,21 +85,23 @@ <bpmn:exclusiveGateway id="Gateway_13kxug8"> <bpmn:incoming>Flow_09dzkmp</bpmn:incoming> <bpmn:incoming>Flow_09yooed</bpmn:incoming> - <bpmn:outgoing>Flow_0jepala</bpmn:outgoing> + <bpmn:outgoing>Flow_1pgebfo</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="Flow_09dzkmp" name="else" sourceRef="Gateway_118ojzy" targetRef="Gateway_13kxug8"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_0xt2bfn" sourceRef="Gateway_118ojzy" targetRef="generateBloomFilters"> + <bpmn:sequenceFlow id="Flow_0xt2bfn" sourceRef="Gateway_118ojzy" targetRef="translateWithRbfGeneration"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_09yooed" sourceRef="generateBloomFilters" targetRef="Gateway_13kxug8" /> - <bpmn:sequenceFlow id="Flow_0jepala" sourceRef="Gateway_13kxug8" targetRef="Activity_0wzh75y" /> - <bpmn:sequenceFlow id="Flow_12yiiun" sourceRef="Activity_0wzh75y" targetRef="checkResults" /> - <bpmn:serviceTask id="Activity_0wzh75y" name="store single MeDIC result sets" camunda:class="org.highmed.dsf.bpe.service.StoreSingleMedicResultSets"> - <bpmn:incoming>Flow_0jepala</bpmn:incoming> - <bpmn:outgoing>Flow_12yiiun</bpmn:outgoing> + <bpmn:sequenceFlow id="Flow_09yooed" sourceRef="translateWithRbfGeneration" targetRef="Gateway_13kxug8" /> + <bpmn:serviceTask id="storeResultSets" name="store result sets" camunda:class="org.highmed.dsf.bpe.service.StoreSingleMedicResultSets"> + <bpmn:incoming>Flow_08925ay</bpmn:incoming> + <bpmn:outgoing>Flow_1611vr6</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_08925ay" sourceRef="checkResultSets" targetRef="storeResultSets" /> + <bpmn:sequenceFlow id="Flow_1pgebfo" sourceRef="Gateway_13kxug8" targetRef="selectResponseTargetTtp" /> + <bpmn:sequenceFlow id="Flow_1pzik8k" sourceRef="selectResponseTargetTtp" targetRef="checkResultSets" /> + <bpmn:sequenceFlow id="Flow_1611vr6" sourceRef="storeResultSets" targetRef="EndEvent" /> <bpmn:textAnnotation id="TextAnnotation_0euut3n"> <bpmn:text>uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc.</bpmn:text> </bpmn:textAnnotation> @@ -111,14 +111,6 @@ <bpmn:message id="Message_1dr71re" name="resultSingleMedicDataSharingMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="executeDataSharing"> - <bpmndi:BPMNEdge id="Flow_12yiiun_di" bpmnElement="Flow_12yiiun"> - <di:waypoint x="1690" y="212" /> - <di:waypoint x="1770" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0jepala_di" bpmnElement="Flow_0jepala"> - <di:waypoint x="1515" y="212" /> - <di:waypoint x="1590" y="212" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_09yooed_di" bpmnElement="Flow_09yooed"> <di:waypoint x="1490" y="130" /> <di:waypoint x="1490" y="187" /> @@ -141,20 +133,16 @@ </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1ecoehc_di" bpmnElement="Flow_1ecoehc"> <di:waypoint x="660" y="212" /> - <di:waypoint x="710" y="212" /> + <di:waypoint x="720" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0qsitvp_di" bpmnElement="Flow_0qsitvp"> - <di:waypoint x="810" y="212" /> + <di:waypoint x="820" y="212" /> <di:waypoint x="880" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1kp6eaq_di" bpmnElement="Flow_1kp6eaq"> <di:waypoint x="500" y="212" /> <di:waypoint x="560" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0ascyjc_di" bpmnElement="SequenceFlow_0ascyjc"> - <di:waypoint x="2040" y="212" /> - <di:waypoint x="2122" y="212" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kzp6tl_di" bpmnElement="SequenceFlow_0kzp6tl"> <di:waypoint x="1217" y="315" /> <di:waypoint x="1217" y="237" /> @@ -174,10 +162,6 @@ <dc:Bounds x="1088" y="195" width="21" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_04ouilq_di" bpmnElement="SequenceFlow_04ouilq"> - <di:waypoint x="1870" y="212" /> - <di:waypoint x="1940" y="212" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1etju4m_di" bpmnElement="SequenceFlow_1etju4m"> <di:waypoint x="340" y="212" /> <di:waypoint x="400" y="212" /> @@ -190,9 +174,22 @@ <di:waypoint x="980" y="212" /> <di:waypoint x="1032" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> - <dc:Bounds x="1770" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_08925ay_di" bpmnElement="Flow_08925ay"> + <di:waypoint x="1870" y="212" /> + <di:waypoint x="1940" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1pgebfo_di" bpmnElement="Flow_1pgebfo"> + <di:waypoint x="1515" y="212" /> + <di:waypoint x="1600" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1pzik8k_di" bpmnElement="Flow_1pzik8k"> + <di:waypoint x="1700" y="212" /> + <di:waypoint x="1770" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1611vr6_di" bpmnElement="Flow_1611vr6"> + <di:waypoint x="2040" y="212" /> + <di:waypoint x="2122" y="212" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkDataSharingRequest"> <dc:Bounds x="400" y="172" width="100" height="80" /> </bpmndi:BPMNShape> @@ -208,7 +205,7 @@ <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> <dc:Bounds x="2122" y="194" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2096" y="237" width="90" height="14" /> + <dc:Bounds x="2105" y="237" width="72" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0bq7zdz_di" bpmnElement="ExclusiveGateway_0bq7zdz" isMarkerVisible="true"> @@ -220,18 +217,12 @@ <bpmndi:BPMNShape id="ExclusiveGateway_0lecmy5_di" bpmnElement="ExclusiveGateway_0lecmy5" isMarkerVisible="true"> <dc:Bounds x="1192" y="187" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="generateBloomFilters"> + <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="translateWithRbfGeneration"> <dc:Bounds x="1440" y="50" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> - <dc:Bounds x="1940" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0u5pb4i_di" bpmnElement="executeQueries"> <dc:Bounds x="880" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1ok9q8j_di" bpmnElement="addIdSelectionIfMissing"> - <dc:Bounds x="710" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1vlv5ud_di" bpmnElement="extractQueries"> <dc:Bounds x="560" y="172" width="100" height="80" /> </bpmndi:BPMNShape> @@ -244,12 +235,21 @@ <bpmndi:BPMNShape id="Gateway_13kxug8_di" bpmnElement="Gateway_13kxug8" isMarkerVisible="true"> <dc:Bounds x="1465" y="187" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1mdgvqk_di" bpmnElement="Activity_0wzh75y"> - <dc:Bounds x="1590" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> <dc:Bounds x="330" y="80" width="267" height="56" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1ok9q8j_di" bpmnElement="addIdSelectionIfMissing"> + <dc:Bounds x="720" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> + <dc:Bounds x="1600" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResultSets"> + <dc:Bounds x="1770" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1mdgvqk_di" bpmnElement="storeResultSets"> + <dc:Bounds x="1940" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> <di:waypoint x="455" y="172" /> <di:waypoint x="460" y="136" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn index 7f706457..940f3ac0 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn @@ -25,7 +25,7 @@ <bpmn:outgoing>Flow_1lw96cm</bpmn:outgoing> <bpmn:multiInstanceLoopCharacteristics camunda:collection="${targets.entries}" camunda:elementVariable="target" /> </bpmn:sendTask> - <bpmn:intermediateCatchEvent id="receiveFinalResultFromTtp" name="receive final result from TTP"> + <bpmn:intermediateCatchEvent id="receiveFinalResultFromTtp" name="receive multi MeDIC results from TTP"> <bpmn:incoming>Flow_1q5jnli</bpmn:incoming> <bpmn:outgoing>Flow_1gf3n6o</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_0ox92uc" messageRef="Message_1a3ewlk" /> @@ -40,8 +40,8 @@ <bpmn:outgoing>Flow_1q5jnli</bpmn:outgoing> <bpmn:outgoing>Flow_1harl90</bpmn:outgoing> </bpmn:eventBasedGateway> - <bpmn:serviceTask id="checkFinalResult" name="check final result" camunda:class="org.highmed.dsf.bpe.service.CheckMultiMedicResults"> - <bpmn:incoming>Flow_1gf3n6o</bpmn:incoming> + <bpmn:serviceTask id="checkResultSets" name="check result sets" camunda:class="org.highmed.dsf.bpe.service.CheckMedicMultiMedicResultSets"> + <bpmn:incoming>Flow_025quhl</bpmn:incoming> <bpmn:outgoing>Flow_0rwo9pn</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="handleError" name="handle error" camunda:class="org.highmed.dsf.bpe.service.HandleErrorMultiMedicResults"> @@ -49,18 +49,18 @@ <bpmn:outgoing>Flow_1s74o06</bpmn:outgoing> </bpmn:serviceTask> <bpmn:exclusiveGateway id="Gateway_0nlbalq"> - <bpmn:incoming>Flow_0rwo9pn</bpmn:incoming> <bpmn:incoming>Flow_1s74o06</bpmn:incoming> + <bpmn:incoming>Flow_1rnnd6d</bpmn:incoming> <bpmn:outgoing>Flow_0amk6ah</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:endEvent id="EndEvent" name="success"> <bpmn:incoming>Flow_0amk6ah</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="Flow_1q5jnli" sourceRef="Gateway_160gkf1" targetRef="receiveFinalResultFromTtp" /> - <bpmn:sequenceFlow id="Flow_1gf3n6o" sourceRef="receiveFinalResultFromTtp" targetRef="checkFinalResult" /> + <bpmn:sequenceFlow id="Flow_1gf3n6o" sourceRef="receiveFinalResultFromTtp" targetRef="temporarilyStoreMultiMeDICresults" /> <bpmn:sequenceFlow id="Flow_1harl90" sourceRef="Gateway_160gkf1" targetRef="receiveErrorFromTtp" /> <bpmn:sequenceFlow id="Flow_1id9r0h" sourceRef="receiveErrorFromTtp" targetRef="handleError" /> - <bpmn:sequenceFlow id="Flow_0rwo9pn" sourceRef="checkFinalResult" targetRef="Gateway_0nlbalq" /> + <bpmn:sequenceFlow id="Flow_0rwo9pn" sourceRef="checkResultSets" targetRef="storeResultSets" /> <bpmn:sequenceFlow id="Flow_1s74o06" sourceRef="handleError" targetRef="Gateway_0nlbalq" /> <bpmn:sequenceFlow id="Flow_0amk6ah" sourceRef="Gateway_0nlbalq" targetRef="EndEvent" /> <bpmn:sequenceFlow id="Flow_1lw96cm" sourceRef="sendRequestToMedics" targetRef="Gateway_160gkf1" /> @@ -82,6 +82,16 @@ <bpmn:incoming>Flow_06otxko</bpmn:incoming> <bpmn:outgoing>Flow_0cx3xe1</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:serviceTask id="temporarilyStoreMultiMeDICresults" name="download result sets" camunda:class="org.highmed.dsf.bpe.service.DownloadMultiMedicResultSets"> + <bpmn:incoming>Flow_1gf3n6o</bpmn:incoming> + <bpmn:outgoing>Flow_025quhl</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_025quhl" sourceRef="temporarilyStoreMultiMeDICresults" targetRef="checkResultSets" /> + <bpmn:sequenceFlow id="Flow_1rnnd6d" sourceRef="storeResultSets" targetRef="Gateway_0nlbalq" /> + <bpmn:serviceTask id="storeResultSets" name="store result sets" camunda:class="org.highmed.dsf.bpe.service.StoreMultiMedicResultSets"> + <bpmn:incoming>Flow_0rwo9pn</bpmn:incoming> + <bpmn:outgoing>Flow_1rnnd6d</bpmn:outgoing> + </bpmn:serviceTask> </bpmn:process> <bpmn:message id="Message_1oeg3sw" name="requestDataSharingMessage" /> <bpmn:message id="Message_1a3ewlk" name="resultMultiMedicDataSharingMessage" /> @@ -89,6 +99,15 @@ <bpmn:message id="Message_0a5typw" name="computeDataSharingMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="requestDataSharing"> + <bpmndi:BPMNEdge id="Flow_1rnnd6d_di" bpmnElement="Flow_1rnnd6d"> + <di:waypoint x="1540" y="140" /> + <di:waypoint x="1600" y="140" /> + <di:waypoint x="1600" y="202" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_025quhl_di" bpmnElement="Flow_025quhl"> + <di:waypoint x="1220" y="140" /> + <di:waypoint x="1280" y="140" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_18ie7l6_di" bpmnElement="Flow_18ie7l6"> <di:waypoint x="688" y="227" /> <di:waypoint x="760" y="227" /> @@ -98,22 +117,21 @@ <di:waypoint x="915" y="227" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0amk6ah_di" bpmnElement="Flow_0amk6ah"> - <di:waypoint x="1345" y="220" /> - <di:waypoint x="1412" y="220" /> + <di:waypoint x="1625" y="227" /> + <di:waypoint x="1682" y="227" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1s74o06_di" bpmnElement="Flow_1s74o06"> - <di:waypoint x="1250" y="300" /> - <di:waypoint x="1320" y="300" /> - <di:waypoint x="1320" y="245" /> + <di:waypoint x="1220" y="300" /> + <di:waypoint x="1600" y="300" /> + <di:waypoint x="1600" y="252" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0rwo9pn_di" bpmnElement="Flow_0rwo9pn"> - <di:waypoint x="1250" y="140" /> - <di:waypoint x="1320" y="140" /> - <di:waypoint x="1320" y="195" /> + <di:waypoint x="1380" y="140" /> + <di:waypoint x="1440" y="140" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1id9r0h_di" bpmnElement="Flow_1id9r0h"> <di:waypoint x="1058" y="300" /> - <di:waypoint x="1150" y="300" /> + <di:waypoint x="1120" y="300" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1harl90_di" bpmnElement="Flow_1harl90"> <di:waypoint x="940" y="252" /> @@ -122,7 +140,7 @@ </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1gf3n6o_di" bpmnElement="Flow_1gf3n6o"> <di:waypoint x="1058" y="140" /> - <di:waypoint x="1150" y="140" /> + <di:waypoint x="1120" y="140" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1q5jnli_di" bpmnElement="Flow_1q5jnli"> <di:waypoint x="940" y="202" /> @@ -156,7 +174,7 @@ <bpmndi:BPMNShape id="Event_0bxieya_di" bpmnElement="receiveFinalResultFromTtp"> <dc:Bounds x="1022" y="122" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1002" y="86" width="76" height="27" /> + <dc:Bounds x="1005" y="80" width="70" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_0jt3zpu_di" bpmnElement="receiveErrorFromTtp"> @@ -168,19 +186,13 @@ <bpmndi:BPMNShape id="Gateway_160gkf1_di" bpmnElement="Gateway_160gkf1"> <dc:Bounds x="915" y="202" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1sx3j2g_di" bpmnElement="checkFinalResult"> - <dc:Bounds x="1150" y="100" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0t7mxic_di" bpmnElement="handleError"> - <dc:Bounds x="1150" y="260" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0nlbalq_di" bpmnElement="Gateway_0nlbalq" isMarkerVisible="true"> - <dc:Bounds x="1295" y="195" width="50" height="50" /> + <dc:Bounds x="1575" y="202" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1vgrk6d_di" bpmnElement="EndEvent"> - <dc:Bounds x="1412" y="202" width="36" height="36" /> + <dc:Bounds x="1682" y="209" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1410" y="245" width="40" height="14" /> + <dc:Bounds x="1680" y="252" width="40" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1c9txf8_di" bpmnElement="sendCorreltationKeysToTTP"> @@ -192,6 +204,18 @@ <bpmndi:BPMNShape id="Activity_1wzn9by_di" bpmnElement="selectRequestTargetsAndGenerateKeys"> <dc:Bounds x="470" y="187" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1sx3j2g_di" bpmnElement="checkResultSets"> + <dc:Bounds x="1280" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_09oplxx_di" bpmnElement="temporarilyStoreMultiMeDICresults"> + <dc:Bounds x="1120" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1a9tjil_di" bpmnElement="storeResultSets"> + <dc:Bounds x="1440" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0t7mxic_di" bpmnElement="handleError"> + <dc:Bounds x="1120" y="260" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> From a1c6f67266367532e71c9ebdd7dcb2206488ac53 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Thu, 11 Mar 2021 14:22:38 +0100 Subject: [PATCH 034/125] decrypt results sets --- .../dsf/bpe/message/SendMedicRequest.java | 5 +- .../dsf/bpe/message/SendTtpRequest.java | 18 ++-- .../dsf/bpe/service/CreatePseudonym.java | 25 ----- .../service/DownloadDataSharingResources.java | 12 +-- .../DownloadResearchStudyResource.java | 15 +++ ...eudonymizeResultSetsWithRecordLinkage.java | 36 +++++-- .../dsf/bpe/service/SelectRequestTargets.java | 9 +- .../TranslateMultiMedicResultSets.java | 97 +++++++++++++++++++ ...TranslateSingleMedicResultSetsWithRbf.java | 11 ++- .../bpe/spring/config/DataSharingConfig.java | 8 +- .../config/DataSharingSerializerConfig.java | 7 -- .../dsf/bpe/variable/SecretKeySerializer.java | 72 -------------- .../dsf/bpe/variable/SecretKeyValues.java | 55 ----------- .../resources/bpe/executeDataSharing.bpmn | 60 ++++++------ .../resources/bpe/requestDataSharing.bpmn | 52 ++++++---- 15 files changed, 234 insertions(+), 248 deletions(-) delete mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CreatePseudonym.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java delete mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeySerializer.java delete mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyValues.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java index 27658a04..da8eb172 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java @@ -15,6 +15,7 @@ import java.util.stream.Stream; import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.variable.BloomFilterConfig; @@ -56,9 +57,9 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut ParameterComponent inputNeedsRecordLinkage = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); - SecretKey mdatKey = (SecretKey) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); + byte[] mdatKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); ParameterComponent inputMdatKey = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY, mdatKey.getEncoded()); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY, mdatKey); if (needsRecordLinkage) { diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java index bd5fd0eb..28c89dd5 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java @@ -2,7 +2,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; @@ -19,7 +19,6 @@ import org.highmed.dsf.fhir.variables.Targets; import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.r4.model.ResearchStudy; import org.hl7.fhir.r4.model.Task; import ca.uhn.fhir.context.FhirContext; @@ -41,8 +40,9 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); Task.ParameterComponent inputNeedsRecordLinkage = getRecordLinkageComponent(needsRecordLinkage); - ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); - Task.ParameterComponent inputResearchStudy = getInputResearchStudyIdentifierComponent(researchStudy); + String researchStudyIdentifier = (String) execution + .getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER); + Task.ParameterComponent inputResearchStudy = getInputResearchStudyIdentifierComponent(researchStudyIdentifier); return Stream.concat(inputTargets, Stream.of(inputNeedsRecordLinkage, inputResearchStudy)); } @@ -59,14 +59,10 @@ private Task.ParameterComponent getRecordLinkageComponent(boolean needsRecordLin CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); } - private Task.ParameterComponent getInputResearchStudyIdentifierComponent(ResearchStudy researchStudy) + private Task.ParameterComponent getInputResearchStudyIdentifierComponent(String researchStudyIdentifierValue) { - Identifier identifier = researchStudy.getIdentifier().stream() - .filter(i -> i.getSystem().equals(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)).findFirst() - .orElseThrow(() -> new IllegalArgumentException("Identifier is not set in research study with id='" - + researchStudy.getId() + "', this error should have been caught by resource validation")); - - Reference reference = new Reference().setIdentifier(identifier); + Reference reference = new Reference().setIdentifier(new Identifier().setValue(researchStudyIdentifierValue) + .setSystem(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)); return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_IDENTIFIER, reference); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CreatePseudonym.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CreatePseudonym.java deleted file mode 100644 index 3e710eac..00000000 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CreatePseudonym.java +++ /dev/null @@ -1,25 +0,0 @@ -package org.highmed.dsf.bpe.service; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; -import org.highmed.dsf.fhir.task.TaskHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class CreatePseudonym extends AbstractServiceDelegate -{ - - private static final Logger logger = LoggerFactory.getLogger(CreatePseudonym.class); - - public CreatePseudonym(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) - { - super(clientProvider, taskHelper); - } - - @Override - protected void doExecute(DelegateExecution execution) - { - logger.info(this.getClass().getName() + " doExecute called"); - } -} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java index aa826bd3..802006bd 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java @@ -3,7 +3,6 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; @@ -29,7 +28,6 @@ import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.highmed.dsf.bpe.variable.BloomFilterConfigValues; -import org.highmed.dsf.bpe.variable.SecretKeyValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -90,8 +88,8 @@ protected void doExecute(DelegateExecution execution) boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); - SecretKey mdatKey = getMdatKey(task); - execution.setVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY, SecretKeyValues.create(mdatKey)); + byte[] mdatKey = getMdatKey(task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY, mdatKey); if (needsRecordLinkage) { @@ -199,15 +197,13 @@ private boolean getNeedsRecordLinkageCheck(Task task) + task.getId() + "', this error should " + "have been caught by resource validation")); } - private SecretKey getMdatKey(Task task) + private byte[] getMdatKey(Task task) { - byte[] encodedKey = getTaskHelper() + return getTaskHelper() .getFirstInputParameterByteValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY) .orElseThrow(() -> new IllegalArgumentException("mdat aes key is not set in task with id='" + task.getId() + "', this error should " + "have been caught by resource validation")); - - return new SecretKeySpec(encodedKey, 0, encodedKey.length, "AES"); } private BloomFilterConfig getBloomFilterConfig(Task task) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java index 3166ebaf..4cc8adf4 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -5,10 +5,12 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; import java.util.Objects; @@ -21,6 +23,7 @@ import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.fhir.client.FhirWebserviceClient; import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResearchStudy; import org.hl7.fhir.r4.model.Task; @@ -56,12 +59,14 @@ protected void doExecute(DelegateExecution execution) IdType researchStudyId = getResearchStudyId(task); ResearchStudy researchStudy = getResearchStudy(researchStudyId, client); + String researchStudyIdentifier = getResearchStudyIdentifier(researchStudy); boolean needsConsentCheck = getNeedsConsentCheck(task); boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY, researchStudy); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK, needsConsentCheck); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER, researchStudyIdentifier); execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER, organizationProvider.getLocalIdentifierValue()); @@ -111,4 +116,14 @@ private boolean getNeedsRecordLinkageCheck(Task task) () -> new IllegalArgumentException("NeedsRecordLinkage boolean is not set in task with id='" + task.getId() + "', this error should " + "have been caught by resource validation")); } + + private String getResearchStudyIdentifier(ResearchStudy researchStudy) + { + Identifier identifier = researchStudy.getIdentifier().stream() + .filter(i -> i.getSystem().equals(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)).findFirst() + .orElseThrow(() -> new IllegalArgumentException("Identifier is not set in research study with id='" + + researchStudy.getId() + "', this error should have been caught by resource validation")); + + return identifier.getValue(); + } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java index aaaf3ca4..7cf9e0ee 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java @@ -6,6 +6,7 @@ import java.security.NoSuchAlgorithmException; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @@ -38,10 +39,11 @@ import org.highmed.pseudonymization.translation.ResultSetTranslatorToMedicImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; import com.fasterxml.jackson.databind.ObjectMapper; -public class PseudonymizeResultSetsWithRecordLinkage extends AbstractServiceDelegate +public class PseudonymizeResultSetsWithRecordLinkage extends AbstractServiceDelegate implements InitializingBean { private static final Logger logger = LoggerFactory.getLogger(PseudonymizeResultSetsWithRecordLinkage.class); @@ -59,6 +61,7 @@ public PseudonymizeResultSetsWithRecordLinkage(FhirWebserviceClientProvider clie public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); + Objects.requireNonNull(psnObjectMapper, "psnObjectMapper"); } @Override @@ -119,20 +122,37 @@ private QueryResult translateMatchAndPseudonymize(ResultSetTranslatorFromMedic t private List<List<PersonWithMdat>> translateFromMedicResultSets(ResultSetTranslatorFromMedic translator, List<QueryResult> results) { - return results.stream().map(r -> translateFromMedic(translator, r)).collect(Collectors.toList()); + return results.stream().map(r -> translateFromMedicResultSet(translator, r)).collect(Collectors.toList()); } - private List<PersonWithMdat> translateFromMedic(ResultSetTranslatorFromMedic translator, QueryResult result) + private List<PersonWithMdat> translateFromMedicResultSet(ResultSetTranslatorFromMedic translator, + QueryResult toTranslate) { - return translator.translate(result.getOrganizationIdentifier(), result.getResultSet()); + try + { + return translator.translate(toTranslate.getOrganizationIdentifier(), toTranslate.getResultSet()); + } + catch (Exception e) + { + logger.warn("Error while translating ResultSet: " + e.getMessage(), e); + throw e; + } } - private ResultSet translateToMedicResultSet(ResultSet initialResultSet, ResultSetTranslatorToMedic translator, + private ResultSet translateToMedicResultSet(ResultSet toTranslate, ResultSetTranslatorToMedic translator, List<PseudonymizedPersonWithMdat> pseudonymizedPersons) { - Meta meta = initialResultSet.getMeta() == null ? new Meta("", "", "", "", "", "") : initialResultSet.getMeta(); - List<Column> columns = initialResultSet.getColumns(); - return translator.translate(meta, columns, pseudonymizedPersons); + try + { + Meta meta = toTranslate.getMeta() == null ? new Meta("", "", "", "", "", "") : toTranslate.getMeta(); + List<Column> columns = toTranslate.getColumns(); + return translator.translate(meta, columns, pseudonymizedPersons); + } + catch (Exception e) + { + logger.warn("Error while translating ResultSet: " + e.getMessage(), e); + throw e; + } } private ResultSetTranslatorFromMedic createResultSetTranslatorFromMedic() diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index 51581342..95db487a 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -24,7 +24,6 @@ import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.highmed.dsf.bpe.variable.BloomFilterConfigValues; -import org.highmed.dsf.bpe.variable.SecretKeyValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -79,8 +78,7 @@ protected void doExecute(DelegateExecution execution) throws Exception execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(getMedicTargets(researchStudy))); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(getTtpTarget(researchStudy))); - - execution.setVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY, SecretKeyValues.create(createMdatKey())); + execution.setVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY, AesGcmUtil.generateAES256Key().getEncoded()); Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); if (Boolean.TRUE.equals(needsRecordLinkage)) @@ -115,9 +113,4 @@ private BloomFilterConfig createBloomFilterConfig() return new BloomFilterConfig(random.nextLong(), hmacSha2Generator.generateKey(), hmacSha3Generator.generateKey()); } - - private SecretKey createMdatKey() throws NoSuchAlgorithmException - { - return AesGcmUtil.generateAES256Key(); - } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java new file mode 100644 index 00000000..125f8147 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java @@ -0,0 +1,97 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.openehr.model.structure.ResultSet; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromTtp; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromTtpImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class TranslateMultiMedicResultSets extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(TranslateMultiMedicResultSets.class); + + private final ObjectMapper openEhrObjectMapper; + + public TranslateMultiMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ObjectMapper openEhrObjectMapper) + { + super(clientProvider, taskHelper); + this.openEhrObjectMapper = openEhrObjectMapper; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + Objects.requireNonNull(openEhrObjectMapper, "openEhrObjectMapper"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + String researchStudyIdentifier = (String) execution + .getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER); + SecretKey mdatKey = getMdatKey(execution); + ResultSetTranslatorFromTtp translator = createResultSetTranslator(researchStudyIdentifier, mdatKey); + + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + QueryResults decryptedResults = decryptResults(results, translator); + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(decryptedResults)); + } + + protected SecretKey getMdatKey(DelegateExecution execution) + { + byte[] encodedKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); + return new SecretKeySpec(encodedKey, "AES"); + } + + protected ResultSetTranslatorFromTtp createResultSetTranslator(String researchStudyIdentifier, + SecretKey researchStudyKey) + { + return new ResultSetTranslatorFromTtpImpl(researchStudyIdentifier, researchStudyKey, openEhrObjectMapper); + } + + private QueryResults decryptResults(QueryResults results, ResultSetTranslatorFromTtp translator) + { + List<QueryResult> translatedResults = results + .getResults().stream().map(result -> QueryResult.idResult(result.getOrganizationIdentifier(), + result.getCohortId(), translate(translator, result.getResultSet()))) + .collect(Collectors.toList()); + + return new QueryResults(translatedResults); + } + + private ResultSet translate(ResultSetTranslatorFromTtp translator, ResultSet toTranslate) + { + try + { + return translator.translate(toTranslate); + } + catch (Exception e) + { + logger.warn("Error while translating ResultSet: " + e.getMessage(), e); + throw e; + } + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java index dde848ae..9dc4fe6c 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java @@ -13,6 +13,7 @@ import java.util.stream.Collectors; import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -80,7 +81,7 @@ protected void doExecute(DelegateExecution execution) throws Exception { String organizationIdentifier = organizationProvider.getLocalIdentifierValue(); String researchStudyIdentifier = getResearchStudyIdentifier(execution); - SecretKey mdatKey = (SecretKey) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); + SecretKey mdatKey = getMdatKey(execution); BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); @@ -105,6 +106,12 @@ protected String getResearchStudyIdentifier(DelegateExecution execution) .getValue(); } + protected SecretKey getMdatKey(DelegateExecution execution) + { + byte[] encodedKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); + return new SecretKeySpec(encodedKey, "AES"); + } + protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, String researchStudyIdentifier, SecretKey mdatKey, BloomFilterConfig bloomFilterConfig) throws NoSuchAlgorithmException @@ -146,4 +153,6 @@ private ResultSet translate(ResultSetTranslatorToTtp resultSetTranslator, Result throw e; } } + + } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index fc8594b4..157b9a9a 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -27,6 +27,7 @@ import org.highmed.dsf.bpe.service.StoreMultiMedicResultSets; import org.highmed.dsf.bpe.service.StoreSingleMedicResultSetLinks; import org.highmed.dsf.bpe.service.StoreSingleMedicResultSets; +import org.highmed.dsf.bpe.service.TranslateMultiMedicResultSets; import org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithRbf; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.group.GroupHelper; @@ -49,7 +50,6 @@ @Configuration public class DataSharingConfig { - @Autowired private FhirWebserviceClientProvider fhirClientProvider; @@ -110,6 +110,12 @@ public DownloadMultiMedicResultSets downloadMultiMedicResultSets() return new DownloadMultiMedicResultSets(fhirClientProvider, taskHelper, objectMapper); } + @Bean + public TranslateMultiMedicResultSets translateMultiMedicResultSets() + { + return new TranslateMultiMedicResultSets(fhirClientProvider, taskHelper, objectMapper); + } + @Bean public CheckMedicMultiMedicResultSets checkMedicMultiMedicResultSets() { diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java index e3757496..3ac056e3 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java @@ -3,7 +3,6 @@ import org.highmed.dsf.bpe.variable.BloomFilterConfigSerializer; import org.highmed.dsf.bpe.variable.QueryResultSerializer; import org.highmed.dsf.bpe.variable.QueryResultsSerializer; -import org.highmed.dsf.bpe.variable.SecretKeySerializer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -22,12 +21,6 @@ public BloomFilterConfigSerializer bloomFilterConfigSerializer() return new BloomFilterConfigSerializer(objectMapper); } - @Bean - public SecretKeySerializer secretKeySerializer() - { - return new SecretKeySerializer(objectMapper); - } - @Bean public QueryResultSerializer queryResultSerializer() { diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeySerializer.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeySerializer.java deleted file mode 100644 index 851da83c..00000000 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeySerializer.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.highmed.dsf.bpe.variable; - -import java.io.IOException; -import java.util.Objects; - -import javax.crypto.SecretKey; - -import org.camunda.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer; -import org.camunda.bpm.engine.impl.variable.serializer.ValueFields; -import org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl; -import org.highmed.dsf.bpe.variable.BloomFilterConfigValues.BloomFilterConfigValue; -import org.springframework.beans.factory.InitializingBean; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -public class SecretKeySerializer extends PrimitiveValueSerializer<SecretKeyValues.SecretKeyValue> - implements InitializingBean -{ - private final ObjectMapper objectMapper; - - public SecretKeySerializer(ObjectMapper objectMapper) - { - super(SecretKeyValues.VALUE_TYPE); - - this.objectMapper = objectMapper; - } - - @Override - public void afterPropertiesSet() throws Exception - { - Objects.requireNonNull(objectMapper, "objectMapper"); - } - - @Override - public void writeValue(SecretKeyValues.SecretKeyValue value, ValueFields valueFields) - { - SecretKey target = value.getValue(); - try - { - if (target != null) - valueFields.setByteArrayValue(objectMapper.writeValueAsBytes(target)); - } - catch (JsonProcessingException e) - { - throw new RuntimeException(e); - } - } - - @Override - public SecretKeyValues.SecretKeyValue convertToTypedValue(UntypedValueImpl untypedValue) - { - return SecretKeyValues.create((SecretKey) untypedValue.getValue()); - } - - @Override - public SecretKeyValues.SecretKeyValue readValue(ValueFields valueFields, boolean asTransientValue) - { - byte[] bytes = valueFields.getByteArrayValue(); - - try - { - SecretKey target = (bytes == null || bytes.length <= 0) ? null - : objectMapper.readValue(bytes, SecretKey.class); - return SecretKeyValues.create(target); - } - catch (IOException e) - { - throw new RuntimeException(e); - } - } -} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyValues.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyValues.java deleted file mode 100644 index 1d95d577..00000000 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyValues.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.highmed.dsf.bpe.variable; - -import java.util.Map; - -import javax.crypto.SecretKey; - -import org.camunda.bpm.engine.variable.impl.type.PrimitiveValueTypeImpl; -import org.camunda.bpm.engine.variable.impl.value.PrimitiveTypeValueImpl; -import org.camunda.bpm.engine.variable.type.PrimitiveValueType; -import org.camunda.bpm.engine.variable.value.PrimitiveValue; -import org.camunda.bpm.engine.variable.value.TypedValue; - -public class SecretKeyValues -{ - public static interface SecretKeyValue extends PrimitiveValue<SecretKey> - { - } - - private static class SecretKeyValueImpl extends PrimitiveTypeValueImpl<SecretKey> implements SecretKeyValue - { - private static final long serialVersionUID = 1L; - - public SecretKeyValueImpl(SecretKey value, PrimitiveValueType type) - { - super(value, type); - } - } - - public static class SecretKeyValueTypeImpl extends PrimitiveValueTypeImpl - { - private static final long serialVersionUID = 1L; - - private SecretKeyValueTypeImpl() - { - super(SecretKey.class); - } - - @Override - public TypedValue createValue(Object value, Map<String, Object> valueInfo) - { - return new SecretKeyValueImpl((SecretKey) value, VALUE_TYPE); - } - } - - public static final PrimitiveValueType VALUE_TYPE = new SecretKeyValueTypeImpl(); - - private SecretKeyValues() - { - } - - public static SecretKeyValue create(SecretKey value) - { - return new SecretKeyValueImpl(value, VALUE_TYPE); - } -} diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index d048723a..b6d8b890 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -53,7 +53,7 @@ <bpmn:outgoing>Flow_14nlfvk</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0kzp6tl" sourceRef="filterByConsent" targetRef="ExclusiveGateway_0lecmy5" /> - <bpmn:serviceTask id="translateWithRbfGeneration" name="translate with RBF generation" camunda:class="org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithRbf"> + <bpmn:serviceTask id="translateWithRbfGeneration" name="translate with RBF generation and encryption" camunda:class="org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithRbf"> <bpmn:incoming>Flow_0xt2bfn</bpmn:incoming> <bpmn:outgoing>Flow_09yooed</bpmn:outgoing> </bpmn:serviceTask> @@ -67,7 +67,7 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1kp6eaq" sourceRef="checkDataSharingRequest" targetRef="extractQueries" /> <bpmn:sequenceFlow id="Flow_0qsitvp" sourceRef="addIdSelectionIfMissing" targetRef="executeQueries" /> - <bpmn:serviceTask id="addIdSelectionIfMissing" name="Add id selection if missing" camunda:class="org.highmed.dsf.bpe.service.ModifyQueries"> + <bpmn:serviceTask id="addIdSelectionIfMissing" name="add id selection if missing" camunda:class="org.highmed.dsf.bpe.service.ModifyQueries"> <bpmn:incoming>Flow_1ecoehc</bpmn:incoming> <bpmn:outgoing>Flow_0qsitvp</bpmn:outgoing> </bpmn:serviceTask> @@ -111,6 +111,22 @@ <bpmn:message id="Message_1dr71re" name="resultSingleMedicDataSharingMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="executeDataSharing"> + <bpmndi:BPMNEdge id="Flow_1611vr6_di" bpmnElement="Flow_1611vr6"> + <di:waypoint x="2040" y="212" /> + <di:waypoint x="2122" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1pzik8k_di" bpmnElement="Flow_1pzik8k"> + <di:waypoint x="1700" y="212" /> + <di:waypoint x="1770" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1pgebfo_di" bpmnElement="Flow_1pgebfo"> + <di:waypoint x="1515" y="212" /> + <di:waypoint x="1600" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_08925ay_di" bpmnElement="Flow_08925ay"> + <di:waypoint x="1870" y="212" /> + <di:waypoint x="1940" y="212" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_09yooed_di" bpmnElement="Flow_09yooed"> <di:waypoint x="1490" y="130" /> <di:waypoint x="1490" y="187" /> @@ -174,22 +190,9 @@ <di:waypoint x="980" y="212" /> <di:waypoint x="1032" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_08925ay_di" bpmnElement="Flow_08925ay"> - <di:waypoint x="1870" y="212" /> - <di:waypoint x="1940" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1pgebfo_di" bpmnElement="Flow_1pgebfo"> - <di:waypoint x="1515" y="212" /> - <di:waypoint x="1600" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1pzik8k_di" bpmnElement="Flow_1pzik8k"> - <di:waypoint x="1700" y="212" /> - <di:waypoint x="1770" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1611vr6_di" bpmnElement="Flow_1611vr6"> - <di:waypoint x="2040" y="212" /> - <di:waypoint x="2122" y="212" /> - </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResultSets"> + <dc:Bounds x="1770" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkDataSharingRequest"> <dc:Bounds x="400" y="172" width="100" height="80" /> </bpmndi:BPMNShape> @@ -220,9 +223,15 @@ <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="translateWithRbfGeneration"> <dc:Bounds x="1440" y="50" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> + <dc:Bounds x="1600" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0u5pb4i_di" bpmnElement="executeQueries"> <dc:Bounds x="880" y="172" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1ok9q8j_di" bpmnElement="addIdSelectionIfMissing"> + <dc:Bounds x="720" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1vlv5ud_di" bpmnElement="extractQueries"> <dc:Bounds x="560" y="172" width="100" height="80" /> </bpmndi:BPMNShape> @@ -235,21 +244,12 @@ <bpmndi:BPMNShape id="Gateway_13kxug8_di" bpmnElement="Gateway_13kxug8" isMarkerVisible="true"> <dc:Bounds x="1465" y="187" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> - <dc:Bounds x="330" y="80" width="267" height="56" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1ok9q8j_di" bpmnElement="addIdSelectionIfMissing"> - <dc:Bounds x="720" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> - <dc:Bounds x="1600" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResultSets"> - <dc:Bounds x="1770" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1mdgvqk_di" bpmnElement="storeResultSets"> <dc:Bounds x="1940" y="172" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> + <dc:Bounds x="330" y="80" width="267" height="56" /> + </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> <di:waypoint x="455" y="172" /> <di:waypoint x="460" y="136" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn index 940f3ac0..f761b793 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn @@ -41,7 +41,7 @@ <bpmn:outgoing>Flow_1harl90</bpmn:outgoing> </bpmn:eventBasedGateway> <bpmn:serviceTask id="checkResultSets" name="check result sets" camunda:class="org.highmed.dsf.bpe.service.CheckMedicMultiMedicResultSets"> - <bpmn:incoming>Flow_025quhl</bpmn:incoming> + <bpmn:incoming>Flow_1m59ov0</bpmn:incoming> <bpmn:outgoing>Flow_0rwo9pn</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="handleError" name="handle error" camunda:class="org.highmed.dsf.bpe.service.HandleErrorMultiMedicResults"> @@ -86,12 +86,17 @@ <bpmn:incoming>Flow_1gf3n6o</bpmn:incoming> <bpmn:outgoing>Flow_025quhl</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_025quhl" sourceRef="temporarilyStoreMultiMeDICresults" targetRef="checkResultSets" /> + <bpmn:sequenceFlow id="Flow_025quhl" sourceRef="temporarilyStoreMultiMeDICresults" targetRef="translateWithDecryption" /> <bpmn:sequenceFlow id="Flow_1rnnd6d" sourceRef="storeResultSets" targetRef="Gateway_0nlbalq" /> <bpmn:serviceTask id="storeResultSets" name="store result sets" camunda:class="org.highmed.dsf.bpe.service.StoreMultiMedicResultSets"> <bpmn:incoming>Flow_0rwo9pn</bpmn:incoming> <bpmn:outgoing>Flow_1rnnd6d</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1m59ov0" sourceRef="translateWithDecryption" targetRef="checkResultSets" /> + <bpmn:serviceTask id="translateWithDecryption" name="translate with decryption" camunda:class="org.highmed.dsf.bpe.service.TranslateMultiMedicResultSets"> + <bpmn:incoming>Flow_025quhl</bpmn:incoming> + <bpmn:outgoing>Flow_1m59ov0</bpmn:outgoing> + </bpmn:serviceTask> </bpmn:process> <bpmn:message id="Message_1oeg3sw" name="requestDataSharingMessage" /> <bpmn:message id="Message_1a3ewlk" name="resultMultiMedicDataSharingMessage" /> @@ -99,10 +104,14 @@ <bpmn:message id="Message_0a5typw" name="computeDataSharingMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="requestDataSharing"> + <bpmndi:BPMNEdge id="Flow_1m59ov0_di" bpmnElement="Flow_1m59ov0"> + <di:waypoint x="1380" y="140" /> + <di:waypoint x="1440" y="140" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1rnnd6d_di" bpmnElement="Flow_1rnnd6d"> - <di:waypoint x="1540" y="140" /> - <di:waypoint x="1600" y="140" /> - <di:waypoint x="1600" y="202" /> + <di:waypoint x="1690" y="140" /> + <di:waypoint x="1730" y="140" /> + <di:waypoint x="1730" y="202" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_025quhl_di" bpmnElement="Flow_025quhl"> <di:waypoint x="1220" y="140" /> @@ -117,17 +126,17 @@ <di:waypoint x="915" y="227" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0amk6ah_di" bpmnElement="Flow_0amk6ah"> - <di:waypoint x="1625" y="227" /> - <di:waypoint x="1682" y="227" /> + <di:waypoint x="1755" y="227" /> + <di:waypoint x="1822" y="227" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1s74o06_di" bpmnElement="Flow_1s74o06"> <di:waypoint x="1220" y="300" /> - <di:waypoint x="1600" y="300" /> - <di:waypoint x="1600" y="252" /> + <di:waypoint x="1730" y="300" /> + <di:waypoint x="1730" y="252" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0rwo9pn_di" bpmnElement="Flow_0rwo9pn"> - <di:waypoint x="1380" y="140" /> - <di:waypoint x="1440" y="140" /> + <di:waypoint x="1540" y="140" /> + <di:waypoint x="1590" y="140" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1id9r0h_di" bpmnElement="Flow_1id9r0h"> <di:waypoint x="1058" y="300" /> @@ -186,13 +195,19 @@ <bpmndi:BPMNShape id="Gateway_160gkf1_di" bpmnElement="Gateway_160gkf1"> <dc:Bounds x="915" y="202" width="50" height="50" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1sx3j2g_di" bpmnElement="checkResultSets"> + <dc:Bounds x="1440" y="100" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0t7mxic_di" bpmnElement="handleError"> + <dc:Bounds x="1120" y="260" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0nlbalq_di" bpmnElement="Gateway_0nlbalq" isMarkerVisible="true"> - <dc:Bounds x="1575" y="202" width="50" height="50" /> + <dc:Bounds x="1705" y="202" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1vgrk6d_di" bpmnElement="EndEvent"> - <dc:Bounds x="1682" y="209" width="36" height="36" /> + <dc:Bounds x="1822" y="209" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1680" y="252" width="40" height="14" /> + <dc:Bounds x="1820" y="252" width="40" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1c9txf8_di" bpmnElement="sendCorreltationKeysToTTP"> @@ -204,17 +219,14 @@ <bpmndi:BPMNShape id="Activity_1wzn9by_di" bpmnElement="selectRequestTargetsAndGenerateKeys"> <dc:Bounds x="470" y="187" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1sx3j2g_di" bpmnElement="checkResultSets"> - <dc:Bounds x="1280" y="100" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_09oplxx_di" bpmnElement="temporarilyStoreMultiMeDICresults"> <dc:Bounds x="1120" y="100" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1a9tjil_di" bpmnElement="storeResultSets"> - <dc:Bounds x="1440" y="100" width="100" height="80" /> + <dc:Bounds x="1590" y="100" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0t7mxic_di" bpmnElement="handleError"> - <dc:Bounds x="1120" y="260" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_0lqm4kz_di" bpmnElement="translateWithDecryption"> + <dc:Bounds x="1280" y="100" width="100" height="80" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> From aea41865e976aaa8f41b25aa8422570cc6f3b643 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Thu, 11 Mar 2021 16:06:35 +0100 Subject: [PATCH 035/125] store final result set reference in initial request, code refactoring --- .../dsf/bpe/message/SendMedicRequest.java | 3 - .../dsf/bpe/message/SendMedicResults.java | 3 + .../service/CheckSingleMedicResultSets.java | 3 +- .../service/DownloadDataSharingResources.java | 3 - .../service/DownloadMultiMedicResultSets.java | 11 +-- .../DownloadResearchStudyResource.java | 3 - .../dsf/bpe/service/DownloadResultSets.java | 14 ++-- .../DownloadSingleMedicResultSets.java | 18 +---- .../dsf/bpe/service/ModifyQueries.java | 1 - ...eudonymizeResultSetsWithRecordLinkage.java | 1 - .../dsf/bpe/service/SelectRequestTargets.java | 1 - .../service/SelectResponseTargetMedic.java | 6 -- ...eMultiMedicResultSetsForLeadingMedic.java} | 4 +- ...toreMultiMedicResultSetsForResearcher.java | 63 +++++++++++++++++ .../dsf/bpe/service/StoreResultSets.java | 25 ++++++- .../StoreSingleMedicResultSetLinks.java | 5 -- .../TranslateMultiMedicResultSets.java | 4 +- ...TranslateSingleMedicResultSetsWithRbf.java | 9 ++- .../bpe/spring/config/DataSharingConfig.java | 13 +++- .../resources/bpe/computeDataSharing.bpmn | 2 +- .../resources/bpe/requestDataSharing.bpmn | 2 +- .../highmed-task-request-data-sharing.xml | 68 +++++++++++++++++++ ...ringFromMedicsViaMedic1ExampleStarter.java | 1 - 23 files changed, 189 insertions(+), 74 deletions(-) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{StoreMultiMedicResultSets.java => StoreMultiMedicResultSetsForLeadingMedic.java} (76%) create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForResearcher.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java index da8eb172..2455dcc3 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java @@ -14,9 +14,6 @@ import java.util.stream.Stream; -import javax.crypto.SecretKey; -import javax.crypto.spec.SecretKeySpec; - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java index 76786d2d..56fe032a 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java @@ -39,6 +39,9 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut return results.getResults().stream().map(this::toInput); } + /** + * @return the code system value that classifies the result set reference Task input + */ protected abstract String getResultSetReferenceCodeSystemValue(); private Task.ParameterComponent toInput(QueryResult result) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java index b60e8786..2a54899e 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java @@ -20,7 +20,6 @@ public class CheckSingleMedicResultSets extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(CheckSingleMedicResultSets.class); public CheckSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) @@ -56,7 +55,7 @@ private List<QueryResult> filterErroneousResultsAndAddErrorsToCurrentTaskOutputs return filteredResults; } - protected Optional<String> testResultAndReturnErrorReason(QueryResult result) + private Optional<String> testResultAndReturnErrorReason(QueryResult result) { // TODO: implement check // result size > 0 diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java index 802006bd..c2c9e1f5 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java @@ -21,9 +21,6 @@ import java.util.Objects; import java.util.stream.Collectors; -import javax.crypto.SecretKey; -import javax.crypto.spec.SecretKeySpec; - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.BloomFilterConfig; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java index 08a995d2..103e6205 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java @@ -1,7 +1,6 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE; import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_GROUP_ID; @@ -10,7 +9,6 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.variable.QueryResult; -import org.highmed.dsf.bpe.variable.QueryResults; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.hl7.fhir.r4.model.Reference; @@ -27,16 +25,9 @@ public DownloadMultiMedicResultSets(FhirWebserviceClientProvider clientProvider, } @Override - protected QueryResults getQueryResults(DelegateExecution execution) + protected List<QueryResult> getQueryResults(DelegateExecution execution) { Task task = getCurrentTaskFromExecutionVariables(); - List<QueryResult> results = getResults(task); - - return new QueryResults(results); - } - - private List<QueryResult> getResults(Task task) - { Reference requester = task.getRequester(); return getTaskHelper().getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java index 4cc8adf4..9411d61a 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -3,7 +3,6 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; @@ -16,8 +15,6 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variable.QueryResults; -import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java index 8f645851..891530f3 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java @@ -49,19 +49,23 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) { - QueryResults results = getQueryResults(execution); - + List<QueryResult> results = getQueryResults(execution); List<QueryResult> resultsWithResultSets = download(results); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(resultsWithResultSets))); } - protected abstract QueryResults getQueryResults(DelegateExecution execution); + /** + * @param execution + * The process execution environment + * @return The QueryResult objects containing the corresponding Binary result set url. + */ + protected abstract List<QueryResult> getQueryResults(DelegateExecution execution); - private List<QueryResult> download(QueryResults results) + private List<QueryResult> download(List<QueryResult> results) { - return results.getResults().stream().map(this::download).collect(Collectors.toList()); + return results.stream().map(this::download).collect(Collectors.toList()); } private QueryResult download(QueryResult result) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResultSets.java index 0e3df1f9..b029dfc3 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResultSets.java @@ -1,28 +1,14 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsBase.OPENEHR_MIMETYPE_JSON; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; -import java.io.IOException; -import java.io.InputStream; import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -import javax.ws.rs.core.MediaType; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.QueryResult; import org.highmed.dsf.bpe.variable.QueryResults; -import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; -import org.highmed.fhir.client.FhirWebserviceClient; -import org.highmed.openehr.model.structure.ResultSet; -import org.hl7.fhir.r4.model.IdType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import com.fasterxml.jackson.databind.ObjectMapper; @@ -35,8 +21,8 @@ public DownloadSingleMedicResultSets(FhirWebserviceClientProvider clientProvider } @Override - protected QueryResults getQueryResults(DelegateExecution execution) + protected List<QueryResult> getQueryResults(DelegateExecution execution) { - return (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + return ((QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS)).getResults(); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java index 2251d963..88bd43d7 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java @@ -18,7 +18,6 @@ public class ModifyQueries extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(ModifyQueries.class); private final String ehrIdColumnPath; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java index 7cf9e0ee..5fd16110 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java @@ -45,7 +45,6 @@ public class PseudonymizeResultSetsWithRecordLinkage extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(PseudonymizeResultSetsWithRecordLinkage.class); private final ObjectMapper psnObjectMapper; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index 95db487a..a4172588 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -17,7 +17,6 @@ import java.util.stream.Collectors; import javax.crypto.KeyGenerator; -import javax.crypto.SecretKey; import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.camunda.bpm.engine.delegate.DelegateExecution; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java index b8f2295d..9fbcce42 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java @@ -9,15 +9,9 @@ import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.TargetValues; -import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class SelectResponseTargetMedic extends AbstractServiceDelegate { - - private static final Logger logger = LoggerFactory.getLogger(SelectResponseTargetMedic.class); - public SelectResponseTargetMedic(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) { super(clientProvider, taskHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForLeadingMedic.java similarity index 76% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSets.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForLeadingMedic.java index 33f67dde..5088c0da 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForLeadingMedic.java @@ -8,9 +8,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class StoreMultiMedicResultSets extends StoreResultSets +public class StoreMultiMedicResultSetsForLeadingMedic extends StoreResultSets { - public StoreMultiMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public StoreMultiMedicResultSetsForLeadingMedic(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper, openEhrObjectMapper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForResearcher.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForResearcher.java new file mode 100644 index 00000000..8eff79d4 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForResearcher.java @@ -0,0 +1,63 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE; + +import java.util.List; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class StoreMultiMedicResultSetsForResearcher extends StoreResultSets +{ + public StoreMultiMedicResultSetsForResearcher(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ObjectMapper openEhrObjectMapper) + { + super(clientProvider, taskHelper, openEhrObjectMapper); + } + + @Override + protected String getSecurityIdentifier(DelegateExecution execution) + { + return (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER); + } + + @Override + protected List<QueryResult> postProcessStoredResults(List<QueryResult> storedResults, DelegateExecution execution) + { + Task currentTask = getCurrentTaskFromExecutionVariables(); + Task leadingTask = getLeadingTaskFromExecutionVariables(); + + storedResults.forEach(result -> addOutput(leadingTask, result)); + + // The current task finishes here but is not automatically set to completed + // because it is an additional task during the execution of the main process + currentTask.setStatus(Task.TaskStatus.COMPLETED); + getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().update(currentTask); + + return storedResults; + } + + private void addOutput(Task task, QueryResult result) + { + Task.TaskOutputComponent output = getTaskHelper().createOutput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE, + new Reference(result.getResultSetUrl())); + output.addExtension(createCohortIdExtension(result.getCohortId())); + task.addOutput(output); + } + + private Extension createCohortIdExtension(String cohortId) + { + return new Extension(EXTENSION_HIGHMED_GROUP_ID, new Reference(cohortId)); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java index 3b1b625d..dfd76187 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java @@ -58,19 +58,38 @@ protected void doExecute(DelegateExecution execution) throws Exception List<QueryResult> storedResults = results.getResults().stream() .map(result -> saveResultSetAsBinary(result, securityIdentifier)).collect(Collectors.toList()); + List<QueryResult> postProcessedResults = postProcessStoredResults(storedResults, execution); + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - QueryResultsValues.create(new QueryResults(storedResults))); + QueryResultsValues.create(new QueryResults(postProcessedResults))); } + /** + * @param execution + * The process execution environment + * @return Identifier of the organization that can read the stored binary resource from the local FHIR server + */ protected abstract String getSecurityIdentifier(DelegateExecution execution); - protected QueryResult saveResultSetAsBinary(QueryResult result, String securityIdentifier) + /** + * @param storedResults + * The QueryResult objects after storing them to the local FHIR server + * @param execution + * The process execution environment + * @return The QueryResult objects after post processing + */ + protected List<QueryResult> postProcessStoredResults(List<QueryResult> storedResults, DelegateExecution execution) + { + return storedResults; + } + + private QueryResult saveResultSetAsBinary(QueryResult result, String securityIdentifier) { String binaryId = save(result.getResultSet(), securityIdentifier); return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), binaryId); } - protected String save(ResultSet resultSet, String securityIdentifier) + private String save(ResultSet resultSet, String securityIdentifier) { byte[] content = serializeResultSet(resultSet); Reference securityContext = new Reference(); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSetLinks.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSetLinks.java index ef7d9682..0c38c268 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSetLinks.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSetLinks.java @@ -18,14 +18,9 @@ import org.highmed.dsf.fhir.task.TaskHelper; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class StoreSingleMedicResultSetLinks extends AbstractServiceDelegate { - - private static final Logger logger = LoggerFactory.getLogger(StoreSingleMedicResultSetLinks.class); - public StoreSingleMedicResultSetLinks(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) { super(clientProvider, taskHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java index 125f8147..9df7aa04 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java @@ -60,13 +60,13 @@ protected void doExecute(DelegateExecution execution) throws Exception execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(decryptedResults)); } - protected SecretKey getMdatKey(DelegateExecution execution) + private SecretKey getMdatKey(DelegateExecution execution) { byte[] encodedKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); return new SecretKeySpec(encodedKey, "AES"); } - protected ResultSetTranslatorFromTtp createResultSetTranslator(String researchStudyIdentifier, + private ResultSetTranslatorFromTtp createResultSetTranslator(String researchStudyIdentifier, SecretKey researchStudyKey) { return new ResultSetTranslatorFromTtpImpl(researchStudyIdentifier, researchStudyKey, openEhrObjectMapper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java index 9dc4fe6c..f7911219 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java @@ -96,7 +96,7 @@ protected void doExecute(DelegateExecution execution) throws Exception QueryResultsValues.create(new QueryResults(translatedResults))); } - protected String getResearchStudyIdentifier(DelegateExecution execution) + private String getResearchStudyIdentifier(DelegateExecution execution) { ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); return researchStudy.getIdentifier().stream() @@ -106,13 +106,13 @@ protected String getResearchStudyIdentifier(DelegateExecution execution) .getValue(); } - protected SecretKey getMdatKey(DelegateExecution execution) + private SecretKey getMdatKey(DelegateExecution execution) { byte[] encodedKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); return new SecretKeySpec(encodedKey, "AES"); } - protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, + private ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, String researchStudyIdentifier, SecretKey mdatKey, BloomFilterConfig bloomFilterConfig) throws NoSuchAlgorithmException { @@ -127,7 +127,7 @@ protected ResultSetTranslatorToTtp createResultSetTranslator(String organization ehrIdColumnPath, recordBloomFilterGenerator, masterPatientIndexClient); } - protected RecordBloomFilterGenerator createRecordBloomFilterGenerator(long permutationSeed, Key hmacSha2Key, + private RecordBloomFilterGenerator createRecordBloomFilterGenerator(long permutationSeed, Key hmacSha2Key, Key hmacSha3Key) { return new RecordBloomFilterGeneratorImpl(RBF_LENGTH, permutationSeed, FBF_WEIGHTS, FBF_LENGTHS, @@ -154,5 +154,4 @@ private ResultSet translate(ResultSetTranslatorToTtp resultSetTranslator, Result } } - } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index 157b9a9a..a26bdfa2 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -24,7 +24,8 @@ import org.highmed.dsf.bpe.service.SelectResponseTargetMedic; import org.highmed.dsf.bpe.service.SelectResponseTargetTtp; import org.highmed.dsf.bpe.service.StoreCorrelationKeys; -import org.highmed.dsf.bpe.service.StoreMultiMedicResultSets; +import org.highmed.dsf.bpe.service.StoreMultiMedicResultSetsForLeadingMedic; +import org.highmed.dsf.bpe.service.StoreMultiMedicResultSetsForResearcher; import org.highmed.dsf.bpe.service.StoreSingleMedicResultSetLinks; import org.highmed.dsf.bpe.service.StoreSingleMedicResultSets; import org.highmed.dsf.bpe.service.TranslateMultiMedicResultSets; @@ -123,9 +124,15 @@ public CheckMedicMultiMedicResultSets checkMedicMultiMedicResultSets() } @Bean - public StoreMultiMedicResultSets storeMultiMedicResultSets() + public StoreMultiMedicResultSetsForLeadingMedic storeMultiMedicResultSetsForLeadingMedic() { - return new StoreMultiMedicResultSets(fhirClientProvider, taskHelper, objectMapper); + return new StoreMultiMedicResultSetsForLeadingMedic(fhirClientProvider, taskHelper, objectMapper); + } + + @Bean + public StoreMultiMedicResultSetsForResearcher storeMultiMedicResultSetsForResearcher() + { + return new StoreMultiMedicResultSetsForResearcher(fhirClientProvider, taskHelper, objectMapper); } // diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn index bfd6514c..23c58b8e 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn @@ -115,7 +115,7 @@ <bpmn:incoming>Flow_0b5n9vc</bpmn:incoming> <bpmn:outgoing>Flow_0gx8n5k</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="storeResultSets" name="store result sets" camunda:class="org.highmed.dsf.bpe.service.StoreMultiMedicResultSets"> + <bpmn:serviceTask id="storeResultSets" name="store result sets" camunda:class="org.highmed.dsf.bpe.service.StoreMultiMedicResultSetsForLeadingMedic"> <bpmn:incoming>Flow_0mogdyo</bpmn:incoming> <bpmn:outgoing>Flow_0uaqn1r</bpmn:outgoing> </bpmn:serviceTask> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn index f761b793..8c59a399 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn @@ -88,7 +88,7 @@ </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_025quhl" sourceRef="temporarilyStoreMultiMeDICresults" targetRef="translateWithDecryption" /> <bpmn:sequenceFlow id="Flow_1rnnd6d" sourceRef="storeResultSets" targetRef="Gateway_0nlbalq" /> - <bpmn:serviceTask id="storeResultSets" name="store result sets" camunda:class="org.highmed.dsf.bpe.service.StoreMultiMedicResultSets"> + <bpmn:serviceTask id="storeResultSets" name="store result sets" camunda:class="org.highmed.dsf.bpe.service.StoreMultiMedicResultSetsForResearcher"> <bpmn:incoming>Flow_0rwo9pn</bpmn:incoming> <bpmn:outgoing>Flow_1rnnd6d</bpmn:outgoing> </bpmn:serviceTask> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml index 5f01406f..bf5bd972 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml @@ -188,5 +188,73 @@ <code value="boolean" /> </type> </element> + <element id="Task.output:multi-medic-result-set-reference"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.output" /> + <sliceName value="multi-medic-result-set-reference" /> + <min value="0" /> + <max value="*" /> + </element> + <element id="Task.output:multi-medic-result-set-reference.extension"> + <path value="Task.output.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + </element> + <element id="Task.output:multi-medic-result-set-reference.extension:group-id"> + <path value="Task.output.extension" /> + <sliceName value="group-id" /> + <min value="1" /> + <type> + <code value="Extension" /> + <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> + </type> + </element> + <element id="Task.output:multi-medic-result-set-reference.type"> + <path value="Task.output.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskOutputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.output:multi-medic-result-set-reference.type.coding"> + <path value="Task.output.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.output:multi-medic-result-set-reference.type.coding.system"> + <path value="Task.output.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.output:multi-medic-result-set-reference.type.coding.code"> + <path value="Task.output.type.coding.code" /> + <min value="1" /> + <fixedCode value="multi-medic-result-set-reference" /> + </element> + <element id="Task.output:multi-medic-result-set-reference.value[x]"> + <path value="Task.output.value[x]" /> + <type> + <code value="Reference" /> + <targetProfile value="http://hl7.org/fhir/StructureDefinition/Binary" /> + </type> + </element> + <element id="Task.output:multi-medic-result-set-reference.value[x].reference"> + <path value="Task.output.value[x].reference" /> + <min value="1" /> + </element> + <element id="Task.output:multi-medic-result-set-reference.value[x].identifier"> + <path value="Task.output.value[x].identifier" /> + <max value="0" /> + </element> </differential> </StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java index fcb000be..c4e0c411 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -138,7 +138,6 @@ private static Task createTask(ResearchStudy researchStudy) Task task = new Task(); task.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); - task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING); task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING); task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION); task.setStatus(TaskStatus.REQUESTED); From daf74951e9a1f74029d447b0bd1b2017a31c67b9 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 12 Mar 2021 14:27:21 +0100 Subject: [PATCH 036/125] distinction between data sharing with record linkage and without --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 3 - .../DownloadResearchStudyResource.java | 2 +- .../bpe/service/PseudonymizeResultSets.java | 190 ++++++++++++++++++ ...eudonymizeResultSetsWithRecordLinkage.java | 165 +-------------- ...onymizeResultSetsWithoutRecordLinkage.java | 24 +++ .../service/SelectResponseTargetMedic.java | 2 +- .../dsf/bpe/service/StoreCorrelationKeys.java | 2 +- ...reMultiMedicResultSetsForLeadingMedic.java | 2 +- ...toreMultiMedicResultSetsForResearcher.java | 2 +- .../TranslateMultiMedicResultSets.java | 3 +- .../TranslateSingleMedicResultSets.java | 172 ++++++++++++++++ ...TranslateSingleMedicResultSetsWithRbf.java | 135 +------------ ...nslateSingleMedicResultSetsWithoutRbf.java | 37 ++++ .../bpe/spring/config/DataSharingConfig.java | 15 ++ .../resources/bpe/computeDataSharing.bpmn | 107 +++++----- .../resources/bpe/executeDataSharing.bpmn | 31 ++- .../resources/bpe/requestDataSharing.bpmn | 8 +- ...ringFromMedicsViaMedic1ExampleStarter.java | 2 +- 18 files changed, 546 insertions(+), 356 deletions(-) create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithoutRecordLinkage.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index 8541f885..6e8fb037 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -16,9 +16,6 @@ public interface ConstantsDataSharing String BPMN_EXECUTION_VARIABLE_QUERY_RESULTS = "queryResults"; String BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS = "finalQueryResults"; - // TODO: move into ConstantsBase from DSF implementation - String BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER = "leadingMedicIdentifier"; - String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestDataSharing/"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java index 9411d61a..73a33184 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -1,6 +1,6 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java new file mode 100644 index 00000000..35044da6 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java @@ -0,0 +1,190 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER; + +import java.security.NoSuchAlgorithmException; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Collectors; + +import javax.crypto.SecretKey; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.openehr.model.structure.Column; +import org.highmed.openehr.model.structure.Meta; +import org.highmed.openehr.model.structure.ResultSet; +import org.highmed.pseudonymization.crypto.AesGcmUtil; +import org.highmed.pseudonymization.domain.PersonWithMdat; +import org.highmed.pseudonymization.domain.PseudonymizedPersonWithMdat; +import org.highmed.pseudonymization.domain.impl.MatchedPersonImpl; +import org.highmed.pseudonymization.domain.impl.PseudonymizedPersonImpl; +import org.highmed.pseudonymization.psn.PseudonymGenerator; +import org.highmed.pseudonymization.psn.PseudonymGeneratorImpl; +import org.highmed.pseudonymization.psn.PseudonymizedPersonFactory; +import org.highmed.pseudonymization.recordlinkage.FederatedMatcher; +import org.highmed.pseudonymization.recordlinkage.FederatedMatcherImpl; +import org.highmed.pseudonymization.recordlinkage.MatchedPerson; +import org.highmed.pseudonymization.recordlinkage.MatchedPersonFactory; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedic; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedicNoRbfImpl; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToMedic; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToMedicImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public abstract class PseudonymizeResultSets extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(PseudonymizeResultSets.class); + + private final ObjectMapper psnObjectMapper; + + public PseudonymizeResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ObjectMapper psnObjectMapper) + { + super(clientProvider, taskHelper); + this.psnObjectMapper = psnObjectMapper; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + Objects.requireNonNull(psnObjectMapper, "psnObjectMapper"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + String researchStudyIdentifier = (String) execution + .getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER); + + // TODO: store key with corresponding research study id + SecretKey researchStudyKey = AesGcmUtil.generateAES256Key(); + + Map<String, List<QueryResult>> byCohortId = groupByCohortId(results); + QueryResults finalResults = createFinalResults(researchStudyIdentifier, researchStudyKey, byCohortId); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(finalResults)); + } + + private Map<String, List<QueryResult>> groupByCohortId(QueryResults results) + { + return results.getResults().stream().collect(Collectors.groupingBy(QueryResult::getCohortId)); + } + + private QueryResults createFinalResults(String researchStudyIdentifier, SecretKey reserchStudyKey, + Map<String, List<QueryResult>> groupedResults) throws NoSuchAlgorithmException + { + ResultSetTranslatorFromMedic translatorFromMedic = createResultSetTranslatorFromMedic(); + ResultSetTranslatorToMedic translatorToMedic = createResultSetTranslatorToMedic(); + FederatedMatcher<PersonWithMdat> matcher = createFederatedMatcher(); + PseudonymGenerator<PersonWithMdat, PseudonymizedPersonWithMdat> psnGenerator = createPseudonymGenerator( + researchStudyIdentifier, reserchStudyKey); + + List<QueryResult> finalResults = groupedResults.entrySet().stream().filter(r -> !r.getValue().isEmpty()) + .map(e -> translateMatchAndPseudonymize(translatorFromMedic, matcher, psnGenerator, translatorToMedic, + e.getKey(), e.getValue())) + .collect(Collectors.toList()); + + return new QueryResults(finalResults); + } + + private QueryResult translateMatchAndPseudonymize(ResultSetTranslatorFromMedic translatorFromMedic, + FederatedMatcher<PersonWithMdat> matcher, + PseudonymGenerator<PersonWithMdat, PseudonymizedPersonWithMdat> psnGenerator, + ResultSetTranslatorToMedic translatorToMedic, String cohortId, List<QueryResult> results) + { + logger.debug("Translating, matching and pseudonymizing results for cohort {}", cohortId); + + List<List<PersonWithMdat>> persons = translateFromMedicResultSets(translatorFromMedic, results); + Set<MatchedPerson<PersonWithMdat>> matchedPersons = matchPersons(persons, matcher, translatorFromMedic); + List<PseudonymizedPersonWithMdat> pseudonymizedPersons = psnGenerator + .createPseudonymsAndShuffle(matchedPersons); + ResultSet resultSet = translateToMedicResultSet(results.get(0).getResultSet(), translatorToMedic, + pseudonymizedPersons); + + return QueryResult.idResult("ttp", cohortId, resultSet); + } + + private List<List<PersonWithMdat>> translateFromMedicResultSets(ResultSetTranslatorFromMedic translator, + List<QueryResult> results) + { + return results.stream().map(r -> translateFromMedicResultSet(translator, r)).collect(Collectors.toList()); + } + + private List<PersonWithMdat> translateFromMedicResultSet(ResultSetTranslatorFromMedic translator, + QueryResult toTranslate) + { + try + { + return translator.translate(toTranslate.getOrganizationIdentifier(), toTranslate.getResultSet()); + } + catch (Exception e) + { + logger.warn("Error while translating ResultSet: " + e.getMessage(), e); + throw e; + } + } + + private Set<MatchedPerson<PersonWithMdat>> matchPersons(List<List<PersonWithMdat>> persons, + FederatedMatcher<PersonWithMdat> matcher, ResultSetTranslatorFromMedic translator) + { + if (translator instanceof ResultSetTranslatorFromMedicNoRbfImpl) + return persons.stream().flatMap(List::stream).map(MatchedPersonImpl::new).collect(Collectors.toSet()); + else + return matcher.matchPersons(persons); + } + + private ResultSet translateToMedicResultSet(ResultSet toTranslate, ResultSetTranslatorToMedic translator, + List<PseudonymizedPersonWithMdat> pseudonymizedPersons) + { + try + { + Meta meta = toTranslate.getMeta() == null ? new Meta("", "", "", "", "", "") : toTranslate.getMeta(); + List<Column> columns = toTranslate.getColumns(); + return translator.translate(meta, columns, pseudonymizedPersons); + } + catch (Exception e) + { + logger.warn("Error while translating ResultSet: " + e.getMessage(), e); + throw e; + } + } + + /** + * @return + */ + protected abstract ResultSetTranslatorFromMedic createResultSetTranslatorFromMedic(); + + private ResultSetTranslatorToMedic createResultSetTranslatorToMedic() + { + return new ResultSetTranslatorToMedicImpl(); + } + + private FederatedMatcher<PersonWithMdat> createFederatedMatcher() + { + MatchedPersonFactory<PersonWithMdat> matchedPersonFactory = MatchedPersonImpl::new; + return new FederatedMatcherImpl<>(matchedPersonFactory); + } + + private PseudonymGenerator<PersonWithMdat, PseudonymizedPersonWithMdat> createPseudonymGenerator( + String researchStudyIdentifier, SecretKey researchStudyKey) + { + PseudonymizedPersonFactory<PersonWithMdat, PseudonymizedPersonWithMdat> psnPersonFactory = PseudonymizedPersonImpl::new; + return new PseudonymGeneratorImpl<>(researchStudyIdentifier, researchStudyKey, psnObjectMapper, + psnPersonFactory); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java index 5fd16110..e9cec51e 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java @@ -1,179 +1,24 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER; - -import java.security.NoSuchAlgorithmException; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Collectors; - -import javax.crypto.SecretKey; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variable.QueryResult; -import org.highmed.dsf.bpe.variable.QueryResults; -import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; -import org.highmed.openehr.model.structure.Column; -import org.highmed.openehr.model.structure.Meta; -import org.highmed.openehr.model.structure.ResultSet; -import org.highmed.pseudonymization.crypto.AesGcmUtil; -import org.highmed.pseudonymization.domain.PersonWithMdat; -import org.highmed.pseudonymization.domain.PseudonymizedPersonWithMdat; -import org.highmed.pseudonymization.domain.impl.MatchedPersonImpl; -import org.highmed.pseudonymization.domain.impl.PseudonymizedPersonImpl; -import org.highmed.pseudonymization.psn.PseudonymGeneratorImpl; -import org.highmed.pseudonymization.psn.PseudonymizedPersonFactory; -import org.highmed.pseudonymization.recordlinkage.FederatedMatcher; -import org.highmed.pseudonymization.recordlinkage.FederatedMatcherImpl; -import org.highmed.pseudonymization.recordlinkage.MatchedPerson; -import org.highmed.pseudonymization.recordlinkage.MatchedPersonFactory; import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedic; -import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedicImpl; -import org.highmed.pseudonymization.translation.ResultSetTranslatorToMedic; -import org.highmed.pseudonymization.translation.ResultSetTranslatorToMedicImpl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedicWithRbfImpl; import org.springframework.beans.factory.InitializingBean; import com.fasterxml.jackson.databind.ObjectMapper; -public class PseudonymizeResultSetsWithRecordLinkage extends AbstractServiceDelegate implements InitializingBean +public class PseudonymizeResultSetsWithRecordLinkage extends PseudonymizeResultSets implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(PseudonymizeResultSetsWithRecordLinkage.class); - - private final ObjectMapper psnObjectMapper; - public PseudonymizeResultSetsWithRecordLinkage(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ObjectMapper psnObjectMapper) { - super(clientProvider, taskHelper); - this.psnObjectMapper = psnObjectMapper; - } - - @Override - public void afterPropertiesSet() throws Exception - { - super.afterPropertiesSet(); - Objects.requireNonNull(psnObjectMapper, "psnObjectMapper"); + super(clientProvider, taskHelper, psnObjectMapper); } @Override - protected void doExecute(DelegateExecution execution) throws Exception - { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - String researchStudyIdentifier = (String) execution - .getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER); - - // TODO: store key with corresponding research study id - SecretKey researchStudyKey = AesGcmUtil.generateAES256Key(); - - Map<String, List<QueryResult>> byCohortId = groupByCohortId(results); - QueryResults finalResults = createFinalResults(researchStudyIdentifier, researchStudyKey, byCohortId); - - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(finalResults)); - } - - protected Map<String, List<QueryResult>> groupByCohortId(QueryResults results) - { - return results.getResults().stream().collect(Collectors.groupingBy(QueryResult::getCohortId)); - } - - protected QueryResults createFinalResults(String researchStudyIdentifier, SecretKey reserchStudyKey, - Map<String, List<QueryResult>> groupedResults) throws NoSuchAlgorithmException - { - ResultSetTranslatorFromMedic translatorFromMedic = createResultSetTranslatorFromMedic(); - ResultSetTranslatorToMedic translatorToMedic = createResultSetTranslatorToMedic(); - FederatedMatcher<PersonWithMdat> matcher = createFederatedMatcher(); - PseudonymGeneratorImpl<PersonWithMdat, PseudonymizedPersonWithMdat> psnGenerator = createPseudonymGenerator( - researchStudyIdentifier, reserchStudyKey); - - List<QueryResult> finalResults = groupedResults.entrySet().stream().filter(r -> !r.getValue().isEmpty()) - .map(e -> translateMatchAndPseudonymize(translatorFromMedic, matcher, psnGenerator, translatorToMedic, - e.getKey(), e.getValue())) - .collect(Collectors.toList()); - - return new QueryResults(finalResults); - } - - private QueryResult translateMatchAndPseudonymize(ResultSetTranslatorFromMedic translatorFromMedic, - FederatedMatcher<PersonWithMdat> matcher, - PseudonymGeneratorImpl<PersonWithMdat, PseudonymizedPersonWithMdat> psnGenerator, - ResultSetTranslatorToMedic translatorToMedic, String cohortId, List<QueryResult> results) - { - logger.debug("Translating, matching and pseudonymizing results for cohort {}", cohortId); - - List<List<PersonWithMdat>> persons = translateFromMedicResultSets(translatorFromMedic, results); - Set<MatchedPerson<PersonWithMdat>> matchedPersons = matcher.matchPersons(persons); - List<PseudonymizedPersonWithMdat> pseudonymizedPersons = psnGenerator - .createPseudonymsAndShuffle(matchedPersons); - ResultSet resultSet = translateToMedicResultSet(results.get(0).getResultSet(), translatorToMedic, - pseudonymizedPersons); - - return QueryResult.idResult("ttp", cohortId, resultSet); - } - - private List<List<PersonWithMdat>> translateFromMedicResultSets(ResultSetTranslatorFromMedic translator, - List<QueryResult> results) - { - return results.stream().map(r -> translateFromMedicResultSet(translator, r)).collect(Collectors.toList()); - } - - private List<PersonWithMdat> translateFromMedicResultSet(ResultSetTranslatorFromMedic translator, - QueryResult toTranslate) - { - try - { - return translator.translate(toTranslate.getOrganizationIdentifier(), toTranslate.getResultSet()); - } - catch (Exception e) - { - logger.warn("Error while translating ResultSet: " + e.getMessage(), e); - throw e; - } - } - - private ResultSet translateToMedicResultSet(ResultSet toTranslate, ResultSetTranslatorToMedic translator, - List<PseudonymizedPersonWithMdat> pseudonymizedPersons) - { - try - { - Meta meta = toTranslate.getMeta() == null ? new Meta("", "", "", "", "", "") : toTranslate.getMeta(); - List<Column> columns = toTranslate.getColumns(); - return translator.translate(meta, columns, pseudonymizedPersons); - } - catch (Exception e) - { - logger.warn("Error while translating ResultSet: " + e.getMessage(), e); - throw e; - } - } - - private ResultSetTranslatorFromMedic createResultSetTranslatorFromMedic() - { - return new ResultSetTranslatorFromMedicImpl(); - } - - private ResultSetTranslatorToMedic createResultSetTranslatorToMedic() - { - return new ResultSetTranslatorToMedicImpl(); - } - - private FederatedMatcher<PersonWithMdat> createFederatedMatcher() - { - MatchedPersonFactory<PersonWithMdat> matchedPersonFactory = MatchedPersonImpl::new; - return new FederatedMatcherImpl<>(matchedPersonFactory); - } - - private PseudonymGeneratorImpl<PersonWithMdat, PseudonymizedPersonWithMdat> createPseudonymGenerator( - String researchStudyIdentifier, SecretKey researchStudyKey) throws NoSuchAlgorithmException + protected ResultSetTranslatorFromMedic createResultSetTranslatorFromMedic() { - PseudonymizedPersonFactory<PersonWithMdat, PseudonymizedPersonWithMdat> psnPersonFactory = PseudonymizedPersonImpl::new; - return new PseudonymGeneratorImpl(researchStudyIdentifier, researchStudyKey, psnObjectMapper, psnPersonFactory); + return new ResultSetTranslatorFromMedicWithRbfImpl(); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithoutRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithoutRecordLinkage.java new file mode 100644 index 00000000..e7db617a --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithoutRecordLinkage.java @@ -0,0 +1,24 @@ +package org.highmed.dsf.bpe.service; + +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedic; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedicNoRbfImpl; +import org.springframework.beans.factory.InitializingBean; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class PseudonymizeResultSetsWithoutRecordLinkage extends PseudonymizeResultSets implements InitializingBean +{ + public PseudonymizeResultSetsWithoutRecordLinkage(FhirWebserviceClientProvider clientProvider, + TaskHelper taskHelper, ObjectMapper psnObjectMapper) + { + super(clientProvider, taskHelper, psnObjectMapper); + } + + @Override + protected ResultSetTranslatorFromMedic createResultSetTranslatorFromMedic() + { + return new ResultSetTranslatorFromMedicNoRbfImpl(); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java index 9fbcce42..09aad61f 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java index b6ee815e..dbe1e272 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForLeadingMedic.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForLeadingMedic.java index 5088c0da..140a72c8 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForLeadingMedic.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForLeadingMedic.java @@ -1,6 +1,6 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForResearcher.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForResearcher.java index 8eff79d4..5eff6566 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForResearcher.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForResearcher.java @@ -1,7 +1,7 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java index 9df7aa04..f0b47ec8 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java @@ -3,6 +3,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER; +import static org.highmed.pseudonymization.crypto.AesGcmUtil.AES; import java.util.List; import java.util.Objects; @@ -63,7 +64,7 @@ protected void doExecute(DelegateExecution execution) throws Exception private SecretKey getMdatKey(DelegateExecution execution) { byte[] encodedKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); - return new SecretKeySpec(encodedKey, "AES"); + return new SecretKeySpec(encodedKey, AES); } private ResultSetTranslatorFromTtp createResultSetTranslator(String researchStudyIdentifier, diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java new file mode 100644 index 00000000..e7f45ad7 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java @@ -0,0 +1,172 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.pseudonymization.crypto.AesGcmUtil.AES; + +import java.security.NoSuchAlgorithmException; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; + +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.BloomFilterConfig; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.mpi.client.MasterPatientIndexClient; +import org.highmed.openehr.model.structure.ResultSet; +import org.highmed.pseudonymization.bloomfilter.BloomFilterGenerator; +import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGenerator; +import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGeneratorImpl; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtp; +import org.hl7.fhir.r4.model.ResearchStudy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +public abstract class TranslateSingleMedicResultSets extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(TranslateSingleMedicResultSets.class); + + private static final int RBF_LENGTH = 3000; + private static final RecordBloomFilterGeneratorImpl.FieldWeights FBF_WEIGHTS = new RecordBloomFilterGeneratorImpl.FieldWeights( + 0.1, 0.1, 0.1, 0.2, 0.05, 0.1, 0.05, 0.2, 0.1); + private static final RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths FBF_LENGTHS = new RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths( + 500, 500, 250, 50, 500, 250, 500, 500, 500); + + private final OrganizationProvider organizationProvider; + private final String ehrIdColumnPath; + private final MasterPatientIndexClient masterPatientIndexClient; + private final BouncyCastleProvider bouncyCastleProvider; + + public TranslateSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider, String ehrIdColumnPath, + MasterPatientIndexClient masterPatientIndexClient, BouncyCastleProvider bouncyCastleProvider) + { + super(clientProvider, taskHelper); + + this.organizationProvider = organizationProvider; + this.ehrIdColumnPath = ehrIdColumnPath; + this.masterPatientIndexClient = masterPatientIndexClient; + this.bouncyCastleProvider = bouncyCastleProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(organizationProvider, "organizationProvider"); + Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath"); + + if (!(this instanceof TranslateSingleMedicResultSetsWithoutRbf)) + { + Objects.requireNonNull(masterPatientIndexClient, "masterPatientIndexClient"); + Objects.requireNonNull(bouncyCastleProvider, "bouncyCastleProvider"); + } + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + String organizationIdentifier = organizationProvider.getLocalIdentifierValue(); + String researchStudyIdentifier = getResearchStudyIdentifier(execution); + SecretKey mdatKey = getMdatKey(execution); + + boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); + RecordBloomFilterGenerator bloomFilterGenerator = createRecordBloomFilterGenerator(execution, + needsRecordLinkage); + + ResultSetTranslatorToTtp resultSetTranslator = createResultSetTranslator(organizationIdentifier, + researchStudyIdentifier, mdatKey, ehrIdColumnPath, masterPatientIndexClient, bloomFilterGenerator); + + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + List<QueryResult> translatedResults = results.getResults().stream() + .map(result -> translateAndCreateBinary(resultSetTranslator, result)).collect(Collectors.toList()); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(translatedResults))); + } + + private String getResearchStudyIdentifier(DelegateExecution execution) + { + ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); + return researchStudy.getIdentifier().stream() + .filter(s -> s.getSystem().equals(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)).findFirst() + .orElseThrow(() -> new IllegalArgumentException("Identifier is not set in research study with id='" + + researchStudy.getId() + "', this error should have been caught by resource validation")) + .getValue(); + } + + private SecretKey getMdatKey(DelegateExecution execution) + { + byte[] encodedKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); + return new SecretKeySpec(encodedKey, AES); + } + + private RecordBloomFilterGenerator createRecordBloomFilterGenerator(DelegateExecution execution, + boolean needsRecordLinkage) + { + if (needsRecordLinkage) + { + BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution + .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); + return new RecordBloomFilterGeneratorImpl(RBF_LENGTH, bloomFilterConfig.getPermutationSeed(), FBF_WEIGHTS, + FBF_LENGTHS, + () -> new BloomFilterGenerator.HmacSha2HmacSha3BiGramHasher(bloomFilterConfig.getHmacSha2Key(), + bloomFilterConfig.getHmacSha2Key(), bouncyCastleProvider)); + } + else + { + return null; + } + } + + /** + * @param organizationIdentifier + * @param researchStudyIdentifier + * @param mdatKey + * @param ehrIdColumnPath + * @param masterPatientIndexClient + * @param recordBloomFilterGenerator + * @return + * @throws NoSuchAlgorithmException + */ + abstract protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, + String researchStudyIdentifier, SecretKey mdatKey, String ehrIdColumnPath, + MasterPatientIndexClient masterPatientIndexClient, RecordBloomFilterGenerator recordBloomFilterGenerator) + throws NoSuchAlgorithmException; + + private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtp resultSetTranslator, QueryResult result) + { + ResultSet translatedResultSet = translate(resultSetTranslator, result.getResultSet()); + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), translatedResultSet); + } + + private ResultSet translate(ResultSetTranslatorToTtp resultSetTranslator, ResultSet resultSet) + { + try + { + return resultSetTranslator.translate(resultSet); + } + catch (Exception e) + { + logger.warn("Error while translating ResultSet: " + e.getMessage(), e); + throw e; + } + } + +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java index f7911219..88d5b095 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java @@ -1,157 +1,40 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; - -import java.security.Key; import java.security.NoSuchAlgorithmException; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; import javax.crypto.SecretKey; -import javax.crypto.spec.SecretKeySpec; import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variable.BloomFilterConfig; -import org.highmed.dsf.bpe.variable.QueryResult; -import org.highmed.dsf.bpe.variable.QueryResults; -import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.mpi.client.MasterPatientIndexClient; -import org.highmed.openehr.model.structure.ResultSet; -import org.highmed.pseudonymization.bloomfilter.BloomFilterGenerator; import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGenerator; -import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGeneratorImpl; import org.highmed.pseudonymization.crypto.AesGcmUtil; import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtp; -import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpImpl; -import org.hl7.fhir.r4.model.ResearchStudy; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpWithRbfImpl; import org.springframework.beans.factory.InitializingBean; -public class TranslateSingleMedicResultSetsWithRbf extends AbstractServiceDelegate implements InitializingBean +public class TranslateSingleMedicResultSetsWithRbf extends TranslateSingleMedicResultSets implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(TranslateSingleMedicResultSetsWithRbf.class); - - private static final int RBF_LENGTH = 3000; - private static final RecordBloomFilterGeneratorImpl.FieldWeights FBF_WEIGHTS = new RecordBloomFilterGeneratorImpl.FieldWeights( - 0.1, 0.1, 0.1, 0.2, 0.05, 0.1, 0.05, 0.2, 0.1); - private static final RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths FBF_LENGTHS = new RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths( - 500, 500, 250, 50, 500, 250, 500, 500, 500); - - private final OrganizationProvider organizationProvider; - private final String ehrIdColumnPath; - private final MasterPatientIndexClient masterPatientIndexClient; - private final BouncyCastleProvider bouncyCastleProvider; - public TranslateSingleMedicResultSetsWithRbf(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, OrganizationProvider organizationProvider, String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, BouncyCastleProvider bouncyCastleProvider) { - super(clientProvider, taskHelper); - - this.organizationProvider = organizationProvider; - this.ehrIdColumnPath = ehrIdColumnPath; - this.masterPatientIndexClient = masterPatientIndexClient; - this.bouncyCastleProvider = bouncyCastleProvider; + super(clientProvider, taskHelper, organizationProvider, ehrIdColumnPath, masterPatientIndexClient, + bouncyCastleProvider); } @Override - public void afterPropertiesSet() throws Exception - { - super.afterPropertiesSet(); - - Objects.requireNonNull(organizationProvider, "organizationProvider"); - Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath"); - Objects.requireNonNull(masterPatientIndexClient, "masterPatientIndexClient"); - Objects.requireNonNull(bouncyCastleProvider, "bouncyCastleProvider"); - } - - @Override - protected void doExecute(DelegateExecution execution) throws Exception - { - String organizationIdentifier = organizationProvider.getLocalIdentifierValue(); - String researchStudyIdentifier = getResearchStudyIdentifier(execution); - SecretKey mdatKey = getMdatKey(execution); - BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution - .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); - - ResultSetTranslatorToTtp resultSetTranslator = createResultSetTranslator(organizationIdentifier, - researchStudyIdentifier, mdatKey, bloomFilterConfig); - - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - List<QueryResult> translatedResults = results.getResults().stream() - .map(result -> translateAndCreateBinary(resultSetTranslator, result)).collect(Collectors.toList()); - - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - QueryResultsValues.create(new QueryResults(translatedResults))); - } - - private String getResearchStudyIdentifier(DelegateExecution execution) - { - ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); - return researchStudy.getIdentifier().stream() - .filter(s -> s.getSystem().equals(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)).findFirst() - .orElseThrow(() -> new IllegalArgumentException("Identifier is not set in research study with id='" - + researchStudy.getId() + "', this error should have been caught by resource validation")) - .getValue(); - } - - private SecretKey getMdatKey(DelegateExecution execution) - { - byte[] encodedKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); - return new SecretKeySpec(encodedKey, "AES"); - } - - private ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, - String researchStudyIdentifier, SecretKey mdatKey, BloomFilterConfig bloomFilterConfig) + protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, + String researchStudyIdentifier, SecretKey mdatKey, String ehrIdColumnPath, + MasterPatientIndexClient masterPatientIndexClient, RecordBloomFilterGenerator recordBloomFilterGenerator) throws NoSuchAlgorithmException { - RecordBloomFilterGenerator recordBloomFilterGenerator = createRecordBloomFilterGenerator( - bloomFilterConfig.getPermutationSeed(), bloomFilterConfig.getHmacSha2Key(), - bloomFilterConfig.getHmacSha3Key()); - // TODO: should be provided by properties or pseudonym provider SecretKey idatKey = AesGcmUtil.generateAES256Key(); - return new ResultSetTranslatorToTtpImpl(organizationIdentifier, idatKey, researchStudyIdentifier, mdatKey, - ehrIdColumnPath, recordBloomFilterGenerator, masterPatientIndexClient); - } - - private RecordBloomFilterGenerator createRecordBloomFilterGenerator(long permutationSeed, Key hmacSha2Key, - Key hmacSha3Key) - { - return new RecordBloomFilterGeneratorImpl(RBF_LENGTH, permutationSeed, FBF_WEIGHTS, FBF_LENGTHS, - () -> new BloomFilterGenerator.HmacSha2HmacSha3BiGramHasher(hmacSha2Key, hmacSha3Key, - bouncyCastleProvider)); - } - - private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtp resultSetTranslator, QueryResult result) - { - ResultSet translatedResultSet = translate(resultSetTranslator, result.getResultSet()); - return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), translatedResultSet); + return new ResultSetTranslatorToTtpWithRbfImpl(organizationIdentifier, idatKey, researchStudyIdentifier, + mdatKey, ehrIdColumnPath, recordBloomFilterGenerator, masterPatientIndexClient); } - - private ResultSet translate(ResultSetTranslatorToTtp resultSetTranslator, ResultSet resultSet) - { - try - { - return resultSetTranslator.translate(resultSet); - } - catch (Exception e) - { - logger.warn("Error while translating ResultSet: " + e.getMessage(), e); - throw e; - } - } - } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java new file mode 100644 index 00000000..9e660b58 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java @@ -0,0 +1,37 @@ +package org.highmed.dsf.bpe.service; + +import java.security.NoSuchAlgorithmException; + +import javax.crypto.SecretKey; + +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.mpi.client.MasterPatientIndexClient; +import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGenerator; +import org.highmed.pseudonymization.crypto.AesGcmUtil; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtp; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpNoRbfImpl; +import org.springframework.beans.factory.InitializingBean; + +public class TranslateSingleMedicResultSetsWithoutRbf extends TranslateSingleMedicResultSets implements InitializingBean +{ + public TranslateSingleMedicResultSetsWithoutRbf(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider, String ehrIdColumnPath) + { + super(clientProvider, taskHelper, organizationProvider, ehrIdColumnPath, null, null); + } + + @Override + protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, + String researchStudyIdentifier, SecretKey mdatKey, String ehrIdColumnPath, + MasterPatientIndexClient masterPatientIndexClient, RecordBloomFilterGenerator recordBloomFilterGenerator) + throws NoSuchAlgorithmException + { + // TODO: should be provided by properties or pseudonym provider + SecretKey idatKey = AesGcmUtil.generateAES256Key(); + + return new ResultSetTranslatorToTtpNoRbfImpl(organizationIdentifier, idatKey, researchStudyIdentifier, mdatKey, + ehrIdColumnPath); + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index a26bdfa2..550bdf18 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -20,6 +20,7 @@ import org.highmed.dsf.bpe.service.HandleErrorMultiMedicResults; import org.highmed.dsf.bpe.service.ModifyQueries; import org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithRecordLinkage; +import org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithoutRecordLinkage; import org.highmed.dsf.bpe.service.SelectRequestTargets; import org.highmed.dsf.bpe.service.SelectResponseTargetMedic; import org.highmed.dsf.bpe.service.SelectResponseTargetTtp; @@ -30,6 +31,7 @@ import org.highmed.dsf.bpe.service.StoreSingleMedicResultSets; import org.highmed.dsf.bpe.service.TranslateMultiMedicResultSets; import org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithRbf; +import org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithoutRbf; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.group.GroupHelper; import org.highmed.dsf.fhir.organization.OrganizationProvider; @@ -163,6 +165,12 @@ public PseudonymizeResultSetsWithRecordLinkage pseudonymizeResultSetsWithRecordL return new PseudonymizeResultSetsWithRecordLinkage(fhirClientProvider, taskHelper, objectMapper); } + @Bean + public PseudonymizeResultSetsWithoutRecordLinkage pseudonymizeResultSetsWithoutRecordLinkage() + { + return new PseudonymizeResultSetsWithoutRecordLinkage(fhirClientProvider, taskHelper, objectMapper); + } + @Bean public SelectResponseTargetMedic selectResponseTargetMedic() { @@ -246,6 +254,13 @@ public TranslateSingleMedicResultSetsWithRbf translateSingleMedicResultSetsWithR ehrIdColumnPath, masterPatientIndexClient(), bouncyCastleProvider()); } + @Bean + public TranslateSingleMedicResultSetsWithoutRbf translateSingleMedicResultSetsWithoutRbf() + { + return new TranslateSingleMedicResultSetsWithoutRbf(fhirClientProvider, taskHelper, organizationProvider, + ehrIdColumnPath); + } + @Bean public MasterPatientIndexClient masterPatientIndexClient() { diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn index 23c58b8e..999b4a1b 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn @@ -59,7 +59,7 @@ </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0xxpamp" sourceRef="SubProcess_1gopxt4" targetRef="Gateway_0h2eszv" /> <bpmn:sequenceFlow id="SequenceFlow_0h3to47" sourceRef="TimerEnded" targetRef="Gateway_0h2eszv" /> - <bpmn:sequenceFlow id="SequenceFlow_0t4lx4v" name="else" sourceRef="ExclusiveGateway_07e71aa" targetRef="ExclusiveGateway_1r8ow3i"> + <bpmn:sequenceFlow id="SequenceFlow_0t4lx4v" name="else" sourceRef="ExclusiveGateway_07e71aa" targetRef="pseudonymizeResultSetWithoutRecordLinkage"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:serviceTask id="pseudonymizeResultSetWithRecordLinkage" name="pseudonymize result sets with record linkage" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithRecordLinkage"> @@ -69,7 +69,7 @@ <bpmn:sequenceFlow id="SequenceFlow_02zmrer" sourceRef="pseudonymizeResultSetWithRecordLinkage" targetRef="ExclusiveGateway_1r8ow3i" /> <bpmn:exclusiveGateway id="ExclusiveGateway_1r8ow3i"> <bpmn:incoming>SequenceFlow_02zmrer</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0t4lx4v</bpmn:incoming> + <bpmn:incoming>Flow_115yfgb</bpmn:incoming> <bpmn:outgoing>Flow_1qqffoq</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:serviceTask id="storeCorrelationKeys" name="store correlation keys" camunda:class="org.highmed.dsf.bpe.service.StoreCorrelationKeys"> @@ -123,6 +123,11 @@ <bpmn:sequenceFlow id="Flow_1qqffoq" sourceRef="ExclusiveGateway_1r8ow3i" targetRef="selectResponseTargetMedic" /> <bpmn:sequenceFlow id="Flow_1wig1wj" sourceRef="selectResponseTargetMedic" targetRef="checkResultSets" /> <bpmn:sequenceFlow id="Flow_0uaqn1r" sourceRef="storeResultSets" targetRef="EndEventSuccess" /> + <bpmn:sequenceFlow id="Flow_115yfgb" sourceRef="pseudonymizeResultSetWithoutRecordLinkage" targetRef="ExclusiveGateway_1r8ow3i" /> + <bpmn:serviceTask id="pseudonymizeResultSetWithoutRecordLinkage" name="pseudonymize result sets" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithoutRecordLinkage"> + <bpmn:incoming>SequenceFlow_0t4lx4v</bpmn:incoming> + <bpmn:outgoing>Flow_115yfgb</bpmn:outgoing> + </bpmn:serviceTask> </bpmn:process> <bpmn:message id="Message_0a1qxd8" name="resultSingleMedicDataSharingMessage" /> <bpmn:message id="Message_0ue93sz" name="resultMultiMedicDataSharingMessage" /> @@ -131,6 +136,22 @@ <bpmn:error id="Error_0qub4jc" name="errorMultiMedicDataSharingResult" errorCode="errorMultiMedicDataSharingResult" camunda:errorMessage="errorMultiMedicDataSharingResult" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="computeDataSharing"> + <bpmndi:BPMNEdge id="Flow_0uaqn1r_di" bpmnElement="Flow_0uaqn1r"> + <di:waypoint x="2050" y="242" /> + <di:waypoint x="2142" y="242" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1wig1wj_di" bpmnElement="Flow_1wig1wj"> + <di:waypoint x="1710" y="242" /> + <di:waypoint x="1780" y="242" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1qqffoq_di" bpmnElement="Flow_1qqffoq"> + <di:waypoint x="1545" y="242" /> + <di:waypoint x="1610" y="242" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0mogdyo_di" bpmnElement="Flow_0mogdyo"> + <di:waypoint x="1880" y="242" /> + <di:waypoint x="1950" y="242" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0gx8n5k_di" bpmnElement="Flow_0gx8n5k"> <di:waypoint x="1260" y="242" /> <di:waypoint x="1315" y="242" /> @@ -147,15 +168,21 @@ <dc:Bounds x="1347" y="133" width="65" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1tmnvhl_di" bpmnElement="Flow_1tmnvhl"> + <di:waypoint x="1880" y="300" /> + <di:waypoint x="1880" y="350" /> + <di:waypoint x="2142" y="350" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_02zmrer_di" bpmnElement="SequenceFlow_02zmrer"> <di:waypoint x="1520" y="166" /> <di:waypoint x="1520" y="217" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0t4lx4v_di" bpmnElement="SequenceFlow_0t4lx4v"> - <di:waypoint x="1365" y="242" /> - <di:waypoint x="1495" y="242" /> + <di:waypoint x="1340" y="267" /> + <di:waypoint x="1340" y="360" /> + <di:waypoint x="1470" y="360" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1369" y="224" width="21" height="14" /> + <dc:Bounds x="1344" y="342" width="21" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0h3to47_di" bpmnElement="SequenceFlow_0h3to47"> @@ -175,47 +202,12 @@ <di:waypoint x="195" y="242" /> <di:waypoint x="279" y="242" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1tmnvhl_di" bpmnElement="Flow_1tmnvhl"> - <di:waypoint x="1880" y="300" /> - <di:waypoint x="1880" y="350" /> - <di:waypoint x="2142" y="350" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0mogdyo_di" bpmnElement="Flow_0mogdyo"> - <di:waypoint x="1880" y="242" /> - <di:waypoint x="1950" y="242" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1qqffoq_di" bpmnElement="Flow_1qqffoq"> - <di:waypoint x="1545" y="242" /> - <di:waypoint x="1610" y="242" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1wig1wj_di" bpmnElement="Flow_1wig1wj"> - <di:waypoint x="1710" y="242" /> - <di:waypoint x="1780" y="242" /> + <bpmndi:BPMNEdge id="Flow_115yfgb_di" bpmnElement="Flow_115yfgb"> + <di:waypoint x="1520" y="320" /> + <di:waypoint x="1520" y="267" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0uaqn1r_di" bpmnElement="Flow_0uaqn1r"> - <di:waypoint x="2050" y="242" /> - <di:waypoint x="2142" y="242" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_0xh5o35_di" bpmnElement="EndEventSuccess"> - <dc:Bounds x="2142" y="224" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2125" y="267" width="72" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_1hmug5i_di" bpmnElement="EndEventError"> - <dc:Bounds x="2142" y="332" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2129" y="375" width="63" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0tps18n_di" bpmnElement="storeResultSets"> - <dc:Bounds x="1950" y="202" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_13j8ce9_di" bpmnElement="checkResultSets"> - <dc:Bounds x="1780" y="202" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0uk3eyz_di" bpmnElement="selectResponseTargetMedic"> - <dc:Bounds x="1610" y="202" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_0y1tjhz_di" bpmnElement="pseudonymizeResultSetWithoutRecordLinkage"> + <dc:Bounds x="1470" y="320" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_1gopxt4_di" bpmnElement="SubProcess_1gopxt4" isExpanded="true"> <dc:Bounds x="469" y="175" width="498" height="134" /> @@ -253,6 +245,12 @@ <dc:Bounds x="166" y="267" width="23" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0xh5o35_di" bpmnElement="EndEventSuccess"> + <dc:Bounds x="2142" y="224" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2125" y="267" width="72" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_07e71aa_di" bpmnElement="ExclusiveGateway_07e71aa" isMarkerVisible="true"> <dc:Bounds x="1315" y="217" width="50" height="50" /> </bpmndi:BPMNShape> @@ -265,18 +263,33 @@ <bpmndi:BPMNShape id="ServiceTask_0bw310g_di" bpmnElement="storeCorrelationKeys"> <dc:Bounds x="279" y="202" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0uk3eyz_di" bpmnElement="selectResponseTargetMedic"> + <dc:Bounds x="1610" y="202" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1hmug5i_di" bpmnElement="EndEventError"> + <dc:Bounds x="2142" y="332" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2129" y="375" width="63" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_13j8ce9_di" bpmnElement="checkResultSets"> + <dc:Bounds x="1780" y="202" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0h2eszv_di" bpmnElement="Gateway_0h2eszv" isMarkerVisible="true"> <dc:Bounds x="1045" y="217" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1rzqqn0_di" bpmnElement="downloadResultSets"> <dc:Bounds x="1160" y="202" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="BoundaryEvent_1g0rcyp_di" bpmnElement="TimerEnded"> - <dc:Bounds x="949" y="291" width="36" height="36" /> + <bpmndi:BPMNShape id="Activity_0tps18n_di" bpmnElement="storeResultSets"> + <dc:Bounds x="1950" y="202" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_155cxa9_di" bpmnElement="Event_1vp5qzs"> <dc:Bounds x="1862" y="264" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="BoundaryEvent_1g0rcyp_di" bpmnElement="TimerEnded"> + <dc:Bounds x="949" y="291" width="36" height="36" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index b6d8b890..5ac31013 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -53,7 +53,7 @@ <bpmn:outgoing>Flow_14nlfvk</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0kzp6tl" sourceRef="filterByConsent" targetRef="ExclusiveGateway_0lecmy5" /> - <bpmn:serviceTask id="translateWithRbfGeneration" name="translate with RBF generation and encryption" camunda:class="org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithRbf"> + <bpmn:serviceTask id="translateWithEncryptionAndRbfGeneration" name="translate with encryption and RBF generation " camunda:class="org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithRbf"> <bpmn:incoming>Flow_0xt2bfn</bpmn:incoming> <bpmn:outgoing>Flow_09yooed</bpmn:outgoing> </bpmn:serviceTask> @@ -83,17 +83,17 @@ </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="Flow_14nlfvk" sourceRef="ExclusiveGateway_0lecmy5" targetRef="Gateway_118ojzy" /> <bpmn:exclusiveGateway id="Gateway_13kxug8"> - <bpmn:incoming>Flow_09dzkmp</bpmn:incoming> <bpmn:incoming>Flow_09yooed</bpmn:incoming> + <bpmn:incoming>Flow_13fof22</bpmn:incoming> <bpmn:outgoing>Flow_1pgebfo</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="Flow_09dzkmp" name="else" sourceRef="Gateway_118ojzy" targetRef="Gateway_13kxug8"> + <bpmn:sequenceFlow id="Flow_09dzkmp" name="else" sourceRef="Gateway_118ojzy" targetRef="translateWithEncryptionAndWithoutRbfGeneration"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_0xt2bfn" sourceRef="Gateway_118ojzy" targetRef="translateWithRbfGeneration"> + <bpmn:sequenceFlow id="Flow_0xt2bfn" sourceRef="Gateway_118ojzy" targetRef="translateWithEncryptionAndRbfGeneration"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_09yooed" sourceRef="translateWithRbfGeneration" targetRef="Gateway_13kxug8" /> + <bpmn:sequenceFlow id="Flow_09yooed" sourceRef="translateWithEncryptionAndRbfGeneration" targetRef="Gateway_13kxug8" /> <bpmn:serviceTask id="storeResultSets" name="store result sets" camunda:class="org.highmed.dsf.bpe.service.StoreSingleMedicResultSets"> <bpmn:incoming>Flow_08925ay</bpmn:incoming> <bpmn:outgoing>Flow_1611vr6</bpmn:outgoing> @@ -102,6 +102,11 @@ <bpmn:sequenceFlow id="Flow_1pgebfo" sourceRef="Gateway_13kxug8" targetRef="selectResponseTargetTtp" /> <bpmn:sequenceFlow id="Flow_1pzik8k" sourceRef="selectResponseTargetTtp" targetRef="checkResultSets" /> <bpmn:sequenceFlow id="Flow_1611vr6" sourceRef="storeResultSets" targetRef="EndEvent" /> + <bpmn:sequenceFlow id="Flow_13fof22" sourceRef="translateWithEncryptionAndWithoutRbfGeneration" targetRef="Gateway_13kxug8" /> + <bpmn:serviceTask id="translateWithEncryptionAndWithoutRbfGeneration" name="translate with encryption" camunda:class="org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithoutRbf"> + <bpmn:incoming>Flow_09dzkmp</bpmn:incoming> + <bpmn:outgoing>Flow_13fof22</bpmn:outgoing> + </bpmn:serviceTask> <bpmn:textAnnotation id="TextAnnotation_0euut3n"> <bpmn:text>uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc.</bpmn:text> </bpmn:textAnnotation> @@ -111,6 +116,10 @@ <bpmn:message id="Message_1dr71re" name="resultSingleMedicDataSharingMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="executeDataSharing"> + <bpmndi:BPMNEdge id="Flow_13fof22_di" bpmnElement="Flow_13fof22"> + <di:waypoint x="1490" y="315" /> + <di:waypoint x="1490" y="237" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1611vr6_di" bpmnElement="Flow_1611vr6"> <di:waypoint x="2040" y="212" /> <di:waypoint x="2122" y="212" /> @@ -137,10 +146,11 @@ <di:waypoint x="1440" y="90" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_09dzkmp_di" bpmnElement="Flow_09dzkmp"> - <di:waypoint x="1355" y="212" /> - <di:waypoint x="1465" y="212" /> + <di:waypoint x="1330" y="237" /> + <di:waypoint x="1330" y="355" /> + <di:waypoint x="1440" y="355" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1361" y="195" width="21" height="14" /> + <dc:Bounds x="1337" y="335" width="21" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_14nlfvk_di" bpmnElement="Flow_14nlfvk"> @@ -220,7 +230,7 @@ <bpmndi:BPMNShape id="ExclusiveGateway_0lecmy5_di" bpmnElement="ExclusiveGateway_0lecmy5" isMarkerVisible="true"> <dc:Bounds x="1192" y="187" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="translateWithRbfGeneration"> + <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="translateWithEncryptionAndRbfGeneration"> <dc:Bounds x="1440" y="50" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> @@ -247,6 +257,9 @@ <bpmndi:BPMNShape id="Activity_1mdgvqk_di" bpmnElement="storeResultSets"> <dc:Bounds x="1940" y="172" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0cu49cc_di" bpmnElement="translateWithEncryptionAndWithoutRbfGeneration"> + <dc:Bounds x="1440" y="315" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> <dc:Bounds x="330" y="80" width="267" height="56" /> </bpmndi:BPMNShape> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn index 8c59a399..59c0551e 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn @@ -57,7 +57,7 @@ <bpmn:incoming>Flow_0amk6ah</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="Flow_1q5jnli" sourceRef="Gateway_160gkf1" targetRef="receiveFinalResultFromTtp" /> - <bpmn:sequenceFlow id="Flow_1gf3n6o" sourceRef="receiveFinalResultFromTtp" targetRef="temporarilyStoreMultiMeDICresults" /> + <bpmn:sequenceFlow id="Flow_1gf3n6o" sourceRef="receiveFinalResultFromTtp" targetRef="downloadResultSets" /> <bpmn:sequenceFlow id="Flow_1harl90" sourceRef="Gateway_160gkf1" targetRef="receiveErrorFromTtp" /> <bpmn:sequenceFlow id="Flow_1id9r0h" sourceRef="receiveErrorFromTtp" targetRef="handleError" /> <bpmn:sequenceFlow id="Flow_0rwo9pn" sourceRef="checkResultSets" targetRef="storeResultSets" /> @@ -82,11 +82,11 @@ <bpmn:incoming>Flow_06otxko</bpmn:incoming> <bpmn:outgoing>Flow_0cx3xe1</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="temporarilyStoreMultiMeDICresults" name="download result sets" camunda:class="org.highmed.dsf.bpe.service.DownloadMultiMedicResultSets"> + <bpmn:serviceTask id="downloadResultSets" name="download result sets" camunda:class="org.highmed.dsf.bpe.service.DownloadMultiMedicResultSets"> <bpmn:incoming>Flow_1gf3n6o</bpmn:incoming> <bpmn:outgoing>Flow_025quhl</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_025quhl" sourceRef="temporarilyStoreMultiMeDICresults" targetRef="translateWithDecryption" /> + <bpmn:sequenceFlow id="Flow_025quhl" sourceRef="downloadResultSets" targetRef="translateWithDecryption" /> <bpmn:sequenceFlow id="Flow_1rnnd6d" sourceRef="storeResultSets" targetRef="Gateway_0nlbalq" /> <bpmn:serviceTask id="storeResultSets" name="store result sets" camunda:class="org.highmed.dsf.bpe.service.StoreMultiMedicResultSetsForResearcher"> <bpmn:incoming>Flow_0rwo9pn</bpmn:incoming> @@ -219,7 +219,7 @@ <bpmndi:BPMNShape id="Activity_1wzn9by_di" bpmnElement="selectRequestTargetsAndGenerateKeys"> <dc:Bounds x="470" y="187" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_09oplxx_di" bpmnElement="temporarilyStoreMultiMeDICresults"> + <bpmndi:BPMNShape id="Activity_09oplxx_di" bpmnElement="downloadResultSets"> <dc:Bounds x="1120" y="100" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1a9tjil_di" bpmnElement="storeResultSets"> diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java index c4e0c411..bc13b01b 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -44,7 +44,7 @@ public class RequestDataSharingFromMedicsViaMedic1ExampleStarter { private static boolean NEEDS_CONSENT_CHECK = true; - private static boolean NEEDS_RECORD_LINKAGE = true; + private static boolean NEEDS_RECORD_LINKAGE = false; private static final String QUERY = "SELECT e/ehr_status/subject/external_ref/id/value as EHRID, " + "v/items[at0024,'Bezeichnung']/value, v/items [at0001,'Messwert'], " From e271ec20617f4e410e300b603eb0b5736653d2ed Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 15 Mar 2021 16:37:00 +0100 Subject: [PATCH 037/125] code refactoring --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 2 + .../dsf/bpe/message/SendMedicRequest.java | 53 ++++++--- .../dsf/bpe/message/SendMedicResults.java | 5 +- .../dsf/bpe/message/SendMultiMedicErrors.java | 1 - .../dsf/bpe/message/SendTtpRequest.java | 9 +- .../service/CheckDataSharingResources.java | 2 +- .../CheckMedicMultiMedicResultSets.java | 12 +- .../dsf/bpe/service/CheckResultSets.java | 107 ++++++++++++++++++ .../service/CheckSingleMedicResultSets.java | 62 +--------- .../service/CheckTtpMultiMedicResultSets.java | 58 +++++++++- .../service/DownloadDataSharingResources.java | 24 +++- .../service/DownloadMultiMedicResultSets.java | 14 ++- .../DownloadResearchStudyResource.java | 10 +- .../dsf/bpe/service/DownloadResultSets.java | 4 +- .../dsf/bpe/service/ExecuteQueries.java | 6 +- .../dsf/bpe/service/ExtractQueries.java | 14 +-- .../service/FilterQueryResultsByConsent.java | 3 +- .../service/HandleErrorMultiMedicResults.java | 28 ++++- .../dsf/bpe/service/ModifyQueries.java | 34 +++--- .../bpe/service/PseudonymizeResultSets.java | 6 +- .../dsf/bpe/service/SelectRequestTargets.java | 20 +++- .../bpe/service/SelectResponseTargetTtp.java | 1 - .../dsf/bpe/service/StoreResultSets.java | 23 ++-- .../StoreSingleMedicResultSetLinks.java | 35 +++--- .../TranslateSingleMedicResultSets.java | 59 +++++----- ...TranslateSingleMedicResultSetsWithRbf.java | 17 ++- ...nslateSingleMedicResultSetsWithoutRbf.java | 17 ++- .../resources/bpe/executeDataSharing.bpmn | 10 +- ...ringFromMedicsViaMedic1ExampleStarter.java | 2 +- .../highmed/dsf/bpe/ConstantsFeasibility.java | 2 +- .../CheckTtpComputedMultiMedicResults.java | 4 +- 31 files changed, 417 insertions(+), 227 deletions(-) create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index 6e8fb037..0dbf1c24 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -5,6 +5,8 @@ public interface ConstantsDataSharing { + String BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_DATA_SHARING_RESULT = "errorMultiMedicDataSharingResult"; + String BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY = "researchStudy"; String BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER = "researchStudyIdentifier"; String BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK = "needsConsentCheck"; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java index 2455dcc3..a5a03427 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java @@ -23,6 +23,7 @@ import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResearchStudy; +import org.hl7.fhir.r4.model.Task; import org.hl7.fhir.r4.model.Task.ParameterComponent; import ca.uhn.fhir.context.FhirContext; @@ -39,31 +40,22 @@ public SendMedicRequest(FhirWebserviceClientProvider clientProvider, TaskHelper protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); - IdType researchStudyId = new IdType( - getFhirWebserviceClientProvider().getLocalBaseUrl() + "/" + researchStudy.getId()); - - ParameterComponent inputResearchStudyReference = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE, - new Reference().setReference(researchStudyId.toVersionless().getValueAsString())); + ParameterComponent inputResearchStudyReference = getResearchStudyComponent(researchStudy); boolean needsConsentCheck = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); - ParameterComponent inputNeedsConsentCheck = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK, needsConsentCheck); + ParameterComponent inputNeedsConsentCheck = getNeedsConsentCheckComponent(needsConsentCheck); boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); - ParameterComponent inputNeedsRecordLinkage = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + ParameterComponent inputNeedsRecordLinkage = getNeedsRecordLinakgeComponent(needsRecordLinkage); byte[] mdatKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); - ParameterComponent inputMdatKey = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY, mdatKey); + ParameterComponent inputMdatKey = getMdatKeyComponent(mdatKey); if (needsRecordLinkage) { BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); - ParameterComponent inputBloomFilterConfig = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG, bloomFilterConfig.toBytes()); + ParameterComponent inputBloomFilterConfig = getBloomFilterConfigComponent(bloomFilterConfig); return Stream.of(inputResearchStudyReference, inputNeedsConsentCheck, inputNeedsRecordLinkage, inputBloomFilterConfig, inputMdatKey); @@ -74,4 +66,37 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut inputMdatKey); } } + + private Task.ParameterComponent getResearchStudyComponent(ResearchStudy researchStudy) + { + IdType researchStudyId = new IdType( + getFhirWebserviceClientProvider().getLocalBaseUrl() + "/" + researchStudy.getId()); + return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE, + new Reference().setReference(researchStudyId.toVersionless().getValueAsString())); + } + + private Task.ParameterComponent getNeedsConsentCheckComponent(boolean needsConsentCheck) + { + return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK, needsConsentCheck); + } + + private Task.ParameterComponent getNeedsRecordLinakgeComponent(boolean needsRecordLinkage) + { + return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); + } + + private Task.ParameterComponent getMdatKeyComponent(byte[] mdatKey) + { + return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY, mdatKey); + } + + private Task.ParameterComponent getBloomFilterConfigComponent(BloomFilterConfig bloomFilterConfig) + { + return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG, bloomFilterConfig.toBytes()); + } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java index 56fe032a..86e59b68 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java @@ -40,7 +40,7 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut } /** - * @return the code system value that classifies the result set reference Task input + * @return the code system value that classifies the result set reference in the Task input that will be generated */ protected abstract String getResultSetReferenceCodeSystemValue(); @@ -48,9 +48,8 @@ private Task.ParameterComponent toInput(QueryResult result) { if (result.isIdResultSetUrlResult()) { - String resultSetReferenceCodeSystemValue = getResultSetReferenceCodeSystemValue(); ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - resultSetReferenceCodeSystemValue, new Reference(result.getResultSetUrl())); + getResultSetReferenceCodeSystemValue(), new Reference(result.getResultSetUrl())); input.addExtension(createCohortIdExtension(result.getCohortId())); return input; } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java index 4b483b75..cbed88ca 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java @@ -29,7 +29,6 @@ public SendMultiMedicErrors(FhirWebserviceClientProvider clientProvider, TaskHel protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { Task task = getLeadingTaskFromExecutionVariables(); - String taskUrl = new Reference(new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl() + "/Task", task.getIdElement().getIdPart())).getReference(); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java index 28c89dd5..43491240 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java @@ -34,17 +34,18 @@ public SendTtpRequest(FhirWebserviceClientProvider clientProvider, TaskHelper ta @Override protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { - Targets multiInstanceTargets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); - Stream<Task.ParameterComponent> inputTargets = getTargetComponents(multiInstanceTargets); + Targets medicTargets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); + Stream<Task.ParameterComponent> inputMedicTargets = getTargetComponents(medicTargets); boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); Task.ParameterComponent inputNeedsRecordLinkage = getRecordLinkageComponent(needsRecordLinkage); String researchStudyIdentifier = (String) execution .getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER); - Task.ParameterComponent inputResearchStudy = getInputResearchStudyIdentifierComponent(researchStudyIdentifier); + Task.ParameterComponent inputResearchStudyIdentifier = getInputResearchStudyIdentifierComponent( + researchStudyIdentifier); - return Stream.concat(inputTargets, Stream.of(inputNeedsRecordLinkage, inputResearchStudy)); + return Stream.concat(inputMedicTargets, Stream.of(inputNeedsRecordLinkage, inputResearchStudyIdentifier)); } private Stream<Task.ParameterComponent> getTargetComponents(Targets targets) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java index 0a1533ff..83aaaeff 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckDataSharingResources.java @@ -31,7 +31,7 @@ protected void doExecute(DelegateExecution execution) checkConsentCheck(execution); checkFullyQualifiedCohortIds(execution); - // TODO: Define further checks + // TODO: define and implement further checks } private void checkConsentCheck(DelegateExecution execution) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResultSets.java index e01cc565..54a09596 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResultSets.java @@ -1,13 +1,18 @@ package org.highmed.dsf.bpe.service; +import java.util.function.BiFunction; +import java.util.stream.Stream; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class CheckMedicMultiMedicResultSets extends AbstractServiceDelegate +public class CheckMedicMultiMedicResultSets extends CheckResultSets { private static final Logger logger = LoggerFactory.getLogger(CheckMedicMultiMedicResultSets.class); @@ -17,8 +22,9 @@ public CheckMedicMultiMedicResultSets(FhirWebserviceClientProvider clientProvide } @Override - protected void doExecute(DelegateExecution execution) + protected Stream<BiFunction<QueryResult, Task, Boolean>> getChecks(QueryResult result, Task task) { - logger.info(this.getClass().getName() + " doExecute called"); + // TODO: define and implement further result set checks + return Stream.of(this::checkColumns, this::checkRows); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java new file mode 100644 index 00000000..9cbac623 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java @@ -0,0 +1,107 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + +import java.util.List; +import java.util.function.BiFunction; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.ConstantsBase; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public abstract class CheckResultSets extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(CheckResultSets.class); + + public CheckResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + List<QueryResult> filteredResults = filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(results); + List<QueryResult> postProcessedResults = postProcessAllPassingResults(filteredResults); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(postProcessedResults))); + } + + private List<QueryResult> filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(QueryResults results) + { + Task task = getCurrentTaskFromExecutionVariables(); + return results.getResults().stream().filter(r -> testResultAndAddPossibleError(r, task)) + .collect(Collectors.toList()); + } + + private boolean testResultAndAddPossibleError(QueryResult result, Task task) + { + boolean hasFailingCheck = getChecks(result, task).map(check -> check.apply(result, task)) + .anyMatch(Boolean.FALSE::equals); + return !hasFailingCheck; + } + + /** + * @param result + * the {@link QueryResult} that should be checked + * @param task + * the task to which errors should be added as outputs if the check is not passed, use + * {@link #getChecks(QueryResult, Task)} to add the error output + * @return a list of checks that should be performed for given {@link QueryResult}, each check returning + * <code>true</code> if the check is passed, <code>false</code> otherwise + */ + protected abstract Stream<BiFunction<QueryResult, Task, Boolean>> getChecks(QueryResult result, Task task); + + /** + * @param passedResults + * all {@link QueryResult} objects that passed the checks defined by + * {@link #getChecks(QueryResult, Task)} + * @return a list of {@link QueryResult} objects after post processing + */ + protected List<QueryResult> postProcessAllPassingResults(List<QueryResult> passedResults) + { + return passedResults; + } + + protected void addError(Task task, String cohortId, String error) + { + String errorMessage = "Data sharing query result check failed for group with id='" + cohortId + "', reason: " + + error; + logger.warn(errorMessage); + + task.getOutput().add(getTaskHelper().createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN, + ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage)); + } + + protected boolean checkColumns(QueryResult result, Task task) + { + boolean hasError = result.getResultSet().getColumns().size() < 1; + + if (hasError) + addError(task, result.getCohortId(), "no columns present"); + + return hasError; + } + + protected boolean checkRows(QueryResult result, Task task) + { + boolean hasError = result.getResultSet().getRows().size() < 1; + + if (hasError) + addError(task, result.getCohortId(), "no rows present"); + + return hasError; + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java index 2a54899e..9ef985ff 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java @@ -1,74 +1,24 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import java.util.function.BiFunction; +import java.util.stream.Stream; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.ConstantsBase; -import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.QueryResult; -import org.highmed.dsf.bpe.variable.QueryResults; -import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -public class CheckSingleMedicResultSets extends AbstractServiceDelegate +public class CheckSingleMedicResultSets extends CheckResultSets { - private static final Logger logger = LoggerFactory.getLogger(CheckSingleMedicResultSets.class); - public CheckSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) { super(clientProvider, taskHelper); } @Override - protected void doExecute(DelegateExecution execution) - { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - - Task currentTask = getCurrentTaskFromExecutionVariables(); - List<QueryResult> filteredResults = filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(results, - currentTask); - - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - QueryResultsValues.create(new QueryResults(filteredResults))); - } - - private List<QueryResult> filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(QueryResults results, Task task) + protected Stream<BiFunction<QueryResult, Task, Boolean>> getChecks(QueryResult result, Task task) { - List<QueryResult> filteredResults = new ArrayList<>(); - for (QueryResult result : results.getResults()) - { - Optional<String> errorReason = testResultAndReturnErrorReason(result); - if (errorReason.isPresent()) - addError(task, result.getCohortId(), errorReason.get()); - else - filteredResults.add(result); - } - - return filteredResults; - } - - private Optional<String> testResultAndReturnErrorReason(QueryResult result) - { - // TODO: implement check - // result size > 0 - // other filter criteria tbd - return Optional.empty(); - } - - private void addError(Task task, String cohortId, String error) - { - String errorMessage = "Data sharing query result check failed for group with id '" + cohortId + "': " + error; - logger.info(errorMessage); - - task.getOutput().add(getTaskHelper().createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN, - ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage)); + // TODO: define and implement further result set checks + return Stream.of(this::checkColumns, this::checkRows); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java index 82be3b9d..759d5985 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java @@ -1,13 +1,24 @@ package org.highmed.dsf.bpe.service; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_DATA_SHARING_RESULT; + +import java.util.List; +import java.util.function.BiFunction; +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.highmed.dsf.bpe.variable.QueryResult; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class CheckTtpMultiMedicResultSets extends AbstractServiceDelegate +public class CheckTtpMultiMedicResultSets extends CheckResultSets { private static final Logger logger = LoggerFactory.getLogger(CheckTtpMultiMedicResultSets.class); @@ -17,9 +28,44 @@ public CheckTtpMultiMedicResultSets(FhirWebserviceClientProvider clientProvider, } @Override - protected void doExecute(DelegateExecution execution) + protected Stream<BiFunction<QueryResult, Task, Boolean>> getChecks(QueryResult result, Task task) + { + // TODO: define and implement further result set checks + return Stream.of(this::checkColumns, this::checkRows); + } + + @Override + protected List<QueryResult> postProcessAllPassingResults(List<QueryResult> passedResults) + { + if (!atLeastOneResultExists(passedResults)) + throw new BpmnError(BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_DATA_SHARING_RESULT); + + return passedResults; + } + + private boolean atLeastOneResultExists(List<QueryResult> results) { - // TODO: implement checks - logger.info(this.getClass().getName() + " doExecute called"); + Task leadingTask = getLeadingTaskFromExecutionVariables(); + String taskId = leadingTask.getId(); + String businessKey = getTaskHelper().getFirstInputParameterStringValue(leadingTask, CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY).orElse(null); + String correlationKey = getTaskHelper().getFirstInputParameterStringValue(leadingTask, CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY).orElse(null); + + if (results.size() < 1) + { + logger.warn( + "Did not receive any results from participating MeDICs for any cohort definition in the " + + "data sharing request with task-id='{}', business-key='{}' and correlation-key='{}'", + taskId, businessKey, correlationKey); + + leadingTask.getOutput() + .add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, + "Did not receive any results from participating MeDICs for any cohort definition")); + + return false; + } + + return true; } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java index c2c9e1f5..6d2fd812 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java @@ -37,6 +37,7 @@ import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResearchStudy; +import org.hl7.fhir.r4.model.Resource; import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -70,7 +71,7 @@ protected void doExecute(DelegateExecution execution) FhirWebserviceClient client = getWebserviceClient(researchStudyId); Bundle bundle = getResearchStudyAndCohortDefinitions(researchStudyId, client); - ResearchStudy researchStudy = (ResearchStudy) bundle.getEntryFirstRep().getResource(); + ResearchStudy researchStudy = getResearchStudy(bundle); execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY, FhirResourceValues.create(researchStudy)); List<Group> cohortDefinitions = getCohortDefinitions(bundle, client.getBaseUrl()); @@ -98,9 +99,12 @@ protected void doExecute(DelegateExecution execution) private IdType getResearchStudyId(Task task) { - Reference researchStudyReference = getTaskHelper().getInputParameterReferenceValues(task, - CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE) - .findFirst().get(); + Reference researchStudyReference = getTaskHelper() + .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("ResearchStudy reference is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation")); return new IdType(researchStudyReference.getReference()); } @@ -136,7 +140,7 @@ else if (!bundle.getEntryFirstRep().hasResource() throw new RuntimeException("Returned search-set did not contain ResearchStudy at index == 0"); } else if (bundle.getEntry().stream().skip(1).map(c -> c.hasResource() && c.getResource() instanceof Group) - .filter(b -> !b).findAny().isPresent()) + .anyMatch(b -> !b)) { throw new RuntimeException("Returned search-set contained unexpected resource at index >= 1"); } @@ -151,6 +155,16 @@ else if (bundle.getEntry().stream().skip(1).map(c -> c.hasResource() && c.getRes } } + private ResearchStudy getResearchStudy(Bundle bundle) + { + Resource resource = bundle.getEntryFirstRep().getResource(); + if (resource instanceof ResearchStudy) + return (ResearchStudy) resource; + else + throw new RuntimeException("Expected first bundle entry to be of type research study"); + + } + private List<Group> getCohortDefinitions(Bundle bundle, String baseUrl) { return bundle.getEntry().stream().skip(1).map(e -> diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java index 103e6205..160370a2 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java @@ -32,12 +32,14 @@ protected List<QueryResult> getQueryResults(DelegateExecution execution) return getTaskHelper().getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE, EXTENSION_HIGHMED_GROUP_ID) - .map(input -> - { - String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); - String resultSetUrl = ((Reference) input.getValue()).getReference(); + .map(input -> toQueryResult(input, requester)).collect(Collectors.toList()); + } + + private QueryResult toQueryResult(Task.ParameterComponent input, Reference requester) + { + String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); + String resultSetUrl = ((Reference) input.getValue()).getReference(); - return QueryResult.idResult(requester.getIdentifier().getValue(), cohortId, resultSetUrl); - }).collect(Collectors.toList()); + return QueryResult.idResult(requester.getIdentifier().getValue(), cohortId, resultSetUrl); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java index 73a33184..29e2add4 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -56,14 +56,16 @@ protected void doExecute(DelegateExecution execution) IdType researchStudyId = getResearchStudyId(task); ResearchStudy researchStudy = getResearchStudy(researchStudyId, client); + execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY, researchStudy); + String researchStudyIdentifier = getResearchStudyIdentifier(researchStudy); - boolean needsConsentCheck = getNeedsConsentCheck(task); - boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER, researchStudyIdentifier); - execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY, researchStudy); + boolean needsConsentCheck = getNeedsConsentCheck(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK, needsConsentCheck); + + boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); - execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER, researchStudyIdentifier); execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_MEDIC_IDENTIFIER, organizationProvider.getLocalIdentifierValue()); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java index 891530f3..5415c48d 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java @@ -58,8 +58,8 @@ protected void doExecute(DelegateExecution execution) /** * @param execution - * The process execution environment - * @return The QueryResult objects containing the corresponding Binary result set url. + * the process execution environment + * @return the {@link QueryResult} objects containing the corresponding Binary result set url. */ protected abstract List<QueryResult> getQueryResults(DelegateExecution execution); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java index 168f5b10..b47f91f7 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -45,8 +45,8 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - // <groupId, query> @SuppressWarnings("unchecked") + // <groupId, query> Map<String, String> queries = (Map<String, String>) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERIES); List<QueryResult> results = queries.entrySet().stream() @@ -58,9 +58,7 @@ protected void doExecute(DelegateExecution execution) throws Exception private QueryResult executeQuery(String cohortId, String cohortQuery) { - // TODO We might want to introduce a more complex result type to represent a count, - // errors and possible meta-data. - + // TODO: introduce a more complex result type to represent a count, errors and possible meta-data ResultSet resultSet = openehrClient.query(cohortQuery, null); return QueryResult.idResult(organizationProvider.getLocalIdentifierValue(), cohortId, resultSet); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExtractQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExtractQueries.java index c7392823..c4f36c3f 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExtractQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ExtractQueries.java @@ -3,10 +3,10 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; @@ -41,16 +41,8 @@ protected void doExecute(DelegateExecution execution) throws Exception .getResourcesAndCast(); // <groupId, query> - Map<String, String> queries = new HashMap<>(); - - cohorts.forEach(group -> - { - String aqlQuery = groupHelper.extractAqlQuery(group); - String groupId = group.getId(); - - queries.put(groupId, aqlQuery); - }); - + Map<String, String> queries = cohorts.stream() + .collect(Collectors.toMap(Group::getId, groupHelper::extractAqlQuery)); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERIES, queries); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java index f577dccf..fc21547b 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java @@ -19,6 +19,7 @@ public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, @Override protected void doExecute(DelegateExecution execution) throws Exception { - logger.info(this.getClass().getName() + " doExecute called"); + // TODO: implement doExecute + logger.debug(this.getClass().getName() + " doExecute called"); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java index 174f9a4b..297c2b71 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java @@ -1,9 +1,11 @@ package org.highmed.dsf.bpe.service; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.ConstantsBase; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -19,6 +21,30 @@ public HandleErrorMultiMedicResults(FhirWebserviceClientProvider clientProvider, @Override protected void doExecute(DelegateExecution execution) { - logger.info(this.getClass().getName() + " doExecute called"); + Task currentTask = getCurrentTaskFromExecutionVariables(); + Task leadingTask = getLeadingTaskFromExecutionVariables(); + + currentTask.getInput().stream().filter(this::isErrorInput) + .forEach(input -> transformToOutput(currentTask.getId(), input, leadingTask)); + + // The current task finishes here but is not automatically set to completed + // because it is an additional task during the execution of the main process + currentTask.setStatus(Task.TaskStatus.COMPLETED); + getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().update(currentTask); + } + + private boolean isErrorInput(Task.ParameterComponent input) + { + return input.getType().getCoding().stream() + .anyMatch(code -> code.getSystem().equals(ConstantsBase.CODESYSTEM_HIGHMED_BPMN) + && code.getCode().equals(ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR)); + } + + private void transformToOutput(String taskId, Task.ParameterComponent input, Task leadingTask) + { + String errorMessage = input.getValue().primitiveValue(); + logger.warn("Received data sharing error in task with id='{}', reason: {}", taskId, errorMessage); + leadingTask.getOutput().add(getTaskHelper().createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN, + ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage)); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java index 88bd43d7..ec5d66ec 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java @@ -4,9 +4,9 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; -import java.util.HashMap; import java.util.Map; import java.util.Objects; +import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; @@ -40,39 +40,33 @@ protected void doExecute(DelegateExecution execution) { Boolean needsConsentCheck = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); - boolean idQuery = Boolean.TRUE.equals(needsConsentCheck) || Boolean.TRUE.equals(needsRecordLinkage); - if (idQuery) + if (Boolean.TRUE.equals(needsConsentCheck) || Boolean.TRUE.equals(needsRecordLinkage)) { - // <groupId, query> @SuppressWarnings("unchecked") + // <groupId, query> Map<String, String> queries = (Map<String, String>) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERIES); - Map<String, String> modifiedQueries = modifyQueries(queries); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERIES, modifiedQueries); } } private Map<String, String> modifyQueries(Map<String, String> queries) { - Map<String, String> modifiedQueries = new HashMap<>(); + return queries.entrySet().stream() + .collect(Collectors.toMap(Map.Entry::getKey, entry -> modify(entry.getValue()))); + } - for (Map.Entry<String, String> entry : queries.entrySet()) + private String modify(String query) + { + // TODO: implement correct check for id query + if (!query.startsWith("SELECT e" + ehrIdColumnPath + " as EHRID")) { - String query = entry.getValue(); - - // TODO Implement correct check for default id query - if (!query.startsWith("SELECT e" + ehrIdColumnPath + " as EHRID")) - { - query = query.replace("SELECT", "SELECT e" + ehrIdColumnPath + " as EHRID,"); - logger.warn("Query does not start with '{}', adapting SELECT statement", - "SELECT e" + ehrIdColumnPath + " as EHRID"); - } - - modifiedQueries.put(entry.getKey(), query); + query = query.replace("SELECT", "SELECT e" + ehrIdColumnPath + " as EHRID,"); + logger.warn("Query does not start with '{}', adapting SELECT statement", + "SELECT e" + ehrIdColumnPath + " as EHRID"); } - return modifiedQueries; + return query; } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java index 35044da6..b879ebe6 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java @@ -71,7 +71,7 @@ protected void doExecute(DelegateExecution execution) throws Exception String researchStudyIdentifier = (String) execution .getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER); - // TODO: store key with corresponding research study id + // TODO: store pseudonym key with corresponding research study id SecretKey researchStudyKey = AesGcmUtil.generateAES256Key(); Map<String, List<QueryResult>> byCohortId = groupByCohortId(results); @@ -86,7 +86,7 @@ private Map<String, List<QueryResult>> groupByCohortId(QueryResults results) } private QueryResults createFinalResults(String researchStudyIdentifier, SecretKey reserchStudyKey, - Map<String, List<QueryResult>> groupedResults) throws NoSuchAlgorithmException + Map<String, List<QueryResult>> groupedResults) { ResultSetTranslatorFromMedic translatorFromMedic = createResultSetTranslatorFromMedic(); ResultSetTranslatorToMedic translatorToMedic = createResultSetTranslatorToMedic(); @@ -165,7 +165,7 @@ private ResultSet translateToMedicResultSet(ResultSet toTranslate, ResultSetTran } /** - * @return + * @return the {@link ResultSetTranslatorFromMedic} that should be used to translate the result sets */ protected abstract ResultSetTranslatorFromMedic createResultSetTranslatorFromMedic(); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index a4172588..cb379fe0 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -75,15 +75,21 @@ protected void doExecute(DelegateExecution execution) throws Exception { ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); - execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(getMedicTargets(researchStudy))); - execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(getTtpTarget(researchStudy))); - execution.setVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY, AesGcmUtil.generateAES256Key().getEncoded()); + Targets medicTargets = getMedicTargets(researchStudy); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(medicTargets)); + + Target ttpTarget = getTtpTarget(researchStudy); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(ttpTarget)); + + byte[] mdatKey = AesGcmUtil.generateAES256Key().getEncoded(); + execution.setVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY, mdatKey); Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); if (Boolean.TRUE.equals(needsRecordLinkage)) { + BloomFilterConfig bloomFilterConfig = createBloomFilterConfig(); execution.setVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG, - BloomFilterConfigValues.create(createBloomFilterConfig())); + BloomFilterConfigValues.create(bloomFilterConfig)); } } @@ -94,6 +100,10 @@ private Targets getMedicTargets(ResearchStudy researchStudy) .map(r -> Target.createBiDirectionalTarget(r.getIdentifier().getValue(), UUID.randomUUID().toString())) .collect(Collectors.toList()); + if (targets.size() < 1) + throw new IllegalArgumentException("No participating MeDICs are set in ResearchStudy with id='" + + researchStudy.getId() + "', this error should have been caught by resource validation"); + return new Targets(targets); } @@ -104,7 +114,7 @@ private Target getTtpTarget(ResearchStudy researchStudy) .map(r -> Target.createUniDirectionalTarget(r.getIdentifier().getValue())).findFirst() .orElseThrow(() -> new IllegalArgumentException( "Participating TTP is not set in ResearchStudy with id='" + researchStudy.getId() - + "', this error should " + "have been caught by resource validation")); + + "', this error should have been caught by resource validation")); } private BloomFilterConfig createBloomFilterConfig() diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java index 830c03ee..99acba32 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java @@ -39,7 +39,6 @@ protected void doExecute(DelegateExecution execution) { String ttpIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); String correlationKey = getCorrelationKey(); - Target ttpTarget = Target.createBiDirectionalTarget(ttpIdentifier, correlationKey); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(ttpTarget)); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java index dfd76187..b75e0ee2 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java @@ -55,10 +55,8 @@ protected void doExecute(DelegateExecution execution) throws Exception QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); String securityIdentifier = getSecurityIdentifier(execution); - List<QueryResult> storedResults = results.getResults().stream() - .map(result -> saveResultSetAsBinary(result, securityIdentifier)).collect(Collectors.toList()); - - List<QueryResult> postProcessedResults = postProcessStoredResults(storedResults, execution); + List<QueryResult> savedResults = saveQueryResults(results, securityIdentifier); + List<QueryResult> postProcessedResults = postProcessStoredResults(savedResults, execution); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(postProcessedResults))); @@ -66,23 +64,30 @@ protected void doExecute(DelegateExecution execution) throws Exception /** * @param execution - * The process execution environment - * @return Identifier of the organization that can read the stored binary resource from the local FHIR server + * the bpmn process execution environment + * @return the identifier of the organization that should have read access to the stored Binary resource from the + * local FHIR server */ protected abstract String getSecurityIdentifier(DelegateExecution execution); /** * @param storedResults - * The QueryResult objects after storing them to the local FHIR server + * the {@link QueryResult} objects after storing them to the local FHIR server * @param execution - * The process execution environment - * @return The QueryResult objects after post processing + * the bpmn process execution environment + * @return the {@link QueryResult} objects after post processing */ protected List<QueryResult> postProcessStoredResults(List<QueryResult> storedResults, DelegateExecution execution) { return storedResults; } + private List<QueryResult> saveQueryResults(QueryResults results, String securityIdentifier) + { + return results.getResults().stream().map(result -> saveResultSetAsBinary(result, securityIdentifier)) + .collect(Collectors.toList()); + } + private QueryResult saveResultSetAsBinary(QueryResult result, String securityIdentifier) { String binaryId = save(result.getResultSet(), securityIdentifier); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSetLinks.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSetLinks.java index 0c38c268..21c4fd7b 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSetLinks.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSetLinks.java @@ -2,14 +2,15 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE; import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_GROUP_ID; -import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.stream.Collectors; +import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.ConstantsDataSharing; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.QueryResult; import org.highmed.dsf.bpe.variable.QueryResults; @@ -29,30 +30,30 @@ public StoreSingleMedicResultSetLinks(FhirWebserviceClientProvider clientProvide @Override protected void doExecute(DelegateExecution execution) { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - List<QueryResult> extendedResults = new ArrayList<>(results.getResults()); + QueryResults currentResults = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + List<QueryResult> newResults = getNewResults(); - Task task = getCurrentTaskFromExecutionVariables(); - extendedResults.addAll(getResults(task, - ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE)); + List<QueryResult> extendedResults = Stream.of(currentResults.getResults(), newResults) + .flatMap(Collection::stream).collect(Collectors.toList()); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(extendedResults))); } - private List<QueryResult> getResults(Task task, String code) + private List<QueryResult> getNewResults() { - TaskHelper taskHelper = getTaskHelper(); + Task task = getCurrentTaskFromExecutionVariables(); Reference requester = task.getRequester(); - return taskHelper - .getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, code, EXTENSION_HIGHMED_GROUP_ID) - .map(input -> - { - String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); - String resultSetUrl = ((Reference) input.getValue()).getReference(); + return getTaskHelper().getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE, EXTENSION_HIGHMED_GROUP_ID) + .map(input -> getQueryResult(input, requester)).collect(Collectors.toList()); + } - return QueryResult.idResult(requester.getIdentifier().getValue(), cohortId, resultSetUrl); - }).collect(Collectors.toList()); + private QueryResult getQueryResult(Task.ParameterComponent input, Reference requester) + { + String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); + String resultSetUrl = ((Reference) input.getValue()).getReference(); + return QueryResult.idResult(requester.getIdentifier().getValue(), cohortId, resultSetUrl); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java index e7f45ad7..0498e409 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java @@ -8,7 +8,6 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.pseudonymization.crypto.AesGcmUtil.AES; -import java.security.NoSuchAlgorithmException; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -85,17 +84,16 @@ protected void doExecute(DelegateExecution execution) throws Exception String organizationIdentifier = organizationProvider.getLocalIdentifierValue(); String researchStudyIdentifier = getResearchStudyIdentifier(execution); SecretKey mdatKey = getMdatKey(execution); - boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); - RecordBloomFilterGenerator bloomFilterGenerator = createRecordBloomFilterGenerator(execution, - needsRecordLinkage); + RecordBloomFilterGenerator bloomFilterGenerator = needsRecordLinkage + ? createRecordBloomFilterGenerator(execution) + : null; - ResultSetTranslatorToTtp resultSetTranslator = createResultSetTranslator(organizationIdentifier, - researchStudyIdentifier, mdatKey, ehrIdColumnPath, masterPatientIndexClient, bloomFilterGenerator); + ResultSetTranslatorToTtp translator = createResultSetTranslator(organizationIdentifier, researchStudyIdentifier, + mdatKey, ehrIdColumnPath, masterPatientIndexClient, bloomFilterGenerator); QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - List<QueryResult> translatedResults = results.getResults().stream() - .map(result -> translateAndCreateBinary(resultSetTranslator, result)).collect(Collectors.toList()); + List<QueryResult> translatedResults = translateResults(translator, results); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(translatedResults))); @@ -117,42 +115,45 @@ private SecretKey getMdatKey(DelegateExecution execution) return new SecretKeySpec(encodedKey, AES); } - private RecordBloomFilterGenerator createRecordBloomFilterGenerator(DelegateExecution execution, - boolean needsRecordLinkage) + private RecordBloomFilterGenerator createRecordBloomFilterGenerator(DelegateExecution execution) { - if (needsRecordLinkage) - { - BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution - .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); - return new RecordBloomFilterGeneratorImpl(RBF_LENGTH, bloomFilterConfig.getPermutationSeed(), FBF_WEIGHTS, - FBF_LENGTHS, - () -> new BloomFilterGenerator.HmacSha2HmacSha3BiGramHasher(bloomFilterConfig.getHmacSha2Key(), - bloomFilterConfig.getHmacSha2Key(), bouncyCastleProvider)); - } - else - { - return null; - } + BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution + .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); + return new RecordBloomFilterGeneratorImpl(RBF_LENGTH, bloomFilterConfig.getPermutationSeed(), FBF_WEIGHTS, + FBF_LENGTHS, + () -> new BloomFilterGenerator.HmacSha2HmacSha3BiGramHasher(bloomFilterConfig.getHmacSha2Key(), + bloomFilterConfig.getHmacSha2Key(), bouncyCastleProvider)); } /** * @param organizationIdentifier + * the FHIR identifier of the current organization * @param researchStudyIdentifier + * the FHIR identifier of the ResearchStudy defining the data sharing request * @param mdatKey + * the key provided by the leading MeDIC to encrypt the MDAT * @param ehrIdColumnPath + * the path to the external subject id column * @param masterPatientIndexClient + * the client to retrieve the {@link org.highmed.mpi.client.Idat} from the MPI, may be null * @param recordBloomFilterGenerator - * @return - * @throws NoSuchAlgorithmException + * the generator to create RBFs based on the {@link org.highmed.mpi.client.Idat} provided by the + * masterPatientIndexClient, may be null + * @return {@link ResultSetTranslatorToTtp} */ abstract protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, String researchStudyIdentifier, SecretKey mdatKey, String ehrIdColumnPath, - MasterPatientIndexClient masterPatientIndexClient, RecordBloomFilterGenerator recordBloomFilterGenerator) - throws NoSuchAlgorithmException; + MasterPatientIndexClient masterPatientIndexClient, RecordBloomFilterGenerator recordBloomFilterGenerator); + + private List<QueryResult> translateResults(ResultSetTranslatorToTtp translator, QueryResults results) + { + return results.getResults().stream().map(result -> translateAndCreateBinary(translator, result)) + .collect(Collectors.toList()); + } - private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtp resultSetTranslator, QueryResult result) + private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtp translator, QueryResult result) { - ResultSet translatedResultSet = translate(resultSetTranslator, result.getResultSet()); + ResultSet translatedResultSet = translate(translator, result.getResultSet()); return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), translatedResultSet); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java index 88d5b095..e8d4f7b7 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java @@ -29,12 +29,17 @@ public TranslateSingleMedicResultSetsWithRbf(FhirWebserviceClientProvider client protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, String researchStudyIdentifier, SecretKey mdatKey, String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, RecordBloomFilterGenerator recordBloomFilterGenerator) - throws NoSuchAlgorithmException { - // TODO: should be provided by properties or pseudonym provider - SecretKey idatKey = AesGcmUtil.generateAES256Key(); - - return new ResultSetTranslatorToTtpWithRbfImpl(organizationIdentifier, idatKey, researchStudyIdentifier, - mdatKey, ehrIdColumnPath, recordBloomFilterGenerator, masterPatientIndexClient); + try + { + // TODO: implement and use pseudonym provider to get IDAT key + SecretKey idatKey = AesGcmUtil.generateAES256Key(); + return new ResultSetTranslatorToTtpWithRbfImpl(organizationIdentifier, idatKey, researchStudyIdentifier, + mdatKey, ehrIdColumnPath, recordBloomFilterGenerator, masterPatientIndexClient); + } + catch (NoSuchAlgorithmException e) + { + throw new RuntimeException("Could not get IDAT key", e); + } } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java index 9e660b58..b13770e1 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java @@ -26,12 +26,17 @@ public TranslateSingleMedicResultSetsWithoutRbf(FhirWebserviceClientProvider cli protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, String researchStudyIdentifier, SecretKey mdatKey, String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, RecordBloomFilterGenerator recordBloomFilterGenerator) - throws NoSuchAlgorithmException { - // TODO: should be provided by properties or pseudonym provider - SecretKey idatKey = AesGcmUtil.generateAES256Key(); - - return new ResultSetTranslatorToTtpNoRbfImpl(organizationIdentifier, idatKey, researchStudyIdentifier, mdatKey, - ehrIdColumnPath); + try + { + // TODO: implement and use pseudonym provider to get IDAT key + SecretKey idatKey = AesGcmUtil.generateAES256Key(); + return new ResultSetTranslatorToTtpNoRbfImpl(organizationIdentifier, idatKey, researchStudyIdentifier, + mdatKey, ehrIdColumnPath); + } + catch (NoSuchAlgorithmException e) + { + throw new RuntimeException("Could not get IDAT key", e); + } } } diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index 5ac31013..81266931 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -158,7 +158,7 @@ <di:waypoint x="1305" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1ecoehc_di" bpmnElement="Flow_1ecoehc"> - <di:waypoint x="660" y="212" /> + <di:waypoint x="650" y="212" /> <di:waypoint x="720" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0qsitvp_di" bpmnElement="Flow_0qsitvp"> @@ -167,7 +167,7 @@ </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1kp6eaq_di" bpmnElement="Flow_1kp6eaq"> <di:waypoint x="500" y="212" /> - <di:waypoint x="560" y="212" /> + <di:waypoint x="550" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0kzp6tl_di" bpmnElement="SequenceFlow_0kzp6tl"> <di:waypoint x="1217" y="315" /> @@ -242,9 +242,6 @@ <bpmndi:BPMNShape id="Activity_1ok9q8j_di" bpmnElement="addIdSelectionIfMissing"> <dc:Bounds x="720" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1vlv5ud_di" bpmnElement="extractQueries"> - <dc:Bounds x="560" y="172" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_118ojzy_di" bpmnElement="Gateway_118ojzy" isMarkerVisible="true"> <dc:Bounds x="1305" y="187" width="50" height="50" /> <bpmndi:BPMNLabel> @@ -263,6 +260,9 @@ <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> <dc:Bounds x="330" y="80" width="267" height="56" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1vlv5ud_di" bpmnElement="extractQueries"> + <dc:Bounds x="550" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> <di:waypoint x="455" y="172" /> <di:waypoint x="460" y="136" /> diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java index bc13b01b..c4e0c411 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -44,7 +44,7 @@ public class RequestDataSharingFromMedicsViaMedic1ExampleStarter { private static boolean NEEDS_CONSENT_CHECK = true; - private static boolean NEEDS_RECORD_LINKAGE = false; + private static boolean NEEDS_RECORD_LINKAGE = true; private static final String QUERY = "SELECT e/ehr_status/subject/external_ref/id/value as EHRID, " + "v/items[at0024,'Bezeichnung']/value, v/items [at0001,'Messwert'], " diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java index d84edc8e..15b4ffb5 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java @@ -5,7 +5,7 @@ public interface ConstantsFeasibility { - String BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_RESULT = "errorMultiMedicFeasibilityResult"; + String BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_FEASIBILITY_RESULT = "errorMultiMedicFeasibilityResult"; // Must be 3 or larger, as otherwise it is possible to draw conclusions about the individual MeDICs // (if I already know the cohort size in my MeDIC) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java index c02f3b0d..69a728a4 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckTtpComputedMultiMedicResults.java @@ -5,7 +5,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_RESULT; +import static org.highmed.dsf.bpe.ConstantsFeasibility.BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_FEASIBILITY_RESULT; import static org.highmed.dsf.bpe.ConstantsFeasibility.MIN_PARTICIPATING_MEDICS_FOR_FEASIBILITY; import java.util.List; @@ -49,7 +49,7 @@ protected void doExecute(DelegateExecution execution) throws Exception resultsWithEnoughParticipatingMedics); if (!existsAtLeastOneResult) - throw new BpmnError(BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_RESULT); + throw new BpmnError(BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_FEASIBILITY_RESULT); } private List<FinalFeasibilityQueryResult> filterResultsByParticipatingMedics(Task leadingTask, From 49e1a41564b6936f6b5c96aca38327b0815c23dc Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 15 Mar 2021 16:45:44 +0100 Subject: [PATCH 038/125] remove unused imports --- .../highmed/dsf/bpe/DataSharingProcessPluginDefinition.java | 1 - .../dsf/bpe/service/CheckMedicMultiMedicResultSets.java | 6 ------ .../org/highmed/dsf/bpe/service/PseudonymizeResultSets.java | 1 - 3 files changed, 8 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java index 0c6f71dc..8940242c 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java @@ -10,7 +10,6 @@ import org.highmed.dsf.fhir.resources.AbstractResource; import org.highmed.dsf.fhir.resources.ActivityDefinitionResource; import org.highmed.dsf.fhir.resources.CodeSystemResource; -import org.highmed.dsf.fhir.resources.NamingSystemResource; import org.highmed.dsf.fhir.resources.ResourceProvider; import org.highmed.dsf.fhir.resources.StructureDefinitionResource; import org.highmed.dsf.fhir.resources.ValueSetResource; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResultSets.java index 54a09596..5d721c76 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResultSets.java @@ -3,19 +3,13 @@ import java.util.function.BiFunction; import java.util.stream.Stream; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.QueryResult; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class CheckMedicMultiMedicResultSets extends CheckResultSets { - private static final Logger logger = LoggerFactory.getLogger(CheckMedicMultiMedicResultSets.class); - public CheckMedicMultiMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) { super(clientProvider, taskHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java index b879ebe6..ba5cc0cb 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java @@ -3,7 +3,6 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER; -import java.security.NoSuchAlgorithmException; import java.util.List; import java.util.Map; import java.util.Objects; From 11f1f4ec7212f5700231c993ee6482db9c99a52c Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 17 Mar 2021 14:30:19 +0100 Subject: [PATCH 039/125] adds crypto read/write --- dsf-bpe-process-data-sharing/README.md | 14 ++++ .../highmed/dsf/bpe/crypto/KeyConsumer.java | 8 +++ .../highmed/dsf/bpe/crypto/KeyProvider.java | 8 +++ .../dsf/bpe/crypto/KeyStoreHelper.java | 34 +++++++++ .../highmed/dsf/bpe/crypto/KeyStoreIo.java | 52 ++++++++++++++ .../dsf/bpe/crypto/SecretKeyConsumerImpl.java | 60 ++++++++++++++++ .../dsf/bpe/crypto/SecretKeyProviderImpl.java | 70 +++++++++++++++++++ .../bpe/service/PseudonymizeResultSets.java | 16 ++++- ...eudonymizeResultSetsWithRecordLinkage.java | 5 +- ...onymizeResultSetsWithoutRecordLinkage.java | 5 +- .../TranslateSingleMedicResultSets.java | 20 ++++-- ...TranslateSingleMedicResultSetsWithRbf.java | 23 ++---- ...nslateSingleMedicResultSetsWithoutRbf.java | 23 ++---- .../bpe/spring/config/DataSharingConfig.java | 41 +++++++++-- 14 files changed, 330 insertions(+), 49 deletions(-) create mode 100644 dsf-bpe-process-data-sharing/README.md create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyConsumer.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyProvider.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreHelper.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyConsumerImpl.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java diff --git a/dsf-bpe-process-data-sharing/README.md b/dsf-bpe-process-data-sharing/README.md new file mode 100644 index 00000000..eac2a46d --- /dev/null +++ b/dsf-bpe-process-data-sharing/README.md @@ -0,0 +1,14 @@ +## Properties + +**MeDIC** +`keytool -genseckey -alias <organization-identifier> -keyalg aes -keysize 256 -keystore organization-key.jceks -storetype jceks` +where `<organization-identifier>` is the same as the property `org.highmed.dsf.bpe.fhir.organization.identifier.localValue` and the password for the key + +* org.highmed.dsf.bpe.psn.organizationKey.keystore.file=conf/organization-key.jceks +* org.highmed.dsf.bpe.psn.organizationKey.keystore.password=password + +**TTP** +Keystore will be created if none exists + +* org.highmed.dsf.bpe.psn.researchStudyKeys.keystore.file=conf/research-study-keystore.jceks +* org.highmed.dsf.bpe.psn.researchStudyKeys.keystore.password=password \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyConsumer.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyConsumer.java new file mode 100644 index 00000000..834a93d8 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyConsumer.java @@ -0,0 +1,8 @@ +package org.highmed.dsf.bpe.crypto; + +import java.security.Key; + +public interface KeyConsumer +{ + void store(String alias, Key key); +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyProvider.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyProvider.java new file mode 100644 index 00000000..2294f3f7 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyProvider.java @@ -0,0 +1,8 @@ +package org.highmed.dsf.bpe.crypto; + +import java.security.Key; + +public interface KeyProvider +{ + Key get(String alias); +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreHelper.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreHelper.java new file mode 100644 index 00000000..54c40427 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreHelper.java @@ -0,0 +1,34 @@ +package org.highmed.dsf.bpe.crypto; + +import java.io.IOException; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; + +public class KeyStoreHelper +{ + public static final String JCEKS = "JCEKS"; + public static final String PKCS12 = "PKCS12"; + + public static KeyStore createJceks(char[] password) + throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException + { + return create(password, JCEKS); + } + + public static KeyStore createPkcs12(char[] password) + throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException + { + return create(password, PKCS12); + } + + private static KeyStore create(char[] password, String type) + throws KeyStoreException, CertificateException, NoSuchAlgorithmException, IOException + { + KeyStore keyStore = KeyStore.getInstance(type); + keyStore.load(null, password); + + return keyStore; + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java new file mode 100644 index 00000000..6864703d --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java @@ -0,0 +1,52 @@ +package org.highmed.dsf.bpe.crypto; + +import static java.nio.file.StandardOpenOption.APPEND; +import static java.nio.file.StandardOpenOption.CREATE; +import static org.highmed.dsf.bpe.crypto.KeyStoreHelper.JCEKS; +import static org.highmed.dsf.bpe.crypto.KeyStoreHelper.PKCS12; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; + +public class KeyStoreIo +{ + public static KeyStore readJceks(Path file, char[] password) + throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException + { + return read(file, password, JCEKS); + } + + public static KeyStore readPkcs12(Path file, char[] password) + throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException + { + return read(file, password, PKCS12); + } + + private static KeyStore read(Path file, char[] password, String type) + throws KeyStoreException, IOException, CertificateException, NoSuchAlgorithmException + { + try (InputStream stream = Files.newInputStream(file)) + { + KeyStore keystore = KeyStore.getInstance(type); + keystore.load(stream, password); + + return keystore; + } + } + + public static void write(KeyStore keystore, Path file, char[] password) + throws IOException, CertificateException, NoSuchAlgorithmException, KeyStoreException + { + try (OutputStream stream = Files.newOutputStream(file, CREATE, APPEND)) + { + keystore.store(stream, password); + } + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyConsumerImpl.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyConsumerImpl.java new file mode 100644 index 00000000..3782b8e3 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyConsumerImpl.java @@ -0,0 +1,60 @@ +package org.highmed.dsf.bpe.crypto; + +import java.io.FileNotFoundException; +import java.nio.file.Path; +import java.security.Key; +import java.security.KeyStore; +import java.util.Objects; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +public class SecretKeyConsumerImpl implements KeyConsumer, InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(SecretKeyConsumerImpl.class); + + private final Path keystoreFile; + private final char[] keystorePassword; + + private KeyStore keystore; + + public SecretKeyConsumerImpl(Path keystoreFile, char[] keystorePassword) + { + this.keystoreFile = keystoreFile; + this.keystorePassword = keystorePassword; + } + + @Override + public void afterPropertiesSet() throws Exception + { + Objects.requireNonNull(keystoreFile, "keystoreFile"); + Objects.requireNonNull(keystorePassword, "keystorePassword"); + + try + { + keystore = KeyStoreIo.readJceks(keystoreFile, keystorePassword); + } + catch (FileNotFoundException e) + { + logger.warn("Could not find keystore at {}, creating an empty keystore", keystoreFile); + + keystore = KeyStoreHelper.createPkcs12(keystorePassword); + KeyStoreIo.write(keystore, keystoreFile, keystorePassword); + } + } + + @Override + public void store(String alias, Key key) + { + try + { + keystore.setKeyEntry(alias, key, keystorePassword, null); + KeyStoreIo.write(keystore, keystoreFile, keystorePassword); + } + catch (Exception e) + { + throw new RuntimeException("Could not store secret key", e); + } + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java new file mode 100644 index 00000000..f7fff58c --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java @@ -0,0 +1,70 @@ +package org.highmed.dsf.bpe.crypto; + +import java.io.FileNotFoundException; +import java.nio.file.Path; +import java.security.Key; +import java.security.KeyStore; +import java.util.Objects; + +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.pseudonymization.crypto.AesGcmUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +public class SecretKeyProviderImpl implements KeyProvider, InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(SecretKeyProviderImpl.class); + + private final OrganizationProvider organizationProvider; + + private final Path keystoreFile; + private final char[] keystorePassword; + + private KeyStore keystore; + + public SecretKeyProviderImpl(OrganizationProvider organizationProvider, Path keystoreFile, char[] keystorePassword) + { + this.keystoreFile = keystoreFile; + this.keystorePassword = keystorePassword; + + this.organizationProvider = organizationProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + Objects.requireNonNull(keystoreFile, "keystoreFile"); + Objects.requireNonNull(keystorePassword, "keystorePassword"); + + Objects.requireNonNull(organizationProvider, "organizationProvider"); + + try + { + keystore = KeyStoreIo.readJceks(keystoreFile, keystorePassword); + } + catch (FileNotFoundException e) + { + logger.warn("Could not find keystore at {}, creating a new keystore containing a new organization key", + keystoreFile); + + keystore = KeyStoreHelper.createJceks(keystorePassword); + keystore.setKeyEntry(organizationProvider.getLocalIdentifierValue(), AesGcmUtil.generateAES256Key(), + keystorePassword, null); + KeyStoreIo.write(keystore, keystoreFile, keystorePassword); + } + } + + @Override + public Key get(String alias) + { + try + { + return keystore.getKey(alias, keystorePassword); + } + catch (Exception e) + { + throw new RuntimeException("Could not get SecretKey", e); + } + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java index ba5cc0cb..f233536c 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java @@ -12,6 +12,7 @@ import javax.crypto.SecretKey; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.crypto.KeyConsumer; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.QueryResult; import org.highmed.dsf.bpe.variable.QueryResults; @@ -47,12 +48,14 @@ public abstract class PseudonymizeResultSets extends AbstractServiceDelegate imp { private static final Logger logger = LoggerFactory.getLogger(PseudonymizeResultSets.class); + private final KeyConsumer keyConsumer; private final ObjectMapper psnObjectMapper; public PseudonymizeResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ObjectMapper psnObjectMapper) + KeyConsumer keyConsumer, ObjectMapper psnObjectMapper) { super(clientProvider, taskHelper); + this.keyConsumer = keyConsumer; this.psnObjectMapper = psnObjectMapper; } @@ -60,6 +63,7 @@ public PseudonymizeResultSets(FhirWebserviceClientProvider clientProvider, TaskH public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); + Objects.requireNonNull(keyConsumer, "keyConsumer"); Objects.requireNonNull(psnObjectMapper, "psnObjectMapper"); } @@ -70,8 +74,7 @@ protected void doExecute(DelegateExecution execution) throws Exception String researchStudyIdentifier = (String) execution .getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER); - // TODO: store pseudonym key with corresponding research study id - SecretKey researchStudyKey = AesGcmUtil.generateAES256Key(); + SecretKey researchStudyKey = createAndStoreResearchStudyKey(researchStudyIdentifier); Map<String, List<QueryResult>> byCohortId = groupByCohortId(results); QueryResults finalResults = createFinalResults(researchStudyIdentifier, researchStudyKey, byCohortId); @@ -79,6 +82,13 @@ protected void doExecute(DelegateExecution execution) throws Exception execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(finalResults)); } + private SecretKey createAndStoreResearchStudyKey(String researchStudyIdentifier) throws Exception + { + SecretKey key = AesGcmUtil.generateAES256Key(); + keyConsumer.store(researchStudyIdentifier, key); + return key; + } + private Map<String, List<QueryResult>> groupByCohortId(QueryResults results) { return results.getResults().stream().collect(Collectors.groupingBy(QueryResult::getCohortId)); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java index e9cec51e..097d3e89 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java @@ -1,5 +1,6 @@ package org.highmed.dsf.bpe.service; +import org.highmed.dsf.bpe.crypto.KeyConsumer; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedic; @@ -11,9 +12,9 @@ public class PseudonymizeResultSetsWithRecordLinkage extends PseudonymizeResultSets implements InitializingBean { public PseudonymizeResultSetsWithRecordLinkage(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ObjectMapper psnObjectMapper) + KeyConsumer keyConsumer, ObjectMapper psnObjectMapper) { - super(clientProvider, taskHelper, psnObjectMapper); + super(clientProvider, taskHelper, keyConsumer, psnObjectMapper); } @Override diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithoutRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithoutRecordLinkage.java index e7db617a..ea1c9810 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithoutRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithoutRecordLinkage.java @@ -1,5 +1,6 @@ package org.highmed.dsf.bpe.service; +import org.highmed.dsf.bpe.crypto.KeyConsumer; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedic; @@ -11,9 +12,9 @@ public class PseudonymizeResultSetsWithoutRecordLinkage extends PseudonymizeResultSets implements InitializingBean { public PseudonymizeResultSetsWithoutRecordLinkage(FhirWebserviceClientProvider clientProvider, - TaskHelper taskHelper, ObjectMapper psnObjectMapper) + TaskHelper taskHelper, KeyConsumer keyConsumer, ObjectMapper psnObjectMapper) { - super(clientProvider, taskHelper, psnObjectMapper); + super(clientProvider, taskHelper, keyConsumer, psnObjectMapper); } @Override diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java index 0498e409..660262fb 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java @@ -8,6 +8,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.pseudonymization.crypto.AesGcmUtil.AES; +import java.security.Key; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -17,6 +18,7 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.crypto.KeyProvider; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.highmed.dsf.bpe.variable.QueryResult; @@ -47,17 +49,19 @@ public abstract class TranslateSingleMedicResultSets extends AbstractServiceDele 500, 500, 250, 50, 500, 250, 500, 500, 500); private final OrganizationProvider organizationProvider; + private final KeyProvider keyProvider; private final String ehrIdColumnPath; private final MasterPatientIndexClient masterPatientIndexClient; private final BouncyCastleProvider bouncyCastleProvider; public TranslateSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - OrganizationProvider organizationProvider, String ehrIdColumnPath, + OrganizationProvider organizationProvider, KeyProvider keyProvider, String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, BouncyCastleProvider bouncyCastleProvider) { super(clientProvider, taskHelper); this.organizationProvider = organizationProvider; + this.keyProvider = keyProvider; this.ehrIdColumnPath = ehrIdColumnPath; this.masterPatientIndexClient = masterPatientIndexClient; this.bouncyCastleProvider = bouncyCastleProvider; @@ -82,6 +86,7 @@ public void afterPropertiesSet() throws Exception protected void doExecute(DelegateExecution execution) throws Exception { String organizationIdentifier = organizationProvider.getLocalIdentifierValue(); + SecretKey idatKey = getIdatKey(organizationIdentifier); String researchStudyIdentifier = getResearchStudyIdentifier(execution); SecretKey mdatKey = getMdatKey(execution); boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); @@ -89,8 +94,8 @@ protected void doExecute(DelegateExecution execution) throws Exception ? createRecordBloomFilterGenerator(execution) : null; - ResultSetTranslatorToTtp translator = createResultSetTranslator(organizationIdentifier, researchStudyIdentifier, - mdatKey, ehrIdColumnPath, masterPatientIndexClient, bloomFilterGenerator); + ResultSetTranslatorToTtp translator = createResultSetTranslator(organizationIdentifier, idatKey, + researchStudyIdentifier, mdatKey, ehrIdColumnPath, masterPatientIndexClient, bloomFilterGenerator); QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); List<QueryResult> translatedResults = translateResults(translator, results); @@ -99,6 +104,11 @@ protected void doExecute(DelegateExecution execution) throws Exception QueryResultsValues.create(new QueryResults(translatedResults))); } + private SecretKey getIdatKey(String organizationIdentifier) + { + return (SecretKey) keyProvider.get(organizationIdentifier); + } + private String getResearchStudyIdentifier(DelegateExecution execution) { ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); @@ -128,6 +138,8 @@ private RecordBloomFilterGenerator createRecordBloomFilterGenerator(DelegateExec /** * @param organizationIdentifier * the FHIR identifier of the current organization + * @param idatKey + * the key to encrypt the IDAT * @param researchStudyIdentifier * the FHIR identifier of the ResearchStudy defining the data sharing request * @param mdatKey @@ -142,7 +154,7 @@ private RecordBloomFilterGenerator createRecordBloomFilterGenerator(DelegateExec * @return {@link ResultSetTranslatorToTtp} */ abstract protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, - String researchStudyIdentifier, SecretKey mdatKey, String ehrIdColumnPath, + SecretKey idatKey, String researchStudyIdentifier, SecretKey mdatKey, String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, RecordBloomFilterGenerator recordBloomFilterGenerator); private List<QueryResult> translateResults(ResultSetTranslatorToTtp translator, QueryResults results) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java index e8d4f7b7..742cbc29 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java @@ -1,16 +1,14 @@ package org.highmed.dsf.bpe.service; -import java.security.NoSuchAlgorithmException; - import javax.crypto.SecretKey; import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.highmed.dsf.bpe.crypto.KeyProvider; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.mpi.client.MasterPatientIndexClient; import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGenerator; -import org.highmed.pseudonymization.crypto.AesGcmUtil; import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtp; import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpWithRbfImpl; import org.springframework.beans.factory.InitializingBean; @@ -18,28 +16,19 @@ public class TranslateSingleMedicResultSetsWithRbf extends TranslateSingleMedicResultSets implements InitializingBean { public TranslateSingleMedicResultSetsWithRbf(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - OrganizationProvider organizationProvider, String ehrIdColumnPath, + OrganizationProvider organizationProvider, KeyProvider keyProvider, String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, BouncyCastleProvider bouncyCastleProvider) { - super(clientProvider, taskHelper, organizationProvider, ehrIdColumnPath, masterPatientIndexClient, + super(clientProvider, taskHelper, organizationProvider, keyProvider, ehrIdColumnPath, masterPatientIndexClient, bouncyCastleProvider); } @Override - protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, + protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, SecretKey idatKey, String researchStudyIdentifier, SecretKey mdatKey, String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, RecordBloomFilterGenerator recordBloomFilterGenerator) { - try - { - // TODO: implement and use pseudonym provider to get IDAT key - SecretKey idatKey = AesGcmUtil.generateAES256Key(); - return new ResultSetTranslatorToTtpWithRbfImpl(organizationIdentifier, idatKey, researchStudyIdentifier, - mdatKey, ehrIdColumnPath, recordBloomFilterGenerator, masterPatientIndexClient); - } - catch (NoSuchAlgorithmException e) - { - throw new RuntimeException("Could not get IDAT key", e); - } + return new ResultSetTranslatorToTtpWithRbfImpl(organizationIdentifier, idatKey, researchStudyIdentifier, + mdatKey, ehrIdColumnPath, recordBloomFilterGenerator, masterPatientIndexClient); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java index b13770e1..c6604eb4 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java @@ -1,15 +1,13 @@ package org.highmed.dsf.bpe.service; -import java.security.NoSuchAlgorithmException; - import javax.crypto.SecretKey; +import org.highmed.dsf.bpe.crypto.KeyProvider; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.mpi.client.MasterPatientIndexClient; import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGenerator; -import org.highmed.pseudonymization.crypto.AesGcmUtil; import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtp; import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpNoRbfImpl; import org.springframework.beans.factory.InitializingBean; @@ -17,26 +15,17 @@ public class TranslateSingleMedicResultSetsWithoutRbf extends TranslateSingleMedicResultSets implements InitializingBean { public TranslateSingleMedicResultSetsWithoutRbf(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - OrganizationProvider organizationProvider, String ehrIdColumnPath) + OrganizationProvider organizationProvider, KeyProvider keyProvider, String ehrIdColumnPath) { - super(clientProvider, taskHelper, organizationProvider, ehrIdColumnPath, null, null); + super(clientProvider, taskHelper, organizationProvider, keyProvider, ehrIdColumnPath, null, null); } @Override - protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, + protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, SecretKey idatKey, String researchStudyIdentifier, SecretKey mdatKey, String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, RecordBloomFilterGenerator recordBloomFilterGenerator) { - try - { - // TODO: implement and use pseudonym provider to get IDAT key - SecretKey idatKey = AesGcmUtil.generateAES256Key(); - return new ResultSetTranslatorToTtpNoRbfImpl(organizationIdentifier, idatKey, researchStudyIdentifier, - mdatKey, ehrIdColumnPath); - } - catch (NoSuchAlgorithmException e) - { - throw new RuntimeException("Could not get IDAT key", e); - } + return new ResultSetTranslatorToTtpNoRbfImpl(organizationIdentifier, idatKey, researchStudyIdentifier, mdatKey, + ehrIdColumnPath); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index 550bdf18..c40bc690 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -1,6 +1,12 @@ package org.highmed.dsf.bpe.spring.config; +import java.nio.file.Paths; + import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.highmed.dsf.bpe.crypto.KeyConsumer; +import org.highmed.dsf.bpe.crypto.KeyProvider; +import org.highmed.dsf.bpe.crypto.SecretKeyConsumerImpl; +import org.highmed.dsf.bpe.crypto.SecretKeyProviderImpl; import org.highmed.dsf.bpe.message.SendMedicRequest; import org.highmed.dsf.bpe.message.SendMultiMedicErrors; import org.highmed.dsf.bpe.message.SendMultiMedicResults; @@ -74,6 +80,18 @@ public class DataSharingConfig @Autowired private FhirContext fhirContext; + @Value("${org.highmed.dsf.bpe.psn.organizationKey.keystore.file:conf/organization-key.jceks}") + private String organizationKeystoreFile; + + @Value("${org.highmed.dsf.bpe.psn.organizationKey.keystore.password:password}") + private String organizationKeystorePassword; + + @Value("${org.highmed.dsf.bpe.psn.researchStudyKeys.keystore.file:conf/research-study-keystore.jceks}") + private String researchStudyKeystoreFile; + + @Value("${org.highmed.dsf.bpe.psn.researchStudyKeys.keystore.password:password}") + private String getResearchStudyKeystorePassword; + @Value("${org.highmed.dsf.bpe.openehr.subject_external_id.path:/ehr_status/subject/external_ref/id/value}") private String ehrIdColumnPath; @@ -159,16 +177,24 @@ public DownloadSingleMedicResultSets downloadSingleMedicResultSets() return new DownloadSingleMedicResultSets(fhirClientProvider, taskHelper, objectMapper); } + @Bean + public KeyConsumer keyConsumer() + { + return new SecretKeyConsumerImpl(Paths.get(researchStudyKeystoreFile), + getResearchStudyKeystorePassword.toCharArray()); + } + @Bean public PseudonymizeResultSetsWithRecordLinkage pseudonymizeResultSetsWithRecordLinkage() { - return new PseudonymizeResultSetsWithRecordLinkage(fhirClientProvider, taskHelper, objectMapper); + return new PseudonymizeResultSetsWithRecordLinkage(fhirClientProvider, taskHelper, keyConsumer(), objectMapper); } @Bean public PseudonymizeResultSetsWithoutRecordLinkage pseudonymizeResultSetsWithoutRecordLinkage() { - return new PseudonymizeResultSetsWithoutRecordLinkage(fhirClientProvider, taskHelper, objectMapper); + return new PseudonymizeResultSetsWithoutRecordLinkage(fhirClientProvider, taskHelper, keyConsumer(), + objectMapper); } @Bean @@ -247,18 +273,25 @@ public FilterQueryResultsByConsent filterQueryResultsByConsent() return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper); } + @Bean + public KeyProvider keyProvider() + { + return new SecretKeyProviderImpl(organizationProvider, Paths.get(organizationKeystoreFile), + organizationKeystorePassword.toCharArray()); + } + @Bean public TranslateSingleMedicResultSetsWithRbf translateSingleMedicResultSetsWithRbf() { return new TranslateSingleMedicResultSetsWithRbf(fhirClientProvider, taskHelper, organizationProvider, - ehrIdColumnPath, masterPatientIndexClient(), bouncyCastleProvider()); + keyProvider(), ehrIdColumnPath, masterPatientIndexClient(), bouncyCastleProvider()); } @Bean public TranslateSingleMedicResultSetsWithoutRbf translateSingleMedicResultSetsWithoutRbf() { return new TranslateSingleMedicResultSetsWithoutRbf(fhirClientProvider, taskHelper, organizationProvider, - ehrIdColumnPath); + keyProvider(), ehrIdColumnPath); } @Bean From 1ad08ec9b5aa298092231bb32161099a5b8303d8 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 17 Mar 2021 14:38:02 +0100 Subject: [PATCH 040/125] format and sort --- .../src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java | 1 + 1 file changed, 1 insertion(+) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java index 6864703d..1fbffd93 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java @@ -2,6 +2,7 @@ import static java.nio.file.StandardOpenOption.APPEND; import static java.nio.file.StandardOpenOption.CREATE; + import static org.highmed.dsf.bpe.crypto.KeyStoreHelper.JCEKS; import static org.highmed.dsf.bpe.crypto.KeyStoreHelper.PKCS12; From 4099e0d9fb331d7e461b5a8fecad5460077fa140 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 17 Mar 2021 16:35:15 +0100 Subject: [PATCH 041/125] check for file read/write, rename of default keystore name --- .../highmed/dsf/bpe/crypto/SecretKeyConsumerImpl.java | 10 ++++++++-- .../highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java | 8 +++++++- .../dsf/bpe/spring/config/DataSharingConfig.java | 4 ++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyConsumerImpl.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyConsumerImpl.java index 3782b8e3..37718612 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyConsumerImpl.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyConsumerImpl.java @@ -1,6 +1,9 @@ package org.highmed.dsf.bpe.crypto; import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.security.Key; import java.security.KeyStore; @@ -35,13 +38,16 @@ public void afterPropertiesSet() throws Exception { keystore = KeyStoreIo.readJceks(keystoreFile, keystorePassword); } - catch (FileNotFoundException e) + catch (FileNotFoundException | NoSuchFileException e) { logger.warn("Could not find keystore at {}, creating an empty keystore", keystoreFile); - keystore = KeyStoreHelper.createPkcs12(keystorePassword); + keystore = KeyStoreHelper.createJceks(keystorePassword); KeyStoreIo.write(keystore, keystoreFile, keystorePassword); } + + if (!Files.isWritable(keystoreFile)) + throw new IOException("ResearchStudy keystore at " + keystoreFile.toString() + " not writable"); } @Override diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java index f7fff58c..cf4703f7 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java @@ -1,6 +1,9 @@ package org.highmed.dsf.bpe.crypto; import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.security.Key; import java.security.KeyStore; @@ -43,7 +46,7 @@ public void afterPropertiesSet() throws Exception { keystore = KeyStoreIo.readJceks(keystoreFile, keystorePassword); } - catch (FileNotFoundException e) + catch (FileNotFoundException | NoSuchFileException e) { logger.warn("Could not find keystore at {}, creating a new keystore containing a new organization key", keystoreFile); @@ -53,6 +56,9 @@ public void afterPropertiesSet() throws Exception keystorePassword, null); KeyStoreIo.write(keystore, keystoreFile, keystorePassword); } + + if (!Files.isReadable(keystoreFile)) + throw new IOException("Organization keystore at " + keystoreFile.toString() + " not writable"); } @Override diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index c40bc690..d52e2af5 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -80,13 +80,13 @@ public class DataSharingConfig @Autowired private FhirContext fhirContext; - @Value("${org.highmed.dsf.bpe.psn.organizationKey.keystore.file:conf/organization-key.jceks}") + @Value("${org.highmed.dsf.bpe.psn.organizationKey.keystore.file:psn/organization-keystore.jceks}") private String organizationKeystoreFile; @Value("${org.highmed.dsf.bpe.psn.organizationKey.keystore.password:password}") private String organizationKeystorePassword; - @Value("${org.highmed.dsf.bpe.psn.researchStudyKeys.keystore.file:conf/research-study-keystore.jceks}") + @Value("${org.highmed.dsf.bpe.psn.researchStudyKeys.keystore.file:psn/research-study-keystore.jceks}") private String researchStudyKeystoreFile; @Value("${org.highmed.dsf.bpe.psn.researchStudyKeys.keystore.password:password}") From 684d1003632a8f064de9d7212d94ed28cd3ee41f Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Thu, 18 Mar 2021 09:29:48 +0100 Subject: [PATCH 042/125] replace getHmacSha2 with getHmacSha3 to translation error --- .../dsf/bpe/service/TranslateSingleMedicResultSets.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java index 660262fb..d9b7c917 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java @@ -132,7 +132,7 @@ private RecordBloomFilterGenerator createRecordBloomFilterGenerator(DelegateExec return new RecordBloomFilterGeneratorImpl(RBF_LENGTH, bloomFilterConfig.getPermutationSeed(), FBF_WEIGHTS, FBF_LENGTHS, () -> new BloomFilterGenerator.HmacSha2HmacSha3BiGramHasher(bloomFilterConfig.getHmacSha2Key(), - bloomFilterConfig.getHmacSha2Key(), bouncyCastleProvider)); + bloomFilterConfig.getHmacSha3Key(), bouncyCastleProvider)); } /** @@ -181,5 +181,4 @@ private ResultSet translate(ResultSetTranslatorToTtp resultSetTranslator, Result throw e; } } - } From a860ad14763aff62c2c76d754f58478ba6073678 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Thu, 18 Mar 2021 11:54:45 +0100 Subject: [PATCH 043/125] fix error in result set checks --- .../highmed/dsf/bpe/service/CheckResultSets.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java index 9cbac623..ad15193f 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java @@ -50,6 +50,7 @@ private boolean testResultAndAddPossibleError(QueryResult result, Task task) { boolean hasFailingCheck = getChecks(result, task).map(check -> check.apply(result, task)) .anyMatch(Boolean.FALSE::equals); + return !hasFailingCheck; } @@ -87,21 +88,21 @@ protected void addError(Task task, String cohortId, String error) protected boolean checkColumns(QueryResult result, Task task) { - boolean hasError = result.getResultSet().getColumns().size() < 1; + boolean passed = result.getResultSet().getColumns().size() > 0; - if (hasError) + if (!passed) addError(task, result.getCohortId(), "no columns present"); - return hasError; + return passed; } protected boolean checkRows(QueryResult result, Task task) { - boolean hasError = result.getResultSet().getRows().size() < 1; + boolean passed = result.getResultSet().getRows().size() > 0; - if (hasError) + if (!passed) addError(task, result.getCohortId(), "no rows present"); - return hasError; + return passed; } } From 44b345a9ef32df6e9ecbedc2a19aada6a74e8e04 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Thu, 18 Mar 2021 12:47:00 +0100 Subject: [PATCH 044/125] use leading task instead of current task, fix profile in bmpn model --- .../highmed/dsf/bpe/service/CheckResultSets.java | 10 ++++++---- .../main/resources/bpe/computeDataSharing.bpmn | 16 ++++++++-------- ...hmed-task-multi-medic-result-data-sharing.xml | 2 +- ...med-task-single-medic-result-data-sharing.xml | 2 +- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java index ad15193f..9709fda7 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java @@ -1,5 +1,7 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import java.util.List; @@ -41,7 +43,7 @@ protected void doExecute(DelegateExecution execution) private List<QueryResult> filterErroneousResultsAndAddErrorsToCurrentTaskOutputs(QueryResults results) { - Task task = getCurrentTaskFromExecutionVariables(); + Task task = getLeadingTaskFromExecutionVariables(); return results.getResults().stream().filter(r -> testResultAndAddPossibleError(r, task)) .collect(Collectors.toList()); } @@ -50,7 +52,7 @@ private boolean testResultAndAddPossibleError(QueryResult result, Task task) { boolean hasFailingCheck = getChecks(result, task).map(check -> check.apply(result, task)) .anyMatch(Boolean.FALSE::equals); - + return !hasFailingCheck; } @@ -82,8 +84,8 @@ protected void addError(Task task, String cohortId, String error) + error; logger.warn(errorMessage); - task.getOutput().add(getTaskHelper().createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN, - ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage)); + task.getOutput().add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, + errorMessage)); } protected boolean checkColumns(QueryResult result, Task task) diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn index 999b4a1b..6358df4a 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn @@ -84,7 +84,7 @@ <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="processDefinitionKey">requestDataSharing</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-error-data-sharing</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing</camunda:inputParameter> <camunda:inputParameter name="versionTag">0.5.0</camunda:inputParameter> <camunda:inputParameter name="messageName">errorMultiMedicDataSharingMessage</camunda:inputParameter> </camunda:inputOutput> @@ -136,6 +136,10 @@ <bpmn:error id="Error_0qub4jc" name="errorMultiMedicDataSharingResult" errorCode="errorMultiMedicDataSharingResult" camunda:errorMessage="errorMultiMedicDataSharingResult" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="computeDataSharing"> + <bpmndi:BPMNEdge id="Flow_115yfgb_di" bpmnElement="Flow_115yfgb"> + <di:waypoint x="1520" y="320" /> + <di:waypoint x="1520" y="267" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0uaqn1r_di" bpmnElement="Flow_0uaqn1r"> <di:waypoint x="2050" y="242" /> <di:waypoint x="2142" y="242" /> @@ -202,13 +206,6 @@ <di:waypoint x="195" y="242" /> <di:waypoint x="279" y="242" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_115yfgb_di" bpmnElement="Flow_115yfgb"> - <di:waypoint x="1520" y="320" /> - <di:waypoint x="1520" y="267" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="Activity_0y1tjhz_di" bpmnElement="pseudonymizeResultSetWithoutRecordLinkage"> - <dc:Bounds x="1470" y="320" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_1gopxt4_di" bpmnElement="SubProcess_1gopxt4" isExpanded="true"> <dc:Bounds x="469" y="175" width="498" height="134" /> </bpmndi:BPMNShape> @@ -284,6 +281,9 @@ <bpmndi:BPMNShape id="Activity_0tps18n_di" bpmnElement="storeResultSets"> <dc:Bounds x="1950" y="202" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0y1tjhz_di" bpmnElement="pseudonymizeResultSetWithoutRecordLinkage"> + <dc:Bounds x="1470" y="320" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_155cxa9_di" bpmnElement="Event_1vp5qzs"> <dc:Bounds x="1862" y="264" width="36" height="36" /> </bpmndi:BPMNShape> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml index 1376ce4e..6a41d12f 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml @@ -29,7 +29,7 @@ <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <min value="2" /> + <min value="3" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml index a68e6720..68681588 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml @@ -64,7 +64,7 @@ </extension> <path value="Task.input" /> <sliceName value="single-medic-result-set-reference" /> - <min value="0" /> + <min value="1" /> <max value="*" /> </element> <element id="Task.input:single-medic-result-set-reference.extension"> From f4c572fd50fa588d3ea15b4a607ce858bd0b50e0 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Thu, 18 Mar 2021 16:09:26 +0100 Subject: [PATCH 045/125] add better error handling --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 4 +- .../DataSharingProcessPluginDefinition.java | 4 +- .../highmed/dsf/bpe/message/SendErrors.java | 42 ++++++ .../dsf/bpe/message/SendMultiMedicErrors.java | 26 +--- .../bpe/message/SendMultiMedicResults.java | 2 +- ...SendMedicResults.java => SendResults.java} | 6 +- .../bpe/message/SendSingleMedicResults.java | 2 +- .../CheckMedicSingleMedicResultSets.java | 70 ++++++++++ .../service/CheckSingleMedicResultSets.java | 24 ---- .../service/CheckTtpMultiMedicResultSets.java | 10 +- .../CheckTtpSingleMedicResultSets.java | 71 ++++++++++ .../service/HandleErrorMultiMedicResults.java | 2 +- .../bpe/spring/config/DataSharingConfig.java | 29 ++-- .../resources/bpe/computeDataSharing.bpmn | 129 +++++++++++------- .../resources/bpe/executeDataSharing.bpmn | 42 ++++-- .../resources/bpe/requestDataSharing.bpmn | 8 +- ...ed-task-multi-medic-error-data-sharing.xml | 2 +- 17 files changed, 339 insertions(+), 134 deletions(-) create mode 100755 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendErrors.java rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/{SendMedicResults.java => SendResults.java} (93%) create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicSingleMedicResultSets.java delete mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResultSets.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index 0dbf1c24..96baaef0 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -5,7 +5,9 @@ public interface ConstantsDataSharing { - String BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_DATA_SHARING_RESULT = "errorMultiMedicDataSharingResult"; + String BPMN_EXECUTION_ERROR_CODE_SINGLE_MEDIC_DATA_SHARING_RESULT = "errorSingleMedicDataSharingResult"; + String BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_RECEIVED_DATA_SHARING_RESULT = "errorMultiMedicReceivedDataSharingResult"; + String BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_PSEUDONYMIZED_DATA_SHARING_RESULT = "errorMultiMedicPseudonymizedDataSharingResult"; String BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY = "researchStudy"; String BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER = "researchStudyIdentifier"; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java index 8940242c..80ee6ae5 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java @@ -55,7 +55,7 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var sTCom = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-compute-data-sharing.xml"); var sTExe = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-execute-data-sharing.xml"); - var sTErr = StructureDefinitionResource + var sTErrM = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml"); var sTResM = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml"); @@ -68,7 +68,7 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of("computeDataSharing/" + VERSION, Arrays.asList(aCom, cDS, sTCom, sTResS, vDS), "executeDataSharing/" + VERSION, Arrays.asList(aExe, cDS, sTExe, vDS), "requestDataSharing/" + VERSION, - Arrays.asList(aReq, cDS, sTReq, sTResM, sTErr, vDS)); + Arrays.asList(aReq, cDS, sTReq, sTResM, sTErrM, vDS)); return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resourcesByProcessKeyAndVersion); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendErrors.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendErrors.java new file mode 100755 index 00000000..4a275b45 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendErrors.java @@ -0,0 +1,42 @@ +package org.highmed.dsf.bpe.message; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; + +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.ParameterComponent; + +import ca.uhn.fhir.context.FhirContext; + +public abstract class SendErrors extends AbstractTaskMessageSend +{ + public SendErrors(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + OrganizationProvider organizationProvider, FhirContext fhirContext) + { + super(clientProvider, taskHelper, organizationProvider, fhirContext); + } + + @Override + protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) + { + Task task = getLeadingTaskFromExecutionVariables(); + String taskUrl = new Reference(new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl() + "/Task", + task.getIdElement().getIdPart())).getReference(); + String errorMessage = getErrorMessage(taskUrl); + + ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage); + return Stream.of(input); + } + + protected abstract String getErrorMessage(String taskUrl); +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java index cbed88ca..db70efdd 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java @@ -1,23 +1,12 @@ package org.highmed.dsf.bpe.message; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; - -import java.util.stream.Stream; - -import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; -import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; import org.highmed.dsf.fhir.task.TaskHelper; -import org.hl7.fhir.r4.model.IdType; -import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.r4.model.Task; -import org.hl7.fhir.r4.model.Task.ParameterComponent; import ca.uhn.fhir.context.FhirContext; -public class SendMultiMedicErrors extends AbstractTaskMessageSend +public class SendMultiMedicErrors extends SendErrors { public SendMultiMedicErrors(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) @@ -26,16 +15,9 @@ public SendMultiMedicErrors(FhirWebserviceClientProvider clientProvider, TaskHel } @Override - protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) + protected String getErrorMessage(String taskUrl) { - Task task = getLeadingTaskFromExecutionVariables(); - String taskUrl = new Reference(new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl() + "/Task", - task.getIdElement().getIdPart())).getReference(); - - Task.ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_BPMN, - CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, - "An error occurred while calculating the multi medic data sharing result for " - + "all defined cohorts, see task with url='" + taskUrl + "'"); - return Stream.of(input); + return "An error occurred while calculating the multi medic data sharing result for " + + "all defined cohorts, see task with url='" + taskUrl + "'"; } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java index 5fa69725..6ef635fc 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java @@ -8,7 +8,7 @@ import ca.uhn.fhir.context.FhirContext; -public class SendMultiMedicResults extends SendMedicResults +public class SendMultiMedicResults extends SendResults { public SendMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java similarity index 93% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java index 86e59b68..418260e0 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java @@ -22,11 +22,11 @@ import ca.uhn.fhir.context.FhirContext; -public abstract class SendMedicResults extends AbstractTaskMessageSend +public abstract class SendResults extends AbstractTaskMessageSend { - private static final Logger logger = LoggerFactory.getLogger(SendMedicResults.class); + private static final Logger logger = LoggerFactory.getLogger(SendResults.class); - public SendMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public SendResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) { super(clientProvider, taskHelper, organizationProvider, fhirContext); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java index f9c93d08..0db915dc 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -8,7 +8,7 @@ import ca.uhn.fhir.context.FhirContext; -public class SendSingleMedicResults extends SendMedicResults +public class SendSingleMedicResults extends SendResults { public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicSingleMedicResultSets.java new file mode 100644 index 00000000..0256bc2f --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicSingleMedicResultSets.java @@ -0,0 +1,70 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_ERROR_CODE_SINGLE_MEDIC_DATA_SHARING_RESULT; + +import java.util.List; +import java.util.function.BiFunction; +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CheckMedicSingleMedicResultSets extends CheckResultSets +{ + private static final Logger logger = LoggerFactory.getLogger(CheckMedicSingleMedicResultSets.class); + + public CheckMedicSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected Stream<BiFunction<QueryResult, Task, Boolean>> getChecks(QueryResult result, Task task) + { + // TODO: define and implement further result set checks + return Stream.of(this::checkColumns, this::checkRows); + } + + @Override + protected List<QueryResult> postProcessAllPassingResults(List<QueryResult> passedResults) + { + if (!atLeastOneResultExists(passedResults)) + throw new BpmnError(BPMN_EXECUTION_ERROR_CODE_SINGLE_MEDIC_DATA_SHARING_RESULT); + + return passedResults; + } + + private boolean atLeastOneResultExists(List<QueryResult> results) + { + Task leadingTask = getLeadingTaskFromExecutionVariables(); + String taskId = leadingTask.getId(); + String businessKey = getTaskHelper().getFirstInputParameterStringValue(leadingTask, CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY).orElse(null); + String correlationKey = getTaskHelper().getFirstInputParameterStringValue(leadingTask, CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY).orElse(null); + + if (results.size() < 1) + { + logger.warn( + "Could not calculate result for any cohort definition in the data sharing request " + + "with task-id='{}', business-key='{}' and correlation-key='{}'", + taskId, businessKey, correlationKey); + + leadingTask.getOutput().add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, "Could not calculate results for any cohort definition")); + + return false; + } + + return true; + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java deleted file mode 100644 index 9ef985ff..00000000 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultSets.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.highmed.dsf.bpe.service; - -import java.util.function.BiFunction; -import java.util.stream.Stream; - -import org.highmed.dsf.bpe.variable.QueryResult; -import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; -import org.highmed.dsf.fhir.task.TaskHelper; -import org.hl7.fhir.r4.model.Task; - -public class CheckSingleMedicResultSets extends CheckResultSets -{ - public CheckSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) - { - super(clientProvider, taskHelper); - } - - @Override - protected Stream<BiFunction<QueryResult, Task, Boolean>> getChecks(QueryResult result, Task task) - { - // TODO: define and implement further result set checks - return Stream.of(this::checkColumns, this::checkRows); - } -} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java index 759d5985..4b605f29 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java @@ -4,7 +4,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_DATA_SHARING_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_PSEUDONYMIZED_DATA_SHARING_RESULT; import java.util.List; import java.util.function.BiFunction; @@ -38,7 +38,7 @@ protected Stream<BiFunction<QueryResult, Task, Boolean>> getChecks(QueryResult r protected List<QueryResult> postProcessAllPassingResults(List<QueryResult> passedResults) { if (!atLeastOneResultExists(passedResults)) - throw new BpmnError(BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_DATA_SHARING_RESULT); + throw new BpmnError(BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_PSEUDONYMIZED_DATA_SHARING_RESULT); return passedResults; } @@ -55,13 +55,13 @@ private boolean atLeastOneResultExists(List<QueryResult> results) if (results.size() < 1) { logger.warn( - "Did not receive any results from participating MeDICs for any cohort definition in the " - + "data sharing request with task-id='{}', business-key='{}' and correlation-key='{}'", + "Could not calculate result for any cohort definition in the data sharing request with " + + "task-id='{}', business-key='{}' and correlation-key='{}', are there results present?", taskId, businessKey, correlationKey); leadingTask.getOutput() .add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, - "Did not receive any results from participating MeDICs for any cohort definition")); + "Could not calculate result for any cohort definition, are there results present?")); return false; } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResultSets.java new file mode 100644 index 00000000..c825db16 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResultSets.java @@ -0,0 +1,71 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_PSEUDONYMIZED_DATA_SHARING_RESULT; + +import java.util.List; +import java.util.function.BiFunction; +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CheckTtpSingleMedicResultSets extends CheckResultSets +{ + private static final Logger logger = LoggerFactory.getLogger(CheckTtpSingleMedicResultSets.class); + + public CheckTtpSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper) + { + super(clientProvider, taskHelper); + } + + @Override + protected Stream<BiFunction<QueryResult, Task, Boolean>> getChecks(QueryResult result, Task task) + { + // TODO: define and implement further result set checks + return Stream.of(this::checkColumns, this::checkRows); + } + + @Override + protected List<QueryResult> postProcessAllPassingResults(List<QueryResult> passedResults) + { + if (!atLeastOneResultExists(passedResults)) + throw new BpmnError(BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_PSEUDONYMIZED_DATA_SHARING_RESULT); + + return passedResults; + } + + private boolean atLeastOneResultExists(List<QueryResult> results) + { + Task leadingTask = getLeadingTaskFromExecutionVariables(); + String taskId = leadingTask.getId(); + String businessKey = getTaskHelper().getFirstInputParameterStringValue(leadingTask, CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY).orElse(null); + String correlationKey = getTaskHelper().getFirstInputParameterStringValue(leadingTask, CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY).orElse(null); + + if (results.size() < 1) + { + logger.warn( + "Did not receive any valid results from any MeDIC for any cohort definition in the data sharing request with " + + "task-id='{}', business-key='{}' and correlation-key='{}', are there results present?", + taskId, businessKey, correlationKey); + + leadingTask.getOutput() + .add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, + "Did not receive any valid results from any MeDIC for any cohort definition")); + + return false; + } + + return true; + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java index 297c2b71..09a0e705 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/HandleErrorMultiMedicResults.java @@ -43,7 +43,7 @@ private boolean isErrorInput(Task.ParameterComponent input) private void transformToOutput(String taskId, Task.ParameterComponent input, Task leadingTask) { String errorMessage = input.getValue().primitiveValue(); - logger.warn("Received data sharing error in task with id='{}', reason: {}", taskId, errorMessage); + logger.warn("Received multi medic data sharing error in task with id='{}', reason: {}", taskId, errorMessage); leadingTask.getOutput().add(getTaskHelper().createOutput(ConstantsBase.CODESYSTEM_HIGHMED_BPMN, ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage)); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index d52e2af5..d0422eb5 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -14,8 +14,9 @@ import org.highmed.dsf.bpe.message.SendTtpRequest; import org.highmed.dsf.bpe.service.CheckDataSharingResources; import org.highmed.dsf.bpe.service.CheckMedicMultiMedicResultSets; -import org.highmed.dsf.bpe.service.CheckSingleMedicResultSets; +import org.highmed.dsf.bpe.service.CheckMedicSingleMedicResultSets; import org.highmed.dsf.bpe.service.CheckTtpMultiMedicResultSets; +import org.highmed.dsf.bpe.service.CheckTtpSingleMedicResultSets; import org.highmed.dsf.bpe.service.DownloadDataSharingResources; import org.highmed.dsf.bpe.service.DownloadMultiMedicResultSets; import org.highmed.dsf.bpe.service.DownloadResearchStudyResource; @@ -101,6 +102,10 @@ public class DataSharingConfig @Autowired private Environment environment; + // + // process requestDataSharing implementations + // + @Bean public DownloadResearchStudyResource downloadResearchStudyResourceDS() { @@ -155,6 +160,12 @@ public StoreMultiMedicResultSetsForResearcher storeMultiMedicResultSetsForResear return new StoreMultiMedicResultSetsForResearcher(fhirClientProvider, taskHelper, objectMapper); } + @Bean + public HandleErrorMultiMedicResults handleErrorMultiMedicResults() + { + return new HandleErrorMultiMedicResults(fhirClientProvider, taskHelper); + } + // // process computeDataSharing implementations // @@ -177,6 +188,12 @@ public DownloadSingleMedicResultSets downloadSingleMedicResultSets() return new DownloadSingleMedicResultSets(fhirClientProvider, taskHelper, objectMapper); } + @Bean + public CheckTtpSingleMedicResultSets checkTtpSingleMedicResultSets() + { + return new CheckTtpSingleMedicResultSets(fhirClientProvider, taskHelper); + } + @Bean public KeyConsumer keyConsumer() { @@ -221,12 +238,6 @@ public SendMultiMedicErrors sendMultiMedicErrors() return new SendMultiMedicErrors(fhirClientProvider, taskHelper, organizationProvider, fhirContext); } - @Bean - public HandleErrorMultiMedicResults handleErrorMultiMedicResults() - { - return new HandleErrorMultiMedicResults(fhirClientProvider, taskHelper); - } - // // process executeDataSharing implementations // @@ -313,9 +324,9 @@ public StoreSingleMedicResultSets storeSingleMedicResultSets() } @Bean - public CheckSingleMedicResultSets checkSingleMedicResultSets() + public CheckMedicSingleMedicResultSets checkMedicSingleMedicResultSets() { - return new CheckSingleMedicResultSets(fhirClientProvider, taskHelper); + return new CheckMedicSingleMedicResultSets(fhirClientProvider, taskHelper); } @Bean diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn index 6358df4a..487f6c5e 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn @@ -53,7 +53,7 @@ <bpmn:sequenceFlow id="SequenceFlow_01pjftq" sourceRef="StartEvent" targetRef="storeCorrelationKeys" /> <bpmn:sequenceFlow id="SequenceFlow_1lfe4wr" sourceRef="storeCorrelationKeys" targetRef="SubProcess_1gopxt4" /> <bpmn:exclusiveGateway id="ExclusiveGateway_07e71aa"> - <bpmn:incoming>Flow_0gx8n5k</bpmn:incoming> + <bpmn:incoming>Flow_0g86uan</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0t4lx4v</bpmn:outgoing> <bpmn:outgoing>SequenceFlow_0calilw</bpmn:outgoing> </bpmn:exclusiveGateway> @@ -90,17 +90,18 @@ </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_1tmnvhl</bpmn:incoming> + <bpmn:incoming>Flow_0rwc0yo</bpmn:incoming> <bpmn:messageEventDefinition id="MessageEventDefinition_19y5diw" messageRef="Message_0kix95m" camunda:class="org.highmed.dsf.bpe.message.SendMultiMedicErrors" /> </bpmn:endEvent> - <bpmn:serviceTask id="checkResultSets" name="check result sets" camunda:class="org.highmed.dsf.bpe.service.CheckTtpMultiMedicResultSets"> + <bpmn:serviceTask id="checkPseudonymizedResultSets" name="check pseudonymized result sets" camunda:class="org.highmed.dsf.bpe.service.CheckTtpMultiMedicResultSets"> <bpmn:incoming>Flow_1wig1wj</bpmn:incoming> <bpmn:outgoing>Flow_0mogdyo</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:boundaryEvent id="Event_1vp5qzs" attachedToRef="checkResultSets"> + <bpmn:boundaryEvent id="errorPseudonymization" attachedToRef="checkPseudonymizedResultSets"> <bpmn:outgoing>Flow_1tmnvhl</bpmn:outgoing> <bpmn:errorEventDefinition id="ErrorEventDefinition_05kx06m" errorRef="Error_0qub4jc" /> </bpmn:boundaryEvent> - <bpmn:sequenceFlow id="Flow_1tmnvhl" sourceRef="Event_1vp5qzs" targetRef="EndEventError" /> + <bpmn:sequenceFlow id="Flow_1tmnvhl" sourceRef="errorPseudonymization" targetRef="EndEventError" /> <bpmn:sequenceFlow id="SequenceFlow_0calilw" name="needs record linkage" sourceRef="ExclusiveGateway_07e71aa" targetRef="pseudonymizeResultSetWithRecordLinkage"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> @@ -110,7 +111,7 @@ <bpmn:outgoing>Flow_0b5n9vc</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="Flow_0b5n9vc" sourceRef="Gateway_0h2eszv" targetRef="downloadResultSets" /> - <bpmn:sequenceFlow id="Flow_0gx8n5k" sourceRef="downloadResultSets" targetRef="ExclusiveGateway_07e71aa" /> + <bpmn:sequenceFlow id="Flow_0gx8n5k" sourceRef="downloadResultSets" targetRef="checkReceivedResultSets" /> <bpmn:serviceTask id="downloadResultSets" name="download result sets" camunda:class="org.highmed.dsf.bpe.service.DownloadSingleMedicResultSets"> <bpmn:incoming>Flow_0b5n9vc</bpmn:incoming> <bpmn:outgoing>Flow_0gx8n5k</bpmn:outgoing> @@ -119,74 +120,89 @@ <bpmn:incoming>Flow_0mogdyo</bpmn:incoming> <bpmn:outgoing>Flow_0uaqn1r</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_0mogdyo" sourceRef="checkResultSets" targetRef="storeResultSets" /> + <bpmn:sequenceFlow id="Flow_0mogdyo" sourceRef="checkPseudonymizedResultSets" targetRef="storeResultSets" /> <bpmn:sequenceFlow id="Flow_1qqffoq" sourceRef="ExclusiveGateway_1r8ow3i" targetRef="selectResponseTargetMedic" /> - <bpmn:sequenceFlow id="Flow_1wig1wj" sourceRef="selectResponseTargetMedic" targetRef="checkResultSets" /> + <bpmn:sequenceFlow id="Flow_1wig1wj" sourceRef="selectResponseTargetMedic" targetRef="checkPseudonymizedResultSets" /> <bpmn:sequenceFlow id="Flow_0uaqn1r" sourceRef="storeResultSets" targetRef="EndEventSuccess" /> <bpmn:sequenceFlow id="Flow_115yfgb" sourceRef="pseudonymizeResultSetWithoutRecordLinkage" targetRef="ExclusiveGateway_1r8ow3i" /> <bpmn:serviceTask id="pseudonymizeResultSetWithoutRecordLinkage" name="pseudonymize result sets" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithoutRecordLinkage"> <bpmn:incoming>SequenceFlow_0t4lx4v</bpmn:incoming> <bpmn:outgoing>Flow_115yfgb</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_0g86uan" sourceRef="checkReceivedResultSets" targetRef="ExclusiveGateway_07e71aa" /> + <bpmn:serviceTask id="checkReceivedResultSets" name="check received result sets" camunda:class="org.highmed.dsf.bpe.service.CheckTtpSingleMedicResultSets"> + <bpmn:incoming>Flow_0gx8n5k</bpmn:incoming> + <bpmn:outgoing>Flow_0g86uan</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:boundaryEvent id="errorReceived" attachedToRef="checkReceivedResultSets"> + <bpmn:outgoing>Flow_0rwc0yo</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1co4qxl" errorRef="Error_1r03ghq" /> + </bpmn:boundaryEvent> + <bpmn:sequenceFlow id="Flow_0rwc0yo" sourceRef="errorReceived" targetRef="EndEventError" /> </bpmn:process> <bpmn:message id="Message_0a1qxd8" name="resultSingleMedicDataSharingMessage" /> <bpmn:message id="Message_0ue93sz" name="resultMultiMedicDataSharingMessage" /> <bpmn:message id="Message_08676wn" name="computeDataSharingMessage" /> <bpmn:message id="Message_0kix95m" name="errorMultiMedicDataSharingMessage" /> - <bpmn:error id="Error_0qub4jc" name="errorMultiMedicDataSharingResult" errorCode="errorMultiMedicDataSharingResult" camunda:errorMessage="errorMultiMedicDataSharingResult" /> + <bpmn:error id="Error_0qub4jc" name="errorMultiMedicPseudonymizedDataSharingResult" errorCode="errorMultiMedicPseudonymizedDataSharingResult" camunda:errorMessage="errorMultiMedicPseudonymizedDataSharingResult" /> + <bpmn:error id="Error_1r03ghq" name="errorMultiMedicReceivedDataSharingResult" errorCode="errorMultiMedicReceivedDataSharingResult" camunda:errorMessage="errorMultiMedicReceivedDataSharingResult" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="computeDataSharing"> + <bpmndi:BPMNEdge id="Flow_0g86uan_di" bpmnElement="Flow_0g86uan"> + <di:waypoint x="1430" y="242" /> + <di:waypoint x="1485" y="242" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_115yfgb_di" bpmnElement="Flow_115yfgb"> - <di:waypoint x="1520" y="320" /> - <di:waypoint x="1520" y="267" /> + <di:waypoint x="1690" y="320" /> + <di:waypoint x="1690" y="267" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0uaqn1r_di" bpmnElement="Flow_0uaqn1r"> - <di:waypoint x="2050" y="242" /> - <di:waypoint x="2142" y="242" /> + <di:waypoint x="2220" y="242" /> + <di:waypoint x="2312" y="242" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1wig1wj_di" bpmnElement="Flow_1wig1wj"> - <di:waypoint x="1710" y="242" /> - <di:waypoint x="1780" y="242" /> + <di:waypoint x="1880" y="242" /> + <di:waypoint x="1950" y="242" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1qqffoq_di" bpmnElement="Flow_1qqffoq"> - <di:waypoint x="1545" y="242" /> - <di:waypoint x="1610" y="242" /> + <di:waypoint x="1715" y="242" /> + <di:waypoint x="1780" y="242" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0mogdyo_di" bpmnElement="Flow_0mogdyo"> - <di:waypoint x="1880" y="242" /> - <di:waypoint x="1950" y="242" /> + <di:waypoint x="2050" y="242" /> + <di:waypoint x="2120" y="242" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0gx8n5k_di" bpmnElement="Flow_0gx8n5k"> <di:waypoint x="1260" y="242" /> - <di:waypoint x="1315" y="242" /> + <di:waypoint x="1330" y="242" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0b5n9vc_di" bpmnElement="Flow_0b5n9vc"> <di:waypoint x="1095" y="242" /> <di:waypoint x="1160" y="242" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0calilw_di" bpmnElement="SequenceFlow_0calilw"> - <di:waypoint x="1340" y="217" /> - <di:waypoint x="1340" y="126" /> - <di:waypoint x="1470" y="126" /> + <di:waypoint x="1510" y="217" /> + <di:waypoint x="1510" y="126" /> + <di:waypoint x="1640" y="126" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1347" y="133" width="65" height="27" /> + <dc:Bounds x="1517" y="133" width="65" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1tmnvhl_di" bpmnElement="Flow_1tmnvhl"> - <di:waypoint x="1880" y="300" /> - <di:waypoint x="1880" y="350" /> - <di:waypoint x="2142" y="350" /> + <di:waypoint x="2050" y="300" /> + <di:waypoint x="2050" y="420" /> + <di:waypoint x="2312" y="420" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_02zmrer_di" bpmnElement="SequenceFlow_02zmrer"> - <di:waypoint x="1520" y="166" /> - <di:waypoint x="1520" y="217" /> + <di:waypoint x="1690" y="166" /> + <di:waypoint x="1690" y="217" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0t4lx4v_di" bpmnElement="SequenceFlow_0t4lx4v"> - <di:waypoint x="1340" y="267" /> - <di:waypoint x="1340" y="360" /> - <di:waypoint x="1470" y="360" /> + <di:waypoint x="1510" y="267" /> + <di:waypoint x="1510" y="360" /> + <di:waypoint x="1640" y="360" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1344" y="342" width="21" height="14" /> + <dc:Bounds x="1514" y="342" width="21" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0h3to47_di" bpmnElement="SequenceFlow_0h3to47"> @@ -206,6 +222,17 @@ <di:waypoint x="195" y="242" /> <di:waypoint x="279" y="242" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0rwc0yo_di" bpmnElement="Flow_0rwc0yo"> + <di:waypoint x="1430" y="300" /> + <di:waypoint x="1430" y="420" /> + <di:waypoint x="2312" y="420" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="Event_1hmug5i_di" bpmnElement="EndEventError"> + <dc:Bounds x="2312" y="402" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2299" y="445" width="63" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_1gopxt4_di" bpmnElement="SubProcess_1gopxt4" isExpanded="true"> <dc:Bounds x="469" y="175" width="498" height="134" /> </bpmndi:BPMNShape> @@ -239,39 +266,33 @@ <bpmndi:BPMNShape id="StartEvent_1skbvzb_di" bpmnElement="StartEvent"> <dc:Bounds x="159" y="224" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="166" y="267" width="23" height="14" /> + <dc:Bounds x="167" y="267" width="22" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0xh5o35_di" bpmnElement="EndEventSuccess"> - <dc:Bounds x="2142" y="224" width="36" height="36" /> + <dc:Bounds x="2312" y="224" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2125" y="267" width="72" height="27" /> + <dc:Bounds x="2295" y="267" width="72" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_07e71aa_di" bpmnElement="ExclusiveGateway_07e71aa" isMarkerVisible="true"> - <dc:Bounds x="1315" y="217" width="50" height="50" /> + <dc:Bounds x="1485" y="217" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_093hq2s_di" bpmnElement="pseudonymizeResultSetWithRecordLinkage"> - <dc:Bounds x="1470" y="86" width="100" height="80" /> + <dc:Bounds x="1640" y="86" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1r8ow3i_di" bpmnElement="ExclusiveGateway_1r8ow3i" isMarkerVisible="true"> - <dc:Bounds x="1495" y="217" width="50" height="50" /> + <dc:Bounds x="1665" y="217" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0bw310g_di" bpmnElement="storeCorrelationKeys"> <dc:Bounds x="279" y="202" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0uk3eyz_di" bpmnElement="selectResponseTargetMedic"> - <dc:Bounds x="1610" y="202" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_1hmug5i_di" bpmnElement="EndEventError"> - <dc:Bounds x="2142" y="332" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2129" y="375" width="63" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_13j8ce9_di" bpmnElement="checkResultSets"> <dc:Bounds x="1780" y="202" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_13j8ce9_di" bpmnElement="checkPseudonymizedResultSets"> + <dc:Bounds x="1950" y="202" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0h2eszv_di" bpmnElement="Gateway_0h2eszv" isMarkerVisible="true"> <dc:Bounds x="1045" y="217" width="50" height="50" /> </bpmndi:BPMNShape> @@ -279,17 +300,23 @@ <dc:Bounds x="1160" y="202" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0tps18n_di" bpmnElement="storeResultSets"> - <dc:Bounds x="1950" y="202" width="100" height="80" /> + <dc:Bounds x="2120" y="202" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0y1tjhz_di" bpmnElement="pseudonymizeResultSetWithoutRecordLinkage"> - <dc:Bounds x="1470" y="320" width="100" height="80" /> + <dc:Bounds x="1640" y="320" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0798gut_di" bpmnElement="checkReceivedResultSets"> + <dc:Bounds x="1330" y="202" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_155cxa9_di" bpmnElement="Event_1vp5qzs"> - <dc:Bounds x="1862" y="264" width="36" height="36" /> + <bpmndi:BPMNShape id="Event_155cxa9_di" bpmnElement="errorPseudonymization"> + <dc:Bounds x="2032" y="264" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BoundaryEvent_1g0rcyp_di" bpmnElement="TimerEnded"> <dc:Bounds x="949" y="291" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1c7452s_di" bpmnElement="errorReceived"> + <dc:Bounds x="1412" y="264" width="36" height="36" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index 81266931..9c056c9f 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1"> <bpmn:process id="executeDataSharing" isExecutable="true" camunda:versionTag="0.5.0"> - <bpmn:serviceTask id="checkResultSets" name="check results sets" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResultSets"> + <bpmn:serviceTask id="checkResultSets" name="check results sets" camunda:class="org.highmed.dsf.bpe.service.CheckMedicSingleMedicResultSets"> <bpmn:incoming>Flow_1pzik8k</bpmn:incoming> <bpmn:outgoing>Flow_08925ay</bpmn:outgoing> </bpmn:serviceTask> @@ -20,7 +20,7 @@ <bpmn:incoming>SequenceFlow_14cn0vs</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1etju4m</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:endEvent id="EndEvent" name="send results to TTP"> + <bpmn:endEvent id="EndEventSuccess" name="send results to TTP"> <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="messageName">resultSingleMedicDataSharingMessage</camunda:inputParameter> @@ -101,12 +101,20 @@ <bpmn:sequenceFlow id="Flow_08925ay" sourceRef="checkResultSets" targetRef="storeResultSets" /> <bpmn:sequenceFlow id="Flow_1pgebfo" sourceRef="Gateway_13kxug8" targetRef="selectResponseTargetTtp" /> <bpmn:sequenceFlow id="Flow_1pzik8k" sourceRef="selectResponseTargetTtp" targetRef="checkResultSets" /> - <bpmn:sequenceFlow id="Flow_1611vr6" sourceRef="storeResultSets" targetRef="EndEvent" /> + <bpmn:sequenceFlow id="Flow_1611vr6" sourceRef="storeResultSets" targetRef="EndEventSuccess" /> <bpmn:sequenceFlow id="Flow_13fof22" sourceRef="translateWithEncryptionAndWithoutRbfGeneration" targetRef="Gateway_13kxug8" /> <bpmn:serviceTask id="translateWithEncryptionAndWithoutRbfGeneration" name="translate with encryption" camunda:class="org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithoutRbf"> <bpmn:incoming>Flow_09dzkmp</bpmn:incoming> <bpmn:outgoing>Flow_13fof22</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:boundaryEvent id="Event_0o8usc6" attachedToRef="checkResultSets"> + <bpmn:outgoing>Flow_1o1ugb3</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_182xhp6" errorRef="Error_0c5gjso" /> + </bpmn:boundaryEvent> + <bpmn:sequenceFlow id="Flow_1o1ugb3" sourceRef="Event_0o8usc6" targetRef="EndEventError" /> + <bpmn:endEvent id="EndEventError" name="error occured"> + <bpmn:incoming>Flow_1o1ugb3</bpmn:incoming> + </bpmn:endEvent> <bpmn:textAnnotation id="TextAnnotation_0euut3n"> <bpmn:text>uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc.</bpmn:text> </bpmn:textAnnotation> @@ -114,8 +122,15 @@ </bpmn:process> <bpmn:message id="Message_1yz2a31" name="executeDataSharingMessage" /> <bpmn:message id="Message_1dr71re" name="resultSingleMedicDataSharingMessage" /> + <bpmn:message id="Message_1ppodb0" name="errorSingleMedicDataSharingMessage" /> + <bpmn:error id="Error_0c5gjso" name="errorSingleMedicDataSharingResult" errorCode="errorSingleMedicDataSharingResult" camunda:errorMessage="errorSingleMedicDataSharingResult" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="executeDataSharing"> + <bpmndi:BPMNEdge id="Flow_1o1ugb3_di" bpmnElement="Flow_1o1ugb3"> + <di:waypoint x="1880" y="270" /> + <di:waypoint x="1880" y="340" /> + <di:waypoint x="2122" y="340" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_13fof22_di" bpmnElement="Flow_13fof22"> <di:waypoint x="1490" y="315" /> <di:waypoint x="1490" y="237" /> @@ -126,14 +141,14 @@ </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1pzik8k_di" bpmnElement="Flow_1pzik8k"> <di:waypoint x="1700" y="212" /> - <di:waypoint x="1770" y="212" /> + <di:waypoint x="1780" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1pgebfo_di" bpmnElement="Flow_1pgebfo"> <di:waypoint x="1515" y="212" /> <di:waypoint x="1600" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_08925ay_di" bpmnElement="Flow_08925ay"> - <di:waypoint x="1870" y="212" /> + <di:waypoint x="1880" y="212" /> <di:waypoint x="1940" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_09yooed_di" bpmnElement="Flow_09yooed"> @@ -201,7 +216,7 @@ <di:waypoint x="1032" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResultSets"> - <dc:Bounds x="1770" y="172" width="100" height="80" /> + <dc:Bounds x="1780" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkDataSharingRequest"> <dc:Bounds x="400" y="172" width="100" height="80" /> @@ -215,7 +230,7 @@ <bpmndi:BPMNShape id="ServiceTask_0b8j3ka_di" bpmnElement="downloadDataSharingResources"> <dc:Bounds x="240" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> + <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEventSuccess"> <dc:Bounds x="2122" y="194" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="2105" y="237" width="72" height="27" /> @@ -242,6 +257,9 @@ <bpmndi:BPMNShape id="Activity_1ok9q8j_di" bpmnElement="addIdSelectionIfMissing"> <dc:Bounds x="720" y="172" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1vlv5ud_di" bpmnElement="extractQueries"> + <dc:Bounds x="550" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_118ojzy_di" bpmnElement="Gateway_118ojzy" isMarkerVisible="true"> <dc:Bounds x="1305" y="187" width="50" height="50" /> <bpmndi:BPMNLabel> @@ -257,11 +275,17 @@ <bpmndi:BPMNShape id="Activity_0cu49cc_di" bpmnElement="translateWithEncryptionAndWithoutRbfGeneration"> <dc:Bounds x="1440" y="315" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1lnwlbo_di" bpmnElement="EndEventError"> + <dc:Bounds x="2122" y="322" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="2107" y="365" width="66" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> <dc:Bounds x="330" y="80" width="267" height="56" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1vlv5ud_di" bpmnElement="extractQueries"> - <dc:Bounds x="550" y="172" width="100" height="80" /> + <bpmndi:BPMNShape id="Event_155zi8c_di" bpmnElement="Event_0o8usc6"> + <dc:Bounds x="1862" y="234" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> <di:waypoint x="455" y="172" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn index 59c0551e..4770a603 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn @@ -25,7 +25,7 @@ <bpmn:outgoing>Flow_1lw96cm</bpmn:outgoing> <bpmn:multiInstanceLoopCharacteristics camunda:collection="${targets.entries}" camunda:elementVariable="target" /> </bpmn:sendTask> - <bpmn:intermediateCatchEvent id="receiveFinalResultFromTtp" name="receive multi MeDIC results from TTP"> + <bpmn:intermediateCatchEvent id="receiveMultiMediclResultFromTtp" name="receive multi MeDIC results from TTP"> <bpmn:incoming>Flow_1q5jnli</bpmn:incoming> <bpmn:outgoing>Flow_1gf3n6o</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_0ox92uc" messageRef="Message_1a3ewlk" /> @@ -56,8 +56,8 @@ <bpmn:endEvent id="EndEvent" name="success"> <bpmn:incoming>Flow_0amk6ah</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="Flow_1q5jnli" sourceRef="Gateway_160gkf1" targetRef="receiveFinalResultFromTtp" /> - <bpmn:sequenceFlow id="Flow_1gf3n6o" sourceRef="receiveFinalResultFromTtp" targetRef="downloadResultSets" /> + <bpmn:sequenceFlow id="Flow_1q5jnli" sourceRef="Gateway_160gkf1" targetRef="receiveMultiMediclResultFromTtp" /> + <bpmn:sequenceFlow id="Flow_1gf3n6o" sourceRef="receiveMultiMediclResultFromTtp" targetRef="downloadResultSets" /> <bpmn:sequenceFlow id="Flow_1harl90" sourceRef="Gateway_160gkf1" targetRef="receiveErrorFromTtp" /> <bpmn:sequenceFlow id="Flow_1id9r0h" sourceRef="receiveErrorFromTtp" targetRef="handleError" /> <bpmn:sequenceFlow id="Flow_0rwo9pn" sourceRef="checkResultSets" targetRef="storeResultSets" /> @@ -180,7 +180,7 @@ <bpmndi:BPMNShape id="Activity_1bpkypl_di" bpmnElement="sendRequestToMedics"> <dc:Bounds x="760" y="187" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0bxieya_di" bpmnElement="receiveFinalResultFromTtp"> + <bpmndi:BPMNShape id="Event_0bxieya_di" bpmnElement="receiveMultiMediclResultFromTtp"> <dc:Bounds x="1022" y="122" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="1005" y="80" width="70" height="40" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml index b59298e3..b101e8f5 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml @@ -9,7 +9,7 @@ <url value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing" /> <!-- version managed by bpe --> <version value="${version}" /> - <name value="TaskErrorDataSharing" /> + <name value="TaskMultiMedicErrorDataSharing" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> From 3abc8d270d23a74b94f280f483088ee35f061161 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Thu, 18 Mar 2021 16:11:04 +0100 Subject: [PATCH 046/125] Improve error message --- .../highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java index 4b605f29..f39792cd 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java @@ -56,12 +56,12 @@ private boolean atLeastOneResultExists(List<QueryResult> results) { logger.warn( "Could not calculate result for any cohort definition in the data sharing request with " - + "task-id='{}', business-key='{}' and correlation-key='{}', are there results present?", + + "task-id='{}', business-key='{}' and correlation-key='{}'", taskId, businessKey, correlationKey); leadingTask.getOutput() .add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, - "Could not calculate result for any cohort definition, are there results present?")); + "Could not calculate result for any cohort definition")); return false; } From 3320603749cfd2d6f6fdd35feca7a4fc775a20b0 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Thu, 18 Mar 2021 16:23:03 +0100 Subject: [PATCH 047/125] fix cardinalities --- .../highmed-task-compute-data-sharing.xml | 2 +- .../highmed-task-execute-data-sharing.xml | 2 -- ...hmed-task-multi-medic-result-data-sharing.xml | 1 - .../highmed-task-request-data-sharing.xml | 1 - ...med-task-single-medic-result-data-sharing.xml | 1 - ...SharingFromMedicsViaMedic1ExampleStarter.java | 16 ++++++++-------- 6 files changed, 9 insertions(+), 14 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml index 5f23c55e..9bbd20a4 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml @@ -184,7 +184,7 @@ <min value="0" /> <max value="0" /> </element> - <element id="Task.input:single-medic-result-set-reference.value[x].identifier"> + <element id="Task.input:research-study-identifier.value[x].identifier"> <path value="Task.input.value[x].identifier" /> <min value="1" /> <max value="1" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml index 5b6b66fe..27e57617 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml @@ -220,8 +220,6 @@ <code value="base64Binary" /> </type> </element> - - <element id="Task.input:mdat-aes-key"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> <valueString value="Parameter" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml index 6a41d12f..b1b7c636 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml @@ -66,7 +66,6 @@ <path value="Task.input" /> <sliceName value="multi-medic-result-set-reference" /> <min value="1" /> - <max value="*" /> </element> <element id="Task.input:multi-medic-result-set-reference.extension"> <path value="Task.input.extension" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml index bf5bd972..befa8719 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml @@ -195,7 +195,6 @@ <path value="Task.output" /> <sliceName value="multi-medic-result-set-reference" /> <min value="0" /> - <max value="*" /> </element> <element id="Task.output:multi-medic-result-set-reference.extension"> <path value="Task.output.extension" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml index 68681588..9ebc14ac 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml @@ -65,7 +65,6 @@ <path value="Task.input" /> <sliceName value="single-medic-result-set-reference" /> <min value="1" /> - <max value="*" /> </element> <element id="Task.input:single-medic-result-set-reference.extension"> <path value="Task.input.extension" /> diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java index c4e0c411..1bef9628 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -117,14 +117,14 @@ private static ResearchStudy createResearchStudy(Group group1, Group group2) .setValue(new Reference().setType(ResourceType.Organization.name()) .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1))); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) - .setValue(new Reference().setType(ResourceType.Organization.name()) - .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2))); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) - .setValue(new Reference().setType(ResourceType.Organization.name()) - .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3))); + // researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( + // new Reference().setType(ResourceType.Organization.name()).setIdentifier( + // new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + // .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2))); + // researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( + // new Reference().setType(ResourceType.Organization.name()).setIdentifier( + // new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + // .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3))); researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP) .setValue(new Reference().setType(ResourceType.Organization.name()) .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) From 5a0e9d86dbc35bbfdb3f2646c7ac84fc210b7895 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 19 Mar 2021 08:55:04 +0100 Subject: [PATCH 048/125] add organization identifier error message after result set check failed --- .../org/highmed/dsf/bpe/service/CheckResultSets.java | 11 +++++------ .../dsf/bpe/service/CheckTtpMultiMedicResultSets.java | 5 ++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java index 9709fda7..632a7443 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java @@ -10,7 +10,6 @@ import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.ConstantsBase; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.QueryResult; import org.highmed.dsf.bpe.variable.QueryResults; @@ -78,10 +77,10 @@ protected List<QueryResult> postProcessAllPassingResults(List<QueryResult> passe return passedResults; } - protected void addError(Task task, String cohortId, String error) + protected void addError(Task task, String organizationIdentifier, String cohortId, String error) { - String errorMessage = "Data sharing query result check failed for group with id='" + cohortId + "', reason: " - + error; + String errorMessage = "QueryResult check failed for group with id='" + cohortId + + "' supplied from organization " + organizationIdentifier + ", reason: " + error; logger.warn(errorMessage); task.getOutput().add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, @@ -93,7 +92,7 @@ protected boolean checkColumns(QueryResult result, Task task) boolean passed = result.getResultSet().getColumns().size() > 0; if (!passed) - addError(task, result.getCohortId(), "no columns present"); + addError(task, result.getOrganizationIdentifier(), result.getCohortId(), "no columns present"); return passed; } @@ -103,7 +102,7 @@ protected boolean checkRows(QueryResult result, Task task) boolean passed = result.getResultSet().getRows().size() > 0; if (!passed) - addError(task, result.getCohortId(), "no rows present"); + addError(task, result.getOrganizationIdentifier(), result.getCohortId(), "no rows present"); return passed; } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java index f39792cd..2415ac9e 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java @@ -59,9 +59,8 @@ private boolean atLeastOneResultExists(List<QueryResult> results) + "task-id='{}', business-key='{}' and correlation-key='{}'", taskId, businessKey, correlationKey); - leadingTask.getOutput() - .add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, - "Could not calculate result for any cohort definition")); + leadingTask.getOutput().add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, "Could not calculate result for any cohort definition")); return false; } From df70ba1c3420ff26a0f56ea6dfb2817c58361807 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 19 Mar 2021 14:41:13 +0100 Subject: [PATCH 049/125] Adds task profile test --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 33 +- .../java/org/highmed/dsf/fhir/profile/.keep | 0 .../dsf/fhir/profile/TaskProfileTest.java | 411 ++++++++++++++++++ 3 files changed, 438 insertions(+), 6 deletions(-) delete mode 100644 dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/.keep create mode 100644 dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index 96baaef0..76740000 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -20,12 +20,6 @@ public interface ConstantsDataSharing String BPMN_EXECUTION_VARIABLE_QUERY_RESULTS = "queryResults"; String BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS = "finalQueryResults"; - String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing"; - String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestDataSharing/"; - String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI - + VERSION; - String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME = "requestDataSharingMessage"; - String CODESYSTEM_HIGHMED_DATA_SHARING = "http://highmed.org/fhir/CodeSystem/data-sharing"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE = "research-study-reference"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_IDENTIFIER = "research-study-identifier"; @@ -46,4 +40,31 @@ public interface ConstantsDataSharing String EXTENSION_HIGHMED_PARTICIPATING_TTP = "http://highmed.org/fhir/StructureDefinition/extension-participating-ttp"; String EXTENSION_HIGHMED_GROUP_ID = "http://highmed.org/fhir/StructureDefinition/extension-group-id"; String EXTENSION_HIGHMED_QUERY = "http://highmed.org/fhir/StructureDefinition/extension-query"; + + String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing"; + String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestDataSharing/"; + String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI + + VERSION; + String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME = "requestDataSharingMessage"; + + String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing"; + String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "executeDataSharing/"; + String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_PROCESS_URI + + VERSION; + String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_MESSAGE_NAME = "executeDataSharingMessage"; + + String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing"; + String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "computeDataSharing/"; + String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_PROCESS_URI + + VERSION; + String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_MESSAGE_NAME = "computeDataSharingMessage"; + + String PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing"; + String PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_DATA_SHARING_MESSAGE_NAME = "resultSingleMedicDataSharingMessage"; + + String PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing"; + String PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_DATA_SHARING_MESSAGE_NAME = "resultMultiMedicDataSharingMessage"; + + String PROFILE_HIGHMED_TASK_ERROR_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing"; + String PROFILE_HIGHMED_TASK_ERROR_DATA_SHARING_MESSAGE_NAME = "errorMultiMedicDataSharingMessage"; } diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/.keep b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java new file mode 100644 index 00000000..c322807d --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -0,0 +1,411 @@ +package org.highmed.dsf.fhir.profile; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_ERROR_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_ERROR_DATA_SHARING_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_DATA_SHARING_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_DATA_SHARING_MESSAGE_NAME; +import static org.highmed.dsf.bpe.DataSharingProcessPluginDefinition.VERSION; +import static org.junit.Assert.assertEquals; + +import java.nio.charset.StandardCharsets; +import java.security.NoSuchAlgorithmException; +import java.util.Arrays; +import java.util.Date; +import java.util.UUID; + +import org.highmed.dsf.fhir.validation.ResourceValidator; +import org.highmed.dsf.fhir.validation.ResourceValidatorImpl; +import org.highmed.dsf.fhir.validation.ValidationSupportRule; +import org.highmed.pseudonymization.crypto.AesGcmUtil; +import org.hl7.fhir.r4.model.Base64BinaryType; +import org.hl7.fhir.r4.model.BooleanType; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResourceType; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.ParameterComponent; +import org.hl7.fhir.r4.model.Task.TaskIntent; +import org.hl7.fhir.r4.model.Task.TaskOutputComponent; +import org.hl7.fhir.r4.model.Task.TaskStatus; +import org.junit.ClassRule; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ca.uhn.fhir.validation.ResultSeverityEnum; +import ca.uhn.fhir.validation.ValidationResult; + +public class TaskProfileTest +{ + private static final Logger logger = LoggerFactory.getLogger(TaskProfileTest.class); + + @ClassRule + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-group-0.5.0.xml", + "highmed-extension-group-id-0.5.0.xml", "highmed-research-study-0.5.0.xml", + "highmed-task-request-data-sharing.xml", "highmed-task-execute-data-sharing.xml", + "highmed-task-single-medic-result-data-sharing.xml", "highmed-task-compute-data-sharing.xml", + "highmed-task-multi-medic-result-data-sharing.xml", + "highmed-task-multi-medic-error-data-sharing.xml"), + Arrays.asList("highmed-authorization-role-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", + "highmed-data-sharing.xml"), + Arrays.asList("highmed-authorization-role-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", + "highmed-data-sharing.xml")); + + private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), + validationRule.getValidationSupport()); + + @Test + public void testTaskRequestDataSharingValid() throws Exception + { + Task task = createValidTaskRequestDataSharing(); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + @Test + public void testTaskRequestDataSharingValidWithOutput() throws Exception + { + String groupId1 = "Group/" + UUID.randomUUID().toString(); + String groupId2 = "Group/" + UUID.randomUUID().toString(); + + Task task = createValidTaskRequestDataSharing(); + + TaskOutputComponent outMultiMedicResult1 = task.addOutput(); + outMultiMedicResult1.setValue(new Reference("Binary/" + UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE); + outMultiMedicResult1.addExtension("http://highmed.org/fhir/StructureDefinition/extension-group-id", + new Reference(groupId1)); + + TaskOutputComponent outMultiMedicResult2 = task.addOutput(); + outMultiMedicResult2.setValue(new Reference("Binary/" + UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT); + outMultiMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + private Task createValidTaskRequestDataSharing() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 1"); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 1"); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME)).getType() + .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new Reference("ResearchStudy/" + UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); + task.addInput().setValue(new BooleanType(false)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); + task.addInput().setValue(new BooleanType(false)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); + + return task; + } + + @Test + public void testTaskExecuteDataSharingValid() throws Exception + { + Task task = createValidTaskExecuteDataSharing(); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + @Test + public void testTaskExecuteDataSharingValidWithBloomFilterConfig() throws Exception + { + Task task = createValidTaskExecuteDataSharing(); + task.addInput().setValue(new Base64BinaryType("TEST".getBytes(StandardCharsets.UTF_8))).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + private Task createValidTaskExecuteDataSharing() throws NoSuchAlgorithmException + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 1"); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 2"); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_MESSAGE_NAME)).getType() + .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY); + + task.addInput().setValue(new Reference("ResearchStudy/" + UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); + task.addInput().setValue(new BooleanType(false)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); + task.addInput().setValue(new BooleanType(false)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); + task.addInput().setValue(new Base64BinaryType(AesGcmUtil.generateAES256Key().getEncoded())).getType() + .addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY); + + return task; + } + + @Test + public void testTaskSingleMedicResultDataSharingReferenceResultValid() throws Exception + { + Task task = createValidTaskSingleMedicResultDataSharingReferenceResult(); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + private Task createValidTaskSingleMedicResultDataSharing() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_DATA_SHARING); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 2"); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("TTP"); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_DATA_SHARING_MESSAGE_NAME)) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN) + .setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY); + + return task; + } + + private Task createValidTaskSingleMedicResultDataSharingReferenceResult() + { + Task task = createValidTaskSingleMedicResultDataSharing(); + + String groupId1 = "Group/" + UUID.randomUUID().toString(); + String groupId2 = "Group/" + UUID.randomUUID().toString(); + + ParameterComponent inSingleMedicResult1 = task.addInput(); + inSingleMedicResult1.setValue(new Reference("Binary/" + UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE); + inSingleMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); + ParameterComponent inSingleMedicResult2 = task.addInput(); + inSingleMedicResult2.setValue(new Reference("Binary/" + UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE); + inSingleMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); + + return task; + } + + @Test + public void testTaskComputeDataSharingValid() throws Exception + { + Task task = createValidTaskComputeDataSharing(); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + private Task createValidTaskComputeDataSharing() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 1"); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("TTP"); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_MESSAGE_NAME)).getType() + .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + + Reference rsRef = new Reference().setIdentifier(new Identifier().setValue(UUID.randomUUID().toString()) + .setSystem(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)); + task.addInput().setValue(rsRef).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_IDENTIFIER); + + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY); + + task.addInput().setValue(new BooleanType(false)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); + + return task; + } + + @Test + public void testTaskMultiMedicResultDataSharingValid() throws Exception + { + Task task = createValidTaskMultiMedicResultDataSharing(); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + private Task createValidTaskMultiMedicResultDataSharing() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_DATA_SHARING); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("TTP"); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 1"); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_DATA_SHARING_MESSAGE_NAME)) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN) + .setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + + String groupId1 = "Group/" + UUID.randomUUID().toString(); + String groupId2 = "Group/" + UUID.randomUUID().toString(); + + ParameterComponent inMultiMedicResult1 = task.addInput(); + inMultiMedicResult1.setValue(new Reference("Binary/" + UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE); + inMultiMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); + + ParameterComponent inMultiMedicResult2 = task.addInput(); + inMultiMedicResult2.setValue(new Reference("Binary/" + UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE); + inMultiMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); + + return task; + } + + @Test + public void testTaskErrorDataSharingValid() throws Exception + { + Task task = createValidTaskErrorDataSharing(); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + private Task createValidTaskErrorDataSharing() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_ERROR_DATA_SHARING); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("TTP"); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 1"); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_ERROR_DATA_SHARING_MESSAGE_NAME)).getType() + .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + + ParameterComponent error = task.addInput(); + error.setValue(new StringType("Could not calculate multi medic results sets for all defined cohorts")).getType() + .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR); + + return task; + } +} From fa1370eb42a8ac85d389ca20fb8cb7547c0f394d Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 23 Mar 2021 14:57:34 +0100 Subject: [PATCH 050/125] adds related artefacts to research study profile --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 3 + .../DataSharingProcessPluginDefinition.java | 6 +- .../fhir/CodeSystem/highmed-data-sharing.xml | 15 +++ .../highmed-research-study-data-sharing.xml | 103 ++++++++++++++++++ .../highmed-task-execute-data-sharing.xml | 2 +- .../highmed-task-request-data-sharing.xml | 2 +- ...ringFromMedicsViaMedic1ExampleStarter.java | 42 +++++-- .../dsf/fhir/profile/TaskProfileTest.java | 6 +- 8 files changed, 161 insertions(+), 18 deletions(-) create mode 100644 dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index 76740000..7bf191a9 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -33,6 +33,9 @@ public interface ConstantsDataSharing String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT = "multi-medic-count-result"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE = "multi-medic-result-set-reference"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS = "participating-medics"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_REQUEST_FORM_REFERENCE = "request-form-reference"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONTRACT_REFERENCE = "contract-reference"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_FEASIBILITY_QUERY_REFERENCE = "feasibility-query-reference"; String NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER = "http://highmed.org/fhir/NamingSystem/research-study-identifier"; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java index 80ee6ae5..d8b6bf61 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java @@ -53,6 +53,8 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var cDS = CodeSystemResource.file("fhir/CodeSystem/highmed-data-sharing.xml"); + var sRSDS = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-research-study-data-sharing.xml"); var sTCom = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-compute-data-sharing.xml"); var sTExe = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-execute-data-sharing.xml"); var sTErrM = StructureDefinitionResource @@ -67,8 +69,8 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of("computeDataSharing/" + VERSION, Arrays.asList(aCom, cDS, sTCom, sTResS, vDS), "executeDataSharing/" + VERSION, - Arrays.asList(aExe, cDS, sTExe, vDS), "requestDataSharing/" + VERSION, - Arrays.asList(aReq, cDS, sTReq, sTResM, sTErrM, vDS)); + Arrays.asList(aExe, cDS, sTExe, sRSDS, vDS), "requestDataSharing/" + VERSION, + Arrays.asList(aReq, cDS, sTReq, sRSDS, sTResM, sTErrM, vDS)); return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resourcesByProcessKeyAndVersion); diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml index e58c637c..740ab930 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml @@ -82,4 +82,19 @@ <display value="Participating MeDICs"/> <definition value="Count of all MeDICs who participated in a data sharing request"/> </concept> + <concept> + <code value="request-form-reference"/> + <display value="Request Form Reference"/> + <definition value="Url to a Binary resource containing the request form"/> + </concept> + <concept> + <code value="contract-reference"/> + <display value="Contract Reference"/> + <definition value="Url to a Binary resource containing the data usage contract"/> + </concept> + <concept> + <code value="feasibility-query-reference"/> + <display value="Feasibility Query Reference"/> + <definition value="Url to a completed Task resource containing the feasibility query result"/> + </concept> </CodeSystem> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml new file mode 100644 index 00000000..184e32ff --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="utf-8"?> +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/authorization-role" /> + <code value="REMOTE" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/research-study-data-sharing" /> + <version value="${version}" /> + <name value="ResearchStudyDataSharing" /> + <status value="unknown" /> + <experimental value="false" /> + <date value="2021-01-26" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="ResearchStudy" /> + <baseDefinition value="http://highmed.org/fhir/StructureDefinition/research-study" /> + <derivation value="constraint" /> + <differential> + <element id="ResearchStudy.relatedArtifact"> + <path value="ResearchStudy.relatedArtifact" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="label" /> + </discriminator> + <rules value="open" /> + </slicing> + <min value="3" /> + </element> + <element id="ResearchStudy.relatedArtifact:request-form-reference"> + <path value="ResearchStudy.relatedArtifact" /> + <sliceName value="request-form-reference" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="ResearchStudy.relatedArtifact:request-form-reference.type"> + <path value="ResearchStudy.relatedArtifact.type" /> + <fixedCode value="documentation" /> + </element> + <element id="ResearchStudy.relatedArtifact:request-form-reference.label"> + <path value="ResearchStudy.relatedArtifact.label" /> + <min value="1" /> + <fixedString value="request-form-reference" /> + <binding> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="ResearchStudy.relatedArtifact:request-form-reference.url"> + <path value="ResearchStudy.relatedArtifact.url" /> + <min value="1" /> + </element> + <element id="ResearchStudy.relatedArtifact:contract-reference"> + <path value="ResearchStudy.relatedArtifact" /> + <sliceName value="contract-reference" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="ResearchStudy.relatedArtifact:contract-reference.type"> + <path value="ResearchStudy.relatedArtifact.type" /> + <fixedCode value="justification" /> + </element> + <element id="ResearchStudy.relatedArtifact:contract-reference.label"> + <path value="ResearchStudy.relatedArtifact.label" /> + <min value="1" /> + <fixedString value="contract-reference" /> + <binding> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="ResearchStudy.relatedArtifact:contract-reference.url"> + <path value="ResearchStudy.relatedArtifact.url" /> + <min value="1" /> + </element> + <element id="ResearchStudy.relatedArtifact:feasibility-query-reference"> + <path value="ResearchStudy.relatedArtifact" /> + <sliceName value="feasibility-query-reference" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="ResearchStudy.relatedArtifact:feasibility-query-reference.type"> + <path value="ResearchStudy.relatedArtifact.type" /> + <fixedCode value="justification" /> + </element> + <element id="ResearchStudy.relatedArtifact:feasibility-query-reference.label"> + <path value="ResearchStudy.relatedArtifact.label" /> + <min value="1" /> + <fixedString value="feasibility-query-reference" /> + <binding> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="ResearchStudy.relatedArtifact:feasibility-query-reference.url"> + <path value="ResearchStudy.relatedArtifact.url" /> + <min value="1" /> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml index 27e57617..393e6445 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml @@ -97,7 +97,7 @@ <path value="Task.input.value[x]" /> <type> <code value="Reference" /> - <targetProfile value="http://highmed.org/fhir/StructureDefinition/research-study" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/research-study-data-sharing" /> </type> </element> <element id="Task.input:needs-record-linkage"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml index befa8719..700db908 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml @@ -97,7 +97,7 @@ <path value="Task.input.value[x]" /> <type> <code value="Reference" /> - <targetProfile value="http://highmed.org/fhir/StructureDefinition/research-study" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/research-study-data-sharing" /> </type> </element> <element id="Task.input:research-study-reference.value[x].reference"> diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java index 1bef9628..eae2d04d 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -7,8 +7,11 @@ import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHEMD_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHMED_GROUP; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONTRACT_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_FEASIBILITY_QUERY_REFERENCE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_REQUEST_FORM_REFERENCE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_TTP; @@ -23,9 +26,11 @@ import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; +import java.nio.charset.StandardCharsets; import java.util.Date; import java.util.UUID; +import org.hl7.fhir.r4.model.Binary; import org.hl7.fhir.r4.model.BooleanType; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Expression; @@ -34,6 +39,7 @@ import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Narrative; import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.RelatedArtifact; import org.hl7.fhir.r4.model.ResearchStudy; import org.hl7.fhir.r4.model.ResourceType; import org.hl7.fhir.r4.model.StringType; @@ -46,6 +52,10 @@ public class RequestDataSharingFromMedicsViaMedic1ExampleStarter private static boolean NEEDS_CONSENT_CHECK = true; private static boolean NEEDS_RECORD_LINKAGE = true; + private static String REQUEST_FORM_REFERENCE = "https://medic1/fhir/Binary/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; + private static String CONTRACT_REFERENCE = "https://medic1/fhir/Binary/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; + private static String FEASIBILITY_REFERENCE = "https://medic1/fhir/Task/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; + private static final String QUERY = "SELECT e/ehr_status/subject/external_ref/id/value as EHRID, " + "v/items[at0024,'Bezeichnung']/value, v/items [at0001,'Messwert'], " + "v/items[at0006,'Dokumentationsdatum Untersuchung']/value FROM EHR e CONTAINS COMPOSITION c " @@ -58,11 +68,12 @@ public class RequestDataSharingFromMedicsViaMedic1ExampleStarter // password public static void main(String[] args) throws Exception { - Bundle bundle = createStartResource(); - ExampleStarter.forServer(args, MEDIC_1_FHIR_BASE_URL).startWith(bundle); + ExampleStarter starter = ExampleStarter.forServer(args, MEDIC_1_FHIR_BASE_URL); + Bundle bundle = createStartResource(starter); + starter.startWith(bundle); } - private static Bundle createStartResource() + private static Bundle createStartResource(ExampleStarter starter) { Group group1 = createGroup("Group 1"); Group group2 = createGroup("Group 2"); @@ -110,21 +121,30 @@ private static ResearchStudy createResearchStudy(Group group1, Group group2) researchStudy.addIdentifier().setSystem(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER) .setValue(UUID.randomUUID().toString()); researchStudy.setStatus(ResearchStudy.ResearchStudyStatus.ACTIVE); + researchStudy.addEnrollment().setReference(group1.getIdElement().getIdPart()); researchStudy.addEnrollment().setReference(group2.getIdElement().getIdPart()); + researchStudy.addRelatedArtifact().setType(RelatedArtifact.RelatedArtifactType.DOCUMENTATION) + .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_REQUEST_FORM_REFERENCE).setUrl(REQUEST_FORM_REFERENCE); + researchStudy.addRelatedArtifact().setType(RelatedArtifact.RelatedArtifactType.JUSTIFICATION) + .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONTRACT_REFERENCE).setUrl(CONTRACT_REFERENCE); + researchStudy.addRelatedArtifact().setType(RelatedArtifact.RelatedArtifactType.JUSTIFICATION) + .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_FEASIBILITY_QUERY_REFERENCE) + .setUrl(FEASIBILITY_REFERENCE); + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) .setValue(new Reference().setType(ResourceType.Organization.name()) .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1))); - // researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( - // new Reference().setType(ResourceType.Organization.name()).setIdentifier( - // new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - // .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2))); - // researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( - // new Reference().setType(ResourceType.Organization.name()).setIdentifier( - // new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - // .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3))); + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) + .setValue(new Reference().setType(ResourceType.Organization.name()) + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2))); + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) + .setValue(new Reference().setType(ResourceType.Organization.name()) + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3))); researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP) .setValue(new Reference().setType(ResourceType.Organization.name()) .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index c322807d..6ab04abf 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -74,9 +74,9 @@ public class TaskProfileTest public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-group-0.5.0.xml", "highmed-extension-group-id-0.5.0.xml", "highmed-research-study-0.5.0.xml", - "highmed-task-request-data-sharing.xml", "highmed-task-execute-data-sharing.xml", - "highmed-task-single-medic-result-data-sharing.xml", "highmed-task-compute-data-sharing.xml", - "highmed-task-multi-medic-result-data-sharing.xml", + "highmed-research-study-data-sharing.xml", "highmed-task-request-data-sharing.xml", + "highmed-task-execute-data-sharing.xml", "highmed-task-single-medic-result-data-sharing.xml", + "highmed-task-compute-data-sharing.xml", "highmed-task-multi-medic-result-data-sharing.xml", "highmed-task-multi-medic-error-data-sharing.xml"), Arrays.asList("highmed-authorization-role-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", "highmed-data-sharing.xml"), From f649876129e09b8926f66d468e36ea93a6bf1df2 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 23 Mar 2021 15:59:28 +0100 Subject: [PATCH 051/125] fix writing of ttp research study key --- .../src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java | 2 +- .../java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java index 1fbffd93..d2be03e4 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java @@ -45,7 +45,7 @@ private static KeyStore read(Path file, char[] password, String type) public static void write(KeyStore keystore, Path file, char[] password) throws IOException, CertificateException, NoSuchAlgorithmException, KeyStoreException { - try (OutputStream stream = Files.newOutputStream(file, CREATE, APPEND)) + try (OutputStream stream = Files.newOutputStream(file)) { keystore.store(stream, password); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java index cf4703f7..207371c6 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java @@ -58,7 +58,7 @@ public void afterPropertiesSet() throws Exception } if (!Files.isReadable(keystoreFile)) - throw new IOException("Organization keystore at " + keystoreFile.toString() + " not writable"); + throw new IOException("Organization keystore at " + keystoreFile.toString() + " not readable"); } @Override From 62d0085375140445835bbf0e8c884356a1955389 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 6 Apr 2021 15:41:08 +0200 Subject: [PATCH 052/125] use strings because constant is private again --- .../dsf/bpe/service/TranslateMultiMedicResultSets.java | 3 +-- .../dsf/bpe/service/TranslateSingleMedicResultSets.java | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java index f0b47ec8..9df7aa04 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java @@ -3,7 +3,6 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER; -import static org.highmed.pseudonymization.crypto.AesGcmUtil.AES; import java.util.List; import java.util.Objects; @@ -64,7 +63,7 @@ protected void doExecute(DelegateExecution execution) throws Exception private SecretKey getMdatKey(DelegateExecution execution) { byte[] encodedKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); - return new SecretKeySpec(encodedKey, AES); + return new SecretKeySpec(encodedKey, "AES"); } private ResultSetTranslatorFromTtp createResultSetTranslator(String researchStudyIdentifier, diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java index d9b7c917..c4763089 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java @@ -6,9 +6,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; -import static org.highmed.pseudonymization.crypto.AesGcmUtil.AES; -import java.security.Key; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -122,7 +120,7 @@ private String getResearchStudyIdentifier(DelegateExecution execution) private SecretKey getMdatKey(DelegateExecution execution) { byte[] encodedKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); - return new SecretKeySpec(encodedKey, AES); + return new SecretKeySpec(encodedKey, "AES"); } private RecordBloomFilterGenerator createRecordBloomFilterGenerator(DelegateExecution execution) From 57e47cd1a2bf024c5c442834862a9afd1e92d02c Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Wed, 8 Sep 2021 12:21:46 +0200 Subject: [PATCH 053/125] starting new development cycle, versions to 0.6.0-SNAPSHOT, DSF to 0.5.2 --- dsf-bpe-process-feasibility/pom.xml | 2 +- dsf-bpe-process-local-services/pom.xml | 2 +- dsf-bpe-process-ping/pom.xml | 2 +- dsf-bpe-process-update-allow-list/pom.xml | 2 +- dsf-bpe-process-update-resources/pom.xml | 2 +- pom.xml | 8 ++++---- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dsf-bpe-process-feasibility/pom.xml b/dsf-bpe-process-feasibility/pom.xml index 7c54622c..ecee459f 100644 --- a/dsf-bpe-process-feasibility/pom.xml +++ b/dsf-bpe-process-feasibility/pom.xml @@ -8,7 +8,7 @@ <parent> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> <groupId>org.highmed.dsf</groupId> - <version>0.5.0</version> + <version>0.6.0-SNAPSHOT</version> </parent> <properties> diff --git a/dsf-bpe-process-local-services/pom.xml b/dsf-bpe-process-local-services/pom.xml index 710ff991..d60820fa 100644 --- a/dsf-bpe-process-local-services/pom.xml +++ b/dsf-bpe-process-local-services/pom.xml @@ -9,7 +9,7 @@ <parent> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> <groupId>org.highmed.dsf</groupId> - <version>0.5.0</version> + <version>0.6.0-SNAPSHOT</version> </parent> <properties> diff --git a/dsf-bpe-process-ping/pom.xml b/dsf-bpe-process-ping/pom.xml index 50af9679..509a6195 100644 --- a/dsf-bpe-process-ping/pom.xml +++ b/dsf-bpe-process-ping/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> - <version>0.5.0</version> + <version>0.6.0-SNAPSHOT</version> </parent> <properties> diff --git a/dsf-bpe-process-update-allow-list/pom.xml b/dsf-bpe-process-update-allow-list/pom.xml index 5c39fb5f..4cde3472 100644 --- a/dsf-bpe-process-update-allow-list/pom.xml +++ b/dsf-bpe-process-update-allow-list/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> - <version>0.5.0</version> + <version>0.6.0-SNAPSHOT</version> </parent> <properties> diff --git a/dsf-bpe-process-update-resources/pom.xml b/dsf-bpe-process-update-resources/pom.xml index 856c7a6f..87a559bb 100644 --- a/dsf-bpe-process-update-resources/pom.xml +++ b/dsf-bpe-process-update-resources/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> - <version>0.5.0</version> + <version>0.6.0-SNAPSHOT</version> </parent> <properties> diff --git a/pom.xml b/pom.xml index 24452a06..4ad0dbae 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> - <version>0.5.0</version> + <version>0.6.0-SNAPSHOT</version> <packaging>pom</packaging> <modules> @@ -64,12 +64,12 @@ <dependency> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-process-base</artifactId> - <version>0.5.0</version> + <version>0.5.2</version> </dependency> <dependency> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-fhir-validation</artifactId> - <version>0.5.0</version> + <version>0.5.2</version> </dependency> <dependency> @@ -127,7 +127,7 @@ <dependency> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-process-base</artifactId> - <version>0.5.0</version> + <version>0.5.2</version> <scope>test</scope> <type>test-jar</type> </dependency> From 18e5ff3c297c21910bef743785aa99b43ac6edfd Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 8 Sep 2021 17:55:38 +0200 Subject: [PATCH 054/125] add task profile constants --- .../org/highmed/dsf/bpe/ConstantsFeasibility.java | 12 ++++++++++++ ...FeasibilityFromMedicsViaMedic1ExampleStarter.java | 4 ++-- .../org/highmed/dsf/bpe/ConstantsLocalServices.java | 1 + .../AbstractLocalServicesMedic1ExampleStarter.java | 4 ++-- .../main/java/org/highmed/dsf/bpe/ConstantsPing.java | 3 +++ .../AbstractPing3MedicFromTtpExampleStarter.java | 4 ++-- .../highmed/dsf/bpe/ConstantsUpdateAllowList.java | 4 ++++ ...nloadAllowListFromTtpViaMedic1ExampleStarter.java | 4 ++-- ...stractUpdateAllowList3MedicTtpExampleStarter.java | 4 ++-- .../highmed/dsf/bpe/ConstantsUpdateResources.java | 4 ++++ ...bstractUpdateResource3MedicTtpExampleStarter.java | 4 ++-- 11 files changed, 36 insertions(+), 12 deletions(-) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java index ebf11c54..208a3231 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java @@ -35,6 +35,8 @@ public interface ConstantsFeasibility String CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE = "research-study-reference"; String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-request-feasibility"; + String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY + "|" + + VERSION; String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestFeasibility/"; String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI + VERSION; @@ -43,23 +45,33 @@ public interface ConstantsFeasibility String PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "localServicesIntegration/"; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-execute-feasibility"; + String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY + "|" + + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "executeFeasibility/"; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MESSAGE_NAME = "executeFeasibilityMessage"; String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-compute-feasibility"; + String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY + "|" + + VERSION; String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "computeFeasibility/"; String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_MESSAGE_NAME = "computeFeasibilityMessage"; String PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility"; + String PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_FEASIBILITY_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_FEASIBILITY + + "|" + VERSION; String PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_FEASIBILITY_MESSAGE_NAME = "resultSingleMedicFeasibilityMessage"; String PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-feasibility"; + String PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_FEASIBILITY_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_FEASIBILITY + + "|" + VERSION; String PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_FEASIBILITY_MESSAGE_NAME = "resultMultiMedicFeasibilityMessage"; String PROFILE_HIGHMED_TASK_ERROR_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-feasibility"; + String PROFILE_HIGHMED_TASK_ERROR_FEASIBILITY_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_ERROR_FEASIBILITY + "|" + + VERSION; String PROFILE_HIGHMED_TASK_ERROR_FEASIBILITY_MESSAGE_NAME = "errorMultiMedicFeasibilityMessage"; } diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java index 1cc918ac..5b02f185 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java @@ -14,7 +14,7 @@ import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_RESEARCH_STUDY_REFERENCE; -import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY; +import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1; @@ -136,7 +136,7 @@ private Task createTask(ResearchStudy researchStudy) Task task = new Task(); task.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); - task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_AND_LATEST_VERSION); task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION); task.setStatus(TaskStatus.REQUESTED); task.setIntent(TaskIntent.ORDER); diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java index 70562d56..a0cd410f 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java @@ -6,6 +6,7 @@ public interface ConstantsLocalServices { String PROFILE_HIGHMED_TASK_LOCAL_SERVICES = "http://highmed.org/fhir/StructureDefinition/task-local-services-integration"; + String PROFILE_HIGHMED_TASK_LOCAL_SERVICES_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_LOCAL_SERVICES + "|" + VERSION; String PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_LOCAL_SERVICES_MESSAGE_NAME = "localServicesIntegrationMessage"; diff --git a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/AbstractLocalServicesMedic1ExampleStarter.java b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/AbstractLocalServicesMedic1ExampleStarter.java index 853f315e..cac50aca 100644 --- a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/AbstractLocalServicesMedic1ExampleStarter.java +++ b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/start/AbstractLocalServicesMedic1ExampleStarter.java @@ -9,7 +9,7 @@ import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsFeasibility.CODESYSTEM_HIGHMED_FEASIBILITY_VALUE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES; +import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1; @@ -42,7 +42,7 @@ private Task createStartResource() { Task task = new Task(); - task.getMeta().addProfile(PROFILE_HIGHMED_TASK_LOCAL_SERVICES); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_LOCAL_SERVICES_AND_LATEST_VERSION); task.setInstantiatesUri(PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION); task.setStatus(Task.TaskStatus.REQUESTED); task.setIntent(Task.TaskIntent.ORDER); diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java index f3c80bb2..72a9820e 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java @@ -6,14 +6,17 @@ public interface ConstantsPing { String PROFILE_HIGHMED_TASK_START_PING = "http://highmed.org/fhir/StructureDefinition/task-start-ping-process"; + String PROFILE_HIGHMED_TASK_START_PING_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_START_PING + "|" + VERSION; String PROFILE_HIGHMED_TASK_START_PING_MESSAGE_NAME = "startPingProcessMessage"; String PROFILE_HIGHMED_TASK_PING = "http://highmed.org/fhir/StructureDefinition/task-ping"; + String PROFILE_HIGHMED_TASK_PING_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_PING + "|" + VERSION; String PROFILE_HIGHMED_TASK_PING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "ping/"; String PROFILE_HIGHMED_TASK_PING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_PING_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_PING_MESSAGE_NAME = "pingMessage"; String PROFILE_HIGHMED_TASK_PONG_TASK = "http://highmed.org/fhir/StructureDefinition/task-pong"; + String PROFILE_HIGHMED_TASK_PONG_TASK_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_PONG_TASK + "|" + VERSION; String PROFILE_HIGHMED_TASK_PONG_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "pong/"; String PROFILE_HIGHMED_TASK_PONG_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_PONG_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_PONG_MESSAGE_NAME = "pongMessage"; diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractPing3MedicFromTtpExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractPing3MedicFromTtpExampleStarter.java index ee760643..00081f17 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractPing3MedicFromTtpExampleStarter.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractPing3MedicFromTtpExampleStarter.java @@ -4,7 +4,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PING_PROCESS_URI_AND_LATEST_VERSION; -import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_MESSAGE_NAME; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; @@ -27,7 +27,7 @@ protected void main(String[] args, String baseUrl) throws Exception private Task createStartResource() { Task task = new Task(); - task.getMeta().addProfile(PROFILE_HIGHMED_TASK_START_PING); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_START_PING_AND_LATEST_VERSION); task.setInstantiatesUri(PROFILE_HIGHMED_TASK_PING_PROCESS_URI_AND_LATEST_VERSION); task.setStatus(TaskStatus.REQUESTED); task.setIntent(TaskIntent.ORDER); diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java index 2e0c3e33..f83c42e3 100644 --- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java +++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java @@ -9,12 +9,16 @@ public interface ConstantsUpdateAllowList String CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST = "allow_list"; String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST = "http://highmed.org/fhir/StructureDefinition/task-download-allow-list"; + String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST + "|" + + VERSION; String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "downloadAllowList/"; String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_MESSAGE_NAME = "downloadAllowListMessage"; String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST = "http://highmed.org/fhir/StructureDefinition/task-update-allow-list"; + String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST + "|" + + VERSION; String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "updateAllowList/"; String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI + VERSION; diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/AbstractDownloadAllowListFromTtpViaMedic1ExampleStarter.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/AbstractDownloadAllowListFromTtpViaMedic1ExampleStarter.java index 1410f258..57c9c855 100644 --- a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/AbstractDownloadAllowListFromTtpViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/AbstractDownloadAllowListFromTtpViaMedic1ExampleStarter.java @@ -5,7 +5,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST; import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST; -import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST; +import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1; @@ -38,7 +38,7 @@ private Task createStartResource(ExampleStarter starter, String ttpUrl) throws E Bundle allowList = getAllowList(starter, ttpUrl); Task task = new Task(); - task.getMeta().addProfile(PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_AND_LATEST_VERSION); task.setInstantiatesUri(PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION); task.setStatus(TaskStatus.REQUESTED); task.setIntent(TaskIntent.ORDER); diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/AbstractUpdateAllowList3MedicTtpExampleStarter.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/AbstractUpdateAllowList3MedicTtpExampleStarter.java index 89920cf7..c7907118 100644 --- a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/AbstractUpdateAllowList3MedicTtpExampleStarter.java +++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/start/AbstractUpdateAllowList3MedicTtpExampleStarter.java @@ -3,7 +3,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST; +import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; @@ -27,7 +27,7 @@ protected void main(String[] args, String baseUrl) throws Exception private Task createStartResource() { Task task = new Task(); - task.getMeta().addProfile(PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_AND_LATEST_VERSION); task.setInstantiatesUri(PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION); task.setStatus(TaskStatus.REQUESTED); task.setIntent(TaskIntent.ORDER); diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java index a4a56881..e6a7b7ec 100644 --- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java +++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java @@ -12,6 +12,8 @@ public interface ConstantsUpdateResources String CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_ORGANIZATION_IDENTIFIER_SEARCH_PARAMETER = "organization-identifier-search-parameter"; String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES = "http://highmed.org/fhir/StructureDefinition/task-request-update-resources"; + String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES + + "|" + VERSION; String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestUpdateResources/"; String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI @@ -19,6 +21,8 @@ public interface ConstantsUpdateResources String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_MESSAGE_NAME = "requestUpdateResourcesMessage"; String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES = "http://highmed.org/fhir/StructureDefinition/task-execute-update-resources"; + String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES + + "|" + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "executeUpdateResources/"; String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI diff --git a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/AbstractUpdateResource3MedicTtpExampleStarter.java b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/AbstractUpdateResource3MedicTtpExampleStarter.java index 9fa0731b..c6475c15 100644 --- a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/AbstractUpdateResource3MedicTtpExampleStarter.java +++ b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/start/AbstractUpdateResource3MedicTtpExampleStarter.java @@ -6,7 +6,7 @@ import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE; import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE; import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_ORGANIZATION_IDENTIFIER_SEARCH_PARAMETER; -import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES; +import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; @@ -39,7 +39,7 @@ private Task createStartResource(ExampleStarter starter, String ttpUrl) throws E Bundle allowList = getAllowList(starter, ttpUrl); Task task = new Task(); - task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_AND_LATEST_VERSION); task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION); task.setStatus(TaskStatus.REQUESTED); task.setIntent(TaskIntent.ORDER); From cbee7bc3e0acc8e6b09ce219860ef47290718a07 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 17 Sep 2021 12:10:43 +0200 Subject: [PATCH 055/125] adapt to properties naming convention, use constant instead of literal string --- .../main/java/org/highmed/dsf/bpe/service/ModifyQueries.java | 3 ++- .../org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java index 4ef209b2..7f7d7c9b 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java @@ -3,6 +3,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; +import static org.highmed.pseudonymization.openehr.Constants.EHRID_COLUMN_NAME; import java.util.HashMap; import java.util.Map; @@ -68,6 +69,6 @@ private Map<String, String> modifyQueries(Map<String, String> queries) protected String replaceSelectCountWithSelectMpiId(String value) { // TODO Implement correct replacement for default id query - return value.replace("SELECT COUNT(e)", "SELECT e" + ehrIdColumnPath + " as EHRID"); + return value.replace("SELECT COUNT(e)", "SELECT e" + ehrIdColumnPath + " as " + EHRID_COLUMN_NAME); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java index b674a878..0fa2a3be 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java @@ -85,7 +85,7 @@ public class FeasibilityConfig @Autowired private Environment environment; - @Value("${org.highmed.dsf.bpe.openehr.subject_external_id.path:/ehr_status/subject/external_ref/id/value}") + @Value("${org.highmed.dsf.bpe.openehr.subject.external.id.path:/ehr_status/subject/external_ref/id/value}") private String ehrIdColumnPath; // From 29d821f7cc877acc4b937370223483ddcff2a714 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 20 Sep 2021 09:31:07 +0200 Subject: [PATCH 056/125] add tests and starters for data sharing 0.5.0, add missing reference type information, fix typos --- .../dsf/bpe/message/SendMedicRequest.java | 4 +- .../highmed/dsf/bpe/message/SendResults.java | 6 +- .../dsf/bpe/message/SendTtpRequest.java | 5 +- .../service/DownloadDataSharingResources.java | 5 - ...ringFromMedicsViaMedic1ExampleStarter.java | 190 ++++++++++++++++++ ...omMedicsViaMedic1DockerExampleStarter.java | 16 ++ ...ringFromMedicsViaMedic1ExampleStarter.java | 186 +---------------- .../ActivityDefinitionProfileTest.java | 116 +++++++++++ .../dsf/bpe/message/SendMedicRequest.java | 1 - ...lityFromMedicsViaMedic1ExampleStarter.java | 15 +- ...lityFromMedicsViaMedic1ExampleStarter.java | 5 - 11 files changed, 342 insertions(+), 207 deletions(-) create mode 100644 dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java create mode 100644 dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1DockerExampleStarter.java create mode 100644 dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java index 24dc1754..a88ac84d 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java @@ -47,7 +47,7 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut ParameterComponent inputNeedsConsentCheck = getNeedsConsentCheckComponent(needsConsentCheck); boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); - ParameterComponent inputNeedsRecordLinkage = getNeedsRecordLinakgeComponent(needsRecordLinkage); + ParameterComponent inputNeedsRecordLinkage = getNeedsRecordLinkageComponent(needsRecordLinkage); byte[] mdatKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); ParameterComponent inputMdatKey = getMdatKeyComponent(mdatKey); @@ -83,7 +83,7 @@ private Task.ParameterComponent getNeedsConsentCheckComponent(boolean needsConse CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK, needsConsentCheck); } - private Task.ParameterComponent getNeedsRecordLinakgeComponent(boolean needsRecordLinkage) + private Task.ParameterComponent getNeedsRecordLinkageComponent(boolean needsRecordLinkage) { return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java index c143b00a..8dbb735f 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java @@ -56,11 +56,9 @@ private Task.ParameterComponent toInput(QueryResult result) } else { - logger.warn("Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " - + result.getCohortId()); + logger.warn("Unexpected result (not a ResultSet URL result) for cohort with ID " + result.getCohortId()); throw new RuntimeException( - "Unexpected result (not a cohort-size or ResultSet URL result) for cohort with ID " - + result.getCohortId()); + "Unexpected result (not a ResultSet URL result) for cohort with ID " + result.getCohortId()); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java index 53123eab..c7bf0d31 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java @@ -20,6 +20,7 @@ import org.highmed.dsf.fhir.variables.Targets; import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResourceType; import org.hl7.fhir.r4.model.Task; import ca.uhn.fhir.context.FhirContext; @@ -63,8 +64,8 @@ private Task.ParameterComponent getRecordLinkageComponent(boolean needsRecordLin private Task.ParameterComponent getInputResearchStudyIdentifierComponent(String researchStudyIdentifierValue) { - Reference reference = new Reference().setIdentifier(new Identifier().setValue(researchStudyIdentifierValue) - .setSystem(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)); + Reference reference = new Reference().setType(ResourceType.ResearchStudy.name()).setIdentifier(new Identifier() + .setValue(researchStudyIdentifierValue).setSystem(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)); return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_IDENTIFIER, reference); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java index 9fe5805f..b652488b 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java @@ -185,11 +185,6 @@ private String getTtpIdentifier(ResearchStudy researchStudy) return ref.getIdentifier().getValue(); } - private String getLeadingMedicIdentifier(Task task) - { - return task.getRequester().getIdentifier().getValue(); - } - private boolean getNeedsConsentCheck(Task task) { return getTaskHelper() diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java new file mode 100644 index 00000000..b5641333 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -0,0 +1,190 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsBase.CODE_TYPE_AQL_QUERY; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHEMD_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHMED_GROUP; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONTRACT_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_FEASIBILITY_QUERY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_REQUEST_FORM_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; +import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_TTP; +import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_QUERY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; + +import java.util.Date; +import java.util.UUID; + +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelperImpl; +import org.hl7.fhir.r4.model.BooleanType; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.Expression; +import org.hl7.fhir.r4.model.Group; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Narrative; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.RelatedArtifact; +import org.hl7.fhir.r4.model.ResearchStudy; +import org.hl7.fhir.r4.model.ResourceType; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.TaskIntent; +import org.hl7.fhir.r4.model.Task.TaskStatus; + +public abstract class AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter +{ + private final boolean NEEDS_CONSENT_CHECK = true; + private final boolean NEEDS_RECORD_LINKAGE = true; + + private static String REQUEST_FORM_REFERENCE = "https://foo/fhir/Binary/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; + private static String CONTRACT_REFERENCE = "https://foo/fhir/Binary/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; + private static String FEASIBILITY_REFERENCE = "https://foo/fhir/Task/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; + + private final String QUERY = "SELECT e/ehr_status/subject/external_ref/id/value as EHRID, " + + "v/items[at0024,'Bezeichnung']/value, v/items [at0001,'Messwert'], " + + "v/items[at0006,'Dokumentationsdatum Untersuchung']/value FROM EHR e CONTAINS COMPOSITION c " + + "CONTAINS CLUSTER v[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1] " + + "WHERE v/items[at0024,'Bezeichnung']/value/value = 'Natrium' OFFSET 0 LIMIT 15;"; + + private final ReadAccessHelper readAccessHelper = new ReadAccessHelperImpl(); + + protected void main(String[] args, String baseUrl) throws Exception + { + Bundle bundle = createStartResource(); + ExampleStarter.forServer(args, baseUrl).startWith(bundle); + } + + private Bundle createStartResource() + { + Group group1 = createGroup("Group 1"); + Group group2 = createGroup("Group 2"); + ResearchStudy researchStudy = createResearchStudy(group1, group2); + Task task = createTask(researchStudy); + + Bundle bundle = new Bundle(); + bundle.setType(Bundle.BundleType.TRANSACTION); + bundle.addEntry().setResource(group1).setFullUrl(group1.getIdElement().getIdPart()).getRequest() + .setMethod(Bundle.HTTPVerb.POST).setUrl(ResourceType.Group.name()); + bundle.addEntry().setResource(group2).setFullUrl(group2.getIdElement().getIdPart()).getRequest() + .setMethod(Bundle.HTTPVerb.POST).setUrl(ResourceType.Group.name()); + bundle.addEntry().setResource(researchStudy).setFullUrl(researchStudy.getIdElement().getIdPart()).getRequest() + .setMethod(Bundle.HTTPVerb.POST).setUrl(ResourceType.ResearchStudy.name()); + bundle.addEntry().setResource(task).setFullUrl(task.getIdElement().getIdPart()).getRequest() + .setMethod(Bundle.HTTPVerb.POST).setUrl(ResourceType.Task.name()); + + return bundle; + } + + private Group createGroup(String name) + { + Group group = new Group(); + group.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); + + group.getMeta().addProfile(PROFILE_HIGHMED_GROUP); + group.getText().getDiv().addText("This is the description"); + group.getText().setStatus(Narrative.NarrativeStatus.ADDITIONAL); + group.setType(Group.GroupType.PERSON); + group.setActual(false); + group.setActive(true); + group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY) + .setValue(new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression(QUERY)); + group.setName(name); + + readAccessHelper.addAll(group); + + return group; + } + + private ResearchStudy createResearchStudy(Group group1, Group group2) + { + ResearchStudy researchStudy = new ResearchStudy(); + researchStudy.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); + + researchStudy.getMeta().addProfile(PROFILE_HIGHEMD_RESEARCH_STUDY); + researchStudy.addIdentifier().setSystem(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER) + .setValue(UUID.randomUUID().toString()); + researchStudy.setStatus(ResearchStudy.ResearchStudyStatus.ACTIVE); + + researchStudy.addEnrollment().setReference(group1.getIdElement().getIdPart()); + researchStudy.addEnrollment().setReference(group2.getIdElement().getIdPart()); + + researchStudy.addRelatedArtifact().setType(RelatedArtifact.RelatedArtifactType.DOCUMENTATION) + .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_REQUEST_FORM_REFERENCE).setUrl(REQUEST_FORM_REFERENCE); + researchStudy.addRelatedArtifact().setType(RelatedArtifact.RelatedArtifactType.JUSTIFICATION) + .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONTRACT_REFERENCE).setUrl(CONTRACT_REFERENCE); + researchStudy.addRelatedArtifact().setType(RelatedArtifact.RelatedArtifactType.JUSTIFICATION) + .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_FEASIBILITY_QUERY_REFERENCE) + .setUrl(FEASIBILITY_REFERENCE); + + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) + .setValue(new Reference().setType(ResourceType.Organization.name()) + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1))); + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) + .setValue(new Reference().setType(ResourceType.Organization.name()) + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2))); + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) + .setValue(new Reference().setType(ResourceType.Organization.name()) + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3))); + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP) + .setValue(new Reference().setType(ResourceType.Organization.name()) + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP))); + + readAccessHelper.addAll(researchStudy); + + return researchStudy; + } + + private Task createTask(ResearchStudy researchStudy) + { + Task task = new Task(); + task.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); + + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME)).getType() + .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput() + .setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart()) + .setType(ResourceType.ResearchStudy.name())) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); + task.addInput().setValue(new BooleanType(NEEDS_RECORD_LINKAGE)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); + task.addInput().setValue(new BooleanType(NEEDS_CONSENT_CHECK)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); + + return task; + } +} diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1DockerExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1DockerExampleStarter.java new file mode 100644 index 00000000..f587d2a1 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1DockerExampleStarter.java @@ -0,0 +1,16 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.MEDIC_1_DOCKER_FHIR_BASE_URL; + +public class RequestDataSharingFromMedicsViaMedic1DockerExampleStarter + extends AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter +{ + // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate + // password + public static void main(String[] args) throws Exception + { + new RequestDataSharingFromMedicsViaMedic1DockerExampleStarter().main(args, MEDIC_1_DOCKER_FHIR_BASE_URL); + } +} diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java index 77c7f8be..6fe55619 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/RequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -1,198 +1,16 @@ package org.highmed.dsf.bpe.start; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; -import static org.highmed.dsf.bpe.ConstantsBase.CODE_TYPE_AQL_QUERY; -import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHEMD_RESEARCH_STUDY; -import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHMED_GROUP; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONTRACT_REFERENCE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_FEASIBILITY_QUERY_REFERENCE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_REQUEST_FORM_REFERENCE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; -import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_TTP; -import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_QUERY; -import static org.highmed.dsf.bpe.ConstantsDataSharing.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING; -import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME; -import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.MEDIC_1_FHIR_BASE_URL; -import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1; -import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2; -import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3; -import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; - -import java.nio.charset.StandardCharsets; -import java.util.Date; -import java.util.UUID; - -import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; -import org.highmed.dsf.fhir.authorization.read.ReadAccessHelperImpl; -import org.hl7.fhir.r4.model.Binary; -import org.hl7.fhir.r4.model.BooleanType; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.Expression; -import org.hl7.fhir.r4.model.Group; -import org.hl7.fhir.r4.model.IdType; -import org.hl7.fhir.r4.model.Identifier; -import org.hl7.fhir.r4.model.Narrative; -import org.hl7.fhir.r4.model.Reference; -import org.hl7.fhir.r4.model.RelatedArtifact; -import org.hl7.fhir.r4.model.ResearchStudy; -import org.hl7.fhir.r4.model.ResourceType; -import org.hl7.fhir.r4.model.StringType; -import org.hl7.fhir.r4.model.Task; -import org.hl7.fhir.r4.model.Task.TaskIntent; -import org.hl7.fhir.r4.model.Task.TaskStatus; public class RequestDataSharingFromMedicsViaMedic1ExampleStarter + extends AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter { - private static boolean NEEDS_CONSENT_CHECK = true; - private static boolean NEEDS_RECORD_LINKAGE = true; - - private static String REQUEST_FORM_REFERENCE = "https://foo/fhir/Binary/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; - private static String CONTRACT_REFERENCE = "https://foo/fhir/Binary/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; - private static String FEASIBILITY_REFERENCE = "https://foo/fhir/Task/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; - - private static final String QUERY = "SELECT e/ehr_status/subject/external_ref/id/value as EHRID, " - + "v/items[at0024,'Bezeichnung']/value, v/items [at0001,'Messwert'], " - + "v/items[at0006,'Dokumentationsdatum Untersuchung']/value FROM EHR e CONTAINS COMPOSITION c " - + "CONTAINS CLUSTER v[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1] " - + "WHERE v/items[at0024,'Bezeichnung']/value/value = 'Natrium' OFFSET 0 LIMIT 15;"; - - private static final ReadAccessHelper readAccessHelper = new ReadAccessHelperImpl(); - // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate // password public static void main(String[] args) throws Exception { - ExampleStarter starter = ExampleStarter.forServer(args, MEDIC_1_FHIR_BASE_URL); - Bundle bundle = createStartResource(starter); - starter.startWith(bundle); - } - - private static Bundle createStartResource(ExampleStarter starter) - { - Group group1 = createGroup("Group 1"); - Group group2 = createGroup("Group 2"); - ResearchStudy researchStudy = createResearchStudy(group1, group2); - Task task = createTask(researchStudy); - - Bundle bundle = new Bundle(); - bundle.setType(Bundle.BundleType.TRANSACTION); - bundle.addEntry().setResource(group1).setFullUrl(group1.getIdElement().getIdPart()).getRequest() - .setMethod(Bundle.HTTPVerb.POST).setUrl(ResourceType.Group.name()); - bundle.addEntry().setResource(group2).setFullUrl(group2.getIdElement().getIdPart()).getRequest() - .setMethod(Bundle.HTTPVerb.POST).setUrl(ResourceType.Group.name()); - bundle.addEntry().setResource(researchStudy).setFullUrl(researchStudy.getIdElement().getIdPart()).getRequest() - .setMethod(Bundle.HTTPVerb.POST).setUrl(ResourceType.ResearchStudy.name()); - bundle.addEntry().setResource(task).setFullUrl(task.getIdElement().getIdPart()).getRequest() - .setMethod(Bundle.HTTPVerb.POST).setUrl(ResourceType.Task.name()); - - return bundle; - } - - private static Group createGroup(String name) - { - Group group = new Group(); - group.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); - - group.getMeta().addProfile(PROFILE_HIGHMED_GROUP); - group.getText().getDiv().addText("This is the description"); - group.getText().setStatus(Narrative.NarrativeStatus.ADDITIONAL); - group.setType(Group.GroupType.PERSON); - group.setActual(false); - group.setActive(true); - group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY) - .setValue(new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression(QUERY)); - group.setName(name); - - readAccessHelper.addAll(group); - - return group; - } - - private static ResearchStudy createResearchStudy(Group group1, Group group2) - { - ResearchStudy researchStudy = new ResearchStudy(); - researchStudy.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); - - researchStudy.getMeta().addProfile(PROFILE_HIGHEMD_RESEARCH_STUDY); - researchStudy.addIdentifier().setSystem(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER) - .setValue(UUID.randomUUID().toString()); - researchStudy.setStatus(ResearchStudy.ResearchStudyStatus.ACTIVE); - - researchStudy.addEnrollment().setReference(group1.getIdElement().getIdPart()); - researchStudy.addEnrollment().setReference(group2.getIdElement().getIdPart()); - - researchStudy.addRelatedArtifact().setType(RelatedArtifact.RelatedArtifactType.DOCUMENTATION) - .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_REQUEST_FORM_REFERENCE).setUrl(REQUEST_FORM_REFERENCE); - researchStudy.addRelatedArtifact().setType(RelatedArtifact.RelatedArtifactType.JUSTIFICATION) - .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONTRACT_REFERENCE).setUrl(CONTRACT_REFERENCE); - researchStudy.addRelatedArtifact().setType(RelatedArtifact.RelatedArtifactType.JUSTIFICATION) - .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_FEASIBILITY_QUERY_REFERENCE) - .setUrl(FEASIBILITY_REFERENCE); - - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) - .setValue(new Reference().setType(ResourceType.Organization.name()) - .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1))); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) - .setValue(new Reference().setType(ResourceType.Organization.name()) - .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2))); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) - .setValue(new Reference().setType(ResourceType.Organization.name()) - .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3))); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP) - .setValue(new Reference().setType(ResourceType.Organization.name()) - .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP))); - - readAccessHelper.addAll(researchStudy); - - return researchStudy; - } - - private static Task createTask(ResearchStudy researchStudy) - { - Task task = new Task(); - task.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); - - task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING); - task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION); - task.setStatus(TaskStatus.REQUESTED); - task.setIntent(TaskIntent.ORDER); - task.setAuthoredOn(new Date()); - - task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() - .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1); - task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() - .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1); - - task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME)).getType() - .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); - task.addInput() - .setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart()) - .setType(ResourceType.ResearchStudy.name())) - .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) - .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); - task.addInput().setValue(new BooleanType(NEEDS_RECORD_LINKAGE)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) - .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); - task.addInput().setValue(new BooleanType(NEEDS_CONSENT_CHECK)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) - .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); - - return task; + new RequestDataSharingFromMedicsViaMedic1ExampleStarter().main(args, MEDIC_1_FHIR_BASE_URL); } } diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java new file mode 100644 index 00000000..35187d2d --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java @@ -0,0 +1,116 @@ +package org.highmed.dsf.fhir.profile; + +import static org.highmed.dsf.bpe.DataSharingProcessPluginDefinition.VERSION; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; + +import org.highmed.dsf.fhir.authorization.process.ProcessAuthorizationHelper; +import org.highmed.dsf.fhir.authorization.process.ProcessAuthorizationHelperImpl; +import org.highmed.dsf.fhir.validation.ResourceValidator; +import org.highmed.dsf.fhir.validation.ResourceValidatorImpl; +import org.highmed.dsf.fhir.validation.ValidationSupportRule; +import org.hl7.fhir.r4.model.ActivityDefinition; +import org.junit.ClassRule; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ca.uhn.fhir.validation.ResultSeverityEnum; +import ca.uhn.fhir.validation.ValidationResult; + +public class ActivityDefinitionProfileTest +{ + private static final Logger logger = LoggerFactory.getLogger(ActivityDefinitionProfileTest.class); + + @ClassRule + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + Arrays.asList("highmed-activity-definition-0.5.0.xml", "highmed-extension-process-authorization-0.5.0.xml", + "highmed-extension-process-authorization-consortium-role-0.5.0.xml", + "highmed-extension-process-authorization-organization-0.5.0.xml", + "highmed-coding-process-authorization-local-all-0.5.0.xml", + "highmed-coding-process-authorization-local-consortium-role-0.5.0.xml", + "highmed-coding-process-authorization-local-organization-0.5.0.xml", + "highmed-coding-process-authorization-remote-all-0.5.0.xml", + "highmed-coding-process-authorization-remote-consortium-role-0.5.0.xml", + "highmed-coding-process-authorization-remote-organization-0.5.0.xml"), + Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-process-authorization-0.5.0.xml"), + Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-process-authorization-recipient-0.5.0.xml", + "highmed-process-authorization-requester-0.5.0.xml")); + + private final ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), + validationRule.getValidationSupport()); + + private final ProcessAuthorizationHelper processAuthorizationHelper = new ProcessAuthorizationHelperImpl(); + + @Test + public void testComputeFeasibilityValid() throws Exception + { + try (InputStream in = Files + .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml"))) + { + ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() + .parseResource(ActivityDefinition.class, in); + + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> + { + System.err.println("Org: " + orgIdentifier); + return true; + }, role -> + { + System.err.println("Role:" + role); + return true; + })); + } + } + + @Test + public void testExecuteFeasibilityValid() throws Exception + { + try (InputStream in = Files + .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml"))) + { + ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() + .parseResource(ActivityDefinition.class, in); + + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + + assertTrue( + processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); + } + } + + @Test + public void testRequestFeasibilityValid() throws Exception + { + try (InputStream in = Files + .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml"))) + { + ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() + .parseResource(ActivityDefinition.class, in); + + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + + assertTrue( + processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); + } + } +} \ No newline at end of file diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java index ce9e3ba6..9cd80ba0 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java @@ -46,7 +46,6 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut new Reference().setReference(researchStudyId.toVersionless().getValueAsString())); boolean needsConsentCheck = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); - ParameterComponent inputNeedsConsentCheck = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK, needsConsentCheck); diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java index df97f94d..a3a1e53a 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java @@ -49,6 +49,11 @@ public abstract class AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter { + private final boolean NEEDS_CONSENT_CHECK = true; + private final boolean NEEDS_RECORD_LINKAGE = true; + + private final String QUERY = "SELECT COUNT(e) FROM EHR e"; + private final String[] medicIdentifier = new String[] { NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1, NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2, NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3 }; @@ -94,8 +99,8 @@ private Group createGroup(String name) group.setType(GroupType.PERSON); group.setActual(false); group.setActive(true); - group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY).setValue( - new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression("SELECT COUNT(e) FROM EHR e")); + group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY) + .setValue(new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression(QUERY)); group.setName(name); Arrays.stream(medicIdentifier).forEach(i -> readAccessHelper.addOrganization(group, i)); @@ -155,9 +160,11 @@ private Task createTask(ResearchStudy researchStudy) .setType(ResourceType.ResearchStudy.name())) .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); - task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + task.addInput().setValue(new BooleanType(NEEDS_RECORD_LINKAGE)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); - task.addInput().setValue(new BooleanType(true)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + task.addInput().setValue(new BooleanType(NEEDS_CONSENT_CHECK)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); return task; diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java index e324a60d..4cb5ab05 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityFromMedicsViaMedic1ExampleStarter.java @@ -5,11 +5,6 @@ public class RequestFeasibilityFromMedicsViaMedic1ExampleStarter extends AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter { - private static boolean NEEDS_CONSENT_CHECK = true; - private static boolean NEEDS_RECORD_LINKAGE = true; - - private static final String QUERY = "SELECT COUNT(e) FROM EHR e;"; - // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate From 3e22b53940b9670e6407f0f9193cb7ba03549e1b Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 20 Sep 2021 15:06:37 +0200 Subject: [PATCH 057/125] add task profile constant --- .../org/highmed/dsf/bpe/ConstantsDataSharing.java | 12 ++++++++++++ ...DataSharingFromMedicsViaMedic1ExampleStarter.java | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index a548c74e..6bbabc65 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -45,29 +45,41 @@ public interface ConstantsDataSharing String EXTENSION_HIGHMED_QUERY = "http://highmed.org/fhir/StructureDefinition/extension-query"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing"; + String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_AND_VERSION = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing" + + "|" + VERSION; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestDataSharing/"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME = "requestDataSharingMessage"; String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing"; + String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_AND_VERSION = "http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing" + + "|" + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "executeDataSharing/"; String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_MESSAGE_NAME = "executeDataSharingMessage"; String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing"; + String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_AND_VERSION = "http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing" + + "|" + VERSION; String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "computeDataSharing/"; String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_MESSAGE_NAME = "computeDataSharingMessage"; String PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing"; + String PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_DATA_SHARING_AND_VERSION = "http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing" + + "|" + VERSION; String PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_DATA_SHARING_MESSAGE_NAME = "resultSingleMedicDataSharingMessage"; String PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing"; + String PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_DATA_SHARING_AND_VERSION = "http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing" + + "|" + VERSION; String PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_DATA_SHARING_MESSAGE_NAME = "resultMultiMedicDataSharingMessage"; String PROFILE_HIGHMED_TASK_ERROR_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing"; + String PROFILE_HIGHMED_TASK_ERROR_DATA_SHARING_VERSION = "http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing" + + "|" + VERSION; String PROFILE_HIGHMED_TASK_ERROR_DATA_SHARING_MESSAGE_NAME = "errorMultiMedicDataSharingMessage"; } diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java index b5641333..d56670bc 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -17,7 +17,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_TTP; import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_QUERY; import static org.highmed.dsf.bpe.ConstantsDataSharing.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_AND_VERSION; import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1; @@ -158,7 +158,7 @@ private Task createTask(ResearchStudy researchStudy) Task task = new Task(); task.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); - task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_AND_VERSION); task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION); task.setStatus(TaskStatus.REQUESTED); task.setIntent(TaskIntent.ORDER); From 97cfb616ac3770d44bd991f143566880dfa8c4b2 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 20 Sep 2021 17:39:49 +0200 Subject: [PATCH 058/125] use new translators, add consent and pseudonymization clients --- .../dsf/bpe/service/EncryptQueryResults.java | 133 +++++++++++++ .../service/FilterQueryResultsByConsent.java | 59 +++++- .../dsf/bpe/service/GenerateBloomFilters.java | 123 ++++++++++++ .../PseudonymizeQueryResultsFirstOrder.java | 78 ++++++++ ... PseudonymizeQueryResultsSecondOrder.java} | 6 +- ...yResultsSecondOrderWithRecordLinkage.java} | 8 +- ...sultsSecondOrderWithoutRecordLinkage.java} | 5 +- .../TranslateSingleMedicResultSets.java | 184 ------------------ ...TranslateSingleMedicResultSetsWithRbf.java | 36 ---- ...nslateSingleMedicResultSetsWithoutRbf.java | 34 ---- .../bpe/spring/config/DataSharingConfig.java | 87 ++++++--- .../resources/bpe/computeDataSharing.bpmn | 4 +- .../resources/bpe/executeDataSharing.bpmn | 114 ++++++----- .../service/FilterQueryResultsByConsent.java | 52 +++-- .../dsf/bpe/service/GenerateBloomFilters.java | 22 ++- .../bpe/spring/config/FeasibilityConfig.java | 13 +- .../spring/config/LocalServicesConfig.java | 13 +- pom.xml | 7 +- 18 files changed, 603 insertions(+), 375 deletions(-) create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptQueryResults.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsFirstOrder.java rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{PseudonymizeResultSets.java => PseudonymizeQueryResultsSecondOrder.java} (96%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{PseudonymizeResultSetsWithRecordLinkage.java => PseudonymizeQueryResultsSecondOrderWithRecordLinkage.java} (68%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{PseudonymizeResultSetsWithoutRecordLinkage.java => PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage.java} (78%) delete mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java delete mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java delete mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptQueryResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptQueryResults.java new file mode 100644 index 00000000..645ba784 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptQueryResults.java @@ -0,0 +1,133 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.crypto.KeyProvider; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.openehr.model.structure.ResultSet; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtp; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpEncrypt; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpEncryptImpl; +import org.hl7.fhir.r4.model.ResearchStudy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +public class EncryptQueryResults extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(EncryptQueryResults.class); + + private final OrganizationProvider organizationProvider; + private final KeyProvider keyProvider; + private final String ehrIdColumnPath; + + public EncryptQueryResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, KeyProvider keyProvider, + String ehrIdColumnPath) + { + super(clientProvider, taskHelper, readAccessHelper); + + this.organizationProvider = organizationProvider; + this.keyProvider = keyProvider; + this.ehrIdColumnPath = ehrIdColumnPath; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(organizationProvider, "organizationProvider"); + Objects.requireNonNull(keyProvider, "keyProvider"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + String organizationIdentifier = organizationProvider.getLocalIdentifierValue(); + SecretKey idatKey = getIdatKey(organizationIdentifier); + String researchStudyIdentifier = getResearchStudyIdentifier(execution); + SecretKey mdatKey = getMdatKey(execution); + + ResultSetTranslatorToTtpEncrypt translator = createResultSetTranslator(organizationIdentifier, idatKey, + researchStudyIdentifier, mdatKey, ehrIdColumnPath); + + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + List<QueryResult> translatedResults = translateResults(translator, results); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(translatedResults))); + } + + private SecretKey getIdatKey(String organizationIdentifier) + { + return (SecretKey) keyProvider.get(organizationIdentifier); + } + + private String getResearchStudyIdentifier(DelegateExecution execution) + { + ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); + return researchStudy.getIdentifier().stream() + .filter(s -> s.getSystem().equals(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)).findFirst() + .orElseThrow(() -> new IllegalArgumentException("Identifier is not set in research study with id='" + + researchStudy.getId() + "', this error should have been caught by resource validation")) + .getValue(); + } + + private SecretKey getMdatKey(DelegateExecution execution) + { + byte[] encodedKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); + return new SecretKeySpec(encodedKey, "AES"); + } + + private ResultSetTranslatorToTtpEncrypt createResultSetTranslator(String organizationIdentifier, + SecretKey organizationKey, String researchStudyIdentifier, SecretKey researchStudyKey, + String ehrIdColumnPath) + { + return new ResultSetTranslatorToTtpEncryptImpl(organizationIdentifier, organizationKey, researchStudyIdentifier, + researchStudyKey, ehrIdColumnPath); + } + + private List<QueryResult> translateResults(ResultSetTranslatorToTtp translator, QueryResults results) + { + return results.getResults().stream().map(result -> translateResult(translator, result)) + .collect(Collectors.toList()); + } + + private QueryResult translateResult(ResultSetTranslatorToTtp translator, QueryResult result) + { + ResultSet translatedResultSet = translate(translator, result.getResultSet()); + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), translatedResultSet); + } + + private ResultSet translate(ResultSetTranslatorToTtp resultSetTranslator, ResultSet resultSet) + { + try + { + return resultSetTranslator.translate(resultSet); + } + catch (Exception exception) + { + logger.warn("Error while encrypting ResultSet: " + exception.getMessage(), exception); + throw exception; + } + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java index 8742d5fe..833f9ed4 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java @@ -1,27 +1,78 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.consent.client.ConsentClient; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.openehr.model.structure.ResultSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; -public class FilterQueryResultsByConsent extends AbstractServiceDelegate +public class FilterQueryResultsByConsent extends AbstractServiceDelegate implements InitializingBean { private static final Logger logger = LoggerFactory.getLogger(FilterQueryResultsByConsent.class); + private final ConsentClient consentClient; + public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper) + ReadAccessHelper readAccessHelper, ConsentClient consentClient) { super(clientProvider, taskHelper, readAccessHelper); + + this.consentClient = consentClient; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(consentClient, "consentClient"); } @Override protected void doExecute(DelegateExecution execution) throws Exception { - // TODO: implement doExecute - logger.debug(this.getClass().getName() + " doExecute called"); + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + List<QueryResult> checkedResults = checkResults(results); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(checkedResults))); + } + + private List<QueryResult> checkResults(QueryResults results) + { + return results.getResults().stream().map(result -> checkResult(result)).collect(Collectors.toList()); + } + + private QueryResult checkResult(QueryResult result) + { + ResultSet checkedResultSet = check(result.getResultSet()); + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), checkedResultSet); + } + + private ResultSet check(ResultSet resultSet) + { + try + { + return consentClient.check(resultSet); + } + catch (Exception exception) + { + logger.warn("Error while checking ResultSet: " + exception.getMessage(), exception); + throw exception; + } } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java new file mode 100644 index 00000000..322b8fba --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -0,0 +1,123 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.BloomFilterConfig; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.mpi.client.MasterPatientIndexClient; +import org.highmed.openehr.model.structure.ResultSet; +import org.highmed.pseudonymization.bloomfilter.BloomFilterGenerator; +import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGenerator; +import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGeneratorImpl; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtp; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpCreateRbf; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpCreateRbfImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +public class GenerateBloomFilters extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(GenerateBloomFilters.class); + + private static final int RBF_LENGTH = 3000; + private static final RecordBloomFilterGeneratorImpl.FieldWeights FBF_WEIGHTS = new RecordBloomFilterGeneratorImpl.FieldWeights( + 0.1, 0.1, 0.1, 0.2, 0.05, 0.1, 0.05, 0.2, 0.1); + private static final RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths FBF_LENGTHS = new RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths( + 500, 500, 250, 50, 500, 250, 500, 500, 500); + + private final MasterPatientIndexClient masterPatientIndexClient; + private final String ehrIdColumnPath; + private final BouncyCastleProvider bouncyCastleProvider; + + public GenerateBloomFilters(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, MasterPatientIndexClient masterPatientIndexClient, + String ehrIdColumnPath, BouncyCastleProvider bouncyCastleProvider) + { + super(clientProvider, taskHelper, readAccessHelper); + + this.masterPatientIndexClient = masterPatientIndexClient; + this.ehrIdColumnPath = ehrIdColumnPath; + this.bouncyCastleProvider = bouncyCastleProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(masterPatientIndexClient, "masterPatientIndexClient"); + Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath"); + Objects.requireNonNull(bouncyCastleProvider, "bouncyCastleProvided"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + RecordBloomFilterGenerator recordBloomFilterGenerator = createRecordBloomFilterGenerator(execution); + ResultSetTranslatorToTtpCreateRbf translator = createResultSetTranslator(ehrIdColumnPath, + recordBloomFilterGenerator, masterPatientIndexClient); + + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + List<QueryResult> translatedResults = translateResults(translator, results); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(translatedResults))); + } + + private RecordBloomFilterGenerator createRecordBloomFilterGenerator(DelegateExecution execution) + { + BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution + .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); + return new RecordBloomFilterGeneratorImpl(RBF_LENGTH, bloomFilterConfig.getPermutationSeed(), FBF_WEIGHTS, + FBF_LENGTHS, + () -> new BloomFilterGenerator.HmacSha2HmacSha3BiGramHasher(bloomFilterConfig.getHmacSha2Key(), + bloomFilterConfig.getHmacSha3Key(), bouncyCastleProvider)); + } + + private ResultSetTranslatorToTtpCreateRbf createResultSetTranslator(String ehrIdColumnPath, + RecordBloomFilterGenerator recordBloomFilterGenerator, MasterPatientIndexClient masterPatientIndexClient) + { + return new ResultSetTranslatorToTtpCreateRbfImpl(ehrIdColumnPath, recordBloomFilterGenerator, + masterPatientIndexClient); + } + + private List<QueryResult> translateResults(ResultSetTranslatorToTtp translator, QueryResults results) + { + return results.getResults().stream().map(result -> translateResult(translator, result)) + .collect(Collectors.toList()); + } + + private QueryResult translateResult(ResultSetTranslatorToTtp translator, QueryResult result) + { + ResultSet translatedResultSet = translate(translator, result.getResultSet()); + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), translatedResultSet); + } + + private ResultSet translate(ResultSetTranslatorToTtp resultSetTranslator, ResultSet resultSet) + { + try + { + return resultSetTranslator.translate(resultSet); + } + catch (Exception exception) + { + logger.warn("Error while generating bloom filter: " + exception.getMessage(), exception); + throw exception; + } + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsFirstOrder.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsFirstOrder.java new file mode 100644 index 00000000..d01c4e13 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsFirstOrder.java @@ -0,0 +1,78 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.openehr.model.structure.ResultSet; +import org.highmed.pseudonymization.client.PseudonymizationClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +public class PseudonymizeQueryResultsFirstOrder extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(PseudonymizeQueryResultsFirstOrder.class); + + private final PseudonymizationClient pseudonymizationClient; + + public PseudonymizeQueryResultsFirstOrder(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, PseudonymizationClient pseudonymizationClient) + { + super(clientProvider, taskHelper, readAccessHelper); + + this.pseudonymizationClient = pseudonymizationClient; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(pseudonymizationClient, "pseudonymizationClient"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + List<QueryResult> pseudonymizedResults = pseudonymizeResults(results); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(pseudonymizedResults))); + } + + private List<QueryResult> pseudonymizeResults(QueryResults results) + { + return results.getResults().stream().map(result -> pseudonymizeResult(result)).collect(Collectors.toList()); + } + + private QueryResult pseudonymizeResult(QueryResult result) + { + ResultSet pseudonymizedResultSet = pseudonymize(result.getResultSet()); + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), pseudonymizedResultSet); + } + + private ResultSet pseudonymize(ResultSet resultSet) + { + try + { + return pseudonymizationClient.pseudonymize(resultSet); + } + catch (Exception exception) + { + logger.warn("Error while encrypting ResultSet: " + exception.getMessage(), exception); + throw exception; + } + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrder.java similarity index 96% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrder.java index 43ff238d..9efc610d 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrder.java @@ -45,14 +45,14 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public abstract class PseudonymizeResultSets extends AbstractServiceDelegate implements InitializingBean +public abstract class PseudonymizeQueryResultsSecondOrder extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(PseudonymizeResultSets.class); + private static final Logger logger = LoggerFactory.getLogger(PseudonymizeQueryResultsSecondOrder.class); private final KeyConsumer keyConsumer; private final ObjectMapper psnObjectMapper; - public PseudonymizeResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public PseudonymizeQueryResultsSecondOrder(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, KeyConsumer keyConsumer, ObjectMapper psnObjectMapper) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrderWithRecordLinkage.java similarity index 68% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrderWithRecordLinkage.java index 49bc14d9..9a1e6d72 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrderWithRecordLinkage.java @@ -10,10 +10,12 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class PseudonymizeResultSetsWithRecordLinkage extends PseudonymizeResultSets implements InitializingBean +public class PseudonymizeQueryResultsSecondOrderWithRecordLinkage extends PseudonymizeQueryResultsSecondOrder + implements InitializingBean { - public PseudonymizeResultSetsWithRecordLinkage(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper, KeyConsumer keyConsumer, ObjectMapper psnObjectMapper) + public PseudonymizeQueryResultsSecondOrderWithRecordLinkage(FhirWebserviceClientProvider clientProvider, + TaskHelper taskHelper, ReadAccessHelper readAccessHelper, KeyConsumer keyConsumer, + ObjectMapper psnObjectMapper) { super(clientProvider, taskHelper, readAccessHelper, keyConsumer, psnObjectMapper); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithoutRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage.java similarity index 78% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithoutRecordLinkage.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage.java index 96f2fdee..eb2bfa47 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultSetsWithoutRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage.java @@ -10,9 +10,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class PseudonymizeResultSetsWithoutRecordLinkage extends PseudonymizeResultSets implements InitializingBean +public class PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage extends PseudonymizeQueryResultsSecondOrder + implements InitializingBean { - public PseudonymizeResultSetsWithoutRecordLinkage(FhirWebserviceClientProvider clientProvider, + public PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, KeyConsumer keyConsumer, ObjectMapper psnObjectMapper) { diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java deleted file mode 100644 index fef01f22..00000000 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSets.java +++ /dev/null @@ -1,184 +0,0 @@ -package org.highmed.dsf.bpe.service; - -import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -import javax.crypto.SecretKey; -import javax.crypto.spec.SecretKeySpec; - -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.crypto.KeyProvider; -import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variable.BloomFilterConfig; -import org.highmed.dsf.bpe.variable.QueryResult; -import org.highmed.dsf.bpe.variable.QueryResults; -import org.highmed.dsf.bpe.variable.QueryResultsValues; -import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; -import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; -import org.highmed.dsf.fhir.organization.OrganizationProvider; -import org.highmed.dsf.fhir.task.TaskHelper; -import org.highmed.mpi.client.MasterPatientIndexClient; -import org.highmed.openehr.model.structure.ResultSet; -import org.highmed.pseudonymization.bloomfilter.BloomFilterGenerator; -import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGenerator; -import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGeneratorImpl; -import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtp; -import org.hl7.fhir.r4.model.ResearchStudy; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.InitializingBean; - -public abstract class TranslateSingleMedicResultSets extends AbstractServiceDelegate implements InitializingBean -{ - private static final Logger logger = LoggerFactory.getLogger(TranslateSingleMedicResultSets.class); - - private static final int RBF_LENGTH = 3000; - private static final RecordBloomFilterGeneratorImpl.FieldWeights FBF_WEIGHTS = new RecordBloomFilterGeneratorImpl.FieldWeights( - 0.1, 0.1, 0.1, 0.2, 0.05, 0.1, 0.05, 0.2, 0.1); - private static final RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths FBF_LENGTHS = new RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths( - 500, 500, 250, 50, 500, 250, 500, 500, 500); - - private final OrganizationProvider organizationProvider; - private final KeyProvider keyProvider; - private final String ehrIdColumnPath; - private final MasterPatientIndexClient masterPatientIndexClient; - private final BouncyCastleProvider bouncyCastleProvider; - - public TranslateSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, KeyProvider keyProvider, - String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, - BouncyCastleProvider bouncyCastleProvider) - { - super(clientProvider, taskHelper, readAccessHelper); - - this.organizationProvider = organizationProvider; - this.keyProvider = keyProvider; - this.ehrIdColumnPath = ehrIdColumnPath; - this.masterPatientIndexClient = masterPatientIndexClient; - this.bouncyCastleProvider = bouncyCastleProvider; - } - - @Override - public void afterPropertiesSet() throws Exception - { - super.afterPropertiesSet(); - - Objects.requireNonNull(organizationProvider, "organizationProvider"); - Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath"); - - if (!(this instanceof TranslateSingleMedicResultSetsWithoutRbf)) - { - Objects.requireNonNull(masterPatientIndexClient, "masterPatientIndexClient"); - Objects.requireNonNull(bouncyCastleProvider, "bouncyCastleProvider"); - } - } - - @Override - protected void doExecute(DelegateExecution execution) throws Exception - { - String organizationIdentifier = organizationProvider.getLocalIdentifierValue(); - SecretKey idatKey = getIdatKey(organizationIdentifier); - String researchStudyIdentifier = getResearchStudyIdentifier(execution); - SecretKey mdatKey = getMdatKey(execution); - boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); - RecordBloomFilterGenerator bloomFilterGenerator = needsRecordLinkage - ? createRecordBloomFilterGenerator(execution) - : null; - - ResultSetTranslatorToTtp translator = createResultSetTranslator(organizationIdentifier, idatKey, - researchStudyIdentifier, mdatKey, ehrIdColumnPath, masterPatientIndexClient, bloomFilterGenerator); - - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - List<QueryResult> translatedResults = translateResults(translator, results); - - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - QueryResultsValues.create(new QueryResults(translatedResults))); - } - - private SecretKey getIdatKey(String organizationIdentifier) - { - return (SecretKey) keyProvider.get(organizationIdentifier); - } - - private String getResearchStudyIdentifier(DelegateExecution execution) - { - ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); - return researchStudy.getIdentifier().stream() - .filter(s -> s.getSystem().equals(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)).findFirst() - .orElseThrow(() -> new IllegalArgumentException("Identifier is not set in research study with id='" - + researchStudy.getId() + "', this error should have been caught by resource validation")) - .getValue(); - } - - private SecretKey getMdatKey(DelegateExecution execution) - { - byte[] encodedKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); - return new SecretKeySpec(encodedKey, "AES"); - } - - private RecordBloomFilterGenerator createRecordBloomFilterGenerator(DelegateExecution execution) - { - BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution - .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); - return new RecordBloomFilterGeneratorImpl(RBF_LENGTH, bloomFilterConfig.getPermutationSeed(), FBF_WEIGHTS, - FBF_LENGTHS, - () -> new BloomFilterGenerator.HmacSha2HmacSha3BiGramHasher(bloomFilterConfig.getHmacSha2Key(), - bloomFilterConfig.getHmacSha3Key(), bouncyCastleProvider)); - } - - /** - * @param organizationIdentifier - * the FHIR identifier of the current organization - * @param idatKey - * the key to encrypt the IDAT - * @param researchStudyIdentifier - * the FHIR identifier of the ResearchStudy defining the data sharing request - * @param mdatKey - * the key provided by the leading MeDIC to encrypt the MDAT - * @param ehrIdColumnPath - * the path to the external subject id column - * @param masterPatientIndexClient - * the client to retrieve the {@link org.highmed.mpi.client.Idat} from the MPI, may be null - * @param recordBloomFilterGenerator - * the generator to create RBFs based on the {@link org.highmed.mpi.client.Idat} provided by the - * masterPatientIndexClient, may be null - * @return {@link ResultSetTranslatorToTtp} - */ - abstract protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, - SecretKey idatKey, String researchStudyIdentifier, SecretKey mdatKey, String ehrIdColumnPath, - MasterPatientIndexClient masterPatientIndexClient, RecordBloomFilterGenerator recordBloomFilterGenerator); - - private List<QueryResult> translateResults(ResultSetTranslatorToTtp translator, QueryResults results) - { - return results.getResults().stream().map(result -> translateAndCreateBinary(translator, result)) - .collect(Collectors.toList()); - } - - private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtp translator, QueryResult result) - { - ResultSet translatedResultSet = translate(translator, result.getResultSet()); - return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), translatedResultSet); - } - - private ResultSet translate(ResultSetTranslatorToTtp resultSetTranslator, ResultSet resultSet) - { - try - { - return resultSetTranslator.translate(resultSet); - } - catch (Exception e) - { - logger.warn("Error while translating ResultSet: " + e.getMessage(), e); - throw e; - } - } -} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java deleted file mode 100644 index 517a4dac..00000000 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithRbf.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.highmed.dsf.bpe.service; - -import javax.crypto.SecretKey; - -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.highmed.dsf.bpe.crypto.KeyProvider; -import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; -import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; -import org.highmed.dsf.fhir.organization.OrganizationProvider; -import org.highmed.dsf.fhir.task.TaskHelper; -import org.highmed.mpi.client.MasterPatientIndexClient; -import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGenerator; -import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtp; -import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpWithRbfImpl; -import org.springframework.beans.factory.InitializingBean; - -public class TranslateSingleMedicResultSetsWithRbf extends TranslateSingleMedicResultSets implements InitializingBean -{ - public TranslateSingleMedicResultSetsWithRbf(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, KeyProvider keyProvider, - String ehrIdColumnPath, MasterPatientIndexClient masterPatientIndexClient, - BouncyCastleProvider bouncyCastleProvider) - { - super(clientProvider, taskHelper, readAccessHelper, organizationProvider, keyProvider, ehrIdColumnPath, - masterPatientIndexClient, bouncyCastleProvider); - } - - @Override - protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, SecretKey idatKey, - String researchStudyIdentifier, SecretKey mdatKey, String ehrIdColumnPath, - MasterPatientIndexClient masterPatientIndexClient, RecordBloomFilterGenerator recordBloomFilterGenerator) - { - return new ResultSetTranslatorToTtpWithRbfImpl(organizationIdentifier, idatKey, researchStudyIdentifier, - mdatKey, ehrIdColumnPath, recordBloomFilterGenerator, masterPatientIndexClient); - } -} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java deleted file mode 100644 index 27896e39..00000000 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateSingleMedicResultSetsWithoutRbf.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.highmed.dsf.bpe.service; - -import javax.crypto.SecretKey; - -import org.highmed.dsf.bpe.crypto.KeyProvider; -import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; -import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; -import org.highmed.dsf.fhir.organization.OrganizationProvider; -import org.highmed.dsf.fhir.task.TaskHelper; -import org.highmed.mpi.client.MasterPatientIndexClient; -import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGenerator; -import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtp; -import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpNoRbfImpl; -import org.springframework.beans.factory.InitializingBean; - -public class TranslateSingleMedicResultSetsWithoutRbf extends TranslateSingleMedicResultSets implements InitializingBean -{ - public TranslateSingleMedicResultSetsWithoutRbf(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, KeyProvider keyProvider, - String ehrIdColumnPath) - { - super(clientProvider, taskHelper, readAccessHelper, organizationProvider, keyProvider, ehrIdColumnPath, null, - null); - } - - @Override - protected ResultSetTranslatorToTtp createResultSetTranslator(String organizationIdentifier, SecretKey idatKey, - String researchStudyIdentifier, SecretKey mdatKey, String ehrIdColumnPath, - MasterPatientIndexClient masterPatientIndexClient, RecordBloomFilterGenerator recordBloomFilterGenerator) - { - return new ResultSetTranslatorToTtpNoRbfImpl(organizationIdentifier, idatKey, researchStudyIdentifier, mdatKey, - ehrIdColumnPath); - } -} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index c7d25c9a..86c8f68b 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -3,6 +3,8 @@ import java.nio.file.Paths; import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.highmed.consent.client.ConsentClient; +import org.highmed.consent.client.ConsentClientFactory; import org.highmed.dsf.bpe.crypto.KeyConsumer; import org.highmed.dsf.bpe.crypto.KeyProvider; import org.highmed.dsf.bpe.crypto.SecretKeyConsumerImpl; @@ -21,13 +23,16 @@ import org.highmed.dsf.bpe.service.DownloadMultiMedicResultSets; import org.highmed.dsf.bpe.service.DownloadResearchStudyResource; import org.highmed.dsf.bpe.service.DownloadSingleMedicResultSets; +import org.highmed.dsf.bpe.service.EncryptQueryResults; import org.highmed.dsf.bpe.service.ExecuteQueries; import org.highmed.dsf.bpe.service.ExtractQueries; import org.highmed.dsf.bpe.service.FilterQueryResultsByConsent; +import org.highmed.dsf.bpe.service.GenerateBloomFilters; import org.highmed.dsf.bpe.service.HandleErrorMultiMedicResults; import org.highmed.dsf.bpe.service.ModifyQueries; -import org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithRecordLinkage; -import org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithoutRecordLinkage; +import org.highmed.dsf.bpe.service.PseudonymizeQueryResultsFirstOrder; +import org.highmed.dsf.bpe.service.PseudonymizeQueryResultsSecondOrderWithRecordLinkage; +import org.highmed.dsf.bpe.service.PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage; import org.highmed.dsf.bpe.service.SelectRequestTargets; import org.highmed.dsf.bpe.service.SelectResponseTargetMedic; import org.highmed.dsf.bpe.service.SelectResponseTargetTtp; @@ -37,8 +42,6 @@ import org.highmed.dsf.bpe.service.StoreSingleMedicResultSetLinks; import org.highmed.dsf.bpe.service.StoreSingleMedicResultSets; import org.highmed.dsf.bpe.service.TranslateMultiMedicResultSets; -import org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithRbf; -import org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithoutRbf; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.group.GroupHelper; @@ -49,6 +52,8 @@ import org.highmed.mpi.client.MasterPatientIndexClientFactory; import org.highmed.openehr.client.OpenEhrClient; import org.highmed.openehr.client.OpenEhrClientFactory; +import org.highmed.pseudonymization.client.PseudonymizationClient; +import org.highmed.pseudonymization.client.PseudonymizationClientFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; @@ -65,6 +70,12 @@ public class DataSharingConfig @Autowired private FhirWebserviceClientProvider fhirClientProvider; + @Autowired + private ConsentClientFactory consentClientFactory; + + @Autowired + private PseudonymizationClientFactory pseudonymizationClientFactory; + @Autowired private MasterPatientIndexClientFactory masterPatientIndexClientFactory; @@ -215,17 +226,17 @@ public KeyConsumer keyConsumer() } @Bean - public PseudonymizeResultSetsWithRecordLinkage pseudonymizeResultSetsWithRecordLinkage() + public PseudonymizeQueryResultsSecondOrderWithRecordLinkage pseudonymizeQueryResultsSecondOrderWithRecordLinkage() { - return new PseudonymizeResultSetsWithRecordLinkage(fhirClientProvider, taskHelper, readAccessHelper, - keyConsumer(), objectMapper); + return new PseudonymizeQueryResultsSecondOrderWithRecordLinkage(fhirClientProvider, taskHelper, + readAccessHelper, keyConsumer(), objectMapper); } @Bean - public PseudonymizeResultSetsWithoutRecordLinkage pseudonymizeResultSetsWithoutRecordLinkage() + public PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage pseudonymizeQueryResultsSecondOrderWithoutRecordLinkage() { - return new PseudonymizeResultSetsWithoutRecordLinkage(fhirClientProvider, taskHelper, readAccessHelper, - keyConsumer(), objectMapper); + return new PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage(fhirClientProvider, taskHelper, + readAccessHelper, keyConsumer(), objectMapper); } @Bean @@ -295,56 +306,62 @@ public OpenEhrClient openEhrClient() return openEhrClientFactory.createClient(environment::getProperty); } + @Bean + public ConsentClient consentClient() + { + return consentClientFactory.createClient(environment::getProperty); + } + @Bean public FilterQueryResultsByConsent filterQueryResultsByConsent() { - return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper); + return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper, consentClient()); } @Bean - public KeyProvider keyProvider() + public MasterPatientIndexClient masterPatientIndexClient() { - return new SecretKeyProviderImpl(organizationProvider, Paths.get(organizationKeystoreFile), - organizationKeystorePassword.toCharArray()); + return masterPatientIndexClientFactory.createClient(environment::getProperty); } @Bean - public TranslateSingleMedicResultSetsWithRbf translateSingleMedicResultSetsWithRbf() + public BouncyCastleProvider bouncyCastleProvider() { - return new TranslateSingleMedicResultSetsWithRbf(fhirClientProvider, taskHelper, readAccessHelper, - organizationProvider, keyProvider(), ehrIdColumnPath, masterPatientIndexClient(), - bouncyCastleProvider()); + return new BouncyCastleProvider(); } @Bean - public TranslateSingleMedicResultSetsWithoutRbf translateSingleMedicResultSetsWithoutRbf() + public GenerateBloomFilters generateBloomFilters() { - return new TranslateSingleMedicResultSetsWithoutRbf(fhirClientProvider, taskHelper, readAccessHelper, - organizationProvider, keyProvider(), ehrIdColumnPath); + return new GenerateBloomFilters(fhirClientProvider, taskHelper, readAccessHelper, masterPatientIndexClient(), + ehrIdColumnPath, bouncyCastleProvider()); } @Bean - public MasterPatientIndexClient masterPatientIndexClient() + public PseudonymizationClient pseudonymizationClient() { - return masterPatientIndexClientFactory.createClient(environment::getProperty); + return pseudonymizationClientFactory.createClient(environment::getProperty); } @Bean - public BouncyCastleProvider bouncyCastleProvider() + public PseudonymizeQueryResultsFirstOrder pseudonymizeQueryResultsFirstOrder() { - return new BouncyCastleProvider(); + return new PseudonymizeQueryResultsFirstOrder(fhirClientProvider, taskHelper, readAccessHelper, + pseudonymizationClient()); } @Bean - public StoreSingleMedicResultSets storeSingleMedicResultSets() + public KeyProvider keyProvider() { - return new StoreSingleMedicResultSets(fhirClientProvider, taskHelper, readAccessHelper, objectMapper); + return new SecretKeyProviderImpl(organizationProvider, Paths.get(organizationKeystoreFile), + organizationKeystorePassword.toCharArray()); } @Bean - public CheckMedicSingleMedicResultSets checkMedicSingleMedicResultSets() + public EncryptQueryResults encryptQueryResults() { - return new CheckMedicSingleMedicResultSets(fhirClientProvider, taskHelper, readAccessHelper); + return new EncryptQueryResults(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider, + keyProvider(), ehrIdColumnPath); } @Bean @@ -353,6 +370,18 @@ public SelectResponseTargetTtp selectResponseTargetTtp() return new SelectResponseTargetTtp(fhirClientProvider, taskHelper, readAccessHelper, endpointProvider); } + @Bean + public CheckMedicSingleMedicResultSets checkMedicSingleMedicResultSets() + { + return new CheckMedicSingleMedicResultSets(fhirClientProvider, taskHelper, readAccessHelper); + } + + @Bean + public StoreSingleMedicResultSets storeSingleMedicResultSets() + { + return new StoreSingleMedicResultSets(fhirClientProvider, taskHelper, readAccessHelper, objectMapper); + } + @Bean public SendSingleMedicResults sendSingleMedicResults() { diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn index 4b023aa8..3e7c7704 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn @@ -61,7 +61,7 @@ <bpmn:sequenceFlow id="SequenceFlow_0t4lx4v" name="else" sourceRef="ExclusiveGateway_07e71aa" targetRef="pseudonymizeResultSetWithoutRecordLinkage"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:serviceTask id="pseudonymizeResultSetWithRecordLinkage" name="pseudonymize result sets with record linkage" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithRecordLinkage"> + <bpmn:serviceTask id="pseudonymizeResultSetWithRecordLinkage" name="pseudonymize result sets with record linkage" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeQueryResultsSecondOrderWithRecordLinkage"> <bpmn:incoming>SequenceFlow_0calilw</bpmn:incoming> <bpmn:outgoing>SequenceFlow_02zmrer</bpmn:outgoing> </bpmn:serviceTask> @@ -123,7 +123,7 @@ <bpmn:sequenceFlow id="Flow_1wig1wj" sourceRef="selectResponseTargetMedic" targetRef="checkPseudonymizedResultSets" /> <bpmn:sequenceFlow id="Flow_0uaqn1r" sourceRef="storeResultSets" targetRef="EndEventSuccess" /> <bpmn:sequenceFlow id="Flow_115yfgb" sourceRef="pseudonymizeResultSetWithoutRecordLinkage" targetRef="ExclusiveGateway_1r8ow3i" /> - <bpmn:serviceTask id="pseudonymizeResultSetWithoutRecordLinkage" name="pseudonymize result sets" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeResultSetsWithoutRecordLinkage"> + <bpmn:serviceTask id="pseudonymizeResultSetWithoutRecordLinkage" name="pseudonymize result sets" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage"> <bpmn:incoming>SequenceFlow_0t4lx4v</bpmn:incoming> <bpmn:outgoing>Flow_115yfgb</bpmn:outgoing> </bpmn:serviceTask> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index f2850366..d581a9ff 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -42,7 +42,7 @@ <bpmn:sequenceFlow id="SequenceFlow_0isxkuy" name="needs consent check" sourceRef="ExclusiveGateway_0bq7zdz" targetRef="filterByConsent"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsConsentCheck}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:serviceTask id="filterByConsent" name="filter by consent" camunda:class="org.highmed.dsf.bpe.service.FilterQueryResultsByConsent"> + <bpmn:serviceTask id="filterByConsent" name="filter query results by consent" camunda:class="org.highmed.dsf.bpe.service.FilterQueryResultsByConsent"> <bpmn:incoming>SequenceFlow_0isxkuy</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0kzp6tl</bpmn:outgoing> </bpmn:serviceTask> @@ -52,12 +52,12 @@ <bpmn:outgoing>Flow_14nlfvk</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0kzp6tl" sourceRef="filterByConsent" targetRef="ExclusiveGateway_0lecmy5" /> - <bpmn:serviceTask id="translateWithEncryptionAndRbfGeneration" name="translate with encryption and RBF generation " camunda:class="org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithRbf"> + <bpmn:serviceTask id="translateWithEncryptionAndRbfGeneration" name="generate bloom filters" camunda:class="org.highmed.dsf.bpe.service.GenerateBloomFilters"> <bpmn:incoming>Flow_0xt2bfn</bpmn:incoming> - <bpmn:outgoing>Flow_09yooed</bpmn:outgoing> + <bpmn:outgoing>Flow_1df64h2</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="selectResponseTargetTtp" name="select response target TTP" camunda:class="org.highmed.dsf.bpe.service.SelectResponseTargetTtp"> - <bpmn:incoming>Flow_1pgebfo</bpmn:incoming> + <bpmn:incoming>Flow_0m3ah40</bpmn:incoming> <bpmn:outgoing>Flow_1pzik8k</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="executeQueries" name="execute queries" camunda:class="org.highmed.dsf.bpe.service.ExecuteQueries"> @@ -75,36 +75,34 @@ <bpmn:incoming>Flow_1kp6eaq</bpmn:incoming> <bpmn:outgoing>Flow_1ecoehc</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:exclusiveGateway id="Gateway_118ojzy" name="needs record linkage"> + <bpmn:exclusiveGateway id="Gateway_118ojzy"> <bpmn:incoming>Flow_14nlfvk</bpmn:incoming> - <bpmn:outgoing>Flow_09dzkmp</bpmn:outgoing> <bpmn:outgoing>Flow_0xt2bfn</bpmn:outgoing> + <bpmn:outgoing>Flow_09dzkmp</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="Flow_14nlfvk" sourceRef="ExclusiveGateway_0lecmy5" targetRef="Gateway_118ojzy" /> <bpmn:exclusiveGateway id="Gateway_13kxug8"> - <bpmn:incoming>Flow_09yooed</bpmn:incoming> - <bpmn:incoming>Flow_13fof22</bpmn:incoming> + <bpmn:incoming>Flow_09dzkmp</bpmn:incoming> + <bpmn:incoming>Flow_1df64h2</bpmn:incoming> <bpmn:outgoing>Flow_1pgebfo</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="Flow_09dzkmp" name="else" sourceRef="Gateway_118ojzy" targetRef="translateWithEncryptionAndWithoutRbfGeneration"> + <bpmn:sequenceFlow id="Flow_09dzkmp" name="else" sourceRef="Gateway_118ojzy" targetRef="Gateway_13kxug8"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_0xt2bfn" sourceRef="Gateway_118ojzy" targetRef="translateWithEncryptionAndRbfGeneration"> + <bpmn:sequenceFlow id="Flow_0xt2bfn" name="needs record linkage" sourceRef="Gateway_118ojzy" targetRef="translateWithEncryptionAndRbfGeneration"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_09yooed" sourceRef="translateWithEncryptionAndRbfGeneration" targetRef="Gateway_13kxug8" /> <bpmn:serviceTask id="storeResultSets" name="store result sets" camunda:class="org.highmed.dsf.bpe.service.StoreSingleMedicResultSets"> <bpmn:incoming>Flow_08925ay</bpmn:incoming> <bpmn:outgoing>Flow_1611vr6</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_08925ay" sourceRef="checkResultSets" targetRef="storeResultSets" /> - <bpmn:sequenceFlow id="Flow_1pgebfo" sourceRef="Gateway_13kxug8" targetRef="selectResponseTargetTtp" /> + <bpmn:sequenceFlow id="Flow_1pgebfo" sourceRef="Gateway_13kxug8" targetRef="Activity_0ycd3ht" /> <bpmn:sequenceFlow id="Flow_1pzik8k" sourceRef="selectResponseTargetTtp" targetRef="checkResultSets" /> <bpmn:sequenceFlow id="Flow_1611vr6" sourceRef="storeResultSets" targetRef="EndEventSuccess" /> - <bpmn:sequenceFlow id="Flow_13fof22" sourceRef="translateWithEncryptionAndWithoutRbfGeneration" targetRef="Gateway_13kxug8" /> - <bpmn:serviceTask id="translateWithEncryptionAndWithoutRbfGeneration" name="translate with encryption" camunda:class="org.highmed.dsf.bpe.service.TranslateSingleMedicResultSetsWithoutRbf"> - <bpmn:incoming>Flow_09dzkmp</bpmn:incoming> - <bpmn:outgoing>Flow_13fof22</bpmn:outgoing> + <bpmn:serviceTask id="translateWithEncryptionAndWithoutRbfGeneration" name="encrypt query results" camunda:class="org.highmed.dsf.bpe.service.EncryptQueryResults"> + <bpmn:incoming>Flow_0wymq8g</bpmn:incoming> + <bpmn:outgoing>Flow_0m3ah40</bpmn:outgoing> </bpmn:serviceTask> <bpmn:boundaryEvent id="Event_0o8usc6" attachedToRef="checkResultSets"> <bpmn:outgoing>Flow_1o1ugb3</bpmn:outgoing> @@ -114,6 +112,13 @@ <bpmn:endEvent id="EndEventError" name="error occured"> <bpmn:incoming>Flow_1o1ugb3</bpmn:incoming> </bpmn:endEvent> + <bpmn:sequenceFlow id="Flow_1df64h2" sourceRef="translateWithEncryptionAndRbfGeneration" targetRef="Gateway_13kxug8" /> + <bpmn:sequenceFlow id="Flow_0m3ah40" sourceRef="translateWithEncryptionAndWithoutRbfGeneration" targetRef="selectResponseTargetTtp" /> + <bpmn:serviceTask id="Activity_0ycd3ht" name="pseudonymize query results" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeQueryResultsFirstOrder"> + <bpmn:incoming>Flow_1pgebfo</bpmn:incoming> + <bpmn:outgoing>Flow_0wymq8g</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_0wymq8g" sourceRef="Activity_0ycd3ht" targetRef="translateWithEncryptionAndWithoutRbfGeneration" /> <bpmn:textAnnotation id="TextAnnotation_0euut3n"> <bpmn:text>uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc.</bpmn:text> </bpmn:textAnnotation> @@ -125,46 +130,52 @@ <bpmn:error id="Error_0c5gjso" name="errorSingleMedicDataSharingResult" errorCode="errorSingleMedicDataSharingResult" camunda:errorMessage="errorSingleMedicDataSharingResult" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_executeDataSharing"> - <bpmndi:BPMNEdge id="Flow_1o1ugb3_di" bpmnElement="Flow_1o1ugb3"> - <di:waypoint x="1880" y="270" /> - <di:waypoint x="1880" y="340" /> - <di:waypoint x="2122" y="340" /> + <bpmndi:BPMNEdge id="Flow_0wymq8g_di" bpmnElement="Flow_0wymq8g"> + <di:waypoint x="1670" y="212" /> + <di:waypoint x="1730" y="212" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0m3ah40_di" bpmnElement="Flow_0m3ah40"> + <di:waypoint x="1830" y="212" /> + <di:waypoint x="1890" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_13fof22_di" bpmnElement="Flow_13fof22"> - <di:waypoint x="1490" y="315" /> + <bpmndi:BPMNEdge id="Flow_1df64h2_di" bpmnElement="Flow_1df64h2"> + <di:waypoint x="1490" y="320" /> <di:waypoint x="1490" y="237" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1o1ugb3_di" bpmnElement="Flow_1o1ugb3"> + <di:waypoint x="2160" y="270" /> + <di:waypoint x="2160" y="340" /> + <di:waypoint x="2402" y="340" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1611vr6_di" bpmnElement="Flow_1611vr6"> - <di:waypoint x="2040" y="212" /> - <di:waypoint x="2122" y="212" /> + <di:waypoint x="2320" y="212" /> + <di:waypoint x="2402" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1pzik8k_di" bpmnElement="Flow_1pzik8k"> - <di:waypoint x="1700" y="212" /> - <di:waypoint x="1780" y="212" /> + <di:waypoint x="1990" y="212" /> + <di:waypoint x="2060" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1pgebfo_di" bpmnElement="Flow_1pgebfo"> <di:waypoint x="1515" y="212" /> - <di:waypoint x="1600" y="212" /> + <di:waypoint x="1570" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_08925ay_di" bpmnElement="Flow_08925ay"> - <di:waypoint x="1880" y="212" /> - <di:waypoint x="1940" y="212" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_09yooed_di" bpmnElement="Flow_09yooed"> - <di:waypoint x="1490" y="130" /> - <di:waypoint x="1490" y="187" /> + <di:waypoint x="2160" y="212" /> + <di:waypoint x="2220" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0xt2bfn_di" bpmnElement="Flow_0xt2bfn"> - <di:waypoint x="1330" y="187" /> - <di:waypoint x="1330" y="90" /> - <di:waypoint x="1440" y="90" /> + <di:waypoint x="1330" y="237" /> + <di:waypoint x="1330" y="360" /> + <di:waypoint x="1440" y="360" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1337" y="326" width="65" height="27" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_09dzkmp_di" bpmnElement="Flow_09dzkmp"> - <di:waypoint x="1330" y="237" /> - <di:waypoint x="1330" y="355" /> - <di:waypoint x="1440" y="355" /> + <di:waypoint x="1355" y="212" /> + <di:waypoint x="1465" y="212" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1337" y="335" width="21" height="14" /> + <dc:Bounds x="1362" y="192" width="21" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_14nlfvk_di" bpmnElement="Flow_14nlfvk"> @@ -215,7 +226,7 @@ <di:waypoint x="1032" y="212" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResultSets"> - <dc:Bounds x="1780" y="172" width="100" height="80" /> + <dc:Bounds x="2060" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkDataSharingRequest"> <dc:Bounds x="400" y="172" width="100" height="80" /> @@ -230,9 +241,9 @@ <dc:Bounds x="240" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEventSuccess"> - <dc:Bounds x="2122" y="194" width="36" height="36" /> + <dc:Bounds x="2402" y="194" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2105" y="237" width="72" height="27" /> + <dc:Bounds x="2385" y="237" width="72" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0bq7zdz_di" bpmnElement="ExclusiveGateway_0bq7zdz" isMarkerVisible="true"> @@ -245,10 +256,10 @@ <dc:Bounds x="1192" y="187" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="translateWithEncryptionAndRbfGeneration"> - <dc:Bounds x="1440" y="50" width="100" height="80" /> + <dc:Bounds x="1440" y="320" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> - <dc:Bounds x="1600" y="172" width="100" height="80" /> + <dc:Bounds x="1890" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0u5pb4i_di" bpmnElement="executeQueries"> <dc:Bounds x="880" y="172" width="100" height="80" /> @@ -269,22 +280,25 @@ <dc:Bounds x="1465" y="187" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1mdgvqk_di" bpmnElement="storeResultSets"> - <dc:Bounds x="1940" y="172" width="100" height="80" /> + <dc:Bounds x="2220" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0cu49cc_di" bpmnElement="translateWithEncryptionAndWithoutRbfGeneration"> - <dc:Bounds x="1440" y="315" width="100" height="80" /> + <dc:Bounds x="1730" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1lnwlbo_di" bpmnElement="EndEventError"> - <dc:Bounds x="2122" y="322" width="36" height="36" /> + <dc:Bounds x="2402" y="322" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2107" y="365" width="66" height="14" /> + <dc:Bounds x="2387" y="365" width="66" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0ycd3ht_di" bpmnElement="Activity_0ycd3ht"> + <dc:Bounds x="1570" y="172" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> <dc:Bounds x="330" y="80" width="267" height="56" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_155zi8c_di" bpmnElement="Event_0o8usc6"> - <dc:Bounds x="1862" y="234" width="36" height="36" /> + <dc:Bounds x="2142" y="234" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> <di:waypoint x="455" y="172" /> diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java index 0d681c84..833f9ed4 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java @@ -3,9 +3,11 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import java.util.List; +import java.util.Objects; import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.consent.client.ConsentClient; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.QueryResult; import org.highmed.dsf.bpe.variable.QueryResults; @@ -14,41 +16,63 @@ import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.openehr.model.structure.ResultSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; -public class FilterQueryResultsByConsent extends AbstractServiceDelegate +public class FilterQueryResultsByConsent extends AbstractServiceDelegate implements InitializingBean { + private static final Logger logger = LoggerFactory.getLogger(FilterQueryResultsByConsent.class); + + private final ConsentClient consentClient; + public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper) + ReadAccessHelper readAccessHelper, ConsentClient consentClient) { super(clientProvider, taskHelper, readAccessHelper); + + this.consentClient = consentClient; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(consentClient, "consentClient"); } @Override protected void doExecute(DelegateExecution execution) throws Exception { QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - - List<QueryResult> filteredResults = filterResults(results.getResults()); + List<QueryResult> checkedResults = checkResults(results); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, - QueryResultsValues.create(new QueryResults(filteredResults))); + QueryResultsValues.create(new QueryResults(checkedResults))); } - private List<QueryResult> filterResults(List<QueryResult> results) + private List<QueryResult> checkResults(QueryResults results) { - return results.stream().map(this::filterResult).collect(Collectors.toList()); + return results.getResults().stream().map(result -> checkResult(result)).collect(Collectors.toList()); } - protected QueryResult filterResult(QueryResult result) + private QueryResult checkResult(QueryResult result) { - return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), - filterResultSet(result.getResultSet())); + ResultSet checkedResultSet = check(result.getResultSet()); + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), checkedResultSet); } - private ResultSet filterResultSet(ResultSet resultSet) + private ResultSet check(ResultSet resultSet) { - // TODO implement - - return resultSet; + try + { + return consentClient.check(resultSet); + } + catch (Exception exception) + { + logger.warn("Error while checking ResultSet: " + exception.getMessage(), exception); + throw exception; + } } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java index 3b0fcad8..defd6521 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -5,7 +5,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI; -import static org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpRbfOnlyImpl.FILTER_ON_IDAT_NOT_FOUND_EXCEPTION; +import static org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpCreateRbfOnlyDropOtherColumnsImpl.FILTER_ON_IDAT_NOT_FOUND_EXCEPTION; import java.security.Key; import java.util.List; @@ -29,8 +29,8 @@ import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGeneratorImpl; import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGeneratorImpl.FieldBloomFilterLengths; import org.highmed.pseudonymization.bloomfilter.RecordBloomFilterGeneratorImpl.FieldWeights; -import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpRbfOnly; -import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpRbfOnlyImpl; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpCreateRbfOnlyDropOtherColumns; +import org.highmed.pseudonymization.translation.ResultSetTranslatorToTtpCreateRbfOnlyDropOtherColumnsImpl; import org.hl7.fhir.r4.model.Binary; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r4.model.ResourceType; @@ -91,7 +91,8 @@ protected void doExecute(DelegateExecution execution) throws Exception BloomFilterConfig bloomFilterConfig = (BloomFilterConfig) execution .getVariable(BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG); - ResultSetTranslatorToTtpRbfOnly resultSetTranslator = createResultSetTranslator(bloomFilterConfig); + ResultSetTranslatorToTtpCreateRbfOnlyDropOtherColumns resultSetTranslator = createResultSetTranslator( + bloomFilterConfig); List<QueryResult> translatedResults = results.getResults().stream() .map(result -> translateAndCreateBinary(resultSetTranslator, result, securityIdentifier)) @@ -111,9 +112,10 @@ private String getSecurityIdentifier(DelegateExecution execution) return (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); } - protected ResultSetTranslatorToTtpRbfOnly createResultSetTranslator(BloomFilterConfig bloomFilterConfig) + protected ResultSetTranslatorToTtpCreateRbfOnlyDropOtherColumns createResultSetTranslator( + BloomFilterConfig bloomFilterConfig) { - return new ResultSetTranslatorToTtpRbfOnlyImpl(ehrIdColumnPath, + return new ResultSetTranslatorToTtpCreateRbfOnlyDropOtherColumnsImpl(ehrIdColumnPath, createRecordBloomFilterGenerator(bloomFilterConfig.getPermutationSeed(), bloomFilterConfig.getHmacSha2Key(), bloomFilterConfig.getHmacSha3Key()), masterPatientIndexClient, FILTER_ON_IDAT_NOT_FOUND_EXCEPTION); @@ -127,8 +129,9 @@ protected RecordBloomFilterGenerator createRecordBloomFilterGenerator(long permu bouncyCastleProvider)); } - private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtpRbfOnly resultSetTranslator, - QueryResult result, String ttpIdentifier) + private QueryResult translateAndCreateBinary( + ResultSetTranslatorToTtpCreateRbfOnlyDropOtherColumns resultSetTranslator, QueryResult result, + String ttpIdentifier) { ResultSet translatedResultSet = translate(resultSetTranslator, result.getResultSet()); String resultSetUrl = saveResultSetAsBinaryForTtp(translatedResultSet, ttpIdentifier); @@ -136,7 +139,8 @@ private QueryResult translateAndCreateBinary(ResultSetTranslatorToTtpRbfOnly res return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), resultSetUrl); } - private ResultSet translate(ResultSetTranslatorToTtpRbfOnly resultSetTranslator, ResultSet resultSet) + private ResultSet translate(ResultSetTranslatorToTtpCreateRbfOnlyDropOtherColumns resultSetTranslator, + ResultSet resultSet) { try { diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java index 0fa2a3be..3c9e9c8b 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java @@ -1,6 +1,8 @@ package org.highmed.dsf.bpe.spring.config; import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.highmed.consent.client.ConsentClient; +import org.highmed.consent.client.ConsentClientFactory; import org.highmed.dsf.bpe.message.SendMedicRequest; import org.highmed.dsf.bpe.message.SendMultiMedicErrors; import org.highmed.dsf.bpe.message.SendMultiMedicResults; @@ -55,6 +57,9 @@ public class FeasibilityConfig @Autowired private FhirWebserviceClientProvider fhirClientProvider; + @Autowired + private ConsentClientFactory consentClientFactory; + @Autowired private MasterPatientIndexClientFactory masterPatientIndexClientFactory; @@ -166,10 +171,16 @@ public ExecuteQueries executeQueries() organizationProvider); } + @Bean + public ConsentClient consentClient() + { + return consentClientFactory.createClient(environment::getProperty); + } + @Bean public FilterQueryResultsByConsent filterQueryResultsByConsent() { - return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper); + return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper, consentClient()); } @Bean diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java index 12681ab6..33d5d8ba 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java @@ -1,6 +1,8 @@ package org.highmed.dsf.bpe.spring.config; import org.bouncycastle.jce.provider.BouncyCastleProvider; +import org.highmed.consent.client.ConsentClient; +import org.highmed.consent.client.ConsentClientFactory; import org.highmed.dsf.bpe.service.CheckQueries; import org.highmed.dsf.bpe.service.CheckSingleMedicResults; import org.highmed.dsf.bpe.service.ExecuteQueries; @@ -33,6 +35,9 @@ public class LocalServicesConfig @Autowired private FhirWebserviceClientProvider fhirClientProvider; + @Autowired + private ConsentClientFactory consentClientFactory; + @Autowired private MasterPatientIndexClientFactory masterPatientIndexClientFactory; @@ -84,10 +89,16 @@ public ModifyQueries modifyQueries() return new ModifyQueries(fhirClientProvider, taskHelper, readAccessHelper, ehrIdColumnPath); } + @Bean + public ConsentClient consentClient() + { + return consentClientFactory.createClient(environment::getProperty); + } + @Bean public FilterQueryResultsByConsent filterQueryResultsByConsent() { - return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper); + return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper, consentClient()); } @Bean diff --git a/pom.xml b/pom.xml index 12ee5853..95973953 100644 --- a/pom.xml +++ b/pom.xml @@ -24,6 +24,7 @@ <compileTarget>11</compileTarget> <main.basedir>${project.basedir}</main.basedir> + <dsf.version>0.6.0-SNAPSHOT</dsf.version> </properties> <name>highmed-processes</name> @@ -65,12 +66,12 @@ <dependency> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-process-base</artifactId> - <version>0.5.2</version> + <version>${dsf.version}</version> </dependency> <dependency> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-fhir-validation</artifactId> - <version>0.5.2</version> + <version>${dsf.version}</version> </dependency> <dependency> @@ -133,7 +134,7 @@ <dependency> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-process-base</artifactId> - <version>0.5.2</version> + <version>${dsf.version}</version> <scope>test</scope> <type>test-jar</type> </dependency> From ebf7b96e18d10cefe005eace2b848aa888956f84 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 20 Sep 2021 18:09:24 +0200 Subject: [PATCH 059/125] renaming of classes and bpmn tasks --- ....java => CheckMedicMultiMedicResults.java} | 4 +- ...java => CheckMedicSingleMedicResults.java} | 6 +- ...CheckResultSets.java => CheckResults.java} | 6 +- ...ts.java => CheckTtpMultiMedicResults.java} | 6 +- ...s.java => CheckTtpSingleMedicResults.java} | 6 +- ...ets.java => DecryptMultiMedicResults.java} | 6 +- ...ts.java => DownloadMultiMedicResults.java} | 4 +- ...adResultSets.java => DownloadResults.java} | 6 +- ...s.java => DownloadSingleMedicResults.java} | 4 +- ...tQueryResults.java => EncryptResults.java} | 6 +- .../bpe/service/FilterResultsByConsent.java | 6 +- ...ava => PseudonymizeResultsFirstOrder.java} | 6 +- ...va => PseudonymizeResultsSecondOrder.java} | 6 +- ...eResultsSecondOrderWithRecordLinkage.java} | 4 +- ...sultsSecondOrderWithoutRecordLinkage.java} | 4 +- ...toreMultiMedicResultsForLeadingMedic.java} | 4 +- ... StoreMultiMedicResultsForResearcher.java} | 4 +- ...StoreResultSets.java => StoreResults.java} | 6 +- ....java => StoreSingleMedicResultLinks.java} | 4 +- ...Sets.java => StoreSingleMedicResults.java} | 4 +- .../bpe/spring/config/DataSharingConfig.java | 105 +++++++++--------- .../resources/bpe/computeDataSharing.bpmn | 50 ++++----- .../resources/bpe/executeDataSharing.bpmn | 46 ++++---- .../resources/bpe/requestDataSharing.bpmn | 26 ++--- ...adResultSets.java => DownloadResults.java} | 6 +- .../bpe/service/FilterResultsByConsent.java | 6 +- .../bpe/spring/config/FeasibilityConfig.java | 12 +- .../resources/bpe/computeFeasibility.bpmn | 14 +-- .../resources/bpe/executeFeasibility.bpmn | 8 +- .../resources/bpe/requestFeasibility.bpmn | 10 +- .../{StoreResult.java => StoreResults.java} | 6 +- .../spring/config/LocalServicesConfig.java | 12 +- .../bpe/localServicesIntegration.bpmn | 4 +- 33 files changed, 203 insertions(+), 204 deletions(-) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{CheckMedicMultiMedicResultSets.java => CheckMedicMultiMedicResults.java} (80%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{CheckMedicSingleMedicResultSets.java => CheckMedicSingleMedicResults.java} (92%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{CheckResultSets.java => CheckResults.java} (95%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{CheckTtpMultiMedicResultSets.java => CheckTtpMultiMedicResults.java} (92%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{CheckTtpSingleMedicResultSets.java => CheckTtpSingleMedicResults.java} (92%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{TranslateMultiMedicResultSets.java => DecryptMultiMedicResults.java} (91%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{DownloadMultiMedicResultSets.java => DownloadMultiMedicResults.java} (91%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{DownloadResultSets.java => DownloadResults.java} (94%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{DownloadSingleMedicResultSets.java => DownloadSingleMedicResults.java} (83%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{EncryptQueryResults.java => EncryptResults.java} (96%) rename dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java => dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java (90%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{PseudonymizeQueryResultsFirstOrder.java => PseudonymizeResultsFirstOrder.java} (90%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{PseudonymizeQueryResultsSecondOrder.java => PseudonymizeResultsSecondOrder.java} (96%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{PseudonymizeQueryResultsSecondOrderWithRecordLinkage.java => PseudonymizeResultsSecondOrderWithRecordLinkage.java} (81%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage.java => PseudonymizeResultsSecondOrderWithoutRecordLinkage.java} (80%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{StoreMultiMedicResultSetsForLeadingMedic.java => StoreMultiMedicResultsForLeadingMedic.java} (79%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{StoreMultiMedicResultSetsForResearcher.java => StoreMultiMedicResultsForResearcher.java} (92%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{StoreResultSets.java => StoreResults.java} (95%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{StoreSingleMedicResultSetLinks.java => StoreSingleMedicResultLinks.java} (93%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{StoreSingleMedicResultSets.java => StoreSingleMedicResults.java} (81%) rename dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/{DownloadResultSets.java => DownloadResults.java} (94%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java => dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java (90%) rename dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/{StoreResult.java => StoreResults.java} (93%) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResults.java similarity index 80% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResultSets.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResults.java index 7b64d7a1..9cc4628f 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResults.java @@ -9,9 +9,9 @@ import org.highmed.dsf.fhir.task.TaskHelper; import org.hl7.fhir.r4.model.Task; -public class CheckMedicMultiMedicResultSets extends CheckResultSets +public class CheckMedicMultiMedicResults extends CheckResults { - public CheckMedicMultiMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public CheckMedicMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicSingleMedicResults.java similarity index 92% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicSingleMedicResultSets.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicSingleMedicResults.java index 9fca5690..264c343e 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicSingleMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicSingleMedicResults.java @@ -19,11 +19,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class CheckMedicSingleMedicResultSets extends CheckResultSets +public class CheckMedicSingleMedicResults extends CheckResults { - private static final Logger logger = LoggerFactory.getLogger(CheckMedicSingleMedicResultSets.class); + private static final Logger logger = LoggerFactory.getLogger(CheckMedicSingleMedicResults.class); - public CheckMedicSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public CheckMedicSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResults.java similarity index 95% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResults.java index d85e27f8..2802f7fd 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResults.java @@ -21,11 +21,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public abstract class CheckResultSets extends AbstractServiceDelegate +public abstract class CheckResults extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(CheckResultSets.class); + private static final Logger logger = LoggerFactory.getLogger(CheckResults.class); - public CheckResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public CheckResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResults.java similarity index 92% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResults.java index a85dec8a..ca96df67 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResults.java @@ -19,11 +19,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class CheckTtpMultiMedicResultSets extends CheckResultSets +public class CheckTtpMultiMedicResults extends CheckResults { - private static final Logger logger = LoggerFactory.getLogger(CheckTtpMultiMedicResultSets.class); + private static final Logger logger = LoggerFactory.getLogger(CheckTtpMultiMedicResults.class); - public CheckTtpMultiMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public CheckTtpMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResults.java similarity index 92% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResultSets.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResults.java index cd05725a..69d306de 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResults.java @@ -19,11 +19,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class CheckTtpSingleMedicResultSets extends CheckResultSets +public class CheckTtpSingleMedicResults extends CheckResults { - private static final Logger logger = LoggerFactory.getLogger(CheckTtpSingleMedicResultSets.class); + private static final Logger logger = LoggerFactory.getLogger(CheckTtpSingleMedicResults.class); - public CheckTtpSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public CheckTtpSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java similarity index 91% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java index 965ba102..0174ada9 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/TranslateMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java @@ -28,13 +28,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class TranslateMultiMedicResultSets extends AbstractServiceDelegate implements InitializingBean +public class DecryptMultiMedicResults extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(TranslateMultiMedicResultSets.class); + private static final Logger logger = LoggerFactory.getLogger(DecryptMultiMedicResults.class); private final ObjectMapper openEhrObjectMapper; - public TranslateMultiMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public DecryptMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResults.java similarity index 91% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResults.java index 755e68c0..d3038200 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResults.java @@ -17,9 +17,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class DownloadMultiMedicResultSets extends DownloadResultSets +public class DownloadMultiMedicResults extends DownloadResults { - public DownloadMultiMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public DownloadMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper, readAccessHelper, openEhrObjectMapper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResults.java similarity index 94% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResults.java index ac11df27..1ca30eb0 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResults.java @@ -27,13 +27,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public abstract class DownloadResultSets extends AbstractServiceDelegate +public abstract class DownloadResults extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(DownloadResultSets.class); + private static final Logger logger = LoggerFactory.getLogger(DownloadResults.class); private final ObjectMapper openEhrObjectMapper; - public DownloadResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public DownloadResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResults.java similarity index 83% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResultSets.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResults.java index b9a1d29b..ef0169ed 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResults.java @@ -13,9 +13,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class DownloadSingleMedicResultSets extends DownloadResultSets +public class DownloadSingleMedicResults extends DownloadResults { - public DownloadSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public DownloadSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper, readAccessHelper, openEhrObjectMapper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptQueryResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java similarity index 96% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptQueryResults.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java index 645ba784..395977fa 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptQueryResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java @@ -31,15 +31,15 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; -public class EncryptQueryResults extends AbstractServiceDelegate implements InitializingBean +public class EncryptResults extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(EncryptQueryResults.class); + private static final Logger logger = LoggerFactory.getLogger(EncryptResults.class); private final OrganizationProvider organizationProvider; private final KeyProvider keyProvider; private final String ehrIdColumnPath; - public EncryptQueryResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public EncryptResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, KeyProvider keyProvider, String ehrIdColumnPath) { diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java similarity index 90% rename from dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java index 833f9ed4..91fe34e8 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java @@ -20,13 +20,13 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; -public class FilterQueryResultsByConsent extends AbstractServiceDelegate implements InitializingBean +public class FilterResultsByConsent extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(FilterQueryResultsByConsent.class); + private static final Logger logger = LoggerFactory.getLogger(FilterResultsByConsent.class); private final ConsentClient consentClient; - public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public FilterResultsByConsent(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, ConsentClient consentClient) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsFirstOrder.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsFirstOrder.java similarity index 90% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsFirstOrder.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsFirstOrder.java index d01c4e13..b0d6f9f8 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsFirstOrder.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsFirstOrder.java @@ -20,13 +20,13 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; -public class PseudonymizeQueryResultsFirstOrder extends AbstractServiceDelegate implements InitializingBean +public class PseudonymizeResultsFirstOrder extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(PseudonymizeQueryResultsFirstOrder.class); + private static final Logger logger = LoggerFactory.getLogger(PseudonymizeResultsFirstOrder.class); private final PseudonymizationClient pseudonymizationClient; - public PseudonymizeQueryResultsFirstOrder(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public PseudonymizeResultsFirstOrder(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, PseudonymizationClient pseudonymizationClient) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrder.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrder.java similarity index 96% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrder.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrder.java index 9efc610d..b75811b7 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrder.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrder.java @@ -45,14 +45,14 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public abstract class PseudonymizeQueryResultsSecondOrder extends AbstractServiceDelegate implements InitializingBean +public abstract class PseudonymizeResultsSecondOrder extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(PseudonymizeQueryResultsSecondOrder.class); + private static final Logger logger = LoggerFactory.getLogger(PseudonymizeResultsSecondOrder.class); private final KeyConsumer keyConsumer; private final ObjectMapper psnObjectMapper; - public PseudonymizeQueryResultsSecondOrder(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public PseudonymizeResultsSecondOrder(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, KeyConsumer keyConsumer, ObjectMapper psnObjectMapper) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrderWithRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrderWithRecordLinkage.java similarity index 81% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrderWithRecordLinkage.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrderWithRecordLinkage.java index 9a1e6d72..6b365a37 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrderWithRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrderWithRecordLinkage.java @@ -10,10 +10,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class PseudonymizeQueryResultsSecondOrderWithRecordLinkage extends PseudonymizeQueryResultsSecondOrder +public class PseudonymizeResultsSecondOrderWithRecordLinkage extends PseudonymizeResultsSecondOrder implements InitializingBean { - public PseudonymizeQueryResultsSecondOrderWithRecordLinkage(FhirWebserviceClientProvider clientProvider, + public PseudonymizeResultsSecondOrderWithRecordLinkage(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, KeyConsumer keyConsumer, ObjectMapper psnObjectMapper) { diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrderWithoutRecordLinkage.java similarity index 80% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrderWithoutRecordLinkage.java index eb2bfa47..2ab23d2d 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrderWithoutRecordLinkage.java @@ -10,10 +10,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage extends PseudonymizeQueryResultsSecondOrder +public class PseudonymizeResultsSecondOrderWithoutRecordLinkage extends PseudonymizeResultsSecondOrder implements InitializingBean { - public PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage(FhirWebserviceClientProvider clientProvider, + public PseudonymizeResultsSecondOrderWithoutRecordLinkage(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, KeyConsumer keyConsumer, ObjectMapper psnObjectMapper) { diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForLeadingMedic.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultsForLeadingMedic.java similarity index 79% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForLeadingMedic.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultsForLeadingMedic.java index 0bcdf0a6..bbf3edf6 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForLeadingMedic.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultsForLeadingMedic.java @@ -9,9 +9,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class StoreMultiMedicResultSetsForLeadingMedic extends StoreResultSets +public class StoreMultiMedicResultsForLeadingMedic extends StoreResults { - public StoreMultiMedicResultSetsForLeadingMedic(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public StoreMultiMedicResultsForLeadingMedic(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper, readAccessHelper, openEhrObjectMapper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForResearcher.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultsForResearcher.java similarity index 92% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForResearcher.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultsForResearcher.java index 81760dd6..dc36d60b 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultSetsForResearcher.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreMultiMedicResultsForResearcher.java @@ -18,9 +18,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class StoreMultiMedicResultSetsForResearcher extends StoreResultSets +public class StoreMultiMedicResultsForResearcher extends StoreResults { - public StoreMultiMedicResultSetsForResearcher(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public StoreMultiMedicResultsForResearcher(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper, readAccessHelper, openEhrObjectMapper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java similarity index 95% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java index c08d59b5..34158176 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java @@ -30,13 +30,13 @@ import ca.uhn.fhir.context.FhirContext; -public abstract class StoreResultSets extends AbstractServiceDelegate implements InitializingBean +public abstract class StoreResults extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(StoreResultSets.class); + private static final Logger logger = LoggerFactory.getLogger(StoreResults.class); private final ObjectMapper openEhrObjectMapper; - public StoreResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public StoreResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSetLinks.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultLinks.java similarity index 93% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSetLinks.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultLinks.java index 33623560..ba8e7d09 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSetLinks.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultLinks.java @@ -21,9 +21,9 @@ import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; -public class StoreSingleMedicResultSetLinks extends AbstractServiceDelegate +public class StoreSingleMedicResultLinks extends AbstractServiceDelegate { - public StoreSingleMedicResultSetLinks(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public StoreSingleMedicResultLinks(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResults.java similarity index 81% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSets.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResults.java index 5c1b5cca..c0123cb3 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultSets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResults.java @@ -9,9 +9,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class StoreSingleMedicResultSets extends StoreResultSets +public class StoreSingleMedicResults extends StoreResults { - public StoreSingleMedicResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public StoreSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper, readAccessHelper, openEhrObjectMapper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index 86c8f68b..45717d13 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -15,33 +15,33 @@ import org.highmed.dsf.bpe.message.SendSingleMedicResults; import org.highmed.dsf.bpe.message.SendTtpRequest; import org.highmed.dsf.bpe.service.CheckDataSharingResources; -import org.highmed.dsf.bpe.service.CheckMedicMultiMedicResultSets; -import org.highmed.dsf.bpe.service.CheckMedicSingleMedicResultSets; -import org.highmed.dsf.bpe.service.CheckTtpMultiMedicResultSets; -import org.highmed.dsf.bpe.service.CheckTtpSingleMedicResultSets; +import org.highmed.dsf.bpe.service.CheckMedicMultiMedicResults; +import org.highmed.dsf.bpe.service.CheckMedicSingleMedicResults; +import org.highmed.dsf.bpe.service.CheckTtpMultiMedicResults; +import org.highmed.dsf.bpe.service.CheckTtpSingleMedicResults; +import org.highmed.dsf.bpe.service.DecryptMultiMedicResults; import org.highmed.dsf.bpe.service.DownloadDataSharingResources; -import org.highmed.dsf.bpe.service.DownloadMultiMedicResultSets; +import org.highmed.dsf.bpe.service.DownloadMultiMedicResults; import org.highmed.dsf.bpe.service.DownloadResearchStudyResource; -import org.highmed.dsf.bpe.service.DownloadSingleMedicResultSets; -import org.highmed.dsf.bpe.service.EncryptQueryResults; +import org.highmed.dsf.bpe.service.DownloadSingleMedicResults; +import org.highmed.dsf.bpe.service.EncryptResults; import org.highmed.dsf.bpe.service.ExecuteQueries; import org.highmed.dsf.bpe.service.ExtractQueries; -import org.highmed.dsf.bpe.service.FilterQueryResultsByConsent; +import org.highmed.dsf.bpe.service.FilterResultsByConsent; import org.highmed.dsf.bpe.service.GenerateBloomFilters; import org.highmed.dsf.bpe.service.HandleErrorMultiMedicResults; import org.highmed.dsf.bpe.service.ModifyQueries; -import org.highmed.dsf.bpe.service.PseudonymizeQueryResultsFirstOrder; -import org.highmed.dsf.bpe.service.PseudonymizeQueryResultsSecondOrderWithRecordLinkage; -import org.highmed.dsf.bpe.service.PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage; +import org.highmed.dsf.bpe.service.PseudonymizeResultsFirstOrder; +import org.highmed.dsf.bpe.service.PseudonymizeResultsSecondOrderWithRecordLinkage; +import org.highmed.dsf.bpe.service.PseudonymizeResultsSecondOrderWithoutRecordLinkage; import org.highmed.dsf.bpe.service.SelectRequestTargets; import org.highmed.dsf.bpe.service.SelectResponseTargetMedic; import org.highmed.dsf.bpe.service.SelectResponseTargetTtp; import org.highmed.dsf.bpe.service.StoreCorrelationKeys; -import org.highmed.dsf.bpe.service.StoreMultiMedicResultSetsForLeadingMedic; -import org.highmed.dsf.bpe.service.StoreMultiMedicResultSetsForResearcher; -import org.highmed.dsf.bpe.service.StoreSingleMedicResultSetLinks; -import org.highmed.dsf.bpe.service.StoreSingleMedicResultSets; -import org.highmed.dsf.bpe.service.TranslateMultiMedicResultSets; +import org.highmed.dsf.bpe.service.StoreMultiMedicResultsForLeadingMedic; +import org.highmed.dsf.bpe.service.StoreMultiMedicResultsForResearcher; +import org.highmed.dsf.bpe.service.StoreSingleMedicResultLinks; +import org.highmed.dsf.bpe.service.StoreSingleMedicResults; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.group.GroupHelper; @@ -126,7 +126,7 @@ public class DataSharingConfig // @Bean - public DownloadResearchStudyResource downloadResearchStudyResourceDS() + public DownloadResearchStudyResource downloadResearchStudyResource() { return new DownloadResearchStudyResource(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider); @@ -153,35 +153,34 @@ public SendMedicRequest sendMedicRequest() } @Bean - public DownloadMultiMedicResultSets downloadMultiMedicResultSets() + public DownloadMultiMedicResults downloadMultiMedicResults() { - return new DownloadMultiMedicResultSets(fhirClientProvider, taskHelper, readAccessHelper, objectMapper); + return new DownloadMultiMedicResults(fhirClientProvider, taskHelper, readAccessHelper, objectMapper); } @Bean - public TranslateMultiMedicResultSets translateMultiMedicResultSets() + public DecryptMultiMedicResults decryptMultiMedicResults() { - return new TranslateMultiMedicResultSets(fhirClientProvider, taskHelper, readAccessHelper, objectMapper); + return new DecryptMultiMedicResults(fhirClientProvider, taskHelper, readAccessHelper, objectMapper); } @Bean - public CheckMedicMultiMedicResultSets checkMedicMultiMedicResultSets() + public CheckMedicMultiMedicResults checkMedicMultiMedicResults() { - return new CheckMedicMultiMedicResultSets(fhirClientProvider, taskHelper, readAccessHelper); + return new CheckMedicMultiMedicResults(fhirClientProvider, taskHelper, readAccessHelper); } @Bean - public StoreMultiMedicResultSetsForLeadingMedic storeMultiMedicResultSetsForLeadingMedic() + public StoreMultiMedicResultsForLeadingMedic storeMultiMedicResultsForLeadingMedic() { - return new StoreMultiMedicResultSetsForLeadingMedic(fhirClientProvider, taskHelper, readAccessHelper, + return new StoreMultiMedicResultsForLeadingMedic(fhirClientProvider, taskHelper, readAccessHelper, objectMapper); } @Bean - public StoreMultiMedicResultSetsForResearcher storeMultiMedicResultSetsForResearcher() + public StoreMultiMedicResultsForResearcher storeMultiMedicResultsForResearcher() { - return new StoreMultiMedicResultSetsForResearcher(fhirClientProvider, taskHelper, readAccessHelper, - objectMapper); + return new StoreMultiMedicResultsForResearcher(fhirClientProvider, taskHelper, readAccessHelper, objectMapper); } @Bean @@ -201,21 +200,21 @@ public StoreCorrelationKeys storeCorrelationKeys() } @Bean - public StoreSingleMedicResultSetLinks storeSingleMedicResultSetLinks() + public StoreSingleMedicResultLinks storeSingleMedicResultLinks() { - return new StoreSingleMedicResultSetLinks(fhirClientProvider, taskHelper, readAccessHelper); + return new StoreSingleMedicResultLinks(fhirClientProvider, taskHelper, readAccessHelper); } @Bean - public DownloadSingleMedicResultSets downloadSingleMedicResultSets() + public DownloadSingleMedicResults downloadSingleMedicResults() { - return new DownloadSingleMedicResultSets(fhirClientProvider, taskHelper, readAccessHelper, objectMapper); + return new DownloadSingleMedicResults(fhirClientProvider, taskHelper, readAccessHelper, objectMapper); } @Bean - public CheckTtpSingleMedicResultSets checkTtpSingleMedicResultSets() + public CheckTtpSingleMedicResults checkTtpSingleMedicResults() { - return new CheckTtpSingleMedicResultSets(fhirClientProvider, taskHelper, readAccessHelper); + return new CheckTtpSingleMedicResults(fhirClientProvider, taskHelper, readAccessHelper); } @Bean @@ -226,17 +225,17 @@ public KeyConsumer keyConsumer() } @Bean - public PseudonymizeQueryResultsSecondOrderWithRecordLinkage pseudonymizeQueryResultsSecondOrderWithRecordLinkage() + public PseudonymizeResultsSecondOrderWithRecordLinkage pseudonymizeQueryResultsSecondOrderWithRecordLinkage() { - return new PseudonymizeQueryResultsSecondOrderWithRecordLinkage(fhirClientProvider, taskHelper, - readAccessHelper, keyConsumer(), objectMapper); + return new PseudonymizeResultsSecondOrderWithRecordLinkage(fhirClientProvider, taskHelper, readAccessHelper, + keyConsumer(), objectMapper); } @Bean - public PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage pseudonymizeQueryResultsSecondOrderWithoutRecordLinkage() + public PseudonymizeResultsSecondOrderWithoutRecordLinkage pseudonymizeQueryResultsSecondOrderWithoutRecordLinkage() { - return new PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage(fhirClientProvider, taskHelper, - readAccessHelper, keyConsumer(), objectMapper); + return new PseudonymizeResultsSecondOrderWithoutRecordLinkage(fhirClientProvider, taskHelper, readAccessHelper, + keyConsumer(), objectMapper); } @Bean @@ -246,9 +245,9 @@ public SelectResponseTargetMedic selectResponseTargetMedic() } @Bean - public CheckTtpMultiMedicResultSets checkTtpMultiMedicResultSets() + public CheckTtpMultiMedicResults checkTtpMultiMedicResults() { - return new CheckTtpMultiMedicResultSets(fhirClientProvider, taskHelper, readAccessHelper); + return new CheckTtpMultiMedicResults(fhirClientProvider, taskHelper, readAccessHelper); } @Bean @@ -313,9 +312,9 @@ public ConsentClient consentClient() } @Bean - public FilterQueryResultsByConsent filterQueryResultsByConsent() + public FilterResultsByConsent filterResultsByConsent() { - return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper, consentClient()); + return new FilterResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper, consentClient()); } @Bean @@ -344,9 +343,9 @@ public PseudonymizationClient pseudonymizationClient() } @Bean - public PseudonymizeQueryResultsFirstOrder pseudonymizeQueryResultsFirstOrder() + public PseudonymizeResultsFirstOrder pseudonymizeResultsFirstOrder() { - return new PseudonymizeQueryResultsFirstOrder(fhirClientProvider, taskHelper, readAccessHelper, + return new PseudonymizeResultsFirstOrder(fhirClientProvider, taskHelper, readAccessHelper, pseudonymizationClient()); } @@ -358,10 +357,10 @@ public KeyProvider keyProvider() } @Bean - public EncryptQueryResults encryptQueryResults() + public EncryptResults encryptResults() { - return new EncryptQueryResults(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider, - keyProvider(), ehrIdColumnPath); + return new EncryptResults(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider, keyProvider(), + ehrIdColumnPath); } @Bean @@ -371,15 +370,15 @@ public SelectResponseTargetTtp selectResponseTargetTtp() } @Bean - public CheckMedicSingleMedicResultSets checkMedicSingleMedicResultSets() + public CheckMedicSingleMedicResults checkMedicSingleMedicResults() { - return new CheckMedicSingleMedicResultSets(fhirClientProvider, taskHelper, readAccessHelper); + return new CheckMedicSingleMedicResults(fhirClientProvider, taskHelper, readAccessHelper); } @Bean - public StoreSingleMedicResultSets storeSingleMedicResultSets() + public StoreSingleMedicResults storeSingleMedicResults() { - return new StoreSingleMedicResultSets(fhirClientProvider, taskHelper, readAccessHelper, objectMapper); + return new StoreSingleMedicResults(fhirClientProvider, taskHelper, readAccessHelper, objectMapper); } @Bean diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn index 3e7c7704..529dcf4f 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn @@ -8,7 +8,7 @@ <bpmn:endEvent id="SubEndEvent"> <bpmn:incoming>SequenceFlow_0mj024w</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="storeResultSetLinks" name="store result set links" camunda:class="org.highmed.dsf.bpe.service.StoreSingleMedicResultSetLinks"> + <bpmn:serviceTask id="storeResultLinks" name="store result links" camunda:class="org.highmed.dsf.bpe.service.StoreSingleMedicResultLinks"> <bpmn:incoming>SequenceFlow_0by0at7</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mj024w</bpmn:outgoing> </bpmn:serviceTask> @@ -25,8 +25,8 @@ <bpmn:outgoing>SequenceFlow_0qjt33w</bpmn:outgoing> </bpmn:startEvent> <bpmn:sequenceFlow id="SequenceFlow_0qjt33w" sourceRef="SubStartEvent" targetRef="receiveResults" /> - <bpmn:sequenceFlow id="SequenceFlow_0by0at7" sourceRef="receiveResults" targetRef="storeResultSetLinks" /> - <bpmn:sequenceFlow id="SequenceFlow_0mj024w" sourceRef="storeResultSetLinks" targetRef="SubEndEvent" /> + <bpmn:sequenceFlow id="SequenceFlow_0by0at7" sourceRef="receiveResults" targetRef="storeResultLinks" /> + <bpmn:sequenceFlow id="SequenceFlow_0mj024w" sourceRef="storeResultLinks" targetRef="SubEndEvent" /> </bpmn:subProcess> <bpmn:boundaryEvent id="TimerEnded" attachedToRef="SubProcess_1gopxt4"> <bpmn:outgoing>SequenceFlow_0h3to47</bpmn:outgoing> @@ -61,11 +61,11 @@ <bpmn:sequenceFlow id="SequenceFlow_0t4lx4v" name="else" sourceRef="ExclusiveGateway_07e71aa" targetRef="pseudonymizeResultSetWithoutRecordLinkage"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:serviceTask id="pseudonymizeResultSetWithRecordLinkage" name="pseudonymize result sets with record linkage" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeQueryResultsSecondOrderWithRecordLinkage"> + <bpmn:serviceTask id="pseudonymizeResultsWithRecordLinkage" name="pseudonymize results with record linkage" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeResultsSecondOrderWithRecordLinkage"> <bpmn:incoming>SequenceFlow_0calilw</bpmn:incoming> <bpmn:outgoing>SequenceFlow_02zmrer</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_02zmrer" sourceRef="pseudonymizeResultSetWithRecordLinkage" targetRef="ExclusiveGateway_1r8ow3i" /> + <bpmn:sequenceFlow id="SequenceFlow_02zmrer" sourceRef="pseudonymizeResultsWithRecordLinkage" targetRef="ExclusiveGateway_1r8ow3i" /> <bpmn:exclusiveGateway id="ExclusiveGateway_1r8ow3i"> <bpmn:incoming>SequenceFlow_02zmrer</bpmn:incoming> <bpmn:incoming>Flow_115yfgb</bpmn:incoming> @@ -91,16 +91,16 @@ <bpmn:incoming>Flow_0rwc0yo</bpmn:incoming> <bpmn:messageEventDefinition id="MessageEventDefinition_19y5diw" messageRef="Message_0kix95m" camunda:class="org.highmed.dsf.bpe.message.SendMultiMedicErrors" /> </bpmn:endEvent> - <bpmn:serviceTask id="checkPseudonymizedResultSets" name="check pseudonymized result sets" camunda:class="org.highmed.dsf.bpe.service.CheckTtpMultiMedicResultSets"> + <bpmn:serviceTask id="checkPseudonymizedResults" name="check pseudonymized results" camunda:class="org.highmed.dsf.bpe.service.CheckTtpMultiMedicResults"> <bpmn:incoming>Flow_1wig1wj</bpmn:incoming> <bpmn:outgoing>Flow_0mogdyo</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:boundaryEvent id="errorPseudonymization" attachedToRef="checkPseudonymizedResultSets"> + <bpmn:boundaryEvent id="errorPseudonymization" attachedToRef="checkPseudonymizedResults"> <bpmn:outgoing>Flow_1tmnvhl</bpmn:outgoing> <bpmn:errorEventDefinition id="ErrorEventDefinition_05kx06m" errorRef="Error_0qub4jc" /> </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_1tmnvhl" sourceRef="errorPseudonymization" targetRef="EndEventError" /> - <bpmn:sequenceFlow id="SequenceFlow_0calilw" name="needs record linkage" sourceRef="ExclusiveGateway_07e71aa" targetRef="pseudonymizeResultSetWithRecordLinkage"> + <bpmn:sequenceFlow id="SequenceFlow_0calilw" name="needs record linkage" sourceRef="ExclusiveGateway_07e71aa" targetRef="pseudonymizeResultsWithRecordLinkage"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:exclusiveGateway id="Gateway_0h2eszv"> @@ -108,31 +108,31 @@ <bpmn:incoming>SequenceFlow_0h3to47</bpmn:incoming> <bpmn:outgoing>Flow_0b5n9vc</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="Flow_0b5n9vc" sourceRef="Gateway_0h2eszv" targetRef="downloadResultSets" /> - <bpmn:sequenceFlow id="Flow_0gx8n5k" sourceRef="downloadResultSets" targetRef="checkReceivedResultSets" /> - <bpmn:serviceTask id="downloadResultSets" name="download result sets" camunda:class="org.highmed.dsf.bpe.service.DownloadSingleMedicResultSets"> + <bpmn:sequenceFlow id="Flow_0b5n9vc" sourceRef="Gateway_0h2eszv" targetRef="downloadResults" /> + <bpmn:sequenceFlow id="Flow_0gx8n5k" sourceRef="downloadResults" targetRef="checkReceivedResults" /> + <bpmn:serviceTask id="downloadResults" name="download results" camunda:class="org.highmed.dsf.bpe.service.DownloadSingleMedicResults"> <bpmn:incoming>Flow_0b5n9vc</bpmn:incoming> <bpmn:outgoing>Flow_0gx8n5k</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="storeResultSets" name="store result sets" camunda:class="org.highmed.dsf.bpe.service.StoreMultiMedicResultSetsForLeadingMedic"> + <bpmn:serviceTask id="storeResults" name="store results" camunda:class="org.highmed.dsf.bpe.service.StoreMultiMedicResultsForLeadingMedic"> <bpmn:incoming>Flow_0mogdyo</bpmn:incoming> <bpmn:outgoing>Flow_0uaqn1r</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_0mogdyo" sourceRef="checkPseudonymizedResultSets" targetRef="storeResultSets" /> + <bpmn:sequenceFlow id="Flow_0mogdyo" sourceRef="checkPseudonymizedResults" targetRef="storeResults" /> <bpmn:sequenceFlow id="Flow_1qqffoq" sourceRef="ExclusiveGateway_1r8ow3i" targetRef="selectResponseTargetMedic" /> - <bpmn:sequenceFlow id="Flow_1wig1wj" sourceRef="selectResponseTargetMedic" targetRef="checkPseudonymizedResultSets" /> - <bpmn:sequenceFlow id="Flow_0uaqn1r" sourceRef="storeResultSets" targetRef="EndEventSuccess" /> + <bpmn:sequenceFlow id="Flow_1wig1wj" sourceRef="selectResponseTargetMedic" targetRef="checkPseudonymizedResults" /> + <bpmn:sequenceFlow id="Flow_0uaqn1r" sourceRef="storeResults" targetRef="EndEventSuccess" /> <bpmn:sequenceFlow id="Flow_115yfgb" sourceRef="pseudonymizeResultSetWithoutRecordLinkage" targetRef="ExclusiveGateway_1r8ow3i" /> - <bpmn:serviceTask id="pseudonymizeResultSetWithoutRecordLinkage" name="pseudonymize result sets" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeQueryResultsSecondOrderWithoutRecordLinkage"> + <bpmn:serviceTask id="pseudonymizeResultSetWithoutRecordLinkage" name="pseudonymize results without record linkage" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeResultsSecondOrderWithoutRecordLinkage"> <bpmn:incoming>SequenceFlow_0t4lx4v</bpmn:incoming> <bpmn:outgoing>Flow_115yfgb</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_0g86uan" sourceRef="checkReceivedResultSets" targetRef="ExclusiveGateway_07e71aa" /> - <bpmn:serviceTask id="checkReceivedResultSets" name="check received result sets" camunda:class="org.highmed.dsf.bpe.service.CheckTtpSingleMedicResultSets"> + <bpmn:sequenceFlow id="Flow_0g86uan" sourceRef="checkReceivedResults" targetRef="ExclusiveGateway_07e71aa" /> + <bpmn:serviceTask id="checkReceivedResults" name="check received results" camunda:class="org.highmed.dsf.bpe.service.CheckTtpSingleMedicResults"> <bpmn:incoming>Flow_0gx8n5k</bpmn:incoming> <bpmn:outgoing>Flow_0g86uan</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:boundaryEvent id="errorReceived" attachedToRef="checkReceivedResultSets"> + <bpmn:boundaryEvent id="errorReceived" attachedToRef="checkReceivedResults"> <bpmn:outgoing>Flow_0rwc0yo</bpmn:outgoing> <bpmn:errorEventDefinition id="ErrorEventDefinition_1co4qxl" errorRef="Error_1r03ghq" /> </bpmn:boundaryEvent> @@ -243,7 +243,7 @@ <bpmndi:BPMNShape id="EndEvent_01cb50v_di" bpmnElement="SubEndEvent"> <dc:Bounds x="894" y="226" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0yjis46_di" bpmnElement="storeResultSetLinks"> + <bpmndi:BPMNShape id="ServiceTask_0yjis46_di" bpmnElement="storeResultLinks"> <dc:Bounds x="746" y="204" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ReceiveTask_0533fm9_di" bpmnElement="receiveResults"> @@ -270,7 +270,7 @@ <bpmndi:BPMNShape id="ExclusiveGateway_07e71aa_di" bpmnElement="ExclusiveGateway_07e71aa" isMarkerVisible="true"> <dc:Bounds x="1485" y="217" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_093hq2s_di" bpmnElement="pseudonymizeResultSetWithRecordLinkage"> + <bpmndi:BPMNShape id="ServiceTask_093hq2s_di" bpmnElement="pseudonymizeResultsWithRecordLinkage"> <dc:Bounds x="1640" y="86" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1r8ow3i_di" bpmnElement="ExclusiveGateway_1r8ow3i" isMarkerVisible="true"> @@ -288,22 +288,22 @@ <dc:Bounds x="2299" y="445" width="63" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_13j8ce9_di" bpmnElement="checkPseudonymizedResultSets"> + <bpmndi:BPMNShape id="Activity_13j8ce9_di" bpmnElement="checkPseudonymizedResults"> <dc:Bounds x="1950" y="202" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0h2eszv_di" bpmnElement="Gateway_0h2eszv" isMarkerVisible="true"> <dc:Bounds x="1045" y="217" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1rzqqn0_di" bpmnElement="downloadResultSets"> + <bpmndi:BPMNShape id="Activity_1rzqqn0_di" bpmnElement="downloadResults"> <dc:Bounds x="1160" y="202" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0tps18n_di" bpmnElement="storeResultSets"> + <bpmndi:BPMNShape id="Activity_0tps18n_di" bpmnElement="storeResults"> <dc:Bounds x="2120" y="202" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0y1tjhz_di" bpmnElement="pseudonymizeResultSetWithoutRecordLinkage"> <dc:Bounds x="1640" y="320" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0798gut_di" bpmnElement="checkReceivedResultSets"> + <bpmndi:BPMNShape id="Activity_0798gut_di" bpmnElement="checkReceivedResults"> <dc:Bounds x="1330" y="202" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1c7452s_di" bpmnElement="errorReceived"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index d581a9ff..9ae563bf 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> <bpmn:process id="highmedorg_executeDataSharing" isExecutable="true" camunda:versionTag="0.5.0"> - <bpmn:serviceTask id="checkResultSets" name="check results sets" camunda:class="org.highmed.dsf.bpe.service.CheckMedicSingleMedicResultSets"> + <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckMedicSingleMedicResults"> <bpmn:incoming>Flow_1pzik8k</bpmn:incoming> <bpmn:outgoing>Flow_08925ay</bpmn:outgoing> </bpmn:serviceTask> @@ -39,10 +39,10 @@ <bpmn:sequenceFlow id="SequenceFlow_05r9whd" name="else" sourceRef="ExclusiveGateway_0bq7zdz" targetRef="ExclusiveGateway_0lecmy5"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsConsentCheck}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0isxkuy" name="needs consent check" sourceRef="ExclusiveGateway_0bq7zdz" targetRef="filterByConsent"> + <bpmn:sequenceFlow id="SequenceFlow_0isxkuy" name="needs consent check" sourceRef="ExclusiveGateway_0bq7zdz" targetRef="filterResultsByConsent"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsConsentCheck}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:serviceTask id="filterByConsent" name="filter query results by consent" camunda:class="org.highmed.dsf.bpe.service.FilterQueryResultsByConsent"> + <bpmn:serviceTask id="filterResultsByConsent" name="filter results by consent" camunda:class="org.highmed.dsf.bpe.service.FilterResultsByConsent"> <bpmn:incoming>SequenceFlow_0isxkuy</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0kzp6tl</bpmn:outgoing> </bpmn:serviceTask> @@ -51,8 +51,8 @@ <bpmn:incoming>SequenceFlow_0kzp6tl</bpmn:incoming> <bpmn:outgoing>Flow_14nlfvk</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_0kzp6tl" sourceRef="filterByConsent" targetRef="ExclusiveGateway_0lecmy5" /> - <bpmn:serviceTask id="translateWithEncryptionAndRbfGeneration" name="generate bloom filters" camunda:class="org.highmed.dsf.bpe.service.GenerateBloomFilters"> + <bpmn:sequenceFlow id="SequenceFlow_0kzp6tl" sourceRef="filterResultsByConsent" targetRef="ExclusiveGateway_0lecmy5" /> + <bpmn:serviceTask id="generateBloomFilters" name="generate bloom filters" camunda:class="org.highmed.dsf.bpe.service.GenerateBloomFilters"> <bpmn:incoming>Flow_0xt2bfn</bpmn:incoming> <bpmn:outgoing>Flow_1df64h2</bpmn:outgoing> </bpmn:serviceTask> @@ -89,22 +89,22 @@ <bpmn:sequenceFlow id="Flow_09dzkmp" name="else" sourceRef="Gateway_118ojzy" targetRef="Gateway_13kxug8"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="Flow_0xt2bfn" name="needs record linkage" sourceRef="Gateway_118ojzy" targetRef="translateWithEncryptionAndRbfGeneration"> + <bpmn:sequenceFlow id="Flow_0xt2bfn" name="needs record linkage" sourceRef="Gateway_118ojzy" targetRef="generateBloomFilters"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:serviceTask id="storeResultSets" name="store result sets" camunda:class="org.highmed.dsf.bpe.service.StoreSingleMedicResultSets"> + <bpmn:serviceTask id="storeResults" name="store results" camunda:class="org.highmed.dsf.bpe.service.StoreSingleMedicResults"> <bpmn:incoming>Flow_08925ay</bpmn:incoming> <bpmn:outgoing>Flow_1611vr6</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_08925ay" sourceRef="checkResultSets" targetRef="storeResultSets" /> - <bpmn:sequenceFlow id="Flow_1pgebfo" sourceRef="Gateway_13kxug8" targetRef="Activity_0ycd3ht" /> - <bpmn:sequenceFlow id="Flow_1pzik8k" sourceRef="selectResponseTargetTtp" targetRef="checkResultSets" /> - <bpmn:sequenceFlow id="Flow_1611vr6" sourceRef="storeResultSets" targetRef="EndEventSuccess" /> - <bpmn:serviceTask id="translateWithEncryptionAndWithoutRbfGeneration" name="encrypt query results" camunda:class="org.highmed.dsf.bpe.service.EncryptQueryResults"> + <bpmn:sequenceFlow id="Flow_08925ay" sourceRef="checkResults" targetRef="storeResults" /> + <bpmn:sequenceFlow id="Flow_1pgebfo" sourceRef="Gateway_13kxug8" targetRef="pseudonymizeResults" /> + <bpmn:sequenceFlow id="Flow_1pzik8k" sourceRef="selectResponseTargetTtp" targetRef="checkResults" /> + <bpmn:sequenceFlow id="Flow_1611vr6" sourceRef="storeResults" targetRef="EndEventSuccess" /> + <bpmn:serviceTask id="encryptResults" name="encrypt results" camunda:class="org.highmed.dsf.bpe.service.EncryptResults"> <bpmn:incoming>Flow_0wymq8g</bpmn:incoming> <bpmn:outgoing>Flow_0m3ah40</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:boundaryEvent id="Event_0o8usc6" attachedToRef="checkResultSets"> + <bpmn:boundaryEvent id="Event_0o8usc6" attachedToRef="checkResults"> <bpmn:outgoing>Flow_1o1ugb3</bpmn:outgoing> <bpmn:errorEventDefinition id="ErrorEventDefinition_182xhp6" errorRef="Error_0c5gjso" /> </bpmn:boundaryEvent> @@ -112,13 +112,13 @@ <bpmn:endEvent id="EndEventError" name="error occured"> <bpmn:incoming>Flow_1o1ugb3</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="Flow_1df64h2" sourceRef="translateWithEncryptionAndRbfGeneration" targetRef="Gateway_13kxug8" /> - <bpmn:sequenceFlow id="Flow_0m3ah40" sourceRef="translateWithEncryptionAndWithoutRbfGeneration" targetRef="selectResponseTargetTtp" /> - <bpmn:serviceTask id="Activity_0ycd3ht" name="pseudonymize query results" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeQueryResultsFirstOrder"> + <bpmn:sequenceFlow id="Flow_1df64h2" sourceRef="generateBloomFilters" targetRef="Gateway_13kxug8" /> + <bpmn:sequenceFlow id="Flow_0m3ah40" sourceRef="encryptResults" targetRef="selectResponseTargetTtp" /> + <bpmn:serviceTask id="pseudonymizeResults" name="pseudonymize results" camunda:class="org.highmed.dsf.bpe.service.PseudonymizeResultsFirstOrder"> <bpmn:incoming>Flow_1pgebfo</bpmn:incoming> <bpmn:outgoing>Flow_0wymq8g</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_0wymq8g" sourceRef="Activity_0ycd3ht" targetRef="translateWithEncryptionAndWithoutRbfGeneration" /> + <bpmn:sequenceFlow id="Flow_0wymq8g" sourceRef="pseudonymizeResults" targetRef="encryptResults" /> <bpmn:textAnnotation id="TextAnnotation_0euut3n"> <bpmn:text>uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc.</bpmn:text> </bpmn:textAnnotation> @@ -225,7 +225,7 @@ <di:waypoint x="980" y="212" /> <di:waypoint x="1032" y="212" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResultSets"> + <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> <dc:Bounds x="2060" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkDataSharingRequest"> @@ -249,13 +249,13 @@ <bpmndi:BPMNShape id="ExclusiveGateway_0bq7zdz_di" bpmnElement="ExclusiveGateway_0bq7zdz" isMarkerVisible="true"> <dc:Bounds x="1032" y="187" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0l3b9as_di" bpmnElement="filterByConsent"> + <bpmndi:BPMNShape id="ServiceTask_0l3b9as_di" bpmnElement="filterResultsByConsent"> <dc:Bounds x="1167" y="315" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0lecmy5_di" bpmnElement="ExclusiveGateway_0lecmy5" isMarkerVisible="true"> <dc:Bounds x="1192" y="187" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="translateWithEncryptionAndRbfGeneration"> + <bpmndi:BPMNShape id="ServiceTask_0akkess_di" bpmnElement="generateBloomFilters"> <dc:Bounds x="1440" y="320" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> @@ -279,10 +279,10 @@ <bpmndi:BPMNShape id="Gateway_13kxug8_di" bpmnElement="Gateway_13kxug8" isMarkerVisible="true"> <dc:Bounds x="1465" y="187" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1mdgvqk_di" bpmnElement="storeResultSets"> + <bpmndi:BPMNShape id="Activity_1mdgvqk_di" bpmnElement="storeResults"> <dc:Bounds x="2220" y="172" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0cu49cc_di" bpmnElement="translateWithEncryptionAndWithoutRbfGeneration"> + <bpmndi:BPMNShape id="Activity_0cu49cc_di" bpmnElement="encryptResults"> <dc:Bounds x="1730" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1lnwlbo_di" bpmnElement="EndEventError"> @@ -291,7 +291,7 @@ <dc:Bounds x="2387" y="365" width="66" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0ycd3ht_di" bpmnElement="Activity_0ycd3ht"> + <bpmndi:BPMNShape id="Activity_0ycd3ht_di" bpmnElement="pseudonymizeResults"> <dc:Bounds x="1570" y="172" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn index 7cd087bf..cf9fbeac 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn @@ -39,7 +39,7 @@ <bpmn:outgoing>Flow_1q5jnli</bpmn:outgoing> <bpmn:outgoing>Flow_1harl90</bpmn:outgoing> </bpmn:eventBasedGateway> - <bpmn:serviceTask id="checkResultSets" name="check result sets" camunda:class="org.highmed.dsf.bpe.service.CheckMedicMultiMedicResultSets"> + <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckMedicMultiMedicResults"> <bpmn:incoming>Flow_1m59ov0</bpmn:incoming> <bpmn:outgoing>Flow_0rwo9pn</bpmn:outgoing> </bpmn:serviceTask> @@ -56,10 +56,10 @@ <bpmn:incoming>Flow_0amk6ah</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="Flow_1q5jnli" sourceRef="Gateway_160gkf1" targetRef="receiveMultiMediclResultFromTtp" /> - <bpmn:sequenceFlow id="Flow_1gf3n6o" sourceRef="receiveMultiMediclResultFromTtp" targetRef="downloadResultSets" /> + <bpmn:sequenceFlow id="Flow_1gf3n6o" sourceRef="receiveMultiMediclResultFromTtp" targetRef="downloadResults" /> <bpmn:sequenceFlow id="Flow_1harl90" sourceRef="Gateway_160gkf1" targetRef="receiveErrorFromTtp" /> <bpmn:sequenceFlow id="Flow_1id9r0h" sourceRef="receiveErrorFromTtp" targetRef="handleError" /> - <bpmn:sequenceFlow id="Flow_0rwo9pn" sourceRef="checkResultSets" targetRef="storeResultSets" /> + <bpmn:sequenceFlow id="Flow_0rwo9pn" sourceRef="checkResults" targetRef="storeResults" /> <bpmn:sequenceFlow id="Flow_1s74o06" sourceRef="handleError" targetRef="Gateway_0nlbalq" /> <bpmn:sequenceFlow id="Flow_0amk6ah" sourceRef="Gateway_0nlbalq" targetRef="EndEvent" /> <bpmn:sequenceFlow id="Flow_1lw96cm" sourceRef="sendRequestToMedics" targetRef="Gateway_160gkf1" /> @@ -80,18 +80,18 @@ <bpmn:incoming>Flow_06otxko</bpmn:incoming> <bpmn:outgoing>Flow_0cx3xe1</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="downloadResultSets" name="download result sets" camunda:class="org.highmed.dsf.bpe.service.DownloadMultiMedicResultSets"> + <bpmn:serviceTask id="downloadResults" name="download results" camunda:class="org.highmed.dsf.bpe.service.DownloadMultiMedicResults"> <bpmn:incoming>Flow_1gf3n6o</bpmn:incoming> <bpmn:outgoing>Flow_025quhl</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_025quhl" sourceRef="downloadResultSets" targetRef="translateWithDecryption" /> - <bpmn:sequenceFlow id="Flow_1rnnd6d" sourceRef="storeResultSets" targetRef="Gateway_0nlbalq" /> - <bpmn:serviceTask id="storeResultSets" name="store result sets" camunda:class="org.highmed.dsf.bpe.service.StoreMultiMedicResultSetsForResearcher"> + <bpmn:sequenceFlow id="Flow_025quhl" sourceRef="downloadResults" targetRef="decryptResults" /> + <bpmn:sequenceFlow id="Flow_1rnnd6d" sourceRef="storeResults" targetRef="Gateway_0nlbalq" /> + <bpmn:serviceTask id="storeResults" name="store results" camunda:class="org.highmed.dsf.bpe.service.StoreMultiMedicResultsForResearcher"> <bpmn:incoming>Flow_0rwo9pn</bpmn:incoming> <bpmn:outgoing>Flow_1rnnd6d</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_1m59ov0" sourceRef="translateWithDecryption" targetRef="checkResultSets" /> - <bpmn:serviceTask id="translateWithDecryption" name="translate with decryption" camunda:class="org.highmed.dsf.bpe.service.TranslateMultiMedicResultSets"> + <bpmn:sequenceFlow id="Flow_1m59ov0" sourceRef="decryptResults" targetRef="checkResults" /> + <bpmn:serviceTask id="decryptResults" name="decrypt results" camunda:class="org.highmed.dsf.bpe.service.DecryptMultiMedicResults"> <bpmn:incoming>Flow_025quhl</bpmn:incoming> <bpmn:outgoing>Flow_1m59ov0</bpmn:outgoing> </bpmn:serviceTask> @@ -193,7 +193,7 @@ <bpmndi:BPMNShape id="Gateway_160gkf1_di" bpmnElement="Gateway_160gkf1"> <dc:Bounds x="915" y="202" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1sx3j2g_di" bpmnElement="checkResultSets"> + <bpmndi:BPMNShape id="Activity_1sx3j2g_di" bpmnElement="checkResults"> <dc:Bounds x="1440" y="100" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0t7mxic_di" bpmnElement="handleError"> @@ -217,13 +217,13 @@ <bpmndi:BPMNShape id="Activity_1wzn9by_di" bpmnElement="selectRequestTargetsAndGenerateKeys"> <dc:Bounds x="470" y="187" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_09oplxx_di" bpmnElement="downloadResultSets"> + <bpmndi:BPMNShape id="Activity_09oplxx_di" bpmnElement="downloadResults"> <dc:Bounds x="1120" y="100" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1a9tjil_di" bpmnElement="storeResultSets"> + <bpmndi:BPMNShape id="Activity_1a9tjil_di" bpmnElement="storeResults"> <dc:Bounds x="1590" y="100" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0lqm4kz_di" bpmnElement="translateWithDecryption"> + <bpmndi:BPMNShape id="Activity_0lqm4kz_di" bpmnElement="decryptResults"> <dc:Bounds x="1280" y="100" width="100" height="80" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResults.java similarity index 94% rename from dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java rename to dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResults.java index bcf0c8a5..41859cd4 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResultSets.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResults.java @@ -27,13 +27,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class DownloadResultSets extends AbstractServiceDelegate +public class DownloadResults extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(DownloadResultSets.class); + private static final Logger logger = LoggerFactory.getLogger(DownloadResults.class); private final ObjectMapper openEhrObjectMapper; - public DownloadResultSets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public DownloadResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java similarity index 90% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java rename to dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java index 833f9ed4..91fe34e8 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterQueryResultsByConsent.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java @@ -20,13 +20,13 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; -public class FilterQueryResultsByConsent extends AbstractServiceDelegate implements InitializingBean +public class FilterResultsByConsent extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(FilterQueryResultsByConsent.class); + private static final Logger logger = LoggerFactory.getLogger(FilterResultsByConsent.class); private final ConsentClient consentClient; - public FilterQueryResultsByConsent(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public FilterResultsByConsent(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, ConsentClient consentClient) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java index 3c9e9c8b..2deee0b0 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityConfig.java @@ -16,10 +16,10 @@ import org.highmed.dsf.bpe.service.CheckTtpComputedMultiMedicResults; import org.highmed.dsf.bpe.service.DownloadFeasibilityResources; import org.highmed.dsf.bpe.service.DownloadResearchStudyResource; -import org.highmed.dsf.bpe.service.DownloadResultSets; +import org.highmed.dsf.bpe.service.DownloadResults; import org.highmed.dsf.bpe.service.ExecuteQueries; import org.highmed.dsf.bpe.service.ExecuteRecordLink; -import org.highmed.dsf.bpe.service.FilterQueryResultsByConsent; +import org.highmed.dsf.bpe.service.FilterResultsByConsent; import org.highmed.dsf.bpe.service.GenerateBloomFilters; import org.highmed.dsf.bpe.service.GenerateCountFromIds; import org.highmed.dsf.bpe.service.HandleErrorMultiMedicResults; @@ -178,9 +178,9 @@ public ConsentClient consentClient() } @Bean - public FilterQueryResultsByConsent filterQueryResultsByConsent() + public FilterResultsByConsent filterResultsByConsent() { - return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper, consentClient()); + return new FilterResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper, consentClient()); } @Bean @@ -250,9 +250,9 @@ public StoreResults storeResults() } @Bean - public DownloadResultSets downloadResultSets() + public DownloadResults downloadResults() { - return new DownloadResultSets(fhirClientProvider, taskHelper, readAccessHelper, objectMapper); + return new DownloadResults(fhirClientProvider, taskHelper, readAccessHelper, objectMapper); } @Bean diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn index c3c82c2e..86ed47ab 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn +++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn @@ -42,7 +42,7 @@ <bpmn:outgoing>SequenceFlow_01pjftq</bpmn:outgoing> <bpmn:messageEventDefinition messageRef="Message_08676wn" /> </bpmn:startEvent> - <bpmn:endEvent id="EndEventSuccess" name="send final result to leading MeDIC"> + <bpmn:endEvent id="EndEventSuccess" name="send final results to leading MeDIC"> <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibility/0.5.0</camunda:inputParameter> @@ -66,7 +66,7 @@ <bpmn:sequenceFlow id="SequenceFlow_0t4lx4v" name="else" sourceRef="ExclusiveGateway_07e71aa" targetRef="calculateMultimedicCohortSize"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0calilw" name="needs record linkage" sourceRef="ExclusiveGateway_07e71aa" targetRef="downloadResultSets"> + <bpmn:sequenceFlow id="SequenceFlow_0calilw" name="needs record linkage" sourceRef="ExclusiveGateway_07e71aa" targetRef="downloadResults"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsRecordLinkage}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:serviceTask id="executeRecordLink" name="execute record link" camunda:class="org.highmed.dsf.bpe.service.ExecuteRecordLink"> @@ -87,8 +87,8 @@ <bpmn:incoming>Flow_1ixeke2</bpmn:incoming> <bpmn:outgoing>Flow_1k0sqwo</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_0zp76kj" sourceRef="downloadResultSets" targetRef="executeRecordLink" /> - <bpmn:serviceTask id="downloadResultSets" name="download ResultSets" camunda:class="org.highmed.dsf.bpe.service.DownloadResultSets"> + <bpmn:sequenceFlow id="SequenceFlow_0zp76kj" sourceRef="downloadResults" targetRef="executeRecordLink" /> + <bpmn:serviceTask id="downloadResults" name="download results" camunda:class="org.highmed.dsf.bpe.service.DownloadResults"> <bpmn:incoming>SequenceFlow_0calilw</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0zp76kj</bpmn:outgoing> </bpmn:serviceTask> @@ -104,7 +104,7 @@ <bpmn:incoming>Flow_1tmnvhl</bpmn:incoming> <bpmn:messageEventDefinition id="MessageEventDefinition_19y5diw" messageRef="Message_0kix95m" camunda:class="org.highmed.dsf.bpe.message.SendMultiMedicErrors" /> </bpmn:endEvent> - <bpmn:serviceTask id="checkComputedResults" name="check computed result" camunda:class="org.highmed.dsf.bpe.service.CheckTtpComputedMultiMedicResults"> + <bpmn:serviceTask id="checkComputedResults" name="check computed results" camunda:class="org.highmed.dsf.bpe.service.CheckTtpComputedMultiMedicResults"> <bpmn:incoming>Flow_1k0sqwo</bpmn:incoming> <bpmn:outgoing>Flow_1r6dq8y</bpmn:outgoing> </bpmn:serviceTask> @@ -245,7 +245,7 @@ <bpmndi:BPMNShape id="ServiceTask_0uk3eyz_di" bpmnElement="selectResponseTargetMedic"> <dc:Bounds x="1540" y="202" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_09wyp6g_di" bpmnElement="downloadResultSets"> + <bpmndi:BPMNShape id="ServiceTask_09wyp6g_di" bpmnElement="downloadResults"> <dc:Bounds x="1230" y="86" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1hmug5i_di" bpmnElement="EndEventError"> @@ -265,4 +265,4 @@ </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> \ No newline at end of file +</bpmn:definitions> diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn index f09807e9..6962e7f4 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn +++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn @@ -21,7 +21,7 @@ <bpmn:incoming>SequenceFlow_14cn0vs</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1etju4m</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:endEvent id="EndEvent" name="send result to TTP"> + <bpmn:endEvent id="EndEvent" name="send results to TTP"> <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeFeasibility/0.5.0</camunda:inputParameter> @@ -71,7 +71,7 @@ <bpmn:sequenceFlow id="SequenceFlow_0isxkuy" name="needs consent check" sourceRef="ExclusiveGateway_0bq7zdz" targetRef="filterByConsent"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsConsentCheck}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:serviceTask id="filterByConsent" name="filter by consent" camunda:class="org.highmed.dsf.bpe.service.FilterQueryResultsByConsent"> + <bpmn:serviceTask id="filterByConsent" name="filter results by consent" camunda:class="org.highmed.dsf.bpe.service.FilterResultsByConsent"> <bpmn:incoming>SequenceFlow_0isxkuy</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0kzp6tl</bpmn:outgoing> </bpmn:serviceTask> @@ -259,7 +259,7 @@ <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> <dc:Bounds x="2201" y="254" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="2186" y="297" width="67" height="27" /> + <dc:Bounds x="2184" y="297" width="72" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1pt9xhp_di" bpmnElement="checkQueries"> @@ -310,4 +310,4 @@ </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> \ No newline at end of file +</bpmn:definitions> diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn index 151c4467..98e81ce2 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn +++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn @@ -44,7 +44,7 @@ <bpmn:endEvent id="EndEvent" name="success"> <bpmn:incoming>Flow_15k4oa2</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="checkFinalResult" name="check final result" camunda:class="org.highmed.dsf.bpe.service.CheckMultiMedicResults"> + <bpmn:serviceTask id="checkFinalResults" name="check final results" camunda:class="org.highmed.dsf.bpe.service.CheckMultiMedicResults"> <bpmn:incoming>Flow_0fd2zcr</bpmn:incoming> <bpmn:outgoing>Flow_0pn3dsm</bpmn:outgoing> </bpmn:serviceTask> @@ -70,14 +70,14 @@ <bpmn:messageEventDefinition id="MessageEventDefinition_07z0ktw" messageRef="Message_1vrxfsk" /> </bpmn:intermediateCatchEvent> <bpmn:sequenceFlow id="Flow_113qgvb" sourceRef="Gateway_1elix41" targetRef="receiveFinalResultFromTTP" /> - <bpmn:sequenceFlow id="Flow_0fd2zcr" sourceRef="receiveFinalResultFromTTP" targetRef="checkFinalResult" /> + <bpmn:sequenceFlow id="Flow_0fd2zcr" sourceRef="receiveFinalResultFromTTP" targetRef="checkFinalResults" /> <bpmn:sequenceFlow id="Flow_0xgrywb" sourceRef="receiveErrorFromTTP" targetRef="handelError" /> <bpmn:exclusiveGateway id="Gateway_12ly33g"> <bpmn:incoming>Flow_0pn3dsm</bpmn:incoming> <bpmn:incoming>Flow_0rkdr4f</bpmn:incoming> <bpmn:outgoing>Flow_15k4oa2</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="Flow_0pn3dsm" sourceRef="checkFinalResult" targetRef="Gateway_12ly33g" /> + <bpmn:sequenceFlow id="Flow_0pn3dsm" sourceRef="checkFinalResults" targetRef="Gateway_12ly33g" /> <bpmn:sequenceFlow id="Flow_0rkdr4f" sourceRef="handelError" targetRef="Gateway_12ly33g" /> <bpmn:sequenceFlow id="Flow_15k4oa2" sourceRef="Gateway_12ly33g" targetRef="EndEvent" /> </bpmn:process> @@ -175,7 +175,7 @@ <dc:Bounds x="1450" y="245" width="40" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_00phx5l_di" bpmnElement="checkFinalResult"> + <bpmndi:BPMNShape id="ServiceTask_00phx5l_di" bpmnElement="checkFinalResults"> <dc:Bounds x="1190" y="100" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0g5gqtl_di" bpmnElement="handelError"> @@ -201,4 +201,4 @@ </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> \ No newline at end of file +</bpmn:definitions> diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java similarity index 93% rename from dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java rename to dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java index a76be893..18bcd30f 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResult.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java @@ -20,11 +20,11 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; -public class StoreResult extends AbstractServiceDelegate implements InitializingBean +public class StoreResults extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(StoreResult.class); + private static final Logger logger = LoggerFactory.getLogger(StoreResults.class); - public StoreResult(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public StoreResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java index 33d5d8ba..39ff4fa0 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/spring/config/LocalServicesConfig.java @@ -7,11 +7,11 @@ import org.highmed.dsf.bpe.service.CheckSingleMedicResults; import org.highmed.dsf.bpe.service.ExecuteQueries; import org.highmed.dsf.bpe.service.ExtractInputValues; -import org.highmed.dsf.bpe.service.FilterQueryResultsByConsent; +import org.highmed.dsf.bpe.service.FilterResultsByConsent; import org.highmed.dsf.bpe.service.GenerateBloomFilters; import org.highmed.dsf.bpe.service.GenerateCountFromIds; import org.highmed.dsf.bpe.service.ModifyQueries; -import org.highmed.dsf.bpe.service.StoreResult; +import org.highmed.dsf.bpe.service.StoreResults; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.group.GroupHelper; @@ -72,9 +72,9 @@ public ExtractInputValues extractInputValues() } @Bean - public StoreResult storeResult() + public StoreResults storeResults() { - return new StoreResult(fhirClientProvider, taskHelper, readAccessHelper); + return new StoreResults(fhirClientProvider, taskHelper, readAccessHelper); } @Bean @@ -96,9 +96,9 @@ public ConsentClient consentClient() } @Bean - public FilterQueryResultsByConsent filterQueryResultsByConsent() + public FilterResultsByConsent filterResultsByConsent() { - return new FilterQueryResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper, consentClient()); + return new FilterResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper, consentClient()); } @Bean diff --git a/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn b/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn index bac4e414..c4a6210c 100644 --- a/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn +++ b/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn @@ -44,7 +44,7 @@ <bpmn:sequenceFlow id="SequenceFlow_0isxkuy" name="needs consent check" sourceRef="ExclusiveGateway_0bq7zdz" targetRef="filterByConsent"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsConsentCheck == true}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:serviceTask id="filterByConsent" name="filter by consent" camunda:class="org.highmed.dsf.bpe.service.FilterQueryResultsByConsent"> + <bpmn:serviceTask id="filterByConsent" name="filter by consent" camunda:class="org.highmed.dsf.bpe.service.FilterResultsByConsent"> <bpmn:incoming>SequenceFlow_0isxkuy</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0kzp6tl</bpmn:outgoing> </bpmn:serviceTask> @@ -101,7 +101,7 @@ <bpmn:incoming>Flow_1yjkp7k</bpmn:incoming> <bpmn:outgoing>Flow_125i149</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:serviceTask id="storeResult" name="store result" camunda:class="org.highmed.dsf.bpe.service.StoreResult"> + <bpmn:serviceTask id="storeResult" name="store results" camunda:class="org.highmed.dsf.bpe.service.StoreResults"> <bpmn:incoming>SequenceFlow_04ouilq</bpmn:incoming> <bpmn:outgoing>Flow_0m4rhl9</bpmn:outgoing> </bpmn:serviceTask> From bb3ef2c991af99b00539c3ec0da351599ac3a02b Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 20 Sep 2021 19:05:04 +0200 Subject: [PATCH 060/125] change to pkcs12, improve starter --- dsf-bpe-process-data-sharing/README.md | 10 +-- .../highmed/dsf/bpe/crypto/KeyStoreIo.java | 3 - .../dsf/bpe/crypto/SecretKeyConsumerImpl.java | 4 +- .../dsf/bpe/crypto/SecretKeyProviderImpl.java | 4 +- .../bpe/spring/config/DataSharingConfig.java | 8 +- ...ringFromMedicsViaMedic1ExampleStarter.java | 75 +++++++++---------- ...lityFromMedicsViaMedic1ExampleStarter.java | 12 +-- 7 files changed, 56 insertions(+), 60 deletions(-) diff --git a/dsf-bpe-process-data-sharing/README.md b/dsf-bpe-process-data-sharing/README.md index eac2a46d..ed2e4608 100644 --- a/dsf-bpe-process-data-sharing/README.md +++ b/dsf-bpe-process-data-sharing/README.md @@ -1,14 +1,14 @@ ## Properties **MeDIC** -`keytool -genseckey -alias <organization-identifier> -keyalg aes -keysize 256 -keystore organization-key.jceks -storetype jceks` +`keytool -genseckey -alias <organization-identifier> -keyalg aes -keysize 256 -keystore organization-keystore.p12 -storetype pkcs12` where `<organization-identifier>` is the same as the property `org.highmed.dsf.bpe.fhir.organization.identifier.localValue` and the password for the key -* org.highmed.dsf.bpe.psn.organizationKey.keystore.file=conf/organization-key.jceks -* org.highmed.dsf.bpe.psn.organizationKey.keystore.password=password +* org.highmed.dsf.bpe.psn.organization.keystore=conf/organization-keystore.p12 +* org.highmed.dsf.bpe.psn.organization.keystore.password=password **TTP** Keystore will be created if none exists -* org.highmed.dsf.bpe.psn.researchStudyKeys.keystore.file=conf/research-study-keystore.jceks -* org.highmed.dsf.bpe.psn.researchStudyKeys.keystore.password=password \ No newline at end of file +* org.highmed.dsf.bpe.psn.research.study.keystore=conf/research-study-keystore.p12 +* org.highmed.dsf.bpe.psn.research.study.keystore.password=password \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java index d2be03e4..53debd02 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/KeyStoreIo.java @@ -1,8 +1,5 @@ package org.highmed.dsf.bpe.crypto; -import static java.nio.file.StandardOpenOption.APPEND; -import static java.nio.file.StandardOpenOption.CREATE; - import static org.highmed.dsf.bpe.crypto.KeyStoreHelper.JCEKS; import static org.highmed.dsf.bpe.crypto.KeyStoreHelper.PKCS12; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyConsumerImpl.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyConsumerImpl.java index 37718612..146b9f0c 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyConsumerImpl.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyConsumerImpl.java @@ -36,13 +36,13 @@ public void afterPropertiesSet() throws Exception try { - keystore = KeyStoreIo.readJceks(keystoreFile, keystorePassword); + keystore = KeyStoreIo.readPkcs12(keystoreFile, keystorePassword); } catch (FileNotFoundException | NoSuchFileException e) { logger.warn("Could not find keystore at {}, creating an empty keystore", keystoreFile); - keystore = KeyStoreHelper.createJceks(keystorePassword); + keystore = KeyStoreHelper.createPkcs12(keystorePassword); KeyStoreIo.write(keystore, keystoreFile, keystorePassword); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java index 207371c6..167629b3 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/crypto/SecretKeyProviderImpl.java @@ -44,14 +44,14 @@ public void afterPropertiesSet() throws Exception try { - keystore = KeyStoreIo.readJceks(keystoreFile, keystorePassword); + keystore = KeyStoreIo.readPkcs12(keystoreFile, keystorePassword); } catch (FileNotFoundException | NoSuchFileException e) { logger.warn("Could not find keystore at {}, creating a new keystore containing a new organization key", keystoreFile); - keystore = KeyStoreHelper.createJceks(keystorePassword); + keystore = KeyStoreHelper.createPkcs12(keystorePassword); keystore.setKeyEntry(organizationProvider.getLocalIdentifierValue(), AesGcmUtil.generateAES256Key(), keystorePassword, null); KeyStoreIo.write(keystore, keystoreFile, keystorePassword); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index 45717d13..eb617dc7 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -106,16 +106,16 @@ public class DataSharingConfig @Autowired private Environment environment; - @Value("${org.highmed.dsf.bpe.psn.organizationKey.keystore.file:psn/organization-keystore.jceks}") + @Value("${org.highmed.dsf.bpe.psn.organization.keystore:psn/organization-keystore.p12}") private String organizationKeystoreFile; - @Value("${org.highmed.dsf.bpe.psn.organizationKey.keystore.password:password}") + @Value("${org.highmed.dsf.bpe.psn.organization.keystore.password:password}") private String organizationKeystorePassword; - @Value("${org.highmed.dsf.bpe.psn.researchStudyKeys.keystore.file:psn/research-study-keystore.jceks}") + @Value("${org.highmed.dsf.bpe.psn.research.study.keystore:psn/research-study-keystore.p12}") private String researchStudyKeystoreFile; - @Value("${org.highmed.dsf.bpe.psn.researchStudyKeys.keystore.password:password}") + @Value("${org.highmed.dsf.bpe.psn.research.study.keystore.password:password}") private String getResearchStudyKeystorePassword; @Value("${org.highmed.dsf.bpe.openehr.subject_external_id.path:/ehr_status/subject/external_ref/id/value}") diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java index d56670bc..017c0cc4 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -13,8 +13,6 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_REQUEST_FORM_REFERENCE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; -import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_TTP; import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_QUERY; import static org.highmed.dsf.bpe.ConstantsDataSharing.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_AND_VERSION; @@ -25,9 +23,11 @@ import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; +import java.util.Arrays; import java.util.Date; import java.util.UUID; +import org.highmed.dsf.bpe.ConstantsBase; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelperImpl; import org.hl7.fhir.r4.model.BooleanType; @@ -48,19 +48,24 @@ public abstract class AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter { - private final boolean NEEDS_CONSENT_CHECK = true; - private final boolean NEEDS_RECORD_LINKAGE = true; + private final boolean needsConsentCheck = false; + private final boolean needsRecordLinkage = false; - private static String REQUEST_FORM_REFERENCE = "https://foo/fhir/Binary/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; - private static String CONTRACT_REFERENCE = "https://foo/fhir/Binary/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; - private static String FEASIBILITY_REFERENCE = "https://foo/fhir/Task/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; + private final String requestFormReference = "https://foo/fhir/Binary/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; + private final String contractReference = "https://foo/fhir/Binary/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; + private final String feasibilityReference = "https://foo/fhir/Task/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; - private final String QUERY = "SELECT e/ehr_status/subject/external_ref/id/value as EHRID, " + private final String query = "SELECT e/ehr_status/subject/external_ref/id/value as EHRID, " + "v/items[at0024,'Bezeichnung']/value, v/items [at0001,'Messwert'], " + "v/items[at0006,'Dokumentationsdatum Untersuchung']/value FROM EHR e CONTAINS COMPOSITION c " + "CONTAINS CLUSTER v[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1] " + "WHERE v/items[at0024,'Bezeichnung']/value/value = 'Natrium' OFFSET 0 LIMIT 15;"; + private final String[] medicIdentifier = new String[] { NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1, + NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2, + NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3 }; + private final String ttpIdentifier = NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; + private final ReadAccessHelper readAccessHelper = new ReadAccessHelperImpl(); protected void main(String[] args, String baseUrl) throws Exception @@ -102,10 +107,11 @@ private Group createGroup(String name) group.setActual(false); group.setActive(true); group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY) - .setValue(new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression(QUERY)); + .setValue(new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression(query)); group.setName(name); - readAccessHelper.addAll(group); + Arrays.stream(medicIdentifier).forEach(i -> readAccessHelper.addOrganization(group, i)); + readAccessHelper.addOrganization(group, ttpIdentifier); return group; } @@ -124,31 +130,25 @@ private ResearchStudy createResearchStudy(Group group1, Group group2) researchStudy.addEnrollment().setReference(group2.getIdElement().getIdPart()); researchStudy.addRelatedArtifact().setType(RelatedArtifact.RelatedArtifactType.DOCUMENTATION) - .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_REQUEST_FORM_REFERENCE).setUrl(REQUEST_FORM_REFERENCE); + .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_REQUEST_FORM_REFERENCE).setUrl(requestFormReference); researchStudy.addRelatedArtifact().setType(RelatedArtifact.RelatedArtifactType.JUSTIFICATION) - .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONTRACT_REFERENCE).setUrl(CONTRACT_REFERENCE); + .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONTRACT_REFERENCE).setUrl(contractReference); researchStudy.addRelatedArtifact().setType(RelatedArtifact.RelatedArtifactType.JUSTIFICATION) .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_FEASIBILITY_QUERY_REFERENCE) - .setUrl(FEASIBILITY_REFERENCE); - - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) - .setValue(new Reference().setType(ResourceType.Organization.name()) - .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1))); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) - .setValue(new Reference().setType(ResourceType.Organization.name()) - .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2))); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) - .setValue(new Reference().setType(ResourceType.Organization.name()) - .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3))); - researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP) - .setValue(new Reference().setType(ResourceType.Organization.name()) - .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP))); - - readAccessHelper.addAll(researchStudy); + .setUrl(feasibilityReference); + + Arrays.stream(medicIdentifier).forEach( + i -> researchStudy.addExtension().setUrl(ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( + new Reference().setType(ResourceType.Organization.name()).setIdentifier( + new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(i)))); + + researchStudy.addExtension().setUrl(ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP).setValue( + new Reference().setType(ResourceType.Organization.name()).setIdentifier( + new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(ttpIdentifier))); + + Arrays.stream(medicIdentifier).forEach(i -> readAccessHelper.addOrganization(researchStudy, i)); + readAccessHelper.addOrganization(researchStudy, ttpIdentifier); return researchStudy; } @@ -173,15 +173,14 @@ private Task createTask(ResearchStudy researchStudy) task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME)).getType() .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); - task.addInput() - .setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart()) - .setType(ResourceType.ResearchStudy.name())) - .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + task.addInput().setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart()) + .setType(ResourceType.ResearchStudy.name())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); - task.addInput().setValue(new BooleanType(NEEDS_RECORD_LINKAGE)).getType().addCoding() + task.addInput().setValue(new BooleanType(needsRecordLinkage)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); - task.addInput().setValue(new BooleanType(NEEDS_CONSENT_CHECK)).getType().addCoding() + task.addInput().setValue(new BooleanType(needsConsentCheck)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java index 4696498f..9dc70390 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java @@ -49,10 +49,10 @@ public abstract class AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter { - private final boolean NEEDS_CONSENT_CHECK = true; - private final boolean NEEDS_RECORD_LINKAGE = true; + private final boolean needsConsentCheck = true; + private final boolean needsRecordLinkage = true; - private final String QUERY = "SELECT COUNT(e) FROM EHR e"; + private final String query = "SELECT COUNT(e) FROM EHR e"; private final String[] medicIdentifier = new String[] { NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1, NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2, @@ -100,7 +100,7 @@ private Group createGroup(String name) group.setActual(false); group.setActive(true); group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY) - .setValue(new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression(QUERY)); + .setValue(new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression(query)); group.setName(name); Arrays.stream(medicIdentifier).forEach(i -> readAccessHelper.addOrganization(group, i)); @@ -160,10 +160,10 @@ private Task createTask(ResearchStudy researchStudy) .setType(ResourceType.ResearchStudy.name())) .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); - task.addInput().setValue(new BooleanType(NEEDS_RECORD_LINKAGE)).getType().addCoding() + task.addInput().setValue(new BooleanType(needsRecordLinkage)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); - task.addInput().setValue(new BooleanType(NEEDS_CONSENT_CHECK)).getType().addCoding() + task.addInput().setValue(new BooleanType(needsConsentCheck)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); From a7af8b2f9ff0603d5f1d1005a2928a7ee53db385 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 20 Sep 2021 19:12:00 +0200 Subject: [PATCH 061/125] fix wrong process dependency --- .../dsf/bpe/LocalServicesProcessPluginDefinition.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java index 829f76f2..c69e4523 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java @@ -62,16 +62,16 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader PropertyResolver resolver) { var aL = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-localServicesIntegration.xml"); - var sTL = StructureDefinitionResource - .file("fhir/StructureDefinition/highmed-task-local-services-integration.xml"); + var sTL = StructureDefinitionResource.file( + "fhir/StructureDefinition/highmed-task-local-services-integration.xml"); - var cDS = CodeSystemResource.dependency(DEPENDENCY_FEASIBILITY_NAME_AND_VERSION, + var cDS = CodeSystemResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/CodeSystem/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); var vDS = ValueSetResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/ValueSet/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); - Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map - .of("highmedorg_localServicesIntegration/" + VERSION, Arrays.asList(aL, sTL, cDS, vDS)); + Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( + "highmedorg_localServicesIntegration/" + VERSION, Arrays.asList(aL, sTL, cDS, vDS)); return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, resourcesByProcessKeyAndVersion); From 7dd247c190565ff83f8568eee0dbe56f5a57c679 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Thu, 23 Sep 2021 09:49:28 +0200 Subject: [PATCH 062/125] update process version to 0.6.0 --- .../DataSharingProcessPluginDefinition.java | 2 +- .../resources/bpe/computeDataSharing.bpmn | 10 +++++----- .../resources/bpe/executeDataSharing.bpmn | 6 +++--- .../resources/bpe/requestDataSharing.bpmn | 10 +++++----- ...ringFromMedicsViaMedic1ExampleStarter.java | 20 +++++++++---------- .../FeasibilityProcessPluginDefinition.java | 6 +++--- .../resources/bpe/computeFeasibility.bpmn | 10 +++++----- .../resources/bpe/executeFeasibility.bpmn | 6 +++--- .../resources/bpe/requestFeasibility.bpmn | 10 +++++----- .../LocalServicesProcessPluginDefinition.java | 16 +++++++-------- .../bpe/localServicesIntegration.bpmn | 2 +- .../dsf/bpe/PingProcessPluginDefinition.java | 2 +- .../src/main/resources/bpe/ping.bpmn | 6 +++--- .../src/main/resources/bpe/pong.bpmn | 6 +++--- ...pdateAllowListProcessPluginDefinition.java | 2 +- .../main/resources/bpe/downloadAllowList.bpmn | 2 +- .../main/resources/bpe/updateAllowList.bpmn | 2 +- ...pdateResourcesProcessPluginDefinition.java | 2 +- .../resources/bpe/executeUpdateResources.bpmn | 2 +- .../resources/bpe/requestUpdateResources.bpmn | 6 +++--- 20 files changed, 64 insertions(+), 64 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java index b679d917..f3137336 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java @@ -19,7 +19,7 @@ public class DataSharingProcessPluginDefinition implements ProcessPluginDefinition { - public static final String VERSION = "0.5.0"; + public static final String VERSION = "0.6.0"; @Override public String getName() diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn index 529dcf4f..f11bb01d 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yff9tp" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_computeDataSharing" isExecutable="true" camunda:versionTag="0.5.0"> + <bpmn:process id="highmedorg_computeDataSharing" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:subProcess id="SubProcess_1gopxt4"> <bpmn:incoming>SequenceFlow_1lfe4wr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0xxpamp</bpmn:outgoing> @@ -41,9 +41,9 @@ <bpmn:endEvent id="EndEventSuccess" name="send results to MeDIC"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestDataSharing/0.5.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestDataSharing/0.6.0</camunda:inputParameter> <camunda:inputParameter name="messageName">resultMultiMedicDataSharingMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing|0.5.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing|0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_0uaqn1r</bpmn:incoming> @@ -82,9 +82,9 @@ <bpmn:endEvent id="EndEventError" name="send error to MeDIC"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestDataSharing/0.5.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestDataSharing/0.6.0</camunda:inputParameter> <camunda:inputParameter name="messageName">errorMultiMedicDataSharingMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing|0.5.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing|0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_1tmnvhl</bpmn:incoming> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index 9ae563bf..d39beff3 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_executeDataSharing" isExecutable="true" camunda:versionTag="0.5.0"> + <bpmn:process id="highmedorg_executeDataSharing" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckMedicSingleMedicResults"> <bpmn:incoming>Flow_1pzik8k</bpmn:incoming> <bpmn:outgoing>Flow_08925ay</bpmn:outgoing> @@ -23,9 +23,9 @@ <bpmn:endEvent id="EndEventSuccess" name="send results to TTP"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeDataSharing/0.5.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeDataSharing/0.6.0</camunda:inputParameter> <camunda:inputParameter name="messageName">resultSingleMedicDataSharingMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing|0.5.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing|0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_1611vr6</bpmn:incoming> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn index cf9fbeac..5273b87b 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1flneil" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_requestDataSharing" isExecutable="true" camunda:versionTag="0.5.0"> + <bpmn:process id="highmedorg_requestDataSharing" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:sequenceFlow id="Flow_0dd6nmz" sourceRef="StartEvent" targetRef="downloadResearchStudyResource" /> <bpmn:sequenceFlow id="Flow_06otxko" sourceRef="downloadResearchStudyResource" targetRef="selectRequestTargetsAndGenerateKeys" /> <bpmn:startEvent id="StartEvent" name="start"> @@ -15,9 +15,9 @@ <bpmn:sendTask id="sendRequestToMedics" name="send request to medics" camunda:class="org.highmed.dsf.bpe.message.SendMedicRequest"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeDataSharing/0.5.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeDataSharing/0.6.0</camunda:inputParameter> <camunda:inputParameter name="messageName">executeDataSharingMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing|0.5.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing|0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_18ie7l6</bpmn:incoming> @@ -66,9 +66,9 @@ <bpmn:intermediateThrowEvent id="sendCorreltationKeysToTTP" name="send correlation keys to TTP"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeDataSharing/0.5.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeDataSharing/0.6.0</camunda:inputParameter> <camunda:inputParameter name="messageName">computeDataSharingMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing|0.5.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing|0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_0cx3xe1</bpmn:incoming> diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java index 017c0cc4..72445a2b 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -137,15 +137,14 @@ private ResearchStudy createResearchStudy(Group group1, Group group2) .setLabel(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_FEASIBILITY_QUERY_REFERENCE) .setUrl(feasibilityReference); - Arrays.stream(medicIdentifier).forEach( - i -> researchStudy.addExtension().setUrl(ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( - new Reference().setType(ResourceType.Organization.name()).setIdentifier( + Arrays.stream(medicIdentifier) + .forEach(i -> researchStudy.addExtension().setUrl(ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC) + .setValue(new Reference().setType(ResourceType.Organization.name()).setIdentifier( new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(i)))); - researchStudy.addExtension().setUrl(ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP).setValue( - new Reference().setType(ResourceType.Organization.name()).setIdentifier( - new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) - .setValue(ttpIdentifier))); + researchStudy.addExtension().setUrl(ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP) + .setValue(new Reference().setType(ResourceType.Organization.name()).setIdentifier(new Identifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(ttpIdentifier))); Arrays.stream(medicIdentifier).forEach(i -> readAccessHelper.addOrganization(researchStudy, i)); readAccessHelper.addOrganization(researchStudy, ttpIdentifier); @@ -173,9 +172,10 @@ private Task createTask(ResearchStudy researchStudy) task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME)).getType() .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); - task.addInput().setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart()) - .setType(ResourceType.ResearchStudy.name())).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + task.addInput() + .setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart()) + .setType(ResourceType.ResearchStudy.name())) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); task.addInput().setValue(new BooleanType(needsRecordLinkage)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java index c4e93eb3..8d48387d 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java @@ -20,10 +20,10 @@ public class FeasibilityProcessPluginDefinition implements ProcessPluginDefinition { - public static final String VERSION = "0.5.0"; + public static final String VERSION = "0.6.0"; - private static final String DEPENDENCY_DATA_SHARING_VERSION = "0.5.0"; - private static final String DEPENDENCY_DATA_SHARING_NAME_AND_VERSION = "dsf-bpe-process-data-sharing-0.5.0"; + private static final String DEPENDENCY_DATA_SHARING_VERSION = "0.6.0"; + private static final String DEPENDENCY_DATA_SHARING_NAME_AND_VERSION = "dsf-bpe-process-data-sharing-0.6.0"; @Override public String getName() diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn index 86ed47ab..f3dd3b5e 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn +++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yff9tp" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_computeFeasibility" isExecutable="true" camunda:versionTag="0.5.0"> + <bpmn:process id="highmedorg_computeFeasibility" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:subProcess id="SubProcess_1gopxt4"> <bpmn:incoming>SequenceFlow_1lfe4wr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0xxpamp</bpmn:outgoing> @@ -45,9 +45,9 @@ <bpmn:endEvent id="EndEventSuccess" name="send final results to leading MeDIC"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibility/0.5.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibility/0.6.0</camunda:inputParameter> <camunda:inputParameter name="messageName">resultMultiMedicFeasibilityMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-feasibility|0.5.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-feasibility|0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_1r6dq8y</bpmn:incoming> @@ -96,9 +96,9 @@ <bpmn:endEvent id="EndEventError" name="send error to leading MeDIC"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibility/0.5.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibility/0.6.0</camunda:inputParameter> <camunda:inputParameter name="messageName">errorMultiMedicFeasibilityMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-feasibility|0.5.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-feasibility|0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_1tmnvhl</bpmn:incoming> diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn index 6962e7f4..4c556084 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn +++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_executeFeasibility" isExecutable="true" camunda:versionTag="0.5.0"> + <bpmn:process id="highmedorg_executeFeasibility" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResults"> <bpmn:incoming>SequenceFlow_0q803rh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> @@ -24,9 +24,9 @@ <bpmn:endEvent id="EndEvent" name="send results to TTP"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeFeasibility/0.5.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeFeasibility/0.6.0</camunda:inputParameter> <camunda:inputParameter name="messageName">resultSingleMedicFeasibilityMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility|0.5.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility|0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0ascyjc</bpmn:incoming> diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn index 98e81ce2..18130802 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn +++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0inb4ax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_requestFeasibility" isExecutable="true" camunda:versionTag="0.5.0"> + <bpmn:process id="highmedorg_requestFeasibility" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:startEvent id="StartEvent" name="start"> <bpmn:outgoing>SequenceFlow_11k77gx</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_10c2suu" messageRef="Message_1pq9qxp" /> @@ -12,9 +12,9 @@ <bpmn:sendTask id="sendRequestToMedics" name="send request to medics" camunda:class="org.highmed.dsf.bpe.message.SendMedicRequest"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibility/0.5.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibility/0.6.0</camunda:inputParameter> <camunda:inputParameter name="messageName">executeFeasibilityMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-feasibility|0.5.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-feasibility|0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_035oihl</bpmn:incoming> @@ -32,9 +32,9 @@ <bpmn:intermediateThrowEvent id="sendCorreltationKeysToTTP" name="send correlation keys to TTP"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeFeasibility/0.5.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeFeasibility/0.6.0</camunda:inputParameter> <camunda:inputParameter name="messageName">computeFeasibilityMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-compute-feasibility|0.5.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-compute-feasibility|0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0b5s4ef</bpmn:incoming> diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java index c69e4523..a524e794 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java @@ -20,11 +20,11 @@ public class LocalServicesProcessPluginDefinition implements ProcessPluginDefinition { - public static final String VERSION = "0.5.0"; + public static final String VERSION = "0.6.0"; - private static final String DEPENDENCY_DATA_SHARING_VERSION = "0.5.0"; - private static final String DEPENDENCY_DATA_SHARING_NAME_AND_VERSION = "dsf-bpe-process-data-sharing-0.5.0"; - private static final String DEPENDENCY_FEASIBILITY_NAME_AND_VERSION = "dsf-bpe-process-feasibility-0.5.0"; + private static final String DEPENDENCY_DATA_SHARING_VERSION = "0.6.0"; + private static final String DEPENDENCY_DATA_SHARING_NAME_AND_VERSION = "dsf-bpe-process-data-sharing-0.6.0"; + private static final String DEPENDENCY_FEASIBILITY_NAME_AND_VERSION = "dsf-bpe-process-feasibility-0.6.0"; @Override public String getName() @@ -62,16 +62,16 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader PropertyResolver resolver) { var aL = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-localServicesIntegration.xml"); - var sTL = StructureDefinitionResource.file( - "fhir/StructureDefinition/highmed-task-local-services-integration.xml"); + var sTL = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-local-services-integration.xml"); var cDS = CodeSystemResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/CodeSystem/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); var vDS = ValueSetResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/ValueSet/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); - Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( - "highmedorg_localServicesIntegration/" + VERSION, Arrays.asList(aL, sTL, cDS, vDS)); + Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map + .of("highmedorg_localServicesIntegration/" + VERSION, Arrays.asList(aL, sTL, cDS, vDS)); return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, resourcesByProcessKeyAndVersion); diff --git a/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn b/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn index c4a6210c..3a4b741a 100644 --- a/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn +++ b/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_localServicesIntegration" isExecutable="true" camunda:versionTag="0.5.0"> + <bpmn:process id="highmedorg_localServicesIntegration" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResults"> <bpmn:incoming>SequenceFlow_0q803rh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java index 180a53a7..0ed0badd 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java @@ -16,7 +16,7 @@ public class PingProcessPluginDefinition implements ProcessPluginDefinition { - public static final String VERSION = "0.5.0"; + public static final String VERSION = "0.6.0"; @Override public String getName() diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn index 1b87ce4b..fb80d97f 100644 --- a/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn +++ b/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0azvmx1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_ping" isExecutable="true" camunda:versionTag="0.5.0"> + <bpmn:process id="highmedorg_ping" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:sequenceFlow id="SequenceFlow_0k1j79c" sourceRef="StartEvent_1" targetRef="selectTargets" /> <bpmn:sequenceFlow id="SequenceFlow_05ia6lz" sourceRef="selectTargets" targetRef="sendPing" /> <bpmn:serviceTask id="selectTargets" name="selectTargets" camunda:class="org.highmed.dsf.bpe.service.SelectPingTargets"> @@ -10,9 +10,9 @@ <bpmn:sendTask id="sendPing" name="sendPing" camunda:class="org.highmed.dsf.bpe.message.SendPing"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/pong/0.5.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/pong/0.6.0</camunda:inputParameter> <camunda:inputParameter name="messageName">pingMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-ping|0.5.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-ping|0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_05ia6lz</bpmn:incoming> diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn index 94580681..66c68cae 100644 --- a/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn +++ b/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_15v05m6" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_pong" isExecutable="true" camunda:versionTag="0.5.0"> + <bpmn:process id="highmedorg_pong" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:startEvent id="StartEvent_1"> <bpmn:outgoing>SequenceFlow_07w11cw</bpmn:outgoing> <bpmn:messageEventDefinition messageRef="Message_0u91abp" /> @@ -9,9 +9,9 @@ <bpmn:endEvent id="EndEvent_1ivxrjg"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/ping/0.5.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/ping/0.6.0</camunda:inputParameter> <camunda:inputParameter name="messageName">pongMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-pong|0.5.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-pong|0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1ism9wt</bpmn:incoming> diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java index 0f330987..52bfb05f 100644 --- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java +++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java @@ -18,7 +18,7 @@ public class UpdateAllowListProcessPluginDefinition implements ProcessPluginDefinition { - public static final String VERSION = "0.5.0"; + public static final String VERSION = "0.6.0"; @Override public String getName() diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn index 2ac200dd..de311db7 100644 --- a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn +++ b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1yb5vw3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_downloadAllowList" isExecutable="true" camunda:versionTag="0.5.0"> + <bpmn:process id="highmedorg_downloadAllowList" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:sequenceFlow id="SequenceFlow_0bbhq2r" sourceRef="StartEvent_1" targetRef="downloadAllowListTask" /> <bpmn:endEvent id="EndEvent_0xd0x8k"> <bpmn:incoming>SequenceFlow_0oyvmcd</bpmn:incoming> diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn index 58003231..eae03a8a 100644 --- a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn +++ b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1yb5vw3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_updateAllowList" isExecutable="true" camunda:versionTag="0.5.0"> + <bpmn:process id="highmedorg_updateAllowList" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:sequenceFlow id="SequenceFlow_0bbhq2r" sourceRef="StartEvent_1" targetRef="updateAllowListTask" /> <bpmn:endEvent id="EndEvent_0xd0x8k"> <bpmn:incoming>SequenceFlow_0oyvmcd</bpmn:incoming> diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java index 8bde102e..9960d61c 100644 --- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java +++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java @@ -18,7 +18,7 @@ public class UpdateResourcesProcessPluginDefinition implements ProcessPluginDefinition { - public static final String VERSION = "0.5.0"; + public static final String VERSION = "0.6.0"; @Override public String getName() diff --git a/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn b/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn index b19a714c..81caaa3d 100644 --- a/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn +++ b/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0k0v4i2" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_executeUpdateResources" isExecutable="true" camunda:versionTag="0.5.0"> + <bpmn:process id="highmedorg_executeUpdateResources" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:startEvent id="StartEvent_1"> <bpmn:outgoing>SequenceFlow_0djh0eg</bpmn:outgoing> <bpmn:messageEventDefinition messageRef="Message_1r6vnvn" /> diff --git a/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn b/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn index 595694e7..c2ad93e7 100644 --- a/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn +++ b/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0os0n0z" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_requestUpdateResources" isExecutable="true" camunda:versionTag="0.5.0"> + <bpmn:process id="highmedorg_requestUpdateResources" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:sequenceFlow id="SequenceFlow_1ryplwc" sourceRef="StartEvent_1" targetRef="selectResourceAndTargets" /> <bpmn:sequenceFlow id="SequenceFlow_1u4zxix" sourceRef="selectResourceAndTargets" targetRef="sendRequest" /> <bpmn:endEvent id="EndEvent_1f9cjs7"> @@ -10,9 +10,9 @@ <bpmn:sendTask id="sendRequest" name="sendRequest" camunda:class="org.highmed.dsf.bpe.message.SendRequest"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeUpdateResources/0.5.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeUpdateResources/0.6.0</camunda:inputParameter> <camunda:inputParameter name="messageName">executeUpdateResourcesMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-update-resources|0.5.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-update-resources|0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1u4zxix</bpmn:incoming> From fd032b646af94f57e9c45517b0c60f8ce69ecc33 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Sat, 16 Oct 2021 22:23:59 +0200 Subject: [PATCH 063/125] check organizations are part of consortium, rename organization-type to organization-role --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 1 + .../dsf/bpe/service/SelectRequestTargets.java | 12 +-- .../service/SelectResponseTargetMedic.java | 6 +- .../bpe/service/SelectResponseTargetTtp.java | 6 +- .../highmed-computeDataSharing.xml | 8 +- .../highmed-executeDataSharing.xml | 6 +- .../highmed-requestDataSharing.xml | 12 +-- .../fhir/CodeSystem/highmed-data-sharing.xml | 5 ++ .../DownloadResearchStudyResource.java | 75 ++++++++++++++++--- .../dsf/bpe/service/SelectRequestTargets.java | 12 +-- .../service/SelectResponseTargetMedic.java | 6 +- .../bpe/service/SelectResponseTargetTtp.java | 6 +- .../highmed-computeFeasibility.xml | 8 +- .../highmed-executeFeasibility.xml | 6 +- .../highmed-requestFeasibility.xml | 12 +-- .../highmed-task-request-feasibility.xml | 53 ++++++++++++- ...lityFromMedicsViaMedic1ExampleStarter.java | 9 +++ .../dsf/fhir/profile/TaskProfileTest.java | 7 ++ .../highmed-localServicesIntegration.xml | 4 +- 19 files changed, 189 insertions(+), 65 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index 6bbabc65..e604d6e0 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -23,6 +23,7 @@ public interface ConstantsDataSharing String CODESYSTEM_HIGHMED_DATA_SHARING = "http://highmed.org/fhir/CodeSystem/data-sharing"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE = "research-study-reference"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_IDENTIFIER = "research-study-identifier"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONSORTIUM_IDENTIFIER = "consortium-identifier"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE = "needs-record-linkage"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK = "needs-consent-check"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG = "bloom-filter-configuration"; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index 737c1987..f3159595 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -2,9 +2,9 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; @@ -107,7 +107,7 @@ private Targets getMedicTargets(ResearchStudy researchStudy) .map(v -> (Reference) v).filter(Reference::hasIdentifier).map(Reference::getIdentifier) .filter(Identifier::hasValue).map(Identifier::getValue) .map(medicIdentifier -> Target.createBiDirectionalTarget(medicIdentifier, - getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC, medicIdentifier), + getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIdentifier), UUID.randomUUID().toString())) .collect(Collectors.toList()); @@ -121,7 +121,7 @@ private Target getTtpTarget(ResearchStudy researchStudy) .map(v -> (Reference) v).filter(Reference::hasIdentifier).map(Reference::getIdentifier) .filter(Identifier::hasValue).map(Identifier::getValue) .map(ttpIdentifier -> Target.createUniDirectionalTarget(ttpIdentifier, - getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP, ttpIdentifier))) + getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP, ttpIdentifier))) .findFirst().get(); } @@ -129,7 +129,7 @@ private String getAddress(String role, String identifier) { return endpointProvider .getFirstConsortiumEndpointAdress(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, - CODESYSTEM_HIGHMED_ORGANIZATION_TYPE, role, identifier) + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, role, identifier) .get(); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java index d906d159..a03e36f9 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java @@ -1,8 +1,8 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import java.util.Objects; @@ -45,7 +45,7 @@ protected void doExecute(DelegateExecution execution) throws Exception Target medicTarget = Target.createUniDirectionalTarget(medicIndentifier, endpointProvider.getFirstConsortiumEndpointAdress( NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, - CODESYSTEM_HIGHMED_ORGANIZATION_TYPE, CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC, + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIndentifier).get()); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(medicTarget)); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java index 78325280..13471ce5 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java @@ -4,8 +4,8 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import java.util.Objects; @@ -47,7 +47,7 @@ protected void doExecute(DelegateExecution execution) Target ttpTarget = Target.createBiDirectionalTarget(ttpIdentifier, endpointProvider.getFirstConsortiumEndpointAdress( NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, - CODESYSTEM_HIGHMED_ORGANIZATION_TYPE, CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP, + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP, ttpIdentifier).get(), correlationKey); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(ttpTarget)); diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml index d608bb90..7b270fdd 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml @@ -23,7 +23,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -43,7 +43,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="TTP" /> </valueCoding> </extension> @@ -71,7 +71,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -91,7 +91,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="TTP" /> </valueCoding> </extension> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml index a181dc40..ee1991d4 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml @@ -23,7 +23,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -43,7 +43,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -63,7 +63,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml index 83c2669b..1c6f26d0 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml @@ -23,7 +23,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -43,7 +43,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -71,7 +71,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="TTP" /> </valueCoding> </extension> @@ -91,7 +91,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -119,7 +119,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="TTP" /> </valueCoding> </extension> @@ -139,7 +139,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml index b24f4f43..8be4cade 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml @@ -40,6 +40,11 @@ <display value="Needs Consent Check"/> <definition value="Boolean indicating if a data analysis needs consent check"/> </concept> + <concept> + <code value="consortium-identifier"/> + <display value="Consortium Identifier"/> + <definition value="Consortium organization resource identifier"/> + </concept> <concept> <code value="bloom-filter-configuration"/> <display value="Bloom Filter Configuration"/> diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java index 5b5edf20..86311239 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -1,16 +1,18 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONSORTIUM_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; +import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; @@ -62,7 +64,10 @@ protected void doExecute(DelegateExecution execution) throws Exception IdType researchStudyId = getResearchStudyId(task); FhirWebserviceClient client = getFhirWebserviceClientProvider().getLocalWebserviceClient(); ResearchStudy researchStudy = getResearchStudy(researchStudyId, client); - researchStudy = addMissingOrganizations(researchStudy, client); + String consortiumIdentifier = getConsortiumIdentifier(task); + + researchStudy = checkConsortiumAffiliationAndAddMissingOrganizations(researchStudy, consortiumIdentifier, + client); execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY, researchStudy); boolean needsConsentCheck = getNeedsConsentCheck(task); @@ -98,23 +103,61 @@ private ResearchStudy getResearchStudy(IdType researchStudyid, FhirWebserviceCli } } - private ResearchStudy addMissingOrganizations(ResearchStudy researchStudy, FhirWebserviceClient client) + private ResearchStudy checkConsortiumAffiliationAndAddMissingOrganizations(ResearchStudy researchStudy, + String consortiumIdentifier, FhirWebserviceClient client) + { + List<String> identifiersConsortium = getOrganizationIdentifiersOfConsortium(consortiumIdentifier); + List<String> identifiersResearchStudy = getOrganizationIdentifiersOfResearchStudy(researchStudy); + + checkConsortiumAffiliation(identifiersConsortium, identifiersResearchStudy, researchStudy.getId(), + consortiumIdentifier); + + return addMissingOrganizations(identifiersConsortium, identifiersResearchStudy, researchStudy, client); + } + + private List<String> getOrganizationIdentifiersOfConsortium(String consortiumIdentifier) { - List<String> identifiers = organizationProvider - .getOrganizationsByType(CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC) + return organizationProvider + .getOrganizationsByConsortiumAndRole(consortiumIdentifier, + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC) .flatMap(o -> o.getIdentifier().stream()) .filter(i -> NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER.equals(i.getSystem())).map(i -> i.getValue()) .collect(Collectors.toList()); + } - List<String> existingIdentifiers = researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) - .stream().filter(e -> e.getValue() instanceof Reference).map(e -> (Reference) e.getValue()) + private List<String> getOrganizationIdentifiersOfResearchStudy(ResearchStudy researchStudy) + { + return researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).stream() + .filter(e -> e.getValue() instanceof Reference).map(e -> (Reference) e.getValue()) .map(r -> r.getIdentifier().getValue()).collect(Collectors.toList()); + } + + private void checkConsortiumAffiliation(List<String> identifiersConsortium, List<String> identifiersResearchStudy, + String researchStudyId, String consortiumIdentifier) + { + List<String> identifiersWrongConsortium = new ArrayList<>(identifiersResearchStudy); + identifiersWrongConsortium.removeAll(identifiersConsortium); + if (!identifiersWrongConsortium.isEmpty()) + { + logger.warn( + "Organizations with identifiers='{}' are part of feasibility research study with id='{}' but do " + + "not belong to the consortium with id='{}'", + identifiersWrongConsortium, researchStudyId, consortiumIdentifier); + + throw new RuntimeException("Organizations with identifiers='" + identifiersWrongConsortium + + "' are part of feasibility research study with id='" + researchStudyId + + "' but do not belong to the consortium with id='" + consortiumIdentifier + "'"); + } + } - identifiers.removeAll(existingIdentifiers); + private ResearchStudy addMissingOrganizations(List<String> identifiersConsortium, + List<String> identifiersResearchStudy, ResearchStudy researchStudy, FhirWebserviceClient client) + { + identifiersConsortium.removeAll(identifiersResearchStudy); - if (!identifiers.isEmpty()) + if (!identifiersConsortium.isEmpty()) { - identifiers.forEach(identifier -> + identifiersConsortium.forEach(identifier -> { logger.warn( "Adding missing organization with identifier='{}' to feasibility research study with id='{}'", @@ -145,13 +188,23 @@ private ResearchStudy update(ResearchStudy researchStudy, FhirWebserviceClient c } } + private String getConsortiumIdentifier(Task task) + { + return getTaskHelper() + .getFirstInputParameterReferenceValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONSORTIUM_IDENTIFIER) + .orElseThrow(() -> new IllegalArgumentException("ConsortiumIdentifier is not set in task with id='" + + task.getId() + "', this error should have been caught by resource validation")) + .getIdentifier().getValue(); + } + private boolean getNeedsConsentCheck(Task task) { return getTaskHelper() .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK) .orElseThrow(() -> new IllegalArgumentException("NeedsConsentCheck boolean is not set in task with id='" - + task.getId() + "', this error should " + "have been caught by resource validation")); + + task.getId() + "', this error should have been caught by resource validation")); } private boolean getNeedsRecordLinkageCheck(Task task) diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index 0f7876ee..82700434 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -2,9 +2,9 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; @@ -105,7 +105,7 @@ private Targets getMedicTargets(ResearchStudy researchStudy) .map(v -> (Reference) v).filter(Reference::hasIdentifier).map(Reference::getIdentifier) .filter(Identifier::hasValue).map(Identifier::getValue) .map(medicIdentifier -> Target.createBiDirectionalTarget(medicIdentifier, - getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC, medicIdentifier), + getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIdentifier), UUID.randomUUID().toString())) .collect(Collectors.toList()); @@ -119,7 +119,7 @@ private Target getTtpTarget(ResearchStudy researchStudy) .map(v -> (Reference) v).filter(Reference::hasIdentifier).map(Reference::getIdentifier) .filter(Identifier::hasValue).map(Identifier::getValue) .map(ttpIdentifier -> Target.createUniDirectionalTarget(ttpIdentifier, - getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP, ttpIdentifier))) + getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP, ttpIdentifier))) .findFirst().get(); } @@ -127,7 +127,7 @@ private String getAddress(String role, String identifier) { return endpointProvider .getFirstConsortiumEndpointAdress(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, - CODESYSTEM_HIGHMED_ORGANIZATION_TYPE, role, identifier) + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, role, identifier) .get(); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java index d906d159..a03e36f9 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java @@ -1,8 +1,8 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import java.util.Objects; @@ -45,7 +45,7 @@ protected void doExecute(DelegateExecution execution) throws Exception Target medicTarget = Target.createUniDirectionalTarget(medicIndentifier, endpointProvider.getFirstConsortiumEndpointAdress( NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, - CODESYSTEM_HIGHMED_ORGANIZATION_TYPE, CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC, + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIndentifier).get()); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(medicTarget)); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java index 0bb36898..4c19f88c 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java @@ -4,8 +4,8 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE; -import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import java.util.Objects; @@ -50,7 +50,7 @@ protected void doExecute(DelegateExecution execution) throws Exception Target ttpTarget = Target.createBiDirectionalTarget(ttpIdentifier, endpointProvider.getFirstConsortiumEndpointAdress( NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, - CODESYSTEM_HIGHMED_ORGANIZATION_TYPE, CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP, + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP, ttpIdentifier).get(), correlationKey); diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml index 12e6269c..a9c664cd 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml @@ -23,7 +23,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -43,7 +43,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="TTP" /> </valueCoding> </extension> @@ -71,7 +71,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -91,7 +91,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="TTP" /> </valueCoding> </extension> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml index ceb27b2c..974932a3 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml @@ -23,7 +23,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -43,7 +43,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -63,7 +63,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml index 44c96360..c367973d 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml @@ -23,7 +23,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -43,7 +43,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -71,7 +71,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="TTP" /> </valueCoding> </extension> @@ -91,7 +91,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -119,7 +119,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="TTP" /> </valueCoding> </extension> @@ -139,7 +139,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml index 2530f97d..5bd05576 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml @@ -29,8 +29,8 @@ <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <min value="4" /> - <max value="4" /> + <min value="5" /> + <max value="5" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> @@ -108,6 +108,55 @@ <path value="Task.input.value[x].identifier" /> <max value="0" /> </element> + <element id="Task.input:consortium-identifier"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="consortium-identifier" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:consortium-identifier.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:consortium-identifier.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:consortium-identifier.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:consortium-identifier.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="consortium-identifier" /> + </element> + <element id="Task.input:consortium-identifier.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="Reference" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/organization" /> + </type> + </element> + <element id="Task.input:consortium-identifier.value[x].reference"> + <path value="Task.input.value[x].reference" /> + <max value="0" /> + </element> + <element id="Task.input:consortium-identifier.value[x].identifier"> + <path value="Task.input.value[x].identifier" /> + <min value="1" /> + </element> <element id="Task.input:needs-record-linkage"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> <valueString value="Parameter" /> diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java index 9dc70390..97aa98f8 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityFromMedicsViaMedic1ExampleStarter.java @@ -11,12 +11,14 @@ import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHEMD_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHMED_GROUP; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONSORTIUM_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_CONSORTIUM_HIGHMED; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3; @@ -160,6 +162,13 @@ private Task createTask(ResearchStudy researchStudy) .setType(ResourceType.ResearchStudy.name())) .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); + task.addInput() + .setValue(new Reference() + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_CONSORTIUM_HIGHMED)) + .setType(ResourceType.Organization.name())) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONSORTIUM_IDENTIFIER); task.addInput().setValue(new BooleanType(needsRecordLinkage)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index 4ce8c1c6..44f26549 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -9,6 +9,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_BLOOM_FILTER_CONFIG; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONSORTIUM_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; @@ -45,6 +46,7 @@ import org.highmed.dsf.fhir.validation.ValidationSupportRule; import org.hl7.fhir.r4.model.Base64BinaryType; import org.hl7.fhir.r4.model.BooleanType; +import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResourceType; import org.hl7.fhir.r4.model.StringType; @@ -149,6 +151,11 @@ private Task createValidTaskRequestFeasibility() task.addInput().setValue(new Reference("ResearchStudy/" + UUID.randomUUID().toString())).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); + task.addInput() + .setValue(new Reference().setIdentifier(new Identifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("Consortium"))) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONSORTIUM_IDENTIFIER); task.addInput().setValue(new BooleanType(false)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE); diff --git a/dsf-bpe-process-local-services/src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml b/dsf-bpe-process-local-services/src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml index 510b6a7d..d998a648 100644 --- a/dsf-bpe-process-local-services/src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml +++ b/dsf-bpe-process-local-services/src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml @@ -23,7 +23,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> @@ -43,7 +43,7 @@ </extension> <extension url="role"> <valueCoding> - <system value="http://highmed.org/fhir/CodeSystem/organization-type" /> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> <code value="MeDIC" /> </valueCoding> </extension> From 3ba06be8a49b09e0396e4ddfbf815d334cc66fe9 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 27 Oct 2021 16:55:05 +0200 Subject: [PATCH 064/125] changes based on review of PR30 --- .../highmed/dsf/bpe/message/SendErrors.java | 4 +- .../dsf/bpe/message/SendMedicRequest.java | 16 ++--- .../dsf/bpe/message/SendMultiMedicErrors.java | 2 +- .../bpe/message/SendMultiMedicResults.java | 9 +-- .../highmed/dsf/bpe/message/SendResults.java | 14 ++-- .../bpe/message/SendSingleMedicResults.java | 9 +-- .../dsf/bpe/message/SendTtpRequest.java | 12 ++-- ...Results.java => AbstractCheckResults.java} | 33 ++++----- ...ults.java => AbstractDownloadResults.java} | 18 ++--- ...stractPseudonymizeResultsSecondOrder.java} | 68 +++++++------------ .../service/CheckMedicMultiMedicResults.java | 10 +-- .../service/CheckMedicSingleMedicResults.java | 9 +-- .../service/CheckTtpMultiMedicResults.java | 9 +-- .../service/CheckTtpSingleMedicResults.java | 7 +- .../bpe/service/DecryptMultiMedicResults.java | 6 +- .../service/DownloadMultiMedicResults.java | 2 +- .../service/DownloadSingleMedicResults.java | 2 +- .../dsf/bpe/service/EncryptResults.java | 2 +- .../bpe/service/FilterResultsByConsent.java | 16 ++--- .../dsf/bpe/service/GenerateBloomFilters.java | 2 +- .../PseudonymizeResultsFirstOrder.java | 2 +- ...zeResultsSecondOrderWithRecordLinkage.java | 19 +++--- ...esultsSecondOrderWithoutRecordLinkage.java | 19 +++--- .../dsf/bpe/service/SelectRequestTargets.java | 7 +- .../highmed/dsf/bpe/service/StoreResults.java | 12 ++-- .../bpe/spring/config/DataSharingConfig.java | 42 ++++++++++-- .../highmed/dsf/bpe/service/CheckQueries.java | 1 - .../DownloadResearchStudyResource.java | 6 +- .../dsf/bpe/service/DownloadResults.java | 2 +- .../bpe/service/FilterResultsByConsent.java | 16 ++--- .../dsf/bpe/service/GenerateBloomFilters.java | 12 ++-- .../dsf/bpe/service/SelectRequestTargets.java | 7 +- .../resources/bpe/computeFeasibility.bpmn | 2 +- pom.xml | 2 +- 34 files changed, 191 insertions(+), 208 deletions(-) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{CheckResults.java => AbstractCheckResults.java} (72%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{DownloadResults.java => AbstractDownloadResults.java} (84%) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/{PseudonymizeResultsSecondOrder.java => AbstractPseudonymizeResultsSecondOrder.java} (72%) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendErrors.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendErrors.java index 693fe3c4..d8cc7e35 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendErrors.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendErrors.java @@ -32,12 +32,12 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut Task task = getLeadingTaskFromExecutionVariables(); String taskUrl = new Reference(new IdType(getFhirWebserviceClientProvider().getLocalBaseUrl() + "/Task", task.getIdElement().getIdPart())).getReference(); - String errorMessage = getErrorMessage(taskUrl); + String errorMessage = createErrorMessage(taskUrl); ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage); return Stream.of(input); } - protected abstract String getErrorMessage(String taskUrl); + protected abstract String createErrorMessage(String taskUrl); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java index a88ac84d..4670d7d1 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java @@ -41,16 +41,16 @@ public SendMedicRequest(FhirWebserviceClientProvider clientProvider, TaskHelper protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); - ParameterComponent inputResearchStudyReference = getResearchStudyComponent(researchStudy); + ParameterComponent inputResearchStudyReference = createResearchStudyComponent(researchStudy); boolean needsConsentCheck = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); - ParameterComponent inputNeedsConsentCheck = getNeedsConsentCheckComponent(needsConsentCheck); + ParameterComponent inputNeedsConsentCheck = createNeedsConsentCheckComponent(needsConsentCheck); boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); - ParameterComponent inputNeedsRecordLinkage = getNeedsRecordLinkageComponent(needsRecordLinkage); + ParameterComponent inputNeedsRecordLinkage = createNeedsRecordLinkageComponent(needsRecordLinkage); byte[] mdatKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); - ParameterComponent inputMdatKey = getMdatKeyComponent(mdatKey); + ParameterComponent inputMdatKey = createMdatKeyComponent(mdatKey); if (needsRecordLinkage) { @@ -68,7 +68,7 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut } } - private Task.ParameterComponent getResearchStudyComponent(ResearchStudy researchStudy) + private Task.ParameterComponent createResearchStudyComponent(ResearchStudy researchStudy) { IdType researchStudyId = new IdType( getFhirWebserviceClientProvider().getLocalBaseUrl() + "/" + researchStudy.getId()); @@ -77,19 +77,19 @@ private Task.ParameterComponent getResearchStudyComponent(ResearchStudy research new Reference().setReference(researchStudyId.toVersionless().getValueAsString())); } - private Task.ParameterComponent getNeedsConsentCheckComponent(boolean needsConsentCheck) + private Task.ParameterComponent createNeedsConsentCheckComponent(boolean needsConsentCheck) { return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK, needsConsentCheck); } - private Task.ParameterComponent getNeedsRecordLinkageComponent(boolean needsRecordLinkage) + private Task.ParameterComponent createNeedsRecordLinkageComponent(boolean needsRecordLinkage) { return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); } - private Task.ParameterComponent getMdatKeyComponent(byte[] mdatKey) + private Task.ParameterComponent createMdatKeyComponent(byte[] mdatKey) { return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY, mdatKey); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java index b3542874..9c275362 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicErrors.java @@ -16,7 +16,7 @@ public SendMultiMedicErrors(FhirWebserviceClientProvider clientProvider, TaskHel } @Override - protected String getErrorMessage(String taskUrl) + protected String createErrorMessage(String taskUrl) { return "An error occurred while calculating the multi medic data sharing result for " + "all defined cohorts, see task with url='" + taskUrl + "'"; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java index 2269ddad..df8753d5 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java @@ -14,12 +14,7 @@ public class SendMultiMedicResults extends SendResults public SendMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) { - super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); - } - - @Override - protected String getResultSetReferenceCodeSystemValue() - { - return CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE; + super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java index 8dbb735f..6750dc89 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java @@ -27,10 +27,15 @@ public abstract class SendResults extends AbstractTaskMessageSend { private static final Logger logger = LoggerFactory.getLogger(SendResults.class); + private final String resultSetReferenceCodeSystemValue; + public SendResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) + ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext, + String resultSetReferenceCodeSystemValue) { super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); + + this.resultSetReferenceCodeSystemValue = resultSetReferenceCodeSystemValue; } @Override @@ -40,17 +45,12 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut return results.getResults().stream().map(this::toInput); } - /** - * @return the code system value that classifies the result set reference in the Task input that will be generated - */ - protected abstract String getResultSetReferenceCodeSystemValue(); - private Task.ParameterComponent toInput(QueryResult result) { if (result.isIdResultSetUrlResult()) { ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - getResultSetReferenceCodeSystemValue(), new Reference(result.getResultSetUrl())); + resultSetReferenceCodeSystemValue, new Reference(result.getResultSetUrl())); input.addExtension(createCohortIdExtension(result.getCohortId())); return input; } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java index 4fb28710..337becd7 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -14,12 +14,7 @@ public class SendSingleMedicResults extends SendResults public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) { - super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); - } - - @Override - protected String getResultSetReferenceCodeSystemValue() - { - return CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE; + super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java index c7bf0d31..b4883089 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendTtpRequest.java @@ -37,32 +37,32 @@ public SendTtpRequest(FhirWebserviceClientProvider clientProvider, TaskHelper ta protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { Targets medicTargets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); - Stream<Task.ParameterComponent> inputMedicTargets = getTargetComponents(medicTargets); + Stream<Task.ParameterComponent> inputMedicTargets = createTargetComponents(medicTargets); boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); - Task.ParameterComponent inputNeedsRecordLinkage = getRecordLinkageComponent(needsRecordLinkage); + Task.ParameterComponent inputNeedsRecordLinkage = createRecordLinkageComponent(needsRecordLinkage); String researchStudyIdentifier = (String) execution .getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY_IDENTIFIER); - Task.ParameterComponent inputResearchStudyIdentifier = getInputResearchStudyIdentifierComponent( + Task.ParameterComponent inputResearchStudyIdentifier = createInputResearchStudyIdentifierComponent( researchStudyIdentifier); return Stream.concat(inputMedicTargets, Stream.of(inputNeedsRecordLinkage, inputResearchStudyIdentifier)); } - private Stream<Task.ParameterComponent> getTargetComponents(Targets targets) + private Stream<Task.ParameterComponent> createTargetComponents(Targets targets) { return targets.getEntries().stream().map(target -> getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY, target.getCorrelationKey())); } - private Task.ParameterComponent getRecordLinkageComponent(boolean needsRecordLinkage) + private Task.ParameterComponent createRecordLinkageComponent(boolean needsRecordLinkage) { return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); } - private Task.ParameterComponent getInputResearchStudyIdentifierComponent(String researchStudyIdentifierValue) + private Task.ParameterComponent createInputResearchStudyIdentifierComponent(String researchStudyIdentifierValue) { Reference reference = new Reference().setType(ResourceType.ResearchStudy.name()).setIdentifier(new Identifier() .setValue(researchStudyIdentifierValue).setSystem(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER)); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/AbstractCheckResults.java similarity index 72% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResults.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/AbstractCheckResults.java index 2802f7fd..64071362 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/AbstractCheckResults.java @@ -5,9 +5,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import java.util.List; -import java.util.function.BiFunction; import java.util.stream.Collectors; -import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; @@ -21,11 +19,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public abstract class CheckResults extends AbstractServiceDelegate +public abstract class AbstractCheckResults extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(CheckResults.class); + private static final Logger logger = LoggerFactory.getLogger(AbstractCheckResults.class); - public CheckResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public AbstractCheckResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) { super(clientProvider, taskHelper, readAccessHelper); @@ -49,29 +47,22 @@ private List<QueryResult> filterErroneousResultsAndAddErrorsToCurrentTaskOutputs .collect(Collectors.toList()); } - private boolean testResultAndAddPossibleError(QueryResult result, Task task) - { - boolean hasFailingCheck = getChecks(result, task).map(check -> check.apply(result, task)) - .anyMatch(Boolean.FALSE::equals); - - return !hasFailingCheck; - } - /** * @param result - * the {@link QueryResult} that should be checked + * not <code>null</code> * @param task - * the task to which errors should be added as outputs if the check is not passed, use - * {@link #getChecks(QueryResult, Task)} to add the error output - * @return a list of checks that should be performed for given {@link QueryResult}, each check returning - * <code>true</code> if the check is passed, <code>false</code> otherwise + * not <code>null</code> + * @return <code>true</code> if the supplied {@link QueryResult} passed all checks, <code>false</code> otherwise */ - protected abstract Stream<BiFunction<QueryResult, Task, Boolean>> getChecks(QueryResult result, Task task); + protected boolean testResultAndAddPossibleError(QueryResult result, Task task) + { + return checkColumns(result, task) && checkRows(result, task); + } /** * @param passedResults - * all {@link QueryResult} objects that passed the checks defined by - * {@link #getChecks(QueryResult, Task)} + * all {@link QueryResult} objects that passed the checks executed by + * {@link #testResultAndAddPossibleError(QueryResult, Task)} * @return a list of {@link QueryResult} objects after post processing */ protected List<QueryResult> postProcessAllPassingResults(List<QueryResult> passedResults) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/AbstractDownloadResults.java similarity index 84% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResults.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/AbstractDownloadResults.java index 1ca30eb0..4535edc3 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/AbstractDownloadResults.java @@ -27,13 +27,13 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public abstract class DownloadResults extends AbstractServiceDelegate +public abstract class AbstractDownloadResults extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(DownloadResults.class); + private static final Logger logger = LoggerFactory.getLogger(AbstractDownloadResults.class); private final ObjectMapper openEhrObjectMapper; - public DownloadResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public AbstractDownloadResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper, readAccessHelper); @@ -87,10 +87,10 @@ private InputStream readBinaryResource(FhirWebserviceClient client, String id) logger.info("Reading binary from {} with id {}", client.getBaseUrl(), id); return client.readBinary(id, MediaType.valueOf(OPENEHR_MIMETYPE_JSON)); } - catch (Exception e) + catch (Exception exception) { - logger.warn("Error while reading Binary resource: " + e.getMessage(), e); - throw e; + logger.warn("Error while reading Binary resource: " + exception.getMessage()); + throw exception; } } @@ -100,10 +100,10 @@ private ResultSet deserializeResultSet(InputStream content) { return openEhrObjectMapper.readValue(content, ResultSet.class); } - catch (IOException e) + catch (IOException exception) { - logger.warn("Error while deserializing ResultSet: " + e.getMessage(), e); - throw new RuntimeException(e); + logger.warn("Error while deserializing ResultSet: " + exception.getMessage()); + throw new RuntimeException(exception); } } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrder.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/AbstractPseudonymizeResultsSecondOrder.java similarity index 72% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrder.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/AbstractPseudonymizeResultsSecondOrder.java index b75811b7..f1bdc857 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrder.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/AbstractPseudonymizeResultsSecondOrder.java @@ -26,17 +26,12 @@ import org.highmed.pseudonymization.crypto.AesGcmUtil; import org.highmed.pseudonymization.domain.PersonWithMdat; import org.highmed.pseudonymization.domain.PseudonymizedPersonWithMdat; -import org.highmed.pseudonymization.domain.impl.MatchedPersonImpl; import org.highmed.pseudonymization.domain.impl.PseudonymizedPersonImpl; import org.highmed.pseudonymization.psn.PseudonymGenerator; import org.highmed.pseudonymization.psn.PseudonymGeneratorImpl; -import org.highmed.pseudonymization.psn.PseudonymizedPersonFactory; import org.highmed.pseudonymization.recordlinkage.FederatedMatcher; -import org.highmed.pseudonymization.recordlinkage.FederatedMatcherImpl; import org.highmed.pseudonymization.recordlinkage.MatchedPerson; -import org.highmed.pseudonymization.recordlinkage.MatchedPersonFactory; import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedic; -import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedicNoRbfImpl; import org.highmed.pseudonymization.translation.ResultSetTranslatorToMedic; import org.highmed.pseudonymization.translation.ResultSetTranslatorToMedicImpl; import org.slf4j.Logger; @@ -45,18 +40,27 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public abstract class PseudonymizeResultsSecondOrder extends AbstractServiceDelegate implements InitializingBean +public abstract class AbstractPseudonymizeResultsSecondOrder extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(PseudonymizeResultsSecondOrder.class); + private static final Logger logger = LoggerFactory.getLogger(AbstractPseudonymizeResultsSecondOrder.class); private final KeyConsumer keyConsumer; + + private final ResultSetTranslatorFromMedic resultSetTranslatorFromMedic; + private final FederatedMatcher<PersonWithMdat> federatedMatcher; + private final ObjectMapper psnObjectMapper; - public PseudonymizeResultsSecondOrder(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper, KeyConsumer keyConsumer, ObjectMapper psnObjectMapper) + public AbstractPseudonymizeResultsSecondOrder(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, KeyConsumer keyConsumer, + ResultSetTranslatorFromMedic resultSetTranslatorFromMedic, + FederatedMatcher<PersonWithMdat> federatedMatcher, ObjectMapper psnObjectMapper) { super(clientProvider, taskHelper, readAccessHelper); + this.keyConsumer = keyConsumer; + this.resultSetTranslatorFromMedic = resultSetTranslatorFromMedic; + this.federatedMatcher = federatedMatcher; this.psnObjectMapper = psnObjectMapper; } @@ -64,7 +68,10 @@ public PseudonymizeResultsSecondOrder(FhirWebserviceClientProvider clientProvide public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); + Objects.requireNonNull(keyConsumer, "keyConsumer"); + Objects.requireNonNull(resultSetTranslatorFromMedic, "resultSetTranslatorFromMedic"); + Objects.requireNonNull(federatedMatcher, "federatedMatcher"); Objects.requireNonNull(psnObjectMapper, "psnObjectMapper"); } @@ -98,15 +105,13 @@ private Map<String, List<QueryResult>> groupByCohortId(QueryResults results) private QueryResults createFinalResults(String researchStudyIdentifier, SecretKey reserchStudyKey, Map<String, List<QueryResult>> groupedResults) { - ResultSetTranslatorFromMedic translatorFromMedic = createResultSetTranslatorFromMedic(); ResultSetTranslatorToMedic translatorToMedic = createResultSetTranslatorToMedic(); - FederatedMatcher<PersonWithMdat> matcher = createFederatedMatcher(); PseudonymGenerator<PersonWithMdat, PseudonymizedPersonWithMdat> psnGenerator = createPseudonymGenerator( researchStudyIdentifier, reserchStudyKey); List<QueryResult> finalResults = groupedResults.entrySet().stream().filter(r -> !r.getValue().isEmpty()) - .map(e -> translateMatchAndPseudonymize(translatorFromMedic, matcher, psnGenerator, translatorToMedic, - e.getKey(), e.getValue())) + .map(e -> translateMatchAndPseudonymize(resultSetTranslatorFromMedic, federatedMatcher, psnGenerator, + translatorToMedic, e.getKey(), e.getValue())) .collect(Collectors.toList()); return new QueryResults(finalResults); @@ -120,7 +125,7 @@ private QueryResult translateMatchAndPseudonymize(ResultSetTranslatorFromMedic t logger.debug("Translating, matching and pseudonymizing results for cohort {}", cohortId); List<List<PersonWithMdat>> persons = translateFromMedicResultSets(translatorFromMedic, results); - Set<MatchedPerson<PersonWithMdat>> matchedPersons = matchPersons(persons, matcher, translatorFromMedic); + Set<MatchedPerson<PersonWithMdat>> matchedPersons = matcher.matchPersons(persons); List<PseudonymizedPersonWithMdat> pseudonymizedPersons = psnGenerator .createPseudonymsAndShuffle(matchedPersons); ResultSet resultSet = translateToMedicResultSet(results.get(0).getResultSet(), translatorToMedic, @@ -142,22 +147,13 @@ private List<PersonWithMdat> translateFromMedicResultSet(ResultSetTranslatorFrom { return translator.translate(toTranslate.getOrganizationIdentifier(), toTranslate.getResultSet()); } - catch (Exception e) + catch (Exception exception) { - logger.warn("Error while translating ResultSet: " + e.getMessage(), e); - throw e; + logger.warn("Error while translating ResultSet: " + exception.getMessage()); + throw exception; } } - private Set<MatchedPerson<PersonWithMdat>> matchPersons(List<List<PersonWithMdat>> persons, - FederatedMatcher<PersonWithMdat> matcher, ResultSetTranslatorFromMedic translator) - { - if (translator instanceof ResultSetTranslatorFromMedicNoRbfImpl) - return persons.stream().flatMap(List::stream).map(MatchedPersonImpl::new).collect(Collectors.toSet()); - else - return matcher.matchPersons(persons); - } - private ResultSet translateToMedicResultSet(ResultSet toTranslate, ResultSetTranslatorToMedic translator, List<PseudonymizedPersonWithMdat> pseudonymizedPersons) { @@ -167,34 +163,22 @@ private ResultSet translateToMedicResultSet(ResultSet toTranslate, ResultSetTran List<Column> columns = toTranslate.getColumns(); return translator.translate(meta, columns, pseudonymizedPersons); } - catch (Exception e) + catch (Exception exception) { - logger.warn("Error while translating ResultSet: " + e.getMessage(), e); - throw e; + logger.warn("Error while translating ResultSet: " + exception.getMessage()); + throw exception; } } - /** - * @return the {@link ResultSetTranslatorFromMedic} that should be used to translate the result sets - */ - protected abstract ResultSetTranslatorFromMedic createResultSetTranslatorFromMedic(); - private ResultSetTranslatorToMedic createResultSetTranslatorToMedic() { return new ResultSetTranslatorToMedicImpl(); } - private FederatedMatcher<PersonWithMdat> createFederatedMatcher() - { - MatchedPersonFactory<PersonWithMdat> matchedPersonFactory = MatchedPersonImpl::new; - return new FederatedMatcherImpl<>(matchedPersonFactory); - } - private PseudonymGenerator<PersonWithMdat, PseudonymizedPersonWithMdat> createPseudonymGenerator( String researchStudyIdentifier, SecretKey researchStudyKey) { - PseudonymizedPersonFactory<PersonWithMdat, PseudonymizedPersonWithMdat> psnPersonFactory = PseudonymizedPersonImpl::new; return new PseudonymGeneratorImpl<>(researchStudyIdentifier, researchStudyKey, psnObjectMapper, - psnPersonFactory); + PseudonymizedPersonImpl::new); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResults.java index 9cc4628f..2ec01e3e 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicMultiMedicResults.java @@ -1,15 +1,12 @@ package org.highmed.dsf.bpe.service; -import java.util.function.BiFunction; -import java.util.stream.Stream; - import org.highmed.dsf.bpe.variable.QueryResult; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.hl7.fhir.r4.model.Task; -public class CheckMedicMultiMedicResults extends CheckResults +public class CheckMedicMultiMedicResults extends AbstractCheckResults { public CheckMedicMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) @@ -18,9 +15,8 @@ public CheckMedicMultiMedicResults(FhirWebserviceClientProvider clientProvider, } @Override - protected Stream<BiFunction<QueryResult, Task, Boolean>> getChecks(QueryResult result, Task task) + protected boolean testResultAndAddPossibleError(QueryResult result, Task task) { - // TODO: define and implement further result set checks - return Stream.of(this::checkColumns, this::checkRows); + return super.testResultAndAddPossibleError(result, task); // TODO: define further checks } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicSingleMedicResults.java index 264c343e..dbfb5997 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicSingleMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckMedicSingleMedicResults.java @@ -7,8 +7,6 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_ERROR_CODE_SINGLE_MEDIC_DATA_SHARING_RESULT; import java.util.List; -import java.util.function.BiFunction; -import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.BpmnError; import org.highmed.dsf.bpe.variable.QueryResult; @@ -19,7 +17,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class CheckMedicSingleMedicResults extends CheckResults +public class CheckMedicSingleMedicResults extends AbstractCheckResults { private static final Logger logger = LoggerFactory.getLogger(CheckMedicSingleMedicResults.class); @@ -30,10 +28,9 @@ public CheckMedicSingleMedicResults(FhirWebserviceClientProvider clientProvider, } @Override - protected Stream<BiFunction<QueryResult, Task, Boolean>> getChecks(QueryResult result, Task task) + protected boolean testResultAndAddPossibleError(QueryResult result, Task task) { - // TODO: define and implement further result set checks - return Stream.of(this::checkColumns, this::checkRows); + return super.testResultAndAddPossibleError(result, task); // TODO: define further checks } @Override diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResults.java index ca96df67..28fca16b 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpMultiMedicResults.java @@ -7,8 +7,6 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_PSEUDONYMIZED_DATA_SHARING_RESULT; import java.util.List; -import java.util.function.BiFunction; -import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.BpmnError; import org.highmed.dsf.bpe.variable.QueryResult; @@ -19,7 +17,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class CheckTtpMultiMedicResults extends CheckResults +public class CheckTtpMultiMedicResults extends AbstractCheckResults { private static final Logger logger = LoggerFactory.getLogger(CheckTtpMultiMedicResults.class); @@ -30,10 +28,9 @@ public CheckTtpMultiMedicResults(FhirWebserviceClientProvider clientProvider, Ta } @Override - protected Stream<BiFunction<QueryResult, Task, Boolean>> getChecks(QueryResult result, Task task) + protected boolean testResultAndAddPossibleError(QueryResult result, Task task) { - // TODO: define and implement further result set checks - return Stream.of(this::checkColumns, this::checkRows); + return super.testResultAndAddPossibleError(result, task); // TODO: define further checks } @Override diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResults.java index 69d306de..f1cd56aa 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResults.java @@ -19,7 +19,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class CheckTtpSingleMedicResults extends CheckResults +public class CheckTtpSingleMedicResults extends AbstractCheckResults { private static final Logger logger = LoggerFactory.getLogger(CheckTtpSingleMedicResults.class); @@ -30,10 +30,9 @@ public CheckTtpSingleMedicResults(FhirWebserviceClientProvider clientProvider, T } @Override - protected Stream<BiFunction<QueryResult, Task, Boolean>> getChecks(QueryResult result, Task task) + protected boolean testResultAndAddPossibleError(QueryResult result, Task task) { - // TODO: define and implement further result set checks - return Stream.of(this::checkColumns, this::checkRows); + return super.testResultAndAddPossibleError(result, task); // TODO: define further checks } @Override diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java index 0174ada9..6c0b35d0 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java @@ -89,10 +89,10 @@ private ResultSet translate(ResultSetTranslatorFromTtp translator, ResultSet toT { return translator.translate(toTranslate); } - catch (Exception e) + catch (Exception exception) { - logger.warn("Error while translating ResultSet: " + e.getMessage(), e); - throw e; + logger.warn("Error while translating ResultSet: " + exception.getMessage()); + throw exception; } } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResults.java index d3038200..5f456dab 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadMultiMedicResults.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class DownloadMultiMedicResults extends DownloadResults +public class DownloadMultiMedicResults extends AbstractDownloadResults { public DownloadMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, ObjectMapper openEhrObjectMapper) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResults.java index ef0169ed..155ff8c4 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadSingleMedicResults.java @@ -13,7 +13,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class DownloadSingleMedicResults extends DownloadResults +public class DownloadSingleMedicResults extends AbstractDownloadResults { public DownloadSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, ObjectMapper openEhrObjectMapper) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java index 395977fa..c551aae4 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java @@ -126,7 +126,7 @@ private ResultSet translate(ResultSetTranslatorToTtp resultSetTranslator, Result } catch (Exception exception) { - logger.warn("Error while encrypting ResultSet: " + exception.getMessage(), exception); + logger.warn("Error while encrypting ResultSet: " + exception.getMessage()); throw exception; } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java index 91fe34e8..13b776ed 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java @@ -46,32 +46,32 @@ public void afterPropertiesSet() throws Exception protected void doExecute(DelegateExecution execution) throws Exception { QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - List<QueryResult> checkedResults = checkResults(results); + List<QueryResult> checkedResults = filterResultsByConsent(results); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(checkedResults))); } - private List<QueryResult> checkResults(QueryResults results) + private List<QueryResult> filterResultsByConsent(QueryResults results) { - return results.getResults().stream().map(result -> checkResult(result)).collect(Collectors.toList()); + return results.getResults().stream().map(result -> filterResultByConsent(result)).collect(Collectors.toList()); } - private QueryResult checkResult(QueryResult result) + private QueryResult filterResultByConsent(QueryResult result) { - ResultSet checkedResultSet = check(result.getResultSet()); + ResultSet checkedResultSet = removeRowsWithoutConsent(result.getResultSet()); return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), checkedResultSet); } - private ResultSet check(ResultSet resultSet) + private ResultSet removeRowsWithoutConsent(ResultSet resultSet) { try { - return consentClient.check(resultSet); + return consentClient.removeRowsWithoutConsent(resultSet); } catch (Exception exception) { - logger.warn("Error while checking ResultSet: " + exception.getMessage(), exception); + logger.warn("Error while filtering ResultSet: " + exception.getMessage()); throw exception; } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java index 322b8fba..b797e1e7 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -116,7 +116,7 @@ private ResultSet translate(ResultSetTranslatorToTtp resultSetTranslator, Result } catch (Exception exception) { - logger.warn("Error while generating bloom filter: " + exception.getMessage(), exception); + logger.warn("Error while generating bloom filter: " + exception.getMessage()); throw exception; } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsFirstOrder.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsFirstOrder.java index b0d6f9f8..89a3321a 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsFirstOrder.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsFirstOrder.java @@ -71,7 +71,7 @@ private ResultSet pseudonymize(ResultSet resultSet) } catch (Exception exception) { - logger.warn("Error while encrypting ResultSet: " + exception.getMessage(), exception); + logger.warn("Error while encrypting ResultSet: " + exception.getMessage()); throw exception; } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrderWithRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrderWithRecordLinkage.java index 6b365a37..795e28b3 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrderWithRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrderWithRecordLinkage.java @@ -4,25 +4,22 @@ import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; -import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedic; -import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedicWithRbfImpl; +import org.highmed.pseudonymization.domain.PersonWithMdat; +import org.highmed.pseudonymization.recordlinkage.FederatedMatcher; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedicWithRbf; import org.springframework.beans.factory.InitializingBean; import com.fasterxml.jackson.databind.ObjectMapper; -public class PseudonymizeResultsSecondOrderWithRecordLinkage extends PseudonymizeResultsSecondOrder +public class PseudonymizeResultsSecondOrderWithRecordLinkage extends AbstractPseudonymizeResultsSecondOrder implements InitializingBean { public PseudonymizeResultsSecondOrderWithRecordLinkage(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, KeyConsumer keyConsumer, - ObjectMapper psnObjectMapper) + ResultSetTranslatorFromMedicWithRbf resultSetTranslatorFromMedicWithRbf, + FederatedMatcher<PersonWithMdat> federatedMatcher, ObjectMapper psnObjectMapper) { - super(clientProvider, taskHelper, readAccessHelper, keyConsumer, psnObjectMapper); - } - - @Override - protected ResultSetTranslatorFromMedic createResultSetTranslatorFromMedic() - { - return new ResultSetTranslatorFromMedicWithRbfImpl(); + super(clientProvider, taskHelper, readAccessHelper, keyConsumer, resultSetTranslatorFromMedicWithRbf, + federatedMatcher, psnObjectMapper); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrderWithoutRecordLinkage.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrderWithoutRecordLinkage.java index 2ab23d2d..7498d765 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrderWithoutRecordLinkage.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/PseudonymizeResultsSecondOrderWithoutRecordLinkage.java @@ -4,25 +4,22 @@ import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; -import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedic; -import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedicNoRbfImpl; +import org.highmed.pseudonymization.domain.PersonWithMdat; +import org.highmed.pseudonymization.recordlinkage.FederatedMatcher; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedicNoRbf; import org.springframework.beans.factory.InitializingBean; import com.fasterxml.jackson.databind.ObjectMapper; -public class PseudonymizeResultsSecondOrderWithoutRecordLinkage extends PseudonymizeResultsSecondOrder +public class PseudonymizeResultsSecondOrderWithoutRecordLinkage extends AbstractPseudonymizeResultsSecondOrder implements InitializingBean { public PseudonymizeResultsSecondOrderWithoutRecordLinkage(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, KeyConsumer keyConsumer, - ObjectMapper psnObjectMapper) + ResultSetTranslatorFromMedicNoRbf resultSetTranslatorFromMedicNoRbf, + FederatedMatcher<PersonWithMdat> federatedMatcher, ObjectMapper psnObjectMapper) { - super(clientProvider, taskHelper, readAccessHelper, keyConsumer, psnObjectMapper); - } - - @Override - protected ResultSetTranslatorFromMedic createResultSetTranslatorFromMedic() - { - return new ResultSetTranslatorFromMedicNoRbfImpl(); + super(clientProvider, taskHelper, readAccessHelper, keyConsumer, resultSetTranslatorFromMedicNoRbf, + federatedMatcher, psnObjectMapper); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index f3159595..2bb61438 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -12,6 +12,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; import java.util.List; import java.util.Objects; import java.util.Random; @@ -43,7 +44,7 @@ public class SelectRequestTargets extends AbstractServiceDelegate implements InitializingBean { - private final Random random = new Random(); + private final Random random = new SecureRandom(); private final EndpointProvider endpointProvider; private final KeyGenerator hmacSha2Generator; @@ -64,9 +65,9 @@ public SelectRequestTargets(FhirWebserviceClientProvider clientProvider, TaskHel hmacSha2Generator = KeyGenerator.getInstance("HmacSHA256", bouncyCastleProvider); hmacSha3Generator = KeyGenerator.getInstance("HmacSHA3-256", bouncyCastleProvider); } - catch (NoSuchAlgorithmException e) + catch (NoSuchAlgorithmException exception) { - throw new RuntimeException(e); + throw new RuntimeException(exception); } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java index 34158176..f9b38214 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreResults.java @@ -115,10 +115,10 @@ private byte[] serializeResultSet(ResultSet resultSet) { return openEhrObjectMapper.writeValueAsBytes(resultSet); } - catch (JsonProcessingException e) + catch (JsonProcessingException exception) { - logger.warn("Error while serializing ResultSet: " + e.getMessage(), e); - throw new RuntimeException(e); + logger.warn("Error while serializing ResultSet: " + exception.getMessage()); + throw new RuntimeException(exception); } } @@ -128,11 +128,11 @@ private IdType createBinaryResource(Binary binary) { return getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().create(binary); } - catch (Exception e) + catch (Exception exception) { logger.debug("Binary to create {}", FhirContext.forR4().newJsonParser().encodeResourceToString(binary)); - logger.warn("Error while creating Binary resoruce: " + e.getMessage(), e); - throw e; + logger.warn("Error while creating Binary resoruce: " + exception.getMessage()); + throw exception; } } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java index eb617dc7..11343a4d 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingConfig.java @@ -54,6 +54,15 @@ import org.highmed.openehr.client.OpenEhrClientFactory; import org.highmed.pseudonymization.client.PseudonymizationClient; import org.highmed.pseudonymization.client.PseudonymizationClientFactory; +import org.highmed.pseudonymization.domain.PersonWithMdat; +import org.highmed.pseudonymization.domain.impl.MatchedPersonImpl; +import org.highmed.pseudonymization.recordlinkage.AbstractMatcher; +import org.highmed.pseudonymization.recordlinkage.FederatedMatcher; +import org.highmed.pseudonymization.recordlinkage.FederatedMatcherImpl; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedicNoRbf; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedicNoRbfImpl; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedicWithRbf; +import org.highmed.pseudonymization.translation.ResultSetTranslatorFromMedicWithRbfImpl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; @@ -225,17 +234,42 @@ public KeyConsumer keyConsumer() } @Bean - public PseudonymizeResultsSecondOrderWithRecordLinkage pseudonymizeQueryResultsSecondOrderWithRecordLinkage() + public ResultSetTranslatorFromMedicWithRbf resultSetTranslatorFromMedicWithRbf() + { + return new ResultSetTranslatorFromMedicWithRbfImpl(); + } + + @Bean + public FederatedMatcher<PersonWithMdat> createFederatedMatcherStrategyMin() + { + return new FederatedMatcherImpl<>(MatchedPersonImpl::new, AbstractMatcher.MatchCalculatorStrategy.MIN); + } + + @Bean + public PseudonymizeResultsSecondOrderWithRecordLinkage pseudonymizeResultsSecondOrderWithRecordLinkage() { return new PseudonymizeResultsSecondOrderWithRecordLinkage(fhirClientProvider, taskHelper, readAccessHelper, - keyConsumer(), objectMapper); + keyConsumer(), resultSetTranslatorFromMedicWithRbf(), createFederatedMatcherStrategyMin(), + objectMapper); + } + + @Bean + public ResultSetTranslatorFromMedicNoRbf resultSetTranslatorFromMedicNoRbf() + { + return new ResultSetTranslatorFromMedicNoRbfImpl(); + } + + @Bean + public FederatedMatcher<PersonWithMdat> createFederatedMatcherStrategyNone() + { + return new FederatedMatcherImpl<>(MatchedPersonImpl::new, AbstractMatcher.MatchCalculatorStrategy.NONE); } @Bean - public PseudonymizeResultsSecondOrderWithoutRecordLinkage pseudonymizeQueryResultsSecondOrderWithoutRecordLinkage() + public PseudonymizeResultsSecondOrderWithoutRecordLinkage pseudonymizeResultsSecondOrderWithoutRecordLinkage() { return new PseudonymizeResultsSecondOrderWithoutRecordLinkage(fhirClientProvider, taskHelper, readAccessHelper, - keyConsumer(), objectMapper); + keyConsumer(), resultSetTranslatorFromMedicNoRbf(), createFederatedMatcherStrategyNone(), objectMapper); } @Bean diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java index 27d1f695..b5c0fa56 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java @@ -12,7 +12,6 @@ import java.util.Objects; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.camunda.bpm.engine.delegate.JavaDelegate; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java index 86311239..b878c467 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -141,12 +141,12 @@ private void checkConsortiumAffiliation(List<String> identifiersConsortium, List { logger.warn( "Organizations with identifiers='{}' are part of feasibility research study with id='{}' but do " - + "not belong to the consortium with id='{}'", + + "not belong to the consortium with identifier='{}'", identifiersWrongConsortium, researchStudyId, consortiumIdentifier); throw new RuntimeException("Organizations with identifiers='" + identifiersWrongConsortium + "' are part of feasibility research study with id='" + researchStudyId - + "' but do not belong to the consortium with id='" + consortiumIdentifier + "'"); + + "' but do not belong to the consortium with identifier='" + consortiumIdentifier + "'"); } } @@ -183,7 +183,7 @@ private ResearchStudy update(ResearchStudy researchStudy, FhirWebserviceClient c } catch (Exception e) { - logger.warn("Error while updating ResearchStudy resoruce: " + e.getMessage(), e); + logger.warn("Error while updating ResearchStudy resource: " + e.getMessage(), e); throw e; } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResults.java index 41859cd4..f30bf278 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResults.java @@ -29,7 +29,7 @@ public class DownloadResults extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(DownloadResults.class); + private static final Logger logger = LoggerFactory.getLogger(AbstractDownloadResults.class); private final ObjectMapper openEhrObjectMapper; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java index 91fe34e8..13b776ed 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java @@ -46,32 +46,32 @@ public void afterPropertiesSet() throws Exception protected void doExecute(DelegateExecution execution) throws Exception { QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); - List<QueryResult> checkedResults = checkResults(results); + List<QueryResult> checkedResults = filterResultsByConsent(results); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, QueryResultsValues.create(new QueryResults(checkedResults))); } - private List<QueryResult> checkResults(QueryResults results) + private List<QueryResult> filterResultsByConsent(QueryResults results) { - return results.getResults().stream().map(result -> checkResult(result)).collect(Collectors.toList()); + return results.getResults().stream().map(result -> filterResultByConsent(result)).collect(Collectors.toList()); } - private QueryResult checkResult(QueryResult result) + private QueryResult filterResultByConsent(QueryResult result) { - ResultSet checkedResultSet = check(result.getResultSet()); + ResultSet checkedResultSet = removeRowsWithoutConsent(result.getResultSet()); return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), checkedResultSet); } - private ResultSet check(ResultSet resultSet) + private ResultSet removeRowsWithoutConsent(ResultSet resultSet) { try { - return consentClient.check(resultSet); + return consentClient.removeRowsWithoutConsent(resultSet); } catch (Exception exception) { - logger.warn("Error while checking ResultSet: " + exception.getMessage(), exception); + logger.warn("Error while filtering ResultSet: " + exception.getMessage()); throw exception; } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java index defd6521..b8c0b1e7 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -170,10 +170,10 @@ private byte[] serializeResultSet(ResultSet resultSet) { return openEhrObjectMapper.writeValueAsBytes(resultSet); } - catch (JsonProcessingException e) + catch (JsonProcessingException exception) { - logger.warn("Error while serializing ResultSet: " + e.getMessage(), e); - throw new RuntimeException(e); + logger.warn("Error while serializing ResultSet: " + exception.getMessage()); + throw new RuntimeException(exception); } } @@ -183,11 +183,11 @@ private IdType createBinaryResource(Binary binary) { return getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().create(binary); } - catch (Exception e) + catch (Exception exception) { logger.debug("Binary to create {}", FhirContext.forR4().newJsonParser().encodeResourceToString(binary)); - logger.warn("Error while creating Binary resoruce: " + e.getMessage(), e); - throw e; + logger.warn("Error while creating Binary resource: " + exception.getMessage()); + throw exception; } } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index 82700434..995668cf 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -13,6 +13,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import java.security.NoSuchAlgorithmException; +import java.security.SecureRandom; import java.util.List; import java.util.Objects; import java.util.Random; @@ -41,7 +42,7 @@ public class SelectRequestTargets extends AbstractServiceDelegate { - private static final Random random = new Random(); + private static final Random random = new SecureRandom(); private final EndpointProvider endpointProvider; private final KeyGenerator hmacSha2Generator; @@ -62,9 +63,9 @@ public SelectRequestTargets(FhirWebserviceClientProvider clientProvider, TaskHel hmacSha2Generator = KeyGenerator.getInstance("HmacSHA256", bouncyCastleProvider); hmacSha3Generator = KeyGenerator.getInstance("HmacSHA3-256", bouncyCastleProvider); } - catch (NoSuchAlgorithmException e) + catch (NoSuchAlgorithmException exception) { - throw new RuntimeException(e); + throw new RuntimeException(exception); } } diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn index f3dd3b5e..35ffdc60 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn +++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn @@ -88,7 +88,7 @@ <bpmn:outgoing>Flow_1k0sqwo</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0zp76kj" sourceRef="downloadResults" targetRef="executeRecordLink" /> - <bpmn:serviceTask id="downloadResults" name="download results" camunda:class="org.highmed.dsf.bpe.service.DownloadResults"> + <bpmn:serviceTask id="downloadResults" name="download results" camunda:class="org.highmed.dsf.bpe.service.AbstractDownloadResults"> <bpmn:incoming>SequenceFlow_0calilw</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0zp76kj</bpmn:outgoing> </bpmn:serviceTask> diff --git a/pom.xml b/pom.xml index 95973953..f9671c34 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ </properties> <name>highmed-processes</name> - <description>HiGHmed DSF HiGHmed Processes</description> + <description>Processes of the HiGHmed consortium to be deployed on the HiGHmed DSF</description> <url>https://github.com/highmed/highmed-processes</url> <scm> From 044945d41c660799031444831272f041be3ebd8e Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 27 Oct 2021 16:56:30 +0200 Subject: [PATCH 065/125] remove unused imports --- .../org/highmed/dsf/bpe/service/CheckTtpSingleMedicResults.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResults.java index f1cd56aa..abee56d0 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/CheckTtpSingleMedicResults.java @@ -7,8 +7,6 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_PSEUDONYMIZED_DATA_SHARING_RESULT; import java.util.List; -import java.util.function.BiFunction; -import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.BpmnError; import org.highmed.dsf.bpe.variable.QueryResult; From e6333037bf630126b4d5f2f0798d4fcdabf068d0 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 27 Oct 2021 19:27:23 +0200 Subject: [PATCH 066/125] fix typo --- .../src/main/resources/bpe/computeFeasibility.bpmn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn index 35ffdc60..f3dd3b5e 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn +++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn @@ -88,7 +88,7 @@ <bpmn:outgoing>Flow_1k0sqwo</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_0zp76kj" sourceRef="downloadResults" targetRef="executeRecordLink" /> - <bpmn:serviceTask id="downloadResults" name="download results" camunda:class="org.highmed.dsf.bpe.service.AbstractDownloadResults"> + <bpmn:serviceTask id="downloadResults" name="download results" camunda:class="org.highmed.dsf.bpe.service.DownloadResults"> <bpmn:incoming>SequenceFlow_0calilw</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0zp76kj</bpmn:outgoing> </bpmn:serviceTask> From a4695692916501224f3ebacc401480a17422c2b2 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 27 Oct 2021 20:11:09 +0200 Subject: [PATCH 067/125] set record-linkage and consent-check to true --- ...ctRequestDataSharingFromMedicsViaMedic1ExampleStarter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java index 72445a2b..ac7ecc6b 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter.java @@ -48,8 +48,8 @@ public abstract class AbstractRequestDataSharingFromMedicsViaMedic1ExampleStarter { - private final boolean needsConsentCheck = false; - private final boolean needsRecordLinkage = false; + private final boolean needsConsentCheck = true; + private final boolean needsRecordLinkage = true; private final String requestFormReference = "https://foo/fhir/Binary/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; private final String contractReference = "https://foo/fhir/Binary/9f747003-5d80-4313-b77f-d6dbe2ef4c55"; From 006ff8eb1c3c8b147ade655a0260aa2e54de2def Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 27 Oct 2021 22:01:26 +0200 Subject: [PATCH 068/125] adds wrapper for AES key --- .../dsf/bpe/message/SendMedicRequest.java | 10 +-- .../bpe/service/DecryptMultiMedicResults.java | 6 +- .../service/DownloadDataSharingResources.java | 12 ++-- .../dsf/bpe/service/EncryptResults.java | 6 +- .../dsf/bpe/service/SelectRequestTargets.java | 7 +- .../config/DataSharingSerializerConfig.java | 7 ++ .../dsf/bpe/variable/SecretKeyWrapper.java | 70 +++++++++++++++++++ .../variable/SecretKeyWrapperSerializer.java | 70 +++++++++++++++++++ .../bpe/variable/SecretKeyWrapperValues.java | 54 ++++++++++++++ 9 files changed, 227 insertions(+), 15 deletions(-) create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapperSerializer.java create mode 100644 dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapperValues.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java index 4670d7d1..b53925fc 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequest.java @@ -16,6 +16,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.variable.BloomFilterConfig; +import org.highmed.dsf.bpe.variable.SecretKeyWrapper; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; @@ -49,8 +50,9 @@ protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecut boolean needsRecordLinkage = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); ParameterComponent inputNeedsRecordLinkage = createNeedsRecordLinkageComponent(needsRecordLinkage); - byte[] mdatKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); - ParameterComponent inputMdatKey = createMdatKeyComponent(mdatKey); + SecretKeyWrapper secretKeyWrapper = (SecretKeyWrapper) execution + .getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); + ParameterComponent inputMdatKey = createMdatKeyComponent(secretKeyWrapper); if (needsRecordLinkage) { @@ -89,10 +91,10 @@ private Task.ParameterComponent createNeedsRecordLinkageComponent(boolean needsR CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); } - private Task.ParameterComponent createMdatKeyComponent(byte[] mdatKey) + private Task.ParameterComponent createMdatKeyComponent(SecretKeyWrapper secretKeyWrapper) { return getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY, mdatKey); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY, secretKeyWrapper.getBytes()); } private Task.ParameterComponent getBloomFilterConfigComponent(BloomFilterConfig bloomFilterConfig) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java index 6c0b35d0..eea0ef05 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java @@ -16,6 +16,7 @@ import org.highmed.dsf.bpe.variable.QueryResult; import org.highmed.dsf.bpe.variable.QueryResults; import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.bpe.variable.SecretKeyWrapper; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -63,8 +64,9 @@ protected void doExecute(DelegateExecution execution) throws Exception private SecretKey getMdatKey(DelegateExecution execution) { - byte[] encodedKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); - return new SecretKeySpec(encodedKey, "AES"); + SecretKeyWrapper secretKeyWrapper = (SecretKeyWrapper) execution + .getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); + return secretKeyWrapper.getSecretKey(); } private ResultSetTranslatorFromTtp createResultSetTranslator(String researchStudyIdentifier, diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java index b652488b..f5e7f8fc 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DownloadDataSharingResources.java @@ -25,6 +25,8 @@ import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.highmed.dsf.bpe.variable.BloomFilterConfigValues; +import org.highmed.dsf.bpe.variable.SecretKeyWrapper; +import org.highmed.dsf.bpe.variable.SecretKeyWrapperValues; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; @@ -87,8 +89,8 @@ protected void doExecute(DelegateExecution execution) boolean needsRecordLinkage = getNeedsRecordLinkageCheck(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE, needsRecordLinkage); - byte[] mdatKey = getMdatKey(task); - execution.setVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY, mdatKey); + SecretKeyWrapper secretKey = getMdatKey(task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY, SecretKeyWrapperValues.create(secretKey)); if (needsRecordLinkage) { @@ -204,13 +206,15 @@ private boolean getNeedsRecordLinkageCheck(Task task) + task.getId() + "', this error should " + "have been caught by resource validation")); } - private byte[] getMdatKey(Task task) + private SecretKeyWrapper getMdatKey(Task task) { - return getTaskHelper() + byte[] bytes = getTaskHelper() .getFirstInputParameterByteValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MDAT_AES_KEY) .orElseThrow(() -> new IllegalArgumentException("mdat aes key is not set in task with id='" + task.getId() + "', this error should " + "have been caught by resource validation")); + + return SecretKeyWrapper.fromAes256Key(bytes); } private BloomFilterConfig getBloomFilterConfig(Task task) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java index c551aae4..0af13dfe 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java @@ -18,6 +18,7 @@ import org.highmed.dsf.bpe.variable.QueryResult; import org.highmed.dsf.bpe.variable.QueryResults; import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.bpe.variable.SecretKeyWrapper; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; @@ -94,8 +95,9 @@ private String getResearchStudyIdentifier(DelegateExecution execution) private SecretKey getMdatKey(DelegateExecution execution) { - byte[] encodedKey = (byte[]) execution.getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); - return new SecretKeySpec(encodedKey, "AES"); + SecretKeyWrapper secretKeyWrapper = (SecretKeyWrapper) execution + .getVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY); + return secretKeyWrapper.getSecretKey(); } private ResultSetTranslatorToTtpEncrypt createResultSetTranslator(String organizationIdentifier, diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index 2bb61438..6f62e62e 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -27,6 +27,8 @@ import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.BloomFilterConfig; import org.highmed.dsf.bpe.variable.BloomFilterConfigValues; +import org.highmed.dsf.bpe.variable.SecretKeyWrapper; +import org.highmed.dsf.bpe.variable.SecretKeyWrapperValues; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.EndpointProvider; @@ -35,7 +37,6 @@ import org.highmed.dsf.fhir.variables.TargetValues; import org.highmed.dsf.fhir.variables.Targets; import org.highmed.dsf.fhir.variables.TargetsValues; -import org.highmed.pseudonymization.crypto.AesGcmUtil; import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; @@ -89,8 +90,8 @@ protected void doExecute(DelegateExecution execution) throws Exception Target ttpTarget = getTtpTarget(researchStudy); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(ttpTarget)); - byte[] mdatKey = AesGcmUtil.generateAES256Key().getEncoded(); - execution.setVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY, mdatKey); + SecretKeyWrapper secretKey = SecretKeyWrapper.newAes256Key(); + execution.setVariable(BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY, SecretKeyWrapperValues.create(secretKey)); Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); if (Boolean.TRUE.equals(needsRecordLinkage)) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java index 3ac056e3..c4da4e58 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/spring/config/DataSharingSerializerConfig.java @@ -3,6 +3,7 @@ import org.highmed.dsf.bpe.variable.BloomFilterConfigSerializer; import org.highmed.dsf.bpe.variable.QueryResultSerializer; import org.highmed.dsf.bpe.variable.QueryResultsSerializer; +import org.highmed.dsf.bpe.variable.SecretKeyWrapperSerializer; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -32,4 +33,10 @@ public QueryResultsSerializer queryResultsSerializer() { return new QueryResultsSerializer(objectMapper); } + + @Bean + public SecretKeyWrapperSerializer secretKeyWrapperSerializer() + { + return new SecretKeyWrapperSerializer(objectMapper); + } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java new file mode 100644 index 00000000..3a410921 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java @@ -0,0 +1,70 @@ +package org.highmed.dsf.bpe.variable; + +import java.security.NoSuchAlgorithmException; + +import javax.crypto.SecretKey; +import javax.crypto.spec.SecretKeySpec; + +import org.highmed.pseudonymization.crypto.AesGcmUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class SecretKeyWrapper +{ + private static final Logger logger = LoggerFactory.getLogger(SecretKeyWrapper.class); + private static final String AES_ALGORITHM = "AES"; + + public static SecretKeyWrapper newAes256Key() + { + try + { + return new SecretKeyWrapper(AesGcmUtil.generateAES256Key().getEncoded(), AES_ALGORITHM); + } + catch (NoSuchAlgorithmException exception) + { + logger.warn("Could not create new AES256 key: {}", exception.getMessage()); + throw new RuntimeException(exception); + } + } + + public static SecretKeyWrapper fromAes256Key(byte[] key) + { + byte[] bytes = new byte[key.length]; + System.arraycopy(key, 0, bytes, 0, bytes.length); + + return new SecretKeyWrapper(bytes, AES_ALGORITHM); + } + + private final byte[] bytes; + private final String algorithm; + + @JsonCreator + public SecretKeyWrapper(@JsonProperty("bytes") byte[] bytes, @JsonProperty("algorithm") String algorithm) + { + this.bytes = bytes; + this.algorithm = algorithm; + } + + @JsonIgnore + public SecretKey getSecretKey() + { + return new SecretKeySpec(bytes, algorithm); + } + + public String getAlgorithm() + { + return algorithm; + } + + public byte[] getBytes() + { + byte[] key = new byte[bytes.length]; + System.arraycopy(bytes, 0, key, 0, key.length); + + return key; + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapperSerializer.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapperSerializer.java new file mode 100644 index 00000000..ab24e5ec --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapperSerializer.java @@ -0,0 +1,70 @@ +package org.highmed.dsf.bpe.variable; + +import java.io.IOException; +import java.util.Objects; + +import org.camunda.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer; +import org.camunda.bpm.engine.impl.variable.serializer.ValueFields; +import org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl; +import org.highmed.dsf.bpe.variable.SecretKeyWrapperValues.SecretKeyWrapperValue; +import org.springframework.beans.factory.InitializingBean; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class SecretKeyWrapperSerializer extends PrimitiveValueSerializer<SecretKeyWrapperValue> + implements InitializingBean +{ + private final ObjectMapper objectMapper; + + public SecretKeyWrapperSerializer(ObjectMapper objectMapper) + { + super(SecretKeyWrapperValues.VALUE_TYPE); + + this.objectMapper = objectMapper; + } + + @Override + public void afterPropertiesSet() throws Exception + { + Objects.requireNonNull(objectMapper, "objectMapper"); + } + + @Override + public void writeValue(SecretKeyWrapperValue value, ValueFields valueFields) + { + SecretKeyWrapper target = value.getValue(); + try + { + if (target != null) + valueFields.setByteArrayValue(objectMapper.writeValueAsBytes(target)); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } + } + + @Override + public SecretKeyWrapperValue convertToTypedValue(UntypedValueImpl untypedValue) + { + return SecretKeyWrapperValues.create((SecretKeyWrapper) untypedValue.getValue()); + } + + @Override + public SecretKeyWrapperValue readValue(ValueFields valueFields, boolean asTransientValue) + { + byte[] bytes = valueFields.getByteArrayValue(); + + try + { + SecretKeyWrapper target = (bytes == null || bytes.length <= 0) ? null + : objectMapper.readValue(bytes, SecretKeyWrapper.class); + return SecretKeyWrapperValues.create(target); + } + catch (IOException e) + { + throw new RuntimeException(e); + } + } +} diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapperValues.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapperValues.java new file mode 100644 index 00000000..579bd9fe --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapperValues.java @@ -0,0 +1,54 @@ +package org.highmed.dsf.bpe.variable; + +import java.util.Map; + +import org.camunda.bpm.engine.variable.impl.type.PrimitiveValueTypeImpl; +import org.camunda.bpm.engine.variable.impl.value.PrimitiveTypeValueImpl; +import org.camunda.bpm.engine.variable.type.PrimitiveValueType; +import org.camunda.bpm.engine.variable.value.PrimitiveValue; +import org.camunda.bpm.engine.variable.value.TypedValue; + +public class SecretKeyWrapperValues +{ + public static interface SecretKeyWrapperValue extends PrimitiveValue<SecretKeyWrapper> + { + } + + private static class SecretKeyWrapperValueImpl extends PrimitiveTypeValueImpl<SecretKeyWrapper> + implements SecretKeyWrapperValues.SecretKeyWrapperValue + { + private static final long serialVersionUID = 1L; + + public SecretKeyWrapperValueImpl(SecretKeyWrapper value, PrimitiveValueType type) + { + super(value, type); + } + } + + public static class SecretKeyWrapperValueTypeImpl extends PrimitiveValueTypeImpl + { + private static final long serialVersionUID = 1L; + + private SecretKeyWrapperValueTypeImpl() + { + super(SecretKeyWrapper.class); + } + + @Override + public TypedValue createValue(Object value, Map<String, Object> valueInfo) + { + return new SecretKeyWrapperValues.SecretKeyWrapperValueImpl((SecretKeyWrapper) value, VALUE_TYPE); + } + } + + public static final PrimitiveValueType VALUE_TYPE = new SecretKeyWrapperValues.SecretKeyWrapperValueTypeImpl(); + + private SecretKeyWrapperValues() + { + } + + public static SecretKeyWrapperValues.SecretKeyWrapperValue create(SecretKeyWrapper value) + { + return new SecretKeyWrapperValues.SecretKeyWrapperValueImpl(value, VALUE_TYPE); + } +} From c7f6dc6fe28170f0123409c1dd3b6b92c324bce8 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Wed, 24 Nov 2021 12:11:58 +0100 Subject: [PATCH 069/125] removed not needed imports, added a few blank lines --- .../org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java | 3 ++- .../main/java/org/highmed/dsf/bpe/service/EncryptResults.java | 1 - .../java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java | 1 - .../org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java | 3 ++- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java index eea0ef05..93f394f7 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/DecryptMultiMedicResults.java @@ -9,7 +9,6 @@ import java.util.stream.Collectors; import javax.crypto.SecretKey; -import javax.crypto.spec.SecretKeySpec; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; @@ -39,6 +38,7 @@ public DecryptMultiMedicResults(FhirWebserviceClientProvider clientProvider, Tas ReadAccessHelper readAccessHelper, ObjectMapper openEhrObjectMapper) { super(clientProvider, taskHelper, readAccessHelper); + this.openEhrObjectMapper = openEhrObjectMapper; } @@ -46,6 +46,7 @@ public DecryptMultiMedicResults(FhirWebserviceClientProvider clientProvider, Tas public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); + Objects.requireNonNull(openEhrObjectMapper, "openEhrObjectMapper"); } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java index 0af13dfe..c7148f0d 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/EncryptResults.java @@ -10,7 +10,6 @@ import java.util.stream.Collectors; import javax.crypto.SecretKey; -import javax.crypto.spec.SecretKeySpec; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.crypto.KeyProvider; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java index b797e1e7..eec53075 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/GenerateBloomFilters.java @@ -8,7 +8,6 @@ import java.util.stream.Collectors; import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.variable.BloomFilterConfig; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java index 13471ce5..f36a0d2a 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java @@ -15,7 +15,6 @@ import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.EndpointProvider; -import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.TargetValues; @@ -29,6 +28,7 @@ public SelectResponseTargetTtp(FhirWebserviceClientProvider clientProvider, Task ReadAccessHelper readAccessHelper, EndpointProvider endpointProvider) { super(clientProvider, taskHelper, readAccessHelper); + this.endpointProvider = endpointProvider; } @@ -36,6 +36,7 @@ public SelectResponseTargetTtp(FhirWebserviceClientProvider clientProvider, Task public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); + Objects.requireNonNull(endpointProvider, "endpointProvider"); } From f0d6a2782aed31d1d8bdc7dd59f5ac50f96b9cd9 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Wed, 24 Nov 2021 12:47:09 +0100 Subject: [PATCH 070/125] Made constructor of SecretKeyWrapper private Since the constructor does not clone the bytes array, the constructor needs to be private in order to be in full control of all field values. Values of an externally created not cloned byte array, could be modified externally without the SecretKeyWrapper class knowing about it. --- .../dsf/bpe/variable/SecretKeyWrapper.java | 2 +- .../bpe/variables/SecretKeyWrapperTest.java | 56 +++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/SecretKeyWrapperTest.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java index 3a410921..25af2797 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java @@ -43,7 +43,7 @@ public static SecretKeyWrapper fromAes256Key(byte[] key) private final String algorithm; @JsonCreator - public SecretKeyWrapper(@JsonProperty("bytes") byte[] bytes, @JsonProperty("algorithm") String algorithm) + private SecretKeyWrapper(@JsonProperty("bytes") byte[] bytes, @JsonProperty("algorithm") String algorithm) { this.bytes = bytes; this.algorithm = algorithm; diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/SecretKeyWrapperTest.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/SecretKeyWrapperTest.java new file mode 100644 index 00000000..974e5166 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/SecretKeyWrapperTest.java @@ -0,0 +1,56 @@ +package org.highmed.dsf.bpe.variables; + +import static org.junit.Assert.*; + +import org.highmed.dsf.bpe.variable.SecretKeyWrapper; +import org.highmed.pseudonymization.crypto.AesGcmUtil; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class SecretKeyWrapperTest +{ + private static final Logger logger = LoggerFactory.getLogger(SecretKeyWrapperTest.class); + + @Test + public void testReadWriteJson() throws Exception + { + ObjectMapper objectMapper = new ObjectMapper(); + + SecretKeyWrapper key = SecretKeyWrapper.newAes256Key(); + + String value = objectMapper.writeValueAsString(key); + + logger.debug("SecretKeyWrapper: {}", value); + + SecretKeyWrapper readkey = objectMapper.readValue(value, SecretKeyWrapper.class); + + assertNotNull(readkey); + assertEquals(key.getAlgorithm(), readkey.getAlgorithm()); + assertArrayEquals(key.getBytes(), readkey.getBytes()); + assertEquals(key.getSecretKey(), readkey.getSecretKey()); + } + + @Test + public void testReadWriteJsonFromBytes() throws Exception + { + ObjectMapper objectMapper = new ObjectMapper(); + + byte[] bytes = AesGcmUtil.generateAES256Key().getEncoded(); + SecretKeyWrapper key = SecretKeyWrapper.fromAes256Key(bytes); + assertArrayEquals(bytes, key.getBytes()); + + String value = objectMapper.writeValueAsString(key); + + logger.debug("SecretKeyWrapper: {}", value); + + SecretKeyWrapper readkey = objectMapper.readValue(value, SecretKeyWrapper.class); + + assertNotNull(readkey); + assertEquals(key.getAlgorithm(), readkey.getAlgorithm()); + assertArrayEquals(key.getBytes(), readkey.getBytes()); + assertEquals(key.getSecretKey(), readkey.getSecretKey()); + } +} From 8571bbf651618210424c3fc9d4106c4518003152 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Wed, 24 Nov 2021 13:25:23 +0100 Subject: [PATCH 071/125] added not null check for resultSetReferenceCodeSystemValue field --- .../java/org/highmed/dsf/bpe/message/SendResults.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java index 6750dc89..fcb9be42 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java @@ -4,6 +4,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import java.util.Objects; import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -38,6 +39,14 @@ public SendResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskH this.resultSetReferenceCodeSystemValue = resultSetReferenceCodeSystemValue; } + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(resultSetReferenceCodeSystemValue, "resultSetReferenceCodeSystemValue"); + } + @Override protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { From bc65b9acc834d4e6b4806b5e2adbdaf475d90318 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Wed, 24 Nov 2021 13:27:51 +0100 Subject: [PATCH 072/125] renamed SendResults to AbstractSendResults --- .../message/{SendResults.java => AbstractSendResults.java} | 6 +++--- .../org/highmed/dsf/bpe/message/SendMultiMedicResults.java | 2 +- .../org/highmed/dsf/bpe/message/SendSingleMedicResults.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) rename dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/{SendResults.java => AbstractSendResults.java} (91%) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/AbstractSendResults.java similarity index 91% rename from dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java rename to dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/AbstractSendResults.java index fcb9be42..7e275c27 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/AbstractSendResults.java @@ -24,13 +24,13 @@ import ca.uhn.fhir.context.FhirContext; -public abstract class SendResults extends AbstractTaskMessageSend +public abstract class AbstractSendResults extends AbstractTaskMessageSend { - private static final Logger logger = LoggerFactory.getLogger(SendResults.class); + private static final Logger logger = LoggerFactory.getLogger(AbstractSendResults.class); private final String resultSetReferenceCodeSystemValue; - public SendResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public AbstractSendResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext, String resultSetReferenceCodeSystemValue) { diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java index df8753d5..98cfbb84 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResults.java @@ -9,7 +9,7 @@ import ca.uhn.fhir.context.FhirContext; -public class SendMultiMedicResults extends SendResults +public class SendMultiMedicResults extends AbstractSendResults { public SendMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java index 337becd7..d117da35 100755 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResults.java @@ -9,7 +9,7 @@ import ca.uhn.fhir.context.FhirContext; -public class SendSingleMedicResults extends SendResults +public class SendSingleMedicResults extends AbstractSendResults { public SendSingleMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) From 7acd913de062ed2666c97ffa8bde4e7dca1daa74 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 28 Jan 2022 19:50:15 +0100 Subject: [PATCH 073/125] initial smpc process --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 2 + .../fhir/CodeSystem/highmed-data-sharing.xml | 10 + dsf-bpe-process-feasibility-mpc/pom.xml | 299 ++++++++++++++++ .../dsf/bpe/ConstantsFeasibilityMpc.java | 57 +++ ...FeasibilityMpcProcessPluginDefinition.java | 88 +++++ .../message/SendMedicRequestMultiShare.java | 40 +++ .../message/SendMedicRequestSingleShare.java | 49 +++ .../message/SendMultiMedicResultShare.java | 54 +++ .../message/SendSingleMedicResultShare.java | 58 +++ .../CalculateMulitMedicResultShares.java | 26 ++ .../CalculateSingleMedicResultShares.java | 26 ++ .../service/CheckFeasibilityMpcResources.java | 74 ++++ .../bpe/service/CheckMultiMedicResults.java | 26 ++ .../highmed/dsf/bpe/service/CheckQueries.java | 81 +++++ .../service/CheckSingleMedicResultShares.java | 26 ++ .../service/ComputeMultiMedicResultShare.java | 26 ++ .../DownloadFeasibilityMpcResources.java | 166 +++++++++ .../DownloadResearchStudyResource.java | 211 +++++++++++ .../dsf/bpe/service/ExecuteQueries.java | 83 +++++ .../bpe/service/FilterResultsByConsent.java | 78 ++++ .../dsf/bpe/service/GenerateCountFromIds.java | 46 +++ .../dsf/bpe/service/ModifyQueries.java | 74 ++++ ...ctMultiMedicResultShareResponseTarget.java | 56 +++ .../SelectMultiMedicResultShareTargets.java | 79 ++++ .../SelectSingleMedicResultShareTargets.java | 79 ++++ .../service/StoreResultsMultiMedicShare.java | 71 ++++ .../service/StoreResultsSingleMedicShare.java | 72 ++++ ...SingleMedicResultShareCorrelationKeys.java | 53 +++ .../spring/config/FeasibilityMpcConfig.java | 244 +++++++++++++ .../FeasibilityMpcSerializerConfig.java | 28 ++ .../FinalFeasibilityMpcQueryResult.java | 35 ++ ...alFeasibilityMpcQueryResultSerializer.java | 70 ++++ .../FinalFeasibilityMpcQueryResultValues.java | 57 +++ .../FinalFeasibilityMpcQueryResults.java | 39 ++ ...lFeasibilityMpcQueryResultsSerializer.java | 70 ++++ ...FinalFeasibilityMpcQueryResultsValues.java | 57 +++ ...rg.highmed.dsf.bpe.ProcessPluginDefinition | 1 + .../bpe/executeFeasibilityMpcMultiShare.bpmn | 168 +++++++++ .../bpe/executeFeasibilityMpcSingleShare.bpmn | 270 ++++++++++++++ .../resources/bpe/requestFeasibilityMpc.bpmn | 232 ++++++++++++ ...ighmed-executeFeasibilityMpcMultiShare.xml | 168 +++++++++ ...ghmed-executeFeasibilityMpcSingleShare.xml | 100 ++++++ .../highmed-requestFeasibilityMpc.xml | 144 ++++++++ ...sk-execute-feasibility-mpc-multi-share.xml | 103 ++++++ ...k-execute-feasibility-mpc-single-share.xml | 145 ++++++++ ...lti-medic-result-share-feasibility-mpc.xml | 123 +++++++ .../highmed-task-request-feasibility-mpc.xml | 309 ++++++++++++++++ ...gle-medic-result-share-feasibility-mpc.xml | 123 +++++++ ...yMpcFromMedicsViaMedic1ExampleStarter.java | 178 ++++++++++ ...omMedicsViaMedic1DockerExampleStarter.java | 16 + ...yMpcFromMedicsViaMedic1ExampleStarter.java | 16 + .../ActivityDefinitionProfileTest.java | 109 ++++++ .../dsf/fhir/profile/TaskProfileTest.java | 336 ++++++++++++++++++ .../src/test/resources/log4j2.xml | 67 ++++ pom.xml | 6 + 55 files changed, 5224 insertions(+) create mode 100644 dsf-bpe-process-feasibility-mpc/pom.xml create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibilityMpc.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequestMultiShare.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequestSingleShare.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMulitMedicResultShares.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityMpcResources.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultShares.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ComputeMultiMedicResultShare.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityMpcResources.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareResponseTarget.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTargets.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectSingleMedicResultShareTargets.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsMultiMedicShare.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcSerializerConfig.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResult.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultSerializer.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultValues.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResults.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultsSerializer.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultsValues.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/resources/META-INF/services/org.highmed.dsf.bpe.ProcessPluginDefinition create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-single-share.xml create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility-mpc.xml create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml create mode 100644 dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityMpcFromMedicsViaMedic1DockerExampleStarter.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/test/resources/log4j2.xml diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index e604d6e0..966dd55c 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -31,8 +31,10 @@ public interface ConstantsDataSharing String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY = "medic-correlation-key"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT = "single-medic-count-result"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SET_REFERENCE = "single-medic-result-set-reference"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE = "single-medic-result-share"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT = "multi-medic-count-result"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SET_REFERENCE = "multi-medic-result-set-reference"; + String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE = "multi-medic-result-share"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS = "participating-medics"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_REQUEST_FORM_REFERENCE = "request-form-reference"; String CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONTRACT_REFERENCE = "contract-reference"; diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml index 8be4cade..4879a967 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml @@ -65,6 +65,11 @@ <display value="Single MeDIC Count Result"/> <definition value="Result of a single count query execution"/> </concept> + <concept> + <code value="single-medic-result-share"/> + <display value="Single MeDIC MPC Result Share"/> + <definition value="MPC result share of a single count query execution"/> + </concept> <concept> <code value="single-medic-result-set-reference"/> <display value="Single MeDIC Result Set Reference"/> @@ -76,6 +81,11 @@ <display value="Multi MeDIC Result"/> <definition value="Aggregated result of all single count query execution results"/> </concept> + <concept> + <code value="multi-medic-result-share"/> + <display value="Multi MeDIC MPC Result Share"/> + <definition value="Aggregated result of all received single count query execution result shares"/> + </concept> <concept> <code value="multi-medic-result-set-reference"/> <display value="Multi MeDIC Result Set Reference"/> diff --git a/dsf-bpe-process-feasibility-mpc/pom.xml b/dsf-bpe-process-feasibility-mpc/pom.xml new file mode 100644 index 00000000..e195a0af --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/pom.xml @@ -0,0 +1,299 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <artifactId>dsf-bpe-process-feasibility-mpc</artifactId> + + <parent> + <artifactId>dsf-bpe-highmed-processes-pom</artifactId> + <groupId>org.highmed.dsf</groupId> + <version>0.6.0-SNAPSHOT</version> + </parent> + + <properties> + <main.basedir>${project.basedir}/..</main.basedir> + <dsf.location>../../highmed-dsf</dsf.location> + </properties> + + <dependencies> + <dependency> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-base</artifactId> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-data-sharing</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>de.hs-heilbronn.mi</groupId> + <artifactId>log4j2-utils</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-fhir-validation</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-base</artifactId> + <scope>test</scope> + <type>test-jar</type> + </dependency> + </dependencies> + + <profiles> + <profile> + <id>copy-to-highmed-dsf-process</id> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-process-plugin-to-docker-test-setup</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup/bpe/process</outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-plugin-to-docker-test-setup-3medic-ttp/medic1</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process</outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-plugin-to-docker-test-setup-3medic-ttp/medic2</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process</outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-plugin-to-docker-test-setup-3medic-ttp/medic3</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process</outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-plugin-to-docker-test-setup-3medic-ttp/ttp</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process</outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic1</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic2</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/medic3</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process + </outputDirectory> + </configuration> + </execution> + <execution> + <id>copy-process-to-docker-test-setup-3medic-ttp-docker/ttp</id> + <phase>package</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>${project.groupId}</groupId> + <artifactId>${project.artifactId}</artifactId> + <version>${project.version}</version> + </artifactItem> + </artifactItems> + <outputDirectory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process + </outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <configuration> + <filesets> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic1/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic2/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/medic3/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp/ttp/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic1/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic2/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/medic3/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + <fileset> + <directory>${dsf.location}/dsf-docker-test-setup-3medic-ttp-docker/ttp/bpe/process</directory> + <includes> + <include>${project.artifactId}-${project.version}.jar</include> + </includes> + <followSymlinks>false</followSymlinks> + </fileset> + </filesets> + </configuration> + </plugin> + </plugins> + </build> + </profile> + </profiles> +</project> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibilityMpc.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibilityMpc.java new file mode 100644 index 00000000..9cda8e8c --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibilityMpc.java @@ -0,0 +1,57 @@ +package org.highmed.dsf.bpe; + +import static org.highmed.dsf.bpe.ConstantsBase.PROCESS_HIGHMED_URI_BASE; +import static org.highmed.dsf.bpe.FeasibilityMpcProcessPluginDefinition.VERSION; + +public interface ConstantsFeasibilityMpc +{ + String BPMN_EXECUTION_VARIABLE_CORRELATION_KEY = "correlationKey"; + // String BPMN_EXECUTION_VARIABLE_CORRELATION_KEYS_SINGLE_MEDIC_SHARE = "correlationKeysSingleMedicShare"; + + String BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES = "queryResultsSingleMedicShare"; + String BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES = "queryResultsMultiMedicShare"; + + // Must be 3 or larger, as otherwise it is possible to draw conclusions about the individual MeDICs + // (if I already know the cohort size in my MeDIC) + int MIN_PARTICIPATING_MEDICS = 3; + int MIN_COHORT_DEFINITIONS = 1; + + String FEASIBILITY_MPC_QUERY_PREFIX = "SELECT COUNT"; + + String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC = "http://highmed.org/fhir/StructureDefinition/task-request-feasibility-mpc"; + String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC + + "|" + VERSION; + String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + + "requestFeasibilityMpc/"; + String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_PROCESS_URI + + VERSION; + String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_MESSAGE_NAME = "requestFeasibilityMpcMessage"; + + String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE = "http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-multi-share"; + String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE + + "|" + VERSION; + String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + + "executeFeasibilityMpcMultiShare/"; + String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_PROCESS_URI + + VERSION; + String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_MESSAGE_NAME = "executeFeasibilityMpcMultiShareMessage"; + + String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE = "http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-single-share"; + String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE + + "|" + VERSION; + String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + + "executeFeasibilityMpcSingleShare/"; + String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE_PROCESS_URI + + VERSION; + String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE_MESSAGE_NAME = "executeFeasibilityMpcSingleShareMessage"; + + String PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_SHARE_FEASIBILITY_MPC = "http://highmed.org/fhir/StructureDefinition/task-single-medic-result-share-feasibility-mpc"; + String PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_SHARE_FEASIBILITY_MPC_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_SHARE_FEASIBILITY_MPC + + "|" + VERSION; + String PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_SHARE_FEASIBILITY_MPC_MESSAGE_NAME = "resultShareSingleMedicFeasibilityMpcMessage"; + + String PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_SHARE_FEASIBILITY_MPC = "http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-share-feasibility-mpc"; + String PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_SHARE_FEASIBILITY_MPC_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_SHARE_FEASIBILITY_MPC + + "|" + VERSION; + String PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_SHARE_FEASIBILITY_MPC_MESSAGE_NAME = "resultShareMultiMedicFeasibilityMpcMessage"; +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java new file mode 100644 index 00000000..1cda4b03 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java @@ -0,0 +1,88 @@ +package org.highmed.dsf.bpe; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Stream; + +import org.highmed.dsf.bpe.spring.config.DataSharingSerializerConfig; +import org.highmed.dsf.bpe.spring.config.FeasibilityMpcConfig; +import org.highmed.dsf.bpe.spring.config.FeasibilityMpcSerializerConfig; +import org.highmed.dsf.fhir.resources.AbstractResource; +import org.highmed.dsf.fhir.resources.ActivityDefinitionResource; +import org.highmed.dsf.fhir.resources.CodeSystemResource; +import org.highmed.dsf.fhir.resources.ResourceProvider; +import org.highmed.dsf.fhir.resources.StructureDefinitionResource; +import org.highmed.dsf.fhir.resources.ValueSetResource; +import org.springframework.core.env.PropertyResolver; + +import ca.uhn.fhir.context.FhirContext; + +public class FeasibilityMpcProcessPluginDefinition implements ProcessPluginDefinition +{ + public static final String VERSION = "0.6.0"; + + private static final String DEPENDENCY_DATA_SHARING_VERSION = "0.6.0"; + private static final String DEPENDENCY_DATA_SHARING_NAME_AND_VERSION = "dsf-bpe-process-data-sharing-0.6.0"; + + @Override + public String getName() + { + return "dsf-bpe-process-feasibility-mpc"; + } + + @Override + public String getVersion() + { + return VERSION; + } + + @Override + public Stream<String> getBpmnFiles() + { + return Stream.of("bpe/requestFeasibilityMpc.bpmn", "bpe/executeFeasibilityMpc.bpmn"); + } + + @Override + public Stream<Class<?>> getSpringConfigClasses() + { + return Stream.of(FeasibilityMpcConfig.class, FeasibilityMpcSerializerConfig.class, + DataSharingSerializerConfig.class); + } + + @Override + public List<String> getDependencyNamesAndVersions() + { + return Arrays.asList(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION); + } + + @Override + public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader, + PropertyResolver resolver) + { + var aExe = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeFeasibilityMpc.xml"); + var aReq = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml"); + + var cDS = CodeSystemResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, + "http://highmed.org/fhir/CodeSystem/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); + + var sTExe = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-execute-feasibility-mpc.xml"); + var sTReq = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-request-feasibility-mpc.xml"); + var sTResM = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml"); + var sTResS = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml"); + + var vDS = ValueSetResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, + "http://highmed.org/fhir/ValueSet/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); + + Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( + "highmedorg_executeFeasibilityMpc/" + VERSION, Arrays.asList(aExe, cDS, sTExe, sTResS, vDS), + "highmedorg_requestFeasibilityMpc/" + VERSION, Arrays.asList(aReq, cDS, sTReq, sTResM, vDS)); + + return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), + classLoader, resolver, resourcesByProcessKeyAndVersion); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequestMultiShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequestMultiShare.java new file mode 100644 index 00000000..ee038f76 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequestMultiShare.java @@ -0,0 +1,40 @@ +package org.highmed.dsf.bpe.message; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; + +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Targets; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.ParameterComponent; + +import ca.uhn.fhir.context.FhirContext; + +public class SendMedicRequestMultiShare extends AbstractTaskMessageSend +{ + public SendMedicRequestMultiShare(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) + { + super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); + } + + @Override + protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) + { + Targets targets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); + Stream<Task.ParameterComponent> inputTargets = targets.getEntries().stream() + .map(target -> getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY, + target.getCorrelationKey())); + + return inputTargets; + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequestSingleShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequestSingleShare.java new file mode 100644 index 00000000..b9141711 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMedicRequestSingleShare.java @@ -0,0 +1,49 @@ +package org.highmed.dsf.bpe.message; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; + +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResearchStudy; +import org.hl7.fhir.r4.model.Task.ParameterComponent; + +import ca.uhn.fhir.context.FhirContext; + +public class SendMedicRequestSingleShare extends AbstractTaskMessageSend +{ + public SendMedicRequestSingleShare(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) + { + super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); + } + + @Override + protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) + { + ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); + IdType researchStudyId = new IdType( + getFhirWebserviceClientProvider().getLocalBaseUrl() + "/" + researchStudy.getId()); + + ParameterComponent inputResearchStudyReference = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE, + new Reference().setReference(researchStudyId.toVersionless().getValueAsString())); + + boolean needsConsentCheck = (boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); + ParameterComponent inputNeedsConsentCheck = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK, needsConsentCheck); + + return Stream.of(inputResearchStudyReference, inputNeedsConsentCheck); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java new file mode 100644 index 00000000..fbdafacd --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java @@ -0,0 +1,54 @@ +package org.highmed.dsf.bpe.message; + +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE; + +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.ParameterComponent; + +import ca.uhn.fhir.context.FhirContext; + +public class SendMultiMedicResultShare extends AbstractTaskMessageSend +{ + public SendMultiMedicResultShare(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) + { + super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); + } + + @Override + protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) + { + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + + return results.getResults().stream().map(this::toInput); + } + + private Task.ParameterComponent toInput(QueryResult result) + { + ParameterComponent input = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE, result.getCohortSize()); + input.addExtension(createCohortIdExtension(result.getCohortId())); + + return input; + } + + private Extension createCohortIdExtension(String cohortId) + { + return new Extension(EXTENSION_HIGHMED_GROUP_ID, new Reference(cohortId)); + } +} \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java new file mode 100644 index 00000000..6e378d88 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java @@ -0,0 +1,58 @@ +package org.highmed.dsf.bpe.message; + +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE; + +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.ParameterComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ca.uhn.fhir.context.FhirContext; + +public class SendSingleMedicResultShare extends AbstractTaskMessageSend +{ + private static final Logger logger = LoggerFactory.getLogger(SendSingleMedicResultShare.class); + + public SendSingleMedicResultShare(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) + { + super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); + } + + @Override + protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) + { + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + + return results.getResults().stream().map(this::toInput); + } + + private Task.ParameterComponent toInput(QueryResult result) + { + ParameterComponent input = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE, result.getCohortSize()); + input.addExtension(createCohortIdExtension(result.getCohortId())); + + return input; + } + + private Extension createCohortIdExtension(String cohortId) + { + return new Extension(EXTENSION_HIGHMED_GROUP_ID, new Reference(cohortId)); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMulitMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMulitMedicResultShares.java new file mode 100644 index 00000000..4b565c8a --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMulitMedicResultShares.java @@ -0,0 +1,26 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CalculateMulitMedicResultShares extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(CalculateMulitMedicResultShares.class); + + public CalculateMulitMedicResultShares(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper) + { + super(clientProvider, taskHelper, readAccessHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + logger.info("EXECUTING: {}", CalculateMulitMedicResultShares.class.getName()); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java new file mode 100644 index 00000000..4cf91209 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java @@ -0,0 +1,26 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CalculateSingleMedicResultShares extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(CalculateSingleMedicResultShares.class); + + public CalculateSingleMedicResultShares(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper) + { + super(clientProvider, taskHelper, readAccessHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + logger.info("EXECUTING: {}", CalculateSingleMedicResultShares.class.getName()); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityMpcResources.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityMpcResources.java new file mode 100644 index 00000000..9cf98a3f --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckFeasibilityMpcResources.java @@ -0,0 +1,74 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.MIN_COHORT_DEFINITIONS; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.MIN_PARTICIPATING_MEDICS; + +import java.util.List; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.FhirResourcesList; +import org.hl7.fhir.r4.model.Group; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResearchStudy; + +public class CheckFeasibilityMpcResources extends AbstractServiceDelegate +{ + public CheckFeasibilityMpcResources(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper) + { + super(clientProvider, taskHelper, readAccessHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); + + List<Group> cohorts = ((FhirResourcesList) execution.getVariable(BPMN_EXECUTION_VARIABLE_COHORTS)) + .getResourcesAndCast(); + + checkNumberOfParticipatingMedics(researchStudy); + checkFullyQualifiedCohortIds(cohorts); + checkNumberOfCohortDefinitions(cohorts); + } + + private void checkNumberOfParticipatingMedics(ResearchStudy researchStudy) + { + long medics = researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).stream() + .filter(e -> e.getValue() instanceof Reference).map(e -> (Reference) e.getValue()) + .map(r -> r.getIdentifier()) + .filter(i -> NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER.equals(i.getSystem())).map(i -> i.getValue()) + .distinct().count(); + + if (medics < MIN_PARTICIPATING_MEDICS) + { + throw new RuntimeException( + "Number of distinct participanting MeDICs is < " + MIN_PARTICIPATING_MEDICS + ", got " + medics); + } + } + + private void checkFullyQualifiedCohortIds(List<Group> cohorts) + { + if (cohorts.stream().anyMatch(g -> !g.getIdElement().hasBaseUrl())) + { + throw new RuntimeException("Not all cohorts have fully qualified ids (containing server base url)"); + } + } + + private void checkNumberOfCohortDefinitions(List<Group> cohorts) + { + int size = cohorts.size(); + if (size < MIN_COHORT_DEFINITIONS) + { + throw new RuntimeException("Number of defined cohorts is < " + MIN_COHORT_DEFINITIONS + ", got " + size); + } + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java new file mode 100644 index 00000000..f7c9bea4 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java @@ -0,0 +1,26 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CheckMultiMedicResults extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(CheckMultiMedicResults.class); + + public CheckMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper) + { + super(clientProvider, taskHelper, readAccessHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + logger.info("EXECUTING: {}", CheckMultiMedicResults.class.getName()); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java new file mode 100644 index 00000000..9be90051 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckQueries.java @@ -0,0 +1,81 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.FEASIBILITY_MPC_QUERY_PREFIX; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.group.GroupHelper; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.FhirResourcesList; +import org.hl7.fhir.r4.model.Group; +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +public class CheckQueries extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(CheckQueries.class); + + private final GroupHelper groupHelper; + + public CheckQueries(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, GroupHelper groupHelper) + { + super(clientProvider, taskHelper, readAccessHelper); + + this.groupHelper = groupHelper; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(groupHelper, "groupHelper"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + List<Group> cohorts = ((FhirResourcesList) execution.getVariable(BPMN_EXECUTION_VARIABLE_COHORTS)) + .getResourcesAndCast(); + + Map<String, String> queries = new HashMap<>(); + + Task leadingTask = getLeadingTaskFromExecutionVariables(); + cohorts.forEach(group -> + { + String aqlQuery = groupHelper.extractAqlQuery(group); + + String groupId = group.getId(); + if (!aqlQuery.startsWith(FEASIBILITY_MPC_QUERY_PREFIX)) + { + String errorMessage = "Initial single medic FeasibilityMpc query check failed, wrong format for query of group with id '" + + groupId + "', expected query to start with '" + FEASIBILITY_MPC_QUERY_PREFIX + "' but got '" + + aqlQuery + "'"; + + logger.info(errorMessage); + leadingTask.getOutput().add(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR, errorMessage)); + } + else + { + queries.put(groupId, aqlQuery); + } + }); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERIES, queries); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultShares.java new file mode 100644 index 00000000..f4949492 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultShares.java @@ -0,0 +1,26 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CheckSingleMedicResultShares extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(CheckSingleMedicResultShares.class); + + public CheckSingleMedicResultShares(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper) + { + super(clientProvider, taskHelper, readAccessHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + logger.info("EXECUTING: {}", CheckSingleMedicResultShares.class.getName()); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ComputeMultiMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ComputeMultiMedicResultShare.java new file mode 100644 index 00000000..c7f4b3a7 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ComputeMultiMedicResultShare.java @@ -0,0 +1,26 @@ +package org.highmed.dsf.bpe.service; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ComputeMultiMedicResultShare extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(ComputeMultiMedicResultShare.class); + + public ComputeMultiMedicResultShare(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper) + { + super(clientProvider, taskHelper, readAccessHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + logger.info("EXECUTING: {}", ComputeMultiMedicResultShare.class.getName()); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityMpcResources.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityMpcResources.java new file mode 100644 index 00000000..8bf50499 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadFeasibilityMpcResources.java @@ -0,0 +1,166 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_COHORTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_CORRELATION_KEY; + +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.FhirResourceValues; +import org.highmed.dsf.fhir.variables.FhirResourcesListValues; +import org.highmed.fhir.client.FhirWebserviceClient; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.Group; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResearchStudy; +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +public class DownloadFeasibilityMpcResources extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(DownloadFeasibilityMpcResources.class); + + private final OrganizationProvider organizationProvider; + + public DownloadFeasibilityMpcResources(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider) + { + super(clientProvider, taskHelper, readAccessHelper); + + this.organizationProvider = organizationProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(organizationProvider, "organizationProvider"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + Task task = getCurrentTaskFromExecutionVariables(); + + IdType researchStudyId = getResearchStudyId(task); + FhirWebserviceClient client = getWebserviceClient(researchStudyId); + Bundle bundle = getResearchStudyAndCohortDefinitions(researchStudyId, client); + + ResearchStudy researchStudy = (ResearchStudy) bundle.getEntryFirstRep().getResource(); + execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY, FhirResourceValues.create(researchStudy)); + + List<Group> cohortDefinitions = getCohortDefinitions(bundle, client.getBaseUrl()); + execution.setVariable(BPMN_EXECUTION_VARIABLE_COHORTS, FhirResourcesListValues.create(cohortDefinitions)); + + boolean needsConsentCheck = getNeedsConsentCheck(task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK, needsConsentCheck); + + String correlationKey = getCorrelationKey(task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_CORRELATION_KEY, correlationKey); + } + + private IdType getResearchStudyId(Task task) + { + Reference researchStudyReference = getTaskHelper().getInputParameterReferenceValues(task, + CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE) + .findFirst().get(); + + return new IdType(researchStudyReference.getReference()); + } + + private FhirWebserviceClient getWebserviceClient(IdType researchStudyId) + { + if (researchStudyId.getBaseUrl() == null + || researchStudyId.getBaseUrl().equals(getFhirWebserviceClientProvider().getLocalBaseUrl())) + { + return getFhirWebserviceClientProvider().getLocalWebserviceClient(); + } + else + { + return getFhirWebserviceClientProvider().getWebserviceClient(researchStudyId.getBaseUrl()); + } + } + + private Bundle getResearchStudyAndCohortDefinitions(IdType researchStudyId, FhirWebserviceClient client) + { + try + { + Bundle bundle = client.searchWithStrictHandling(ResearchStudy.class, + Map.of("_id", Collections.singletonList(researchStudyId.getIdPart()), "_include", + Collections.singletonList("ResearchStudy:enrollment"))); + + if (bundle.getEntry().size() < 2) + { + throw new RuntimeException("Returned search-set contained less then two entries"); + } + else if (!bundle.getEntryFirstRep().hasResource() + || !(bundle.getEntryFirstRep().getResource() instanceof ResearchStudy)) + { + throw new RuntimeException("Returned search-set did not contain ResearchStudy at index == 0"); + } + else if (bundle.getEntry().stream().skip(1).map(c -> c.hasResource() && c.getResource() instanceof Group) + .filter(b -> !b).findAny().isPresent()) + { + throw new RuntimeException("Returned search-set contained unexpected resource at index >= 1"); + } + + return bundle; + } + catch (Exception e) + { + logger.warn("Error while reading ResearchStudy with id {} including Groups from {}: {}", + researchStudyId.getIdPart(), client.getBaseUrl(), e.getMessage()); + throw e; + } + } + + private List<Group> getCohortDefinitions(Bundle bundle, String baseUrl) + { + return bundle.getEntry().stream().skip(1).map(e -> + { + Group group = (Group) e.getResource(); + IdType oldId = group.getIdElement(); + group.setIdElement( + new IdType(baseUrl, oldId.getResourceType(), oldId.getIdPart(), oldId.getVersionIdPart())); + return group; + }).collect(Collectors.toList()); + } + + private boolean getNeedsConsentCheck(Task task) + { + return getTaskHelper() + .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK) + .orElseThrow(() -> new IllegalArgumentException("NeedsConsentCheck boolean is not set in task with id='" + + task.getId() + "', this error should have been caught by resource validation")); + } + + private String getCorrelationKey(Task task) + { + return getTaskHelper() + .getFirstInputParameterStringValue(task, CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY) + .orElseThrow(() -> new IllegalArgumentException("CorrelationKey is not set in task with id='" + + task.getId() + "', this error should have been caught by resource validation")); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java new file mode 100644 index 00000000..0c006a84 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -0,0 +1,211 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONSORTIUM_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.fhir.client.FhirWebserviceClient; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResearchStudy; +import org.hl7.fhir.r4.model.ResourceType; +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +public class DownloadResearchStudyResource extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(DownloadResearchStudyResource.class); + + private final OrganizationProvider organizationProvider; + + public DownloadResearchStudyResource(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider) + { + super(clientProvider, taskHelper, readAccessHelper); + + this.organizationProvider = organizationProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(organizationProvider, "organizationProvider"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + Task task = getCurrentTaskFromExecutionVariables(); + + IdType researchStudyId = getResearchStudyId(task); + FhirWebserviceClient client = getFhirWebserviceClientProvider().getLocalWebserviceClient(); + ResearchStudy researchStudy = getResearchStudy(researchStudyId, client); + String consortiumIdentifier = getConsortiumIdentifier(task); + + researchStudy = checkConsortiumAffiliationAndAddMissingOrganizations(researchStudy, consortiumIdentifier, + client); + execution.setVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY, researchStudy); + + boolean needsConsentCheck = getNeedsConsentCheck(task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK, needsConsentCheck); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES, + QueryResultsValues.create(new QueryResults(null))); + } + + private IdType getResearchStudyId(Task task) + { + Reference researchStudyReference = getTaskHelper() + .getInputParameterReferenceValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("ResearchStudy reference is not set in task with id='" + + task.getId() + "', this error should " + "have been caught by resource validation")); + + return new IdType(researchStudyReference.getReference()); + } + + private ResearchStudy getResearchStudy(IdType researchStudyid, FhirWebserviceClient client) + { + try + { + return client.read(ResearchStudy.class, researchStudyid.getIdPart()); + } + catch (Exception e) + { + logger.warn("Error while reading ResearchStudy with id {} from {}", researchStudyid.getIdPart(), + client.getBaseUrl()); + throw e; + } + } + + private ResearchStudy checkConsortiumAffiliationAndAddMissingOrganizations(ResearchStudy researchStudy, + String consortiumIdentifier, FhirWebserviceClient client) + { + List<String> identifiersConsortium = getOrganizationIdentifiersOfConsortium(consortiumIdentifier); + List<String> identifiersResearchStudy = getOrganizationIdentifiersOfResearchStudy(researchStudy); + + checkConsortiumAffiliation(identifiersConsortium, identifiersResearchStudy, researchStudy.getId(), + consortiumIdentifier); + + return addMissingOrganizations(identifiersConsortium, identifiersResearchStudy, researchStudy, client); + } + + private List<String> getOrganizationIdentifiersOfConsortium(String consortiumIdentifier) + { + return organizationProvider + .getOrganizationsByConsortiumAndRole(consortiumIdentifier, + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC) + .flatMap(o -> o.getIdentifier().stream()) + .filter(i -> NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER.equals(i.getSystem())).map(i -> i.getValue()) + .collect(Collectors.toList()); + } + + private List<String> getOrganizationIdentifiersOfResearchStudy(ResearchStudy researchStudy) + { + return researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).stream() + .filter(e -> e.getValue() instanceof Reference).map(e -> (Reference) e.getValue()) + .map(r -> r.getIdentifier().getValue()).collect(Collectors.toList()); + } + + private void checkConsortiumAffiliation(List<String> identifiersConsortium, List<String> identifiersResearchStudy, + String researchStudyId, String consortiumIdentifier) + { + List<String> identifiersWrongConsortium = new ArrayList<>(identifiersResearchStudy); + identifiersWrongConsortium.removeAll(identifiersConsortium); + if (!identifiersWrongConsortium.isEmpty()) + { + logger.warn( + "Organizations with identifiers='{}' are part of FeasibilityMpc research study with id='{}' but do " + + "not belong to the consortium with identifier='{}'", + identifiersWrongConsortium, researchStudyId, consortiumIdentifier); + + throw new RuntimeException("Organizations with identifiers='" + identifiersWrongConsortium + + "' are part of FeasibilityMpc research study with id='" + researchStudyId + + "' but do not belong to the consortium with identifier='" + consortiumIdentifier + "'"); + } + } + + private ResearchStudy addMissingOrganizations(List<String> identifiersConsortium, + List<String> identifiersResearchStudy, ResearchStudy researchStudy, FhirWebserviceClient client) + { + identifiersConsortium.removeAll(identifiersResearchStudy); + + if (!identifiersConsortium.isEmpty()) + { + identifiersConsortium.forEach(identifier -> + { + logger.warn( + "Adding missing organization with identifier='{}' to FeasibilityMpc research study with id='{}'", + identifier, researchStudy.getId()); + + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).setValue( + new Reference().setType(ResourceType.Organization.name()).setIdentifier(new Identifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(identifier))); + + }); + + return update(researchStudy, client); + } + else + return researchStudy; + } + + private ResearchStudy update(ResearchStudy researchStudy, FhirWebserviceClient client) + { + try + { + return client.update(researchStudy); + } + catch (Exception e) + { + logger.warn("Error while updating ResearchStudy resource: " + e.getMessage(), e); + throw e; + } + } + + private String getConsortiumIdentifier(Task task) + { + return getTaskHelper() + .getFirstInputParameterReferenceValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONSORTIUM_IDENTIFIER) + .orElseThrow(() -> new IllegalArgumentException("ConsortiumIdentifier is not set in task with id='" + + task.getId() + "', this error should have been caught by resource validation")) + .getIdentifier().getValue(); + } + + private boolean getNeedsConsentCheck(Task task) + { + return getTaskHelper() + .getFirstInputParameterBooleanValue(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK) + .orElseThrow(() -> new IllegalArgumentException("NeedsConsentCheck boolean is not set in task with id='" + + task.getId() + "', this error should have been caught by resource validation")); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java new file mode 100644 index 00000000..299122da --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -0,0 +1,83 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.openehr.client.OpenEhrClient; +import org.highmed.openehr.model.structure.ResultSet; +import org.springframework.beans.factory.InitializingBean; + +public class ExecuteQueries extends AbstractServiceDelegate implements InitializingBean +{ + private final OpenEhrClient openehrClient; + private final OrganizationProvider organizationProvider; + + public ExecuteQueries(FhirWebserviceClientProvider clientProvider, OpenEhrClient openehrClient, + TaskHelper taskHelper, ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider) + { + super(clientProvider, taskHelper, readAccessHelper); + + this.openehrClient = openehrClient; + this.organizationProvider = organizationProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(openehrClient, "openehrClient"); + Objects.requireNonNull(organizationProvider, "organizationProvider"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + // <groupId, query> + @SuppressWarnings("unchecked") + Map<String, String> queries = (Map<String, String>) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERIES); + + Boolean needsConsentCheck = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); + + List<QueryResult> results = queries.entrySet().stream() + .map(entry -> executeQuery(entry.getKey(), entry.getValue(), needsConsentCheck)) + .collect(Collectors.toList()); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(results))); + } + + private QueryResult executeQuery(String cohortId, String cohortQuery, boolean idQuery) + { + // TODO We might want to introduce a more complex result type to represent a count, + // errors and possible meta-data. + + ResultSet resultSet = openehrClient.query(cohortQuery, null); + + if (idQuery) + { + return QueryResult.idResult(organizationProvider.getLocalIdentifierValue(), cohortId, resultSet); + } + else + { + int count = Integer.parseInt(resultSet.getRow(0).get(0).getValueAsString()); + return QueryResult.countResult(organizationProvider.getLocalIdentifierValue(), cohortId, count); + } + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java new file mode 100644 index 00000000..13b776ed --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/FilterResultsByConsent.java @@ -0,0 +1,78 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.consent.client.ConsentClient; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.openehr.model.structure.ResultSet; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +public class FilterResultsByConsent extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(FilterResultsByConsent.class); + + private final ConsentClient consentClient; + + public FilterResultsByConsent(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, ConsentClient consentClient) + { + super(clientProvider, taskHelper, readAccessHelper); + + this.consentClient = consentClient; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(consentClient, "consentClient"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + List<QueryResult> checkedResults = filterResultsByConsent(results); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(checkedResults))); + } + + private List<QueryResult> filterResultsByConsent(QueryResults results) + { + return results.getResults().stream().map(result -> filterResultByConsent(result)).collect(Collectors.toList()); + } + + private QueryResult filterResultByConsent(QueryResult result) + { + ResultSet checkedResultSet = removeRowsWithoutConsent(result.getResultSet()); + return QueryResult.idResult(result.getOrganizationIdentifier(), result.getCohortId(), checkedResultSet); + } + + private ResultSet removeRowsWithoutConsent(ResultSet resultSet) + { + try + { + return consentClient.removeRowsWithoutConsent(resultSet); + } + catch (Exception exception) + { + logger.warn("Error while filtering ResultSet: " + exception.getMessage()); + throw exception; + } + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java new file mode 100644 index 00000000..80f71f97 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/GenerateCountFromIds.java @@ -0,0 +1,46 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; + +import java.util.List; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; + +public class GenerateCountFromIds extends AbstractServiceDelegate +{ + public GenerateCountFromIds(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper) + { + super(clientProvider, taskHelper, readAccessHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + + List<QueryResult> filteredResults = count(results.getResults()); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS, + QueryResultsValues.create(new QueryResults(filteredResults))); + } + + private List<QueryResult> count(List<QueryResult> results) + { + return results.stream().map(this::count).collect(Collectors.toList()); + } + + protected QueryResult count(QueryResult result) + { + return QueryResult.countResult(result.getOrganizationIdentifier(), result.getCohortId(), + result.getResultSet().getRows().size()); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java new file mode 100644 index 00000000..7f7d7c9b --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ModifyQueries.java @@ -0,0 +1,74 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; +import static org.highmed.pseudonymization.openehr.Constants.EHRID_COLUMN_NAME; + +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Objects; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.springframework.beans.factory.InitializingBean; + +public class ModifyQueries extends AbstractServiceDelegate implements InitializingBean +{ + private final String ehrIdColumnPath; + + public ModifyQueries(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, String ehrIdColumnPath) + { + super(clientProvider, taskHelper, readAccessHelper); + + this.ehrIdColumnPath = ehrIdColumnPath; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(ehrIdColumnPath, "ehrIdColumnPath"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + Boolean needsConsentCheck = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK); + Boolean needsRecordLinkage = (Boolean) execution.getVariable(BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE); + boolean idQuery = Boolean.TRUE.equals(needsConsentCheck) || Boolean.TRUE.equals(needsRecordLinkage); + + if (idQuery) + { + // <groupId, query> + @SuppressWarnings("unchecked") + Map<String, String> queries = (Map<String, String>) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERIES); + + Map<String, String> modifiedQueries = modifyQueries(queries); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERIES, modifiedQueries); + } + } + + private Map<String, String> modifyQueries(Map<String, String> queries) + { + Map<String, String> modifiedQueries = new HashMap<>(); + + for (Entry<String, String> entry : queries.entrySet()) + modifiedQueries.put(entry.getKey(), replaceSelectCountWithSelectMpiId(entry.getValue())); + + return modifiedQueries; + } + + protected String replaceSelectCountWithSelectMpiId(String value) + { + // TODO Implement correct replacement for default id query + return value.replace("SELECT COUNT(e)", "SELECT e" + ehrIdColumnPath + " as " + EHRID_COLUMN_NAME); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareResponseTarget.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareResponseTarget.java new file mode 100644 index 00000000..be0ac96b --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareResponseTarget.java @@ -0,0 +1,56 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_CORRELATION_KEY; + +import java.util.Objects; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.EndpointProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Target; +import org.highmed.dsf.fhir.variables.TargetValues; +import org.springframework.beans.factory.InitializingBean; + +public class SelectMultiMedicResultShareResponseTarget extends AbstractServiceDelegate implements InitializingBean +{ + private final EndpointProvider endpointProvider; + + public SelectMultiMedicResultShareResponseTarget(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, EndpointProvider endpointProvider) + { + super(clientProvider, taskHelper, readAccessHelper); + + this.endpointProvider = endpointProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(endpointProvider, "endpointProvider"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + String identifier = getLeadingTaskFromExecutionVariables().getRequester().getIdentifier().getValue(); + String correlationKey = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_CORRELATION_KEY); + + Target medicTarget = Target.createBiDirectionalTarget(identifier, + endpointProvider.getFirstConsortiumEndpointAdress( + NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, + identifier).get(), + correlationKey); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(medicTarget)); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTargets.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTargets.java new file mode 100644 index 00000000..4be6d803 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTargets.java @@ -0,0 +1,79 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; + +import java.util.List; +import java.util.Objects; +import java.util.UUID; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.EndpointProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Target; +import org.highmed.dsf.fhir.variables.Targets; +import org.highmed.dsf.fhir.variables.TargetsValues; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResearchStudy; + +public class SelectMultiMedicResultShareTargets extends AbstractServiceDelegate +{ + private final EndpointProvider endpointProvider; + + public SelectMultiMedicResultShareTargets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, EndpointProvider endpointProvider) + { + super(clientProvider, taskHelper, readAccessHelper); + + this.endpointProvider = endpointProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(endpointProvider, "endpointProvider"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); + + Targets targets = getTargets(researchStudy); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(targets)); + } + + private Targets getTargets(ResearchStudy researchStudy) + { + List<Target> targets = researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).stream() + .filter(Extension::hasValue).map(Extension::getValue).filter(v -> v instanceof Reference) + .map(v -> (Reference) v).filter(Reference::hasIdentifier).map(Reference::getIdentifier) + .filter(Identifier::hasValue).map(Identifier::getValue) + .map(medicIdentifier -> Target.createBiDirectionalTarget(medicIdentifier, + getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIdentifier), + UUID.randomUUID().toString())) + .collect(Collectors.toList()); + + return new Targets(targets); + } + + private String getAddress(String role, String identifier) + { + return endpointProvider + .getFirstConsortiumEndpointAdress(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, role, identifier) + .get(); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectSingleMedicResultShareTargets.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectSingleMedicResultShareTargets.java new file mode 100644 index 00000000..b03af4e3 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectSingleMedicResultShareTargets.java @@ -0,0 +1,79 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_CORRELATION_KEY; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.EndpointProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Target; +import org.highmed.dsf.fhir.variables.Targets; +import org.highmed.dsf.fhir.variables.TargetsValues; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResearchStudy; + +public class SelectSingleMedicResultShareTargets extends AbstractServiceDelegate +{ + private final EndpointProvider endpointProvider; + + public SelectSingleMedicResultShareTargets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, EndpointProvider endpointProvider) + { + super(clientProvider, taskHelper, readAccessHelper); + + this.endpointProvider = endpointProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(endpointProvider, "endpointProvider"); + } + + @Override + protected void doExecute(DelegateExecution execution) + { + ResearchStudy researchStudy = (ResearchStudy) execution.getVariable(BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY); + String correlationKey = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_CORRELATION_KEY); + + Targets targets = getTargets(researchStudy, correlationKey); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(targets)); + } + + private Targets getTargets(ResearchStudy researchStudy, String correlationKey) + { + List<Target> targets = researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).stream() + .filter(Extension::hasValue).map(Extension::getValue).filter(v -> v instanceof Reference) + .map(v -> (Reference) v).filter(Reference::hasIdentifier).map(Reference::getIdentifier) + .filter(Identifier::hasValue).map(Identifier::getValue) + .map(medicIdentifier -> Target.createBiDirectionalTarget(medicIdentifier, + getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIdentifier), correlationKey)) + .collect(Collectors.toList()); + + return new Targets(targets); + } + + private String getAddress(String role, String identifier) + { + return endpointProvider + .getFirstConsortiumEndpointAdress(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, role, identifier) + .get(); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsMultiMedicShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsMultiMedicShare.java new file mode 100644 index 00000000..2fddb0e2 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsMultiMedicShare.java @@ -0,0 +1,71 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.UnsignedIntType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +public class StoreResultsMultiMedicShare extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(StoreResultsMultiMedicShare.class); + + public StoreResultsMultiMedicShare(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper) + { + super(clientProvider, taskHelper, readAccessHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + logger.info("EXECUTING: {}", StoreResultsMultiMedicShare.class.getName()); + + QueryResults results = (QueryResults) execution + .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES); + + Task task = getCurrentTaskFromExecutionVariables(); + + List<QueryResult> extendedResults = new ArrayList<>(); + extendedResults.addAll(results.getResults()); + extendedResults.addAll(getResults(task)); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES, + QueryResultsValues.create(new QueryResults(extendedResults))); + } + + private List<QueryResult> getResults(Task task) + { + TaskHelper taskHelper = getTaskHelper(); + Reference requester = task.getRequester(); + + return taskHelper + .getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE, EXTENSION_HIGHMED_GROUP_ID) + .map(input -> + { + String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); + int cohortSize = ((UnsignedIntType) input.getValue()).getValue(); + + return QueryResult.countResult(requester.getIdentifier().getValue(), cohortId, cohortSize); + }).collect(Collectors.toList()); + } +} \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java new file mode 100644 index 00000000..d2f3c20e --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java @@ -0,0 +1,72 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.UnsignedIntType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +public class StoreResultsSingleMedicShare extends AbstractServiceDelegate implements InitializingBean +{ + private static final Logger logger = LoggerFactory.getLogger(StoreResultsSingleMedicShare.class); + + public StoreResultsSingleMedicShare(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper) + { + super(clientProvider, taskHelper, readAccessHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + logger.info("EXECUTING: {}", StoreResultsSingleMedicShare.class.getName()); + + QueryResults results = (QueryResults) execution + .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES); + + Task task = getCurrentTaskFromExecutionVariables(); + + List<QueryResult> extendedResults = new ArrayList<>(); + extendedResults.addAll(results.getResults()); + extendedResults.addAll(getResults(task)); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES, + QueryResultsValues.create(new QueryResults(extendedResults))); + } + + private List<QueryResult> getResults(Task task) + { + TaskHelper taskHelper = getTaskHelper(); + Reference requester = task.getRequester(); + + return taskHelper + .getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE, EXTENSION_HIGHMED_GROUP_ID) + .map(input -> + { + String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); + int cohortSize = ((UnsignedIntType) input.getValue()).getValue(); + + return QueryResult.countResult(requester.getIdentifier().getValue(), cohortId, cohortSize); + }).collect(Collectors.toList()); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java new file mode 100644 index 00000000..806fc32a --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java @@ -0,0 +1,53 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; + +import java.util.List; +import java.util.stream.Collectors; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Target; +import org.highmed.dsf.fhir.variables.Targets; +import org.highmed.dsf.fhir.variables.TargetsValues; +import org.hl7.fhir.r4.model.Task; + +public class StoreSingleMedicResultShareCorrelationKeys extends AbstractServiceDelegate +{ + public StoreSingleMedicResultShareCorrelationKeys(FhirWebserviceClientProvider clientProvider, + TaskHelper taskHelper, ReadAccessHelper readAccessHelper) + { + super(clientProvider, taskHelper, readAccessHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + Task task = getCurrentTaskFromExecutionVariables(); + + Targets targets = getTargets(task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(targets)); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES, + QueryResultsValues.create(new QueryResults(null))); + } + + private Targets getTargets(Task task) + { + List<Target> targets = getTaskHelper() + .getInputParameterStringValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY) + .map(correlationKey -> Target.createBiDirectionalTarget("", "", correlationKey)) + .collect(Collectors.toList()); + + return new Targets(targets); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java new file mode 100644 index 00000000..8061a1f8 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java @@ -0,0 +1,244 @@ +package org.highmed.dsf.bpe.spring.config; + +import org.highmed.consent.client.ConsentClient; +import org.highmed.consent.client.ConsentClientFactory; +import org.highmed.dsf.bpe.message.*; +import org.highmed.dsf.bpe.service.CalculateMulitMedicResultShares; +import org.highmed.dsf.bpe.service.CalculateSingleMedicResultShares; +import org.highmed.dsf.bpe.service.CheckFeasibilityMpcResources; +import org.highmed.dsf.bpe.service.CheckMultiMedicResults; +import org.highmed.dsf.bpe.service.CheckQueries; +import org.highmed.dsf.bpe.service.CheckSingleMedicResultShares; +import org.highmed.dsf.bpe.service.ComputeMultiMedicResultShare; +import org.highmed.dsf.bpe.service.DownloadFeasibilityMpcResources; +import org.highmed.dsf.bpe.service.DownloadResearchStudyResource; +import org.highmed.dsf.bpe.service.ExecuteQueries; +import org.highmed.dsf.bpe.service.FilterResultsByConsent; +import org.highmed.dsf.bpe.service.GenerateCountFromIds; +import org.highmed.dsf.bpe.service.ModifyQueries; +import org.highmed.dsf.bpe.service.SelectMultiMedicResultShareResponseTarget; +import org.highmed.dsf.bpe.service.SelectMultiMedicResultShareTargets; +import org.highmed.dsf.bpe.service.SelectSingleMedicResultShareTargets; +import org.highmed.dsf.bpe.service.StoreResultsMultiMedicShare; +import org.highmed.dsf.bpe.service.StoreResultsSingleMedicShare; +import org.highmed.dsf.bpe.service.StoreSingleMedicResultShareCorrelationKeys; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.group.GroupHelper; +import org.highmed.dsf.fhir.organization.EndpointProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.openehr.client.OpenEhrClient; +import org.highmed.openehr.client.OpenEhrClientFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; + +import ca.uhn.fhir.context.FhirContext; + +@Configuration +public class FeasibilityMpcConfig +{ + @Autowired + private FhirWebserviceClientProvider fhirClientProvider; + + @Autowired + private ConsentClientFactory consentClientFactory; + + @Autowired + private OpenEhrClientFactory openEhrClientFactory; + + @Autowired + private OrganizationProvider organizationProvider; + + @Autowired + private EndpointProvider endpointProvider; + + @Autowired + private TaskHelper taskHelper; + + @Autowired + private ReadAccessHelper readAccessHelper; + + @Autowired + private GroupHelper groupHelper; + + @Autowired + private FhirContext fhirContext; + + @Autowired + private Environment environment; + + @Value("${org.highmed.dsf.bpe.openehr.subject.external.id.path:/ehr_status/subject/external_ref/id/value}") + private String ehrIdColumnPath; + + // + // process requestFeasibilityMpc implementations + // + + @Bean + public DownloadResearchStudyResource downloadResearchStudyResource() + { + return new DownloadResearchStudyResource(fhirClientProvider, taskHelper, readAccessHelper, + organizationProvider); + } + + @Bean + public SelectMultiMedicResultShareTargets selectMultiMedicResultShareTargets() + { + return new SelectMultiMedicResultShareTargets(fhirClientProvider, taskHelper, readAccessHelper, + endpointProvider); + } + + @Bean + public SendMedicRequestMultiShare sendMedicRequestMultiShare() + { + return new SendMedicRequestMultiShare(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider, + fhirContext); + } + + @Bean + public SendMedicRequestSingleShare sendMedicRequestSingleShare() + { + return new SendMedicRequestSingleShare(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider, + fhirContext); + } + + @Bean + public StoreResultsMultiMedicShare storeResultsMultiMedicShare() + { + return new StoreResultsMultiMedicShare(fhirClientProvider, taskHelper, readAccessHelper); + } + + @Bean + public CalculateMulitMedicResultShares calculateMulitMedicResultShares() + { + return new CalculateMulitMedicResultShares(fhirClientProvider, taskHelper, readAccessHelper); + } + + @Bean + public CheckMultiMedicResults checkMultiMedicResults() + { + return new CheckMultiMedicResults(fhirClientProvider, taskHelper, readAccessHelper); + } + + // + // process executeFeasibilityMpc implementations + // + + @Bean + public DownloadFeasibilityMpcResources downloadFeasibilityMpcResources() + { + return new DownloadFeasibilityMpcResources(fhirClientProvider, taskHelper, readAccessHelper, + organizationProvider); + } + + @Bean + public CheckFeasibilityMpcResources checkFeasibilityMpcResources() + { + return new CheckFeasibilityMpcResources(fhirClientProvider, taskHelper, readAccessHelper); + } + + @Bean + public StoreSingleMedicResultShareCorrelationKeys storeSingleMedicResultShareCorrelationKeys() + { + return new StoreSingleMedicResultShareCorrelationKeys(fhirClientProvider, taskHelper, readAccessHelper); + } + + @Bean + public CheckQueries checkQueries() + { + return new CheckQueries(fhirClientProvider, taskHelper, readAccessHelper, groupHelper); + } + + @Bean + public ModifyQueries modifyQueries() + { + return new ModifyQueries(fhirClientProvider, taskHelper, readAccessHelper, ehrIdColumnPath); + } + + @Bean + public OpenEhrClient openEhrClient() + { + return openEhrClientFactory.createClient(environment::getProperty); + } + + @Bean + public ExecuteQueries executeQueries() + { + return new ExecuteQueries(fhirClientProvider, openEhrClient(), taskHelper, readAccessHelper, + organizationProvider); + } + + @Bean + public ConsentClient consentClient() + { + return consentClientFactory.createClient(environment::getProperty); + } + + @Bean + public FilterResultsByConsent filterResultsByConsent() + { + return new FilterResultsByConsent(fhirClientProvider, taskHelper, readAccessHelper, consentClient()); + } + + @Bean + public GenerateCountFromIds generateCountFromIds() + { + return new GenerateCountFromIds(fhirClientProvider, taskHelper, readAccessHelper); + } + + @Bean + public CalculateSingleMedicResultShares calculateSingleMedicResultShares() + { + return new CalculateSingleMedicResultShares(fhirClientProvider, taskHelper, readAccessHelper); + } + + @Bean + public CheckSingleMedicResultShares checkSingleMedicResultShares() + { + return new CheckSingleMedicResultShares(fhirClientProvider, taskHelper, readAccessHelper); + } + + @Bean + public SelectSingleMedicResultShareTargets selectSingleMedicResultShareTargets() + { + return new SelectSingleMedicResultShareTargets(fhirClientProvider, taskHelper, readAccessHelper, + endpointProvider); + } + + @Bean + public SendSingleMedicResultShare sendSingleMedicResultShare() + { + return new SendSingleMedicResultShare(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider, + fhirContext); + } + + @Bean + public StoreResultsSingleMedicShare storeResultsSingleMedicShare() + { + return new StoreResultsSingleMedicShare(fhirClientProvider, taskHelper, readAccessHelper); + } + + @Bean + public ComputeMultiMedicResultShare computeMultiMedicResultShare() + { + return new ComputeMultiMedicResultShare(fhirClientProvider, taskHelper, readAccessHelper); + } + + @Bean + public SelectMultiMedicResultShareResponseTarget selectMultiMedicResultShareResponseTarget() + { + return new SelectMultiMedicResultShareResponseTarget(fhirClientProvider, taskHelper, readAccessHelper, + endpointProvider); + } + + @Bean + public SendMultiMedicResultShare sendMultiMedicResultShare() + { + return new SendMultiMedicResultShare(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider, + fhirContext); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcSerializerConfig.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcSerializerConfig.java new file mode 100644 index 00000000..0b479601 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcSerializerConfig.java @@ -0,0 +1,28 @@ +package org.highmed.dsf.bpe.spring.config; + +import org.highmed.dsf.bpe.variables.FinalFeasibilityMpcQueryResultSerializer; +import org.highmed.dsf.bpe.variables.FinalFeasibilityMpcQueryResultsSerializer; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.fasterxml.jackson.databind.ObjectMapper; + +@Configuration +public class FeasibilityMpcSerializerConfig +{ + @Autowired + private ObjectMapper objectMapper; + + @Bean + public FinalFeasibilityMpcQueryResultSerializer finalFeasibilityMpcQueryResultSerializer() + { + return new FinalFeasibilityMpcQueryResultSerializer(objectMapper); + } + + @Bean + public FinalFeasibilityMpcQueryResultsSerializer finalFeasibilityMpcQueryResultsSerializer() + { + return new FinalFeasibilityMpcQueryResultsSerializer(objectMapper); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResult.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResult.java new file mode 100644 index 00000000..a21e9d53 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResult.java @@ -0,0 +1,35 @@ +package org.highmed.dsf.bpe.variables; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class FinalFeasibilityMpcQueryResult +{ + private final String cohortId; + private final int participatingMedics; + private final int cohortSize; + + @JsonCreator + public FinalFeasibilityMpcQueryResult(@JsonProperty("cohortId") String cohortId, + @JsonProperty("participatingMedics") int participatingMedics, @JsonProperty("cohortSize") int cohortSize) + { + this.cohortId = cohortId; + this.participatingMedics = participatingMedics; + this.cohortSize = cohortSize; + } + + public String getCohortId() + { + return cohortId; + } + + public int getParticipatingMedics() + { + return participatingMedics; + } + + public int getCohortSize() + { + return cohortSize; + } +} \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultSerializer.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultSerializer.java new file mode 100644 index 00000000..f4f37e3c --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultSerializer.java @@ -0,0 +1,70 @@ +package org.highmed.dsf.bpe.variables; + +import java.io.IOException; +import java.util.Objects; + +import org.camunda.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer; +import org.camunda.bpm.engine.impl.variable.serializer.ValueFields; +import org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl; +import org.highmed.dsf.bpe.variables.FinalFeasibilityMpcQueryResultValues.FinalFeasibilityMpcQueryResultValue; +import org.springframework.beans.factory.InitializingBean; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class FinalFeasibilityMpcQueryResultSerializer + extends PrimitiveValueSerializer<FinalFeasibilityMpcQueryResultValue> implements InitializingBean +{ + private final ObjectMapper objectMapper; + + public FinalFeasibilityMpcQueryResultSerializer(ObjectMapper objectMapper) + { + super(FinalFeasibilityMpcQueryResultValues.VALUE_TYPE); + + this.objectMapper = objectMapper; + } + + @Override + public void afterPropertiesSet() throws Exception + { + Objects.requireNonNull(objectMapper, "objectMapper"); + } + + @Override + public void writeValue(FinalFeasibilityMpcQueryResultValue value, ValueFields valueFields) + { + FinalFeasibilityMpcQueryResult result = value.getValue(); + try + { + if (result != null) + valueFields.setByteArrayValue(objectMapper.writeValueAsBytes(result)); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } + } + + @Override + public FinalFeasibilityMpcQueryResultValue convertToTypedValue(UntypedValueImpl untypedValue) + { + return FinalFeasibilityMpcQueryResultValues.create((FinalFeasibilityMpcQueryResult) untypedValue.getValue()); + } + + @Override + public FinalFeasibilityMpcQueryResultValue readValue(ValueFields valueFields, boolean asTransientValue) + { + byte[] bytes = valueFields.getByteArrayValue(); + + try + { + FinalFeasibilityMpcQueryResult result = (bytes == null || bytes.length <= 0) ? null + : objectMapper.readValue(bytes, FinalFeasibilityMpcQueryResult.class); + return FinalFeasibilityMpcQueryResultValues.create(result); + } + catch (IOException e) + { + throw new RuntimeException(e); + } + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultValues.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultValues.java new file mode 100644 index 00000000..304076dd --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultValues.java @@ -0,0 +1,57 @@ +package org.highmed.dsf.bpe.variables; + +import java.util.Map; + +import org.camunda.bpm.engine.variable.impl.type.PrimitiveValueTypeImpl; +import org.camunda.bpm.engine.variable.impl.value.PrimitiveTypeValueImpl; +import org.camunda.bpm.engine.variable.type.PrimitiveValueType; +import org.camunda.bpm.engine.variable.value.PrimitiveValue; +import org.camunda.bpm.engine.variable.value.TypedValue; + +public class FinalFeasibilityMpcQueryResultValues +{ + public static interface FinalFeasibilityMpcQueryResultValue extends PrimitiveValue<FinalFeasibilityMpcQueryResult> + { + } + + private static class FinalFeasibilityMpcQueryResultValueImpl + extends PrimitiveTypeValueImpl<FinalFeasibilityMpcQueryResult> + implements FinalFeasibilityMpcQueryResultValues.FinalFeasibilityMpcQueryResultValue + { + private static final long serialVersionUID = 1L; + + public FinalFeasibilityMpcQueryResultValueImpl(FinalFeasibilityMpcQueryResult value, PrimitiveValueType type) + { + super(value, type); + } + } + + public static class FinalFeasibilityMpcQueryResultValueTypeImpl extends PrimitiveValueTypeImpl + { + private static final long serialVersionUID = 1L; + + private FinalFeasibilityMpcQueryResultValueTypeImpl() + { + super(FinalFeasibilityMpcQueryResult.class); + } + + @Override + public TypedValue createValue(Object value, Map<String, Object> valueInfo) + { + return new FinalFeasibilityMpcQueryResultValues.FinalFeasibilityMpcQueryResultValueImpl( + (FinalFeasibilityMpcQueryResult) value, VALUE_TYPE); + } + } + + public static final PrimitiveValueType VALUE_TYPE = new FinalFeasibilityMpcQueryResultValues.FinalFeasibilityMpcQueryResultValueTypeImpl(); + + private FinalFeasibilityMpcQueryResultValues() + { + } + + public static FinalFeasibilityMpcQueryResultValues.FinalFeasibilityMpcQueryResultValue create( + FinalFeasibilityMpcQueryResult value) + { + return new FinalFeasibilityMpcQueryResultValues.FinalFeasibilityMpcQueryResultValueImpl(value, VALUE_TYPE); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResults.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResults.java new file mode 100644 index 00000000..72ced50e --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResults.java @@ -0,0 +1,39 @@ +package org.highmed.dsf.bpe.variables; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class FinalFeasibilityMpcQueryResults +{ + private final List<FinalFeasibilityMpcQueryResult> results = new ArrayList<>(); + + @JsonCreator + public FinalFeasibilityMpcQueryResults( + @JsonProperty("results") Collection<? extends FinalFeasibilityMpcQueryResult> results) + { + if (results != null) + this.results.addAll(results); + } + + public void add(FinalFeasibilityMpcQueryResult newResult) + { + if (newResult != null) + results.add(newResult); + } + + public void addAll(Collection<FinalFeasibilityMpcQueryResult> results) + { + if (results != null) + this.results.addAll(results); + } + + public List<FinalFeasibilityMpcQueryResult> getResults() + { + return Collections.unmodifiableList(results); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultsSerializer.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultsSerializer.java new file mode 100644 index 00000000..b0ddb60d --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultsSerializer.java @@ -0,0 +1,70 @@ +package org.highmed.dsf.bpe.variables; + +import java.io.IOException; +import java.util.Objects; + +import org.camunda.bpm.engine.impl.variable.serializer.PrimitiveValueSerializer; +import org.camunda.bpm.engine.impl.variable.serializer.ValueFields; +import org.camunda.bpm.engine.variable.impl.value.UntypedValueImpl; +import org.highmed.dsf.bpe.variables.FinalFeasibilityMpcQueryResultsValues.FinalFeasibilityMpcQueryResultsValue; +import org.springframework.beans.factory.InitializingBean; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class FinalFeasibilityMpcQueryResultsSerializer + extends PrimitiveValueSerializer<FinalFeasibilityMpcQueryResultsValue> implements InitializingBean +{ + private final ObjectMapper objectMapper; + + public FinalFeasibilityMpcQueryResultsSerializer(ObjectMapper objectMapper) + { + super(FinalFeasibilityMpcQueryResultsValues.VALUE_TYPE); + + this.objectMapper = objectMapper; + } + + @Override + public void afterPropertiesSet() throws Exception + { + Objects.requireNonNull(objectMapper, "objectMapper"); + } + + @Override + public void writeValue(FinalFeasibilityMpcQueryResultsValue value, ValueFields valueFields) + { + FinalFeasibilityMpcQueryResults results = value.getValue(); + try + { + if (results != null) + valueFields.setByteArrayValue(objectMapper.writeValueAsBytes(results)); + } + catch (JsonProcessingException e) + { + throw new RuntimeException(e); + } + } + + @Override + public FinalFeasibilityMpcQueryResultsValue convertToTypedValue(UntypedValueImpl untypedValue) + { + return FinalFeasibilityMpcQueryResultsValues.create((FinalFeasibilityMpcQueryResults) untypedValue.getValue()); + } + + @Override + public FinalFeasibilityMpcQueryResultsValue readValue(ValueFields valueFields, boolean asTransientValue) + { + byte[] bytes = valueFields.getByteArrayValue(); + + try + { + FinalFeasibilityMpcQueryResults results = (bytes == null || bytes.length <= 0) ? null + : objectMapper.readValue(bytes, FinalFeasibilityMpcQueryResults.class); + return FinalFeasibilityMpcQueryResultsValues.create(results); + } + catch (IOException e) + { + throw new RuntimeException(e); + } + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultsValues.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultsValues.java new file mode 100644 index 00000000..a7076e52 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultsValues.java @@ -0,0 +1,57 @@ +package org.highmed.dsf.bpe.variables; + +import java.util.Map; + +import org.camunda.bpm.engine.variable.impl.type.PrimitiveValueTypeImpl; +import org.camunda.bpm.engine.variable.impl.value.PrimitiveTypeValueImpl; +import org.camunda.bpm.engine.variable.type.PrimitiveValueType; +import org.camunda.bpm.engine.variable.value.PrimitiveValue; +import org.camunda.bpm.engine.variable.value.TypedValue; + +public class FinalFeasibilityMpcQueryResultsValues +{ + public static interface FinalFeasibilityMpcQueryResultsValue extends PrimitiveValue<FinalFeasibilityMpcQueryResults> + { + } + + private static class FinalFeasibilityMpcQueryResultsValueImpl + extends PrimitiveTypeValueImpl<FinalFeasibilityMpcQueryResults> + implements FinalFeasibilityMpcQueryResultsValues.FinalFeasibilityMpcQueryResultsValue + { + private static final long serialVersionUID = 1L; + + public FinalFeasibilityMpcQueryResultsValueImpl(FinalFeasibilityMpcQueryResults value, PrimitiveValueType type) + { + super(value, type); + } + } + + public static class FinalFeasibilityMpcQueryResultsValueTypeImpl extends PrimitiveValueTypeImpl + { + private static final long serialVersionUID = 1L; + + private FinalFeasibilityMpcQueryResultsValueTypeImpl() + { + super(FinalFeasibilityMpcQueryResults.class); + } + + @Override + public TypedValue createValue(Object value, Map<String, Object> valueInfo) + { + return new FinalFeasibilityMpcQueryResultsValues.FinalFeasibilityMpcQueryResultsValueImpl( + (FinalFeasibilityMpcQueryResults) value, VALUE_TYPE); + } + } + + public static final PrimitiveValueType VALUE_TYPE = new FinalFeasibilityMpcQueryResultsValues.FinalFeasibilityMpcQueryResultsValueTypeImpl(); + + private FinalFeasibilityMpcQueryResultsValues() + { + } + + public static FinalFeasibilityMpcQueryResultsValues.FinalFeasibilityMpcQueryResultsValue create( + FinalFeasibilityMpcQueryResults value) + { + return new FinalFeasibilityMpcQueryResultsValues.FinalFeasibilityMpcQueryResultsValueImpl(value, VALUE_TYPE); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/META-INF/services/org.highmed.dsf.bpe.ProcessPluginDefinition b/dsf-bpe-process-feasibility-mpc/src/main/resources/META-INF/services/org.highmed.dsf.bpe.ProcessPluginDefinition new file mode 100644 index 00000000..38c28e0e --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/META-INF/services/org.highmed.dsf.bpe.ProcessPluginDefinition @@ -0,0 +1 @@ +org.highmed.dsf.bpe.FeasibilityMpcProcessPluginDefinition \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn new file mode 100644 index 00000000..a3e76b6e --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn @@ -0,0 +1,168 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> + <bpmn:process id="highmedorg_executeFeasibilityMpcMultiShare" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:startEvent id="StartEvent" name="start"> + <bpmn:outgoing>Flow_0zwnqdn</bpmn:outgoing> + <bpmn:messageEventDefinition id="MessageEventDefinition_0sjtzj6" messageRef="Message_1yz2a31" /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent" name="send multi medic result share"> + <bpmn:extensionElements> + <camunda:inputOutput> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibilityMpc/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="messageName">resultShareMultiMedicFeasibilityMpcMessage</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-FeasibilityMpc|0.6.0</camunda:inputParameter> + </camunda:inputOutput> + </bpmn:extensionElements> + <bpmn:incoming>Flow_1p3ixg0</bpmn:incoming> + <bpmn:messageEventDefinition id="MessageEventDefinition_13swtie" messageRef="Message_0qpomdh" camunda:class="org.highmed.dsf.bpe.message.SendMultiMedicResultShare" /> + </bpmn:endEvent> + <bpmn:subProcess id="Activity_11idi2o"> + <bpmn:incoming>Flow_15s0sha</bpmn:incoming> + <bpmn:outgoing>Flow_18n85hs</bpmn:outgoing> + <bpmn:multiInstanceLoopCharacteristics camunda:collection="${targets.entries}" camunda:elementVariable="target" /> + <bpmn:endEvent id="Event_1q7uhca"> + <bpmn:incoming>Flow_1p7mmcy</bpmn:incoming> + </bpmn:endEvent> + <bpmn:serviceTask id="temporarillyStoreSingleMedicResultShare" name="temporarilly store single medic result share" camunda:class="org.highmed.dsf.bpe.service.StoreResultsSingleMedicShare"> + <bpmn:incoming>Flow_1dzs2th</bpmn:incoming> + <bpmn:outgoing>Flow_1p7mmcy</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:receiveTask id="receiveSingleMedicResultShare" name="receive single medic result share" messageRef="Message_1ycrgfa"> + <bpmn:extensionElements> + <camunda:inputOutput> + <camunda:inputParameter name="correlationKey">${target.correlationKey}</camunda:inputParameter> + </camunda:inputOutput> + </bpmn:extensionElements> + <bpmn:incoming>Flow_17saewg</bpmn:incoming> + <bpmn:outgoing>Flow_1dzs2th</bpmn:outgoing> + </bpmn:receiveTask> + <bpmn:startEvent id="Event_0sfgw8l"> + <bpmn:outgoing>Flow_17saewg</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="Flow_1p7mmcy" sourceRef="temporarillyStoreSingleMedicResultShare" targetRef="Event_1q7uhca" /> + <bpmn:sequenceFlow id="Flow_1dzs2th" sourceRef="receiveSingleMedicResultShare" targetRef="temporarillyStoreSingleMedicResultShare" /> + <bpmn:sequenceFlow id="Flow_17saewg" sourceRef="Event_0sfgw8l" targetRef="receiveSingleMedicResultShare" /> + </bpmn:subProcess> + <bpmn:exclusiveGateway id="Gateway_0atmr78"> + <bpmn:incoming>Flow_18n85hs</bpmn:incoming> + <bpmn:incoming>Flow_1688meb</bpmn:incoming> + <bpmn:outgoing>Flow_18sujdf</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:boundaryEvent id="Event_1qabwc2" attachedToRef="Activity_11idi2o"> + <bpmn:outgoing>Flow_1688meb</bpmn:outgoing> + <bpmn:timerEventDefinition id="TimerEventDefinition_0jn3631"> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT5M</bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:boundaryEvent> + <bpmn:sequenceFlow id="Flow_18n85hs" sourceRef="Activity_11idi2o" targetRef="Gateway_0atmr78" /> + <bpmn:sequenceFlow id="Flow_1688meb" sourceRef="Event_1qabwc2" targetRef="Gateway_0atmr78" /> + <bpmn:serviceTask id="Activity_07k3fpm" name="compute multi medic result share" camunda:class="org.highmed.dsf.bpe.service.ComputeMultiMedicResultShare"> + <bpmn:incoming>Flow_18sujdf</bpmn:incoming> + <bpmn:outgoing>Flow_0bm0z7u</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_0bm0z7u" sourceRef="Activity_07k3fpm" targetRef="selectMultiMedicResultShareResponseTarget" /> + <bpmn:serviceTask id="storeSingleMedicResultShareCorrelationKeys" name="store single medic result share correlation keys" camunda:class="org.highmed.dsf.bpe.service.StoreSingleMedicResultShareCorrelationKeys"> + <bpmn:incoming>Flow_0zwnqdn</bpmn:incoming> + <bpmn:outgoing>Flow_15s0sha</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1p3ixg0" sourceRef="selectMultiMedicResultShareResponseTarget" targetRef="EndEvent" /> + <bpmn:serviceTask id="selectMultiMedicResultShareResponseTarget" name="select multi medic result share response target" camunda:class="org.highmed.dsf.bpe.service.SelectMultiMedicResultShareResponseTarget"> + <bpmn:incoming>Flow_0bm0z7u</bpmn:incoming> + <bpmn:outgoing>Flow_1p3ixg0</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_15s0sha" sourceRef="storeSingleMedicResultShareCorrelationKeys" targetRef="Activity_11idi2o" /> + <bpmn:sequenceFlow id="Flow_0zwnqdn" sourceRef="StartEvent" targetRef="storeSingleMedicResultShareCorrelationKeys" /> + <bpmn:sequenceFlow id="Flow_18sujdf" sourceRef="Gateway_0atmr78" targetRef="Activity_07k3fpm" /> + </bpmn:process> + <bpmn:message id="Message_1yz2a31" name="executeFeasibilityMpcMultiShareMessage" /> + <bpmn:message id="Message_1dr71re" name="resultMultiMedicFeasibilityMpcMessage" /> + <bpmn:message id="Message_1ycrgfa" name="resultShareSingleMedicFeasibilityMpcMessage" /> + <bpmn:message id="Message_0qpomdh" name="resultShareMultiMedicFeasibilityMpcMessage" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_executeFeasibilityMpcMultiShare"> + <bpmndi:BPMNEdge id="Flow_1688meb_di" bpmnElement="Flow_1688meb"> + <di:waypoint x="936" y="214" /> + <di:waypoint x="1030" y="214" /> + <di:waypoint x="1030" y="172" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_18n85hs_di" bpmnElement="Flow_18n85hs"> + <di:waypoint x="918" y="147" /> + <di:waypoint x="1005" y="147" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_15s0sha_di" bpmnElement="Flow_15s0sha"> + <di:waypoint x="360" y="147" /> + <di:waypoint x="420" y="147" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0zwnqdn_di" bpmnElement="Flow_0zwnqdn"> + <di:waypoint x="188" y="147" /> + <di:waypoint x="260" y="147" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1p3ixg0_di" bpmnElement="Flow_1p3ixg0"> + <di:waypoint x="1380" y="147" /> + <di:waypoint x="1452" y="147" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0bm0z7u_di" bpmnElement="Flow_0bm0z7u"> + <di:waypoint x="1210" y="147" /> + <di:waypoint x="1280" y="147" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_18sujdf_di" bpmnElement="Flow_18sujdf"> + <di:waypoint x="1055" y="147" /> + <di:waypoint x="1110" y="147" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="Activity_1r2389r_di" bpmnElement="storeSingleMedicResultShareCorrelationKeys"> + <dc:Bounds x="260" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1fzso6r_di" bpmnElement="StartEvent"> + <dc:Bounds x="152" y="129" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="160" y="172" width="22" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_07k3fpm_di" bpmnElement="Activity_07k3fpm"> + <dc:Bounds x="1110" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_19ocdmp_di" bpmnElement="selectMultiMedicResultShareResponseTarget"> + <dc:Bounds x="1280" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> + <dc:Bounds x="1452" y="129" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1428" y="172" width="83" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0atmr78_di" bpmnElement="Gateway_0atmr78" isMarkerVisible="true"> + <dc:Bounds x="1005" y="122" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_11idi2o_di" bpmnElement="Activity_11idi2o" isExpanded="true"> + <dc:Bounds x="420" y="80" width="498" height="134" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_17saewg_di" bpmnElement="Flow_17saewg"> + <di:waypoint x="480" y="149" /> + <di:waypoint x="534" y="149" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1dzs2th_di" bpmnElement="Flow_1dzs2th"> + <di:waypoint x="634" y="149" /> + <di:waypoint x="697" y="149" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1p7mmcy_di" bpmnElement="Flow_1p7mmcy"> + <di:waypoint x="797" y="149" /> + <di:waypoint x="845" y="149" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="Event_1q7uhca_di" bpmnElement="Event_1q7uhca"> + <dc:Bounds x="845" y="131" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1dodsnn_di" bpmnElement="temporarillyStoreSingleMedicResultShare"> + <dc:Bounds x="697" y="109" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_01ldf9a_di" bpmnElement="receiveSingleMedicResultShare"> + <dc:Bounds x="534" y="109" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0sfgw8l_di" bpmnElement="Event_0sfgw8l"> + <dc:Bounds x="444" y="131" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1qabwc2_di" bpmnElement="Event_1qabwc2"> + <dc:Bounds x="900" y="196" width="36" height="36" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn new file mode 100644 index 00000000..c1bdaa9b --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn @@ -0,0 +1,270 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> + <bpmn:process id="highmedorg_executeFeasibilityMpcSingleShare" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:serviceTask id="checkResults" name="check single medic result shares" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResultShares"> + <bpmn:incoming>Flow_1tdtqpl</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="checkFeasibilityMpcResources" name="check feasibility resources" camunda:class="org.highmed.dsf.bpe.service.CheckFeasibilityMpcResources"> + <bpmn:incoming>Flow_1czhll7</bpmn:incoming> + <bpmn:outgoing>Flow_1dnygeo</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:startEvent id="StartEvent" name="start"> + <bpmn:outgoing>SequenceFlow_14cn0vs</bpmn:outgoing> + <bpmn:messageEventDefinition id="MessageEventDefinition_0sjtzj6" messageRef="Message_1yz2a31" /> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_1rmqv20" sourceRef="executeQueries" targetRef="ExclusiveGateway_0bq7zdz" /> + <bpmn:sequenceFlow id="SequenceFlow_14cn0vs" sourceRef="StartEvent" targetRef="downloadFeasibilityMpcResources" /> + <bpmn:serviceTask id="downloadFeasibilityMpcResources" name="download feasibility resources" camunda:class="org.highmed.dsf.bpe.service.DownloadFeasibilityMpcResources"> + <bpmn:incoming>SequenceFlow_14cn0vs</bpmn:incoming> + <bpmn:outgoing>Flow_1czhll7</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_04ouilq" sourceRef="checkResults" targetRef="selectResponseTargetTtp" /> + <bpmn:sequenceFlow id="SequenceFlow_07wtgee" sourceRef="checkQueries" targetRef="ExclusiveGateway_1dln3in" /> + <bpmn:serviceTask id="checkQueries" name="check query" camunda:class="org.highmed.dsf.bpe.service.CheckQueries"> + <bpmn:incoming>Flow_1dnygeo</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_07wtgee</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_1dln3in"> + <bpmn:incoming>SequenceFlow_07wtgee</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0zlq6j4</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0yqpkri</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0zlq6j4" name="else" sourceRef="ExclusiveGateway_1dln3in" targetRef="ExclusiveGateway_1r4c9fx"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsConsentCheck}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0yqpkri" name="needs consent check" sourceRef="ExclusiveGateway_1dln3in" targetRef="replaceCountpartWithIdSelection"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsConsentCheck}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:serviceTask id="replaceCountpartWithIdSelection" name="replace countpart with id selection" camunda:class="org.highmed.dsf.bpe.service.ModifyQueries"> + <bpmn:incoming>SequenceFlow_0yqpkri</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1u1p9j2</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_1r4c9fx"> + <bpmn:incoming>SequenceFlow_0zlq6j4</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1u1p9j2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0bwn08k</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0bwn08k" sourceRef="ExclusiveGateway_1r4c9fx" targetRef="executeQueries" /> + <bpmn:sequenceFlow id="SequenceFlow_1u1p9j2" sourceRef="replaceCountpartWithIdSelection" targetRef="ExclusiveGateway_1r4c9fx" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_0bq7zdz"> + <bpmn:incoming>SequenceFlow_1rmqv20</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0isxkuy</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_17otl7p</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0isxkuy" name="needs consent check" sourceRef="ExclusiveGateway_0bq7zdz" targetRef="filterByConsent"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${needsConsentCheck}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:serviceTask id="filterByConsent" name="filter result by consent" camunda:class="org.highmed.dsf.bpe.service.FilterResultsByConsent"> + <bpmn:incoming>SequenceFlow_0isxkuy</bpmn:incoming> + <bpmn:outgoing>Flow_19itw20</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_17otl7p" name="else" sourceRef="ExclusiveGateway_0bq7zdz" targetRef="ExclusiveGateway_002t87f"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!needsConsentCheck}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:exclusiveGateway id="ExclusiveGateway_002t87f"> + <bpmn:incoming>SequenceFlow_17otl7p</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1kpvsx9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0q803rh</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0q803rh" sourceRef="ExclusiveGateway_002t87f" targetRef="calculateSingleMedicResultShares" /> + <bpmn:sequenceFlow id="SequenceFlow_1kpvsx9" sourceRef="countIds" targetRef="ExclusiveGateway_002t87f" /> + <bpmn:serviceTask id="countIds" name="count id's" camunda:class="org.highmed.dsf.bpe.service.GenerateCountFromIds"> + <bpmn:incoming>Flow_19itw20</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1kpvsx9</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0ascyjc" sourceRef="selectResponseTargetTtp" targetRef="sendSingleMedicResultShares" /> + <bpmn:serviceTask id="selectResponseTargetTtp" name="select single medic result  share targets" camunda:class="org.highmed.dsf.bpe.service.SelectSingleMedicResultShareTargets"> + <bpmn:incoming>SequenceFlow_04ouilq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ascyjc</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:serviceTask id="executeQueries" name="execute query" camunda:class="org.highmed.dsf.bpe.service.ExecuteQueries"> + <bpmn:incoming>SequenceFlow_0bwn08k</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1rmqv20</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1tdtqpl" sourceRef="calculateSingleMedicResultShares" targetRef="checkResults" /> + <bpmn:serviceTask id="calculateSingleMedicResultShares" name="calculate single medic result shares" camunda:class="org.highmed.dsf.bpe.service.CalculateSingleMedicResultShares"> + <bpmn:incoming>SequenceFlow_0q803rh</bpmn:incoming> + <bpmn:outgoing>Flow_1tdtqpl</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sendTask id="sendSingleMedicResultShares" name="send single medic result shares" camunda:class="org.highmed.dsf.bpe.message.SendSingleMedicResultShare"> + <bpmn:extensionElements> + <camunda:inputOutput> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-share-feasibility-mpc|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="messageName">resultShareSingleMedicFeasibilityMpcMessage</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare/0.6.0</camunda:inputParameter> + </camunda:inputOutput> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0ascyjc</bpmn:incoming> + <bpmn:outgoing>Flow_1tfx2ak</bpmn:outgoing> + <bpmn:multiInstanceLoopCharacteristics camunda:collection="${targetsSingleMedicShare.entries}" camunda:elementVariable="target" /> + </bpmn:sendTask> + <bpmn:sequenceFlow id="Flow_19itw20" sourceRef="filterByConsent" targetRef="countIds" /> + <bpmn:sequenceFlow id="Flow_1czhll7" sourceRef="downloadFeasibilityMpcResources" targetRef="checkFeasibilityMpcResources" /> + <bpmn:endEvent id="Event_1smcidr"> + <bpmn:incoming>Flow_1tfx2ak</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="Flow_1tfx2ak" sourceRef="sendSingleMedicResultShares" targetRef="Event_1smcidr" /> + <bpmn:sequenceFlow id="Flow_1dnygeo" sourceRef="checkFeasibilityMpcResources" targetRef="checkQueries" /> + <bpmn:textAnnotation id="TextAnnotation_0euut3n"> + <bpmn:text>uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc.</bpmn:text> + </bpmn:textAnnotation> + <bpmn:association id="Association_1ncewqu" sourceRef="checkFeasibilityMpcResources" targetRef="TextAnnotation_0euut3n" /> + </bpmn:process> + <bpmn:message id="Message_1yz2a31" name="executeFeasibilityMpcSingleShareMessage" /> + <bpmn:message id="Message_1dr71re" name="resultMultiMedicFeasibilityMpcMessage" /> + <bpmn:message id="Message_1ycrgfa" name="resultSingleMedicResultShareFeasibilityMpcMessage" /> + <bpmn:message id="Message_0qpomdh" name="resultShareMultiMedicFeasibilityMpcMessage" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_executeFeasibilityMpcSingleShare"> + <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> + <dc:Bounds x="490" y="113" width="267" height="56" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_1czhll7_di" bpmnElement="Flow_1czhll7"> + <di:waypoint x="360" y="272" /> + <di:waypoint x="440" y="272" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_19itw20_di" bpmnElement="Flow_19itw20"> + <di:waypoint x="1440" y="141" /> + <di:waypoint x="1520" y="141" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1tdtqpl_di" bpmnElement="Flow_1tdtqpl"> + <di:waypoint x="1770" y="272" /> + <di:waypoint x="1860" y="272" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ascyjc_di" bpmnElement="SequenceFlow_0ascyjc"> + <di:waypoint x="2130" y="272" /> + <di:waypoint x="2210" y="272" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1kpvsx9_di" bpmnElement="SequenceFlow_1kpvsx9"> + <di:waypoint x="1570" y="181" /> + <di:waypoint x="1570" y="247" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0q803rh_di" bpmnElement="SequenceFlow_0q803rh"> + <di:waypoint x="1595" y="272" /> + <di:waypoint x="1670" y="272" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_17otl7p_di" bpmnElement="SequenceFlow_17otl7p"> + <di:waypoint x="1245" y="272" /> + <di:waypoint x="1545" y="272" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1254" y="254" width="21" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0isxkuy_di" bpmnElement="SequenceFlow_0isxkuy"> + <di:waypoint x="1220" y="247" /> + <di:waypoint x="1220" y="141" /> + <di:waypoint x="1340" y="141" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1227" y="146" width="72" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1u1p9j2_di" bpmnElement="SequenceFlow_1u1p9j2"> + <di:waypoint x="940" y="181" /> + <di:waypoint x="940" y="247" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0bwn08k_di" bpmnElement="SequenceFlow_0bwn08k"> + <di:waypoint x="965" y="272" /> + <di:waypoint x="1030" y="272" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0yqpkri_di" bpmnElement="SequenceFlow_0yqpkri"> + <di:waypoint x="788" y="247" /> + <di:waypoint x="788" y="141" /> + <di:waypoint x="890" y="141" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="793" y="146" width="72" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0zlq6j4_di" bpmnElement="SequenceFlow_0zlq6j4"> + <di:waypoint x="813" y="272" /> + <di:waypoint x="915" y="272" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="817" y="254" width="21" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_07wtgee_di" bpmnElement="SequenceFlow_07wtgee"> + <di:waypoint x="700" y="272" /> + <di:waypoint x="763" y="272" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_04ouilq_di" bpmnElement="SequenceFlow_04ouilq"> + <di:waypoint x="1960" y="272" /> + <di:waypoint x="2030" y="272" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_14cn0vs_di" bpmnElement="SequenceFlow_14cn0vs"> + <di:waypoint x="188" y="272" /> + <di:waypoint x="260" y="272" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1rmqv20_di" bpmnElement="SequenceFlow_1rmqv20"> + <di:waypoint x="1130" y="272" /> + <di:waypoint x="1195" y="272" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1tfx2ak_di" bpmnElement="Flow_1tfx2ak"> + <di:waypoint x="2310" y="272" /> + <di:waypoint x="2372" y="272" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1dnygeo_di" bpmnElement="Flow_1dnygeo"> + <di:waypoint x="540" y="272" /> + <di:waypoint x="600" y="272" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> + <dc:Bounds x="1860" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_1pt9xhp_di" bpmnElement="checkQueries"> + <dc:Bounds x="600" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1dln3in_di" bpmnElement="ExclusiveGateway_1dln3in" isMarkerVisible="true"> + <dc:Bounds x="763" y="247" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_02nwn9u_di" bpmnElement="replaceCountpartWithIdSelection"> + <dc:Bounds x="890" y="101" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1r4c9fx_di" bpmnElement="ExclusiveGateway_1r4c9fx" isMarkerVisible="true"> + <dc:Bounds x="915" y="247" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0bq7zdz_di" bpmnElement="ExclusiveGateway_0bq7zdz" isMarkerVisible="true"> + <dc:Bounds x="1195" y="247" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0l3b9as_di" bpmnElement="filterByConsent"> + <dc:Bounds x="1340" y="101" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_002t87f_di" bpmnElement="ExclusiveGateway_002t87f" isMarkerVisible="true"> + <dc:Bounds x="1545" y="247" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_17kpyle_di" bpmnElement="countIds"> + <dc:Bounds x="1520" y="101" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> + <dc:Bounds x="2030" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0u5pb4i_di" bpmnElement="executeQueries"> + <dc:Bounds x="1030" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkFeasibilityMpcResources"> + <dc:Bounds x="440" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0b8j3ka_di" bpmnElement="downloadFeasibilityMpcResources"> + <dc:Bounds x="260" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1fzso6r_di" bpmnElement="StartEvent"> + <dc:Bounds x="152" y="254" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="160" y="297" width="22" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0z7c65s_di" bpmnElement="calculateSingleMedicResultShares"> + <dc:Bounds x="1670" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0j0x0r2_di" bpmnElement="sendSingleMedicResultShares"> + <dc:Bounds x="2210" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1smcidr_di" bpmnElement="Event_1smcidr"> + <dc:Bounds x="2372" y="254" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> + <di:waypoint x="460" y="230" /> + <di:waypoint x="460" y="140" /> + <di:waypoint x="490" y="140" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn new file mode 100644 index 00000000..89e814d4 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn @@ -0,0 +1,232 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0inb4ax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> + <bpmn:process id="highmedorg_requestFeasibilityMpc" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:startEvent id="StartEvent" name="start"> + <bpmn:outgoing>SequenceFlow_11k77gx</bpmn:outgoing> + <bpmn:messageEventDefinition id="MessageEventDefinition_10c2suu" messageRef="Message_1pq9qxp" /> + </bpmn:startEvent> + <bpmn:serviceTask id="selectMultiMedicResultSharetTargets" name="select multi medic result share targets" camunda:class="org.highmed.dsf.bpe.service.SelectMultiMedicResultShareTargets"> + <bpmn:incoming>SequenceFlow_18ajfnh</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0b5s4ef</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sendTask id="sendRequestMultiShareToMedics" name="send request multi share to medics" camunda:class="org.highmed.dsf.bpe.message.SendMedicRequestMultiShare"> + <bpmn:extensionElements> + <camunda:inputOutput> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="messageName">executeFeasibilityMpcMultiShareMessage</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-multi-share|0.6.0</camunda:inputParameter> + </camunda:inputOutput> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0b5s4ef</bpmn:incoming> + <bpmn:outgoing>Flow_1k1a943</bpmn:outgoing> + <bpmn:multiInstanceLoopCharacteristics camunda:collection="${targets.entries}" camunda:elementVariable="target" /> + </bpmn:sendTask> + <bpmn:sequenceFlow id="SequenceFlow_11k77gx" sourceRef="StartEvent" targetRef="downloadResearchStudyResource" /> + <bpmn:sequenceFlow id="SequenceFlow_0b5s4ef" sourceRef="selectMultiMedicResultSharetTargets" targetRef="sendRequestMultiShareToMedics" /> + <bpmn:serviceTask id="downloadResearchStudyResource" name="download research study resource" camunda:class="org.highmed.dsf.bpe.service.DownloadResearchStudyResource"> + <bpmn:incoming>SequenceFlow_11k77gx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18ajfnh</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_18ajfnh" sourceRef="downloadResearchStudyResource" targetRef="selectMultiMedicResultSharetTargets" /> + <bpmn:subProcess id="Activity_0lcbiwk"> + <bpmn:incoming>Flow_1b19aj3</bpmn:incoming> + <bpmn:outgoing>Flow_0w3k4vv</bpmn:outgoing> + <bpmn:multiInstanceLoopCharacteristics camunda:collection="${targets.entries}" camunda:elementVariable="target" /> + <bpmn:endEvent id="Event_1j6g4x8"> + <bpmn:incoming>Flow_13lm9he</bpmn:incoming> + </bpmn:endEvent> + <bpmn:serviceTask id="Activity_0289vyo" name="temporarilly store multi medic result share" camunda:class="org.highmed.dsf.bpe.service.StoreResultsMultiMedicShare"> + <bpmn:incoming>Flow_0j3mv3q</bpmn:incoming> + <bpmn:outgoing>Flow_13lm9he</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:receiveTask id="Activity_1jnfv03" name="receive multi medic result share" messageRef="Message_1k57zqd"> + <bpmn:extensionElements> + <camunda:inputOutput> + <camunda:inputParameter name="correlationKey">${target.correlationKey}</camunda:inputParameter> + </camunda:inputOutput> + </bpmn:extensionElements> + <bpmn:incoming>Flow_0t3ex93</bpmn:incoming> + <bpmn:outgoing>Flow_0j3mv3q</bpmn:outgoing> + </bpmn:receiveTask> + <bpmn:startEvent id="Event_1xy6pw3"> + <bpmn:outgoing>Flow_0t3ex93</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="Flow_13lm9he" sourceRef="Activity_0289vyo" targetRef="Event_1j6g4x8" /> + <bpmn:sequenceFlow id="Flow_0j3mv3q" sourceRef="Activity_1jnfv03" targetRef="Activity_0289vyo" /> + <bpmn:sequenceFlow id="Flow_0t3ex93" sourceRef="Event_1xy6pw3" targetRef="Activity_1jnfv03" /> + </bpmn:subProcess> + <bpmn:boundaryEvent id="Event_1ih81k1" attachedToRef="Activity_0lcbiwk"> + <bpmn:outgoing>Flow_0nau6pf</bpmn:outgoing> + <bpmn:timerEventDefinition id="TimerEventDefinition_0tvpxsv"> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT5M</bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:boundaryEvent> + <bpmn:sequenceFlow id="Flow_1k1a943" sourceRef="sendRequestMultiShareToMedics" targetRef="sendRequestSingleShareToMedics" /> + <bpmn:serviceTask id="Activity_044pdxe" name="calculate multimedic cohort size" camunda:class="org.highmed.dsf.bpe.service.CalculateMulitMedicResultShares"> + <bpmn:incoming>Flow_161cxwt</bpmn:incoming> + <bpmn:outgoing>Flow_08i18td</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:exclusiveGateway id="Gateway_1cv27w0"> + <bpmn:incoming>Flow_0w3k4vv</bpmn:incoming> + <bpmn:incoming>Flow_0nau6pf</bpmn:incoming> + <bpmn:outgoing>Flow_161cxwt</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_0w3k4vv" sourceRef="Activity_0lcbiwk" targetRef="Gateway_1cv27w0" /> + <bpmn:sequenceFlow id="Flow_0nau6pf" sourceRef="Event_1ih81k1" targetRef="Gateway_1cv27w0" /> + <bpmn:sequenceFlow id="Flow_161cxwt" sourceRef="Gateway_1cv27w0" targetRef="Activity_044pdxe" /> + <bpmn:serviceTask id="Activity_0o1pue0" name="check multimedic cohort size" camunda:class="org.highmed.dsf.bpe.service.CheckMultiMedicResults"> + <bpmn:incoming>Flow_08i18td</bpmn:incoming> + <bpmn:outgoing>Flow_1atjmt6</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1atjmt6" sourceRef="Activity_0o1pue0" targetRef="Event_123lecz" /> + <bpmn:sequenceFlow id="Flow_08i18td" sourceRef="Activity_044pdxe" targetRef="Activity_0o1pue0" /> + <bpmn:endEvent id="Event_123lecz" name="success"> + <bpmn:extensionElements> + <camunda:inputOutput> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibilityMpc/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="messageName">resultMultiMedicFeasibilityMpcMessage</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-FeasibilityMpc|0.6.0</camunda:inputParameter> + </camunda:inputOutput> + </bpmn:extensionElements> + <bpmn:incoming>Flow_1atjmt6</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sendTask id="sendRequestSingleShareToMedics" name="send request single share to medics" camunda:class="org.highmed.dsf.bpe.message.SendMedicRequestSingleShare"> + <bpmn:extensionElements> + <camunda:inputOutput> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibilityMpcSingleShare/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="messageName">executeFeasibilityMpcSingleShareMessage</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-single-share|0.6.0</camunda:inputParameter> + </camunda:inputOutput> + </bpmn:extensionElements> + <bpmn:incoming>Flow_1k1a943</bpmn:incoming> + <bpmn:outgoing>Flow_1b19aj3</bpmn:outgoing> + <bpmn:multiInstanceLoopCharacteristics camunda:collection="${targets.entries}" camunda:elementVariable="target" /> + </bpmn:sendTask> + <bpmn:sequenceFlow id="Flow_1b19aj3" sourceRef="sendRequestSingleShareToMedics" targetRef="Activity_0lcbiwk" /> + </bpmn:process> + <bpmn:message id="Message_1pq9qxp" name="requestFeasibilityMpcMessage" /> + <bpmn:message id="Message_07ayhv1" name="resultFeasibilityMpcMessage" /> + <bpmn:message id="Message_0gifb86" name="computeFeasibilityMpcMessage" /> + <bpmn:error id="Error_0dl03kn" /> + <bpmn:error id="Error_07exqe7" /> + <bpmn:error id="Error_1jhmarr" /> + <bpmn:message id="Message_0qfng3q" name="receiveMultiMedicCohortSizeResultMessage" /> + <bpmn:message id="Message_0srg3vv" name="resultMultiMedicFeasibilityMpcMessage" /> + <bpmn:message id="Message_0nmxozg" name="errorFeasibilityMpcMessage" /> + <bpmn:message id="Message_1y0yxv0" name="resultMultiMedicFeasibilityMpcMessage" /> + <bpmn:message id="Message_0v1bo0o" name="errorFeasibilityMpcMessage" /> + <bpmn:message id="Message_10vqhu0" name="errorMultiMedicFeasibilityMpcMessage" /> + <bpmn:message id="Message_1vrxfsk" name="resultMultiMedicFeasibilityMpcMessage" /> + <bpmn:message id="Message_1k57zqd" name="resultShareMultiMedicFeasibilityMpcMessage" /> + <bpmn:message id="Message_15g8gns" name="resultMultiMedicFeasibilityMpcMessage" /> + <bpmn:message id="Message_1hrloi3" name="errorMultiMedicFeasibilityMpcMessage" /> + <bpmn:error id="Error_0ttn640" name="errorMultiMedicFeasibilityMpcResult" errorCode="errorMultiMedicFeasibilityMpcResult" camunda:errorMessage="errorMultiMedicFeasibilityMpcResult" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_requestFeasibilityMpc"> + <bpmndi:BPMNEdge id="Flow_08i18td_di" bpmnElement="Flow_08i18td"> + <di:waypoint x="1720" y="145" /> + <di:waypoint x="1790" y="145" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1atjmt6_di" bpmnElement="Flow_1atjmt6"> + <di:waypoint x="1890" y="145" /> + <di:waypoint x="1962" y="145" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_161cxwt_di" bpmnElement="Flow_161cxwt"> + <di:waypoint x="1555" y="145" /> + <di:waypoint x="1620" y="145" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0nau6pf_di" bpmnElement="Flow_0nau6pf"> + <di:waypoint x="1426" y="212" /> + <di:waypoint x="1530" y="212" /> + <di:waypoint x="1530" y="170" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0w3k4vv_di" bpmnElement="Flow_0w3k4vv"> + <di:waypoint x="1408" y="145" /> + <di:waypoint x="1505" y="145" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1k1a943_di" bpmnElement="Flow_1k1a943"> + <di:waypoint x="690" y="145" /> + <di:waypoint x="750" y="145" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_18ajfnh_di" bpmnElement="SequenceFlow_18ajfnh"> + <di:waypoint x="340" y="145" /> + <di:waypoint x="410" y="145" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0b5s4ef_di" bpmnElement="SequenceFlow_0b5s4ef"> + <di:waypoint x="510" y="145" /> + <di:waypoint x="590" y="145" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_11k77gx_di" bpmnElement="SequenceFlow_11k77gx"> + <di:waypoint x="188" y="145" /> + <di:waypoint x="240" y="145" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1b19aj3_di" bpmnElement="Flow_1b19aj3"> + <di:waypoint x="850" y="145" /> + <di:waypoint x="910" y="145" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="StartEvent_1ozsjmr_di" bpmnElement="StartEvent"> + <dc:Bounds x="152" y="127" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="160" y="170" width="22" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_052xqjx_di" bpmnElement="downloadResearchStudyResource"> + <dc:Bounds x="240" y="105" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0vfud44_di" bpmnElement="selectMultiMedicResultSharetTargets"> + <dc:Bounds x="410" y="105" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_044pdxe_di" bpmnElement="Activity_044pdxe"> + <dc:Bounds x="1620" y="105" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_1cv27w0_di" bpmnElement="Gateway_1cv27w0" isMarkerVisible="true"> + <dc:Bounds x="1505" y="120" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0o1pue0_di" bpmnElement="Activity_0o1pue0"> + <dc:Bounds x="1790" y="105" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0r58kgi_di" bpmnElement="Event_123lecz"> + <dc:Bounds x="1962" y="127" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1961" y="170" width="40" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1uwfouh_di" bpmnElement="sendRequestSingleShareToMedics"> + <dc:Bounds x="750" y="105" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SendTask_1pu8i9n_di" bpmnElement="sendRequestMultiShareToMedics"> + <dc:Bounds x="590" y="105" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0lcbiwk_di" bpmnElement="Activity_0lcbiwk" isExpanded="true"> + <dc:Bounds x="910" y="78" width="498" height="134" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_0t3ex93_di" bpmnElement="Flow_0t3ex93"> + <di:waypoint x="970" y="147" /> + <di:waypoint x="1024" y="147" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0j3mv3q_di" bpmnElement="Flow_0j3mv3q"> + <di:waypoint x="1124" y="147" /> + <di:waypoint x="1187" y="147" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_13lm9he_di" bpmnElement="Flow_13lm9he"> + <di:waypoint x="1287" y="147" /> + <di:waypoint x="1335" y="147" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="Event_1j6g4x8_di" bpmnElement="Event_1j6g4x8"> + <dc:Bounds x="1335" y="129" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0289vyo_di" bpmnElement="Activity_0289vyo"> + <dc:Bounds x="1187" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1jnfv03_di" bpmnElement="Activity_1jnfv03"> + <dc:Bounds x="1024" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1xy6pw3_di" bpmnElement="Event_1xy6pw3"> + <dc:Bounds x="934" y="129" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1ih81k1_di" bpmnElement="Event_1ih81k1"> + <dc:Bounds x="1390" y="194" width="36" height="36" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml new file mode 100644 index 00000000..7f4c5b96 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml @@ -0,0 +1,168 @@ +<ActivityDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag"/> + <code value="ALL"/> + </tag> + </meta> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> + <extension url="message-name"> + <valueString value="executeFeasibilityMpcMessage"/> + </extension> + <extension url="task-profile"> + <valueCanonical + value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc|${version}"/> + </extension> + <extension url="requester"> + <valueCoding> + <extension + url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier"/> + <value value="highmed.org"/> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-role"/> + <code value="MeDIC"/> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization"/> + <code value="LOCAL_ROLE"/> + </valueCoding> + </extension> + <extension url="requester"> + <valueCoding> + <extension + url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier"/> + <value value="highmed.org"/> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-role"/> + <code value="MeDIC"/> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization"/> + <code value="REMOTE_ROLE"/> + </valueCoding> + </extension> + <extension url="recipient"> + <valueCoding> + <extension + url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier"/> + <value value="highmed.org"/> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-role"/> + <code value="MeDIC"/> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization"/> + <code value="LOCAL_ROLE"/> + </valueCoding> + </extension> + </extension> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> + <extension url="message-name"> + <valueString value="resultShareSingleMedicFeasibilityMpcMessage" /> + </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-single-medic-result-share-feasibility-mpc|${version}" /> + </extension> + <extension url="requester"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ROLE" /> + </valueCoding> + </extension> + <extension url="requester"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="REMOTE_ROLE" /> + </valueCoding> + </extension> + <extension url="recipient"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ROLE" /> + </valueCoding> + </extension> + </extension> + <url value="http://highmed.org/bpe/Process/executeFeasibilityMpc"/> + <!-- version managed by bpe --> + <version value="${version}"/> + <name value="ExecuteFeasibilityMpc"/> + <title value="Execute Feasibility Mpc"/> + <subtitle value="Feasibility Mpc Execution Process"/> + <!-- status managed by bpe --> + <status value="unknown"/> + <experimental value="false"/> + <date value="2021-08-24"/> + <publisher value="HiGHmed"/> + <contact> + <name value="HiGHmed"/> + <telecom> + <system value="email"/> + <value value="pmo@highmed.org"/> + </telecom> + </contact> + <description value="Process executes feasibility query and sends single medic result shares to each MeDIC, process receives single medic result shares from each MeDIC, process calculates multi medic result share and sends it to coordinating MeDIC"/> + <kind value="Task"/> +</ActivityDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml new file mode 100644 index 00000000..b5f697f9 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml @@ -0,0 +1,100 @@ +<ActivityDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag"/> + <code value="ALL"/> + </tag> + </meta> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> + <extension url="message-name"> + <valueString value="executeFeasibilityMpcSingleShareMessage"/> + </extension> + <extension url="task-profile"> + <valueCanonical + value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-single-share|${version}"/> + </extension> + <extension url="requester"> + <valueCoding> + <extension + url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier"/> + <value value="highmed.org"/> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-role"/> + <code value="MeDIC"/> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization"/> + <code value="LOCAL_ROLE"/> + </valueCoding> + </extension> + <extension url="requester"> + <valueCoding> + <extension + url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier"/> + <value value="highmed.org"/> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-role"/> + <code value="MeDIC"/> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization"/> + <code value="REMOTE_ROLE"/> + </valueCoding> + </extension> + <extension url="recipient"> + <valueCoding> + <extension + url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier"/> + <value value="highmed.org"/> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-role"/> + <code value="MeDIC"/> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization"/> + <code value="LOCAL_ROLE"/> + </valueCoding> + </extension> + </extension> + <url value="http://highmed.org/bpe/Process/executeFeasibilityMpcSingleShare"/> + <!-- version managed by bpe --> + <version value="${version}"/> + <name value="ExecuteFeasibilityMpcSingleShare"/> + <title value="Execute Feasibility Mpc Single Share"/> + <subtitle value="Feasibility Mpc Single Share Execution Process"/> + <!-- status managed by bpe --> + <status value="unknown"/> + <experimental value="false"/> + <date value="2021-08-24"/> + <publisher value="HiGHmed"/> + <contact> + <name value="HiGHmed"/> + <telecom> + <system value="email"/> + <value value="pmo@highmed.org"/> + </telecom> + </contact> + <description value="Process executes feasibility query and sends single medic result shares to each MeDIC"/> + <kind value="Task"/> +</ActivityDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml new file mode 100644 index 00000000..8101e341 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml @@ -0,0 +1,144 @@ +<ActivityDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> + <extension url="message-name"> + <valueString value="requestFeasibilityMpcMessage" /> + </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-request-feasibility-mpc|${version}" /> + </extension> + <extension url="requester"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ROLE" /> + </valueCoding> + </extension> + <extension url="recipient"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ROLE" /> + </valueCoding> + </extension> + </extension> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> + <extension url="message-name"> + <valueString value="resultShareMultiMedicFeasibilityMpcMessage" /> + </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-share-feasibility-mpc|${version}" /> + </extension> + <extension url="requester"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ROLE" /> + </valueCoding> + </extension> + <extension url="requester"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="REMOTE_ROLE" /> + </valueCoding> + </extension> + <extension url="recipient"> + <valueCoding> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization-consortium-role"> + <extension url="consortium"> + <valueIdentifier> + <system value="http://highmed.org/sid/organization-identifier" /> + <value value="highmed.org" /> + </valueIdentifier> + </extension> + <extension url="role"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/organization-role" /> + <code value="MeDIC" /> + </valueCoding> + </extension> + </extension> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ROLE" /> + </valueCoding> + </extension> + </extension> + <url value="http://highmed.org/bpe/Process/requestFeasibilityMpc" /> + <!-- version managed by bpe --> + <version value="${version}" /> + <name value="RequestFeasibilityMpc" /> + <title value="Request Feasibility Mpc" /> + <subtitle value="Feasibility Mpc Request Process" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2021-08-24" /> + <publisher value="HiGHmed" /> + <contact> + <name value="HiGHmed" /> + <telecom> + <system value="email" /> + <value value="pmo@highmed.org" /> + </telecom> + </contact> + <description value="Process starts feasibility execution using MPC at each MeDIC, process receives multi medic result shares from each MeDIC" /> + <kind value="Task" /> +</ActivityDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml new file mode 100644 index 00000000..094af2c4 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml @@ -0,0 +1,103 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-multi-share" /> + <!-- version managed by bpe --> + <version value="${version}" /> + <name value="TaskExecuteFeasibilityMpcMultiShare" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2021-08-24" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Task" /> + <baseDefinition value="http://highmed.org/fhir/StructureDefinition/task-base" /> + <derivation value="constraint" /> + <differential> + <element id="Task.instantiatesUri"> + <path value="Task.instantiatesUri" /> + <fixedUri value="http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare/${version}" /> + </element> + <element id="Task.input"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <min value="3" /> + </element> + <element id="Task.input:message-name"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="message-name" /> + </element> + <element id="Task.input:message-name.value[x]"> + <path value="Task.input.value[x]" /> + <fixedString value="executeFeasibilityMpcMultiShareMessage" /> + </element> + <element id="Task.input:business-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="business-key" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="correlation-key" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:medic-correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="medic-correlation-key" /> + <min value="1" /> + </element> + <element id="Task.input:medic-correlation-key.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:medic-correlation-key.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:medic-correlation-key.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:medic-correlation-key.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="medic-correlation-key" /> + </element> + <element id="Task.input:medic-correlation-key.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="string" /> + </type> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-single-share.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-single-share.xml new file mode 100644 index 00000000..a87add9f --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-single-share.xml @@ -0,0 +1,145 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-single-share" /> + <!-- version managed by bpe --> + <version value="${version}" /> + <name value="TaskExecuteFeasibilityMpcSingleShare" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2021-08-24" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Task" /> + <baseDefinition value="http://highmed.org/fhir/StructureDefinition/task-base" /> + <derivation value="constraint" /> + <differential> + <element id="Task.instantiatesUri"> + <path value="Task.instantiatesUri" /> + <fixedUri value="http://highmed.org/bpe/Process/executeFeasibilityMpcSingleShare/${version}" /> + </element> + <element id="Task.input"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <min value="5" /> + </element> + <element id="Task.input:message-name"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="message-name" /> + </element> + <element id="Task.input:message-name.value[x]"> + <path value="Task.input.value[x]" /> + <fixedString value="executeFeasibilityMpcSingleShareMessage" /> + </element> + <element id="Task.input:business-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="business-key" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="correlation-key" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:research-study"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="research-study" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:research-study.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:research-study.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:research-study.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:research-study.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="research-study-reference" /> + </element> + <element id="Task.input:research-study.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="Reference" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/research-study" /> + </type> + </element> + <element id="Task.input:needs-consent-check"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="needs-consent-check" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:needs-consent-check.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:needs-consent-check.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:needs-consent-check.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:needs-consent-check.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="needs-consent-check" /> + </element> + <element id="Task.input:needs-consent-check.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="boolean" /> + </type> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml new file mode 100644 index 00000000..b0987324 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml @@ -0,0 +1,123 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-share-feasibility-mpc" /> + <!-- version managed by bpe --> + <version value="${version}" /> + <name value="TaskMultiMedicResultFeasibilityMpc" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2021-08-24" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Task" /> + <baseDefinition value="http://highmed.org/fhir/StructureDefinition/task-base" /> + <derivation value="constraint" /> + <differential> + <element id="Task.instantiatesUri"> + <path value="Task.instantiatesUri" /> + <fixedUri value="http://highmed.org/bpe/Process/requestFeasibilityMpc/${version}" /> + </element> + <element id="Task.input"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <min value="4" /> + </element> + <element id="Task.input:message-name"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="message-name" /> + </element> + <element id="Task.input:message-name.value[x]"> + <path value="Task.input.value[x]" /> + <fixedString value="resultShareMultiMedicFeasibilityMpcMessage" /> + </element> + <element id="Task.input:business-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="business-key" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="correlation-key" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:multi-medic-result-share"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="multi-medic-result-share" /> + <min value="1" /> + <max value="*" /> + </element> + <element id="Task.input:multi-medic-result-share.extension"> + <path value="Task.input.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + </element> + <element id="Task.input:multi-medic-result-share.extension:group-id"> + <path value="Task.input.extension" /> + <sliceName value="group-id" /> + <min value="1" /> + <type> + <code value="Extension" /> + <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> + </type> + </element> + <element id="Task.input:multi-medic-result-share.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:multi-medic-result-share.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:multi-medic-result-share.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:multi-medic-result-share.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="multi-medic-result-share" /> + </element> + <element id="Task.input:multi-medic-result-share.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="unsignedInt" /> + </type> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility-mpc.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility-mpc.xml new file mode 100644 index 00000000..cca5aa0c --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility-mpc.xml @@ -0,0 +1,309 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/task-request-feasibility-mpc" /> + <!-- version managed by bpe --> + <version value="${version}" /> + <name value="TaskRequestFeasibilityMpc" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2021-08-24" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Task" /> + <baseDefinition value="http://highmed.org/fhir/StructureDefinition/task-base" /> + <derivation value="constraint" /> + <differential> + <element id="Task.instantiatesUri"> + <path value="Task.instantiatesUri" /> + <fixedUri value="http://highmed.org/bpe/Process/requestFeasibilityMpc/${version}" /> + </element> + <element id="Task.input"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <min value="4" /> + <max value="4" /> + </element> + <element id="Task.input:message-name"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="message-name" /> + </element> + <element id="Task.input:message-name.value[x]"> + <path value="Task.input.value[x]" /> + <fixedString value="requestFeasibilityMpcMessage" /> + </element> + <element id="Task.input:business-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="business-key" /> + <max value="0" /> + </element> + <element id="Task.input:correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="correlation-key" /> + <max value="0" /> + </element> + <element id="Task.input:research-study-reference"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="research-study-reference" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:research-study-reference.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:research-study-reference.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:research-study-reference.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:research-study-reference.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="research-study-reference" /> + </element> + <element id="Task.input:research-study-reference.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="Reference" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/research-study" /> + </type> + </element> + <element id="Task.input:research-study-reference.value[x].reference"> + <path value="Task.input.value[x].reference" /> + <min value="1" /> + </element> + <element id="Task.input:research-study-reference.value[x].identifier"> + <path value="Task.input.value[x].identifier" /> + <max value="0" /> + </element> + <element id="Task.input:consortium-identifier"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="consortium-identifier" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:consortium-identifier.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:consortium-identifier.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:consortium-identifier.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:consortium-identifier.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="consortium-identifier" /> + </element> + <element id="Task.input:consortium-identifier.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="Reference" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/organization" /> + </type> + </element> + <element id="Task.input:consortium-identifier.value[x].reference"> + <path value="Task.input.value[x].reference" /> + <max value="0" /> + </element> + <element id="Task.input:consortium-identifier.value[x].identifier"> + <path value="Task.input.value[x].identifier" /> + <min value="1" /> + </element> + <element id="Task.input:needs-consent-check"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="needs-consent-check" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:needs-consent-check.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:needs-consent-check.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:needs-consent-check.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:needs-consent-check.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="needs-consent-check" /> + </element> + <element id="Task.input:needs-consent-check.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="boolean" /> + </type> + </element> + <element id="Task.output:participating-medics"> + <path value="Task.output" /> + <sliceName value="participating-medics" /> + </element> + <element id="Task.output:participating-medics.extension"> + <path value="Task.output.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + </element> + <element id="Task.output:participating-medics.extension:group-id"> + <path value="Task.output.extension" /> + <sliceName value="group-id" /> + <min value="1" /> + <type> + <code value="Extension" /> + <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> + </type> + </element> + <element id="Task.output:participating-medics.type"> + <path value="Task.output.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskOutputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.output:participating-medics.type.coding"> + <path value="Task.output.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.output:participating-medics.type.coding.system"> + <path value="Task.output.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.output:participating-medics.type.coding.code"> + <path value="Task.output.type.coding.code" /> + <min value="1" /> + <fixedCode value="participating-medics" /> + </element> + <element id="Task.output:participating-medics.value[x]"> + <path value="Task.output.value[x]" /> + <type> + <code value="unsignedInt" /> + </type> + </element> + <element id="Task.output:multi-medic-count-result"> + <path value="Task.output" /> + <sliceName value="multi-medic-count-result" /> + </element> + <element id="Task.output:multi-medic-count-result.extension"> + <path value="Task.output.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + </element> + <element id="Task.output:multi-medic-count-result.extension:group-id"> + <path value="Task.output.extension" /> + <sliceName value="group-id" /> + <min value="1" /> + <type> + <code value="Extension" /> + <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> + </type> + </element> + <element id="Task.output:multi-medic-count-result.type"> + <path value="Task.output.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskOutputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.output:multi-medic-count-result.type.coding"> + <path value="Task.output.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.output:multi-medic-count-result.type.coding.system"> + <path value="Task.output.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.output:multi-medic-count-result.type.coding.code"> + <path value="Task.output.type.coding.code" /> + <min value="1" /> + <fixedCode value="multi-medic-count-result" /> + </element> + <element id="Task.output:multi-medic-count-result.value[x]"> + <path value="Task.output.value[x]" /> + <type> + <code value="unsignedInt" /> + </type> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml new file mode 100644 index 00000000..716b8ea7 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml @@ -0,0 +1,123 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/task-single-medic-result-share-feasibility-mpc" /> + <!-- version managed by bpe --> + <version value="${version}" /> + <name value="TaskSingleMedicResultShareFeasibilityMpc" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <date value="2021-08-24" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Task" /> + <baseDefinition value="http://highmed.org/fhir/StructureDefinition/task-base" /> + <derivation value="constraint" /> + <differential> + <element id="Task.instantiatesUri"> + <path value="Task.instantiatesUri" /> + <fixedUri value="http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare/${version}" /> + </element> + <element id="Task.input"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <min value="4" /> + </element> + <element id="Task.input:message-name"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="message-name" /> + </element> + <element id="Task.input:message-name.value[x]"> + <path value="Task.input.value[x]" /> + <fixedString value="resultShareSingleMedicFeasibilityMpcMessage" /> + </element> + <element id="Task.input:business-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="business-key" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="correlation-key" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:single-medic-result-share"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="single-medic-result-share" /> + <min value="1" /> + <max value="*" /> + </element> + <element id="Task.input:single-medic-result-share.extension"> + <path value="Task.input.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + </element> + <element id="Task.input:single-medic-result-share.extension:group-id"> + <path value="Task.input.extension" /> + <sliceName value="group-id" /> + <min value="1" /> + <type> + <code value="Extension" /> + <profile value="http://highmed.org/fhir/StructureDefinition/extension-group-id" /> + </type> + </element> + <element id="Task.input:single-medic-result-share.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/data-sharing" /> + </binding> + </element> + <element id="Task.input:single-medic-result-share.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:single-medic-result-share.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/data-sharing" /> + </element> + <element id="Task.input:single-medic-result-share.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="single-medic-result-share" /> + </element> + <element id="Task.input:single-medic-result-share.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="unsignedInt" /> + </type> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter.java new file mode 100644 index 00000000..d02014f4 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter.java @@ -0,0 +1,178 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsBase.CODE_TYPE_AQL_QUERY; +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP; +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_QUERY; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHEMD_RESEARCH_STUDY; +import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHMED_GROUP; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONSORTIUM_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_CONSORTIUM_HIGHMED; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; + +import java.util.Arrays; +import java.util.Date; +import java.util.UUID; + +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelperImpl; +import org.hl7.fhir.r4.model.BooleanType; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.Bundle.BundleType; +import org.hl7.fhir.r4.model.Bundle.HTTPVerb; +import org.hl7.fhir.r4.model.Expression; +import org.hl7.fhir.r4.model.Group; +import org.hl7.fhir.r4.model.Group.GroupType; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Narrative; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResearchStudy; +import org.hl7.fhir.r4.model.ResearchStudy.ResearchStudyStatus; +import org.hl7.fhir.r4.model.ResourceType; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.TaskIntent; +import org.hl7.fhir.r4.model.Task.TaskStatus; + +public abstract class AbstractRequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter +{ + private final boolean needsConsentCheck = true; + + private final String query = "SELECT COUNT(e) FROM EHR e"; + + private final String[] medicIdentifier = new String[] { NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1, + NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_2, + NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_3 }; + private final String ttpIdentifier = NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; + + private final ReadAccessHelper readAccessHelper = new ReadAccessHelperImpl(); + + protected void main(String[] args, String baseUrl) throws Exception + { + Bundle bundle = createStartResource(); + ExampleStarter.forServer(args, baseUrl).startWith(bundle); + } + + private Bundle createStartResource() + { + Group group1 = createGroup("Group 1"); + Group group2 = createGroup("Group 2"); + ResearchStudy researchStudy = createResearchStudy(group1, group2); + Task task = createTask(researchStudy); + + Bundle bundle = new Bundle(); + bundle.setType(BundleType.TRANSACTION); + bundle.addEntry().setResource(group1).setFullUrl(group1.getIdElement().getIdPart()).getRequest() + .setMethod(HTTPVerb.POST).setUrl(ResourceType.Group.name()); + bundle.addEntry().setResource(group2).setFullUrl(group2.getIdElement().getIdPart()).getRequest() + .setMethod(HTTPVerb.POST).setUrl(ResourceType.Group.name()); + bundle.addEntry().setResource(researchStudy).setFullUrl(researchStudy.getIdElement().getIdPart()).getRequest() + .setMethod(HTTPVerb.POST).setUrl(ResourceType.ResearchStudy.name()); + bundle.addEntry().setResource(task).setFullUrl(task.getIdElement().getIdPart()).getRequest() + .setMethod(HTTPVerb.POST).setUrl(ResourceType.Task.name()); + + return bundle; + } + + private Group createGroup(String name) + { + Group group = new Group(); + group.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); + + group.getMeta().addProfile(PROFILE_HIGHMED_GROUP); + group.getText().getDiv().addText("This is the description"); + group.getText().setStatus(Narrative.NarrativeStatus.ADDITIONAL); + group.setType(GroupType.PERSON); + group.setActual(false); + group.setActive(true); + group.addExtension().setUrl(EXTENSION_HIGHMED_QUERY) + .setValue(new Expression().setLanguageElement(CODE_TYPE_AQL_QUERY).setExpression(query)); + group.setName(name); + + Arrays.stream(medicIdentifier).forEach(i -> readAccessHelper.addOrganization(group, i)); + readAccessHelper.addOrganization(group, ttpIdentifier); + + return group; + } + + private ResearchStudy createResearchStudy(Group group1, Group group2) + { + ResearchStudy researchStudy = new ResearchStudy(); + researchStudy.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); + + researchStudy.getMeta().addProfile(PROFILE_HIGHEMD_RESEARCH_STUDY); + researchStudy.addIdentifier().setSystem(NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER) + .setValue(UUID.randomUUID().toString()); + researchStudy.setStatus(ResearchStudyStatus.ACTIVE); + researchStudy.addEnrollment().setReference(group1.getIdElement().getIdPart()); + researchStudy.addEnrollment().setReference(group2.getIdElement().getIdPart()); + + Arrays.stream(medicIdentifier) + .forEach(i -> researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC) + .setValue(new Reference().setType(ResourceType.Organization.name()).setIdentifier( + new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(i)))); + + Arrays.stream(medicIdentifier).forEach(i -> readAccessHelper.addOrganization(researchStudy, i)); + readAccessHelper.addOrganization(researchStudy, ttpIdentifier); + + // TODO: remove tpp from research study profile + researchStudy.addExtension().setUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP) + .setValue(new Reference().setType(ResourceType.Organization.name()).setIdentifier(new Identifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue(ttpIdentifier))); + + return researchStudy; + } + + private Task createTask(ResearchStudy researchStudy) + { + Task task = new Task(); + task.setIdElement(new IdType("urn:uuid:" + UUID.randomUUID().toString())); + + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_AND_LATEST_VERSION); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_MESSAGE_NAME)).getType() + .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput() + .setValue(new Reference().setReference(researchStudy.getIdElement().getIdPart()) + .setType(ResourceType.ResearchStudy.name())) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); + task.addInput() + .setValue(new Reference() + .setIdentifier(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_CONSORTIUM_HIGHMED)) + .setType(ResourceType.Organization.name())) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONSORTIUM_IDENTIFIER); + task.addInput().setValue(new BooleanType(needsConsentCheck)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); + + return task; + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityMpcFromMedicsViaMedic1DockerExampleStarter.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityMpcFromMedicsViaMedic1DockerExampleStarter.java new file mode 100644 index 00000000..73700c5a --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityMpcFromMedicsViaMedic1DockerExampleStarter.java @@ -0,0 +1,16 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.MEDIC_1_DOCKER_FHIR_BASE_URL; + +public class RequestFeasibilityMpcFromMedicsViaMedic1DockerExampleStarter + extends AbstractRequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter +{ + // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate + // password + public static void main(String[] args) throws Exception + { + new RequestFeasibilityMpcFromMedicsViaMedic1DockerExampleStarter().main(args, MEDIC_1_DOCKER_FHIR_BASE_URL); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter.java new file mode 100644 index 00000000..14c68f2b --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/RequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter.java @@ -0,0 +1,16 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.MEDIC_1_FHIR_BASE_URL; + +public class RequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter + extends AbstractRequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter +{ + // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate + // password + public static void main(String[] args) throws Exception + { + new RequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter().main(args, MEDIC_1_FHIR_BASE_URL); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java new file mode 100644 index 00000000..3749995b --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java @@ -0,0 +1,109 @@ +package org.highmed.dsf.fhir.profile; + +import static org.highmed.dsf.bpe.FeasibilityMpcProcessPluginDefinition.VERSION; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Arrays; + +import org.highmed.dsf.fhir.authorization.process.ProcessAuthorizationHelper; +import org.highmed.dsf.fhir.authorization.process.ProcessAuthorizationHelperImpl; +import org.highmed.dsf.fhir.validation.ResourceValidator; +import org.highmed.dsf.fhir.validation.ResourceValidatorImpl; +import org.highmed.dsf.fhir.validation.ValidationSupportRule; +import org.hl7.fhir.r4.model.ActivityDefinition; +import org.junit.ClassRule; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ca.uhn.fhir.validation.ResultSeverityEnum; +import ca.uhn.fhir.validation.ValidationResult; + +public class ActivityDefinitionProfileTest +{ + private static final Logger logger = LoggerFactory.getLogger(ActivityDefinitionProfileTest.class); + + @ClassRule + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + Arrays.asList("highmed-activity-definition-0.5.0.xml", "highmed-extension-process-authorization-0.5.0.xml", + "highmed-extension-process-authorization-consortium-role-0.5.0.xml", + "highmed-extension-process-authorization-organization-0.5.0.xml", + "highmed-coding-process-authorization-local-all-0.5.0.xml", + "highmed-coding-process-authorization-local-consortium-role-0.5.0.xml", + "highmed-coding-process-authorization-local-organization-0.5.0.xml", + "highmed-coding-process-authorization-remote-all-0.5.0.xml", + "highmed-coding-process-authorization-remote-consortium-role-0.5.0.xml", + "highmed-coding-process-authorization-remote-organization-0.5.0.xml"), + Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-process-authorization-0.5.0.xml"), + Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-process-authorization-recipient-0.5.0.xml", + "highmed-process-authorization-requester-0.5.0.xml")); + + private final ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), + validationRule.getValidationSupport()); + + private final ProcessAuthorizationHelper processAuthorizationHelper = new ProcessAuthorizationHelperImpl(); + + @Test + public void testExecuteFeasibilityMpcMultiShareValid() throws Exception + { + try (InputStream in = Files.newInputStream( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml"))) + { + ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() + .parseResource(ActivityDefinition.class, in); + + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + + assertTrue( + processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); + } + } + + @Test + public void testExecuteFeasibilityMpcSingleShareValid() throws Exception + { + try (InputStream in = Files.newInputStream( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml"))) + { + ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() + .parseResource(ActivityDefinition.class, in); + + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + + assertTrue( + processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); + } + } + + @Test + public void testRequestFeasibilityMpcValid() throws Exception + { + try (InputStream in = Files.newInputStream( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml"))) + { + ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() + .parseResource(ActivityDefinition.class, in); + + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + + assertTrue( + processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); + } + } +} \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java new file mode 100644 index 00000000..63c68fc9 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -0,0 +1,336 @@ +package org.highmed.dsf.fhir.profile; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONSORTIUM_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.*; +import static org.highmed.dsf.bpe.FeasibilityMpcProcessPluginDefinition.VERSION; +import static org.junit.Assert.assertEquals; + +import java.util.Arrays; +import java.util.Date; +import java.util.UUID; + +import org.highmed.dsf.fhir.validation.ResourceValidator; +import org.highmed.dsf.fhir.validation.ResourceValidatorImpl; +import org.highmed.dsf.fhir.validation.ValidationSupportRule; +import org.hl7.fhir.r4.model.BooleanType; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResourceType; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.ParameterComponent; +import org.hl7.fhir.r4.model.Task.TaskIntent; +import org.hl7.fhir.r4.model.Task.TaskOutputComponent; +import org.hl7.fhir.r4.model.Task.TaskStatus; +import org.hl7.fhir.r4.model.UnsignedIntType; +import org.junit.ClassRule; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ca.uhn.fhir.validation.ResultSeverityEnum; +import ca.uhn.fhir.validation.ValidationResult; + +public class TaskProfileTest +{ + private static final Logger logger = LoggerFactory.getLogger(TaskProfileTest.class); + + @ClassRule + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-group-0.5.0.xml", + "highmed-extension-group-id-0.5.0.xml", "highmed-research-study-0.5.0.xml", + "highmed-task-request-feasibility-mpc.xml", "highmed-task-execute-feasibility-mpc-multi-share.xml", + "highmed-task-execute-feasibility-mpc-single-share.xml", + "highmed-task-single-medic-result-share-feasibility-mpc.xml", + "highmed-task-multi-medic-result-share-feasibility-mpc.xml"), + Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", + "highmed-data-sharing.xml"), + Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", + "highmed-data-sharing.xml")); + + private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), + validationRule.getValidationSupport()); + + @Test + public void testTaskRequestFeasibilityMpcValid() throws Exception + { + Task task = createValidTaskRequestFeasibilityMpc(); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + @Test + public void testTaskRequestFeasibilityMpcValidWithOutput() throws Exception + { + String groupId1 = "Group/" + UUID.randomUUID().toString(); + String groupId2 = "Group/" + UUID.randomUUID().toString(); + + Task task = createValidTaskRequestFeasibilityMpc(); + + TaskOutputComponent outParticipatingMedics1 = task.addOutput(); + outParticipatingMedics1.setValue(new UnsignedIntType(5)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS); + outParticipatingMedics1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); + TaskOutputComponent outMultiMedicResult1 = task.addOutput(); + outMultiMedicResult1.setValue(new UnsignedIntType(25)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT); + outMultiMedicResult1.addExtension("http://highmed.org/fhir/StructureDefinition/extension-group-id", + new Reference(groupId1)); + + TaskOutputComponent outParticipatingMedics2 = task.addOutput(); + outParticipatingMedics2.setValue(new UnsignedIntType(5)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS); + outParticipatingMedics2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); + TaskOutputComponent outMultiMedicResult2 = task.addOutput(); + outMultiMedicResult2.setValue(new UnsignedIntType(25)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT); + outMultiMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + private Task createValidTaskRequestFeasibilityMpc() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 1"); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 1"); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_MESSAGE_NAME)).getType() + .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new Reference("ResearchStudy/" + UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); + task.addInput() + .setValue(new Reference().setIdentifier(new Identifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("Consortium"))) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONSORTIUM_IDENTIFIER); + task.addInput().setValue(new BooleanType(false)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); + + return task; + } + + @Test + public void testTaskExecuteFeasibilityMpcMultiShareValid() throws Exception + { + Task task = createValidTaskExecuteFeasibilityMpcMultiShare(); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + private Task createValidTaskExecuteFeasibilityMpcMultiShare() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE); + task.setInstantiatesUri( + PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 1"); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 2"); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_MESSAGE_NAME)) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN) + .setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY); + + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY); + + return task; + } + + @Test + public void testTaskExecuteFeasibilityMpcSingleShareValid() throws Exception + { + Task task = createValidTaskExecuteFeasibilityMpcSingleShare(); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + private Task createValidTaskExecuteFeasibilityMpcSingleShare() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE); + task.setInstantiatesUri( + PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 1"); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 2"); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE_MESSAGE_NAME)) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN) + .setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY); + + task.addInput().setValue(new Reference("ResearchStudy/" + UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE); + task.addInput().setValue(new BooleanType(false)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK); + + return task; + } + + @Test + public void testTaskSingleMedicResultShareFeasibilityMpc() throws Exception + { + Task task = createValidTaskSingleMedicResultShareFeasibilityMpc(); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + private Task createValidTaskSingleMedicResultShareFeasibilityMpc() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_SHARE_FEASIBILITY_MPC); + task.setInstantiatesUri( + PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 2"); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 1"); + + task.addInput() + .setValue(new StringType(PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_SHARE_FEASIBILITY_MPC_MESSAGE_NAME)) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN) + .setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY); + + String groupId1 = "Group/" + UUID.randomUUID().toString(); + String groupId2 = "Group/" + UUID.randomUUID().toString(); + + ParameterComponent inSingleMedicResult1 = task.addInput(); + inSingleMedicResult1.setValue(new UnsignedIntType(5)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE); + inSingleMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); + ParameterComponent inSingleMedicResult2 = task.addInput(); + inSingleMedicResult2.setValue(new UnsignedIntType(10)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE); + inSingleMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); + + return task; + } + + @Test + public void testTaskMultiMedicResultShareFeasibilityMpc() throws Exception + { + Task task = createValidTaskMultiMedicResultShareFeasibilityMpc(); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + private Task createValidTaskMultiMedicResultShareFeasibilityMpc() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_SHARE_FEASIBILITY_MPC); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 2"); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("MeDIC 1"); + + task.addInput() + .setValue(new StringType(PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_SHARE_FEASIBILITY_MPC_MESSAGE_NAME)) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN) + .setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY); + + String groupId1 = "Group/" + UUID.randomUUID().toString(); + String groupId2 = "Group/" + UUID.randomUUID().toString(); + + ParameterComponent inSingleMedicResult1 = task.addInput(); + inSingleMedicResult1.setValue(new UnsignedIntType(15)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE); + inSingleMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); + ParameterComponent inSingleMedicResult2 = task.addInput(); + inSingleMedicResult2.setValue(new UnsignedIntType(25)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) + .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE); + inSingleMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); + + return task; + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/test/resources/log4j2.xml b/dsf-bpe-process-feasibility-mpc/src/test/resources/log4j2.xml new file mode 100644 index 00000000..f1afe81d --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/test/resources/log4j2.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Configuration status="INFO" monitorInterval="30" + verbose="false"> + + <Appenders> + <Console name="CONSOLE" target="SYSTEM_OUT"> + <PatternLayout pattern="%p\t%t - %C{1}.%M(%L) | %m%n"/> + </Console> + <!-- <RollingFile name="FILE" fileName="log/adt_db.log" + filePattern="log/adt_db_%d{MM-dd-yyyy}_%i.log.gz" + ignoreExceptions="false"> + <PatternLayout> + <Pattern>%d [%t] %-5p %c - %m%n</Pattern> + </PatternLayout> + <Policies> + <OnStartupTriggeringPolicy /> + <TimeBasedTriggeringPolicy /> + </Policies> + </RollingFile> --> + + <!-- <SMTP name="MAIL" subject="Production RWH LAB Gateway Error" + to="hauke.hund@med.uni-heidelberg.de, thomas.hilbel@med.uni-heidelberg.de" + from="med3-kvm15@med.uni-heidelberg.de" + replyTo="hauke.hund@med.uni-heidelberg.de" smtpHost="localhost" + smtpPort="25" bufferSize="50"> + </SMTP> + <SMTP name="MAIL_CERTIFICATE" subject="Production RWH LAB Gateway Certificate Warning" + to="hauke.hund@med.uni-heidelberg.de, thomas.hilbel@med.uni-heidelberg.de" + from="med3-kvm15@med.uni-heidelberg.de" + replyTo="hauke.hund@med.uni-heidelberg.de" smtpHost="localhost" + smtpPort="25" bufferSize="1"> + <ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY"/> + </SMTP> + <SMTP name="MAIL_HL7" subject="Production RWH ADT Gateway HL7 Warning" + to="hauke.hund@med.uni-heidelberg.de, thomas.hilbel@med.uni-heidelberg.de" + from="med3-kvm15@med.uni-heidelberg.de" + replyTo="hauke.hund@med.uni-heidelberg.de" smtpHost="localhost" + smtpPort="25" bufferSize="1"> + <ThresholdFilter level="WARN" onMatch="ACCEPT" onMismatch="DENY"/> + </SMTP> --> + </Appenders> + + <Loggers> + <Logger name="de.rwh" level="TRACE"/> + <Logger name="org.highmed" level="TRACE"/> + <Logger name="org.apache" level="WARN"/> + <Logger name="org.springframework" level="WARN"/> + <Logger name="jndi" level="WARN"/> + <Logger name="org.eclipse.jetty" level="INFO"/> + <Logger name="com.sun.jersey" level="WARN"/> + <Logger name="liquibase" level="WARN"/> + <Logger name="ca.uhn.hl7v2" level="WARN"/> + + <!-- <Logger name="certificate-warning-logger" level="INFO"> + <AppenderRef ref="MAIL_CERTIFICATE" /> + </Logger> + <Logger name="async-message-handler-warning-logger" level="INFO"> + <AppenderRef ref="MAIL_HL7" /> + </Logger> --> + + <Root level="WARN"> + <AppenderRef ref="CONSOLE"/> + <!-- <AppenderRef ref="FILE" /> --> + <!-- <AppenderRef ref="MAIL" /> --> + </Root> + </Loggers> +</Configuration> \ No newline at end of file diff --git a/pom.xml b/pom.xml index f9671c34..a2338249 100644 --- a/pom.xml +++ b/pom.xml @@ -12,6 +12,7 @@ <modules> <module>dsf-bpe-process-data-sharing</module> <module>dsf-bpe-process-feasibility</module> + <module>dsf-bpe-process-feasibility-mpc</module> <module>dsf-bpe-process-local-services</module> <module>dsf-bpe-process-ping</module> <module>dsf-bpe-process-update-allow-list</module> @@ -84,6 +85,11 @@ <artifactId>dsf-bpe-process-feasibility</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.highmed.dsf</groupId> + <artifactId>dsf-bpe-process-feasibility-mpc</artifactId> + <version>${project.version}</version> + </dependency> <dependency> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-process-local-services</artifactId> From 66f2704e142e3aee312e8230e6eb27bdbb424846 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 28 Jan 2022 20:20:28 +0100 Subject: [PATCH 074/125] add missing files to plugin --- ...FeasibilityMpcProcessPluginDefinition.java | 27 +++++++++++-------- ...=> SelectMultiMedicResultShareTarget.java} | 4 +-- ...gets.java => SelectMultiMedicTargets.java} | 4 +-- .../spring/config/FeasibilityMpcConfig.java | 12 ++++----- .../bpe/executeFeasibilityMpcMultiShare.bpmn | 2 +- .../resources/bpe/requestFeasibilityMpc.bpmn | 2 +- 6 files changed, 28 insertions(+), 23 deletions(-) rename dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/{SelectMultiMedicResultShareResponseTarget.java => SelectMultiMedicResultShareTarget.java} (90%) rename dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/{SelectMultiMedicResultShareTargets.java => SelectMultiMedicTargets.java} (94%) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java index 1cda4b03..49f78333 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java @@ -40,7 +40,8 @@ public String getVersion() @Override public Stream<String> getBpmnFiles() { - return Stream.of("bpe/requestFeasibilityMpc.bpmn", "bpe/executeFeasibilityMpc.bpmn"); + return Stream.of("bpe/requestFeasibilityMpc.bpmn", "bpe/executeFeasibilityMpcSingleShare.bpmn", + "bpe/executeFeasibilityMpcMultiShare.bpmn"); } @Override @@ -60,26 +61,30 @@ public List<String> getDependencyNamesAndVersions() public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader, PropertyResolver resolver) { - var aExe = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeFeasibilityMpc.xml"); + var aExeM = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml"); + var aExeS = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml"); var aReq = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml"); var cDS = CodeSystemResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/CodeSystem/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); - var sTExe = StructureDefinitionResource - .file("fhir/StructureDefinition/highmed-task-execute-feasibility-mpc.xml"); - var sTReq = StructureDefinitionResource - .file("fhir/StructureDefinition/highmed-task-request-feasibility-mpc.xml"); - var sTResM = StructureDefinitionResource - .file("fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml"); - var sTResS = StructureDefinitionResource - .file("fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml"); + var sTExeM = StructureDefinitionResource.file( + "fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml"); + var sTExeS = StructureDefinitionResource.file( + "fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-single-share.xml"); + var sTReq = StructureDefinitionResource.file( + "fhir/StructureDefinition/highmed-task-request-feasibility-mpc.xml"); + var sTResM = StructureDefinitionResource.file( + "fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml"); + var sTResS = StructureDefinitionResource.file( + "fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml"); var vDS = ValueSetResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/ValueSet/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( - "highmedorg_executeFeasibilityMpc/" + VERSION, Arrays.asList(aExe, cDS, sTExe, sTResS, vDS), + "highmedorg_executeFeasibilityMpcMultiShare/" + VERSION, Arrays.asList(aExeM, cDS, sTExeM, sTResS, vDS), + "highmedorg_executeFeasibilityMpcSingleShare/" + VERSION, Arrays.asList(aExeS, cDS, sTExeS, vDS), "highmedorg_requestFeasibilityMpc/" + VERSION, Arrays.asList(aReq, cDS, sTReq, sTResM, vDS)); return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareResponseTarget.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTarget.java similarity index 90% rename from dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareResponseTarget.java rename to dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTarget.java index be0ac96b..d3f70365 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareResponseTarget.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTarget.java @@ -18,11 +18,11 @@ import org.highmed.dsf.fhir.variables.TargetValues; import org.springframework.beans.factory.InitializingBean; -public class SelectMultiMedicResultShareResponseTarget extends AbstractServiceDelegate implements InitializingBean +public class SelectMultiMedicResultShareTarget extends AbstractServiceDelegate implements InitializingBean { private final EndpointProvider endpointProvider; - public SelectMultiMedicResultShareResponseTarget(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public SelectMultiMedicResultShareTarget(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, EndpointProvider endpointProvider) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTargets.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicTargets.java similarity index 94% rename from dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTargets.java rename to dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicTargets.java index 4be6d803..2b2b5400 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTargets.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicTargets.java @@ -26,11 +26,11 @@ import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResearchStudy; -public class SelectMultiMedicResultShareTargets extends AbstractServiceDelegate +public class SelectMultiMedicTargets extends AbstractServiceDelegate { private final EndpointProvider endpointProvider; - public SelectMultiMedicResultShareTargets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public SelectMultiMedicTargets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, EndpointProvider endpointProvider) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java index 8061a1f8..24fc049c 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java @@ -16,8 +16,8 @@ import org.highmed.dsf.bpe.service.FilterResultsByConsent; import org.highmed.dsf.bpe.service.GenerateCountFromIds; import org.highmed.dsf.bpe.service.ModifyQueries; -import org.highmed.dsf.bpe.service.SelectMultiMedicResultShareResponseTarget; -import org.highmed.dsf.bpe.service.SelectMultiMedicResultShareTargets; +import org.highmed.dsf.bpe.service.SelectMultiMedicResultShareTarget; +import org.highmed.dsf.bpe.service.SelectMultiMedicTargets; import org.highmed.dsf.bpe.service.SelectSingleMedicResultShareTargets; import org.highmed.dsf.bpe.service.StoreResultsMultiMedicShare; import org.highmed.dsf.bpe.service.StoreResultsSingleMedicShare; @@ -86,9 +86,9 @@ public DownloadResearchStudyResource downloadResearchStudyResource() } @Bean - public SelectMultiMedicResultShareTargets selectMultiMedicResultShareTargets() + public SelectMultiMedicTargets selectMultiMedicTargets() { - return new SelectMultiMedicResultShareTargets(fhirClientProvider, taskHelper, readAccessHelper, + return new SelectMultiMedicTargets(fhirClientProvider, taskHelper, readAccessHelper, endpointProvider); } @@ -229,9 +229,9 @@ public ComputeMultiMedicResultShare computeMultiMedicResultShare() } @Bean - public SelectMultiMedicResultShareResponseTarget selectMultiMedicResultShareResponseTarget() + public SelectMultiMedicResultShareTarget selectMultiMedicResultShareTarget() { - return new SelectMultiMedicResultShareResponseTarget(fhirClientProvider, taskHelper, readAccessHelper, + return new SelectMultiMedicResultShareTarget(fhirClientProvider, taskHelper, readAccessHelper, endpointProvider); } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn index a3e76b6e..e050c429 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn @@ -66,7 +66,7 @@ <bpmn:outgoing>Flow_15s0sha</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_1p3ixg0" sourceRef="selectMultiMedicResultShareResponseTarget" targetRef="EndEvent" /> - <bpmn:serviceTask id="selectMultiMedicResultShareResponseTarget" name="select multi medic result share response target" camunda:class="org.highmed.dsf.bpe.service.SelectMultiMedicResultShareResponseTarget"> + <bpmn:serviceTask id="selectMultiMedicResultShareResponseTarget" name="select multi medic result share response target" camunda:class="org.highmed.dsf.bpe.service.SelectMultiMedicResultShareTarget"> <bpmn:incoming>Flow_0bm0z7u</bpmn:incoming> <bpmn:outgoing>Flow_1p3ixg0</bpmn:outgoing> </bpmn:serviceTask> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn index 89e814d4..acf54395 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn @@ -5,7 +5,7 @@ <bpmn:outgoing>SequenceFlow_11k77gx</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_10c2suu" messageRef="Message_1pq9qxp" /> </bpmn:startEvent> - <bpmn:serviceTask id="selectMultiMedicResultSharetTargets" name="select multi medic result share targets" camunda:class="org.highmed.dsf.bpe.service.SelectMultiMedicResultShareTargets"> + <bpmn:serviceTask id="selectMultiMedicResultSharetTargets" name="select multi medic result share targets" camunda:class="org.highmed.dsf.bpe.service.SelectMultiMedicTargets"> <bpmn:incoming>SequenceFlow_18ajfnh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0b5s4ef</bpmn:outgoing> </bpmn:serviceTask> From b7226f74f3e2ea5df70ffd89697593f46f578098 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 28 Jan 2022 22:27:05 +0100 Subject: [PATCH 075/125] fixes typos, renames classes, makes process messages executable --- ...FeasibilityMpcProcessPluginDefinition.java | 26 ++++---- .../message/SendMultiMedicResultShare.java | 6 +- .../message/SendSingleMedicResultShare.java | 1 + .../CalculateMulitMedicResultShares.java | 7 +++ ...re.java => CalculateMultiMedicResult.java} | 10 ++-- .../CalculateSingleMedicResultShares.java | 2 + ...SingleMedicResultShareCorrelationKeys.java | 15 +++++ .../spring/config/FeasibilityMpcConfig.java | 15 +++-- .../bpe/executeFeasibilityMpcMultiShare.bpmn | 60 +++++++++---------- .../bpe/executeFeasibilityMpcSingleShare.bpmn | 50 ++++++++-------- .../resources/bpe/requestFeasibilityMpc.bpmn | 54 ++++++++--------- ...ighmed-executeFeasibilityMpcMultiShare.xml | 14 ++--- 12 files changed, 148 insertions(+), 112 deletions(-) rename dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/{ComputeMultiMedicResultShare.java => CalculateMultiMedicResult.java} (60%) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java index 49f78333..2b77d984 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java @@ -61,23 +61,25 @@ public List<String> getDependencyNamesAndVersions() public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader, PropertyResolver resolver) { - var aExeM = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml"); - var aExeS = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml"); + var aExeM = ActivityDefinitionResource + .file("fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml"); + var aExeS = ActivityDefinitionResource + .file("fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml"); var aReq = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml"); var cDS = CodeSystemResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/CodeSystem/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); - var sTExeM = StructureDefinitionResource.file( - "fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml"); - var sTExeS = StructureDefinitionResource.file( - "fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-single-share.xml"); - var sTReq = StructureDefinitionResource.file( - "fhir/StructureDefinition/highmed-task-request-feasibility-mpc.xml"); - var sTResM = StructureDefinitionResource.file( - "fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml"); - var sTResS = StructureDefinitionResource.file( - "fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml"); + var sTExeM = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml"); + var sTExeS = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-single-share.xml"); + var sTReq = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-request-feasibility-mpc.xml"); + var sTResM = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml"); + var sTResS = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml"); var vDS = ValueSetResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/ValueSet/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java index fbdafacd..b70649f3 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java @@ -4,6 +4,8 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; import java.util.stream.Stream; @@ -33,7 +35,9 @@ public SendMultiMedicResultShare(FhirWebserviceClientProvider clientProvider, Ta @Override protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + // TODO: use calculated multi share + QueryResults results = (QueryResults) execution + .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES); return results.getResults().stream().map(this::toInput); } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java index 6e378d88..a71b4c9c 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java @@ -37,6 +37,7 @@ public SendSingleMedicResultShare(FhirWebserviceClientProvider clientProvider, T @Override protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { + // TODO: use calculated single share QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); return results.getResults().stream().map(this::toInput); diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMulitMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMulitMedicResultShares.java index 4b565c8a..889d9758 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMulitMedicResultShares.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMulitMedicResultShares.java @@ -1,7 +1,12 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -22,5 +27,7 @@ public CalculateMulitMedicResultShares(FhirWebserviceClientProvider clientProvid protected void doExecute(DelegateExecution execution) throws Exception { logger.info("EXECUTING: {}", CalculateMulitMedicResultShares.class.getName()); + + // TODO: calculate multi shares } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ComputeMultiMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java similarity index 60% rename from dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ComputeMultiMedicResultShare.java rename to dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java index c7f4b3a7..25619372 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ComputeMultiMedicResultShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java @@ -8,11 +8,11 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ComputeMultiMedicResultShare extends AbstractServiceDelegate +public class CalculateMultiMedicResult extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(ComputeMultiMedicResultShare.class); + private static final Logger logger = LoggerFactory.getLogger(CalculateMultiMedicResult.class); - public ComputeMultiMedicResultShare(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public CalculateMultiMedicResult(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) { super(clientProvider, taskHelper, readAccessHelper); @@ -21,6 +21,8 @@ public ComputeMultiMedicResultShare(FhirWebserviceClientProvider clientProvider, @Override protected void doExecute(DelegateExecution execution) throws Exception { - logger.info("EXECUTING: {}", ComputeMultiMedicResultShare.class.getName()); + logger.info("EXECUTING: {}", CalculateMultiMedicResult.class.getName()); + + // TODO: calculate results } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java index 4cf91209..d2a8e23d 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java @@ -22,5 +22,7 @@ public CalculateSingleMedicResultShares(FhirWebserviceClientProvider clientProvi protected void doExecute(DelegateExecution execution) throws Exception { logger.info("EXECUTING: {}", CalculateSingleMedicResultShares.class.getName()); + + // TODO: calculate single shares } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java index 806fc32a..15f4b043 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java @@ -1,8 +1,11 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; import java.util.List; @@ -36,6 +39,9 @@ protected void doExecute(DelegateExecution execution) throws Exception Targets targets = getTargets(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(targets)); + String correlationKey = getCorrelationKey(task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_CORRELATION_KEY, correlationKey); + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES, QueryResultsValues.create(new QueryResults(null))); } @@ -50,4 +56,13 @@ private Targets getTargets(Task task) return new Targets(targets); } + + private String getCorrelationKey(Task task) + { + return getTaskHelper() + .getFirstInputParameterStringValue(task, CODESYSTEM_HIGHMED_BPMN, + CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY) + .orElseThrow(() -> new IllegalArgumentException("CorrelationKey is not set in task with id='" + + task.getId() + "', this error should have been caught by resource validation")); + } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java index 24fc049c..c96136b4 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java @@ -4,12 +4,12 @@ import org.highmed.consent.client.ConsentClientFactory; import org.highmed.dsf.bpe.message.*; import org.highmed.dsf.bpe.service.CalculateMulitMedicResultShares; +import org.highmed.dsf.bpe.service.CalculateMultiMedicResult; import org.highmed.dsf.bpe.service.CalculateSingleMedicResultShares; import org.highmed.dsf.bpe.service.CheckFeasibilityMpcResources; import org.highmed.dsf.bpe.service.CheckMultiMedicResults; import org.highmed.dsf.bpe.service.CheckQueries; import org.highmed.dsf.bpe.service.CheckSingleMedicResultShares; -import org.highmed.dsf.bpe.service.ComputeMultiMedicResultShare; import org.highmed.dsf.bpe.service.DownloadFeasibilityMpcResources; import org.highmed.dsf.bpe.service.DownloadResearchStudyResource; import org.highmed.dsf.bpe.service.ExecuteQueries; @@ -88,8 +88,7 @@ public DownloadResearchStudyResource downloadResearchStudyResource() @Bean public SelectMultiMedicTargets selectMultiMedicTargets() { - return new SelectMultiMedicTargets(fhirClientProvider, taskHelper, readAccessHelper, - endpointProvider); + return new SelectMultiMedicTargets(fhirClientProvider, taskHelper, readAccessHelper, endpointProvider); } @Bean @@ -125,7 +124,11 @@ public CheckMultiMedicResults checkMultiMedicResults() } // - // process executeFeasibilityMpc implementations + // process executeFeasibilityMpcSingleShare implementations + // + + // + // process executeFeasibilityMpcMultiShare implementations // @Bean @@ -223,9 +226,9 @@ public StoreResultsSingleMedicShare storeResultsSingleMedicShare() } @Bean - public ComputeMultiMedicResultShare computeMultiMedicResultShare() + public CalculateMultiMedicResult calculateMultiMedicResult() { - return new ComputeMultiMedicResultShare(fhirClientProvider, taskHelper, readAccessHelper); + return new CalculateMultiMedicResult(fhirClientProvider, taskHelper, readAccessHelper); } @Bean diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn index e050c429..9e3319d3 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> <bpmn:process id="highmedorg_executeFeasibilityMpcMultiShare" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:startEvent id="StartEvent" name="start"> <bpmn:outgoing>Flow_0zwnqdn</bpmn:outgoing> @@ -10,7 +10,7 @@ <camunda:inputOutput> <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibilityMpc/0.6.0</camunda:inputParameter> <camunda:inputParameter name="messageName">resultShareMultiMedicFeasibilityMpcMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-FeasibilityMpc|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-share-feasibility-mpc|0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_1p3ixg0</bpmn:incoming> @@ -51,12 +51,12 @@ <bpmn:boundaryEvent id="Event_1qabwc2" attachedToRef="Activity_11idi2o"> <bpmn:outgoing>Flow_1688meb</bpmn:outgoing> <bpmn:timerEventDefinition id="TimerEventDefinition_0jn3631"> - <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT5M</bpmn:timeDuration> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT2M</bpmn:timeDuration> </bpmn:timerEventDefinition> </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_18n85hs" sourceRef="Activity_11idi2o" targetRef="Gateway_0atmr78" /> <bpmn:sequenceFlow id="Flow_1688meb" sourceRef="Event_1qabwc2" targetRef="Gateway_0atmr78" /> - <bpmn:serviceTask id="Activity_07k3fpm" name="compute multi medic result share" camunda:class="org.highmed.dsf.bpe.service.ComputeMultiMedicResultShare"> + <bpmn:serviceTask id="Activity_07k3fpm" name="calculate multi medic result shares" camunda:class="org.highmed.dsf.bpe.service.CalculateMulitMedicResultShares"> <bpmn:incoming>Flow_18sujdf</bpmn:incoming> <bpmn:outgoing>Flow_0bm0z7u</bpmn:outgoing> </bpmn:serviceTask> @@ -80,23 +80,18 @@ <bpmn:message id="Message_0qpomdh" name="resultShareMultiMedicFeasibilityMpcMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_executeFeasibilityMpcMultiShare"> - <bpmndi:BPMNEdge id="Flow_1688meb_di" bpmnElement="Flow_1688meb"> - <di:waypoint x="936" y="214" /> - <di:waypoint x="1030" y="214" /> - <di:waypoint x="1030" y="172" /> + <bpmndi:BPMNEdge id="Flow_18sujdf_di" bpmnElement="Flow_18sujdf"> + <di:waypoint x="1055" y="147" /> + <di:waypoint x="1110" y="147" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_18n85hs_di" bpmnElement="Flow_18n85hs"> - <di:waypoint x="918" y="147" /> - <di:waypoint x="1005" y="147" /> + <bpmndi:BPMNEdge id="Flow_0zwnqdn_di" bpmnElement="Flow_0zwnqdn"> + <di:waypoint x="188" y="147" /> + <di:waypoint x="260" y="147" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_15s0sha_di" bpmnElement="Flow_15s0sha"> <di:waypoint x="360" y="147" /> <di:waypoint x="420" y="147" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0zwnqdn_di" bpmnElement="Flow_0zwnqdn"> - <di:waypoint x="188" y="147" /> - <di:waypoint x="260" y="147" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1p3ixg0_di" bpmnElement="Flow_1p3ixg0"> <di:waypoint x="1380" y="147" /> <di:waypoint x="1452" y="147" /> @@ -105,34 +100,27 @@ <di:waypoint x="1210" y="147" /> <di:waypoint x="1280" y="147" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_18sujdf_di" bpmnElement="Flow_18sujdf"> - <di:waypoint x="1055" y="147" /> - <di:waypoint x="1110" y="147" /> + <bpmndi:BPMNEdge id="Flow_1688meb_di" bpmnElement="Flow_1688meb"> + <di:waypoint x="936" y="214" /> + <di:waypoint x="1030" y="214" /> + <di:waypoint x="1030" y="172" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_18n85hs_di" bpmnElement="Flow_18n85hs"> + <di:waypoint x="918" y="147" /> + <di:waypoint x="1005" y="147" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="Activity_1r2389r_di" bpmnElement="storeSingleMedicResultShareCorrelationKeys"> - <dc:Bounds x="260" y="107" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1fzso6r_di" bpmnElement="StartEvent"> <dc:Bounds x="152" y="129" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="160" y="172" width="22" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_07k3fpm_di" bpmnElement="Activity_07k3fpm"> - <dc:Bounds x="1110" y="107" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_19ocdmp_di" bpmnElement="selectMultiMedicResultShareResponseTarget"> - <dc:Bounds x="1280" y="107" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_10xdh63_di" bpmnElement="EndEvent"> <dc:Bounds x="1452" y="129" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="1428" y="172" width="83" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_0atmr78_di" bpmnElement="Gateway_0atmr78" isMarkerVisible="true"> - <dc:Bounds x="1005" y="122" width="50" height="50" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_11idi2o_di" bpmnElement="Activity_11idi2o" isExpanded="true"> <dc:Bounds x="420" y="80" width="498" height="134" /> </bpmndi:BPMNShape> @@ -160,6 +148,18 @@ <bpmndi:BPMNShape id="Event_0sfgw8l_di" bpmnElement="Event_0sfgw8l"> <dc:Bounds x="444" y="131" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0atmr78_di" bpmnElement="Gateway_0atmr78" isMarkerVisible="true"> + <dc:Bounds x="1005" y="122" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_07k3fpm_di" bpmnElement="Activity_07k3fpm"> + <dc:Bounds x="1110" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1r2389r_di" bpmnElement="storeSingleMedicResultShareCorrelationKeys"> + <dc:Bounds x="260" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_19ocdmp_di" bpmnElement="selectMultiMedicResultShareResponseTarget"> + <dc:Bounds x="1280" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1qabwc2_di" bpmnElement="Event_1qabwc2"> <dc:Bounds x="900" y="196" width="36" height="36" /> </bpmndi:BPMNShape> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn index c1bdaa9b..696ab73a 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> <bpmn:process id="highmedorg_executeFeasibilityMpcSingleShare" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:serviceTask id="checkResults" name="check single medic result shares" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResultShares"> <bpmn:incoming>Flow_1tdtqpl</bpmn:incoming> @@ -97,7 +97,7 @@ </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0ascyjc</bpmn:incoming> <bpmn:outgoing>Flow_1tfx2ak</bpmn:outgoing> - <bpmn:multiInstanceLoopCharacteristics camunda:collection="${targetsSingleMedicShare.entries}" camunda:elementVariable="target" /> + <bpmn:multiInstanceLoopCharacteristics camunda:collection="${targets.entries}" camunda:elementVariable="target" /> </bpmn:sendTask> <bpmn:sequenceFlow id="Flow_19itw20" sourceRef="filterByConsent" targetRef="countIds" /> <bpmn:sequenceFlow id="Flow_1czhll7" sourceRef="downloadFeasibilityMpcResources" targetRef="checkFeasibilityMpcResources" /> @@ -117,9 +117,14 @@ <bpmn:message id="Message_0qpomdh" name="resultShareMultiMedicFeasibilityMpcMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_executeFeasibilityMpcSingleShare"> - <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> - <dc:Bounds x="490" y="113" width="267" height="56" /> - </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_1dnygeo_di" bpmnElement="Flow_1dnygeo"> + <di:waypoint x="540" y="272" /> + <di:waypoint x="600" y="272" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1tfx2ak_di" bpmnElement="Flow_1tfx2ak"> + <di:waypoint x="2310" y="272" /> + <di:waypoint x="2372" y="272" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1czhll7_di" bpmnElement="Flow_1czhll7"> <di:waypoint x="360" y="272" /> <di:waypoint x="440" y="272" /> @@ -198,17 +203,21 @@ <di:waypoint x="1130" y="272" /> <di:waypoint x="1195" y="272" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1tfx2ak_di" bpmnElement="Flow_1tfx2ak"> - <di:waypoint x="2310" y="272" /> - <di:waypoint x="2372" y="272" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1dnygeo_di" bpmnElement="Flow_1dnygeo"> - <di:waypoint x="540" y="272" /> - <di:waypoint x="600" y="272" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> <dc:Bounds x="1860" y="232" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkFeasibilityMpcResources"> + <dc:Bounds x="440" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1fzso6r_di" bpmnElement="StartEvent"> + <dc:Bounds x="152" y="254" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="160" y="297" width="22" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0b8j3ka_di" bpmnElement="downloadFeasibilityMpcResources"> + <dc:Bounds x="260" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1pt9xhp_di" bpmnElement="checkQueries"> <dc:Bounds x="600" y="232" width="100" height="80" /> </bpmndi:BPMNShape> @@ -239,18 +248,6 @@ <bpmndi:BPMNShape id="ServiceTask_0u5pb4i_di" bpmnElement="executeQueries"> <dc:Bounds x="1030" y="232" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkFeasibilityMpcResources"> - <dc:Bounds x="440" y="232" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0b8j3ka_di" bpmnElement="downloadFeasibilityMpcResources"> - <dc:Bounds x="260" y="232" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="StartEvent_1fzso6r_di" bpmnElement="StartEvent"> - <dc:Bounds x="152" y="254" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="160" y="297" width="22" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0z7c65s_di" bpmnElement="calculateSingleMedicResultShares"> <dc:Bounds x="1670" y="232" width="100" height="80" /> </bpmndi:BPMNShape> @@ -260,6 +257,9 @@ <bpmndi:BPMNShape id="Event_1smcidr_di" bpmnElement="Event_1smcidr"> <dc:Bounds x="2372" y="254" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> + <dc:Bounds x="490" y="113" width="267" height="56" /> + </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> <di:waypoint x="460" y="230" /> <di:waypoint x="460" y="140" /> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn index acf54395..818c27da 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0inb4ax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0inb4ax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> <bpmn:process id="highmedorg_requestFeasibilityMpc" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:startEvent id="StartEvent" name="start"> <bpmn:outgoing>SequenceFlow_11k77gx</bpmn:outgoing> @@ -62,7 +62,7 @@ </bpmn:timerEventDefinition> </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_1k1a943" sourceRef="sendRequestMultiShareToMedics" targetRef="sendRequestSingleShareToMedics" /> - <bpmn:serviceTask id="Activity_044pdxe" name="calculate multimedic cohort size" camunda:class="org.highmed.dsf.bpe.service.CalculateMulitMedicResultShares"> + <bpmn:serviceTask id="Activity_044pdxe" name="calculate multimedic cohort size" camunda:class="org.highmed.dsf.bpe.service.CalculateMultiMedicResult"> <bpmn:incoming>Flow_161cxwt</bpmn:incoming> <bpmn:outgoing>Flow_08i18td</bpmn:outgoing> </bpmn:serviceTask> @@ -123,6 +123,10 @@ <bpmn:error id="Error_0ttn640" name="errorMultiMedicFeasibilityMpcResult" errorCode="errorMultiMedicFeasibilityMpcResult" camunda:errorMessage="errorMultiMedicFeasibilityMpcResult" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_requestFeasibilityMpc"> + <bpmndi:BPMNEdge id="Flow_1b19aj3_di" bpmnElement="Flow_1b19aj3"> + <di:waypoint x="850" y="145" /> + <di:waypoint x="910" y="145" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_08i18td_di" bpmnElement="Flow_08i18td"> <di:waypoint x="1720" y="145" /> <di:waypoint x="1790" y="145" /> @@ -160,43 +164,21 @@ <di:waypoint x="188" y="145" /> <di:waypoint x="240" y="145" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1b19aj3_di" bpmnElement="Flow_1b19aj3"> - <di:waypoint x="850" y="145" /> - <di:waypoint x="910" y="145" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="StartEvent_1ozsjmr_di" bpmnElement="StartEvent"> <dc:Bounds x="152" y="127" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="160" y="170" width="22" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_052xqjx_di" bpmnElement="downloadResearchStudyResource"> - <dc:Bounds x="240" y="105" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0vfud44_di" bpmnElement="selectMultiMedicResultSharetTargets"> <dc:Bounds x="410" y="105" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_044pdxe_di" bpmnElement="Activity_044pdxe"> - <dc:Bounds x="1620" y="105" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_1cv27w0_di" bpmnElement="Gateway_1cv27w0" isMarkerVisible="true"> - <dc:Bounds x="1505" y="120" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0o1pue0_di" bpmnElement="Activity_0o1pue0"> - <dc:Bounds x="1790" y="105" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0r58kgi_di" bpmnElement="Event_123lecz"> - <dc:Bounds x="1962" y="127" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1961" y="170" width="40" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1uwfouh_di" bpmnElement="sendRequestSingleShareToMedics"> - <dc:Bounds x="750" y="105" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SendTask_1pu8i9n_di" bpmnElement="sendRequestMultiShareToMedics"> <dc:Bounds x="590" y="105" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_052xqjx_di" bpmnElement="downloadResearchStudyResource"> + <dc:Bounds x="240" y="105" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0lcbiwk_di" bpmnElement="Activity_0lcbiwk" isExpanded="true"> <dc:Bounds x="910" y="78" width="498" height="134" /> </bpmndi:BPMNShape> @@ -224,6 +206,24 @@ <bpmndi:BPMNShape id="Event_1xy6pw3_di" bpmnElement="Event_1xy6pw3"> <dc:Bounds x="934" y="129" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_044pdxe_di" bpmnElement="Activity_044pdxe"> + <dc:Bounds x="1620" y="105" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_1cv27w0_di" bpmnElement="Gateway_1cv27w0" isMarkerVisible="true"> + <dc:Bounds x="1505" y="120" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0o1pue0_di" bpmnElement="Activity_0o1pue0"> + <dc:Bounds x="1790" y="105" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0r58kgi_di" bpmnElement="Event_123lecz"> + <dc:Bounds x="1962" y="127" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1961" y="170" width="40" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1uwfouh_di" bpmnElement="sendRequestSingleShareToMedics"> + <dc:Bounds x="750" y="105" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1ih81k1_di" bpmnElement="Event_1ih81k1"> <dc:Bounds x="1390" y="194" width="36" height="36" /> </bpmndi:BPMNShape> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml index 7f4c5b96..e2708587 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml @@ -7,11 +7,11 @@ </meta> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> - <valueString value="executeFeasibilityMpcMessage"/> + <valueString value="executeFeasibilityMpcMultiShareMessage"/> </extension> <extension url="task-profile"> <valueCanonical - value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc|${version}"/> + value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-multi-share|${version}"/> </extension> <extension url="requester"> <valueCoding> @@ -145,12 +145,12 @@ </valueCoding> </extension> </extension> - <url value="http://highmed.org/bpe/Process/executeFeasibilityMpc"/> + <url value="http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare"/> <!-- version managed by bpe --> <version value="${version}"/> - <name value="ExecuteFeasibilityMpc"/> - <title value="Execute Feasibility Mpc"/> - <subtitle value="Feasibility Mpc Execution Process"/> + <name value="ExecuteFeasibilityMpcMultiShare"/> + <title value="Execute Feasibility Mpc Multi Share"/> + <subtitle value="Feasibility Mpc Multi Share Execution Process"/> <!-- status managed by bpe --> <status value="unknown"/> <experimental value="false"/> @@ -163,6 +163,6 @@ <value value="pmo@highmed.org"/> </telecom> </contact> - <description value="Process executes feasibility query and sends single medic result shares to each MeDIC, process receives single medic result shares from each MeDIC, process calculates multi medic result share and sends it to coordinating MeDIC"/> + <description value="Process receives single medic result shares from each MeDIC, process calculates multi medic result share and sends it to coordinating MeDIC"/> <kind value="Task"/> </ActivityDefinition> \ No newline at end of file From d049a44ba8341624143ed54fe41285ef652293f2 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 28 Jan 2022 23:19:07 +0100 Subject: [PATCH 076/125] adds code for arithmetic share --- .../cbs/secretshare/ArithmeticShare.java | 100 ++++++++ .../cbs/secretshare/ArithmeticSharing.java | 242 ++++++++++++++++++ 2 files changed, 342 insertions(+) create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticShare.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticSharing.java diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticShare.java new file mode 100644 index 00000000..e509609b --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticShare.java @@ -0,0 +1,100 @@ +package de.tu_darmstadt.cbs.secretshare; + +import java.io.Serializable; +import java.math.BigInteger; + +/** + * This class implements an arithmetic share + * + * @author Tobias Kussel + */ +public class ArithmeticShare implements Serializable, Cloneable +{ + + /** + * SVUID + */ + private static final long serialVersionUID = 5017971477461756174L; + + /** + * Value + */ + public final BigInteger value; + /** + * Prime + */ + public final BigInteger prime; + + /** + * Creates a copy of another arithmetic share + * + * @param other + */ + public ArithmeticShare(ArithmeticShare other) + { + value = other.value; + prime = other.prime; + } + + /** + * Creates a new instance + * + * @param value + * @param prime + */ + public ArithmeticShare(BigInteger value, BigInteger prime) + { + this.value = value; + this.prime = prime; + } + + /** + * Adds another arithmetic share + * + * @param other + * @return + * @throws IllegalArgumentException + */ + public ArithmeticShare add(ArithmeticShare other) throws IllegalArgumentException + { + if (!this.prime.equals(other.prime)) + throw new IllegalArgumentException("Incompatible primes for addition"); + if (other.value == BigInteger.ZERO) + return this; + if (this.value == BigInteger.ZERO) + return other; + BigInteger sum = this.value.add(other.value).remainder(this.prime); + return new ArithmeticShare(sum, prime); + } + + @Override + public Object clone() + { + return new ArithmeticShare(this.value, this.prime); + } + + @Override + public boolean equals(Object o) + { + if (o == this) + return true; + if (!(o instanceof ArithmeticShare)) + return false; + ArithmeticShare as = (ArithmeticShare) o; + return as.value.equals(value) && as.prime.equals(prime); + } + + @Override + public int hashCode() + { + int result = value.hashCode(); + result = 31 * result + prime.hashCode(); + return result; + } + + @Override + public String toString() + { + return value + " mod " + prime; + } +} \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticSharing.java b/dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticSharing.java new file mode 100644 index 00000000..dca8c964 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticSharing.java @@ -0,0 +1,242 @@ +package de.tu_darmstadt.cbs.secretshare; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.math.RoundingMode; +import java.security.SecureRandom; +import java.util.Objects; + +import org.springframework.beans.factory.InitializingBean; + +/** + * This class implements arithmetic sharing + * + * @author Tobias Kussel + */ +public class ArithmeticSharing implements InitializingBean +{ + /** + * Convert a BigDecimal to a fixed point representation + * + * @param value + * Value as (unscaled) BigDecimal + * @param fractionalBits + * number of bits for fixed point scaling. Must be positive + * @return Fixed point represented value + * @throws IllegalArgumentException + * Negative fractionalBits + */ + public static BigInteger convertToFixedPoint(BigDecimal value, int fractionalBits) throws IllegalArgumentException + { + if (fractionalBits < 0) + throw new IllegalArgumentException("FractionalBits must be positive"); + final BigDecimal scaleFactor = BigDecimal.valueOf(2).pow(fractionalBits); + return value.multiply(scaleFactor).toBigInteger(); + } + + /** + * Reconstruct secret from shares + * + * @param shares + * Array of all arithmetic shares + * @return Clear text BigInteger + * @throws IllegalArgumentException + * Incompatible primes + */ + public static BigInteger reconstruct(ArithmeticShare[] shares) throws IllegalArgumentException + { + BigInteger reconstruction = BigInteger.ZERO; + BigInteger first_prime = shares[0].prime; + for (int i = 0; i != shares.length; i++) + { + if (!(shares[i].prime.equals(first_prime))) + { + throw new IllegalArgumentException("Incompatible primes found!"); + } + reconstruction = reconstruction.add(shares[i].value).remainder(shares[i].prime); + } + return reconstruction; + } + + /** + * Reconstruct secret from shares + * + * @param shares + * Array of all arithmetic shares (containing decimal values) + * @param fractionalBits + * Number of bits for fractional part during construction of shares + * @return Clear text BigDecimal + * @throws IllegalArgumentException + * Incompatible primes + */ + public static BigDecimal reconstruct(ArithmeticShare[] shares, int fractionalBits) throws IllegalArgumentException + { + final BigDecimal scaleFactor = BigDecimal.valueOf(2).pow(fractionalBits); + BigDecimal result = new BigDecimal(reconstruct(shares)); + return result.divide(scaleFactor); + } + + /** + * Reconstruct secret from shares + * + * @param shares + * Array of all arithmetic shares (containing decimal values) + * @param fractionalBits + * Number of bits for fractional part during construction of shares + * @param roundingMode + * Rounding mode for final rescaling + * @return Clear text BigDecimal + * @throws IllegalArgumentException + * Incompatible primes + */ + public static BigDecimal reconstruct(ArithmeticShare[] shares, int fractionalBits, RoundingMode roundingMode) + throws IllegalArgumentException + { + final BigDecimal scaleFactor = BigDecimal.valueOf(2).pow(fractionalBits); + BigDecimal result = new BigDecimal(reconstruct(shares)); + return result.divide(scaleFactor, roundingMode); + } + + /** + * RNG + */ + private final SecureRandom randomGenerator = new SecureRandom(); + + /** + * Prime + */ + private final BigInteger prime; + + /** + * Number of parties + */ + private final int numParties; + + /** + * Creates a new instance + * + * @param numParties + */ + public ArithmeticSharing(int numParties) + { + this(numParties, BigInteger.valueOf(2).pow(127).subtract(BigInteger.ONE)); + } + + /** + * Creates a new instance + * + * @param numParties + * @param prime + */ + public ArithmeticSharing(int numParties, BigInteger prime) + { + this.prime = prime; + this.numParties = numParties; + } + + @Override + public void afterPropertiesSet() throws Exception + { + Objects.requireNonNull(prime, "prime"); + + if (BigInteger.ZERO.compareTo(prime) >= 0) + { + throw new IllegalArgumentException("prime < 1"); + } + + if (numParties <= 0) + { + throw new IllegalArgumentException("numParties < 1"); + } + } + + /** + * Share a secret + * + * @param secret + * Secret BigDecimal value to share + * @param fractionalBits + * number of bits for fixed point scaling. Must be positive + * @return Array of arithmetic shares + * @throws IllegalArgumentException + * Negative fractionalBits + */ + public ArithmeticShare[] share(BigDecimal secret, int fractionalBits) throws IllegalArgumentException + { + return share(ArithmeticSharing.convertToFixedPoint(secret, fractionalBits)); + } + + /** + * Share a secret + * + * @param secret + * BigInteger secret value to share + * @return Array of arithmetic shares + */ + public ArithmeticShare[] share(BigInteger secret) + { + BigInteger[] shares = new BigInteger[numParties]; + shares[numParties - 1] = secret; + for (int i = 0; i != numParties - 1; i++) + { + shares[i] = getSignedBlind(127); + shares[numParties - 1] = shares[numParties - 1].add(prime).subtract(shares[i]); + } + ArithmeticShare[] result = new ArithmeticShare[numParties]; + for (int i = 0; i != numParties; i++) + { + result[i] = new ArithmeticShare(shares[i], prime); + } + return result; + } + + /** + * Share a secret + * + * @param secret + * Secret double value to share + * @param fractionalBits + * number of bits for fixed point scaling. Must be positive + * @return Array of arithmetic shares + * @throws IllegalArgumentException + * Negative fractionalBits + */ + public ArithmeticShare[] share(double secret, int fractionalBits) throws IllegalArgumentException + { + return share(BigDecimal.valueOf(secret), fractionalBits); + } + + /** + * Share a secret + * + * @param secret + * Secret integral value to share + * @return Array of arithmetic shares + */ + public ArithmeticShare[] share(int secret) + { + return share(BigInteger.valueOf(secret)); + } + + /** + * Generate a signed blind + * + * @param bitlength + * Bitlength *including* sign bit + * @return BigInteger + * @throws IllegalArgumentException + * Too small or negative bitlength + */ + private BigInteger getSignedBlind(int bitlength) throws IllegalArgumentException + { + if (bitlength < 2) + throw new IllegalArgumentException("Bitlength must be larger than 2"); + BigInteger value = new BigInteger(bitlength - 1, randomGenerator); + byte[] randomByte = new byte[1]; + randomGenerator.nextBytes(randomByte); + int signum = Byte.valueOf(randomByte[0]).intValue() & 0x01; + if (signum == 1) + value = value.negate(); + return value; + } +} \ No newline at end of file From 882cb1d77482aa4bfcf0ce075fcfdff3abf7b106 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 31 Jan 2022 13:50:23 +0100 Subject: [PATCH 077/125] calculate shares and reconstruct secret --- .../cbs/secretshare/ArithmeticShare.java | 100 -------- .../cbs/secretshare/ArithmeticSharing.java | 242 ------------------ .../message/SendMultiMedicResultShare.java | 12 +- .../message/SendSingleMedicResultShare.java | 24 +- .../highmed/dsf/bpe/mpc/ArithmeticShare.java | 61 +++++ .../dsf/bpe/mpc/ArithmeticSharing.java | 150 +++++++++++ .../highmed/dsf/bpe/mpc/QueryResultShare.java | 38 +++ .../dsf/bpe/mpc/QueryResultShares.java | 39 +++ .../CalculateMulitMedicResultShares.java | 33 --- .../CalculateMultiMedicResultShares.java | 83 ++++++ .../CalculateSingleMedicResultShares.java | 46 +++- .../service/StoreResultsSingleMedicShare.java | 40 +-- ...SingleMedicResultShareCorrelationKeys.java | 6 +- .../spring/config/FeasibilityMpcConfig.java | 7 +- .../bpe/executeFeasibilityMpcMultiShare.bpmn | 2 +- .../bpe/executeFeasibilityMpcSingleShare.bpmn | 68 ++--- 16 files changed, 501 insertions(+), 450 deletions(-) delete mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticShare.java delete mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticSharing.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShare.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShares.java delete mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMulitMedicResultShares.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShares.java diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticShare.java deleted file mode 100644 index e509609b..00000000 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticShare.java +++ /dev/null @@ -1,100 +0,0 @@ -package de.tu_darmstadt.cbs.secretshare; - -import java.io.Serializable; -import java.math.BigInteger; - -/** - * This class implements an arithmetic share - * - * @author Tobias Kussel - */ -public class ArithmeticShare implements Serializable, Cloneable -{ - - /** - * SVUID - */ - private static final long serialVersionUID = 5017971477461756174L; - - /** - * Value - */ - public final BigInteger value; - /** - * Prime - */ - public final BigInteger prime; - - /** - * Creates a copy of another arithmetic share - * - * @param other - */ - public ArithmeticShare(ArithmeticShare other) - { - value = other.value; - prime = other.prime; - } - - /** - * Creates a new instance - * - * @param value - * @param prime - */ - public ArithmeticShare(BigInteger value, BigInteger prime) - { - this.value = value; - this.prime = prime; - } - - /** - * Adds another arithmetic share - * - * @param other - * @return - * @throws IllegalArgumentException - */ - public ArithmeticShare add(ArithmeticShare other) throws IllegalArgumentException - { - if (!this.prime.equals(other.prime)) - throw new IllegalArgumentException("Incompatible primes for addition"); - if (other.value == BigInteger.ZERO) - return this; - if (this.value == BigInteger.ZERO) - return other; - BigInteger sum = this.value.add(other.value).remainder(this.prime); - return new ArithmeticShare(sum, prime); - } - - @Override - public Object clone() - { - return new ArithmeticShare(this.value, this.prime); - } - - @Override - public boolean equals(Object o) - { - if (o == this) - return true; - if (!(o instanceof ArithmeticShare)) - return false; - ArithmeticShare as = (ArithmeticShare) o; - return as.value.equals(value) && as.prime.equals(prime); - } - - @Override - public int hashCode() - { - int result = value.hashCode(); - result = 31 * result + prime.hashCode(); - return result; - } - - @Override - public String toString() - { - return value + " mod " + prime; - } -} \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticSharing.java b/dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticSharing.java deleted file mode 100644 index dca8c964..00000000 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/de/tu_darmstadt/cbs/secretshare/ArithmeticSharing.java +++ /dev/null @@ -1,242 +0,0 @@ -package de.tu_darmstadt.cbs.secretshare; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.math.RoundingMode; -import java.security.SecureRandom; -import java.util.Objects; - -import org.springframework.beans.factory.InitializingBean; - -/** - * This class implements arithmetic sharing - * - * @author Tobias Kussel - */ -public class ArithmeticSharing implements InitializingBean -{ - /** - * Convert a BigDecimal to a fixed point representation - * - * @param value - * Value as (unscaled) BigDecimal - * @param fractionalBits - * number of bits for fixed point scaling. Must be positive - * @return Fixed point represented value - * @throws IllegalArgumentException - * Negative fractionalBits - */ - public static BigInteger convertToFixedPoint(BigDecimal value, int fractionalBits) throws IllegalArgumentException - { - if (fractionalBits < 0) - throw new IllegalArgumentException("FractionalBits must be positive"); - final BigDecimal scaleFactor = BigDecimal.valueOf(2).pow(fractionalBits); - return value.multiply(scaleFactor).toBigInteger(); - } - - /** - * Reconstruct secret from shares - * - * @param shares - * Array of all arithmetic shares - * @return Clear text BigInteger - * @throws IllegalArgumentException - * Incompatible primes - */ - public static BigInteger reconstruct(ArithmeticShare[] shares) throws IllegalArgumentException - { - BigInteger reconstruction = BigInteger.ZERO; - BigInteger first_prime = shares[0].prime; - for (int i = 0; i != shares.length; i++) - { - if (!(shares[i].prime.equals(first_prime))) - { - throw new IllegalArgumentException("Incompatible primes found!"); - } - reconstruction = reconstruction.add(shares[i].value).remainder(shares[i].prime); - } - return reconstruction; - } - - /** - * Reconstruct secret from shares - * - * @param shares - * Array of all arithmetic shares (containing decimal values) - * @param fractionalBits - * Number of bits for fractional part during construction of shares - * @return Clear text BigDecimal - * @throws IllegalArgumentException - * Incompatible primes - */ - public static BigDecimal reconstruct(ArithmeticShare[] shares, int fractionalBits) throws IllegalArgumentException - { - final BigDecimal scaleFactor = BigDecimal.valueOf(2).pow(fractionalBits); - BigDecimal result = new BigDecimal(reconstruct(shares)); - return result.divide(scaleFactor); - } - - /** - * Reconstruct secret from shares - * - * @param shares - * Array of all arithmetic shares (containing decimal values) - * @param fractionalBits - * Number of bits for fractional part during construction of shares - * @param roundingMode - * Rounding mode for final rescaling - * @return Clear text BigDecimal - * @throws IllegalArgumentException - * Incompatible primes - */ - public static BigDecimal reconstruct(ArithmeticShare[] shares, int fractionalBits, RoundingMode roundingMode) - throws IllegalArgumentException - { - final BigDecimal scaleFactor = BigDecimal.valueOf(2).pow(fractionalBits); - BigDecimal result = new BigDecimal(reconstruct(shares)); - return result.divide(scaleFactor, roundingMode); - } - - /** - * RNG - */ - private final SecureRandom randomGenerator = new SecureRandom(); - - /** - * Prime - */ - private final BigInteger prime; - - /** - * Number of parties - */ - private final int numParties; - - /** - * Creates a new instance - * - * @param numParties - */ - public ArithmeticSharing(int numParties) - { - this(numParties, BigInteger.valueOf(2).pow(127).subtract(BigInteger.ONE)); - } - - /** - * Creates a new instance - * - * @param numParties - * @param prime - */ - public ArithmeticSharing(int numParties, BigInteger prime) - { - this.prime = prime; - this.numParties = numParties; - } - - @Override - public void afterPropertiesSet() throws Exception - { - Objects.requireNonNull(prime, "prime"); - - if (BigInteger.ZERO.compareTo(prime) >= 0) - { - throw new IllegalArgumentException("prime < 1"); - } - - if (numParties <= 0) - { - throw new IllegalArgumentException("numParties < 1"); - } - } - - /** - * Share a secret - * - * @param secret - * Secret BigDecimal value to share - * @param fractionalBits - * number of bits for fixed point scaling. Must be positive - * @return Array of arithmetic shares - * @throws IllegalArgumentException - * Negative fractionalBits - */ - public ArithmeticShare[] share(BigDecimal secret, int fractionalBits) throws IllegalArgumentException - { - return share(ArithmeticSharing.convertToFixedPoint(secret, fractionalBits)); - } - - /** - * Share a secret - * - * @param secret - * BigInteger secret value to share - * @return Array of arithmetic shares - */ - public ArithmeticShare[] share(BigInteger secret) - { - BigInteger[] shares = new BigInteger[numParties]; - shares[numParties - 1] = secret; - for (int i = 0; i != numParties - 1; i++) - { - shares[i] = getSignedBlind(127); - shares[numParties - 1] = shares[numParties - 1].add(prime).subtract(shares[i]); - } - ArithmeticShare[] result = new ArithmeticShare[numParties]; - for (int i = 0; i != numParties; i++) - { - result[i] = new ArithmeticShare(shares[i], prime); - } - return result; - } - - /** - * Share a secret - * - * @param secret - * Secret double value to share - * @param fractionalBits - * number of bits for fixed point scaling. Must be positive - * @return Array of arithmetic shares - * @throws IllegalArgumentException - * Negative fractionalBits - */ - public ArithmeticShare[] share(double secret, int fractionalBits) throws IllegalArgumentException - { - return share(BigDecimal.valueOf(secret), fractionalBits); - } - - /** - * Share a secret - * - * @param secret - * Secret integral value to share - * @return Array of arithmetic shares - */ - public ArithmeticShare[] share(int secret) - { - return share(BigInteger.valueOf(secret)); - } - - /** - * Generate a signed blind - * - * @param bitlength - * Bitlength *including* sign bit - * @return BigInteger - * @throws IllegalArgumentException - * Too small or negative bitlength - */ - private BigInteger getSignedBlind(int bitlength) throws IllegalArgumentException - { - if (bitlength < 2) - throw new IllegalArgumentException("Bitlength must be larger than 2"); - BigInteger value = new BigInteger(bitlength - 1, randomGenerator); - byte[] randomByte = new byte[1]; - randomGenerator.nextBytes(randomByte); - int signum = Byte.valueOf(randomByte[0]).intValue() & 0x01; - if (signum == 1) - value = value.negate(); - return value; - } -} \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java index b70649f3..2f114fe2 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java @@ -1,11 +1,9 @@ package org.highmed.dsf.bpe.message; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES; -import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; import java.util.stream.Stream; @@ -21,11 +19,15 @@ import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; import org.hl7.fhir.r4.model.Task.ParameterComponent; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import ca.uhn.fhir.context.FhirContext; public class SendMultiMedicResultShare extends AbstractTaskMessageSend { + private static final Logger logger = LoggerFactory.getLogger(SendMultiMedicResultShare.class); + public SendMultiMedicResultShare(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) { @@ -35,9 +37,8 @@ public SendMultiMedicResultShare(FhirWebserviceClientProvider clientProvider, Ta @Override protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { - // TODO: use calculated multi share QueryResults results = (QueryResults) execution - .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES); + .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES); return results.getResults().stream().map(this::toInput); } @@ -48,6 +49,9 @@ private Task.ParameterComponent toInput(QueryResult result) CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE, result.getCohortSize()); input.addExtension(createCohortIdExtension(result.getCohortId())); + logger.info("Sending MultiMedicShare with cohortId={} and size={}", result.getCohortId(), + result.getCohortSize()); + return input; } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java index a71b4c9c..825ba9bf 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java @@ -1,15 +1,15 @@ package org.highmed.dsf.bpe.message; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.variable.QueryResult; -import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.mpc.QueryResultShare; +import org.highmed.dsf.bpe.mpc.QueryResultShares; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; @@ -37,17 +37,23 @@ public SendSingleMedicResultShare(FhirWebserviceClientProvider clientProvider, T @Override protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { - // TODO: use calculated single share - QueryResults results = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + String targetIdentifier = getTarget(execution).getTargetOrganizationIdentifierValue(); + QueryResultShares shares = (QueryResultShares) execution + .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES); - return results.getResults().stream().map(this::toInput); + return shares.getShares().stream().filter(s -> s.getOrganizationIdentifier().equals(targetIdentifier)) + .map(this::toInput); } - private Task.ParameterComponent toInput(QueryResult result) + private Task.ParameterComponent toInput(QueryResultShare share) { ParameterComponent input = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE, result.getCohortSize()); - input.addExtension(createCohortIdExtension(result.getCohortId())); + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE, + share.getArithmeticShare().getValue().intValue()); + input.addExtension(createCohortIdExtension(share.getCohortId())); + + logger.info("Sending SingleMedicShare with cohortId={} and size={}", share.getCohortId(), + share.getArithmeticShare().getValue().intValue()); return input; } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java new file mode 100644 index 00000000..6a20cd54 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java @@ -0,0 +1,61 @@ +package org.highmed.dsf.bpe.mpc; + +import static org.highmed.dsf.bpe.mpc.ArithmeticSharing.DEFAULT_PRIME; + +import java.io.Serializable; +import java.math.BigInteger; + +/** + * @author Tobias Kussel + */ +public class ArithmeticShare implements Serializable +{ + private final BigInteger value; + private final BigInteger prime; + + public ArithmeticShare(BigInteger value) + { + this(value, DEFAULT_PRIME); + } + + public ArithmeticShare(BigInteger value, BigInteger prime) + { + this.value = value; + this.prime = prime; + } + + public BigInteger getValue() + { + return value; + } + + public BigInteger getPrime() + { + return prime; + } + + @Override + public boolean equals(Object o) + { + if (o == this) + return true; + if (!(o instanceof ArithmeticShare)) + return false; + ArithmeticShare as = (ArithmeticShare) o; + return as.value.equals(value) && as.prime.equals(prime); + } + + @Override + public int hashCode() + { + int result = value.hashCode(); + result = 31 * result + prime.hashCode(); + return result; + } + + @Override + public String toString() + { + return value + " mod " + prime; + } +} \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java new file mode 100644 index 00000000..40d7fb76 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java @@ -0,0 +1,150 @@ +package org.highmed.dsf.bpe.mpc; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.math.RoundingMode; +import java.security.SecureRandom; +import java.util.Arrays; +import java.util.List; +import java.util.Objects; + +import org.springframework.beans.factory.InitializingBean; + +/** + * @author Tobias Kussel + */ +public class ArithmeticSharing implements InitializingBean +{ + public static final BigInteger DEFAULT_PRIME = BigInteger.valueOf(2).pow(127).subtract(BigInteger.ONE); + + private final SecureRandom randomGenerator = new SecureRandom(); + + private final BigInteger prime; + private final int numParties; + + public ArithmeticSharing(int numParties) + { + this(numParties, DEFAULT_PRIME); + } + + public ArithmeticSharing(int numParties, BigInteger prime) + { + this.prime = prime; + this.numParties = numParties; + } + + @Override + public void afterPropertiesSet() throws Exception + { + Objects.requireNonNull(prime, "prime"); + + if (BigInteger.ZERO.compareTo(prime) >= 0) + { + throw new IllegalArgumentException("prime < 1"); + } + + if (numParties <= 0) + { + throw new IllegalArgumentException("numParties < 1"); + } + } + + public List<ArithmeticShare> createShares(double secret, int fractionalBits) + { + return createShares(BigDecimal.valueOf(secret), fractionalBits); + } + + public List<ArithmeticShare> createShares(BigDecimal secret, int fractionalBits) + { + return createShares(convertToFixedPoint(secret, fractionalBits)); + } + + public List<ArithmeticShare> createShares(int secret) + { + return createShares(BigInteger.valueOf(secret)); + } + + public List<ArithmeticShare> createShares(BigInteger secret) + { + BigInteger[] shares = new BigInteger[numParties]; + shares[numParties - 1] = secret; + for (int i = 0; i != numParties - 1; i++) + { + shares[i] = getSignedBlind(127); + shares[numParties - 1] = shares[numParties - 1].add(prime).subtract(shares[i]); + } + ArithmeticShare[] result = new ArithmeticShare[numParties]; + for (int i = 0; i != numParties; i++) + { + result[i] = new ArithmeticShare(shares[i], prime); + } + + return Arrays.asList(result); + } + + public double reconstructToDouble(List<ArithmeticShare> shares, int fractionalBits, RoundingMode roundingMode) + { + return reconstructToBigDecimal(shares, fractionalBits, roundingMode).doubleValue(); + } + + public BigDecimal reconstructToBigDecimal(List<ArithmeticShare> shares, int fractionalBits, + RoundingMode roundingMode) + { + BigDecimal scaleFactor = BigDecimal.valueOf(2).pow(fractionalBits); + BigDecimal result = new BigDecimal(reconstructSecret(shares)); + + return result.divide(scaleFactor, roundingMode); + } + + public int reconstructSecretToInt(List<ArithmeticShare> shares) + { + return reconstructSecret(shares).intValue(); + } + + public BigInteger reconstructSecret(List<ArithmeticShare> shares) + { + if (shares.size() != numParties) + throw new IllegalArgumentException("Number of provided ArithmeticShares does not match numParties, shares=" + + shares.size() + " ,numParties=" + numParties); + + ArithmeticShare[] sharesArray = shares.toArray(new ArithmeticShare[0]); + + BigInteger reconstruction = BigInteger.ZERO; + BigInteger first_prime = sharesArray[0].getPrime(); + for (int i = 0; i != sharesArray.length; i++) + { + if (!(sharesArray[i].getPrime().equals(first_prime))) + { + throw new IllegalArgumentException("Incompatible primes found!"); + } + reconstruction = reconstruction.add(sharesArray[i].getValue()).remainder(sharesArray[i].getPrime()); + } + + return reconstruction; + } + + private BigInteger getSignedBlind(int bitlength) throws IllegalArgumentException + { + if (bitlength < 2) + throw new IllegalArgumentException("Bitlength must be larger than 2"); + + BigInteger value = new BigInteger(bitlength - 1, randomGenerator); + byte[] randomByte = new byte[1]; + randomGenerator.nextBytes(randomByte); + int signum = Byte.valueOf(randomByte[0]).intValue() & 0x01; + if (signum == 1) + value = value.negate(); + + return value; + } + + private BigInteger convertToFixedPoint(BigDecimal value, int fractionalBits) + { + if (fractionalBits < 0) + throw new IllegalArgumentException("FractionalBits must be positive"); + + BigDecimal scaleFactor = BigDecimal.valueOf(2).pow(fractionalBits); + + return value.multiply(scaleFactor).toBigInteger(); + } +} \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShare.java new file mode 100644 index 00000000..99fd8bcd --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShare.java @@ -0,0 +1,38 @@ +package org.highmed.dsf.bpe.mpc; + +import java.io.Serializable; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class QueryResultShare implements Serializable +{ + private final String cohortId; + private final String organizationIdentifier; + private final ArithmeticShare arithmeticShare; + + @JsonCreator + public QueryResultShare(@JsonProperty("cohortId") String cohortId, + @JsonProperty("organizationIdentifier") String organizationIdentifier, + @JsonProperty("arithmeticShare") ArithmeticShare arithmeticShare) + { + this.cohortId = cohortId; + this.organizationIdentifier = organizationIdentifier; + this.arithmeticShare = arithmeticShare; + } + + public String getCohortId() + { + return cohortId; + } + + public String getOrganizationIdentifier() + { + return organizationIdentifier; + } + + public ArithmeticShare getArithmeticShare() + { + return arithmeticShare; + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShares.java new file mode 100644 index 00000000..eae6eafe --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShares.java @@ -0,0 +1,39 @@ +package org.highmed.dsf.bpe.mpc; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +public class QueryResultShares implements Serializable +{ + private final List<QueryResultShare> shares = new ArrayList<>(); + + @JsonCreator + public QueryResultShares(@JsonProperty("shares") Collection<? extends QueryResultShare> shares) + { + if (shares != null) + this.shares.addAll(shares); + } + + public void add(QueryResultShare newShare) + { + if (newShare != null) + shares.add(newShare); + } + + public void addAll(Collection<QueryResultShare> shares) + { + if (shares != null) + this.shares.addAll(shares); + } + + public List<QueryResultShare> getShares() + { + return Collections.unmodifiableList(shares); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMulitMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMulitMedicResultShares.java deleted file mode 100644 index 889d9758..00000000 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMulitMedicResultShares.java +++ /dev/null @@ -1,33 +0,0 @@ -package org.highmed.dsf.bpe.service; - -import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES; -import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variable.QueryResults; -import org.highmed.dsf.bpe.variable.QueryResultsValues; -import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; -import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; -import org.highmed.dsf.fhir.task.TaskHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class CalculateMulitMedicResultShares extends AbstractServiceDelegate -{ - private static final Logger logger = LoggerFactory.getLogger(CalculateMulitMedicResultShares.class); - - public CalculateMulitMedicResultShares(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper) - { - super(clientProvider, taskHelper, readAccessHelper); - } - - @Override - protected void doExecute(DelegateExecution execution) throws Exception - { - logger.info("EXECUTING: {}", CalculateMulitMedicResultShares.class.getName()); - - // TODO: calculate multi shares - } -} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShares.java new file mode 100644 index 00000000..903e9cdc --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShares.java @@ -0,0 +1,83 @@ +package org.highmed.dsf.bpe.service; + +import static java.util.stream.Collectors.groupingBy; +import static java.util.stream.Collectors.toList; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; + +import java.util.List; +import java.util.Map; +import java.util.Objects; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.mpc.ArithmeticShare; +import org.highmed.dsf.bpe.mpc.ArithmeticSharing; +import org.highmed.dsf.bpe.mpc.QueryResultShare; +import org.highmed.dsf.bpe.mpc.QueryResultShares; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Targets; +import org.springframework.beans.factory.InitializingBean; + +public class CalculateMultiMedicResultShares extends AbstractServiceDelegate implements InitializingBean +{ + private final OrganizationProvider organizationProvider; + + public CalculateMultiMedicResultShares(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider) + { + super(clientProvider, taskHelper, readAccessHelper); + + this.organizationProvider = organizationProvider; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(organizationProvider, "organizationProvided"); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + QueryResultShares shares = (QueryResultShares) execution + .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES); + + Targets targets = ((Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS)); + + ArithmeticSharing arithmeticSharing = new ArithmeticSharing(targets.getEntries().size()); + String organizationIdentifier = organizationProvider.getLocalIdentifierValue(); + + Map<String, List<QueryResultShare>> byCohortId = shares.getShares().stream() + .collect(groupingBy(QueryResultShare::getCohortId)); + + List<QueryResult> reconstructedResults = byCohortId.entrySet().stream() + .map(group -> toReconstructedResult(arithmeticSharing, organizationIdentifier, group)) + .collect(toList()); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES, + QueryResultsValues.create(new QueryResults(reconstructedResults))); + + } + + private QueryResult toReconstructedResult(ArithmeticSharing arithmeticSharing, String organizationIdentifier, + Map.Entry<String, List<QueryResultShare>> group) + { + String cohortId = group.getKey(); + List<ArithmeticShare> toReconstruct = group.getValue().stream().map(QueryResultShare::getArithmeticShare) + .collect(toList()); + int reconstructedResult = arithmeticSharing.reconstructSecretToInt(toReconstruct); + + return QueryResult.countResult(organizationIdentifier, cohortId, reconstructedResult); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java index d2a8e23d..cbdf8e10 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java @@ -1,10 +1,28 @@ package org.highmed.dsf.bpe.service; +import static java.util.stream.Collectors.toList; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; + +import java.util.List; +import java.util.stream.IntStream; +import java.util.stream.Stream; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.mpc.ArithmeticShare; +import org.highmed.dsf.bpe.mpc.ArithmeticSharing; +import org.highmed.dsf.bpe.mpc.QueryResultShare; +import org.highmed.dsf.bpe.mpc.QueryResultShares; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Target; +import org.highmed.dsf.fhir.variables.Targets; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +39,32 @@ public CalculateSingleMedicResultShares(FhirWebserviceClientProvider clientProvi @Override protected void doExecute(DelegateExecution execution) throws Exception { - logger.info("EXECUTING: {}", CalculateSingleMedicResultShares.class.getName()); + QueryResults queryResults = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); + Targets targets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); + + List<QueryResultShare> shares = queryResults.getResults().stream() + .flatMap(queryResult -> toArithmeticSharesForCohortAndOrganization(queryResult, targets)) + .collect(toList()); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES, new QueryResultShares(shares)); + } + + private Stream<QueryResultShare> toArithmeticSharesForCohortAndOrganization(QueryResult queryResult, + Targets targets) + { + List<Target> organizations = targets.getEntries(); + ArithmeticSharing arithmeticSharing = new ArithmeticSharing(organizations.size()); + List<ArithmeticShare> shares = arithmeticSharing.createShares(queryResult.getCohortSize()); + + if (shares.size() != organizations.size()) + throw new IllegalStateException("Number of shares does not match number of targets"); - // TODO: calculate single shares + return IntStream.range(0, shares.size()).mapToObj(i -> new QueryResultShare(queryResult.getCohortId(), + organizations.get(i).getTargetOrganizationIdentifierValue(), shares.get(i))); + } + + private int getNumberOfParticipatingMedics(DelegateExecution execution) + { + return ((Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS)).getEntries().size(); } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java index d2f3c20e..f919859f 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java @@ -1,20 +1,22 @@ package org.highmed.dsf.bpe.service; +import static java.util.stream.Collectors.toList; + import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; +import java.math.BigInteger; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variable.QueryResult; -import org.highmed.dsf.bpe.variable.QueryResults; -import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.bpe.mpc.ArithmeticShare; +import org.highmed.dsf.bpe.mpc.QueryResultShare; +import org.highmed.dsf.bpe.mpc.QueryResultShares; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -38,22 +40,20 @@ public StoreResultsSingleMedicShare(FhirWebserviceClientProvider clientProvider, @Override protected void doExecute(DelegateExecution execution) throws Exception { - logger.info("EXECUTING: {}", StoreResultsSingleMedicShare.class.getName()); - - QueryResults results = (QueryResults) execution + QueryResultShares shares = (QueryResultShares) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES); Task task = getCurrentTaskFromExecutionVariables(); - List<QueryResult> extendedResults = new ArrayList<>(); - extendedResults.addAll(results.getResults()); - extendedResults.addAll(getResults(task)); + List<QueryResultShare> extendedShares = new ArrayList<>(); + extendedShares.addAll(shares.getShares()); + extendedShares.addAll(getShares(task)); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES, - QueryResultsValues.create(new QueryResults(extendedResults))); + new QueryResultShares(extendedShares)); } - private List<QueryResult> getResults(Task task) + private List<QueryResultShare> getShares(Task task) { TaskHelper taskHelper = getTaskHelper(); Reference requester = task.getRequester(); @@ -61,12 +61,16 @@ private List<QueryResult> getResults(Task task) return taskHelper .getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE, EXTENSION_HIGHMED_GROUP_ID) - .map(input -> - { - String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); - int cohortSize = ((UnsignedIntType) input.getValue()).getValue(); + .map(input -> toQueryResultShare(requester, input)).collect(toList()); + } + + private QueryResultShare toQueryResultShare(Reference requester, Task.ParameterComponent input) + { + String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); + String organizationIdentifier = requester.getIdentifier().getValue(); + int shareSize = ((UnsignedIntType) input.getValue()).getValue(); - return QueryResult.countResult(requester.getIdentifier().getValue(), cohortId, cohortSize); - }).collect(Collectors.toList()); + return new QueryResultShare(cohortId, organizationIdentifier, + new ArithmeticShare(BigInteger.valueOf(shareSize))); } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java index 15f4b043..5dd12d49 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java @@ -13,8 +13,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.variable.QueryResults; -import org.highmed.dsf.bpe.variable.QueryResultsValues; +import org.highmed.dsf.bpe.mpc.QueryResultShares; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -42,8 +41,7 @@ protected void doExecute(DelegateExecution execution) throws Exception String correlationKey = getCorrelationKey(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_CORRELATION_KEY, correlationKey); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES, - QueryResultsValues.create(new QueryResults(null))); + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES, new QueryResultShares(null)); } private Targets getTargets(Task task) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java index c96136b4..979861f4 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java @@ -3,8 +3,8 @@ import org.highmed.consent.client.ConsentClient; import org.highmed.consent.client.ConsentClientFactory; import org.highmed.dsf.bpe.message.*; -import org.highmed.dsf.bpe.service.CalculateMulitMedicResultShares; import org.highmed.dsf.bpe.service.CalculateMultiMedicResult; +import org.highmed.dsf.bpe.service.CalculateMultiMedicResultShares; import org.highmed.dsf.bpe.service.CalculateSingleMedicResultShares; import org.highmed.dsf.bpe.service.CheckFeasibilityMpcResources; import org.highmed.dsf.bpe.service.CheckMultiMedicResults; @@ -112,9 +112,10 @@ public StoreResultsMultiMedicShare storeResultsMultiMedicShare() } @Bean - public CalculateMulitMedicResultShares calculateMulitMedicResultShares() + public CalculateMultiMedicResultShares calculateMulitMedicResultShares() { - return new CalculateMulitMedicResultShares(fhirClientProvider, taskHelper, readAccessHelper); + return new CalculateMultiMedicResultShares(fhirClientProvider, taskHelper, readAccessHelper, + organizationProvider); } @Bean diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn index 9e3319d3..3d51f688 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn @@ -56,7 +56,7 @@ </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_18n85hs" sourceRef="Activity_11idi2o" targetRef="Gateway_0atmr78" /> <bpmn:sequenceFlow id="Flow_1688meb" sourceRef="Event_1qabwc2" targetRef="Gateway_0atmr78" /> - <bpmn:serviceTask id="Activity_07k3fpm" name="calculate multi medic result shares" camunda:class="org.highmed.dsf.bpe.service.CalculateMulitMedicResultShares"> + <bpmn:serviceTask id="Activity_07k3fpm" name="calculate multi medic result shares" camunda:class="org.highmed.dsf.bpe.service.CalculateMultiMedicResultShares"> <bpmn:incoming>Flow_18sujdf</bpmn:incoming> <bpmn:outgoing>Flow_0bm0z7u</bpmn:outgoing> </bpmn:serviceTask> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn index 696ab73a..b947d25b 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> <bpmn:process id="highmedorg_executeFeasibilityMpcSingleShare" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:serviceTask id="checkResults" name="check single medic result shares" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResultShares"> - <bpmn:incoming>Flow_1tdtqpl</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> + <bpmn:incoming>Flow_08uzidj</bpmn:incoming> + <bpmn:outgoing>Flow_0nknzne</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="checkFeasibilityMpcResources" name="check feasibility resources" camunda:class="org.highmed.dsf.bpe.service.CheckFeasibilityMpcResources"> <bpmn:incoming>Flow_1czhll7</bpmn:incoming> @@ -19,7 +19,6 @@ <bpmn:incoming>SequenceFlow_14cn0vs</bpmn:incoming> <bpmn:outgoing>Flow_1czhll7</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_04ouilq" sourceRef="checkResults" targetRef="selectResponseTargetTtp" /> <bpmn:sequenceFlow id="SequenceFlow_07wtgee" sourceRef="checkQueries" targetRef="ExclusiveGateway_1dln3in" /> <bpmn:serviceTask id="checkQueries" name="check query" camunda:class="org.highmed.dsf.bpe.service.CheckQueries"> <bpmn:incoming>Flow_1dnygeo</bpmn:incoming> @@ -67,25 +66,24 @@ <bpmn:incoming>SequenceFlow_1kpvsx9</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0q803rh</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_0q803rh" sourceRef="ExclusiveGateway_002t87f" targetRef="calculateSingleMedicResultShares" /> + <bpmn:sequenceFlow id="SequenceFlow_0q803rh" sourceRef="ExclusiveGateway_002t87f" targetRef="selectResponseTargetTtp" /> <bpmn:sequenceFlow id="SequenceFlow_1kpvsx9" sourceRef="countIds" targetRef="ExclusiveGateway_002t87f" /> <bpmn:serviceTask id="countIds" name="count id's" camunda:class="org.highmed.dsf.bpe.service.GenerateCountFromIds"> <bpmn:incoming>Flow_19itw20</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1kpvsx9</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_0ascyjc" sourceRef="selectResponseTargetTtp" targetRef="sendSingleMedicResultShares" /> + <bpmn:sequenceFlow id="SequenceFlow_0ascyjc" sourceRef="selectResponseTargetTtp" targetRef="calculateSingleMedicResultShares" /> <bpmn:serviceTask id="selectResponseTargetTtp" name="select single medic result  share targets" camunda:class="org.highmed.dsf.bpe.service.SelectSingleMedicResultShareTargets"> - <bpmn:incoming>SequenceFlow_04ouilq</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0q803rh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0ascyjc</bpmn:outgoing> </bpmn:serviceTask> <bpmn:serviceTask id="executeQueries" name="execute query" camunda:class="org.highmed.dsf.bpe.service.ExecuteQueries"> <bpmn:incoming>SequenceFlow_0bwn08k</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1rmqv20</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_1tdtqpl" sourceRef="calculateSingleMedicResultShares" targetRef="checkResults" /> <bpmn:serviceTask id="calculateSingleMedicResultShares" name="calculate single medic result shares" camunda:class="org.highmed.dsf.bpe.service.CalculateSingleMedicResultShares"> - <bpmn:incoming>SequenceFlow_0q803rh</bpmn:incoming> - <bpmn:outgoing>Flow_1tdtqpl</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_0ascyjc</bpmn:incoming> + <bpmn:outgoing>Flow_08uzidj</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sendTask id="sendSingleMedicResultShares" name="send single medic result shares" camunda:class="org.highmed.dsf.bpe.message.SendSingleMedicResultShare"> <bpmn:extensionElements> @@ -95,7 +93,7 @@ <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare/0.6.0</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0ascyjc</bpmn:incoming> + <bpmn:incoming>Flow_0nknzne</bpmn:incoming> <bpmn:outgoing>Flow_1tfx2ak</bpmn:outgoing> <bpmn:multiInstanceLoopCharacteristics camunda:collection="${targets.entries}" camunda:elementVariable="target" /> </bpmn:sendTask> @@ -106,6 +104,8 @@ </bpmn:endEvent> <bpmn:sequenceFlow id="Flow_1tfx2ak" sourceRef="sendSingleMedicResultShares" targetRef="Event_1smcidr" /> <bpmn:sequenceFlow id="Flow_1dnygeo" sourceRef="checkFeasibilityMpcResources" targetRef="checkQueries" /> + <bpmn:sequenceFlow id="Flow_0nknzne" sourceRef="checkResults" targetRef="sendSingleMedicResultShares" /> + <bpmn:sequenceFlow id="Flow_08uzidj" sourceRef="calculateSingleMedicResultShares" targetRef="checkResults" /> <bpmn:textAnnotation id="TextAnnotation_0euut3n"> <bpmn:text>uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc.</bpmn:text> </bpmn:textAnnotation> @@ -122,7 +122,7 @@ <di:waypoint x="600" y="272" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1tfx2ak_di" bpmnElement="Flow_1tfx2ak"> - <di:waypoint x="2310" y="272" /> + <di:waypoint x="2300" y="272" /> <di:waypoint x="2372" y="272" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1czhll7_di" bpmnElement="Flow_1czhll7"> @@ -133,13 +133,9 @@ <di:waypoint x="1440" y="141" /> <di:waypoint x="1520" y="141" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_1tdtqpl_di" bpmnElement="Flow_1tdtqpl"> - <di:waypoint x="1770" y="272" /> - <di:waypoint x="1860" y="272" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0ascyjc_di" bpmnElement="SequenceFlow_0ascyjc"> - <di:waypoint x="2130" y="272" /> - <di:waypoint x="2210" y="272" /> + <di:waypoint x="1770" y="272" /> + <di:waypoint x="1840" y="272" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1kpvsx9_di" bpmnElement="SequenceFlow_1kpvsx9"> <di:waypoint x="1570" y="181" /> @@ -191,10 +187,6 @@ <di:waypoint x="700" y="272" /> <di:waypoint x="763" y="272" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_04ouilq_di" bpmnElement="SequenceFlow_04ouilq"> - <di:waypoint x="1960" y="272" /> - <di:waypoint x="2030" y="272" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_14cn0vs_di" bpmnElement="SequenceFlow_14cn0vs"> <di:waypoint x="188" y="272" /> <di:waypoint x="260" y="272" /> @@ -203,9 +195,14 @@ <di:waypoint x="1130" y="272" /> <di:waypoint x="1195" y="272" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> - <dc:Bounds x="1860" y="232" width="100" height="80" /> - </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_0nknzne_di" bpmnElement="Flow_0nknzne"> + <di:waypoint x="2120" y="272" /> + <di:waypoint x="2200" y="272" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_08uzidj_di" bpmnElement="Flow_08uzidj"> + <di:waypoint x="1940" y="272" /> + <di:waypoint x="2020" y="272" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkFeasibilityMpcResources"> <dc:Bounds x="440" y="232" width="100" height="80" /> </bpmndi:BPMNShape> @@ -242,24 +239,27 @@ <bpmndi:BPMNShape id="ServiceTask_17kpyle_di" bpmnElement="countIds"> <dc:Bounds x="1520" y="101" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> - <dc:Bounds x="2030" y="232" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0u5pb4i_di" bpmnElement="executeQueries"> <dc:Bounds x="1030" y="232" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0z7c65s_di" bpmnElement="calculateSingleMedicResultShares"> - <dc:Bounds x="1670" y="232" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0j0x0r2_di" bpmnElement="sendSingleMedicResultShares"> - <dc:Bounds x="2210" y="232" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1smcidr_di" bpmnElement="Event_1smcidr"> <dc:Bounds x="2372" y="254" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> <dc:Bounds x="490" y="113" width="267" height="56" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> + <dc:Bounds x="1670" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0z7c65s_di" bpmnElement="calculateSingleMedicResultShares"> + <dc:Bounds x="1840" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> + <dc:Bounds x="2020" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0j0x0r2_di" bpmnElement="sendSingleMedicResultShares"> + <dc:Bounds x="2200" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> <di:waypoint x="460" y="230" /> <di:waypoint x="460" y="140" /> From bbe7598719b8f9f16a74e84e668ab2ccd41bbbab Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 1 Feb 2022 12:24:58 +0100 Subject: [PATCH 078/125] first version of aworking mpc feasibility process --- .../highmed/dsf/bpe/variable/QueryResult.java | 5 ++ .../message/SendMultiMedicResultShare.java | 2 +- .../message/SendSingleMedicResultShare.java | 17 +++--- .../highmed/dsf/bpe/mpc/ArithmeticShare.java | 6 ++- .../dsf/bpe/mpc/ArithmeticSharing.java | 30 ++++++++--- .../highmed/dsf/bpe/mpc/QueryResultShare.java | 38 ------------- .../dsf/bpe/mpc/QueryResultShares.java | 39 -------------- .../service/CalculateMultiMedicResult.java | 51 +++++++++++++++++- .../CalculateMultiMedicResultShares.java | 21 ++++---- .../CalculateSingleMedicResultShares.java | 21 +++----- .../bpe/service/CheckMultiMedicResults.java | 53 +++++++++++++++++- .../DownloadResearchStudyResource.java | 1 - .../dsf/bpe/service/ExecuteQueries.java | 3 +- .../service/StoreResultsMultiMedicShare.java | 12 ++--- .../service/StoreResultsSingleMedicShare.java | 31 +++++------ ...SingleMedicResultShareCorrelationKeys.java | 6 ++- .../spring/config/FeasibilityMpcConfig.java | 5 +- .../resources/bpe/requestFeasibilityMpc.bpmn | 16 +++--- ...lti-medic-result-share-feasibility-mpc.xml | 2 +- ...gle-medic-result-share-feasibility-mpc.xml | 2 +- .../dsf/bpe/mpc/ArithmeticSharingTest.java | 54 +++++++++++++++++++ .../dsf/fhir/profile/TaskProfileTest.java | 9 ++-- 22 files changed, 256 insertions(+), 168 deletions(-) delete mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShare.java delete mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShares.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java index 9ce52281..053fdfd3 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java @@ -22,6 +22,11 @@ public static QueryResult countResult(String organizationIdentifier, String coho return new QueryResult(organizationIdentifier, cohortId, cohortSize, null, null); } + public static QueryResult mpcCountResult(String organizationIdentifier, String cohortId, int cohortSize) + { + return new QueryResult(organizationIdentifier, cohortId, cohortSize, null, null); + } + public static QueryResult idResult(String organizationIdentifier, String cohortId, ResultSet resultSet) { return new QueryResult(organizationIdentifier, cohortId, -1, resultSet, null); diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java index 2f114fe2..c99e86bd 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java @@ -45,7 +45,7 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE private Task.ParameterComponent toInput(QueryResult result) { - ParameterComponent input = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, + ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE, result.getCohortSize()); input.addExtension(createCohortIdExtension(result.getCohortId())); diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java index 825ba9bf..34f45587 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java @@ -8,8 +8,8 @@ import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.mpc.QueryResultShare; -import org.highmed.dsf.bpe.mpc.QueryResultShares; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; @@ -38,22 +38,21 @@ public SendSingleMedicResultShare(FhirWebserviceClientProvider clientProvider, T protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { String targetIdentifier = getTarget(execution).getTargetOrganizationIdentifierValue(); - QueryResultShares shares = (QueryResultShares) execution + QueryResults shares = (QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES); - return shares.getShares().stream().filter(s -> s.getOrganizationIdentifier().equals(targetIdentifier)) + return shares.getResults().stream().filter(s -> s.getOrganizationIdentifier().equals(targetIdentifier)) .map(this::toInput); } - private Task.ParameterComponent toInput(QueryResultShare share) + private Task.ParameterComponent toInput(QueryResult share) { - ParameterComponent input = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, - CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE, - share.getArithmeticShare().getValue().intValue()); + ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE, share.getCohortSize()); input.addExtension(createCohortIdExtension(share.getCohortId())); logger.info("Sending SingleMedicShare with cohortId={} and size={}", share.getCohortId(), - share.getArithmeticShare().getValue().intValue()); + share.getCohortSize()); return input; } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java index 6a20cd54..062d1837 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java @@ -5,6 +5,9 @@ import java.io.Serializable; import java.math.BigInteger; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + /** * @author Tobias Kussel */ @@ -18,7 +21,8 @@ public ArithmeticShare(BigInteger value) this(value, DEFAULT_PRIME); } - public ArithmeticShare(BigInteger value, BigInteger prime) + @JsonCreator + public ArithmeticShare(@JsonProperty("value") BigInteger value, @JsonProperty("prime") BigInteger prime) { this.value = value; this.prime = prime; diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java index 40d7fb76..26aa3fb2 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java @@ -15,9 +15,11 @@ */ public class ArithmeticSharing implements InitializingBean { - public static final BigInteger DEFAULT_PRIME = BigInteger.valueOf(2).pow(127).subtract(BigInteger.ONE); + private static final int MAX_POWER_FOR_INT = 31; + public static final BigInteger DEFAULT_PRIME = BigInteger.valueOf(2).pow(MAX_POWER_FOR_INT) + .subtract(BigInteger.ONE); - private final SecureRandom randomGenerator = new SecureRandom(); + private static final SecureRandom RANDOM_GENERATOR = new SecureRandom(); private final BigInteger prime; private final int numParties; @@ -49,6 +51,16 @@ public void afterPropertiesSet() throws Exception } } + public int getNumParties() + { + return numParties; + } + + public BigInteger getPrime() + { + return prime; + } + public List<ArithmeticShare> createShares(double secret, int fractionalBits) { return createShares(BigDecimal.valueOf(secret), fractionalBits); @@ -68,11 +80,15 @@ public List<ArithmeticShare> createShares(BigInteger secret) { BigInteger[] shares = new BigInteger[numParties]; shares[numParties - 1] = secret; + for (int i = 0; i != numParties - 1; i++) { - shares[i] = getSignedBlind(127); - shares[numParties - 1] = shares[numParties - 1].add(prime).subtract(shares[i]); + shares[i] = getSignedBlind(MAX_POWER_FOR_INT); + shares[numParties - 1] = shares[numParties - 1].subtract(shares[i]); } + + shares[numParties - 1] = shares[numParties - 1].mod(prime); + ArithmeticShare[] result = new ArithmeticShare[numParties]; for (int i = 0; i != numParties; i++) { @@ -98,7 +114,7 @@ public BigDecimal reconstructToBigDecimal(List<ArithmeticShare> shares, int frac public int reconstructSecretToInt(List<ArithmeticShare> shares) { - return reconstructSecret(shares).intValue(); + return reconstructSecret(shares).intValueExact(); } public BigInteger reconstructSecret(List<ArithmeticShare> shares) @@ -128,9 +144,9 @@ private BigInteger getSignedBlind(int bitlength) throws IllegalArgumentException if (bitlength < 2) throw new IllegalArgumentException("Bitlength must be larger than 2"); - BigInteger value = new BigInteger(bitlength - 1, randomGenerator); + BigInteger value = new BigInteger(bitlength - 1, RANDOM_GENERATOR); byte[] randomByte = new byte[1]; - randomGenerator.nextBytes(randomByte); + RANDOM_GENERATOR.nextBytes(randomByte); int signum = Byte.valueOf(randomByte[0]).intValue() & 0x01; if (signum == 1) value = value.negate(); diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShare.java deleted file mode 100644 index 99fd8bcd..00000000 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShare.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.highmed.dsf.bpe.mpc; - -import java.io.Serializable; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class QueryResultShare implements Serializable -{ - private final String cohortId; - private final String organizationIdentifier; - private final ArithmeticShare arithmeticShare; - - @JsonCreator - public QueryResultShare(@JsonProperty("cohortId") String cohortId, - @JsonProperty("organizationIdentifier") String organizationIdentifier, - @JsonProperty("arithmeticShare") ArithmeticShare arithmeticShare) - { - this.cohortId = cohortId; - this.organizationIdentifier = organizationIdentifier; - this.arithmeticShare = arithmeticShare; - } - - public String getCohortId() - { - return cohortId; - } - - public String getOrganizationIdentifier() - { - return organizationIdentifier; - } - - public ArithmeticShare getArithmeticShare() - { - return arithmeticShare; - } -} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShares.java deleted file mode 100644 index eae6eafe..00000000 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/QueryResultShares.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.highmed.dsf.bpe.mpc; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - -public class QueryResultShares implements Serializable -{ - private final List<QueryResultShare> shares = new ArrayList<>(); - - @JsonCreator - public QueryResultShares(@JsonProperty("shares") Collection<? extends QueryResultShare> shares) - { - if (shares != null) - this.shares.addAll(shares); - } - - public void add(QueryResultShare newShare) - { - if (newShare != null) - shares.add(newShare); - } - - public void addAll(Collection<QueryResultShare> shares) - { - if (shares != null) - this.shares.addAll(shares); - } - - public List<QueryResultShare> getShares() - { - return Collections.unmodifiableList(shares); - } -} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java index 25619372..def26612 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java @@ -1,10 +1,29 @@ package org.highmed.dsf.bpe.service; +import static java.util.stream.Collectors.groupingBy; +import static java.util.stream.Collectors.toList; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES; + +import java.math.BigInteger; +import java.util.List; +import java.util.Map; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.mpc.ArithmeticShare; +import org.highmed.dsf.bpe.mpc.ArithmeticSharing; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variables.FinalFeasibilityMpcQueryResult; +import org.highmed.dsf.bpe.variables.FinalFeasibilityMpcQueryResults; +import org.highmed.dsf.bpe.variables.FinalFeasibilityMpcQueryResultsValues; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Targets; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,8 +40,36 @@ public CalculateMultiMedicResult(FhirWebserviceClientProvider clientProvider, Ta @Override protected void doExecute(DelegateExecution execution) throws Exception { - logger.info("EXECUTING: {}", CalculateMultiMedicResult.class.getName()); + QueryResults shares = (QueryResults) execution + .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES); + + Targets targets = ((Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS)); + + ArithmeticSharing arithmeticSharing = new ArithmeticSharing(targets.getEntries().size()); + + Map<String, List<QueryResult>> byCohortId = shares.getResults().stream() + .collect(groupingBy(QueryResult::getCohortId)); + + List<FinalFeasibilityMpcQueryResult> reconstructedResults = byCohortId.entrySet().stream() + .map(group -> toReconstructedResult(arithmeticSharing, group)).collect(toList()); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS, FinalFeasibilityMpcQueryResultsValues + .create(new FinalFeasibilityMpcQueryResults(reconstructedResults))); + } + + private FinalFeasibilityMpcQueryResult toReconstructedResult(ArithmeticSharing arithmeticSharing, + Map.Entry<String, List<QueryResult>> group) + { + String cohortId = group.getKey(); + List<ArithmeticShare> toReconstruct = group.getValue().stream().map(s -> toArithmeticShare(s.getCohortSize())) + .collect(toList()); + int reconstructedResult = arithmeticSharing.reconstructSecretToInt(toReconstruct); - // TODO: calculate results + return new FinalFeasibilityMpcQueryResult(cohortId, arithmeticSharing.getNumParties(), reconstructedResult); + } + + private ArithmeticShare toArithmeticShare(int share) + { + return new ArithmeticShare(BigInteger.valueOf(share)); } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShares.java index 903e9cdc..79997562 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShares.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShares.java @@ -7,6 +7,7 @@ import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; +import java.math.BigInteger; import java.util.List; import java.util.Map; import java.util.Objects; @@ -15,8 +16,6 @@ import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.mpc.ArithmeticShare; import org.highmed.dsf.bpe.mpc.ArithmeticSharing; -import org.highmed.dsf.bpe.mpc.QueryResultShare; -import org.highmed.dsf.bpe.mpc.QueryResultShares; import org.highmed.dsf.bpe.variable.QueryResult; import org.highmed.dsf.bpe.variable.QueryResults; import org.highmed.dsf.bpe.variable.QueryResultsValues; @@ -50,7 +49,7 @@ public void afterPropertiesSet() throws Exception @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResultShares shares = (QueryResultShares) execution + QueryResults shares = (QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES); Targets targets = ((Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS)); @@ -58,8 +57,8 @@ protected void doExecute(DelegateExecution execution) throws Exception ArithmeticSharing arithmeticSharing = new ArithmeticSharing(targets.getEntries().size()); String organizationIdentifier = organizationProvider.getLocalIdentifierValue(); - Map<String, List<QueryResultShare>> byCohortId = shares.getShares().stream() - .collect(groupingBy(QueryResultShare::getCohortId)); + Map<String, List<QueryResult>> byCohortId = shares.getResults().stream() + .collect(groupingBy(QueryResult::getCohortId)); List<QueryResult> reconstructedResults = byCohortId.entrySet().stream() .map(group -> toReconstructedResult(arithmeticSharing, organizationIdentifier, group)) @@ -67,17 +66,21 @@ protected void doExecute(DelegateExecution execution) throws Exception execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES, QueryResultsValues.create(new QueryResults(reconstructedResults))); - } private QueryResult toReconstructedResult(ArithmeticSharing arithmeticSharing, String organizationIdentifier, - Map.Entry<String, List<QueryResultShare>> group) + Map.Entry<String, List<QueryResult>> group) { String cohortId = group.getKey(); - List<ArithmeticShare> toReconstruct = group.getValue().stream().map(QueryResultShare::getArithmeticShare) + List<ArithmeticShare> toReconstruct = group.getValue().stream().map(s -> toArithmeticShare(s.getCohortSize())) .collect(toList()); int reconstructedResult = arithmeticSharing.reconstructSecretToInt(toReconstruct); - return QueryResult.countResult(organizationIdentifier, cohortId, reconstructedResult); + return QueryResult.mpcCountResult(organizationIdentifier, cohortId, reconstructedResult); + } + + private ArithmeticShare toArithmeticShare(int share) + { + return new ArithmeticShare(BigInteger.valueOf(share)); } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java index cbdf8e10..4d12b68d 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java @@ -14,10 +14,9 @@ import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.bpe.mpc.ArithmeticShare; import org.highmed.dsf.bpe.mpc.ArithmeticSharing; -import org.highmed.dsf.bpe.mpc.QueryResultShare; -import org.highmed.dsf.bpe.mpc.QueryResultShares; import org.highmed.dsf.bpe.variable.QueryResult; import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -42,15 +41,15 @@ protected void doExecute(DelegateExecution execution) throws Exception QueryResults queryResults = (QueryResults) execution.getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS); Targets targets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); - List<QueryResultShare> shares = queryResults.getResults().stream() + List<QueryResult> shares = queryResults.getResults().stream() .flatMap(queryResult -> toArithmeticSharesForCohortAndOrganization(queryResult, targets)) .collect(toList()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES, new QueryResultShares(shares)); + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES, + QueryResultsValues.create(new QueryResults(shares))); } - private Stream<QueryResultShare> toArithmeticSharesForCohortAndOrganization(QueryResult queryResult, - Targets targets) + private Stream<QueryResult> toArithmeticSharesForCohortAndOrganization(QueryResult queryResult, Targets targets) { List<Target> organizations = targets.getEntries(); ArithmeticSharing arithmeticSharing = new ArithmeticSharing(organizations.size()); @@ -59,12 +58,8 @@ private Stream<QueryResultShare> toArithmeticSharesForCohortAndOrganization(Quer if (shares.size() != organizations.size()) throw new IllegalStateException("Number of shares does not match number of targets"); - return IntStream.range(0, shares.size()).mapToObj(i -> new QueryResultShare(queryResult.getCohortId(), - organizations.get(i).getTargetOrganizationIdentifierValue(), shares.get(i))); - } - - private int getNumberOfParticipatingMedics(DelegateExecution execution) - { - return ((Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS)).getEntries().size(); + return IntStream.range(0, shares.size()) + .mapToObj(i -> QueryResult.mpcCountResult(organizations.get(i).getTargetOrganizationIdentifierValue(), + queryResult.getCohortId(), shares.get(i).getValue().intValueExact())); } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java index f7c9bea4..886bf5a8 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java @@ -1,10 +1,21 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; +import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT; +import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.variables.FinalFeasibilityMpcQueryResult; +import org.highmed.dsf.bpe.variables.FinalFeasibilityMpcQueryResults; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,6 +32,46 @@ public CheckMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskH @Override protected void doExecute(DelegateExecution execution) throws Exception { - logger.info("EXECUTING: {}", CheckMultiMedicResults.class.getName()); + Task leadingTask = getLeadingTaskFromExecutionVariables(); + + FinalFeasibilityMpcQueryResults results = (FinalFeasibilityMpcQueryResults) execution + .getVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS); + + FinalFeasibilityMpcQueryResults checkedResults = checkResults(results); + + addFinalFeasibilityQueryResultsToLeadingTask(checkedResults, leadingTask); + } + + protected FinalFeasibilityMpcQueryResults checkResults(FinalFeasibilityMpcQueryResults results) + { + // TODO implement check for results + // - criterias tbd + return results; + } + + private void addFinalFeasibilityQueryResultsToLeadingTask(FinalFeasibilityMpcQueryResults results, Task toWrite) + { + results.getResults().forEach(result -> addResultOutput(result, toWrite)); + } + + private void addResultOutput(FinalFeasibilityMpcQueryResult result, Task toWrite) + { + Task.TaskOutputComponent output1 = getTaskHelper().createOutputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_COUNT_RESULT, result.getCohortSize()); + output1.addExtension(createCohortIdExtension(result.getCohortId())); + toWrite.addOutput(output1); + + Task.TaskOutputComponent output2 = getTaskHelper().createOutputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, + CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS, result.getParticipatingMedics()); + output2.addExtension(createCohortIdExtension(result.getCohortId())); + toWrite.addOutput(output2); + + logger.info("Storing MultiMedicResult with cohortId={} and size={}", result.getCohortId(), + result.getCohortSize()); + } + + private Extension createCohortIdExtension(String cohortId) + { + return new Extension(EXTENSION_HIGHMED_GROUP_ID, new Reference(cohortId)); } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java index 0c006a84..a7e69ec5 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -10,7 +10,6 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES; -import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; import java.util.ArrayList; import java.util.List; diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java index 299122da..5898f17a 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/ExecuteQueries.java @@ -1,7 +1,6 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERIES; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; @@ -77,7 +76,7 @@ private QueryResult executeQuery(String cohortId, String cohortQuery, boolean id else { int count = Integer.parseInt(resultSet.getRow(0).get(0).getValueAsString()); - return QueryResult.countResult(organizationProvider.getLocalIdentifierValue(), cohortId, count); + return QueryResult.mpcCountResult(organizationProvider.getLocalIdentifierValue(), cohortId, count); } } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsMultiMedicShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsMultiMedicShare.java index 2fddb0e2..9b97a3b6 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsMultiMedicShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsMultiMedicShare.java @@ -17,17 +17,13 @@ import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.IntegerType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; -import org.hl7.fhir.r4.model.UnsignedIntType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; public class StoreResultsMultiMedicShare extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(StoreResultsMultiMedicShare.class); - public StoreResultsMultiMedicShare(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) { @@ -37,8 +33,6 @@ public StoreResultsMultiMedicShare(FhirWebserviceClientProvider clientProvider, @Override protected void doExecute(DelegateExecution execution) throws Exception { - logger.info("EXECUTING: {}", StoreResultsMultiMedicShare.class.getName()); - QueryResults results = (QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES); @@ -63,9 +57,9 @@ private List<QueryResult> getResults(Task task) .map(input -> { String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); - int cohortSize = ((UnsignedIntType) input.getValue()).getValue(); + int cohortSize = ((IntegerType) input.getValue()).getValue(); - return QueryResult.countResult(requester.getIdentifier().getValue(), cohortId, cohortSize); + return QueryResult.mpcCountResult(requester.getIdentifier().getValue(), cohortId, cohortSize); }).collect(Collectors.toList()); } } \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java index f919859f..5e41fd6c 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java @@ -7,30 +7,24 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; -import java.math.BigInteger; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.mpc.ArithmeticShare; -import org.highmed.dsf.bpe.mpc.QueryResultShare; -import org.highmed.dsf.bpe.mpc.QueryResultShares; +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.IntegerType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; -import org.hl7.fhir.r4.model.UnsignedIntType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; public class StoreResultsSingleMedicShare extends AbstractServiceDelegate implements InitializingBean { - private static final Logger logger = LoggerFactory.getLogger(StoreResultsSingleMedicShare.class); - public StoreResultsSingleMedicShare(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) { @@ -40,20 +34,20 @@ public StoreResultsSingleMedicShare(FhirWebserviceClientProvider clientProvider, @Override protected void doExecute(DelegateExecution execution) throws Exception { - QueryResultShares shares = (QueryResultShares) execution + QueryResults shares = (QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES); Task task = getCurrentTaskFromExecutionVariables(); - List<QueryResultShare> extendedShares = new ArrayList<>(); - extendedShares.addAll(shares.getShares()); + List<QueryResult> extendedShares = new ArrayList<>(); + extendedShares.addAll(shares.getResults()); extendedShares.addAll(getShares(task)); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES, - new QueryResultShares(extendedShares)); + QueryResultsValues.create(new QueryResults(extendedShares))); } - private List<QueryResultShare> getShares(Task task) + private List<QueryResult> getShares(Task task) { TaskHelper taskHelper = getTaskHelper(); Reference requester = task.getRequester(); @@ -64,13 +58,12 @@ private List<QueryResultShare> getShares(Task task) .map(input -> toQueryResultShare(requester, input)).collect(toList()); } - private QueryResultShare toQueryResultShare(Reference requester, Task.ParameterComponent input) + private QueryResult toQueryResultShare(Reference requester, Task.ParameterComponent input) { String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); String organizationIdentifier = requester.getIdentifier().getValue(); - int shareSize = ((UnsignedIntType) input.getValue()).getValue(); + int shareSize = ((IntegerType) input.getValue()).getValue(); - return new QueryResultShare(cohortId, organizationIdentifier, - new ArithmeticShare(BigInteger.valueOf(shareSize))); + return QueryResult.mpcCountResult(organizationIdentifier, cohortId, shareSize); } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java index 5dd12d49..15f4b043 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java @@ -13,7 +13,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.mpc.QueryResultShares; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.bpe.variable.QueryResultsValues; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -41,7 +42,8 @@ protected void doExecute(DelegateExecution execution) throws Exception String correlationKey = getCorrelationKey(task); execution.setVariable(BPMN_EXECUTION_VARIABLE_CORRELATION_KEY, correlationKey); - execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES, new QueryResultShares(null)); + execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES, + QueryResultsValues.create(new QueryResults(null))); } private Targets getTargets(Task task) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java index 979861f4..9da6353a 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java @@ -2,7 +2,10 @@ import org.highmed.consent.client.ConsentClient; import org.highmed.consent.client.ConsentClientFactory; -import org.highmed.dsf.bpe.message.*; +import org.highmed.dsf.bpe.message.SendMedicRequestMultiShare; +import org.highmed.dsf.bpe.message.SendMedicRequestSingleShare; +import org.highmed.dsf.bpe.message.SendMultiMedicResultShare; +import org.highmed.dsf.bpe.message.SendSingleMedicResultShare; import org.highmed.dsf.bpe.service.CalculateMultiMedicResult; import org.highmed.dsf.bpe.service.CalculateMultiMedicResultShares; import org.highmed.dsf.bpe.service.CalculateSingleMedicResultShares; diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn index 818c27da..edc177d4 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0inb4ax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0inb4ax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> <bpmn:process id="highmedorg_requestFeasibilityMpc" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:startEvent id="StartEvent" name="start"> <bpmn:outgoing>SequenceFlow_11k77gx</bpmn:outgoing> @@ -62,7 +62,7 @@ </bpmn:timerEventDefinition> </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_1k1a943" sourceRef="sendRequestMultiShareToMedics" targetRef="sendRequestSingleShareToMedics" /> - <bpmn:serviceTask id="Activity_044pdxe" name="calculate multimedic cohort size" camunda:class="org.highmed.dsf.bpe.service.CalculateMultiMedicResult"> + <bpmn:serviceTask id="calculateMultiMedicCohortSize" name="calculate multi medic cohort size" camunda:class="org.highmed.dsf.bpe.service.CalculateMultiMedicResult"> <bpmn:incoming>Flow_161cxwt</bpmn:incoming> <bpmn:outgoing>Flow_08i18td</bpmn:outgoing> </bpmn:serviceTask> @@ -73,13 +73,13 @@ </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="Flow_0w3k4vv" sourceRef="Activity_0lcbiwk" targetRef="Gateway_1cv27w0" /> <bpmn:sequenceFlow id="Flow_0nau6pf" sourceRef="Event_1ih81k1" targetRef="Gateway_1cv27w0" /> - <bpmn:sequenceFlow id="Flow_161cxwt" sourceRef="Gateway_1cv27w0" targetRef="Activity_044pdxe" /> - <bpmn:serviceTask id="Activity_0o1pue0" name="check multimedic cohort size" camunda:class="org.highmed.dsf.bpe.service.CheckMultiMedicResults"> + <bpmn:sequenceFlow id="Flow_161cxwt" sourceRef="Gateway_1cv27w0" targetRef="calculateMultiMedicCohortSize" /> + <bpmn:serviceTask id="checkMultimedicCohortSize" name="check multimedic cohort size" camunda:class="org.highmed.dsf.bpe.service.CheckMultiMedicResults"> <bpmn:incoming>Flow_08i18td</bpmn:incoming> <bpmn:outgoing>Flow_1atjmt6</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_1atjmt6" sourceRef="Activity_0o1pue0" targetRef="Event_123lecz" /> - <bpmn:sequenceFlow id="Flow_08i18td" sourceRef="Activity_044pdxe" targetRef="Activity_0o1pue0" /> + <bpmn:sequenceFlow id="Flow_1atjmt6" sourceRef="checkMultimedicCohortSize" targetRef="Event_123lecz" /> + <bpmn:sequenceFlow id="Flow_08i18td" sourceRef="calculateMultiMedicCohortSize" targetRef="checkMultimedicCohortSize" /> <bpmn:endEvent id="Event_123lecz" name="success"> <bpmn:extensionElements> <camunda:inputOutput> @@ -206,13 +206,13 @@ <bpmndi:BPMNShape id="Event_1xy6pw3_di" bpmnElement="Event_1xy6pw3"> <dc:Bounds x="934" y="129" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_044pdxe_di" bpmnElement="Activity_044pdxe"> + <bpmndi:BPMNShape id="Activity_044pdxe_di" bpmnElement="calculateMultiMedicCohortSize"> <dc:Bounds x="1620" y="105" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_1cv27w0_di" bpmnElement="Gateway_1cv27w0" isMarkerVisible="true"> <dc:Bounds x="1505" y="120" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0o1pue0_di" bpmnElement="Activity_0o1pue0"> + <bpmndi:BPMNShape id="Activity_0o1pue0_di" bpmnElement="checkMultimedicCohortSize"> <dc:Bounds x="1790" y="105" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_0r58kgi_di" bpmnElement="Event_123lecz"> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml index b0987324..7392c1aa 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml @@ -116,7 +116,7 @@ <element id="Task.input:multi-medic-result-share.value[x]"> <path value="Task.input.value[x]" /> <type> - <code value="unsignedInt" /> + <code value="integer" /> </type> </element> </differential> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml index 716b8ea7..7d9efb77 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml @@ -116,7 +116,7 @@ <element id="Task.input:single-medic-result-share.value[x]"> <path value="Task.input.value[x]" /> <type> - <code value="unsignedInt" /> + <code value="integer" /> </type> </element> </differential> diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java new file mode 100644 index 00000000..858fcc75 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java @@ -0,0 +1,54 @@ +package org.highmed.dsf.bpe.mpc; + +import static org.junit.Assert.assertEquals; + +import java.math.BigInteger; +import java.util.List; +import java.util.stream.Collectors; + +import org.highmed.dsf.bpe.variable.QueryResult; +import org.junit.Test; + +public class ArithmeticSharingTest +{ + @Test + public void arithmeticSharingValid() + { + ArithmeticSharing arithmeticSharing = new ArithmeticSharing(3); + + List<ArithmeticShare> shares1 = arithmeticSharing.createShares(15); + List<ArithmeticShare> shares2 = arithmeticSharing.createShares(15); + List<ArithmeticShare> shares3 = arithmeticSharing.createShares(15); + + List<QueryResult> shares1q = shares1.stream() + .map(s -> QueryResult.mpcCountResult("", "", s.getValue().intValueExact())) + .collect(Collectors.toList()); + List<QueryResult> shares2q = shares2.stream() + .map(s -> QueryResult.mpcCountResult("", "", s.getValue().intValueExact())) + .collect(Collectors.toList()); + List<QueryResult> shares3q = shares3.stream() + .map(s -> QueryResult.mpcCountResult("", "", s.getValue().intValueExact())) + .collect(Collectors.toList()); + + List<ArithmeticShare> shares1s = shares1q.stream() + .map(q -> new ArithmeticShare(BigInteger.valueOf(q.getCohortSize()))).collect(Collectors.toList()); + List<ArithmeticShare> shares2s = shares2q.stream() + .map(q -> new ArithmeticShare(BigInteger.valueOf(q.getCohortSize()))).collect(Collectors.toList()); + List<ArithmeticShare> shares3s = shares3q.stream() + .map(q -> new ArithmeticShare(BigInteger.valueOf(q.getCohortSize()))).collect(Collectors.toList()); + + int reconstructed1 = arithmeticSharing + .reconstructSecretToInt(List.of(shares1s.get(0), shares2s.get(0), shares3s.get(0))); + int reconstructed2 = arithmeticSharing + .reconstructSecretToInt(List.of(shares1s.get(1), shares2s.get(1), shares3s.get(1))); + int reconstructed3 = arithmeticSharing + .reconstructSecretToInt(List.of(shares1s.get(2), shares2s.get(2), shares3s.get(2))); + + int total = arithmeticSharing + .reconstructSecretToInt(List.of(new ArithmeticShare(BigInteger.valueOf(reconstructed1)), + new ArithmeticShare(BigInteger.valueOf(reconstructed2)), + new ArithmeticShare(BigInteger.valueOf(reconstructed3)))); + + assertEquals(45, total); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index 63c68fc9..61582bdf 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -29,6 +29,7 @@ import org.highmed.dsf.fhir.validation.ValidationSupportRule; import org.hl7.fhir.r4.model.BooleanType; import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.IntegerType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResourceType; import org.hl7.fhir.r4.model.StringType; @@ -270,12 +271,12 @@ private Task createValidTaskSingleMedicResultShareFeasibilityMpc() String groupId2 = "Group/" + UUID.randomUUID().toString(); ParameterComponent inSingleMedicResult1 = task.addInput(); - inSingleMedicResult1.setValue(new UnsignedIntType(5)).getType().addCoding() + inSingleMedicResult1.setValue(new IntegerType(5)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE); inSingleMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); ParameterComponent inSingleMedicResult2 = task.addInput(); - inSingleMedicResult2.setValue(new UnsignedIntType(10)).getType().addCoding() + inSingleMedicResult2.setValue(new IntegerType(10)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE); inSingleMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); @@ -321,12 +322,12 @@ private Task createValidTaskMultiMedicResultShareFeasibilityMpc() String groupId2 = "Group/" + UUID.randomUUID().toString(); ParameterComponent inSingleMedicResult1 = task.addInput(); - inSingleMedicResult1.setValue(new UnsignedIntType(15)).getType().addCoding() + inSingleMedicResult1.setValue(new IntegerType(15)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE); inSingleMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); ParameterComponent inSingleMedicResult2 = task.addInput(); - inSingleMedicResult2.setValue(new UnsignedIntType(25)).getType().addCoding() + inSingleMedicResult2.setValue(new IntegerType(25)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE); inSingleMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); From 7eb032486467d3ef12b5b99bc78c353215b0d200 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 2 Feb 2022 13:26:25 +0100 Subject: [PATCH 079/125] remove not needed mpc methods, only use unsignedInt in mpc, remove unneeded log statements, rename prime to ringSize --- .../message/SendMultiMedicResultShare.java | 5 +- .../message/SendSingleMedicResultShare.java | 5 +- .../highmed/dsf/bpe/mpc/ArithmeticShare.java | 24 +++--- .../dsf/bpe/mpc/ArithmeticSharing.java | 79 +++++-------------- .../bpe/service/CheckMultiMedicResults.java | 3 - .../service/StoreResultsMultiMedicShare.java | 4 +- .../service/StoreResultsSingleMedicShare.java | 4 +- ...lti-medic-result-share-feasibility-mpc.xml | 2 +- ...gle-medic-result-share-feasibility-mpc.xml | 2 +- .../dsf/bpe/mpc/ArithmeticSharingTest.java | 14 ++-- .../dsf/fhir/profile/TaskProfileTest.java | 24 ++++-- 11 files changed, 61 insertions(+), 105 deletions(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java index c99e86bd..494a6deb 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java @@ -45,13 +45,10 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE private Task.ParameterComponent toInput(QueryResult result) { - ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + ParameterComponent input = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE, result.getCohortSize()); input.addExtension(createCohortIdExtension(result.getCohortId())); - logger.info("Sending MultiMedicShare with cohortId={} and size={}", result.getCohortId(), - result.getCohortSize()); - return input; } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java index 34f45587..a5792366 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java @@ -47,13 +47,10 @@ protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateE private Task.ParameterComponent toInput(QueryResult share) { - ParameterComponent input = getTaskHelper().createInput(CODESYSTEM_HIGHMED_DATA_SHARING, + ParameterComponent input = getTaskHelper().createInputUnsignedInt(CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE, share.getCohortSize()); input.addExtension(createCohortIdExtension(share.getCohortId())); - logger.info("Sending SingleMedicShare with cohortId={} and size={}", share.getCohortId(), - share.getCohortSize()); - return input; } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java index 062d1837..ec50881e 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java @@ -1,31 +1,27 @@ package org.highmed.dsf.bpe.mpc; -import static org.highmed.dsf.bpe.mpc.ArithmeticSharing.DEFAULT_PRIME; +import static org.highmed.dsf.bpe.mpc.ArithmeticSharing.DEFAULT_RING_SIZE; import java.io.Serializable; import java.math.BigInteger; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; - /** * @author Tobias Kussel */ public class ArithmeticShare implements Serializable { private final BigInteger value; - private final BigInteger prime; + private final BigInteger ringSize; public ArithmeticShare(BigInteger value) { - this(value, DEFAULT_PRIME); + this(value, DEFAULT_RING_SIZE); } - @JsonCreator - public ArithmeticShare(@JsonProperty("value") BigInteger value, @JsonProperty("prime") BigInteger prime) + public ArithmeticShare(BigInteger value, BigInteger ringSize) { this.value = value; - this.prime = prime; + this.ringSize = ringSize; } public BigInteger getValue() @@ -33,9 +29,9 @@ public BigInteger getValue() return value; } - public BigInteger getPrime() + public BigInteger getRingSize() { - return prime; + return ringSize; } @Override @@ -46,20 +42,20 @@ public boolean equals(Object o) if (!(o instanceof ArithmeticShare)) return false; ArithmeticShare as = (ArithmeticShare) o; - return as.value.equals(value) && as.prime.equals(prime); + return as.value.equals(value) && as.ringSize.equals(ringSize); } @Override public int hashCode() { int result = value.hashCode(); - result = 31 * result + prime.hashCode(); + result = 31 * result + ringSize.hashCode(); return result; } @Override public String toString() { - return value + " mod " + prime; + return value + " mod " + ringSize; } } \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java index 26aa3fb2..3b16557c 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java @@ -16,33 +16,33 @@ public class ArithmeticSharing implements InitializingBean { private static final int MAX_POWER_FOR_INT = 31; - public static final BigInteger DEFAULT_PRIME = BigInteger.valueOf(2).pow(MAX_POWER_FOR_INT) + public static final BigInteger DEFAULT_RING_SIZE = BigInteger.valueOf(2).pow(MAX_POWER_FOR_INT) .subtract(BigInteger.ONE); private static final SecureRandom RANDOM_GENERATOR = new SecureRandom(); - private final BigInteger prime; + private final BigInteger ringSize; private final int numParties; public ArithmeticSharing(int numParties) { - this(numParties, DEFAULT_PRIME); + this(numParties, DEFAULT_RING_SIZE); } - public ArithmeticSharing(int numParties, BigInteger prime) + public ArithmeticSharing(int numParties, BigInteger ringSize) { - this.prime = prime; this.numParties = numParties; + this.ringSize = ringSize; } @Override public void afterPropertiesSet() throws Exception { - Objects.requireNonNull(prime, "prime"); + Objects.requireNonNull(ringSize, "ringSize"); - if (BigInteger.ZERO.compareTo(prime) >= 0) + if (BigInteger.ZERO.compareTo(ringSize) >= 0) { - throw new IllegalArgumentException("prime < 1"); + throw new IllegalArgumentException("ringSize < 1"); } if (numParties <= 0) @@ -56,19 +56,9 @@ public int getNumParties() return numParties; } - public BigInteger getPrime() + public BigInteger getRingSize() { - return prime; - } - - public List<ArithmeticShare> createShares(double secret, int fractionalBits) - { - return createShares(BigDecimal.valueOf(secret), fractionalBits); - } - - public List<ArithmeticShare> createShares(BigDecimal secret, int fractionalBits) - { - return createShares(convertToFixedPoint(secret, fractionalBits)); + return ringSize; } public List<ArithmeticShare> createShares(int secret) @@ -83,35 +73,21 @@ public List<ArithmeticShare> createShares(BigInteger secret) for (int i = 0; i != numParties - 1; i++) { - shares[i] = getSignedBlind(MAX_POWER_FOR_INT); + shares[i] = getBlind(MAX_POWER_FOR_INT); shares[numParties - 1] = shares[numParties - 1].subtract(shares[i]); } - shares[numParties - 1] = shares[numParties - 1].mod(prime); + shares[numParties - 1] = shares[numParties - 1].mod(ringSize); ArithmeticShare[] result = new ArithmeticShare[numParties]; for (int i = 0; i != numParties; i++) { - result[i] = new ArithmeticShare(shares[i], prime); + result[i] = new ArithmeticShare(shares[i], ringSize); } return Arrays.asList(result); } - public double reconstructToDouble(List<ArithmeticShare> shares, int fractionalBits, RoundingMode roundingMode) - { - return reconstructToBigDecimal(shares, fractionalBits, roundingMode).doubleValue(); - } - - public BigDecimal reconstructToBigDecimal(List<ArithmeticShare> shares, int fractionalBits, - RoundingMode roundingMode) - { - BigDecimal scaleFactor = BigDecimal.valueOf(2).pow(fractionalBits); - BigDecimal result = new BigDecimal(reconstructSecret(shares)); - - return result.divide(scaleFactor, roundingMode); - } - public int reconstructSecretToInt(List<ArithmeticShare> shares) { return reconstructSecret(shares).intValueExact(); @@ -126,41 +102,24 @@ public BigInteger reconstructSecret(List<ArithmeticShare> shares) ArithmeticShare[] sharesArray = shares.toArray(new ArithmeticShare[0]); BigInteger reconstruction = BigInteger.ZERO; - BigInteger first_prime = sharesArray[0].getPrime(); + BigInteger firstRingSize = sharesArray[0].getRingSize(); for (int i = 0; i != sharesArray.length; i++) { - if (!(sharesArray[i].getPrime().equals(first_prime))) + if (!(sharesArray[i].getRingSize().equals(firstRingSize))) { - throw new IllegalArgumentException("Incompatible primes found!"); + throw new IllegalArgumentException("Incompatible ringSizes found!"); } - reconstruction = reconstruction.add(sharesArray[i].getValue()).remainder(sharesArray[i].getPrime()); + reconstruction = reconstruction.add(sharesArray[i].getValue()).remainder(sharesArray[i].getRingSize()); } return reconstruction; } - private BigInteger getSignedBlind(int bitlength) throws IllegalArgumentException + private BigInteger getBlind(int bitlength) throws IllegalArgumentException { if (bitlength < 2) throw new IllegalArgumentException("Bitlength must be larger than 2"); - BigInteger value = new BigInteger(bitlength - 1, RANDOM_GENERATOR); - byte[] randomByte = new byte[1]; - RANDOM_GENERATOR.nextBytes(randomByte); - int signum = Byte.valueOf(randomByte[0]).intValue() & 0x01; - if (signum == 1) - value = value.negate(); - - return value; - } - - private BigInteger convertToFixedPoint(BigDecimal value, int fractionalBits) - { - if (fractionalBits < 0) - throw new IllegalArgumentException("FractionalBits must be positive"); - - BigDecimal scaleFactor = BigDecimal.valueOf(2).pow(fractionalBits); - - return value.multiply(scaleFactor).toBigInteger(); + return new BigInteger(bitlength - 1, RANDOM_GENERATOR); } } \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java index 886bf5a8..98d0eb8a 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java @@ -65,9 +65,6 @@ private void addResultOutput(FinalFeasibilityMpcQueryResult result, Task toWrite CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS, result.getParticipatingMedics()); output2.addExtension(createCohortIdExtension(result.getCohortId())); toWrite.addOutput(output2); - - logger.info("Storing MultiMedicResult with cohortId={} and size={}", result.getCohortId(), - result.getCohortSize()); } private Extension createCohortIdExtension(String cohortId) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsMultiMedicShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsMultiMedicShare.java index 9b97a3b6..0eec7209 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsMultiMedicShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsMultiMedicShare.java @@ -17,9 +17,9 @@ import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; -import org.hl7.fhir.r4.model.IntegerType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.UnsignedIntType; import org.springframework.beans.factory.InitializingBean; public class StoreResultsMultiMedicShare extends AbstractServiceDelegate implements InitializingBean @@ -57,7 +57,7 @@ private List<QueryResult> getResults(Task task) .map(input -> { String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); - int cohortSize = ((IntegerType) input.getValue()).getValue(); + int cohortSize = ((UnsignedIntType) input.getValue()).getValue(); return QueryResult.mpcCountResult(requester.getIdentifier().getValue(), cohortId, cohortSize); }).collect(Collectors.toList()); diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java index 5e41fd6c..4aa02c97 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java @@ -18,9 +18,9 @@ import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; -import org.hl7.fhir.r4.model.IntegerType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.UnsignedIntType; import org.springframework.beans.factory.InitializingBean; public class StoreResultsSingleMedicShare extends AbstractServiceDelegate implements InitializingBean @@ -62,7 +62,7 @@ private QueryResult toQueryResultShare(Reference requester, Task.ParameterCompon { String cohortId = ((Reference) input.getExtension().get(0).getValue()).getReference(); String organizationIdentifier = requester.getIdentifier().getValue(); - int shareSize = ((IntegerType) input.getValue()).getValue(); + int shareSize = ((UnsignedIntType) input.getValue()).getValue(); return QueryResult.mpcCountResult(organizationIdentifier, cohortId, shareSize); } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml index 7392c1aa..b0987324 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml @@ -116,7 +116,7 @@ <element id="Task.input:multi-medic-result-share.value[x]"> <path value="Task.input.value[x]" /> <type> - <code value="integer" /> + <code value="unsignedInt" /> </type> </element> </differential> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml index 7d9efb77..716b8ea7 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml @@ -116,7 +116,7 @@ <element id="Task.input:single-medic-result-share.value[x]"> <path value="Task.input.value[x]" /> <type> - <code value="integer" /> + <code value="unsignedInt" /> </type> </element> </differential> diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java index 858fcc75..077a7631 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java @@ -16,9 +16,9 @@ public void arithmeticSharingValid() { ArithmeticSharing arithmeticSharing = new ArithmeticSharing(3); - List<ArithmeticShare> shares1 = arithmeticSharing.createShares(15); - List<ArithmeticShare> shares2 = arithmeticSharing.createShares(15); - List<ArithmeticShare> shares3 = arithmeticSharing.createShares(15); + List<ArithmeticShare> shares1 = arithmeticSharing.createShares(20); + List<ArithmeticShare> shares2 = arithmeticSharing.createShares(30); + List<ArithmeticShare> shares3 = arithmeticSharing.createShares(50); List<QueryResult> shares1q = shares1.stream() .map(s -> QueryResult.mpcCountResult("", "", s.getValue().intValueExact())) @@ -38,17 +38,17 @@ public void arithmeticSharingValid() .map(q -> new ArithmeticShare(BigInteger.valueOf(q.getCohortSize()))).collect(Collectors.toList()); int reconstructed1 = arithmeticSharing - .reconstructSecretToInt(List.of(shares1s.get(0), shares2s.get(0), shares3s.get(0))); + .reconstructSecretToInt(List.of(shares1s.get(0), shares2s.get(1), shares3s.get(2))); int reconstructed2 = arithmeticSharing - .reconstructSecretToInt(List.of(shares1s.get(1), shares2s.get(1), shares3s.get(1))); + .reconstructSecretToInt(List.of(shares1s.get(1), shares2s.get(2), shares3s.get(0))); int reconstructed3 = arithmeticSharing - .reconstructSecretToInt(List.of(shares1s.get(2), shares2s.get(2), shares3s.get(2))); + .reconstructSecretToInt(List.of(shares1s.get(2), shares2s.get(0), shares3s.get(1))); int total = arithmeticSharing .reconstructSecretToInt(List.of(new ArithmeticShare(BigInteger.valueOf(reconstructed1)), new ArithmeticShare(BigInteger.valueOf(reconstructed2)), new ArithmeticShare(BigInteger.valueOf(reconstructed3)))); - assertEquals(45, total); + assertEquals(100, total); } } diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index 61582bdf..c16956c7 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -14,9 +14,20 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDICS; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_COUNT_RESULT; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE; -import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.*; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_SHARE_FEASIBILITY_MPC; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_MULTI_MEDIC_RESULT_SHARE_FEASIBILITY_MPC_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_SHARE_FEASIBILITY_MPC; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_SHARE_FEASIBILITY_MPC_MESSAGE_NAME; import static org.highmed.dsf.bpe.FeasibilityMpcProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; @@ -29,7 +40,6 @@ import org.highmed.dsf.fhir.validation.ValidationSupportRule; import org.hl7.fhir.r4.model.BooleanType; import org.hl7.fhir.r4.model.Identifier; -import org.hl7.fhir.r4.model.IntegerType; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResourceType; import org.hl7.fhir.r4.model.StringType; @@ -271,12 +281,12 @@ private Task createValidTaskSingleMedicResultShareFeasibilityMpc() String groupId2 = "Group/" + UUID.randomUUID().toString(); ParameterComponent inSingleMedicResult1 = task.addInput(); - inSingleMedicResult1.setValue(new IntegerType(5)).getType().addCoding() + inSingleMedicResult1.setValue(new UnsignedIntType(5)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE); inSingleMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); ParameterComponent inSingleMedicResult2 = task.addInput(); - inSingleMedicResult2.setValue(new IntegerType(10)).getType().addCoding() + inSingleMedicResult2.setValue(new UnsignedIntType(10)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE); inSingleMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); @@ -322,12 +332,12 @@ private Task createValidTaskMultiMedicResultShareFeasibilityMpc() String groupId2 = "Group/" + UUID.randomUUID().toString(); ParameterComponent inSingleMedicResult1 = task.addInput(); - inSingleMedicResult1.setValue(new IntegerType(15)).getType().addCoding() + inSingleMedicResult1.setValue(new UnsignedIntType(15)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE); inSingleMedicResult1.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId1)); ParameterComponent inSingleMedicResult2 = task.addInput(); - inSingleMedicResult2.setValue(new IntegerType(25)).getType().addCoding() + inSingleMedicResult2.setValue(new UnsignedIntType(25)).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_DATA_SHARING) .setCode(CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_MULTI_MEDIC_RESULT_SHARE); inSingleMedicResult2.addExtension(EXTENSION_HIGHMED_GROUP_ID, new Reference(groupId2)); From 7ccf0637a4d60c5420b6aee0c6389afc6050992a Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 4 Feb 2022 10:44:23 +0100 Subject: [PATCH 080/125] use whole bitlength for positive vlaues --- .../main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java index 3b16557c..c4b35587 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java @@ -120,6 +120,6 @@ private BigInteger getBlind(int bitlength) throws IllegalArgumentException if (bitlength < 2) throw new IllegalArgumentException("Bitlength must be larger than 2"); - return new BigInteger(bitlength - 1, RANDOM_GENERATOR); + return new BigInteger(bitlength, RANDOM_GENERATOR); } } \ No newline at end of file From 10861eee4d08bb846da6f9a12d049e2528222839 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 4 Feb 2022 11:40:13 +0100 Subject: [PATCH 081/125] remove unneeded imports --- .../main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java index c4b35587..6464b743 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java @@ -1,8 +1,6 @@ package org.highmed.dsf.bpe.mpc; -import java.math.BigDecimal; import java.math.BigInteger; -import java.math.RoundingMode; import java.security.SecureRandom; import java.util.Arrays; import java.util.List; From 71f876c746a3c92fd4884e85d606528cc140c619 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Thu, 17 Feb 2022 17:36:50 +0100 Subject: [PATCH 082/125] some renaimings in bpmn --- ....java => CalculateMultiMedicResultShare.java} | 4 ++-- .../bpe/spring/config/FeasibilityMpcConfig.java | 6 +++--- .../bpe/executeFeasibilityMpcMultiShare.bpmn | 16 ++++++++-------- .../resources/bpe/requestFeasibilityMpc.bpmn | 14 +++++++------- 4 files changed, 20 insertions(+), 20 deletions(-) rename dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/{CalculateMultiMedicResultShares.java => CalculateMultiMedicResultShare.java} (93%) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShare.java similarity index 93% rename from dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShares.java rename to dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShare.java index 79997562..929260db 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShares.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShare.java @@ -26,11 +26,11 @@ import org.highmed.dsf.fhir.variables.Targets; import org.springframework.beans.factory.InitializingBean; -public class CalculateMultiMedicResultShares extends AbstractServiceDelegate implements InitializingBean +public class CalculateMultiMedicResultShare extends AbstractServiceDelegate implements InitializingBean { private final OrganizationProvider organizationProvider; - public CalculateMultiMedicResultShares(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + public CalculateMultiMedicResultShare(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider) { super(clientProvider, taskHelper, readAccessHelper); diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java index 9da6353a..ef9f8880 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java @@ -7,7 +7,7 @@ import org.highmed.dsf.bpe.message.SendMultiMedicResultShare; import org.highmed.dsf.bpe.message.SendSingleMedicResultShare; import org.highmed.dsf.bpe.service.CalculateMultiMedicResult; -import org.highmed.dsf.bpe.service.CalculateMultiMedicResultShares; +import org.highmed.dsf.bpe.service.CalculateMultiMedicResultShare; import org.highmed.dsf.bpe.service.CalculateSingleMedicResultShares; import org.highmed.dsf.bpe.service.CheckFeasibilityMpcResources; import org.highmed.dsf.bpe.service.CheckMultiMedicResults; @@ -115,9 +115,9 @@ public StoreResultsMultiMedicShare storeResultsMultiMedicShare() } @Bean - public CalculateMultiMedicResultShares calculateMulitMedicResultShares() + public CalculateMultiMedicResultShare calculateMulitMedicResultShare() { - return new CalculateMultiMedicResultShares(fhirClientProvider, taskHelper, readAccessHelper, + return new CalculateMultiMedicResultShare(fhirClientProvider, taskHelper, readAccessHelper, organizationProvider); } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn index 3d51f688..d5b205f1 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> <bpmn:process id="highmedorg_executeFeasibilityMpcMultiShare" isExecutable="true" camunda:versionTag="0.6.0"> <bpmn:startEvent id="StartEvent" name="start"> <bpmn:outgoing>Flow_0zwnqdn</bpmn:outgoing> @@ -56,23 +56,23 @@ </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_18n85hs" sourceRef="Activity_11idi2o" targetRef="Gateway_0atmr78" /> <bpmn:sequenceFlow id="Flow_1688meb" sourceRef="Event_1qabwc2" targetRef="Gateway_0atmr78" /> - <bpmn:serviceTask id="Activity_07k3fpm" name="calculate multi medic result shares" camunda:class="org.highmed.dsf.bpe.service.CalculateMultiMedicResultShares"> + <bpmn:serviceTask id="calculateMultiMedicResultShare" name="calculate multi medic result share" camunda:class="org.highmed.dsf.bpe.service.CalculateMultiMedicResultShare"> <bpmn:incoming>Flow_18sujdf</bpmn:incoming> <bpmn:outgoing>Flow_0bm0z7u</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_0bm0z7u" sourceRef="Activity_07k3fpm" targetRef="selectMultiMedicResultShareResponseTarget" /> + <bpmn:sequenceFlow id="Flow_0bm0z7u" sourceRef="calculateMultiMedicResultShare" targetRef="selectMultiMedicResultShareTarget" /> <bpmn:serviceTask id="storeSingleMedicResultShareCorrelationKeys" name="store single medic result share correlation keys" camunda:class="org.highmed.dsf.bpe.service.StoreSingleMedicResultShareCorrelationKeys"> <bpmn:incoming>Flow_0zwnqdn</bpmn:incoming> <bpmn:outgoing>Flow_15s0sha</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="Flow_1p3ixg0" sourceRef="selectMultiMedicResultShareResponseTarget" targetRef="EndEvent" /> - <bpmn:serviceTask id="selectMultiMedicResultShareResponseTarget" name="select multi medic result share response target" camunda:class="org.highmed.dsf.bpe.service.SelectMultiMedicResultShareTarget"> + <bpmn:sequenceFlow id="Flow_1p3ixg0" sourceRef="selectMultiMedicResultShareTarget" targetRef="EndEvent" /> + <bpmn:serviceTask id="selectMultiMedicResultShareTarget" name="select multi medic result share target" camunda:class="org.highmed.dsf.bpe.service.SelectMultiMedicResultShareTarget"> <bpmn:incoming>Flow_0bm0z7u</bpmn:incoming> <bpmn:outgoing>Flow_1p3ixg0</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="Flow_15s0sha" sourceRef="storeSingleMedicResultShareCorrelationKeys" targetRef="Activity_11idi2o" /> <bpmn:sequenceFlow id="Flow_0zwnqdn" sourceRef="StartEvent" targetRef="storeSingleMedicResultShareCorrelationKeys" /> - <bpmn:sequenceFlow id="Flow_18sujdf" sourceRef="Gateway_0atmr78" targetRef="Activity_07k3fpm" /> + <bpmn:sequenceFlow id="Flow_18sujdf" sourceRef="Gateway_0atmr78" targetRef="calculateMultiMedicResultShare" /> </bpmn:process> <bpmn:message id="Message_1yz2a31" name="executeFeasibilityMpcMultiShareMessage" /> <bpmn:message id="Message_1dr71re" name="resultMultiMedicFeasibilityMpcMessage" /> @@ -151,13 +151,13 @@ <bpmndi:BPMNShape id="Gateway_0atmr78_di" bpmnElement="Gateway_0atmr78" isMarkerVisible="true"> <dc:Bounds x="1005" y="122" width="50" height="50" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_07k3fpm_di" bpmnElement="Activity_07k3fpm"> + <bpmndi:BPMNShape id="Activity_07k3fpm_di" bpmnElement="calculateMultiMedicResultShare"> <dc:Bounds x="1110" y="107" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1r2389r_di" bpmnElement="storeSingleMedicResultShareCorrelationKeys"> <dc:Bounds x="260" y="107" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_19ocdmp_di" bpmnElement="selectMultiMedicResultShareResponseTarget"> + <bpmndi:BPMNShape id="Activity_19ocdmp_di" bpmnElement="selectMultiMedicResultShareTarget"> <dc:Bounds x="1280" y="107" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1qabwc2_di" bpmnElement="Event_1qabwc2"> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn index edc177d4..c17ca169 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn @@ -35,11 +35,11 @@ <bpmn:endEvent id="Event_1j6g4x8"> <bpmn:incoming>Flow_13lm9he</bpmn:incoming> </bpmn:endEvent> - <bpmn:serviceTask id="Activity_0289vyo" name="temporarilly store multi medic result share" camunda:class="org.highmed.dsf.bpe.service.StoreResultsMultiMedicShare"> + <bpmn:serviceTask id="temporarillyStoreMultiMedicResultShare" name="temporarilly store multi medic result share" camunda:class="org.highmed.dsf.bpe.service.StoreResultsMultiMedicShare"> <bpmn:incoming>Flow_0j3mv3q</bpmn:incoming> <bpmn:outgoing>Flow_13lm9he</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:receiveTask id="Activity_1jnfv03" name="receive multi medic result share" messageRef="Message_1k57zqd"> + <bpmn:receiveTask id="receiveMultiMedicResultShare" name="receive multi medic result share" messageRef="Message_1k57zqd"> <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="correlationKey">${target.correlationKey}</camunda:inputParameter> @@ -51,9 +51,9 @@ <bpmn:startEvent id="Event_1xy6pw3"> <bpmn:outgoing>Flow_0t3ex93</bpmn:outgoing> </bpmn:startEvent> - <bpmn:sequenceFlow id="Flow_13lm9he" sourceRef="Activity_0289vyo" targetRef="Event_1j6g4x8" /> - <bpmn:sequenceFlow id="Flow_0j3mv3q" sourceRef="Activity_1jnfv03" targetRef="Activity_0289vyo" /> - <bpmn:sequenceFlow id="Flow_0t3ex93" sourceRef="Event_1xy6pw3" targetRef="Activity_1jnfv03" /> + <bpmn:sequenceFlow id="Flow_13lm9he" sourceRef="temporarillyStoreMultiMedicResultShare" targetRef="Event_1j6g4x8" /> + <bpmn:sequenceFlow id="Flow_0j3mv3q" sourceRef="receiveMultiMedicResultShare" targetRef="temporarillyStoreMultiMedicResultShare" /> + <bpmn:sequenceFlow id="Flow_0t3ex93" sourceRef="Event_1xy6pw3" targetRef="receiveMultiMedicResultShare" /> </bpmn:subProcess> <bpmn:boundaryEvent id="Event_1ih81k1" attachedToRef="Activity_0lcbiwk"> <bpmn:outgoing>Flow_0nau6pf</bpmn:outgoing> @@ -197,10 +197,10 @@ <bpmndi:BPMNShape id="Event_1j6g4x8_di" bpmnElement="Event_1j6g4x8"> <dc:Bounds x="1335" y="129" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0289vyo_di" bpmnElement="Activity_0289vyo"> + <bpmndi:BPMNShape id="Activity_0289vyo_di" bpmnElement="temporarillyStoreMultiMedicResultShare"> <dc:Bounds x="1187" y="107" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_1jnfv03_di" bpmnElement="Activity_1jnfv03"> + <bpmndi:BPMNShape id="Activity_1jnfv03_di" bpmnElement="receiveMultiMedicResultShare"> <dc:Bounds x="1024" y="107" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1xy6pw3_di" bpmnElement="Event_1xy6pw3"> From d0543ff4d0517d91ac4d5e4b7df7c2d50de35653 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 18 Feb 2022 09:56:40 +0100 Subject: [PATCH 083/125] rename variables --- .../dsf/bpe/mpc/ArithmeticSharingTest.java | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java index 077a7631..42e84ca3 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java @@ -16,39 +16,39 @@ public void arithmeticSharingValid() { ArithmeticSharing arithmeticSharing = new ArithmeticSharing(3); - List<ArithmeticShare> shares1 = arithmeticSharing.createShares(20); - List<ArithmeticShare> shares2 = arithmeticSharing.createShares(30); - List<ArithmeticShare> shares3 = arithmeticSharing.createShares(50); + List<ArithmeticShare> singleMedicSharesOrg1 = arithmeticSharing.createShares(10); + List<ArithmeticShare> singleMedicSharesOrg2 = arithmeticSharing.createShares(20); + List<ArithmeticShare> singleMedicSharesOrg3 = arithmeticSharing.createShares(30); - List<QueryResult> shares1q = shares1.stream() + List<QueryResult> queryResultsSingleMedicSharesOrg1 = singleMedicSharesOrg1.stream() .map(s -> QueryResult.mpcCountResult("", "", s.getValue().intValueExact())) .collect(Collectors.toList()); - List<QueryResult> shares2q = shares2.stream() + List<QueryResult> queryResultsSingleMedicSharesOrg2 = singleMedicSharesOrg2.stream() .map(s -> QueryResult.mpcCountResult("", "", s.getValue().intValueExact())) .collect(Collectors.toList()); - List<QueryResult> shares3q = shares3.stream() + List<QueryResult> queryResultsSingleMedicSharesOrg3 = singleMedicSharesOrg3.stream() .map(s -> QueryResult.mpcCountResult("", "", s.getValue().intValueExact())) .collect(Collectors.toList()); - List<ArithmeticShare> shares1s = shares1q.stream() + List<ArithmeticShare> reconstrucedSingleMedicSharesOrg1 = queryResultsSingleMedicSharesOrg1.stream() .map(q -> new ArithmeticShare(BigInteger.valueOf(q.getCohortSize()))).collect(Collectors.toList()); - List<ArithmeticShare> shares2s = shares2q.stream() + List<ArithmeticShare> reconstrucedSingleMedicSharesOrg2 = queryResultsSingleMedicSharesOrg2.stream() .map(q -> new ArithmeticShare(BigInteger.valueOf(q.getCohortSize()))).collect(Collectors.toList()); - List<ArithmeticShare> shares3s = shares3q.stream() + List<ArithmeticShare> reconstrucedSingleMedicSharesOrg3 = queryResultsSingleMedicSharesOrg3.stream() .map(q -> new ArithmeticShare(BigInteger.valueOf(q.getCohortSize()))).collect(Collectors.toList()); - int reconstructed1 = arithmeticSharing - .reconstructSecretToInt(List.of(shares1s.get(0), shares2s.get(1), shares3s.get(2))); - int reconstructed2 = arithmeticSharing - .reconstructSecretToInt(List.of(shares1s.get(1), shares2s.get(2), shares3s.get(0))); - int reconstructed3 = arithmeticSharing - .reconstructSecretToInt(List.of(shares1s.get(2), shares2s.get(0), shares3s.get(1))); + int multiMedicShareOrg1 = arithmeticSharing + .reconstructSecretToInt(List.of(reconstrucedSingleMedicSharesOrg1.get(0), reconstrucedSingleMedicSharesOrg2.get(1), reconstrucedSingleMedicSharesOrg3.get(2))); + int multiMedicShareOrg2 = arithmeticSharing + .reconstructSecretToInt(List.of(reconstrucedSingleMedicSharesOrg1.get(1), reconstrucedSingleMedicSharesOrg2.get(2), reconstrucedSingleMedicSharesOrg3.get(0))); + int multiMedicShareOrg3 = arithmeticSharing + .reconstructSecretToInt(List.of(reconstrucedSingleMedicSharesOrg1.get(2), reconstrucedSingleMedicSharesOrg2.get(0), reconstrucedSingleMedicSharesOrg3.get(1))); - int total = arithmeticSharing - .reconstructSecretToInt(List.of(new ArithmeticShare(BigInteger.valueOf(reconstructed1)), - new ArithmeticShare(BigInteger.valueOf(reconstructed2)), - new ArithmeticShare(BigInteger.valueOf(reconstructed3)))); + long total = arithmeticSharing + .reconstructSecretToInt(List.of(new ArithmeticShare(BigInteger.valueOf(multiMedicShareOrg1)), + new ArithmeticShare(BigInteger.valueOf(multiMedicShareOrg2)), + new ArithmeticShare(BigInteger.valueOf(multiMedicShareOrg3)))); - assertEquals(100, total); + assertEquals(60, total); } } From d427c1c5fbafb178164486fe924bc59aca4a35fb Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 18 Feb 2022 10:06:12 +0100 Subject: [PATCH 084/125] format and sort --- .../org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java index 42e84ca3..b6ef092f 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java @@ -38,11 +38,14 @@ public void arithmeticSharingValid() .map(q -> new ArithmeticShare(BigInteger.valueOf(q.getCohortSize()))).collect(Collectors.toList()); int multiMedicShareOrg1 = arithmeticSharing - .reconstructSecretToInt(List.of(reconstrucedSingleMedicSharesOrg1.get(0), reconstrucedSingleMedicSharesOrg2.get(1), reconstrucedSingleMedicSharesOrg3.get(2))); + .reconstructSecretToInt(List.of(reconstrucedSingleMedicSharesOrg1.get(0), + reconstrucedSingleMedicSharesOrg2.get(1), reconstrucedSingleMedicSharesOrg3.get(2))); int multiMedicShareOrg2 = arithmeticSharing - .reconstructSecretToInt(List.of(reconstrucedSingleMedicSharesOrg1.get(1), reconstrucedSingleMedicSharesOrg2.get(2), reconstrucedSingleMedicSharesOrg3.get(0))); + .reconstructSecretToInt(List.of(reconstrucedSingleMedicSharesOrg1.get(1), + reconstrucedSingleMedicSharesOrg2.get(2), reconstrucedSingleMedicSharesOrg3.get(0))); int multiMedicShareOrg3 = arithmeticSharing - .reconstructSecretToInt(List.of(reconstrucedSingleMedicSharesOrg1.get(2), reconstrucedSingleMedicSharesOrg2.get(0), reconstrucedSingleMedicSharesOrg3.get(1))); + .reconstructSecretToInt(List.of(reconstrucedSingleMedicSharesOrg1.get(2), + reconstrucedSingleMedicSharesOrg2.get(0), reconstrucedSingleMedicSharesOrg3.get(1))); long total = arithmeticSharing .reconstructSecretToInt(List.of(new ArithmeticShare(BigInteger.valueOf(multiMedicShareOrg1)), From 7c45cced4e7af27aa8c67611820c1bd2d8d4da59 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 18 Feb 2022 16:22:42 +0100 Subject: [PATCH 085/125] add check for max secret, add test for max secret --- .../CalculateSingleMedicResultShares.java | 18 ++++++++++++++---- .../dsf/bpe/mpc/ArithmeticSharingTest.java | 13 +++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java index 4d12b68d..43a7934f 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java @@ -52,13 +52,23 @@ protected void doExecute(DelegateExecution execution) throws Exception private Stream<QueryResult> toArithmeticSharesForCohortAndOrganization(QueryResult queryResult, Targets targets) { List<Target> organizations = targets.getEntries(); - ArithmeticSharing arithmeticSharing = new ArithmeticSharing(organizations.size()); - List<ArithmeticShare> shares = arithmeticSharing.createShares(queryResult.getCohortSize()); - if (shares.size() != organizations.size()) + int numParties = organizations.size(); + ArithmeticSharing arithmeticSharing = new ArithmeticSharing(numParties); + + int secret = queryResult.getCohortSize(); + int maximalSecret = arithmeticSharing.getRingSize().shiftRight(numParties).intValueExact(); + + if (secret > maximalSecret) + throw new IllegalStateException("Secret > maximalSecret (" + maximalSecret + ") for " + numParties + + " participating organizations"); + + List<ArithmeticShare> shares = arithmeticSharing.createShares(secret); + + if (shares.size() != numParties) throw new IllegalStateException("Number of shares does not match number of targets"); - return IntStream.range(0, shares.size()) + return IntStream.range(0, numParties) .mapToObj(i -> QueryResult.mpcCountResult(organizations.get(i).getTargetOrganizationIdentifierValue(), queryResult.getCohortId(), shares.get(i).getValue().intValueExact())); } diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java index b6ef092f..990500e3 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java @@ -11,6 +11,19 @@ public class ArithmeticSharingTest { + @Test(expected = IllegalStateException.class) + public void testMaxSecret() + { + int numParties = 3; + int secret = 1000000000; + int maximalSecret = new ArithmeticSharing(numParties).getRingSize().shiftRight(numParties).intValueExact(); + + if (secret > maximalSecret) + { + throw new IllegalStateException("Secret to big for numParties"); + } + } + @Test public void arithmeticSharingValid() { From 9e0d6374d8146063f7f359216e69a06f3572a918 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 18 Feb 2022 17:11:11 +0100 Subject: [PATCH 086/125] fix maxSecret calculation --- .../bpe/service/CalculateSingleMedicResultShares.java | 9 +++++---- .../org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java | 5 +++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java index 43a7934f..1accaefd 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java @@ -6,6 +6,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; +import java.math.BigInteger; import java.util.List; import java.util.stream.IntStream; import java.util.stream.Stream; @@ -57,11 +58,11 @@ private Stream<QueryResult> toArithmeticSharesForCohortAndOrganization(QueryResu ArithmeticSharing arithmeticSharing = new ArithmeticSharing(numParties); int secret = queryResult.getCohortSize(); - int maximalSecret = arithmeticSharing.getRingSize().shiftRight(numParties).intValueExact(); + int maxSecret = arithmeticSharing.getRingSize().divide(BigInteger.valueOf(numParties)).intValueExact(); - if (secret > maximalSecret) - throw new IllegalStateException("Secret > maximalSecret (" + maximalSecret + ") for " + numParties - + " participating organizations"); + if (secret > maxSecret) + throw new IllegalStateException( + "Secret > maxSecret (" + maxSecret + ") for " + numParties + " participating organizations"); List<ArithmeticShare> shares = arithmeticSharing.createShares(secret); diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java index 990500e3..0e9ce2cb 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java @@ -16,9 +16,10 @@ public void testMaxSecret() { int numParties = 3; int secret = 1000000000; - int maximalSecret = new ArithmeticSharing(numParties).getRingSize().shiftRight(numParties).intValueExact(); + int maxSecret = new ArithmeticSharing(numParties).getRingSize().divide(BigInteger.valueOf(numParties)) + .intValueExact(); - if (secret > maximalSecret) + if (secret > maxSecret) { throw new IllegalStateException("Secret to big for numParties"); } From 50da32bf43167c307aa03d9198f7b431fdac95dc Mon Sep 17 00:00:00 2001 From: Tobias Kussel <kussel@cbs.tu-darmstadt.de> Date: Tue, 15 Feb 2022 13:42:37 +0100 Subject: [PATCH 087/125] Increase test coverage for ArithmeticSharing --- .../highmed/dsf/bpe/mpc/ArithmeticShare.java | 2 +- .../dsf/bpe/mpc/ArithmeticSharingTest.java | 79 +++++++++++++++++++ 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java index ec50881e..b1fd15cd 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java @@ -58,4 +58,4 @@ public String toString() { return value + " mod " + ringSize; } -} \ No newline at end of file +} diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java index b6ef092f..5d902448 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java @@ -3,6 +3,9 @@ import static org.junit.Assert.assertEquals; import java.math.BigInteger; +import java.security.SecureRandom; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @@ -54,4 +57,80 @@ public void arithmeticSharingValid() assertEquals(60, total); } + + @Test + public void fiftyPartiesAndSecrets() + { + SecureRandom randomGenerator = new SecureRandom(); + + int numParties = 50; + ArithmeticSharing arithmeticSharing = new ArithmeticSharing(numParties); + + int maxSecret = arithmeticSharing.getRingSize().divide(BigInteger.valueOf(numParties)).intValueExact(); + + int[] secrets = new int[numParties]; + List<List<ArithmeticShare>> shares = new ArrayList<>(); + + for (int i = 0; i < numParties; i++) + { + secrets[i] = randomGenerator.nextInt(maxSecret); + List<ArithmeticShare> sharesI = arithmeticSharing.createShares(secrets[i]); + + shares.add(sharesI); + } + + for (int i = 0; i < numParties; i++) + { + assertEquals(secrets[i], arithmeticSharing.reconstructSecretToInt(shares.get(i))); + } + } + + @Test + public void homomorphicAddition() + { + SecureRandom randomGenerator = new SecureRandom(); + + int numParties = 5; + ArithmeticSharing arithmeticSharing = new ArithmeticSharing(numParties); + + int maxSecret = arithmeticSharing.getRingSize().divide(BigInteger.valueOf(numParties)).intValueExact(); + + int[] secrets = new int[numParties]; + for (int i = 0; i < numParties; i++) + { + secrets[i] = randomGenerator.nextInt(maxSecret); + } + + List<ArithmeticShare> shares1 = arithmeticSharing.createShares(secrets[0]); + List<ArithmeticShare> shares2 = arithmeticSharing.createShares(secrets[1]); + List<ArithmeticShare> shares3 = arithmeticSharing.createShares(secrets[2]); + List<ArithmeticShare> shares4 = arithmeticSharing.createShares(secrets[3]); + List<ArithmeticShare> shares5 = arithmeticSharing.createShares(secrets[4]); + + List<Integer> sumShares = new ArrayList<>(); + for (int i = 0; i < numParties; i++) + { + sumShares.add(arithmeticSharing.reconstructSecretToInt( + List.of(shares1.get(i), shares2.get(i), shares3.get(i), shares4.get(i), shares5.get(i)))); + } + + int reconstructedResult = arithmeticSharing.reconstructSecretToInt( + sumShares.stream().map(s -> new ArithmeticShare(BigInteger.valueOf(s))).collect(Collectors.toList())); + + int cleartextResult = Arrays.stream(secrets).sum(); + + assertEquals(reconstructedResult, cleartextResult); + } + + @Test + public void manyManyParties() + { + int secret = Integer.MAX_VALUE - 1; + ArithmeticSharing arithmeticSharing = new ArithmeticSharing(54321); + + List<ArithmeticShare> shares = arithmeticSharing.createShares(secret); + int reconstructed = arithmeticSharing.reconstructSecretToInt(shares); + + assertEquals(secret, reconstructed); + } } From 11d2d5d1ed3237227248a83489bd79fab8c9b0ae Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Thu, 14 Apr 2022 17:58:02 +0200 Subject: [PATCH 088/125] dependency/plugin version upgrades --- pom.xml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index f9671c34..5cb7d3ab 100644 --- a/pom.xml +++ b/pom.xml @@ -109,7 +109,7 @@ <dependency> <groupId>de.hs-heilbronn.mi</groupId> <artifactId>log4j2-utils</artifactId> - <version>0.10.0</version> + <version>0.13.0</version> </dependency> <!-- logging --> @@ -122,7 +122,7 @@ <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> - <version>2.12.4</version> + <version>2.13.2</version> </dependency> <!-- testing --> @@ -147,7 +147,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> - <version>3.8.1</version> + <version>3.10.1</version> <configuration> <source>${compileSource}</source> <target>${compileTarget}</target> @@ -161,7 +161,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> - <version>3.2.0</version> + <version>3.2.2</version> <configuration> <archive> <manifest> @@ -183,7 +183,7 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> - <version>3.2.0</version> + <version>3.3.0</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -193,13 +193,18 @@ <plugin> <groupId>net.revelc.code.formatter</groupId> <artifactId>formatter-maven-plugin</artifactId> - <version>2.16.0</version> + <version>2.18.0</version> </plugin> <plugin> <groupId>net.revelc.code</groupId> <artifactId>impsort-maven-plugin</artifactId> <version>1.6.2</version> </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>buildnumber-maven-plugin</artifactId> + <version>1.4</version> + </plugin> </plugins> </pluginManagement> @@ -207,7 +212,6 @@ <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> - <version>1.4</version> <executions> <execution> <phase>validate</phase> From ea6ce5cefb43885034bc8a0773c032b0d508360c Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Thu, 14 Apr 2022 18:02:06 +0200 Subject: [PATCH 089/125] changed to new #{version} placeholder, integrated #{date} placeholder #closes #34 --- .../DataSharingProcessPluginDefinition.java | 13 ++- .../resources/bpe/computeDataSharing.bpmn | 10 +-- .../resources/bpe/executeDataSharing.bpmn | 6 +- .../resources/bpe/requestDataSharing.bpmn | 10 +-- .../highmed-computeDataSharing.xml | 9 ++- .../highmed-executeDataSharing.xml | 7 +- .../highmed-requestDataSharing.xml | 11 +-- .../fhir/CodeSystem/highmed-data-sharing.xml | 5 +- .../highmed-research-study-data-sharing.xml | 5 +- .../highmed-task-compute-data-sharing.xml | 7 +- .../highmed-task-execute-data-sharing.xml | 7 +- ...ed-task-multi-medic-error-data-sharing.xml | 7 +- ...d-task-multi-medic-result-data-sharing.xml | 7 +- .../highmed-task-request-data-sharing.xml | 7 +- ...-task-single-medic-result-data-sharing.xml | 7 +- .../fhir/ValueSet/highmed-data-sharing.xml | 5 +- .../ActivityDefinitionProfileTest.java | 81 ++++++++----------- .../dsf/fhir/profile/TaskProfileTest.java | 3 +- .../FeasibilityProcessPluginDefinition.java | 13 ++- .../resources/bpe/computeFeasibility.bpmn | 10 +-- .../resources/bpe/executeFeasibility.bpmn | 6 +- .../resources/bpe/requestFeasibility.bpmn | 10 +-- .../highmed-computeFeasibility.xml | 9 ++- .../highmed-executeFeasibility.xml | 7 +- .../highmed-requestFeasibility.xml | 11 +-- .../highmed-task-compute-feasibility.xml | 7 +- .../highmed-task-error-feasibility.xml | 7 +- .../highmed-task-execute-feasibility.xml | 7 +- ...ed-task-multi-medic-result-feasibility.xml | 7 +- .../highmed-task-request-feasibility.xml | 7 +- ...d-task-single-medic-result-feasibility.xml | 7 +- .../ActivityDefinitionProfileTest.java | 81 ++++++++----------- .../dsf/fhir/profile/TaskProfileTest.java | 3 +- .../LocalServicesProcessPluginDefinition.java | 13 ++- .../bpe/localServicesIntegration.bpmn | 2 +- .../highmed-localServicesIntegration.xml | 7 +- ...ighmed-task-local-services-integration.xml | 7 +- .../ActivityDefinitionProfileTest.java | 24 +++--- .../dsf/fhir/profile/TaskProfileTest.java | 3 +- .../dsf/bpe/PingProcessPluginDefinition.java | 13 ++- .../src/main/resources/bpe/ping.bpmn | 6 +- .../src/main/resources/bpe/pong.bpmn | 6 +- .../fhir/ActivityDefinition/highmed-ping.xml | 9 ++- .../fhir/ActivityDefinition/highmed-pong.xml | 7 +- .../StructureDefinition/highmed-task-ping.xml | 7 +- .../StructureDefinition/highmed-task-pong.xml | 7 +- .../highmed-task-start-ping-process.xml | 7 +- .../ActivityDefinitionProfileTest.java | 43 ++++------ .../dsf/fhir/profiles/TaskProfileTest.java | 3 +- ...pdateAllowListProcessPluginDefinition.java | 13 ++- .../main/resources/bpe/downloadAllowList.bpmn | 2 +- .../main/resources/bpe/updateAllowList.bpmn | 2 +- .../highmed-downloadAllowList.xml | 7 +- .../highmed-updateAllowList.xml | 7 +- .../CodeSystem/highmed-update-allow-list.xml | 5 +- .../highmed-task-download-allow-list.xml | 7 +- .../highmed-task-update-allow-list.xml | 7 +- .../ValueSet/highmed-update-allow-list.xml | 5 +- .../ActivityDefinitionProfileTest.java | 43 ++++------ .../dsf/fhir/profile/TaskProfileTest.java | 3 +- ...pdateResourcesProcessPluginDefinition.java | 13 ++- .../resources/bpe/executeUpdateResources.bpmn | 2 +- .../resources/bpe/requestUpdateResources.bpmn | 6 +- .../highmed-executeUpdateResources.xml | 7 +- .../highmed-requestUpdateResources.xml | 7 +- .../CodeSystem/highmed-update-resources.xml | 5 +- .../highmed-task-execute-update-resources.xml | 7 +- .../highmed-task-request-update-resources.xml | 7 +- .../ValueSet/highmed-update-resources.xml | 5 +- .../ActivityDefinitionProfileTest.java | 43 ++++------ .../dsf/fhir/profile/TaskProfileTest.java | 5 +- 71 files changed, 401 insertions(+), 370 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java index f3137336..7160f9cf 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java @@ -1,5 +1,6 @@ package org.highmed.dsf.bpe; +import java.time.LocalDate; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -20,6 +21,7 @@ public class DataSharingProcessPluginDefinition implements ProcessPluginDefinition { public static final String VERSION = "0.6.0"; + public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 4, 14); @Override public String getName() @@ -33,6 +35,12 @@ public String getVersion() return VERSION; } + @Override + public LocalDate getReleaseDate() + { + return RELEASE_DATE; + } + @Override public Stream<String> getBpmnFiles() { @@ -75,7 +83,8 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader "highmedorg_requestDataSharing/" + VERSION, Arrays.asList(aReq, cDS, sTReq, sRSDS, sTResM, sTErrM, vDS)); - return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), - classLoader, resolver, resourcesByProcessKeyAndVersion); + return ResourceProvider.read(VERSION, RELEASE_DATE, + () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, + resourcesByProcessKeyAndVersion); } } diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn index f11bb01d..b7b4d2a2 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/computeDataSharing.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yff9tp" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_computeDataSharing" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_computeDataSharing" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:subProcess id="SubProcess_1gopxt4"> <bpmn:incoming>SequenceFlow_1lfe4wr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0xxpamp</bpmn:outgoing> @@ -41,9 +41,9 @@ <bpmn:endEvent id="EndEventSuccess" name="send results to MeDIC"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestDataSharing/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestDataSharing/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">resultMultiMedicDataSharingMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_0uaqn1r</bpmn:incoming> @@ -82,9 +82,9 @@ <bpmn:endEvent id="EndEventError" name="send error to MeDIC"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestDataSharing/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestDataSharing/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">errorMultiMedicDataSharingMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_1tmnvhl</bpmn:incoming> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn index d39beff3..577d10ca 100755 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/executeDataSharing.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_executeDataSharing" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_executeDataSharing" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckMedicSingleMedicResults"> <bpmn:incoming>Flow_1pzik8k</bpmn:incoming> <bpmn:outgoing>Flow_08925ay</bpmn:outgoing> @@ -23,9 +23,9 @@ <bpmn:endEvent id="EndEventSuccess" name="send results to TTP"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeDataSharing/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeDataSharing/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">resultSingleMedicDataSharingMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_1611vr6</bpmn:incoming> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn index 5273b87b..6d6d1018 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn +++ b/dsf-bpe-process-data-sharing/src/main/resources/bpe/requestDataSharing.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1flneil" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_requestDataSharing" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_requestDataSharing" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:sequenceFlow id="Flow_0dd6nmz" sourceRef="StartEvent" targetRef="downloadResearchStudyResource" /> <bpmn:sequenceFlow id="Flow_06otxko" sourceRef="downloadResearchStudyResource" targetRef="selectRequestTargetsAndGenerateKeys" /> <bpmn:startEvent id="StartEvent" name="start"> @@ -15,9 +15,9 @@ <bpmn:sendTask id="sendRequestToMedics" name="send request to medics" camunda:class="org.highmed.dsf.bpe.message.SendMedicRequest"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeDataSharing/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeDataSharing/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">executeDataSharingMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_18ie7l6</bpmn:incoming> @@ -66,9 +66,9 @@ <bpmn:intermediateThrowEvent id="sendCorreltationKeysToTTP" name="send correlation keys to TTP"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeDataSharing/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeDataSharing/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">computeDataSharingMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_0cx3xe1</bpmn:incoming> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml index 7b270fdd..19c6cc5d 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml @@ -10,7 +10,7 @@ <valueString value="computeDataSharingMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -58,7 +58,7 @@ <valueString value="resultSingleMedicDataSharingMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -103,14 +103,15 @@ </extension> <url value="http://highmed.org/bpe/Process/computeDataSharing" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="ComputeDataSharing" /> <title value="Compute Data Sharing" /> <subtitle value="Process to compute a data sharing result" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml index ee1991d4..0667ba3a 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml @@ -10,7 +10,7 @@ <valueString value="executeDataSharingMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -75,14 +75,15 @@ </extension> <url value="http://highmed.org/bpe/Process/executeDataSharing" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="ExecuteDataSharing" /> <title value="Execute Data Sharing" /> <subtitle value="Process to execute a data sharing query" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml index 1c6f26d0..998f885b 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml @@ -10,7 +10,7 @@ <valueString value="requestDataSharingMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-request-data-sharing|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-request-data-sharing|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -58,7 +58,7 @@ <valueString value="resultMultiMedicDataSharingMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -106,7 +106,7 @@ <valueString value="errorMultiMedicDataSharingMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -151,14 +151,15 @@ </extension> <url value="http://highmed.org/bpe/Process/requestDataSharing" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="RequestDataSharing" /> <title value="Request Data Sharing" /> <subtitle value="Process to request data sharing" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml index 8be4cade..c43a1f12 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/CodeSystem/highmed-data-sharing.xml @@ -7,13 +7,14 @@ </meta> <url value="http://highmed.org/fhir/CodeSystem/data-sharing"/> <!-- version managed by bpe --> - <version value="${version}"/> + <version value="#{version}"/> <name value="HiGHmed_Data_Sharing"/> <title value="HiGHmed Data Sharing"/> <!-- status managed by bpe --> <status value="unknown"/> <experimental value="false"/> - <date value="2021-08-24"/> + <!-- date managed by bpe --> + <date value="#{date}"/> <publisher value="HiGHmed"/> <description value="CodeSystem with standard values for HiGhmed data sharing processes"/> <caseSensitive value="true"/> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml index 87970a96..1f8b8470 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-research-study-data-sharing.xml @@ -7,11 +7,12 @@ </tag> </meta> <url value="http://highmed.org/fhir/StructureDefinition/research-study-data-sharing" /> - <version value="${version}" /> + <version value="#{version}" /> <name value="ResearchStudyDataSharing" /> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml index 516f1134..82c9f854 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-compute-data-sharing.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskComputeDataSharing" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/computeDataSharing/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/computeDataSharing/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml index 89055a75..10addc27 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-execute-data-sharing.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskExecuteDataSharing" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/executeDataSharing/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/executeDataSharing/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml index a13196f9..697acc73 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml @@ -8,12 +8,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-data-sharing" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskMultiMedicErrorDataSharing" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -23,7 +24,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml index 52d4a7d3..bed845b8 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-data-sharing" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskMultiMedicResultDataSharing" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml index f9728bf1..fb5387f4 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-request-data-sharing.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-request-data-sharing" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskRequestDataSharing" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/requestDataSharing/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml index b13942f9..e089d280 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-single-medic-result-data-sharing" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskSingleMedicResultDataSharing" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/computeDataSharing/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/computeDataSharing/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml index 8992686f..c02879f1 100644 --- a/dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml +++ b/dsf-bpe-process-data-sharing/src/main/resources/fhir/ValueSet/highmed-data-sharing.xml @@ -7,13 +7,14 @@ </meta> <url value="http://highmed.org/fhir/ValueSet/data-sharing"/> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="HiGHmed_Data_Sharing"/> <title value="HiGHmed Data Sharing"/> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false"/> - <date value="2021-08-24"/> + <!-- date managed by bpe --> + <date value="#{date}"/> <publisher value="HiGHmed"/> <description value="ValueSet with standard values for HiGhmed data sharing processes"/> <immutable value="true"/> diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java index 35187d2d..629fdeac 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java @@ -1,11 +1,10 @@ package org.highmed.dsf.fhir.profile; +import static org.highmed.dsf.bpe.DataSharingProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.DataSharingProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.io.InputStream; -import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; @@ -28,7 +27,7 @@ public class ActivityDefinitionProfileTest private static final Logger logger = LoggerFactory.getLogger(ActivityDefinitionProfileTest.class); @ClassRule - public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-activity-definition-0.5.0.xml", "highmed-extension-process-authorization-0.5.0.xml", "highmed-extension-process-authorization-consortium-role-0.5.0.xml", "highmed-extension-process-authorization-organization-0.5.0.xml", @@ -50,67 +49,53 @@ public class ActivityDefinitionProfileTest @Test public void testComputeFeasibilityValid() throws Exception { - try (InputStream in = Files - .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml"))) + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-computeDataSharing.xml")); + + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); - - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); - - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - - assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> - { - System.err.println("Org: " + orgIdentifier); - return true; - }, role -> - { - System.err.println("Role:" + role); - return true; - })); - } + System.err.println("Org: " + orgIdentifier); + return true; + }, role -> + { + System.err.println("Role:" + role); + return true; + })); } @Test public void testExecuteFeasibilityValid() throws Exception { - try (InputStream in = Files - .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml"))) - { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeDataSharing.xml")); - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - assertTrue( - processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - } + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); } @Test public void testRequestFeasibilityValid() throws Exception { - try (InputStream in = Files - .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml"))) - { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-requestDataSharing.xml")); - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - assertTrue( - processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - } + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); } } \ No newline at end of file diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index f0544f61..6be6c921 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -34,6 +34,7 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_DATA_SHARING_MESSAGE_NAME; +import static org.highmed.dsf.bpe.DataSharingProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.DataSharingProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; @@ -71,7 +72,7 @@ public class TaskProfileTest private static final Logger logger = LoggerFactory.getLogger(TaskProfileTest.class); @ClassRule - public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-group-0.5.0.xml", "highmed-extension-group-id-0.5.0.xml", "highmed-research-study-0.5.0.xml", "highmed-research-study-data-sharing.xml", "highmed-task-request-data-sharing.xml", diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java index 8d48387d..bfda306e 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java @@ -1,5 +1,6 @@ package org.highmed.dsf.bpe; +import java.time.LocalDate; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -21,6 +22,7 @@ public class FeasibilityProcessPluginDefinition implements ProcessPluginDefinition { public static final String VERSION = "0.6.0"; + public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 4, 14); private static final String DEPENDENCY_DATA_SHARING_VERSION = "0.6.0"; private static final String DEPENDENCY_DATA_SHARING_NAME_AND_VERSION = "dsf-bpe-process-data-sharing-0.6.0"; @@ -37,6 +39,12 @@ public String getVersion() return VERSION; } + @Override + public LocalDate getReleaseDate() + { + return RELEASE_DATE; + } + @Override public Stream<String> getBpmnFiles() { @@ -83,7 +91,8 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader "highmedorg_executeFeasibility/" + VERSION, Arrays.asList(aExe, cDS, sTExe, vDS), "highmedorg_requestFeasibility/" + VERSION, Arrays.asList(aReq, cDS, sTReq, sTResM, sTErr, vDS)); - return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), - classLoader, resolver, resourcesByProcessKeyAndVersion); + return ResourceProvider.read(VERSION, RELEASE_DATE, + () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, + resourcesByProcessKeyAndVersion); } } diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn index f3dd3b5e..15001ec2 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn +++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/computeFeasibility.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yff9tp" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_computeFeasibility" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_computeFeasibility" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:subProcess id="SubProcess_1gopxt4"> <bpmn:incoming>SequenceFlow_1lfe4wr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0xxpamp</bpmn:outgoing> @@ -45,9 +45,9 @@ <bpmn:endEvent id="EndEventSuccess" name="send final results to leading MeDIC"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibility/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibility/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">resultMultiMedicFeasibilityMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-feasibility|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-feasibility|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_1r6dq8y</bpmn:incoming> @@ -96,9 +96,9 @@ <bpmn:endEvent id="EndEventError" name="send error to leading MeDIC"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibility/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibility/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">errorMultiMedicFeasibilityMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-feasibility|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-feasibility|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_1tmnvhl</bpmn:incoming> diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn index 4c556084..d1d58a32 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn +++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/executeFeasibility.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_executeFeasibility" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_executeFeasibility" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResults"> <bpmn:incoming>SequenceFlow_0q803rh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> @@ -24,9 +24,9 @@ <bpmn:endEvent id="EndEvent" name="send results to TTP"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeFeasibility/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeFeasibility/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">resultSingleMedicFeasibilityMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0ascyjc</bpmn:incoming> diff --git a/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn b/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn index 18130802..c9fe4471 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn +++ b/dsf-bpe-process-feasibility/src/main/resources/bpe/requestFeasibility.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0inb4ax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_requestFeasibility" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_requestFeasibility" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:startEvent id="StartEvent" name="start"> <bpmn:outgoing>SequenceFlow_11k77gx</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_10c2suu" messageRef="Message_1pq9qxp" /> @@ -12,9 +12,9 @@ <bpmn:sendTask id="sendRequestToMedics" name="send request to medics" camunda:class="org.highmed.dsf.bpe.message.SendMedicRequest"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibility/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibility/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">executeFeasibilityMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-feasibility|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-feasibility|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_035oihl</bpmn:incoming> @@ -32,9 +32,9 @@ <bpmn:intermediateThrowEvent id="sendCorreltationKeysToTTP" name="send correlation keys to TTP"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeFeasibility/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/computeFeasibility/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">computeFeasibilityMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-compute-feasibility|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-compute-feasibility|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0b5s4ef</bpmn:incoming> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml index a9c664cd..78a0e027 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml @@ -10,7 +10,7 @@ <valueString value="computeFeasibilityMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-compute-feasibility|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-compute-feasibility|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -58,7 +58,7 @@ <valueString value="resultSingleMedicFeasibilityMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -103,14 +103,15 @@ </extension> <url value="http://highmed.org/bpe/Process/computeFeasibility" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="ComputeFeasibility" /> <title value="Compute Feasibility" /> <subtitle value="Process to compute feasibility result" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml index 974932a3..506fd2cd 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml @@ -10,7 +10,7 @@ <valueString value="executeFeasibilityMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -75,14 +75,15 @@ </extension> <url value="http://highmed.org/bpe/Process/executeFeasibility" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="ExecuteFeasibility" /> <title value="Execute a Feasibility" /> <subtitle value="Process to execute a feasibility query" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml index c367973d..3307bdda 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml @@ -10,7 +10,7 @@ <valueString value="requestFeasibilityMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-request-feasibility|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-request-feasibility|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -58,7 +58,7 @@ <valueString value="resultMultiMedicFeasibilityMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-feasibility|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-feasibility|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -106,7 +106,7 @@ <valueString value="errorMultiMedicFeasibilityMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-feasibility|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-feasibility|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -151,14 +151,15 @@ </extension> <url value="http://highmed.org/bpe/Process/requestFeasibility" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="RequestFeasibility" /> <title value="Request feasibility" /> <subtitle value="Feasibility Request Process" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-compute-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-compute-feasibility.xml index 6cf2b575..838e2802 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-compute-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-compute-feasibility.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-compute-feasibility" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskComputeFeasibility" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/computeFeasibility/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/computeFeasibility/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-error-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-error-feasibility.xml index a225592d..6fc4694e 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-error-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-error-feasibility.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-error-feasibility" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskErrorFeasibility" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/requestFeasibility/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/requestFeasibility/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility.xml index 1bbe5fca..0f10b3ac 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskExecuteFeasibility" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/executeFeasibility/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/executeFeasibility/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml index 44d1bd93..96515028 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-feasibility" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskMultiMedicResultFeasibility" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/requestFeasibility/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/requestFeasibility/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml index 5bd05576..f32ef12b 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-request-feasibility" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskRequestFeasibility" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/requestFeasibility/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/requestFeasibility/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml index 9eccad8b..873432dd 100644 --- a/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml +++ b/dsf-bpe-process-feasibility/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-single-medic-result-feasibility" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskSingleMedicResultFeasibility" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/computeFeasibility/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/computeFeasibility/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java index e12cd5bc..e4e43c74 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java @@ -1,11 +1,10 @@ package org.highmed.dsf.fhir.profile; +import static org.highmed.dsf.bpe.FeasibilityProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.FeasibilityProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.io.InputStream; -import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; @@ -28,7 +27,7 @@ public class ActivityDefinitionProfileTest private static final Logger logger = LoggerFactory.getLogger(ActivityDefinitionProfileTest.class); @ClassRule - public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-activity-definition-0.5.0.xml", "highmed-extension-process-authorization-0.5.0.xml", "highmed-extension-process-authorization-consortium-role-0.5.0.xml", "highmed-extension-process-authorization-organization-0.5.0.xml", @@ -50,67 +49,53 @@ public class ActivityDefinitionProfileTest @Test public void testComputeFeasibilityValid() throws Exception { - try (InputStream in = Files - .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml"))) + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-computeFeasibility.xml")); + + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); - - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); - - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - - assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> - { - System.err.println("Org: " + orgIdentifier); - return true; - }, role -> - { - System.err.println("Role:" + role); - return true; - })); - } + System.err.println("Org: " + orgIdentifier); + return true; + }, role -> + { + System.err.println("Role:" + role); + return true; + })); } @Test public void testExecuteFeasibilityValid() throws Exception { - try (InputStream in = Files - .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml"))) - { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibility.xml")); - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - assertTrue( - processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - } + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); } @Test public void testRequestFeasibilityValid() throws Exception { - try (InputStream in = Files - .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml"))) - { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibility.xml")); - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - assertTrue( - processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - } + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); } } \ No newline at end of file diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index 44f26549..ac64270f 100644 --- a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -33,6 +33,7 @@ import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_FEASIBILITY; import static org.highmed.dsf.bpe.ConstantsFeasibility.PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_FEASIBILITY_MESSAGE_NAME; +import static org.highmed.dsf.bpe.FeasibilityProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.FeasibilityProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; @@ -69,7 +70,7 @@ public class TaskProfileTest private static final Logger logger = LoggerFactory.getLogger(TaskProfileTest.class); @ClassRule - public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-group-0.5.0.xml", "highmed-extension-group-id-0.5.0.xml", "highmed-research-study-0.5.0.xml", "highmed-task-request-feasibility.xml", "highmed-task-execute-feasibility.xml", diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java index a524e794..a57b7796 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java @@ -1,5 +1,6 @@ package org.highmed.dsf.bpe; +import java.time.LocalDate; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -21,6 +22,7 @@ public class LocalServicesProcessPluginDefinition implements ProcessPluginDefinition { public static final String VERSION = "0.6.0"; + public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 4, 14); private static final String DEPENDENCY_DATA_SHARING_VERSION = "0.6.0"; private static final String DEPENDENCY_DATA_SHARING_NAME_AND_VERSION = "dsf-bpe-process-data-sharing-0.6.0"; @@ -38,6 +40,12 @@ public String getVersion() return VERSION; } + @Override + public LocalDate getReleaseDate() + { + return RELEASE_DATE; + } + @Override public Stream<String> getBpmnFiles() { @@ -73,7 +81,8 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map .of("highmedorg_localServicesIntegration/" + VERSION, Arrays.asList(aL, sTL, cDS, vDS)); - return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), - classLoader, resolver, resourcesByProcessKeyAndVersion); + return ResourceProvider.read(VERSION, RELEASE_DATE, + () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, + resourcesByProcessKeyAndVersion); } } diff --git a/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn b/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn index 3a4b741a..9e64a4b6 100644 --- a/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn +++ b/dsf-bpe-process-local-services/src/main/resources/bpe/localServicesIntegration.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_localServicesIntegration" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_localServicesIntegration" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:serviceTask id="checkResults" name="check results" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResults"> <bpmn:incoming>SequenceFlow_0q803rh</bpmn:incoming> <bpmn:outgoing>SequenceFlow_04ouilq</bpmn:outgoing> diff --git a/dsf-bpe-process-local-services/src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml b/dsf-bpe-process-local-services/src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml index d998a648..621c6a3c 100644 --- a/dsf-bpe-process-local-services/src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml +++ b/dsf-bpe-process-local-services/src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml @@ -10,7 +10,7 @@ <valueString value="localServicesIntegrationMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-local-services-integration|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-local-services-integration|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -55,14 +55,15 @@ </extension> <url value="http://highmed.org/bpe/Process/localServicesIntegration" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="LocalServicesIntegration" /> <title value="Local services integration" /> <subtitle value="Service integration process" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> diff --git a/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml b/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml index cc51d80c..600ea09a 100644 --- a/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml +++ b/dsf-bpe-process-local-services/src/main/resources/fhir/StructureDefinition/highmed-task-local-services-integration.xml @@ -8,12 +8,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-local-services-integration" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskLocalServicesIntegration" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -23,7 +24,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/localServicesIntegration/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/localServicesIntegration/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java index c804f720..a990b3ea 100644 --- a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java +++ b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java @@ -1,11 +1,10 @@ package org.highmed.dsf.fhir.profile; +import static org.highmed.dsf.bpe.LocalServicesProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.LocalServicesProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.io.InputStream; -import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; @@ -28,7 +27,7 @@ public class ActivityDefinitionProfileTest private static final Logger logger = LoggerFactory.getLogger(ActivityDefinitionProfileTest.class); @ClassRule - public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-activity-definition-0.5.0.xml", "highmed-extension-process-authorization-0.5.0.xml", "highmed-extension-process-authorization-consortium-role-0.5.0.xml", "highmed-extension-process-authorization-organization-0.5.0.xml", @@ -50,20 +49,15 @@ public class ActivityDefinitionProfileTest @Test public void testLocalServicesIntegrationValid() throws Exception { - try (InputStream in = Files.newInputStream( - Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml"))) - { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-localServicesIntegration.xml")); - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - assertTrue( - processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - } + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); } } \ No newline at end of file diff --git a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index 214dfebc..8ff4f411 100644 --- a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -12,6 +12,7 @@ import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES; import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsLocalServices.PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.LocalServicesProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.LocalServicesProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; @@ -40,7 +41,7 @@ public class TaskProfileTest private static final Logger logger = LoggerFactory.getLogger(TaskProfileTest.class); @ClassRule - public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-group-0.5.0.xml", "highmed-extension-group-id-0.5.0.xml", "highmed-extension-query-0.5.0.xml", "highmed-task-local-services-integration.xml"), diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java index 0ed0badd..bc6ec58e 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java @@ -1,5 +1,6 @@ package org.highmed.dsf.bpe; +import java.time.LocalDate; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -17,6 +18,7 @@ public class PingProcessPluginDefinition implements ProcessPluginDefinition { public static final String VERSION = "0.6.0"; + public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 4, 14); @Override public String getName() @@ -30,6 +32,12 @@ public String getVersion() return VERSION; } + @Override + public LocalDate getReleaseDate() + { + return RELEASE_DATE; + } + @Override public Stream<String> getBpmnFiles() { @@ -56,7 +64,8 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of("highmedorg_ping/" + VERSION, Arrays.asList(aPing, tPong, tStartPing), "highmedorg_pong/" + VERSION, Arrays.asList(aPong, tPing)); - return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), - classLoader, resolver, resourcesByProcessKeyAndVersion); + return ResourceProvider.read(VERSION, RELEASE_DATE, + () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, + resourcesByProcessKeyAndVersion); } } diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn index fb80d97f..fee083bd 100644 --- a/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn +++ b/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0azvmx1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_ping" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_ping" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:sequenceFlow id="SequenceFlow_0k1j79c" sourceRef="StartEvent_1" targetRef="selectTargets" /> <bpmn:sequenceFlow id="SequenceFlow_05ia6lz" sourceRef="selectTargets" targetRef="sendPing" /> <bpmn:serviceTask id="selectTargets" name="selectTargets" camunda:class="org.highmed.dsf.bpe.service.SelectPingTargets"> @@ -10,9 +10,9 @@ <bpmn:sendTask id="sendPing" name="sendPing" camunda:class="org.highmed.dsf.bpe.message.SendPing"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/pong/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/pong/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">pingMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-ping|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-ping|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_05ia6lz</bpmn:incoming> diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn index 66c68cae..651a63fd 100644 --- a/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn +++ b/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_15v05m6" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_pong" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_pong" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:startEvent id="StartEvent_1"> <bpmn:outgoing>SequenceFlow_07w11cw</bpmn:outgoing> <bpmn:messageEventDefinition messageRef="Message_0u91abp" /> @@ -9,9 +9,9 @@ <bpmn:endEvent id="EndEvent_1ivxrjg"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/ping/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/ping/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">pongMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-pong|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-pong|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1ism9wt</bpmn:incoming> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping.xml index fb074ac7..46f8f47b 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping.xml @@ -10,7 +10,7 @@ <valueString value="startPingProcessMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-start-ping-process|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-start-ping-process|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -30,7 +30,7 @@ <valueString value="pongMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-pong|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-pong|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -47,14 +47,15 @@ </extension> <url value="http://highmed.org/bpe/Process/ping" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="Ping" /> <title value="PING process" /> <subtitle value="Communication Testing Process" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-pong.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-pong.xml index fb6d1ce4..0a08bfee 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-pong.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-pong.xml @@ -10,7 +10,7 @@ <valueString value="pingMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-ping|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-ping|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -27,14 +27,15 @@ </extension> <url value="http://highmed.org/bpe/Process/pong" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="Pong" /> <title value="PONG process" /> <subtitle value="Communication Testing Process" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml index f388c627..ab9fedac 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-ping" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskPing" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/pong/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/pong/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-pong.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-pong.xml index d4084cf4..ab27da19 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-pong.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-pong.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-pong" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskPong" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/ping/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/ping/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml index aebc6cde..557ee67f 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-start-ping-process" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskStartProcess" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/ping/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/ping/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java index 36e45fae..d090f81e 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java @@ -1,11 +1,10 @@ package org.highmed.dsf.fhir.profiles; +import static org.highmed.dsf.bpe.PingProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.PingProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.io.InputStream; -import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; @@ -28,7 +27,7 @@ public class ActivityDefinitionProfileTest private static final Logger logger = LoggerFactory.getLogger(ActivityDefinitionProfileTest.class); @ClassRule - public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-activity-definition-0.5.0.xml", "highmed-extension-process-authorization-0.5.0.xml", "highmed-extension-process-authorization-consortium-role-0.5.0.xml", "highmed-extension-process-authorization-organization-0.5.0.xml", @@ -50,40 +49,30 @@ public class ActivityDefinitionProfileTest @Test public void testPingValid() throws Exception { - try (InputStream in = Files - .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-ping.xml"))) - { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); + ActivityDefinition ad = validationRule + .readActivityDefinition(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-ping.xml")); - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - assertTrue( - processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - } + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); } @Test public void testPongValid() throws Exception { - try (InputStream in = Files - .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-pong.xml"))) - { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); + ActivityDefinition ad = validationRule + .readActivityDefinition(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-pong.xml")); - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - assertTrue( - processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - } + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); } } \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java index a89d86dd..1ad1871d 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java @@ -13,6 +13,7 @@ import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PONG_TASK; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_MESSAGE_NAME; +import static org.highmed.dsf.bpe.PingProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.PingProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; @@ -41,7 +42,7 @@ public class TaskProfileTest private static final Logger logger = LoggerFactory.getLogger(TaskProfileTest.class); @ClassRule - public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-task-start-ping-process.xml", "highmed-task-ping.xml", "highmed-task-pong.xml"), Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml"), diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java index 52bfb05f..c667868c 100644 --- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java +++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java @@ -1,5 +1,6 @@ package org.highmed.dsf.bpe; +import java.time.LocalDate; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -19,6 +20,7 @@ public class UpdateAllowListProcessPluginDefinition implements ProcessPluginDefinition { public static final String VERSION = "0.6.0"; + public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 4, 14); @Override public String getName() @@ -32,6 +34,12 @@ public String getVersion() return VERSION; } + @Override + public LocalDate getReleaseDate() + { + return RELEASE_DATE; + } + @Override public Stream<String> getBpmnFiles() { @@ -59,7 +67,8 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader "highmedorg_downloadAllowList/" + VERSION, Arrays.asList(aDown, c, sDown, v), "highmedorg_updateAllowList/" + VERSION, Arrays.asList(aUp, c, sUp, v)); - return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), - classLoader, resolver, resourcesByProcessKeyAndVersion); + return ResourceProvider.read(VERSION, RELEASE_DATE, + () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, + resourcesByProcessKeyAndVersion); } } diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn index de311db7..9ef3dd42 100644 --- a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn +++ b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/downloadAllowList.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1yb5vw3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_downloadAllowList" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_downloadAllowList" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:sequenceFlow id="SequenceFlow_0bbhq2r" sourceRef="StartEvent_1" targetRef="downloadAllowListTask" /> <bpmn:endEvent id="EndEvent_0xd0x8k"> <bpmn:incoming>SequenceFlow_0oyvmcd</bpmn:incoming> diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn index eae03a8a..f80bc0b7 100644 --- a/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn +++ b/dsf-bpe-process-update-allow-list/src/main/resources/bpe/updateAllowList.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1yb5vw3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_updateAllowList" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_updateAllowList" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:sequenceFlow id="SequenceFlow_0bbhq2r" sourceRef="StartEvent_1" targetRef="updateAllowListTask" /> <bpmn:endEvent id="EndEvent_0xd0x8k"> <bpmn:incoming>SequenceFlow_0oyvmcd</bpmn:incoming> diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-downloadAllowList.xml b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-downloadAllowList.xml index 639af2d6..1b60be2f 100644 --- a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-downloadAllowList.xml +++ b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-downloadAllowList.xml @@ -10,7 +10,7 @@ <valueString value="downloadAllowListMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-download-allow-list|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-download-allow-list|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -27,14 +27,15 @@ </extension> <url value="http://highmed.org/bpe/Process/downloadAllowList" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="DownloadAllowList" /> <title value="Download Allow List" /> <subtitle value="Download Allow List Bundle Process" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-updateAllowList.xml b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-updateAllowList.xml index d1c7cf33..c5dabcc1 100644 --- a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-updateAllowList.xml +++ b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ActivityDefinition/highmed-updateAllowList.xml @@ -10,7 +10,7 @@ <valueString value="updateAllowListMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-update-allow-list|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-update-allow-list|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -39,14 +39,15 @@ </extension> <url value="http://highmed.org/bpe/Process/updateAllowList" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="UpdateAllowList" /> <title value="Update Allow List" /> <subtitle value="Update Allow List Bundle Process" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/CodeSystem/highmed-update-allow-list.xml b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/CodeSystem/highmed-update-allow-list.xml index fbce2f2b..5bc40951 100644 --- a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/CodeSystem/highmed-update-allow-list.xml +++ b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/CodeSystem/highmed-update-allow-list.xml @@ -7,13 +7,14 @@ </meta> <url value="http://highmed.org/fhir/CodeSystem/update-allow-list" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="HiGHmed_Update_Allow_List" /> <title value="HiGHmed Update Allow List" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <description value="CodeSystem with standard values for the processes update and download allow list" /> <caseSensitive value="true" /> diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-download-allow-list.xml b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-download-allow-list.xml index afcb991c..3ee0eb28 100644 --- a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-download-allow-list.xml +++ b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-download-allow-list.xml @@ -8,12 +8,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-download-allow-list" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskDownloadAllowList" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -23,7 +24,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/downloadAllowList/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/downloadAllowList/#{version}" /> </element> <element id="Task.input"> <path value="Task.input" /> diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-update-allow-list.xml b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-update-allow-list.xml index 83f474ba..3c2d0813 100644 --- a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-update-allow-list.xml +++ b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/StructureDefinition/highmed-task-update-allow-list.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-update-allow-list" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskUpdateAllowList" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/updateAllowList/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/updateAllowList/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ValueSet/highmed-update-allow-list.xml b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ValueSet/highmed-update-allow-list.xml index 44450c21..6b3696c2 100644 --- a/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ValueSet/highmed-update-allow-list.xml +++ b/dsf-bpe-process-update-allow-list/src/main/resources/fhir/ValueSet/highmed-update-allow-list.xml @@ -7,13 +7,14 @@ </meta> <url value="http://highmed.org/fhir/ValueSet/update-allow-list" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="HiGHmed_Update_Allow_List" /> <title value="HiGHmed Update Allow List" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <description value="ValueSet with standard values for the process update allow list" /> <immutable value="true" /> diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java index 1d1797f1..6aa85cc8 100644 --- a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java +++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java @@ -1,11 +1,10 @@ package org.highmed.dsf.fhir.profile; +import static org.highmed.dsf.bpe.UpdateAllowListProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.UpdateAllowListProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.io.InputStream; -import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; @@ -28,7 +27,7 @@ public class ActivityDefinitionProfileTest private static final Logger logger = LoggerFactory.getLogger(ActivityDefinitionProfileTest.class); @ClassRule - public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-activity-definition-0.5.0.xml", "highmed-extension-process-authorization-0.5.0.xml", "highmed-extension-process-authorization-consortium-role-0.5.0.xml", "highmed-extension-process-authorization-organization-0.5.0.xml", @@ -50,40 +49,30 @@ public class ActivityDefinitionProfileTest @Test public void testDownloadAllowListValid() throws Exception { - try (InputStream in = Files - .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-downloadAllowList.xml"))) - { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-downloadAllowList.xml")); - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - assertTrue( - processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - } + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); } @Test public void testUpdateAllowListValid() throws Exception { - try (InputStream in = Files - .newInputStream(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-updateAllowList.xml"))) - { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-updateAllowList.xml")); - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - assertTrue( - processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - } + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); } } \ No newline at end of file diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index fef1465d..b689bf4c 100644 --- a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -11,6 +11,7 @@ import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST; import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.UpdateAllowListProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.UpdateAllowListProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; @@ -41,7 +42,7 @@ public class TaskProfileTest private static final Logger logger = LoggerFactory.getLogger(TaskProfileTest.class); @ClassRule - public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-task-update-allow-list.xml", "highmed-task-download-allow-list.xml"), Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java index 9960d61c..b3dcc346 100644 --- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java +++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java @@ -1,5 +1,6 @@ package org.highmed.dsf.bpe; +import java.time.LocalDate; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -19,6 +20,7 @@ public class UpdateResourcesProcessPluginDefinition implements ProcessPluginDefinition { public static final String VERSION = "0.6.0"; + public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 4, 14); @Override public String getName() @@ -32,6 +34,12 @@ public String getVersion() return VERSION; } + @Override + public LocalDate getReleaseDate() + { + return RELEASE_DATE; + } + @Override public Stream<String> getBpmnFiles() { @@ -61,7 +69,8 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader "highmedorg_executeUpdateResources/" + VERSION, Arrays.asList(aExec, c, sExec, v), "highmedorg_requestUpdateResources/" + VERSION, Arrays.asList(aReq, c, sReq, v)); - return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), - classLoader, resolver, resourcesByProcessKeyAndVersion); + return ResourceProvider.read(VERSION, RELEASE_DATE, + () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, + resourcesByProcessKeyAndVersion); } } diff --git a/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn b/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn index 81caaa3d..5b8d0d8b 100644 --- a/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn +++ b/dsf-bpe-process-update-resources/src/main/resources/bpe/executeUpdateResources.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0k0v4i2" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_executeUpdateResources" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_executeUpdateResources" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:startEvent id="StartEvent_1"> <bpmn:outgoing>SequenceFlow_0djh0eg</bpmn:outgoing> <bpmn:messageEventDefinition messageRef="Message_1r6vnvn" /> diff --git a/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn b/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn index c2ad93e7..12831980 100644 --- a/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn +++ b/dsf-bpe-process-update-resources/src/main/resources/bpe/requestUpdateResources.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0os0n0z" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> - <bpmn:process id="highmedorg_requestUpdateResources" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_requestUpdateResources" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:sequenceFlow id="SequenceFlow_1ryplwc" sourceRef="StartEvent_1" targetRef="selectResourceAndTargets" /> <bpmn:sequenceFlow id="SequenceFlow_1u4zxix" sourceRef="selectResourceAndTargets" targetRef="sendRequest" /> <bpmn:endEvent id="EndEvent_1f9cjs7"> @@ -10,9 +10,9 @@ <bpmn:sendTask id="sendRequest" name="sendRequest" camunda:class="org.highmed.dsf.bpe.message.SendRequest"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeUpdateResources/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeUpdateResources/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">executeUpdateResourcesMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-update-resources|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-update-resources|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1u4zxix</bpmn:incoming> diff --git a/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-executeUpdateResources.xml b/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-executeUpdateResources.xml index bdaa2b5f..96c4ca3f 100644 --- a/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-executeUpdateResources.xml +++ b/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-executeUpdateResources.xml @@ -10,7 +10,7 @@ <valueString value="executeUpdateResourcesMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-execute-update-resources|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-execute-update-resources|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -33,14 +33,15 @@ </extension> <url value="http://highmed.org/bpe/Process/executeUpdateResources" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="ExecuteUpdateResources" /> <title value="Execute Update of Resources" /> <subtitle value="Process to Download and Execute FHIR Bundle" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> diff --git a/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-requestUpdateResources.xml b/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-requestUpdateResources.xml index d71a67b2..9cf917f4 100644 --- a/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-requestUpdateResources.xml +++ b/dsf-bpe-process-update-resources/src/main/resources/fhir/ActivityDefinition/highmed-requestUpdateResources.xml @@ -10,7 +10,7 @@ <valueString value="requestUpdateResourcesMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-request-update-resources|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-request-update-resources|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -39,14 +39,15 @@ </extension> <url value="http://highmed.org/bpe/Process/requestUpdateResources" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="RequestUpdateResources" /> <title value="Request Update of Resources" /> <subtitle value="Process to Request a Bundle Download" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> diff --git a/dsf-bpe-process-update-resources/src/main/resources/fhir/CodeSystem/highmed-update-resources.xml b/dsf-bpe-process-update-resources/src/main/resources/fhir/CodeSystem/highmed-update-resources.xml index 6589ed88..3798441e 100644 --- a/dsf-bpe-process-update-resources/src/main/resources/fhir/CodeSystem/highmed-update-resources.xml +++ b/dsf-bpe-process-update-resources/src/main/resources/fhir/CodeSystem/highmed-update-resources.xml @@ -7,13 +7,14 @@ </meta> <url value="http://highmed.org/fhir/CodeSystem/update-resources" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="HiGHmed_Update_Resources" /> <title value="HiGHmed Update Resources" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <description value="CodeSystem with standard values for the process update resources" /> <caseSensitive value="true" /> diff --git a/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-execute-update-resources.xml b/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-execute-update-resources.xml index 276e9aad..fce399be 100644 --- a/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-execute-update-resources.xml +++ b/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-execute-update-resources.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-execute-update-resources" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskExecuteUpdateResources" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/executeUpdateResources/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/executeUpdateResources/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-request-update-resources.xml b/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-request-update-resources.xml index 50b69c78..e8611fb9 100644 --- a/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-request-update-resources.xml +++ b/dsf-bpe-process-update-resources/src/main/resources/fhir/StructureDefinition/highmed-task-request-update-resources.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-request-update-resources" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskRequestUpdateResources" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/requestUpdateResources/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/requestUpdateResources/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-update-resources/src/main/resources/fhir/ValueSet/highmed-update-resources.xml b/dsf-bpe-process-update-resources/src/main/resources/fhir/ValueSet/highmed-update-resources.xml index 6ab0bb9d..f16f7642 100644 --- a/dsf-bpe-process-update-resources/src/main/resources/fhir/ValueSet/highmed-update-resources.xml +++ b/dsf-bpe-process-update-resources/src/main/resources/fhir/ValueSet/highmed-update-resources.xml @@ -7,13 +7,14 @@ </meta> <url value="http://highmed.org/fhir/ValueSet/update-resources" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="HiGHmed_Update_Resources" /> <title value="HiGHmed Update Resources" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <description value="ValueSet with standard values for the process update resources" /> <immutable value="true" /> diff --git a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java index 8c763dfa..d7c77bc6 100644 --- a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java +++ b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java @@ -1,11 +1,10 @@ package org.highmed.dsf.fhir.profile; +import static org.highmed.dsf.bpe.UpdateResourcesProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.UpdateResourcesProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.io.InputStream; -import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; @@ -28,7 +27,7 @@ public class ActivityDefinitionProfileTest private static final Logger logger = LoggerFactory.getLogger(ActivityDefinitionProfileTest.class); @ClassRule - public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-activity-definition-0.5.0.xml", "highmed-extension-process-authorization-0.5.0.xml", "highmed-extension-process-authorization-consortium-role-0.5.0.xml", "highmed-extension-process-authorization-organization-0.5.0.xml", @@ -50,40 +49,30 @@ public class ActivityDefinitionProfileTest @Test public void testExecuteUpdateResourcesValid() throws Exception { - try (InputStream in = Files.newInputStream( - Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeUpdateResources.xml"))) - { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeUpdateResources.xml")); - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - assertTrue( - processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - } + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); } @Test public void testRequestUpdateResourcesValid() throws Exception { - try (InputStream in = Files.newInputStream( - Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-requestUpdateResources.xml"))) - { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-requestUpdateResources.xml")); - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - assertTrue( - processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - } + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); } } \ No newline at end of file diff --git a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index b90a947f..1057c8fc 100644 --- a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -13,6 +13,7 @@ import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES; import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.UpdateResourcesProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.UpdateResourcesProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -52,7 +53,7 @@ public class TaskProfileTest private static final Logger logger = LoggerFactory.getLogger(TaskProfileTest.class); @ClassRule - public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-task-request-update-resources.xml", "highmed-task-execute-update-resources.xml"), Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", @@ -66,7 +67,7 @@ public class TaskProfileTest @Test public void testGenerateSnapshotNotWorkingWithoutBaseSnapshot() throws Exception { - var reader = new StructureDefinitionReader(validationRule.getFhirContext()); + var reader = new StructureDefinitionReader(validationRule.getFhirContext(), VERSION, RELEASE_DATE); StructureDefinition base = reader.readXml("/fhir/StructureDefinition/highmed-task-base-0.5.0.xml"); StructureDefinition differential = reader From 06d4da85fb7a86988bf340cff8c5ecada7c48a08 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 19 Apr 2022 10:34:55 +0200 Subject: [PATCH 090/125] update to dsf 0.6.0 --- ...FeasibilityMpcProcessPluginDefinition.java | 13 +++- .../bpe/executeFeasibilityMpcMultiShare.bpmn | 6 +- .../bpe/executeFeasibilityMpcSingleShare.bpmn | 6 +- .../resources/bpe/requestFeasibilityMpc.bpmn | 14 ++-- ...ighmed-executeFeasibilityMpcMultiShare.xml | 9 +-- ...ghmed-executeFeasibilityMpcSingleShare.xml | 7 +- .../highmed-requestFeasibilityMpc.xml | 9 +-- ...sk-execute-feasibility-mpc-multi-share.xml | 5 +- ...k-execute-feasibility-mpc-single-share.xml | 7 +- ...lti-medic-result-share-feasibility-mpc.xml | 7 +- .../highmed-task-request-feasibility-mpc.xml | 7 +- ...gle-medic-result-share-feasibility-mpc.xml | 7 +- .../ActivityDefinitionProfileTest.java | 65 ++++++++----------- .../dsf/fhir/profile/TaskProfileTest.java | 3 +- 14 files changed, 85 insertions(+), 80 deletions(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java index 2b77d984..facd1733 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java @@ -1,5 +1,6 @@ package org.highmed.dsf.bpe; +import java.time.LocalDate; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -21,6 +22,7 @@ public class FeasibilityMpcProcessPluginDefinition implements ProcessPluginDefinition { public static final String VERSION = "0.6.0"; + public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 4, 14); private static final String DEPENDENCY_DATA_SHARING_VERSION = "0.6.0"; private static final String DEPENDENCY_DATA_SHARING_NAME_AND_VERSION = "dsf-bpe-process-data-sharing-0.6.0"; @@ -37,6 +39,12 @@ public String getVersion() return VERSION; } + @Override + public LocalDate getReleaseDate() + { + return RELEASE_DATE; + } + @Override public Stream<String> getBpmnFiles() { @@ -89,7 +97,8 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader "highmedorg_executeFeasibilityMpcSingleShare/" + VERSION, Arrays.asList(aExeS, cDS, sTExeS, vDS), "highmedorg_requestFeasibilityMpc/" + VERSION, Arrays.asList(aReq, cDS, sTReq, sTResM, vDS)); - return ResourceProvider.read(VERSION, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), - classLoader, resolver, resourcesByProcessKeyAndVersion); + return ResourceProvider.read(VERSION, RELEASE_DATE, + () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, + resourcesByProcessKeyAndVersion); } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn index d5b205f1..1c1b52cb 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcMultiShare.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> - <bpmn:process id="highmedorg_executeFeasibilityMpcMultiShare" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_executeFeasibilityMpcMultiShare" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:startEvent id="StartEvent" name="start"> <bpmn:outgoing>Flow_0zwnqdn</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_0sjtzj6" messageRef="Message_1yz2a31" /> @@ -8,9 +8,9 @@ <bpmn:endEvent id="EndEvent" name="send multi medic result share"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibilityMpc/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibilityMpc/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">resultShareMultiMedicFeasibilityMpcMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-share-feasibility-mpc|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-share-feasibility-mpc|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_1p3ixg0</bpmn:incoming> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn index b947d25b..cfefaec4 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> - <bpmn:process id="highmedorg_executeFeasibilityMpcSingleShare" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_executeFeasibilityMpcSingleShare" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:serviceTask id="checkResults" name="check single medic result shares" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResultShares"> <bpmn:incoming>Flow_08uzidj</bpmn:incoming> <bpmn:outgoing>Flow_0nknzne</bpmn:outgoing> @@ -88,9 +88,9 @@ <bpmn:sendTask id="sendSingleMedicResultShares" name="send single medic result shares" camunda:class="org.highmed.dsf.bpe.message.SendSingleMedicResultShare"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-share-feasibility-mpc|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-single-medic-result-share-feasibility-mpc|#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">resultShareSingleMedicFeasibilityMpcMessage</camunda:inputParameter> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare/#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_0nknzne</bpmn:incoming> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn index c17ca169..30255987 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/requestFeasibilityMpc.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0inb4ax" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> - <bpmn:process id="highmedorg_requestFeasibilityMpc" isExecutable="true" camunda:versionTag="0.6.0"> + <bpmn:process id="highmedorg_requestFeasibilityMpc" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:startEvent id="StartEvent" name="start"> <bpmn:outgoing>SequenceFlow_11k77gx</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_10c2suu" messageRef="Message_1pq9qxp" /> @@ -12,9 +12,9 @@ <bpmn:sendTask id="sendRequestMultiShareToMedics" name="send request multi share to medics" camunda:class="org.highmed.dsf.bpe.message.SendMedicRequestMultiShare"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">executeFeasibilityMpcMultiShareMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-multi-share|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-multi-share|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0b5s4ef</bpmn:incoming> @@ -83,9 +83,9 @@ <bpmn:endEvent id="Event_123lecz" name="success"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibilityMpc/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/requestFeasibilityMpc/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">resultMultiMedicFeasibilityMpcMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-FeasibilityMpc|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-FeasibilityMpc|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_1atjmt6</bpmn:incoming> @@ -93,9 +93,9 @@ <bpmn:sendTask id="sendRequestSingleShareToMedics" name="send request single share to medics" camunda:class="org.highmed.dsf.bpe.message.SendMedicRequestSingleShare"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibilityMpcSingleShare/0.6.0</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibilityMpcSingleShare/#{version}</camunda:inputParameter> <camunda:inputParameter name="messageName">executeFeasibilityMpcSingleShareMessage</camunda:inputParameter> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-single-share|0.6.0</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-single-share|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> <bpmn:incoming>Flow_1k1a943</bpmn:incoming> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml index e2708587..fd15f520 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml @@ -11,7 +11,7 @@ </extension> <extension url="task-profile"> <valueCanonical - value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-multi-share|${version}"/> + value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-multi-share|#{version}"/> </extension> <extension url="requester"> <valueCoding> @@ -82,7 +82,7 @@ <valueString value="resultShareSingleMedicFeasibilityMpcMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-single-medic-result-share-feasibility-mpc|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-single-medic-result-share-feasibility-mpc|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -147,14 +147,15 @@ </extension> <url value="http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare"/> <!-- version managed by bpe --> - <version value="${version}"/> + <version value="#{version}"/> <name value="ExecuteFeasibilityMpcMultiShare"/> <title value="Execute Feasibility Mpc Multi Share"/> <subtitle value="Feasibility Mpc Multi Share Execution Process"/> <!-- status managed by bpe --> <status value="unknown"/> <experimental value="false"/> - <date value="2021-08-24"/> + <!-- date managed by bpe --> + <date value="#{date}"/> <publisher value="HiGHmed"/> <contact> <name value="HiGHmed"/> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml index b5f697f9..11f11dd4 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml @@ -11,7 +11,7 @@ </extension> <extension url="task-profile"> <valueCanonical - value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-single-share|${version}"/> + value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-single-share|#{version}"/> </extension> <extension url="requester"> <valueCoding> @@ -79,14 +79,15 @@ </extension> <url value="http://highmed.org/bpe/Process/executeFeasibilityMpcSingleShare"/> <!-- version managed by bpe --> - <version value="${version}"/> + <version value="#{version}"/> <name value="ExecuteFeasibilityMpcSingleShare"/> <title value="Execute Feasibility Mpc Single Share"/> <subtitle value="Feasibility Mpc Single Share Execution Process"/> <!-- status managed by bpe --> <status value="unknown"/> <experimental value="false"/> - <date value="2021-08-24"/> + <!-- date managed by bpe --> + <date value="#{date}"/> <publisher value="HiGHmed"/> <contact> <name value="HiGHmed"/> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml index 8101e341..c7902926 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml @@ -10,7 +10,7 @@ <valueString value="requestFeasibilityMpcMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-request-feasibility-mpc|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-request-feasibility-mpc|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -58,7 +58,7 @@ <valueString value="resultShareMultiMedicFeasibilityMpcMessage" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-share-feasibility-mpc|${version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-share-feasibility-mpc|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -123,14 +123,15 @@ </extension> <url value="http://highmed.org/bpe/Process/requestFeasibilityMpc" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="RequestFeasibilityMpc" /> <title value="Request Feasibility Mpc" /> <subtitle value="Feasibility Mpc Request Process" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <publisher value="HiGHmed" /> <contact> <name value="HiGHmed" /> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml index 094af2c4..5aea505d 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml @@ -7,11 +7,12 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-multi-share" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskExecuteFeasibilityMpcMultiShare" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> + <!-- date managed by bpe --> <date value="2021-08-24" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-single-share.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-single-share.xml index a87add9f..8a844a20 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-single-share.xml +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-single-share.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-execute-feasibility-mpc-single-share" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskExecuteFeasibilityMpcSingleShare" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/executeFeasibilityMpcSingleShare/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/executeFeasibilityMpcSingleShare/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml index b0987324..cfdd63db 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-multi-medic-result-share-feasibility-mpc" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskMultiMedicResultFeasibilityMpc" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/requestFeasibilityMpc/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/requestFeasibilityMpc/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility-mpc.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility-mpc.xml index cca5aa0c..141433a2 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility-mpc.xml +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-request-feasibility-mpc.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-request-feasibility-mpc" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskRequestFeasibilityMpc" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/requestFeasibilityMpc/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/requestFeasibilityMpc/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml index 716b8ea7..481c1bbf 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml @@ -7,12 +7,13 @@ </meta> <url value="http://highmed.org/fhir/StructureDefinition/task-single-medic-result-share-feasibility-mpc" /> <!-- version managed by bpe --> - <version value="${version}" /> + <version value="#{version}" /> <name value="TaskSingleMedicResultShareFeasibilityMpc" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> - <date value="2021-08-24" /> + <!-- date managed by bpe --> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> @@ -22,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare/${version}" /> + <fixedUri value="http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java index 3749995b..d0f241f2 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/ActivityDefinitionProfileTest.java @@ -1,11 +1,10 @@ package org.highmed.dsf.fhir.profile; +import static org.highmed.dsf.bpe.FeasibilityMpcProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.FeasibilityMpcProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import java.io.InputStream; -import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; @@ -28,7 +27,7 @@ public class ActivityDefinitionProfileTest private static final Logger logger = LoggerFactory.getLogger(ActivityDefinitionProfileTest.class); @ClassRule - public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-activity-definition-0.5.0.xml", "highmed-extension-process-authorization-0.5.0.xml", "highmed-extension-process-authorization-consortium-role-0.5.0.xml", "highmed-extension-process-authorization-organization-0.5.0.xml", @@ -50,60 +49,48 @@ public class ActivityDefinitionProfileTest @Test public void testExecuteFeasibilityMpcMultiShareValid() throws Exception { - try (InputStream in = Files.newInputStream( - Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml"))) - { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml")); - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - assertTrue( - processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - } + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); } @Test public void testExecuteFeasibilityMpcSingleShareValid() throws Exception { - try (InputStream in = Files.newInputStream( - Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml"))) - { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml")); - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - assertTrue( - processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - } } @Test public void testRequestFeasibilityMpcValid() throws Exception { - try (InputStream in = Files.newInputStream( - Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml"))) - { - ActivityDefinition ad = validationRule.getFhirContext().newXmlParser() - .parseResource(ActivityDefinition.class, in); + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml")); + + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); - ValidationResult result = resourceValidator.validate(ad); - ValidationSupportRule.logValidationMessages(logger, result); + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); - assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) - || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - assertTrue( - processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); - } } } \ No newline at end of file diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java index c16956c7..b415f142 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/fhir/profile/TaskProfileTest.java @@ -28,6 +28,7 @@ import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_SHARE_FEASIBILITY_MPC; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_SINGLE_MEDIC_RESULT_SHARE_FEASIBILITY_MPC_MESSAGE_NAME; +import static org.highmed.dsf.bpe.FeasibilityMpcProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.FeasibilityMpcProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; @@ -62,7 +63,7 @@ public class TaskProfileTest private static final Logger logger = LoggerFactory.getLogger(TaskProfileTest.class); @ClassRule - public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, + public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-group-0.5.0.xml", "highmed-extension-group-id-0.5.0.xml", "highmed-research-study-0.5.0.xml", "highmed-task-request-feasibility-mpc.xml", "highmed-task-execute-feasibility-mpc-multi-share.xml", From 81752803bd4fef1396474bba081effbc5fa94dff Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 19 Apr 2022 12:07:55 +0200 Subject: [PATCH 091/125] replace debug log message with warn message, that task is not yet implemented --- .../highmed/dsf/bpe/service/CheckSingleMedicResultShares.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultShares.java index f4949492..67d5637c 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultShares.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultShares.java @@ -21,6 +21,6 @@ public CheckSingleMedicResultShares(FhirWebserviceClientProvider clientProvider, @Override protected void doExecute(DelegateExecution execution) throws Exception { - logger.info("EXECUTING: {}", CheckSingleMedicResultShares.class.getName()); + logger.warn("Checks not yet implemented"); } } From 3c6a8c7d90df725106b3d63c468a8e21e5fb9955 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 19 Apr 2022 15:48:23 +0200 Subject: [PATCH 092/125] adds serialization test --- .../variables/TargetsSerializationTest.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java new file mode 100644 index 00000000..5c8b0ece --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java @@ -0,0 +1,34 @@ +package org.highmed.dsf.variables; + +import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES; +import static org.junit.Assert.assertNotNull; + +import org.highmed.dsf.fhir.variables.Targets; +import org.junit.Test; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class TargetsSerializationTest +{ + @Test + public void serializeDeserializeTargets() throws Exception + { + ObjectMapper objectMapper = new ObjectMapper(); + + String serialized = objectMapper.writeValueAsString(new Targets(null)); + Targets deserialized = objectMapper.readValue(serialized, Targets.class); + + assertNotNull(deserialized); + } + + @Test + public void serializeDeserializeTargets2() throws Exception + { + ObjectMapper objectMapper = new ObjectMapper().configure(FAIL_ON_UNKNOWN_PROPERTIES, false); + + String serialized = objectMapper.writeValueAsString(new Targets(null)); + Targets deserialized = objectMapper.readValue(serialized, Targets.class); + + assertNotNull(deserialized); + } +} From bf898178c13e542dab1bad599b88b0ba1f0fc44d Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 19 Apr 2022 16:25:55 +0200 Subject: [PATCH 093/125] remove not needed test --- .../dsf/variables/TargetsSerializationTest.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java index 5c8b0ece..842096d2 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java @@ -20,15 +20,4 @@ public void serializeDeserializeTargets() throws Exception assertNotNull(deserialized); } - - @Test - public void serializeDeserializeTargets2() throws Exception - { - ObjectMapper objectMapper = new ObjectMapper().configure(FAIL_ON_UNKNOWN_PROPERTIES, false); - - String serialized = objectMapper.writeValueAsString(new Targets(null)); - Targets deserialized = objectMapper.readValue(serialized, Targets.class); - - assertNotNull(deserialized); - } } From f77481e41094e1c69ca2c9e3adf26e4cf2f4f91f Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 19 Apr 2022 16:27:28 +0200 Subject: [PATCH 094/125] remove not needed import --- .../java/org/highmed/dsf/variables/TargetsSerializationTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java index 842096d2..a31fd6fb 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java @@ -1,6 +1,5 @@ package org.highmed.dsf.variables; -import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES; import static org.junit.Assert.assertNotNull; import org.highmed.dsf.fhir.variables.Targets; From 9d897ca1ff485291a5813a55c2233d729242b8ab Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Tue, 19 Apr 2022 18:58:33 +0200 Subject: [PATCH 095/125] renamed test classes --- ...onfigTest.java => BloomFilterConfigSerializationTest.java} | 4 ++-- ...rapperTest.java => SecretKeyWrapperSerializationTest.java} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/{BloomFilterConfigTest.java => BloomFilterConfigSerializationTest.java} (95%) rename dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/{SecretKeyWrapperTest.java => SecretKeyWrapperSerializationTest.java} (94%) diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigTest.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigSerializationTest.java similarity index 95% rename from dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigTest.java rename to dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigSerializationTest.java index 6475a784..35e89b9c 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigTest.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigSerializationTest.java @@ -14,9 +14,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class BloomFilterConfigTest +public class BloomFilterConfigSerializationTest { - private static final Logger logger = LoggerFactory.getLogger(BloomFilterConfigTest.class); + private static final Logger logger = LoggerFactory.getLogger(BloomFilterConfigSerializationTest.class); private static final byte[] b1 = Base64.getDecoder().decode("KLhuuy3lDSmo8A/mcYBBZJ+Xu+ok30qDGM4L0magwyY="); private static final byte[] b2 = Base64.getDecoder().decode("VALdwRisuEsUBIXaqJ01L9lk0jJUSGm5ZBE+Ha5bm8c="); diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/SecretKeyWrapperTest.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/SecretKeyWrapperSerializationTest.java similarity index 94% rename from dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/SecretKeyWrapperTest.java rename to dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/SecretKeyWrapperSerializationTest.java index 974e5166..1b51ce5d 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/SecretKeyWrapperTest.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/SecretKeyWrapperSerializationTest.java @@ -10,9 +10,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; -public class SecretKeyWrapperTest +public class SecretKeyWrapperSerializationTest { - private static final Logger logger = LoggerFactory.getLogger(SecretKeyWrapperTest.class); + private static final Logger logger = LoggerFactory.getLogger(SecretKeyWrapperSerializationTest.class); @Test public void testReadWriteJson() throws Exception From 72341318fb8706a1200831b8a8ba2e1018136076 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Tue, 19 Apr 2022 19:20:33 +0200 Subject: [PATCH 096/125] mods required by ObjectMapper config changes in DSF, additional tests --- .../dsf/bpe/variable/BloomFilterConfig.java | 5 +- .../highmed/dsf/bpe/variable/QueryResult.java | 9 +- .../dsf/bpe/variable/QueryResults.java | 1 + .../dsf/bpe/variable/SecretKeyWrapper.java | 4 +- .../BloomFilterConfigSerializationTest.java | 9 +- .../QueryResultsSerializationTest.java | 91 +++++++++++++++++++ .../SecretKeyWrapperSerializationTest.java | 19 ++-- .../FinalFeasibilityQueryResult.java | 3 + .../FinalFeasibilityQueryResults.java | 1 + ...sibilityQueryResultsSerializationTest.java | 66 ++++++++++++++ 10 files changed, 190 insertions(+), 18 deletions(-) create mode 100644 dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/QueryResultsSerializationTest.java create mode 100644 dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResultsSerializationTest.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java index e4d117cb..b1d35d1f 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/BloomFilterConfig.java @@ -8,7 +8,6 @@ import org.highmed.dsf.fhir.variables.KeySerializer; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; @@ -60,22 +59,24 @@ public BloomFilterConfig(@JsonProperty("permutationSeed") long permutationSeed, this.hmacSha3Key = hmacSha3Key; } + @JsonProperty("permutationSeed") public long getPermutationSeed() { return permutationSeed; } + @JsonProperty("hmacSha2Key") public Key getHmacSha2Key() { return hmacSha2Key; } + @JsonProperty("hmacSha3Key") public Key getHmacSha3Key() { return hmacSha3Key; } - @JsonIgnore public byte[] toBytes() { byte[] bytes = new byte[SEED_LENGTH + HMAC_SHA2_KEY_LENGTH + HMAC_SHA3_KEY_LENGTH]; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java index 9ce52281..a233b001 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java @@ -3,7 +3,6 @@ import org.highmed.openehr.model.structure.ResultSet; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; public class QueryResult @@ -44,44 +43,46 @@ public QueryResult(@JsonProperty("organizationIdentifier") String organizationId this.resultSetUrl = resultSetUrl; } + @JsonProperty("organizationIdentifier") public String getOrganizationIdentifier() { return organizationIdentifier; } + @JsonProperty("cohortId") public String getCohortId() { return cohortId; } + @JsonProperty("cohortSize") public int getCohortSize() { return cohortSize; } + @JsonProperty("resultSet") public ResultSet getResultSet() { return resultSet; } + @JsonProperty("resultSetUrl") public String getResultSetUrl() { return resultSetUrl; } - @JsonIgnore public boolean isCohortSizeResult() { return resultSet == null && resultSetUrl == null; } - @JsonIgnore public boolean isIdResultSetResult() { return resultSet != null && resultSetUrl == null; } - @JsonIgnore public boolean isIdResultSetUrlResult() { return resultSet == null && resultSetUrl != null; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResults.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResults.java index ff3cd0ec..89c11818 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResults.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResults.java @@ -31,6 +31,7 @@ public void addAll(Collection<QueryResult> results) this.results.addAll(results); } + @JsonProperty("results") public List<QueryResult> getResults() { return Collections.unmodifiableList(results); diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java index 25af2797..06b39322 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java @@ -10,7 +10,6 @@ import org.slf4j.LoggerFactory; import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; public class SecretKeyWrapper @@ -49,17 +48,18 @@ private SecretKeyWrapper(@JsonProperty("bytes") byte[] bytes, @JsonProperty("alg this.algorithm = algorithm; } - @JsonIgnore public SecretKey getSecretKey() { return new SecretKeySpec(bytes, algorithm); } + @JsonProperty("algorithm") public String getAlgorithm() { return algorithm; } + @JsonProperty("bytes") public byte[] getBytes() { byte[] key = new byte[bytes.length]; diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigSerializationTest.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigSerializationTest.java index 35e89b9c..4526ca8d 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigSerializationTest.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/BloomFilterConfigSerializationTest.java @@ -8,12 +8,15 @@ import javax.crypto.spec.SecretKeySpec; import org.highmed.dsf.bpe.variable.BloomFilterConfig; +import org.highmed.dsf.fhir.json.ObjectMapperFactory; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.fasterxml.jackson.databind.ObjectMapper; +import ca.uhn.fhir.context.FhirContext; + public class BloomFilterConfigSerializationTest { private static final Logger logger = LoggerFactory.getLogger(BloomFilterConfigSerializationTest.class); @@ -25,16 +28,16 @@ public class BloomFilterConfigSerializationTest @Test public void testReadWriteJson() throws Exception { - ObjectMapper objectMapper = new ObjectMapper(); + ObjectMapper mapper = ObjectMapperFactory.createObjectMapper(FhirContext.forR4()); BloomFilterConfig bfc = new BloomFilterConfig(l, new SecretKeySpec(b1, "HmacSHA256"), new SecretKeySpec(b2, "HmacSHA3-256")); - String value = objectMapper.writeValueAsString(bfc); + String value = mapper.writeValueAsString(bfc); logger.debug("BloomFilterConfig: {}", value); - BloomFilterConfig readBfc = objectMapper.readValue(value, BloomFilterConfig.class); + BloomFilterConfig readBfc = mapper.readValue(value, BloomFilterConfig.class); assertNotNull(readBfc); assertEquals(bfc.getPermutationSeed(), readBfc.getPermutationSeed()); diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/QueryResultsSerializationTest.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/QueryResultsSerializationTest.java new file mode 100644 index 00000000..d26d39f2 --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/QueryResultsSerializationTest.java @@ -0,0 +1,91 @@ +package org.highmed.dsf.bpe.variables; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.UUID; + +import org.highmed.dsf.bpe.variable.QueryResult; +import org.highmed.dsf.bpe.variable.QueryResults; +import org.highmed.dsf.fhir.json.ObjectMapperFactory; +import org.highmed.openehr.model.datatypes.IntegerRowElement; +import org.highmed.openehr.model.datatypes.StringRowElement; +import org.highmed.openehr.model.structure.Column; +import org.highmed.openehr.model.structure.Meta; +import org.highmed.openehr.model.structure.ResultSet; +import org.highmed.openehr.model.structure.RowElement; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import ca.uhn.fhir.context.FhirContext; + +public class QueryResultsSerializationTest +{ + private static final Logger logger = LoggerFactory.getLogger(QueryResultsSerializationTest.class); + + @Test + public void testEmptyQueryResultsSerialization() throws Exception + { + ObjectMapper mapper = ObjectMapperFactory.createObjectMapper(FhirContext.forR4()); + + QueryResults results = new QueryResults(Collections.emptyList()); + + String resultsAsString = mapper.writeValueAsString(results); + assertNotNull(resultsAsString); + + logger.debug("QueryResults (empty): '{}'", resultsAsString); + + QueryResults readResults = mapper.readValue(resultsAsString, QueryResults.class); + assertNotNull(readResults); + assertNotNull(readResults.getResults()); + assertTrue(readResults.getResults().isEmpty()); + } + + @Test + public void testNonEmptyQueryResultsSerialization() throws Exception + { + ObjectMapper mapper = ObjectMapperFactory.createObjectMapper(FhirContext.forR4()); + + QueryResult result = new QueryResult("test.org", UUID.randomUUID().toString(), 1, createResultSet(), + "http://test.com/fhir/Binary/" + UUID.randomUUID().toString()); + QueryResults results = new QueryResults(Collections.singleton(result)); + + String resultsAsString = mapper.writeValueAsString(results); + assertNotNull(resultsAsString); + + logger.debug("QueryResults (non empty): '{}'", resultsAsString); + + QueryResults readResults = mapper.readValue(resultsAsString, QueryResults.class); + assertNotNull(readResults); + assertNotNull(readResults.getResults()); + assertFalse(readResults.getResults().isEmpty()); + assertEquals(1, readResults.getResults().size()); + assertNotNull(readResults.getResults().get(0)); + assertEquals(result.getCohortId(), readResults.getResults().get(0).getCohortId()); + assertEquals(result.getCohortSize(), readResults.getResults().get(0).getCohortSize()); + assertEquals(result.getOrganizationIdentifier(), readResults.getResults().get(0).getOrganizationIdentifier()); + assertEquals(result.getResultSetUrl(), readResults.getResults().get(0).getResultSetUrl()); + assertNotNull(readResults.getResults().get(0).getResultSet()); + assertEquals(result.getResultSet().getName(), readResults.getResults().get(0).getResultSet().getName()); + assertEquals(result.getResultSet().getQuery(), readResults.getResults().get(0).getResultSet().getQuery()); + // Not testing every ResultSet property, see ResultSet serialization tests + } + + private ResultSet createResultSet() + { + Meta meta = new Meta("href", "type", "schemaVersion", "created", "generator", "executedAql"); + List<Column> columns = Arrays.asList(new Column("name1", "path1"), new Column("name2", "path2")); + List<List<RowElement>> rows = Arrays.asList(Arrays.asList(new IntegerRowElement(123)), + Arrays.asList(new StringRowElement("456"))); + ResultSet resultSet = new ResultSet(meta, "name", "query", columns, rows); + return resultSet; + } +} diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/SecretKeyWrapperSerializationTest.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/SecretKeyWrapperSerializationTest.java index 1b51ce5d..b14d3603 100644 --- a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/SecretKeyWrapperSerializationTest.java +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/variables/SecretKeyWrapperSerializationTest.java @@ -1,8 +1,11 @@ package org.highmed.dsf.bpe.variables; -import static org.junit.Assert.*; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import org.highmed.dsf.bpe.variable.SecretKeyWrapper; +import org.highmed.dsf.fhir.json.ObjectMapperFactory; import org.highmed.pseudonymization.crypto.AesGcmUtil; import org.junit.Test; import org.slf4j.Logger; @@ -10,6 +13,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; +import ca.uhn.fhir.context.FhirContext; + public class SecretKeyWrapperSerializationTest { private static final Logger logger = LoggerFactory.getLogger(SecretKeyWrapperSerializationTest.class); @@ -17,15 +22,15 @@ public class SecretKeyWrapperSerializationTest @Test public void testReadWriteJson() throws Exception { - ObjectMapper objectMapper = new ObjectMapper(); + ObjectMapper mapper = ObjectMapperFactory.createObjectMapper(FhirContext.forR4()); SecretKeyWrapper key = SecretKeyWrapper.newAes256Key(); - String value = objectMapper.writeValueAsString(key); + String value = mapper.writeValueAsString(key); logger.debug("SecretKeyWrapper: {}", value); - SecretKeyWrapper readkey = objectMapper.readValue(value, SecretKeyWrapper.class); + SecretKeyWrapper readkey = mapper.readValue(value, SecretKeyWrapper.class); assertNotNull(readkey); assertEquals(key.getAlgorithm(), readkey.getAlgorithm()); @@ -36,17 +41,17 @@ public void testReadWriteJson() throws Exception @Test public void testReadWriteJsonFromBytes() throws Exception { - ObjectMapper objectMapper = new ObjectMapper(); + ObjectMapper mapper = ObjectMapperFactory.createObjectMapper(FhirContext.forR4()); byte[] bytes = AesGcmUtil.generateAES256Key().getEncoded(); SecretKeyWrapper key = SecretKeyWrapper.fromAes256Key(bytes); assertArrayEquals(bytes, key.getBytes()); - String value = objectMapper.writeValueAsString(key); + String value = mapper.writeValueAsString(key); logger.debug("SecretKeyWrapper: {}", value); - SecretKeyWrapper readkey = objectMapper.readValue(value, SecretKeyWrapper.class); + SecretKeyWrapper readkey = mapper.readValue(value, SecretKeyWrapper.class); assertNotNull(readkey); assertEquals(key.getAlgorithm(), readkey.getAlgorithm()); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResult.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResult.java index 9cbd2324..5c82d02f 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResult.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResult.java @@ -18,16 +18,19 @@ public FinalFeasibilityQueryResult(@JsonProperty("cohortId") String cohortId, this.cohortSize = cohortSize; } + @JsonProperty("cohortId") public String getCohortId() { return cohortId; } + @JsonProperty("participatingMedics") public int getParticipatingMedics() { return participatingMedics; } + @JsonProperty("cohortSize") public int getCohortSize() { return cohortSize; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResults.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResults.java index 65f413db..0ba16484 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResults.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResults.java @@ -32,6 +32,7 @@ public void addAll(Collection<FinalFeasibilityQueryResult> results) this.results.addAll(results); } + @JsonProperty("results") public List<FinalFeasibilityQueryResult> getResults() { return Collections.unmodifiableList(results); diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResultsSerializationTest.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResultsSerializationTest.java new file mode 100644 index 00000000..9e691aa2 --- /dev/null +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/variables/FinalFeasibilityQueryResultsSerializationTest.java @@ -0,0 +1,66 @@ +package org.highmed.dsf.bpe.variables; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.Collections; + +import org.highmed.dsf.fhir.json.ObjectMapperFactory; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import ca.uhn.fhir.context.FhirContext; + +public class FinalFeasibilityQueryResultsSerializationTest +{ + private static final Logger logger = LoggerFactory.getLogger(FinalFeasibilityQueryResultsSerializationTest.class); + + @Test + public void testEmptyFinalFeasibilityQueryResultsSerialization() throws Exception + { + ObjectMapper mapper = ObjectMapperFactory.createObjectMapper(FhirContext.forR4()); + + FinalFeasibilityQueryResults results = new FinalFeasibilityQueryResults(Collections.emptyList()); + + String resultsAsString = mapper.writeValueAsString(results); + assertNotNull(resultsAsString); + + logger.debug("FinalFeasibilityQueryResults (empty): '{}'", resultsAsString); + + FinalFeasibilityQueryResults readResults = mapper.readValue(resultsAsString, + FinalFeasibilityQueryResults.class); + assertNotNull(readResults); + assertNotNull(readResults.getResults()); + assertTrue(readResults.getResults().isEmpty()); + } + + @Test + public void testNonEmptyFinalFeasibilityQueryResultsSerialization() throws Exception + { + ObjectMapper mapper = ObjectMapperFactory.createObjectMapper(FhirContext.forR4()); + + FinalFeasibilityQueryResult result = new FinalFeasibilityQueryResult("cohortId", 1, 2); + FinalFeasibilityQueryResults results = new FinalFeasibilityQueryResults(Collections.singleton(result)); + + String resultsAsString = mapper.writeValueAsString(results); + assertNotNull(resultsAsString); + + logger.debug("FinalFeasibilityQueryResults (non empty): '{}'", resultsAsString); + + FinalFeasibilityQueryResults readResults = mapper.readValue(resultsAsString, + FinalFeasibilityQueryResults.class); + assertNotNull(readResults); + assertNotNull(readResults.getResults()); + assertFalse(readResults.getResults().isEmpty()); + assertEquals(1, readResults.getResults().size()); + assertNotNull(readResults.getResults().get(0)); + assertEquals(result.getCohortId(), readResults.getResults().get(0).getCohortId()); + assertEquals(result.getCohortSize(), readResults.getResults().get(0).getCohortSize()); + assertEquals(result.getParticipatingMedics(), readResults.getResults().get(0).getParticipatingMedics()); + } +} From 3cc087641feca88debf09d3fe3f0030d18e8b0a2 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Wed, 20 Apr 2022 09:38:25 +0200 Subject: [PATCH 097/125] adapt to new object mapper --- .../FinalFeasibilityMpcQueryResult.java | 3 + .../FinalFeasibilityMpcQueryResults.java | 1 + ...ilityMpcQueryResultsSerializationTest.java | 67 +++++++++++++++++++ .../variables/TargetsSerializationTest.java | 45 +++++++++++++ .../variables/TargetsSerializationTest.java | 22 ------ 5 files changed, 116 insertions(+), 22 deletions(-) create mode 100644 dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultsSerializationTest.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/variables/TargetsSerializationTest.java delete mode 100644 dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResult.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResult.java index a21e9d53..542436b1 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResult.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResult.java @@ -18,16 +18,19 @@ public FinalFeasibilityMpcQueryResult(@JsonProperty("cohortId") String cohortId, this.cohortSize = cohortSize; } + @JsonProperty("cohortId") public String getCohortId() { return cohortId; } + @JsonProperty("participatingMedics") public int getParticipatingMedics() { return participatingMedics; } + @JsonProperty("cohortSize") public int getCohortSize() { return cohortSize; diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResults.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResults.java index 72ced50e..f086e50b 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResults.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResults.java @@ -32,6 +32,7 @@ public void addAll(Collection<FinalFeasibilityMpcQueryResult> results) this.results.addAll(results); } + @JsonProperty("results") public List<FinalFeasibilityMpcQueryResult> getResults() { return Collections.unmodifiableList(results); diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultsSerializationTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultsSerializationTest.java new file mode 100644 index 00000000..8a3b55b0 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/variables/FinalFeasibilityMpcQueryResultsSerializationTest.java @@ -0,0 +1,67 @@ +package org.highmed.dsf.bpe.variables; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.Collections; + +import org.highmed.dsf.fhir.json.ObjectMapperFactory; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import ca.uhn.fhir.context.FhirContext; + +public class FinalFeasibilityMpcQueryResultsSerializationTest +{ + private static final Logger logger = LoggerFactory + .getLogger(FinalFeasibilityMpcQueryResultsSerializationTest.class); + + @Test + public void testEmptyFinalFeasibilityMpcQueryResultsSerialization() throws Exception + { + ObjectMapper mapper = ObjectMapperFactory.createObjectMapper(FhirContext.forR4()); + + FinalFeasibilityMpcQueryResults results = new FinalFeasibilityMpcQueryResults(Collections.emptyList()); + + String resultsAsString = mapper.writeValueAsString(results); + assertNotNull(resultsAsString); + + logger.debug("FinalFeasibilityMpcQueryResults (empty): '{}'", resultsAsString); + + FinalFeasibilityMpcQueryResults readResults = mapper.readValue(resultsAsString, + FinalFeasibilityMpcQueryResults.class); + assertNotNull(readResults); + assertNotNull(readResults.getResults()); + assertTrue(readResults.getResults().isEmpty()); + } + + @Test + public void testNonEmptyFinalFeasibilityMpcQueryResultsSerialization() throws Exception + { + ObjectMapper mapper = ObjectMapperFactory.createObjectMapper(FhirContext.forR4()); + + FinalFeasibilityMpcQueryResult result = new FinalFeasibilityMpcQueryResult("cohortId", 1, 2); + FinalFeasibilityMpcQueryResults results = new FinalFeasibilityMpcQueryResults(Collections.singleton(result)); + + String resultsAsString = mapper.writeValueAsString(results); + assertNotNull(resultsAsString); + + logger.debug("FinalFeasibilityMpcQueryResults (non empty): '{}'", resultsAsString); + + FinalFeasibilityMpcQueryResults readResults = mapper.readValue(resultsAsString, + FinalFeasibilityMpcQueryResults.class); + assertNotNull(readResults); + assertNotNull(readResults.getResults()); + assertFalse(readResults.getResults().isEmpty()); + assertEquals(1, readResults.getResults().size()); + assertNotNull(readResults.getResults().get(0)); + assertEquals(result.getCohortId(), readResults.getResults().get(0).getCohortId()); + assertEquals(result.getCohortSize(), readResults.getResults().get(0).getCohortSize()); + assertEquals(result.getParticipatingMedics(), readResults.getResults().get(0).getParticipatingMedics()); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/variables/TargetsSerializationTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/variables/TargetsSerializationTest.java new file mode 100644 index 00000000..f5bc973b --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/variables/TargetsSerializationTest.java @@ -0,0 +1,45 @@ +package org.highmed.dsf.bpe.variables; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.List; + +import org.highmed.dsf.fhir.json.ObjectMapperFactory; +import org.highmed.dsf.fhir.variables.Target; +import org.highmed.dsf.fhir.variables.Targets; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import ca.uhn.fhir.context.FhirContext; + +public class TargetsSerializationTest +{ + private static final Logger logger = LoggerFactory.getLogger(TargetsSerializationTest.class); + + @Test + public void serializeDeserializeTargets() throws Exception + { + ObjectMapper objectMapper = ObjectMapperFactory.createObjectMapper(FhirContext.forR4()); + + Target target = Target.createUniDirectionalTarget("identifier", "endpoint"); + Targets targets = new Targets(List.of(target)); + + String serialized = objectMapper.writeValueAsString(targets); + + logger.debug("Targets: '{}'", serialized); + + Targets deserialized = objectMapper.readValue(serialized, Targets.class); + + assertNotNull(deserialized); + assertEquals(1, deserialized.getEntries().size()); + assertNotNull(deserialized.getEntries().get(0)); + assertEquals(deserialized.getEntries().get(0).getTargetOrganizationIdentifierValue(), + target.getTargetOrganizationIdentifierValue()); + assertEquals(deserialized.getEntries().get(0).getTargetEndpointUrl(), target.getTargetEndpointUrl()); + assertEquals(deserialized.getEntries().get(0).getCorrelationKey(), target.getCorrelationKey()); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java deleted file mode 100644 index a31fd6fb..00000000 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/variables/TargetsSerializationTest.java +++ /dev/null @@ -1,22 +0,0 @@ -package org.highmed.dsf.variables; - -import static org.junit.Assert.assertNotNull; - -import org.highmed.dsf.fhir.variables.Targets; -import org.junit.Test; - -import com.fasterxml.jackson.databind.ObjectMapper; - -public class TargetsSerializationTest -{ - @Test - public void serializeDeserializeTargets() throws Exception - { - ObjectMapper objectMapper = new ObjectMapper(); - - String serialized = objectMapper.writeValueAsString(new Targets(null)); - Targets deserialized = objectMapper.readValue(serialized, Targets.class); - - assertNotNull(deserialized); - } -} From a5a555f0719b3b002237f4773127cd38a84caf9c Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 25 Apr 2022 16:03:16 +0200 Subject: [PATCH 098/125] add test-setup to readme --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2084f47b..dc468087 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,11 @@ Prerequisite: Java 11, Maven >= 3.6 ``` mvn clean install (-P copy-to-highmed-dsf-process) - ``` + ``` + +## Executing the Processes +The HiGHmed DSF Wiki includes the section (Manual Integration Testing) [https://github.com/highmed/highmed-dsf/wiki/Build-and-Test-Project#manual-integration-testing-vms-for-docker-registry-3-medics-ttp], with detailed description on how to run the processes in a simulated setup consisting of 3 MeDIC and 1 TTP. Example implementations to start a process can be found in the respective Maven sub-modules under `src/test/java` in the package `org.highmed.dsf.bpe.start`. + ## Implementing new Processes Instructions on how to implement a new process can be found in the HiGHmed DSF Wiki page with the name [Adding a new BPMN Process](https://github.com/highmed/highmed-dsf/wiki/Adding-BPMN-Processes). \ No newline at end of file From 5845c6b636575c55a4fb36a16a51f0b0667cf6da Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 25 Apr 2022 16:05:08 +0200 Subject: [PATCH 099/125] fix wrong link formatting --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dc468087..bc8a0109 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Prerequisite: Java 11, Maven >= 3.6 ``` ## Executing the Processes -The HiGHmed DSF Wiki includes the section (Manual Integration Testing) [https://github.com/highmed/highmed-dsf/wiki/Build-and-Test-Project#manual-integration-testing-vms-for-docker-registry-3-medics-ttp], with detailed description on how to run the processes in a simulated setup consisting of 3 MeDIC and 1 TTP. Example implementations to start a process can be found in the respective Maven sub-modules under `src/test/java` in the package `org.highmed.dsf.bpe.start`. +The HiGHmed DSF Wiki includes the section [Manual Integration Testing](https://github.com/highmed/highmed-dsf/wiki/Build-and-Test-Project#manual-integration-testing-vms-for-docker-registry-3-medics-ttp), with detailed description on how to run the processes in a simulated setup consisting of 3 MeDIC and 1 TTP. Example implementations to start a process can be found in the respective Maven sub-modules under `src/test/java` in the package `org.highmed.dsf.bpe.start`. ## Implementing new Processes From 31cc93619281d817cc0c4fbcb0269eac289dbdca Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 25 Apr 2022 16:07:00 +0200 Subject: [PATCH 100/125] fix typos --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bc8a0109..830a4023 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Prerequisite: Java 11, Maven >= 3.6 ``` ## Executing the Processes -The HiGHmed DSF Wiki includes the section [Manual Integration Testing](https://github.com/highmed/highmed-dsf/wiki/Build-and-Test-Project#manual-integration-testing-vms-for-docker-registry-3-medics-ttp), with detailed description on how to run the processes in a simulated setup consisting of 3 MeDIC and 1 TTP. Example implementations to start a process can be found in the respective Maven sub-modules under `src/test/java` in the package `org.highmed.dsf.bpe.start`. +The HiGHmed DSF Wiki includes a section about [Manual Integration Testing](https://github.com/highmed/highmed-dsf/wiki/Build-and-Test-Project#manual-integration-testing-vms-for-docker-registry-3-medics-ttp), with detailed descriptions on how to run the processes in a simulated testing environment consisting of 3 MeDICs and 1 TTP. Example implementations to start a process can be found in the respective Maven sub-modules under `src/test/java` in the package `org.highmed.dsf.bpe.start`. ## Implementing new Processes From 0bddea4feb3fc387b68a2d5683b3d96f6b6a8949 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 26 Apr 2022 15:21:27 +0200 Subject: [PATCH 101/125] remove not needed service, logger and imports --- .../message/SendMultiMedicResultShare.java | 4 -- .../message/SendSingleMedicResultShare.java | 4 -- .../service/CalculateMultiMedicResult.java | 4 -- .../CalculateSingleMedicResultShares.java | 4 -- .../bpe/service/CheckMultiMedicResults.java | 4 -- .../service/CheckSingleMedicResultShares.java | 26 ----------- .../spring/config/FeasibilityMpcConfig.java | 7 --- .../bpe/executeFeasibilityMpcSingleShare.bpmn | 46 +++++++------------ ...yMpcFromMedicsViaMedic1ExampleStarter.java | 9 ++-- 9 files changed, 21 insertions(+), 87 deletions(-) delete mode 100644 dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultShares.java diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java index 494a6deb..152aaaaf 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendMultiMedicResultShare.java @@ -19,15 +19,11 @@ import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; import org.hl7.fhir.r4.model.Task.ParameterComponent; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import ca.uhn.fhir.context.FhirContext; public class SendMultiMedicResultShare extends AbstractTaskMessageSend { - private static final Logger logger = LoggerFactory.getLogger(SendMultiMedicResultShare.class); - public SendMultiMedicResultShare(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) { diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java index a5792366..9f9481d8 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java @@ -19,15 +19,11 @@ import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; import org.hl7.fhir.r4.model.Task.ParameterComponent; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import ca.uhn.fhir.context.FhirContext; public class SendSingleMedicResultShare extends AbstractTaskMessageSend { - private static final Logger logger = LoggerFactory.getLogger(SendSingleMedicResultShare.class); - public SendSingleMedicResultShare(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) { diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java index def26612..7e476aa5 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java @@ -24,13 +24,9 @@ import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Targets; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class CalculateMultiMedicResult extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(CalculateMultiMedicResult.class); - public CalculateMultiMedicResult(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) { diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java index 1accaefd..e646ef90 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java @@ -23,13 +23,9 @@ import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.Targets; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class CalculateSingleMedicResultShares extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(CalculateSingleMedicResultShares.class); - public CalculateSingleMedicResultShares(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) { diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java index 98d0eb8a..5d2e70cb 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckMultiMedicResults.java @@ -16,13 +16,9 @@ import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; public class CheckMultiMedicResults extends AbstractServiceDelegate { - private static final Logger logger = LoggerFactory.getLogger(CheckMultiMedicResults.class); - public CheckMultiMedicResults(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper) { diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultShares.java deleted file mode 100644 index 67d5637c..00000000 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CheckSingleMedicResultShares.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.highmed.dsf.bpe.service; - -import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; -import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; -import org.highmed.dsf.fhir.task.TaskHelper; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class CheckSingleMedicResultShares extends AbstractServiceDelegate -{ - private static final Logger logger = LoggerFactory.getLogger(CheckSingleMedicResultShares.class); - - public CheckSingleMedicResultShares(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper) - { - super(clientProvider, taskHelper, readAccessHelper); - } - - @Override - protected void doExecute(DelegateExecution execution) throws Exception - { - logger.warn("Checks not yet implemented"); - } -} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java index ef9f8880..0df213dd 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/spring/config/FeasibilityMpcConfig.java @@ -12,7 +12,6 @@ import org.highmed.dsf.bpe.service.CheckFeasibilityMpcResources; import org.highmed.dsf.bpe.service.CheckMultiMedicResults; import org.highmed.dsf.bpe.service.CheckQueries; -import org.highmed.dsf.bpe.service.CheckSingleMedicResultShares; import org.highmed.dsf.bpe.service.DownloadFeasibilityMpcResources; import org.highmed.dsf.bpe.service.DownloadResearchStudyResource; import org.highmed.dsf.bpe.service.ExecuteQueries; @@ -203,12 +202,6 @@ public CalculateSingleMedicResultShares calculateSingleMedicResultShares() return new CalculateSingleMedicResultShares(fhirClientProvider, taskHelper, readAccessHelper); } - @Bean - public CheckSingleMedicResultShares checkSingleMedicResultShares() - { - return new CheckSingleMedicResultShares(fhirClientProvider, taskHelper, readAccessHelper); - } - @Bean public SelectSingleMedicResultShareTargets selectSingleMedicResultShareTargets() { diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn index cfefaec4..04d7a415 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/bpe/executeFeasibilityMpcSingleShare.bpmn @@ -1,10 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0drkcb5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> <bpmn:process id="highmedorg_executeFeasibilityMpcSingleShare" isExecutable="true" camunda:versionTag="#{version}"> - <bpmn:serviceTask id="checkResults" name="check single medic result shares" camunda:class="org.highmed.dsf.bpe.service.CheckSingleMedicResultShares"> - <bpmn:incoming>Flow_08uzidj</bpmn:incoming> - <bpmn:outgoing>Flow_0nknzne</bpmn:outgoing> - </bpmn:serviceTask> <bpmn:serviceTask id="checkFeasibilityMpcResources" name="check feasibility resources" camunda:class="org.highmed.dsf.bpe.service.CheckFeasibilityMpcResources"> <bpmn:incoming>Flow_1czhll7</bpmn:incoming> <bpmn:outgoing>Flow_1dnygeo</bpmn:outgoing> @@ -93,7 +89,7 @@ <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/executeFeasibilityMpcMultiShare/#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> - <bpmn:incoming>Flow_0nknzne</bpmn:incoming> + <bpmn:incoming>Flow_08uzidj</bpmn:incoming> <bpmn:outgoing>Flow_1tfx2ak</bpmn:outgoing> <bpmn:multiInstanceLoopCharacteristics camunda:collection="${targets.entries}" camunda:elementVariable="target" /> </bpmn:sendTask> @@ -104,8 +100,7 @@ </bpmn:endEvent> <bpmn:sequenceFlow id="Flow_1tfx2ak" sourceRef="sendSingleMedicResultShares" targetRef="Event_1smcidr" /> <bpmn:sequenceFlow id="Flow_1dnygeo" sourceRef="checkFeasibilityMpcResources" targetRef="checkQueries" /> - <bpmn:sequenceFlow id="Flow_0nknzne" sourceRef="checkResults" targetRef="sendSingleMedicResultShares" /> - <bpmn:sequenceFlow id="Flow_08uzidj" sourceRef="calculateSingleMedicResultShares" targetRef="checkResults" /> + <bpmn:sequenceFlow id="Flow_08uzidj" sourceRef="calculateSingleMedicResultShares" targetRef="sendSingleMedicResultShares" /> <bpmn:textAnnotation id="TextAnnotation_0euut3n"> <bpmn:text>uac check, study definiton validity, type of cohort, ethics commitee vote, included medics, user authentication, rate limit, etc.</bpmn:text> </bpmn:textAnnotation> @@ -117,13 +112,17 @@ <bpmn:message id="Message_0qpomdh" name="resultShareMultiMedicFeasibilityMpcMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_executeFeasibilityMpcSingleShare"> + <bpmndi:BPMNEdge id="Flow_08uzidj_di" bpmnElement="Flow_08uzidj"> + <di:waypoint x="1940" y="272" /> + <di:waypoint x="2010" y="272" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1dnygeo_di" bpmnElement="Flow_1dnygeo"> <di:waypoint x="540" y="272" /> <di:waypoint x="600" y="272" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1tfx2ak_di" bpmnElement="Flow_1tfx2ak"> - <di:waypoint x="2300" y="272" /> - <di:waypoint x="2372" y="272" /> + <di:waypoint x="2110" y="272" /> + <di:waypoint x="2182" y="272" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1czhll7_di" bpmnElement="Flow_1czhll7"> <di:waypoint x="360" y="272" /> @@ -195,14 +194,6 @@ <di:waypoint x="1130" y="272" /> <di:waypoint x="1195" y="272" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0nknzne_di" bpmnElement="Flow_0nknzne"> - <di:waypoint x="2120" y="272" /> - <di:waypoint x="2200" y="272" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_08uzidj_di" bpmnElement="Flow_08uzidj"> - <di:waypoint x="1940" y="272" /> - <di:waypoint x="2020" y="272" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0jna5l2_di" bpmnElement="checkFeasibilityMpcResources"> <dc:Bounds x="440" y="232" width="100" height="80" /> </bpmndi:BPMNShape> @@ -239,26 +230,23 @@ <bpmndi:BPMNShape id="ServiceTask_17kpyle_di" bpmnElement="countIds"> <dc:Bounds x="1520" y="101" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0u5pb4i_di" bpmnElement="executeQueries"> - <dc:Bounds x="1030" y="232" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_1smcidr_di" bpmnElement="Event_1smcidr"> - <dc:Bounds x="2372" y="254" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> - <dc:Bounds x="490" y="113" width="267" height="56" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_15aifhd_di" bpmnElement="selectResponseTargetTtp"> <dc:Bounds x="1670" y="232" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0u5pb4i_di" bpmnElement="executeQueries"> + <dc:Bounds x="1030" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0z7c65s_di" bpmnElement="calculateSingleMedicResultShares"> <dc:Bounds x="1840" y="232" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0t2s0v7_di" bpmnElement="checkResults"> - <dc:Bounds x="2020" y="232" width="100" height="80" /> + <bpmndi:BPMNShape id="TextAnnotation_0euut3n_di" bpmnElement="TextAnnotation_0euut3n"> + <dc:Bounds x="490" y="113" width="267" height="56" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_0j0x0r2_di" bpmnElement="sendSingleMedicResultShares"> - <dc:Bounds x="2200" y="232" width="100" height="80" /> + <dc:Bounds x="2010" y="232" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1smcidr_di" bpmnElement="Event_1smcidr"> + <dc:Bounds x="2182" y="254" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1ncewqu_di" bpmnElement="Association_1ncewqu"> <di:waypoint x="460" y="230" /> diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter.java index d02014f4..43892db2 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/start/AbstractRequestFeasibilityMpcFromMedicsViaMedic1ExampleStarter.java @@ -3,18 +3,17 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsBase.CODE_TYPE_AQL_QUERY; -import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; -import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP; -import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_QUERY; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHEMD_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsBase.PROFILE_HIGHMED_GROUP; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_CONSORTIUM_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_CONSENT_CHECK; -import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_NEEDS_RECORD_LINKAGE; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_RESEARCH_STUDY_REFERENCE; +import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; +import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_PARTICIPATING_TTP; +import static org.highmed.dsf.bpe.ConstantsDataSharing.EXTENSION_HIGHMED_QUERY; +import static org.highmed.dsf.bpe.ConstantsDataSharing.NAMINGSYSTEM_HIGHMED_RESEARCH_STUDY_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_PROCESS_URI_AND_LATEST_VERSION; From d7a0ae35ddb2f8a1d9b472f8f8ac5e1c70752435 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 26 Apr 2022 15:23:07 +0200 Subject: [PATCH 102/125] use #{date} replacement --- .../highmed-task-execute-feasibility-mpc-multi-share.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml index 5aea505d..8854d559 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml +++ b/dsf-bpe-process-feasibility-mpc/src/main/resources/fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml @@ -13,7 +13,7 @@ <status value="unknown" /> <experimental value="false" /> <!-- date managed by bpe --> - <date value="2021-08-24" /> + <date value="#{date}" /> <fhirVersion value="4.0.1" /> <kind value="resource" /> <abstract value="false" /> From bc027c4374020db66a19382df952d2fcaceacb6c Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 26 Apr 2022 15:28:38 +0200 Subject: [PATCH 103/125] do not log the exception (stack-trace) when throwing the exception --- .../highmed/dsf/bpe/service/DownloadResearchStudyResource.java | 2 +- .../highmed/dsf/bpe/service/DownloadResearchStudyResource.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java index a7e69ec5..057dafdc 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -184,7 +184,7 @@ private ResearchStudy update(ResearchStudy researchStudy, FhirWebserviceClient c } catch (Exception e) { - logger.warn("Error while updating ResearchStudy resource: " + e.getMessage(), e); + logger.warn("Error while updating ResearchStudy resource: " + e.getMessage()); throw e; } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java index b878c467..a0dfc127 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/DownloadResearchStudyResource.java @@ -183,7 +183,7 @@ private ResearchStudy update(ResearchStudy researchStudy, FhirWebserviceClient c } catch (Exception e) { - logger.warn("Error while updating ResearchStudy resource: " + e.getMessage(), e); + logger.warn("Error while updating ResearchStudy resource: " + e.getMessage()); throw e; } } From b349b34a7ef46bf6774fa2c5488ec8e1c9f048bf Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 26 Apr 2022 15:39:16 +0200 Subject: [PATCH 104/125] remove Serializable, InitializingBean, hashCode and equals --- .../highmed/dsf/bpe/mpc/ArithmeticShare.java | 22 +------------------ .../dsf/bpe/mpc/ArithmeticSharing.java | 20 +++++------------ 2 files changed, 6 insertions(+), 36 deletions(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java index b1fd15cd..fd0d0297 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java @@ -2,13 +2,12 @@ import static org.highmed.dsf.bpe.mpc.ArithmeticSharing.DEFAULT_RING_SIZE; -import java.io.Serializable; import java.math.BigInteger; /** * @author Tobias Kussel */ -public class ArithmeticShare implements Serializable +public class ArithmeticShare { private final BigInteger value; private final BigInteger ringSize; @@ -34,25 +33,6 @@ public BigInteger getRingSize() return ringSize; } - @Override - public boolean equals(Object o) - { - if (o == this) - return true; - if (!(o instanceof ArithmeticShare)) - return false; - ArithmeticShare as = (ArithmeticShare) o; - return as.value.equals(value) && as.ringSize.equals(ringSize); - } - - @Override - public int hashCode() - { - int result = value.hashCode(); - result = 31 * result + ringSize.hashCode(); - return result; - } - @Override public String toString() { diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java index 6464b743..30a87fc7 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java @@ -6,12 +6,10 @@ import java.util.List; import java.util.Objects; -import org.springframework.beans.factory.InitializingBean; - /** * @author Tobias Kussel */ -public class ArithmeticSharing implements InitializingBean +public class ArithmeticSharing { private static final int MAX_POWER_FOR_INT = 31; public static final BigInteger DEFAULT_RING_SIZE = BigInteger.valueOf(2).pow(MAX_POWER_FOR_INT) @@ -28,25 +26,17 @@ public ArithmeticSharing(int numParties) } public ArithmeticSharing(int numParties, BigInteger ringSize) - { - this.numParties = numParties; - this.ringSize = ringSize; - } - - @Override - public void afterPropertiesSet() throws Exception { Objects.requireNonNull(ringSize, "ringSize"); if (BigInteger.ZERO.compareTo(ringSize) >= 0) - { throw new IllegalArgumentException("ringSize < 1"); - } - if (numParties <= 0) - { + if (numParties < 1) throw new IllegalArgumentException("numParties < 1"); - } + + this.numParties = numParties; + this.ringSize = ringSize; } public int getNumParties() From 14d738205291bdcb16ca311a6dea4ce48619d938 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 26 Apr 2022 16:36:58 +0200 Subject: [PATCH 105/125] improve arithmetic sharing code, remove static imports of collector methods --- .../highmed/dsf/bpe/mpc/ArithmeticShare.java | 5 ++ .../dsf/bpe/mpc/ArithmeticSharing.java | 30 ++++---- .../service/CalculateMultiMedicResult.java | 18 ++--- .../CalculateMultiMedicResultShare.java | 19 ++--- .../CalculateSingleMedicResultShares.java | 11 ++- .../service/StoreResultsSingleMedicShare.java | 5 +- .../dsf/bpe/mpc/ArithmeticSharingTest.java | 70 +++++++++---------- 7 files changed, 73 insertions(+), 85 deletions(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java index fd0d0297..38e8fca4 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticShare.java @@ -12,6 +12,11 @@ public class ArithmeticShare private final BigInteger value; private final BigInteger ringSize; + public ArithmeticShare(long value) + { + this(BigInteger.valueOf(value), DEFAULT_RING_SIZE); + } + public ArithmeticShare(BigInteger value) { this(value, DEFAULT_RING_SIZE); diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java index 30a87fc7..b878f505 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/mpc/ArithmeticSharing.java @@ -2,8 +2,6 @@ import java.math.BigInteger; import java.security.SecureRandom; -import java.util.Arrays; -import java.util.List; import java.util.Objects; /** @@ -49,17 +47,17 @@ public BigInteger getRingSize() return ringSize; } - public List<ArithmeticShare> createShares(int secret) + public ArithmeticShare[] createShares(int secret) { return createShares(BigInteger.valueOf(secret)); } - public List<ArithmeticShare> createShares(BigInteger secret) + public ArithmeticShare[] createShares(BigInteger secret) { BigInteger[] shares = new BigInteger[numParties]; shares[numParties - 1] = secret; - for (int i = 0; i != numParties - 1; i++) + for (int i = 0; i < numParties - 1; i++) { shares[i] = getBlind(MAX_POWER_FOR_INT); shares[numParties - 1] = shares[numParties - 1].subtract(shares[i]); @@ -68,36 +66,34 @@ public List<ArithmeticShare> createShares(BigInteger secret) shares[numParties - 1] = shares[numParties - 1].mod(ringSize); ArithmeticShare[] result = new ArithmeticShare[numParties]; - for (int i = 0; i != numParties; i++) + for (int i = 0; i < numParties; i++) { result[i] = new ArithmeticShare(shares[i], ringSize); } - return Arrays.asList(result); + return result; } - public int reconstructSecretToInt(List<ArithmeticShare> shares) + public int reconstructSecretToInt(ArithmeticShare[] shares) { return reconstructSecret(shares).intValueExact(); } - public BigInteger reconstructSecret(List<ArithmeticShare> shares) + public BigInteger reconstructSecret(ArithmeticShare[] shares) { - if (shares.size() != numParties) + if (shares.length != numParties) throw new IllegalArgumentException("Number of provided ArithmeticShares does not match numParties, shares=" - + shares.size() + " ,numParties=" + numParties); - - ArithmeticShare[] sharesArray = shares.toArray(new ArithmeticShare[0]); + + shares.length + " ,numParties=" + numParties); BigInteger reconstruction = BigInteger.ZERO; - BigInteger firstRingSize = sharesArray[0].getRingSize(); - for (int i = 0; i != sharesArray.length; i++) + BigInteger firstRingSize = shares[0].getRingSize(); + for (int i = 0; i < shares.length; i++) { - if (!(sharesArray[i].getRingSize().equals(firstRingSize))) + if (!(shares[i].getRingSize().equals(firstRingSize))) { throw new IllegalArgumentException("Incompatible ringSizes found!"); } - reconstruction = reconstruction.add(sharesArray[i].getValue()).remainder(sharesArray[i].getRingSize()); + reconstruction = reconstruction.add(shares[i].getValue()).remainder(shares[i].getRingSize()); } return reconstruction; diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java index 7e476aa5..37208995 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java @@ -1,8 +1,5 @@ package org.highmed.dsf.bpe.service; -import static java.util.stream.Collectors.groupingBy; -import static java.util.stream.Collectors.toList; - import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES; @@ -10,6 +7,7 @@ import java.math.BigInteger; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; @@ -44,10 +42,10 @@ protected void doExecute(DelegateExecution execution) throws Exception ArithmeticSharing arithmeticSharing = new ArithmeticSharing(targets.getEntries().size()); Map<String, List<QueryResult>> byCohortId = shares.getResults().stream() - .collect(groupingBy(QueryResult::getCohortId)); + .collect(Collectors.groupingBy(QueryResult::getCohortId)); List<FinalFeasibilityMpcQueryResult> reconstructedResults = byCohortId.entrySet().stream() - .map(group -> toReconstructedResult(arithmeticSharing, group)).collect(toList()); + .map(group -> toReconstructedResult(arithmeticSharing, group)).collect(Collectors.toList()); execution.setVariable(BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS, FinalFeasibilityMpcQueryResultsValues .create(new FinalFeasibilityMpcQueryResults(reconstructedResults))); @@ -57,15 +55,11 @@ private FinalFeasibilityMpcQueryResult toReconstructedResult(ArithmeticSharing a Map.Entry<String, List<QueryResult>> group) { String cohortId = group.getKey(); - List<ArithmeticShare> toReconstruct = group.getValue().stream().map(s -> toArithmeticShare(s.getCohortSize())) - .collect(toList()); + ArithmeticShare[] toReconstruct = group.getValue().stream().map(QueryResult::getCohortSize) + .map(ArithmeticShare::new).toArray(ArithmeticShare[]::new); + int reconstructedResult = arithmeticSharing.reconstructSecretToInt(toReconstruct); return new FinalFeasibilityMpcQueryResult(cohortId, arithmeticSharing.getNumParties(), reconstructedResult); } - - private ArithmeticShare toArithmeticShare(int share) - { - return new ArithmeticShare(BigInteger.valueOf(share)); - } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShare.java index 929260db..b86a3f7e 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShare.java @@ -1,8 +1,5 @@ package org.highmed.dsf.bpe.service; -import static java.util.stream.Collectors.groupingBy; -import static java.util.stream.Collectors.toList; - import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; @@ -11,6 +8,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; @@ -58,11 +56,11 @@ protected void doExecute(DelegateExecution execution) throws Exception String organizationIdentifier = organizationProvider.getLocalIdentifierValue(); Map<String, List<QueryResult>> byCohortId = shares.getResults().stream() - .collect(groupingBy(QueryResult::getCohortId)); + .collect(Collectors.groupingBy(QueryResult::getCohortId)); List<QueryResult> reconstructedResults = byCohortId.entrySet().stream() .map(group -> toReconstructedResult(arithmeticSharing, organizationIdentifier, group)) - .collect(toList()); + .collect(Collectors.toList()); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES, QueryResultsValues.create(new QueryResults(reconstructedResults))); @@ -72,15 +70,12 @@ private QueryResult toReconstructedResult(ArithmeticSharing arithmeticSharing, S Map.Entry<String, List<QueryResult>> group) { String cohortId = group.getKey(); - List<ArithmeticShare> toReconstruct = group.getValue().stream().map(s -> toArithmeticShare(s.getCohortSize())) - .collect(toList()); + + ArithmeticShare[] toReconstruct = group.getValue().stream().map(QueryResult::getCohortSize) + .map(ArithmeticShare::new).toArray(ArithmeticShare[]::new); + int reconstructedResult = arithmeticSharing.reconstructSecretToInt(toReconstruct); return QueryResult.mpcCountResult(organizationIdentifier, cohortId, reconstructedResult); } - - private ArithmeticShare toArithmeticShare(int share) - { - return new ArithmeticShare(BigInteger.valueOf(share)); - } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java index e646ef90..9b45f063 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java @@ -1,13 +1,12 @@ package org.highmed.dsf.bpe.service; -import static java.util.stream.Collectors.toList; - import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; import java.math.BigInteger; import java.util.List; +import java.util.stream.Collectors; import java.util.stream.IntStream; import java.util.stream.Stream; @@ -40,7 +39,7 @@ protected void doExecute(DelegateExecution execution) throws Exception List<QueryResult> shares = queryResults.getResults().stream() .flatMap(queryResult -> toArithmeticSharesForCohortAndOrganization(queryResult, targets)) - .collect(toList()); + .collect(Collectors.toList()); execution.setVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES, QueryResultsValues.create(new QueryResults(shares))); @@ -60,13 +59,13 @@ private Stream<QueryResult> toArithmeticSharesForCohortAndOrganization(QueryResu throw new IllegalStateException( "Secret > maxSecret (" + maxSecret + ") for " + numParties + " participating organizations"); - List<ArithmeticShare> shares = arithmeticSharing.createShares(secret); + ArithmeticShare[] shares = arithmeticSharing.createShares(secret); - if (shares.size() != numParties) + if (shares.length != numParties) throw new IllegalStateException("Number of shares does not match number of targets"); return IntStream.range(0, numParties) .mapToObj(i -> QueryResult.mpcCountResult(organizations.get(i).getTargetOrganizationIdentifierValue(), - queryResult.getCohortId(), shares.get(i).getValue().intValueExact())); + queryResult.getCohortId(), shares[i].getValue().intValueExact())); } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java index 4aa02c97..cf28a7e2 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreResultsSingleMedicShare.java @@ -1,7 +1,5 @@ package org.highmed.dsf.bpe.service; -import static java.util.stream.Collectors.toList; - import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_GROUP_ID; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING; import static org.highmed.dsf.bpe.ConstantsDataSharing.CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE; @@ -9,6 +7,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; @@ -55,7 +54,7 @@ private List<QueryResult> getShares(Task task) return taskHelper .getInputParameterWithExtension(task, CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_SINGLE_MEDIC_RESULT_SHARE, EXTENSION_HIGHMED_GROUP_ID) - .map(input -> toQueryResultShare(requester, input)).collect(toList()); + .map(input -> toQueryResultShare(requester, input)).collect(Collectors.toList()); } private QueryResult toQueryResultShare(Reference requester, Task.ParameterComponent input) diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java index 4aadcf4e..909c2f0f 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/mpc/ArithmeticSharingTest.java @@ -8,6 +8,7 @@ import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; +import java.util.stream.IntStream; import org.highmed.dsf.bpe.variable.QueryResult; import org.junit.Test; @@ -33,41 +34,40 @@ public void arithmeticSharingValid() { ArithmeticSharing arithmeticSharing = new ArithmeticSharing(3); - List<ArithmeticShare> singleMedicSharesOrg1 = arithmeticSharing.createShares(10); - List<ArithmeticShare> singleMedicSharesOrg2 = arithmeticSharing.createShares(20); - List<ArithmeticShare> singleMedicSharesOrg3 = arithmeticSharing.createShares(30); + ArithmeticShare[] singleMedicSharesOrg1 = arithmeticSharing.createShares(10); + ArithmeticShare[] singleMedicSharesOrg2 = arithmeticSharing.createShares(20); + ArithmeticShare[] singleMedicSharesOrg3 = arithmeticSharing.createShares(30); - List<QueryResult> queryResultsSingleMedicSharesOrg1 = singleMedicSharesOrg1.stream() - .map(s -> QueryResult.mpcCountResult("", "", s.getValue().intValueExact())) + List<QueryResult> queryResultsSingleMedicSharesOrg1 = IntStream.range(0, arithmeticSharing.getNumParties()) + .mapToObj(i -> QueryResult.mpcCountResult("", "", singleMedicSharesOrg1[i].getValue().intValueExact())) .collect(Collectors.toList()); - List<QueryResult> queryResultsSingleMedicSharesOrg2 = singleMedicSharesOrg2.stream() - .map(s -> QueryResult.mpcCountResult("", "", s.getValue().intValueExact())) + List<QueryResult> queryResultsSingleMedicSharesOrg2 = IntStream.range(0, arithmeticSharing.getNumParties()) + .mapToObj(i -> QueryResult.mpcCountResult("", "", singleMedicSharesOrg2[i].getValue().intValueExact())) .collect(Collectors.toList()); - List<QueryResult> queryResultsSingleMedicSharesOrg3 = singleMedicSharesOrg3.stream() - .map(s -> QueryResult.mpcCountResult("", "", s.getValue().intValueExact())) + List<QueryResult> queryResultsSingleMedicSharesOrg3 = IntStream.range(0, arithmeticSharing.getNumParties()) + .mapToObj(i -> QueryResult.mpcCountResult("", "", singleMedicSharesOrg3[i].getValue().intValueExact())) .collect(Collectors.toList()); - List<ArithmeticShare> reconstrucedSingleMedicSharesOrg1 = queryResultsSingleMedicSharesOrg1.stream() - .map(q -> new ArithmeticShare(BigInteger.valueOf(q.getCohortSize()))).collect(Collectors.toList()); - List<ArithmeticShare> reconstrucedSingleMedicSharesOrg2 = queryResultsSingleMedicSharesOrg2.stream() - .map(q -> new ArithmeticShare(BigInteger.valueOf(q.getCohortSize()))).collect(Collectors.toList()); - List<ArithmeticShare> reconstrucedSingleMedicSharesOrg3 = queryResultsSingleMedicSharesOrg3.stream() - .map(q -> new ArithmeticShare(BigInteger.valueOf(q.getCohortSize()))).collect(Collectors.toList()); + ArithmeticShare[] reconstructedSingleMedicSharesOrg1 = queryResultsSingleMedicSharesOrg1.stream() + .map(QueryResult::getCohortSize).map(ArithmeticShare::new).toArray(ArithmeticShare[]::new); + ArithmeticShare[] reconstructedSingleMedicSharesOrg2 = queryResultsSingleMedicSharesOrg2.stream() + .map(QueryResult::getCohortSize).map(ArithmeticShare::new).toArray(ArithmeticShare[]::new); + ArithmeticShare[] reconstructedSingleMedicSharesOrg3 = queryResultsSingleMedicSharesOrg3.stream() + .map(QueryResult::getCohortSize).map(ArithmeticShare::new).toArray(ArithmeticShare[]::new); int multiMedicShareOrg1 = arithmeticSharing - .reconstructSecretToInt(List.of(reconstrucedSingleMedicSharesOrg1.get(0), - reconstrucedSingleMedicSharesOrg2.get(1), reconstrucedSingleMedicSharesOrg3.get(2))); + .reconstructSecretToInt(new ArithmeticShare[] { reconstructedSingleMedicSharesOrg1[0], + reconstructedSingleMedicSharesOrg2[1], reconstructedSingleMedicSharesOrg3[2] }); int multiMedicShareOrg2 = arithmeticSharing - .reconstructSecretToInt(List.of(reconstrucedSingleMedicSharesOrg1.get(1), - reconstrucedSingleMedicSharesOrg2.get(2), reconstrucedSingleMedicSharesOrg3.get(0))); + .reconstructSecretToInt(new ArithmeticShare[] { reconstructedSingleMedicSharesOrg1[1], + reconstructedSingleMedicSharesOrg2[2], reconstructedSingleMedicSharesOrg3[0] }); int multiMedicShareOrg3 = arithmeticSharing - .reconstructSecretToInt(List.of(reconstrucedSingleMedicSharesOrg1.get(2), - reconstrucedSingleMedicSharesOrg2.get(0), reconstrucedSingleMedicSharesOrg3.get(1))); + .reconstructSecretToInt(new ArithmeticShare[] { reconstructedSingleMedicSharesOrg1[2], + reconstructedSingleMedicSharesOrg2[0], reconstructedSingleMedicSharesOrg3[1] }); long total = arithmeticSharing - .reconstructSecretToInt(List.of(new ArithmeticShare(BigInteger.valueOf(multiMedicShareOrg1)), - new ArithmeticShare(BigInteger.valueOf(multiMedicShareOrg2)), - new ArithmeticShare(BigInteger.valueOf(multiMedicShareOrg3)))); + .reconstructSecretToInt(new ArithmeticShare[] { new ArithmeticShare(multiMedicShareOrg1), + new ArithmeticShare(multiMedicShareOrg2), new ArithmeticShare(multiMedicShareOrg3) }); assertEquals(60, total); } @@ -83,12 +83,12 @@ public void fiftyPartiesAndSecrets() int maxSecret = arithmeticSharing.getRingSize().divide(BigInteger.valueOf(numParties)).intValueExact(); int[] secrets = new int[numParties]; - List<List<ArithmeticShare>> shares = new ArrayList<>(); + List<ArithmeticShare[]> shares = new ArrayList<>(); for (int i = 0; i < numParties; i++) { secrets[i] = randomGenerator.nextInt(maxSecret); - List<ArithmeticShare> sharesI = arithmeticSharing.createShares(secrets[i]); + ArithmeticShare[] sharesI = arithmeticSharing.createShares(secrets[i]); shares.add(sharesI); } @@ -115,21 +115,21 @@ public void homomorphicAddition() secrets[i] = randomGenerator.nextInt(maxSecret); } - List<ArithmeticShare> shares1 = arithmeticSharing.createShares(secrets[0]); - List<ArithmeticShare> shares2 = arithmeticSharing.createShares(secrets[1]); - List<ArithmeticShare> shares3 = arithmeticSharing.createShares(secrets[2]); - List<ArithmeticShare> shares4 = arithmeticSharing.createShares(secrets[3]); - List<ArithmeticShare> shares5 = arithmeticSharing.createShares(secrets[4]); + ArithmeticShare[] shares1 = arithmeticSharing.createShares(secrets[0]); + ArithmeticShare[] shares2 = arithmeticSharing.createShares(secrets[1]); + ArithmeticShare[] shares3 = arithmeticSharing.createShares(secrets[2]); + ArithmeticShare[] shares4 = arithmeticSharing.createShares(secrets[3]); + ArithmeticShare[] shares5 = arithmeticSharing.createShares(secrets[4]); List<Integer> sumShares = new ArrayList<>(); for (int i = 0; i < numParties; i++) { sumShares.add(arithmeticSharing.reconstructSecretToInt( - List.of(shares1.get(i), shares2.get(i), shares3.get(i), shares4.get(i), shares5.get(i)))); + new ArithmeticShare[] { shares1[i], shares2[i], shares3[i], shares4[i], shares5[i] })); } - int reconstructedResult = arithmeticSharing.reconstructSecretToInt( - sumShares.stream().map(s -> new ArithmeticShare(BigInteger.valueOf(s))).collect(Collectors.toList())); + int reconstructedResult = arithmeticSharing + .reconstructSecretToInt(sumShares.stream().map(ArithmeticShare::new).toArray(ArithmeticShare[]::new)); int cleartextResult = Arrays.stream(secrets).sum(); @@ -142,7 +142,7 @@ public void manyManyParties() int secret = Integer.MAX_VALUE - 1; ArithmeticSharing arithmeticSharing = new ArithmeticSharing(54321); - List<ArithmeticShare> shares = arithmeticSharing.createShares(secret); + ArithmeticShare[] shares = arithmeticSharing.createShares(secret); int reconstructed = arithmeticSharing.reconstructSecretToInt(shares); assertEquals(secret, reconstructed); From efcf225fc26ed426c8c04fa229de697e4583feb6 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Tue, 26 Apr 2022 16:49:25 +0200 Subject: [PATCH 106/125] remove not needed imports --- .../org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java | 1 - .../highmed/dsf/bpe/service/CalculateMultiMedicResultShare.java | 1 - 2 files changed, 2 deletions(-) diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java index 37208995..ac8150dd 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResult.java @@ -4,7 +4,6 @@ import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_FINAL_QUERY_RESULTS; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES; -import java.math.BigInteger; import java.util.List; import java.util.Map; import java.util.stream.Collectors; diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShare.java index b86a3f7e..d8f79091 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateMultiMedicResultShare.java @@ -4,7 +4,6 @@ import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_MULTI_MEDIC_SHARES; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES; -import java.math.BigInteger; import java.util.List; import java.util.Map; import java.util.Objects; From 13cd6d31d141b31605e8475be6a925531e205553 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Wed, 27 Apr 2022 12:17:21 +0200 Subject: [PATCH 107/125] added business-key as optional output parameter --- .../highmed-task-start-ping-process.xml | 39 +++++++++++++++++++ .../dsf/fhir/profiles/TaskProfileTest.java | 14 +++++++ 2 files changed, 53 insertions(+) diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml index 557ee67f..3de0a43c 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml @@ -59,5 +59,44 @@ <sliceName value="correlation-key" /> <max value="0" /> </element> + <element id="Task.output:business-key-out"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.output" /> + <sliceName value="business-key-out" /> + <max value="1" /> + </element> + <element id="Task.output:business-key-out.type"> + <path value="Task.output.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskOutputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/bpmn-message" /> + </binding> + </element> + <element id="Task.output:business-key-out.type.coding"> + <path value="Task.output.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.output:business-key-out.type.coding.system"> + <path value="Task.output.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/bpmn-message" /> + </element> + <element id="Task.output:business-key-out.type.coding.code"> + <path value="Task.output.type.coding.code" /> + <min value="1" /> + <fixedCode value="business-key" /> + </element> + <element id="Task.output:business-key-out.value[x]"> + <path value="Task.output.value[x]" /> + <type> + <code value="string" /> + </type> + </element> </differential> </StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java index 1ad1871d..fe2c9500 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java @@ -63,6 +63,20 @@ public void testTaskStartPingProcessProfileValid() throws Exception || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); } + @Test + public void testTaskStartPingProcessProfileValidWithOutput() throws Exception + { + Task task = createValidTaskStartPingProcess(); + task.addOutput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + @Test public void testTaskStartPingProcessProfileNotValid1() throws Exception { From 7630e7172a5e775efa7a8ec2c9639c8c660968f2 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 29 Apr 2022 15:50:39 +0200 Subject: [PATCH 108/125] wip: add response output to start ping --- .../org/highmed/dsf/bpe/ConstantsPing.java | 12 ++ .../dsf/bpe/PingProcessPluginDefinition.java | 15 ++- .../org/highmed/dsf/bpe/message/SendPing.java | 99 +++++++++++++++ .../dsf/bpe/service/LogNoResponse.java | 49 +++++++ .../org/highmed/dsf/bpe/service/LogPong.java | 35 ++++- .../dsf/bpe/service/SelectPingTargets.java | 3 +- .../dsf/bpe/spring/config/PingConfig.java | 7 + .../dsf/bpe/util/PingResponseHelper.java | 28 ++++ .../src/main/resources/bpe/ping.bpmn | 120 ++++++++++-------- .../fhir/CodeSystem/highmed-ping-response.xml | 44 +++++++ .../fhir/CodeSystem/highmed-ping.xml | 29 +++++ .../fhir/ValueSet/highmed-ping-response.xml | 26 ++++ .../resources/fhir/ValueSet/highmed-ping.xml | 26 ++++ 13 files changed, 432 insertions(+), 61 deletions(-) create mode 100644 dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java create mode 100644 dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseHelper.java create mode 100644 dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-response.xml create mode 100644 dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml create mode 100644 dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-response.xml create mode 100644 dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping.xml diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java index 72a9820e..05e74eee 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java @@ -20,4 +20,16 @@ public interface ConstantsPing String PROFILE_HIGHMED_TASK_PONG_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "pong/"; String PROFILE_HIGHMED_TASK_PONG_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_PONG_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_PONG_MESSAGE_NAME = "pongMessage"; + + String CODESYSTEM_HIGHMED_PING = "http://highmed.org/fhir/CodeSystem/ping"; + String CODESYSTEM_HIGHMED_PING_VALUE_PING_RESPONSE = "ping-response"; + + String CODESYSTEM_HIGHMED_PING_RESPONSE = "http://highmed.org/fhir/CodeSystem/ping-response"; + String CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_RECEIVED = "received"; + String CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_MISSING = "missing"; + String CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE = "not-reachable"; + String CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_ALLOWED = "not-allowed"; + + String EXTENSION_URL_ORGANIZATION_IDENTIFIER = "http://highmed.org/fhir/StructureDefinition/extension-organization-identifier"; + String EXTENSION_URL_ENDPOINT_IDENTIFIER = "http://highmed.org/fhir/StructureDefinition/extension-endpoint-identifier"; } diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java index bc6ec58e..60eba26b 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java @@ -9,8 +9,10 @@ import org.highmed.dsf.bpe.spring.config.PingConfig; import org.highmed.dsf.fhir.resources.AbstractResource; import org.highmed.dsf.fhir.resources.ActivityDefinitionResource; +import org.highmed.dsf.fhir.resources.CodeSystemResource; import org.highmed.dsf.fhir.resources.ResourceProvider; import org.highmed.dsf.fhir.resources.StructureDefinitionResource; +import org.highmed.dsf.fhir.resources.ValueSetResource; import org.springframework.core.env.PropertyResolver; import ca.uhn.fhir.context.FhirContext; @@ -56,13 +58,22 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader { var aPing = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-ping.xml"); var aPong = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-pong.xml"); - var tPing = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-pong.xml"); + + // TODO: add response output to StructureDefinition var tStartPing = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-start-ping-process.xml"); + var tPing = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-pong.xml"); var tPong = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-ping.xml"); + var cPing = CodeSystemResource.file("fhir/CodeSystem/highmed-ping.xml"); + var cPingResponse = CodeSystemResource.file("fhir/CodeSystem/highmed-ping-response.xml"); + + var vPing = ValueSetResource.file("fhir/ValueSet/highmed-ping.xml"); + var vPingResponse = ValueSetResource.file("fhir/ValueSet/highmed-ping-response.xml"); + Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of("highmedorg_ping/" + VERSION, - Arrays.asList(aPing, tPong, tStartPing), "highmedorg_pong/" + VERSION, Arrays.asList(aPong, tPing)); + Arrays.asList(aPing, tStartPing, tPong, cPing, cPingResponse, vPing, vPingResponse), + "highmedorg_pong/" + VERSION, Arrays.asList(aPong, tPing)); return ResourceProvider.read(VERSION, RELEASE_DATE, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java index 8a64cc1e..34253e78 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java @@ -1,18 +1,117 @@ package org.highmed.dsf.bpe.message; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_LEADING_TASK; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_ALLOWED; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.util.PingResponseHelper; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Target; +import org.highmed.dsf.fhir.variables.Targets; +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import ca.uhn.fhir.context.FhirContext; public class SendPing extends AbstractTaskMessageSend { + private static final Logger logger = LoggerFactory.getLogger(SendPing.class); + public SendPing(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) { super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); } + + @Override + protected void handleSendTaskError(DelegateExecution execution, Target target, Exception exception, Task task) + { + Targets targets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); + + // if we are a multi instance message send task, remove target + if (targets != null) + { + Target toRemove = getTargetFromTargets(targets, target.getTargetOrganizationIdentifierValue()); + boolean removed = targets.removeTarget(toRemove); + + if (removed) + { + // TODO: after new Target class is available, replace "endpoint-identifier" with actual value from + // target + logger.debug("Target organization {} (endpoint {}) with error {} removed from target list", + toRemove.getTargetOrganizationIdentifierValue(), "endpoint-identifier", exception.getMessage()); + } + + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, targets); + } + + if (task != null) + { + if (exception instanceof WebApplicationException) + { + WebApplicationException webApplicationException = (WebApplicationException) exception; + if (webApplicationException.getResponse() != null && webApplicationException.getResponse() + .getStatus() == Response.Status.FORBIDDEN.getStatusCode()) + { + PingResponseHelper.addResponseToTask(task, target.getTargetOrganizationIdentifierValue(), + "endpoint-identifier", CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_ALLOWED); + } + else + { + PingResponseHelper.addResponseToTask(task, target.getTargetOrganizationIdentifierValue(), + "endpoint-identifier", CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE); + } + } + else + { + PingResponseHelper.addResponseToTask(task, target.getTargetOrganizationIdentifierValue(), + "endpoint-identifier", CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE); + } + + execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_TASK, task); + } + + if (targets != null && targets.isEmpty()) + { + logger.debug("Error while executing Task message send " + getClass().getName(), exception); + logger.error("Process {} has fatal error in step {} for task with id {}, last reason: {}", + execution.getProcessDefinitionId(), execution.getActivityInstanceId(), + task == null ? "?" : task.getId(), exception.getMessage()); + + if (task != null) + { + task.setStatus(Task.TaskStatus.FAILED); + getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().update(task); + } + else + logger.warn("Leading Task null, unable update Task with failed state"); + + execution.getProcessEngine().getRuntimeService().deleteProcessInstance(execution.getProcessInstanceId(), + exception.getMessage()); + } + + } + + private Target getTargetFromTargets(Targets targets, String organizationIdentifier) + { + return targets.getEntries().stream() + .filter(t -> organizationIdentifier.equals(t.getTargetOrganizationIdentifierValue())).findFirst() + .orElseThrow(); + } + + @Override + protected void addErrorMessageToLeadingTask(Task task, String errorMessage) + { + // Do noting because error is handled in "handleSendTaskError" + } } diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java new file mode 100644 index 00000000..ed4cb84c --- /dev/null +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java @@ -0,0 +1,49 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_LEADING_TASK; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_MISSING; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.util.PingResponseHelper; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Target; +import org.highmed.dsf.fhir.variables.Targets; +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class LogNoResponse extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(LogNoResponse.class); + + public LogNoResponse(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper) + { + super(clientProvider, taskHelper, readAccessHelper); + + } + + @Override + public void doExecute(DelegateExecution execution) throws Exception + { + Task task = getLeadingTaskFromExecutionVariables(); + + Targets targets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); + targets.getEntries().forEach(t -> logAndAddResponseToTask(task, t)); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_TASK, task); + } + + private void logAndAddResponseToTask(Task task, Target target) + { + // TODO: after new Target class is available, replace "endpoint-identifier" with actual value from target + logger.warn("PONG from organization {} (endpoint {}) missing", target.getTargetOrganizationIdentifierValue(), + "endpoint-identifier"); + PingResponseHelper.addResponseToTask(task, target.getTargetOrganizationIdentifierValue(), "endpoint-identifier", + CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_MISSING); + } +} diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java index 400ee43d..744d5686 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java @@ -1,10 +1,17 @@ package org.highmed.dsf.bpe.service; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_LEADING_TASK; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_RECEIVED; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.bpe.util.PingResponseHelper; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Target; +import org.highmed.dsf.fhir.variables.Targets; import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,10 +27,32 @@ public LogPong(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelpe } @Override - public void doExecute(DelegateExecution execution) throws Exception + public void doExecute(DelegateExecution execution) { - Task task = getCurrentTaskFromExecutionVariables(); + Task current = getCurrentTaskFromExecutionVariables(); + Task leading = getLeadingTaskFromExecutionVariables(); + + Targets targets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); + String organizationIdentifier = current.getRequester().getIdentifier().getValue(); + + Target target = getTargetFromTargets(targets, organizationIdentifier); + + // TODO: after new Target class is available, replace "endpoint-identifier" with actual value from target + logger.info("PONG from {} (endpoint: {})", target.getTargetOrganizationIdentifierValue(), + "endpoint-identifier"); + PingResponseHelper.addResponseToTask(leading, target.getTargetOrganizationIdentifierValue(), + "endpoint-identifier", CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_RECEIVED); - logger.info("PONG from {}", task.getRequester().getIdentifier().getValue()); + execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_TASK, leading); + + targets.removeTarget(target); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, targets); + } + + private Target getTargetFromTargets(Targets targets, String organizationIdentifier) + { + return targets.getEntries().stream() + .filter(t -> organizationIdentifier.equals(t.getTargetOrganizationIdentifierValue())).findFirst() + .orElseThrow(); } } diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java index 9066782e..3ebe86a0 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java @@ -15,7 +15,6 @@ import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.Targets; -import org.highmed.dsf.fhir.variables.TargetsValues; import org.springframework.beans.factory.InitializingBean; public class SelectPingTargets extends AbstractServiceDelegate implements InitializingBean @@ -48,6 +47,6 @@ public void doExecute(DelegateExecution execution) throws Exception .map(e -> Target.createBiDirectionalTarget(e.getKey(), e.getValue(), UUID.randomUUID().toString())) .collect(Collectors.toList()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(new Targets(targets))); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, new Targets(targets)); } } diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java index a67497cf..90bcdcc6 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java @@ -2,6 +2,7 @@ import org.highmed.dsf.bpe.message.SendPing; import org.highmed.dsf.bpe.message.SendPong; +import org.highmed.dsf.bpe.service.LogNoResponse; import org.highmed.dsf.bpe.service.LogPing; import org.highmed.dsf.bpe.service.LogPong; import org.highmed.dsf.bpe.service.SelectPingTargets; @@ -62,6 +63,12 @@ public LogPong logPong() return new LogPong(clientProvider, taskHelper, readAccessHelper); } + @Bean + public LogNoResponse logNoResponse() + { + return new LogNoResponse(clientProvider, taskHelper, readAccessHelper); + } + @Bean public SelectPingTargets selectPingTargets() { diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseHelper.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseHelper.java new file mode 100644 index 00000000..102d4188 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseHelper.java @@ -0,0 +1,28 @@ +package org.highmed.dsf.bpe.util; + +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_PING_RESPONSE; +import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER; + +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.Task; + +public class PingResponseHelper +{ + public static void addResponseToTask(Task task, String organizationIdentifier, String endpointIdentifier, + String code) + { + Coding value = new Coding().setSystem(CODESYSTEM_HIGHMED_PING_RESPONSE).setCode(code); + value.addExtension().setUrl(EXTENSION_URL_ORGANIZATION_IDENTIFIER).setValue( + new Coding().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setCode(organizationIdentifier)); + value.addExtension().setUrl(EXTENSION_URL_ENDPOINT_IDENTIFIER) + .setValue(new Coding().setSystem(NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER).setCode(endpointIdentifier)); + + task.addOutput().setValue(value).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_PING) + .setCode(CODESYSTEM_HIGHMED_PING_VALUE_PING_RESPONSE); + } +} diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn index fee083bd..2b40fe79 100644 --- a/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn +++ b/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0azvmx1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0azvmx1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> <bpmn:process id="highmedorg_ping" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:sequenceFlow id="SequenceFlow_0k1j79c" sourceRef="StartEvent_1" targetRef="selectTargets" /> <bpmn:sequenceFlow id="SequenceFlow_05ia6lz" sourceRef="selectTargets" targetRef="sendPing" /> @@ -28,13 +28,8 @@ </bpmn:startEvent> <bpmn:sequenceFlow id="SequenceFlow_1jv4kfm" sourceRef="StartEvent_18et3pb" targetRef="receivePong" /> <bpmn:endEvent id="EndEvent_1yf8pjt"> - <bpmn:incoming>SequenceFlow_0vxiwg9</bpmn:incoming> + <bpmn:incoming>Flow_0brn8vt</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_0vxiwg9" sourceRef="logPong" targetRef="EndEvent_1yf8pjt" /> - <bpmn:serviceTask id="logPong" name="logPong" camunda:class="org.highmed.dsf.bpe.service.LogPong"> - <bpmn:incoming>SequenceFlow_0r89tc0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0vxiwg9</bpmn:outgoing> - </bpmn:serviceTask> <bpmn:receiveTask id="receivePong" name="receivePong" messageRef="Message_10o3b8y"> <bpmn:extensionElements> <camunda:inputOutput> @@ -45,91 +40,108 @@ <bpmn:outgoing>SequenceFlow_0r89tc0</bpmn:outgoing> </bpmn:receiveTask> <bpmn:sequenceFlow id="SequenceFlow_0r89tc0" sourceRef="receivePong" targetRef="logPong" /> + <bpmn:sequenceFlow id="Flow_0brn8vt" sourceRef="logPong" targetRef="EndEvent_1yf8pjt" /> + <bpmn:serviceTask id="logPong" name="logPong" camunda:class="org.highmed.dsf.bpe.service.LogPong"> + <bpmn:incoming>SequenceFlow_0r89tc0</bpmn:incoming> + <bpmn:outgoing>Flow_0brn8vt</bpmn:outgoing> + </bpmn:serviceTask> </bpmn:subProcess> - <bpmn:boundaryEvent id="BoundaryEvent_0s1l6j2" attachedToRef="SubProcess_0szmntn"> - <bpmn:outgoing>SequenceFlow_01v9yzp</bpmn:outgoing> - <bpmn:timerEventDefinition> - <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT5M</bpmn:timeDuration> - </bpmn:timerEventDefinition> - </bpmn:boundaryEvent> <bpmn:endEvent id="EndEvent_1rdxonv"> - <bpmn:incoming>SequenceFlow_10d3jfk</bpmn:incoming> - <bpmn:incoming>SequenceFlow_01v9yzp</bpmn:incoming> + <bpmn:incoming>Flow_0d1hhpd</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_10d3jfk" sourceRef="SubProcess_0szmntn" targetRef="EndEvent_1rdxonv" /> - <bpmn:sequenceFlow id="SequenceFlow_01v9yzp" sourceRef="BoundaryEvent_0s1l6j2" targetRef="EndEvent_1rdxonv" /> + <bpmn:sequenceFlow id="SequenceFlow_10d3jfk" sourceRef="SubProcess_0szmntn" targetRef="logNoResponse" /> <bpmn:sequenceFlow id="SequenceFlow_1vng5zz" sourceRef="sendPing" targetRef="SubProcess_0szmntn" /> <bpmn:startEvent id="StartEvent_1"> <bpmn:outgoing>SequenceFlow_0k1j79c</bpmn:outgoing> <bpmn:messageEventDefinition messageRef="Message_1pklz6t" /> </bpmn:startEvent> + <bpmn:boundaryEvent id="BoundaryEvent_0s1l6j2" attachedToRef="SubProcess_0szmntn"> + <bpmn:outgoing>Flow_1mpgmm5</bpmn:outgoing> + <bpmn:timerEventDefinition> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT5M</bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:boundaryEvent> + <bpmn:sequenceFlow id="Flow_0d1hhpd" sourceRef="logNoResponse" targetRef="EndEvent_1rdxonv" /> + <bpmn:serviceTask id="logNoResponse" name="logNoResponse" camunda:class="org.highmed.dsf.bpe.service.LogNoResponse"> + <bpmn:incoming>SequenceFlow_10d3jfk</bpmn:incoming> + <bpmn:incoming>Flow_1mpgmm5</bpmn:incoming> + <bpmn:outgoing>Flow_0d1hhpd</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="Flow_1mpgmm5" sourceRef="BoundaryEvent_0s1l6j2" targetRef="logNoResponse" /> </bpmn:process> <bpmn:message id="Message_10o3b8y" name="pongMessage" /> <bpmn:message id="Message_1pklz6t" name="startPingProcessMessage" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_ping"> - <bpmndi:BPMNEdge id="SequenceFlow_1vng5zz_di" bpmnElement="SequenceFlow_1vng5zz"> - <di:waypoint x="530" y="120" /> - <di:waypoint x="606" y="120" /> + <bpmndi:BPMNEdge id="Flow_1mpgmm5_di" bpmnElement="Flow_1mpgmm5"> + <di:waypoint x="1108" y="180" /> + <di:waypoint x="1220" y="180" /> + <di:waypoint x="1220" y="160" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_01v9yzp_di" bpmnElement="SequenceFlow_01v9yzp"> - <di:waypoint x="1082" y="180" /> - <di:waypoint x="1172" y="180" /> - <di:waypoint x="1172" y="138" /> + <bpmndi:BPMNEdge id="Flow_0d1hhpd_di" bpmnElement="Flow_0d1hhpd"> + <di:waypoint x="1270" y="120" /> + <di:waypoint x="1322" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1vng5zz_di" bpmnElement="SequenceFlow_1vng5zz"> + <di:waypoint x="520" y="120" /> + <di:waypoint x="596" y="120" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_10d3jfk_di" bpmnElement="SequenceFlow_10d3jfk"> - <di:waypoint x="1064" y="120" /> - <di:waypoint x="1154" y="120" /> + <di:waypoint x="1090" y="120" /> + <di:waypoint x="1170" y="120" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_05ia6lz_di" bpmnElement="SequenceFlow_05ia6lz"> - <di:waypoint x="370" y="120" /> - <di:waypoint x="430" y="120" /> + <di:waypoint x="360" y="120" /> + <di:waypoint x="420" y="120" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0k1j79c_di" bpmnElement="SequenceFlow_0k1j79c"> - <di:waypoint x="209" y="120" /> - <di:waypoint x="270" y="120" /> + <di:waypoint x="188" y="120" /> + <di:waypoint x="260" y="120" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1cxtndb_di" bpmnElement="selectTargets"> + <dc:Bounds x="260" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SendTask_01t32b2_di" bpmnElement="sendPing"> - <dc:Bounds x="430" y="80" width="100" height="80" /> + <dc:Bounds x="420" y="80" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1cxtndb_di" bpmnElement="selectTargets"> - <dc:Bounds x="270" y="80" width="100" height="80" /> + <bpmndi:BPMNShape id="Activity_0byox2n_di" bpmnElement="logNoResponse"> + <dc:Bounds x="1170" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1rdxonv_di" bpmnElement="EndEvent_1rdxonv"> + <dc:Bounds x="1322" y="102" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_0szmntn_di" bpmnElement="SubProcess_0szmntn" isExpanded="true"> - <dc:Bounds x="606" y="60" width="458" height="120" /> + <dc:Bounds x="596" y="60" width="494" height="120" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0r89tc0_di" bpmnElement="SequenceFlow_0r89tc0"> - <di:waypoint x="808" y="120" /> - <di:waypoint x="858" y="120" /> + <bpmndi:BPMNEdge id="Flow_0brn8vt_di" bpmnElement="Flow_0brn8vt"> + <di:waypoint x="970" y="120" /> + <di:waypoint x="1022" y="120" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0vxiwg9_di" bpmnElement="SequenceFlow_0vxiwg9"> - <di:waypoint x="958" y="120" /> - <di:waypoint x="1008" y="120" /> + <bpmndi:BPMNEdge id="SequenceFlow_0r89tc0_di" bpmnElement="SequenceFlow_0r89tc0"> + <di:waypoint x="798" y="120" /> + <di:waypoint x="870" y="120" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1jv4kfm_di" bpmnElement="SequenceFlow_1jv4kfm"> - <di:waypoint x="662" y="120" /> - <di:waypoint x="708" y="120" /> + <di:waypoint x="652" y="120" /> + <di:waypoint x="698" y="120" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="StartEvent_18et3pb_di" bpmnElement="StartEvent_18et3pb"> - <dc:Bounds x="626" y="102" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1yf8pjt_di" bpmnElement="EndEvent_1yf8pjt"> - <dc:Bounds x="1008" y="102" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1tf139x_di" bpmnElement="logPong"> - <dc:Bounds x="858" y="80" width="100" height="80" /> + <dc:Bounds x="616" y="102" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ReceiveTask_1n4t6gv_di" bpmnElement="receivePong"> - <dc:Bounds x="708" y="80" width="100" height="80" /> + <dc:Bounds x="698" y="80" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1rdxonv_di" bpmnElement="EndEvent_1rdxonv"> - <dc:Bounds x="1154" y="102" width="36" height="36" /> + <bpmndi:BPMNShape id="Activity_1m8zy1k_di" bpmnElement="logPong"> + <dc:Bounds x="870" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1yf8pjt_di" bpmnElement="EndEvent_1yf8pjt"> + <dc:Bounds x="1022" y="102" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1dlqln5_di" bpmnElement="StartEvent_1"> - <dc:Bounds x="173" y="102" width="36" height="36" /> + <dc:Bounds x="152" y="102" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BoundaryEvent_0nix4ox_di" bpmnElement="BoundaryEvent_0s1l6j2"> - <dc:Bounds x="1046" y="162" width="36" height="36" /> + <dc:Bounds x="1072" y="162" width="36" height="36" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-response.xml b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-response.xml new file mode 100644 index 00000000..1185cb87 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-response.xml @@ -0,0 +1,44 @@ +<CodeSystem xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/CodeSystem/ping-response" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="HiGHmed_Ping_Response" /> + <title value="HiGHmed Ping Response" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="HiGHmed" /> + <description value="CodeSystem with values of the ping response status" /> + <caseSensitive value="true" /> + <hierarchyMeaning value="grouped-by" /> + <versionNeeded value="false" /> + <content value="complete" /> + <concept> + <code value="received" /> + <display value="Received" /> + <definition value="Pong received from the pinged organization" /> + </concept> + <concept> + <code value="missing" /> + <display value="Missing" /> + <definition value="Pong was not received from the pinged organization" /> + </concept> + <concept> + <code value="not-reachable" /> + <display value="Not reachable" /> + <definition value="Ping could not be sent to the organization" /> + </concept> + <concept> + <code value="not-allowed" /> + <display value="Not allowed" /> + <definition value="Missing authorization to start the Pong process at the organization" /> + </concept> +</CodeSystem> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml new file mode 100644 index 00000000..38e090ac --- /dev/null +++ b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml @@ -0,0 +1,29 @@ +<CodeSystem xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/CodeSystem/ping" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="HiGHmed_Ping" /> + <title value="HiGHmed Ping" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="HiGHmed" /> + <description value="CodeSystem with standard values for the process ping" /> + <caseSensitive value="true" /> + <hierarchyMeaning value="grouped-by" /> + <versionNeeded value="false" /> + <content value="complete" /> + <concept> + <code value="ping-response" /> + <display value="Ping Response" /> + <definition value="The response status of a pinged organization" /> + </concept> +</CodeSystem> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-response.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-response.xml new file mode 100644 index 00000000..79f5ff37 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-response.xml @@ -0,0 +1,26 @@ +<ValueSet xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/ValueSet/ping" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="HiGHmed_Ping" /> + <title value="HiGHmed Ping" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="HiGHmed" /> + <description value="ValueSet with standard values for the process ping" /> + <immutable value="true" /> + <compose> + <include> + <system value="http://highmed.org/fhir/CodeSystem/ping" /> + </include> + </compose> +</ValueSet> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping.xml new file mode 100644 index 00000000..79f5ff37 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping.xml @@ -0,0 +1,26 @@ +<ValueSet xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/ValueSet/ping" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="HiGHmed_Ping" /> + <title value="HiGHmed Ping" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="HiGHmed" /> + <description value="ValueSet with standard values for the process ping" /> + <immutable value="true" /> + <compose> + <include> + <system value="http://highmed.org/fhir/CodeSystem/ping" /> + </include> + </compose> +</ValueSet> \ No newline at end of file From d36972ab5138b3e54bae1c5734a2b5e151ce9605 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Fri, 29 Apr 2022 15:56:57 +0200 Subject: [PATCH 109/125] add comments for targets improvement --- .../src/main/java/org/highmed/dsf/bpe/message/SendPing.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java index 34253e78..c787e3fe 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java @@ -52,6 +52,7 @@ protected void handleSendTaskError(DelegateExecution execution, Target target, E toRemove.getTargetOrganizationIdentifierValue(), "endpoint-identifier", exception.getMessage()); } + // TODO: does not work if Targets are not updated execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, targets); } @@ -78,6 +79,7 @@ protected void handleSendTaskError(DelegateExecution execution, Target target, E "endpoint-identifier", CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE); } + // TODO: does not work if Task is not updated execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_TASK, task); } From 4e0fd9156b311feb88f0f8cc08b7171ac1fe5971 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Mon, 2 May 2022 01:20:35 +0200 Subject: [PATCH 110/125] pong results in start task, endpoint target search parameter Adds pong results to the start task, including needed additions to the Task profiles. Adds a target-endpoints input parameter to the start task profile, to specify entpoint that should be pinged. The parameter can be omitted to ping all existing active endpoints with correspoinding active managing organizations. Compile depends on highmed/highmed-dsf#345 closed and merged into highmed-dsf develop --- dsf-bpe-process-ping/pom.xml | 5 + .../org/highmed/dsf/bpe/ConstantsPing.java | 9 +- .../dsf/bpe/PingProcessPluginDefinition.java | 9 +- .../org/highmed/dsf/bpe/message/SendPing.java | 113 +++++------ .../dsf/bpe/service/LogNoResponse.java | 26 ++- .../org/highmed/dsf/bpe/service/LogPong.java | 46 +++-- .../dsf/bpe/service/SelectPingTargets.java | 188 +++++++++++++++++- .../dsf/bpe/service/SelectPongTarget.java | 33 ++- .../dsf/bpe/spring/config/PingConfig.java | 16 +- .../dsf/bpe/util/PingResponseGenerator.java | 48 +++++ .../dsf/bpe/util/PingResponseHelper.java | 28 --- .../src/main/resources/bpe/ping.bpmn | 30 +-- .../src/main/resources/bpe/pong.bpmn | 25 ++- .../fhir/CodeSystem/highmed-ping-response.xml | 2 +- .../fhir/CodeSystem/highmed-ping.xml | 12 +- .../highmed-extension-ping-response.xml | 134 +++++++++++++ .../StructureDefinition/highmed-task-ping.xml | 61 +++++- .../highmed-task-start-ping-process.xml | 107 +++++++++- .../fhir/ValueSet/highmed-ping-response.xml | 10 +- .../dsf/fhir/profiles/TaskProfileTest.java | 61 +++++- pom.xml | 6 +- 21 files changed, 795 insertions(+), 174 deletions(-) create mode 100644 dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseGenerator.java delete mode 100644 dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseHelper.java create mode 100644 dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-extension-ping-response.xml diff --git a/dsf-bpe-process-ping/pom.xml b/dsf-bpe-process-ping/pom.xml index 509a6195..10900435 100644 --- a/dsf-bpe-process-ping/pom.xml +++ b/dsf-bpe-process-ping/pom.xml @@ -21,6 +21,11 @@ <artifactId>dsf-bpe-process-base</artifactId> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <scope>provided</scope> + </dependency> <dependency> <groupId>de.hs-heilbronn.mi</groupId> diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java index 05e74eee..9d86687a 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java @@ -23,6 +23,8 @@ public interface ConstantsPing String CODESYSTEM_HIGHMED_PING = "http://highmed.org/fhir/CodeSystem/ping"; String CODESYSTEM_HIGHMED_PING_VALUE_PING_RESPONSE = "ping-response"; + String CODESYSTEM_HIGHMED_PING_VALUE_ENDPOINT_IDENTIFIER = "endpoint-identifier"; + String CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS = "target-endpoints"; String CODESYSTEM_HIGHMED_PING_RESPONSE = "http://highmed.org/fhir/CodeSystem/ping-response"; String CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_RECEIVED = "received"; @@ -30,6 +32,9 @@ public interface ConstantsPing String CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE = "not-reachable"; String CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_ALLOWED = "not-allowed"; - String EXTENSION_URL_ORGANIZATION_IDENTIFIER = "http://highmed.org/fhir/StructureDefinition/extension-organization-identifier"; - String EXTENSION_URL_ENDPOINT_IDENTIFIER = "http://highmed.org/fhir/StructureDefinition/extension-endpoint-identifier"; + String EXTENSION_URL_PING_RESPONSE = "http://highmed.org/fhir/StructureDefinition/extension-ping-response"; + String EXTENSION_URL_CORRELATION_KEY = "correlation-key"; + String EXTENSION_URL_ORGANIZATION_IDENTIFIER = "organization-identifier"; + String EXTENSION_URL_ENDPOINT_IDENTIFIER = "endpoint-identifier"; + String EXTENSION_URL_ERROR_MESSAGE = "error-message"; } diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java index 60eba26b..5990f9c5 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java @@ -59,11 +59,12 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var aPing = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-ping.xml"); var aPong = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-pong.xml"); - // TODO: add response output to StructureDefinition var tStartPing = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-start-ping-process.xml"); - var tPing = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-pong.xml"); - var tPong = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-ping.xml"); + var tPong = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-pong.xml"); + var tPing = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-ping.xml"); + var ePingResponse = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-extension-ping-response.xml"); var cPing = CodeSystemResource.file("fhir/CodeSystem/highmed-ping.xml"); var cPingResponse = CodeSystemResource.file("fhir/CodeSystem/highmed-ping-response.xml"); @@ -72,7 +73,7 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var vPingResponse = ValueSetResource.file("fhir/ValueSet/highmed-ping-response.xml"); Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of("highmedorg_ping/" + VERSION, - Arrays.asList(aPing, tStartPing, tPong, cPing, cPingResponse, vPing, vPingResponse), + Arrays.asList(aPing, tStartPing, ePingResponse, tPong, cPing, cPingResponse, vPing, vPingResponse), "highmedorg_pong/" + VERSION, Arrays.asList(aPong, tPing)); return ResourceProvider.read(VERSION, RELEASE_DATE, diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java index c787e3fe..6ae28948 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java @@ -1,119 +1,102 @@ package org.highmed.dsf.bpe.message; -import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_LEADING_TASK; -import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_ALLOWED; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_ENDPOINT_IDENTIFIER; + +import java.util.Objects; +import java.util.stream.Stream; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.Response; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.util.PingResponseHelper; +import org.highmed.dsf.bpe.util.PingResponseGenerator; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.EndpointProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; -import org.highmed.dsf.fhir.variables.Targets; +import org.hl7.fhir.r4.model.Reference; +import org.hl7.fhir.r4.model.ResourceType; import org.hl7.fhir.r4.model.Task; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.hl7.fhir.r4.model.Task.ParameterComponent; import ca.uhn.fhir.context.FhirContext; public class SendPing extends AbstractTaskMessageSend { - private static final Logger logger = LoggerFactory.getLogger(SendPing.class); + private final EndpointProvider endpointProvider; + private final PingResponseGenerator responseGenerator; public SendPing(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) + ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext, + EndpointProvider endpointProvider, PingResponseGenerator responseGenerator) { super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); + + this.endpointProvider = endpointProvider; + this.responseGenerator = responseGenerator; } @Override - protected void handleSendTaskError(DelegateExecution execution, Target target, Exception exception, Task task) + public void afterPropertiesSet() throws Exception { - Targets targets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); + super.afterPropertiesSet(); - // if we are a multi instance message send task, remove target - if (targets != null) - { - Target toRemove = getTargetFromTargets(targets, target.getTargetOrganizationIdentifierValue()); - boolean removed = targets.removeTarget(toRemove); + Objects.requireNonNull(endpointProvider, "endpointProvider"); + Objects.requireNonNull(responseGenerator, "responseGenerator"); + } - if (removed) - { - // TODO: after new Target class is available, replace "endpoint-identifier" with actual value from - // target - logger.debug("Target organization {} (endpoint {}) with error {} removed from target list", - toRemove.getTargetOrganizationIdentifierValue(), "endpoint-identifier", exception.getMessage()); - } + @Override + protected Stream<ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) + { + return Stream.of( + getTaskHelper().createInput(CODESYSTEM_HIGHMED_PING, CODESYSTEM_HIGHMED_PING_VALUE_ENDPOINT_IDENTIFIER, + new Reference().setIdentifier(endpointProvider.getLocalEndpointIdentifier()) + .setType(ResourceType.Endpoint.name()))); + } - // TODO: does not work if Targets are not updated - execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, targets); - } + @Override + protected void handleSendTaskError(Exception exception, String errorMessage) + { + Target target = getTarget(); + Task task = getLeadingTaskFromExecutionVariables(); if (task != null) { + String responseCode = CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE; if (exception instanceof WebApplicationException) { WebApplicationException webApplicationException = (WebApplicationException) exception; if (webApplicationException.getResponse() != null && webApplicationException.getResponse() .getStatus() == Response.Status.FORBIDDEN.getStatusCode()) { - PingResponseHelper.addResponseToTask(task, target.getTargetOrganizationIdentifierValue(), - "endpoint-identifier", CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_ALLOWED); + responseCode = CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_ALLOWED; } - else - { - PingResponseHelper.addResponseToTask(task, target.getTargetOrganizationIdentifierValue(), - "endpoint-identifier", CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE); - } - } - else - { - PingResponseHelper.addResponseToTask(task, target.getTargetOrganizationIdentifierValue(), - "endpoint-identifier", CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE); - } - - // TODO: does not work if Task is not updated - execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_TASK, task); - } - - if (targets != null && targets.isEmpty()) - { - logger.debug("Error while executing Task message send " + getClass().getName(), exception); - logger.error("Process {} has fatal error in step {} for task with id {}, last reason: {}", - execution.getProcessDefinitionId(), execution.getActivityInstanceId(), - task == null ? "?" : task.getId(), exception.getMessage()); - - if (task != null) - { - task.setStatus(Task.TaskStatus.FAILED); - getFhirWebserviceClientProvider().getLocalWebserviceClient().withMinimalReturn().update(task); } - else - logger.warn("Leading Task null, unable update Task with failed state"); - execution.getProcessEngine().getRuntimeService().deleteProcessInstance(execution.getProcessInstanceId(), - exception.getMessage()); + task.addOutput(responseGenerator.createOutput(target, responseCode, createErrorMessage(exception))); + updateLeadingTaskInExecutionVariables(task); } + super.handleSendTaskError(exception, errorMessage); } - private Target getTargetFromTargets(Targets targets, String organizationIdentifier) + @Override + protected void addErrorMessage(Task task, String errorMessage) { - return targets.getEntries().stream() - .filter(t -> organizationIdentifier.equals(t.getTargetOrganizationIdentifierValue())).findFirst() - .orElseThrow(); + // error message part of } - @Override - protected void addErrorMessageToLeadingTask(Task task, String errorMessage) + private String createErrorMessage(Exception exception) { - // Do noting because error is handled in "handleSendTaskError" + return exception.getClass().getSimpleName() + + ((exception.getMessage() != null && !exception.getMessage().isBlank()) + ? (": " + exception.getMessage()) + : ""); } } diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java index ed4cb84c..12594f95 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java @@ -4,9 +4,11 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_MISSING; +import java.util.Objects; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.util.PingResponseHelper; +import org.highmed.dsf.bpe.util.PingResponseGenerator; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -20,11 +22,22 @@ public class LogNoResponse extends AbstractServiceDelegate { private static final Logger logger = LoggerFactory.getLogger(LogNoResponse.class); + private final PingResponseGenerator responseGenerator; + public LogNoResponse(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper) + ReadAccessHelper readAccessHelper, PingResponseGenerator responseGenerator) { super(clientProvider, taskHelper, readAccessHelper); + this.responseGenerator = responseGenerator; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(responseGenerator, "responseGenerator"); } @Override @@ -40,10 +53,9 @@ public void doExecute(DelegateExecution execution) throws Exception private void logAndAddResponseToTask(Task task, Target target) { - // TODO: after new Target class is available, replace "endpoint-identifier" with actual value from target - logger.warn("PONG from organization {} (endpoint {}) missing", target.getTargetOrganizationIdentifierValue(), - "endpoint-identifier"); - PingResponseHelper.addResponseToTask(task, target.getTargetOrganizationIdentifierValue(), "endpoint-identifier", - CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_MISSING); + logger.warn("PONG from organization {} (endpoint {}) missing", target.getOrganizationIdentifierValue(), + target.getEndpointIdentifierValue()); + + task.addOutput(responseGenerator.createOutput(target, CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_MISSING)); } } diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java index 744d5686..e224f159 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java @@ -1,17 +1,21 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_LEADING_TASK; +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_RECEIVED; +import java.util.Objects; + import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.util.PingResponseHelper; +import org.highmed.dsf.bpe.util.PingResponseGenerator; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.Targets; +import org.highmed.dsf.fhir.variables.TargetsValues; import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,39 +24,43 @@ public class LogPong extends AbstractServiceDelegate { private static final Logger logger = LoggerFactory.getLogger(LogPong.class); + private final PingResponseGenerator responseGenerator; + public LogPong(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper) + ReadAccessHelper readAccessHelper, PingResponseGenerator responseGenerator) { super(clientProvider, taskHelper, readAccessHelper); + + this.responseGenerator = responseGenerator; } @Override - public void doExecute(DelegateExecution execution) + public void afterPropertiesSet() throws Exception { - Task current = getCurrentTaskFromExecutionVariables(); - Task leading = getLeadingTaskFromExecutionVariables(); + super.afterPropertiesSet(); - Targets targets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); - String organizationIdentifier = current.getRequester().getIdentifier().getValue(); + Objects.requireNonNull(responseGenerator, "responseGenerator"); + } - Target target = getTargetFromTargets(targets, organizationIdentifier); + @Override + public void doExecute(DelegateExecution execution) + { + Target target = getTarget(execution); - // TODO: after new Target class is available, replace "endpoint-identifier" with actual value from target - logger.info("PONG from {} (endpoint: {})", target.getTargetOrganizationIdentifierValue(), - "endpoint-identifier"); - PingResponseHelper.addResponseToTask(leading, target.getTargetOrganizationIdentifierValue(), - "endpoint-identifier", CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_RECEIVED); + logger.info("PONG from {} (endpoint: {})", target.getOrganizationIdentifierValue(), + target.getEndpointIdentifierValue()); + Task leading = getLeadingTaskFromExecutionVariables(); + leading.addOutput(responseGenerator.createOutput(target, CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_RECEIVED)); execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_TASK, leading); - targets.removeTarget(target); - execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, targets); + Targets targets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); + targets = targets.removeByEndpointIdentifierValue(target.getEndpointIdentifierValue()); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(targets)); } - private Target getTargetFromTargets(Targets targets, String organizationIdentifier) + private Target getTarget(DelegateExecution execution) { - return targets.getEntries().stream() - .filter(t -> organizationIdentifier.equals(t.getTargetOrganizationIdentifierValue())).findFirst() - .orElseThrow(); + return (Target) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGET); } } diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java index 3ebe86a0..9cfd44f7 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java @@ -1,32 +1,60 @@ package org.highmed.dsf.bpe.service; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS; +import java.util.Collections; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; +import java.util.Optional; import java.util.UUID; +import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.util.stream.Stream; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; -import org.highmed.dsf.fhir.organization.EndpointProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.Targets; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.r4.model.Endpoint; +import org.hl7.fhir.r4.model.Endpoint.EndpointStatus; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Resource; +import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; +import org.springframework.web.util.UriComponents; +import org.springframework.web.util.UriComponentsBuilder; public class SelectPingTargets extends AbstractServiceDelegate implements InitializingBean { - private final EndpointProvider endpointProvider; + private static final Logger logger = LoggerFactory.getLogger(SelectPingTargets.class); + + private final OrganizationProvider organizationProvider; + + private static final Pattern endpointResouceTypes = Pattern.compile( + "Endpoint|HealthcareService|ImagingStudy|InsurancePlan|Location|Organization|OrganizationAffiliation|PractitionerRole"); public SelectPingTargets(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper, EndpointProvider endpointProvider) + ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider) { super(clientProvider, taskHelper, readAccessHelper); - this.endpointProvider = endpointProvider; + this.organizationProvider = organizationProvider; } @Override @@ -34,19 +62,159 @@ public void afterPropertiesSet() throws Exception { super.afterPropertiesSet(); - Objects.requireNonNull(endpointProvider, "endpointProvider"); + Objects.requireNonNull(organizationProvider, "organizationProvider"); } @Override public void doExecute(DelegateExecution execution) throws Exception { - String localAddress = endpointProvider.getLocalEndpoint().getAddress(); + Task task = getLeadingTaskFromExecutionVariables(); + task.addOutput(getTaskHelper().createOutput(CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY, + execution.getBusinessKey())); + updateLeadingTaskInExecutionVariables(task); + + // String localAddress = endpointProvider.getLocalEndpoint().getAddress(); + // List<Target> targets = endpointProvider.getDefaultEndpointsByOrganizationIdentifier().entrySet().stream() + // .filter(a -> !localAddress.equals(a.getValue().getAddress())) + // .map(e -> Target.createBiDirectionalTarget(e.getKey(), + // e.getValue().getIdentifier().stream() + // .filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem())).findFirst() + // .map(Identifier::getValue).get(), + // e.getValue().getAddress(), UUID.randomUUID().toString())) + // .collect(Collectors.toList()); + + Stream<Endpoint> targetEndpoints = getTargetEndpointsSearchParameter().map(this::searchForEndpoints) + .orElse(allEndpoints()); + + Map<String, Identifier> organizationIdentifierByOrganizationId = organizationProvider.getRemoteOrganizations() + .stream() + .collect(Collectors.toMap(o -> o.getIdElement().getIdPart(), + o -> o.getIdentifier().stream() + .filter(i -> NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER.equals(i.getSystem())) + .findFirst().get())); + + Stream<Endpoint> remoteTargetEndpointsWithActiveOrganization = targetEndpoints + .filter(e -> getOrganizationIdentifier(e, organizationIdentifierByOrganizationId).isPresent()); - List<Target> targets = endpointProvider.getDefaultEndpointAdressesByOrganizationIdentifier().entrySet().stream() - .filter(a -> !localAddress.equals(a.getValue())) - .map(e -> Target.createBiDirectionalTarget(e.getKey(), e.getValue(), UUID.randomUUID().toString())) - .collect(Collectors.toList()); + + List<Target> targets = remoteTargetEndpointsWithActiveOrganization.map(e -> + { + String organizationIdentifier = getOrganizationIdentifier(e, organizationIdentifierByOrganizationId).get(); + String endpointIdentifier = getEndpointIdentifier(e).get(); + String endpointAddress = getEndpointAddress(e).get(); + return Target.createBiDirectionalTarget(organizationIdentifier, endpointIdentifier, endpointAddress, + UUID.randomUUID().toString()); + }).collect(Collectors.toList()); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, new Targets(targets)); } + + private Optional<UriComponents> getTargetEndpointsSearchParameter() + { + Task task = getLeadingTaskFromExecutionVariables(); + return getTaskHelper() + .getFirstInputParameterStringValue(task, CODESYSTEM_HIGHMED_PING, + CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS) + .map(requestUrl -> UriComponentsBuilder.fromUriString(requestUrl).build()); + } + + private Stream<Endpoint> searchForEndpoints(UriComponents searchParameters) + { + return searchForEndpoints(searchParameters, 1, 0); + } + + private Stream<Endpoint> searchForEndpoints(UriComponents searchParameters, int page, int currentTotal) + { + if (searchParameters.getPathSegments().isEmpty()) + return Stream.empty(); + + Optional<Class<? extends Resource>> resourceType = getResourceType(searchParameters); + if (resourceType.isEmpty()) + return Stream.empty(); + + Map<String, List<String>> queryParameters = new HashMap<String, List<String>>(); + queryParameters.putAll(searchParameters.getQueryParams()); + queryParameters.put("_page", Collections.singletonList(String.valueOf(page))); + + Bundle searchResult = getFhirWebserviceClientProvider().getLocalWebserviceClient() + .searchWithStrictHandling(resourceType.get(), queryParameters); + + if (searchResult.getTotal() > currentTotal + searchResult.getEntry().size()) + return Stream.concat(toEndpoints(searchResult), + searchForEndpoints(searchParameters, page + 1, currentTotal + searchResult.getEntry().size())); + else + return toEndpoints(searchResult); + } + + @SuppressWarnings("unchecked") + private Optional<Class<? extends Resource>> getResourceType(UriComponents searchParameters) + { + if (searchParameters.getPathSegments().isEmpty()) + return Optional.empty(); + + String type = searchParameters.getPathSegments().get(searchParameters.getPathSegments().size() - 1); + if (!endpointResouceTypes.matcher(type).matches()) + return Optional.empty(); + + try + { + return Optional.of((Class<? extends Resource>) Class.forName("org.hl7.fhir.r4.model." + type)); + } + catch (ClassNotFoundException e) + { + logger.error("Unable to find class for FHIR resource type " + type, e); + return Optional.empty(); + } + } + + private Stream<Endpoint> allEndpoints() + { + return allEndpoints(1, 0); + } + + private Stream<Endpoint> allEndpoints(int page, int currentTotal) + { + Bundle searchResult = getFhirWebserviceClientProvider().getLocalWebserviceClient() + .searchWithStrictHandling(Endpoint.class, Map.of("status", Collections.singletonList("active"), "_page", + Collections.singletonList(String.valueOf(page)))); + + if (searchResult.getTotal() > currentTotal + searchResult.getEntry().size()) + return Stream.concat(toEndpoints(searchResult), + allEndpoints(page + 1, currentTotal + searchResult.getEntry().size())); + else + return toEndpoints(searchResult); + } + + private Stream<Endpoint> toEndpoints(Bundle searchResult) + { + Objects.requireNonNull(searchResult, "searchResult"); + + return searchResult.getEntry().stream().filter(BundleEntryComponent::hasResource) + .filter(e -> e.getResource() instanceof Endpoint).map(e -> (Endpoint) e.getResource()) + .filter(Endpoint::hasStatus).filter(e -> EndpointStatus.ACTIVE.equals(e.getStatus())); + } + + private Optional<String> getOrganizationIdentifier(Endpoint endpoint, + Map<String, Identifier> organizationIdentifierByOrganizationId) + { + if (!endpoint.hasManagingOrganization() || !endpoint.getManagingOrganization().hasReferenceElement()) + return Optional.empty(); + + return Optional + .ofNullable(organizationIdentifierByOrganizationId + .get(endpoint.getManagingOrganization().getReferenceElement().getIdPart())) + .map(Identifier::getValue); + } + + private Optional<String> getEndpointIdentifier(Endpoint endpoint) + { + return endpoint.getIdentifier().stream() + .filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem())).findFirst() + .map(Identifier::getValue); + } + + private Optional<String> getEndpointAddress(Endpoint endpoint) + { + return endpoint.hasAddress() ? Optional.of(endpoint.getAddress()) : Optional.empty(); + } } diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPongTarget.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPongTarget.java index b064d657..427aacf6 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPongTarget.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPongTarget.java @@ -3,9 +3,12 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_ENDPOINT_IDENTIFIER; import java.util.Objects; +import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; @@ -15,11 +18,16 @@ import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.TargetValues; import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; public class SelectPongTarget extends AbstractServiceDelegate implements InitializingBean { + private static final Logger logger = LoggerFactory.getLogger(SelectPongTarget.class); + private final EndpointProvider endpointProvider; public SelectPongTarget(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, @@ -45,11 +53,28 @@ public void doExecute(DelegateExecution execution) throws Exception String correlationKey = getTaskHelper().getFirstInputParameterStringValue(task, CODESYSTEM_HIGHMED_BPMN, CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY).get(); - Identifier targetOrganizationIdentifier = task.getRequester().getIdentifier(); + String targetOrganizationIdentifierValue = task.getRequester().getIdentifier().getValue(); + String targetEndpointIdentifierValue = getEndpointIdentifierValue(task); + + String targetEndpointAddress = endpointProvider.getEndpointAddress(targetEndpointIdentifierValue) + .orElseThrow(() -> + { + logger.warn( + "Pong response target (organization {}, endpoint {}) not found locally or not active, not sending pong", + targetOrganizationIdentifierValue, targetEndpointIdentifierValue); + return new BpmnError("target_not_allowed"); + }); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, - TargetValues.create(Target.createBiDirectionalTarget(targetOrganizationIdentifier.getValue(), - endpointProvider.getFirstDefaultEndpointAddress(targetOrganizationIdentifier.getValue()).get(), - correlationKey))); + TargetValues.create(Target.createBiDirectionalTarget(targetOrganizationIdentifierValue, + targetEndpointIdentifierValue, targetEndpointAddress, correlationKey))); + } + + private String getEndpointIdentifierValue(Task task) + { + return getTaskHelper() + .getFirstInputParameterReferenceValue(task, CODESYSTEM_HIGHMED_PING, + CODESYSTEM_HIGHMED_PING_VALUE_ENDPOINT_IDENTIFIER) + .map(Reference::getIdentifier).map(Identifier::getValue).get(); } } diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java index 90bcdcc6..ab5a55ba 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java @@ -7,6 +7,7 @@ import org.highmed.dsf.bpe.service.LogPong; import org.highmed.dsf.bpe.service.SelectPingTargets; import org.highmed.dsf.bpe.service.SelectPongTarget; +import org.highmed.dsf.bpe.util.PingResponseGenerator; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.EndpointProvider; @@ -39,10 +40,17 @@ public class PingConfig @Autowired private FhirContext fhirContext; + @Bean + public PingResponseGenerator responseGenerator() + { + return new PingResponseGenerator(); + } + @Bean public SendPing sendPing() { - return new SendPing(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); + return new SendPing(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext, + endpointProvider, responseGenerator()); } @Bean @@ -60,19 +68,19 @@ public LogPing logPing() @Bean public LogPong logPong() { - return new LogPong(clientProvider, taskHelper, readAccessHelper); + return new LogPong(clientProvider, taskHelper, readAccessHelper, responseGenerator()); } @Bean public LogNoResponse logNoResponse() { - return new LogNoResponse(clientProvider, taskHelper, readAccessHelper); + return new LogNoResponse(clientProvider, taskHelper, readAccessHelper, responseGenerator()); } @Bean public SelectPingTargets selectPingTargets() { - return new SelectPingTargets(clientProvider, taskHelper, readAccessHelper, endpointProvider); + return new SelectPingTargets(clientProvider, taskHelper, readAccessHelper, organizationProvider); } @Bean diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseGenerator.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseGenerator.java new file mode 100644 index 00000000..b5171d2f --- /dev/null +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseGenerator.java @@ -0,0 +1,48 @@ +package org.highmed.dsf.bpe.util; + +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_PING_RESPONSE; +import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_CORRELATION_KEY; +import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_ERROR_MESSAGE; +import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_PING_RESPONSE; + +import org.highmed.dsf.fhir.variables.Target; +import org.hl7.fhir.r4.model.Coding; +import org.hl7.fhir.r4.model.Extension; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task.TaskOutputComponent; + +public class PingResponseGenerator +{ + public TaskOutputComponent createOutput(Target target, String pingResponseCode) + { + return createOutput(target, pingResponseCode, null); + } + + public TaskOutputComponent createOutput(Target target, String pingResponseCode, String errorMessage) + { + TaskOutputComponent output = new TaskOutputComponent(); + output.setValue(new Coding().setSystem(CODESYSTEM_HIGHMED_PING_RESPONSE).setCode(pingResponseCode)); + output.getType().addCoding().setSystem(CODESYSTEM_HIGHMED_PING) + .setCode(CODESYSTEM_HIGHMED_PING_VALUE_PING_RESPONSE); + + Extension extension = output.addExtension(); + extension.setUrl(EXTENSION_URL_PING_RESPONSE); + extension.addExtension(EXTENSION_URL_CORRELATION_KEY, new StringType(target.getCorrelationKey())); + extension.addExtension().setUrl(EXTENSION_URL_ORGANIZATION_IDENTIFIER) + .setValue(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(target.getOrganizationIdentifierValue())); + extension.addExtension().setUrl(EXTENSION_URL_ENDPOINT_IDENTIFIER).setValue(new Identifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER).setValue(target.getEndpointIdentifierValue())); + if (errorMessage != null) + extension.addExtension().setUrl(EXTENSION_URL_ERROR_MESSAGE).setValue(new StringType(errorMessage)); + + return output; + } +} diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseHelper.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseHelper.java deleted file mode 100644 index 102d4188..00000000 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseHelper.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.highmed.dsf.bpe.util; - -import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; -import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE; -import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_PING_RESPONSE; -import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER; - -import org.hl7.fhir.r4.model.Coding; -import org.hl7.fhir.r4.model.Task; - -public class PingResponseHelper -{ - public static void addResponseToTask(Task task, String organizationIdentifier, String endpointIdentifier, - String code) - { - Coding value = new Coding().setSystem(CODESYSTEM_HIGHMED_PING_RESPONSE).setCode(code); - value.addExtension().setUrl(EXTENSION_URL_ORGANIZATION_IDENTIFIER).setValue( - new Coding().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setCode(organizationIdentifier)); - value.addExtension().setUrl(EXTENSION_URL_ENDPOINT_IDENTIFIER) - .setValue(new Coding().setSystem(NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER).setCode(endpointIdentifier)); - - task.addOutput().setValue(value).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_PING) - .setCode(CODESYSTEM_HIGHMED_PING_VALUE_PING_RESPONSE); - } -} diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn index 2b40fe79..cdc14e85 100644 --- a/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn +++ b/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0azvmx1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_0azvmx1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.11.1"> <bpmn:process id="highmedorg_ping" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:sequenceFlow id="SequenceFlow_0k1j79c" sourceRef="StartEvent_1" targetRef="selectTargets" /> <bpmn:sequenceFlow id="SequenceFlow_05ia6lz" sourceRef="selectTargets" targetRef="sendPing" /> @@ -55,18 +55,18 @@ <bpmn:outgoing>SequenceFlow_0k1j79c</bpmn:outgoing> <bpmn:messageEventDefinition messageRef="Message_1pklz6t" /> </bpmn:startEvent> - <bpmn:boundaryEvent id="BoundaryEvent_0s1l6j2" attachedToRef="SubProcess_0szmntn"> - <bpmn:outgoing>Flow_1mpgmm5</bpmn:outgoing> - <bpmn:timerEventDefinition> - <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT5M</bpmn:timeDuration> - </bpmn:timerEventDefinition> - </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_0d1hhpd" sourceRef="logNoResponse" targetRef="EndEvent_1rdxonv" /> <bpmn:serviceTask id="logNoResponse" name="logNoResponse" camunda:class="org.highmed.dsf.bpe.service.LogNoResponse"> <bpmn:incoming>SequenceFlow_10d3jfk</bpmn:incoming> <bpmn:incoming>Flow_1mpgmm5</bpmn:incoming> <bpmn:outgoing>Flow_0d1hhpd</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:boundaryEvent id="BoundaryEvent_0s1l6j2" attachedToRef="SubProcess_0szmntn"> + <bpmn:outgoing>Flow_1mpgmm5</bpmn:outgoing> + <bpmn:timerEventDefinition> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT5M</bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_1mpgmm5" sourceRef="BoundaryEvent_0s1l6j2" targetRef="logNoResponse" /> </bpmn:process> <bpmn:message id="Message_10o3b8y" name="pongMessage" /> @@ -104,12 +104,6 @@ <bpmndi:BPMNShape id="SendTask_01t32b2_di" bpmnElement="sendPing"> <dc:Bounds x="420" y="80" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0byox2n_di" bpmnElement="logNoResponse"> - <dc:Bounds x="1170" y="80" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1rdxonv_di" bpmnElement="EndEvent_1rdxonv"> - <dc:Bounds x="1322" y="102" width="36" height="36" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_0szmntn_di" bpmnElement="SubProcess_0szmntn" isExpanded="true"> <dc:Bounds x="596" y="60" width="494" height="120" /> </bpmndi:BPMNShape> @@ -128,18 +122,24 @@ <bpmndi:BPMNShape id="StartEvent_18et3pb_di" bpmnElement="StartEvent_18et3pb"> <dc:Bounds x="616" y="102" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1yf8pjt_di" bpmnElement="EndEvent_1yf8pjt"> + <dc:Bounds x="1022" y="102" width="36" height="36" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ReceiveTask_1n4t6gv_di" bpmnElement="receivePong"> <dc:Bounds x="698" y="80" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1m8zy1k_di" bpmnElement="logPong"> <dc:Bounds x="870" y="80" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1yf8pjt_di" bpmnElement="EndEvent_1yf8pjt"> - <dc:Bounds x="1022" y="102" width="36" height="36" /> + <bpmndi:BPMNShape id="EndEvent_1rdxonv_di" bpmnElement="EndEvent_1rdxonv"> + <dc:Bounds x="1322" y="102" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_1dlqln5_di" bpmnElement="StartEvent_1"> <dc:Bounds x="152" y="102" width="36" height="36" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0byox2n_di" bpmnElement="logNoResponse"> + <dc:Bounds x="1170" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> <bpmndi:BPMNShape id="BoundaryEvent_0nix4ox_di" bpmnElement="BoundaryEvent_0s1l6j2"> <dc:Bounds x="1072" y="162" width="36" height="36" /> </bpmndi:BPMNShape> diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn index 651a63fd..6f4214b6 100644 --- a/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn +++ b/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_15v05m6" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.8.1"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_15v05m6" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.11.1"> <bpmn:process id="highmedorg_pong" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:startEvent id="StartEvent_1"> <bpmn:outgoing>SequenceFlow_07w11cw</bpmn:outgoing> @@ -27,9 +27,18 @@ <bpmn:outgoing>SequenceFlow_1ism9wt</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1ism9wt" sourceRef="selectTarget" targetRef="EndEvent_1ivxrjg" /> + <bpmn:endEvent id="Event_05zzvx3"> + <bpmn:incoming>Flow_0yr2pmf</bpmn:incoming> + </bpmn:endEvent> + <bpmn:boundaryEvent id="Event_1u9ooa5" name="target not allowed" attachedToRef="selectTarget"> + <bpmn:outgoing>Flow_0yr2pmf</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_0ty7e1r" errorRef="Error_1j0t9ud" /> + </bpmn:boundaryEvent> + <bpmn:sequenceFlow id="Flow_0yr2pmf" sourceRef="Event_1u9ooa5" targetRef="Event_05zzvx3" /> </bpmn:process> <bpmn:message id="Message_0u91abp" name="pingMessage" /> <bpmn:message id="Message_1h0kvyq" name="pong" /> + <bpmn:error id="Error_1j0t9ud" name="target_not_allowed" errorCode="target_not_allowed" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_pong"> <bpmndi:BPMNEdge id="SequenceFlow_1ism9wt_di" bpmnElement="SequenceFlow_1ism9wt"> @@ -44,6 +53,11 @@ <di:waypoint x="209" y="120" /> <di:waypoint x="262" y="120" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0yr2pmf_di" bpmnElement="Flow_0yr2pmf"> + <di:waypoint x="528" y="178" /> + <di:waypoint x="528" y="210" /> + <di:waypoint x="580" y="210" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="StartEvent_1"> <dc:Bounds x="173" y="102" width="36" height="36" /> </bpmndi:BPMNShape> @@ -56,6 +70,15 @@ <bpmndi:BPMNShape id="ServiceTask_0ko681m_di" bpmnElement="selectTarget"> <dc:Bounds x="428" y="80" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_05zzvx3_di" bpmnElement="Event_05zzvx3"> + <dc:Bounds x="580" y="192" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_143ftxn_di" bpmnElement="Event_1u9ooa5"> + <dc:Bounds x="510" y="142" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="547" y="173" width="86" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-response.xml b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-response.xml index 1185cb87..7251972b 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-response.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-response.xml @@ -16,7 +16,7 @@ <!-- date managed by bpe --> <date value="#{date}" /> <publisher value="HiGHmed" /> - <description value="CodeSystem with values of the ping response status" /> + <description value="CodeSystem with ping response status values" /> <caseSensitive value="true" /> <hierarchyMeaning value="grouped-by" /> <versionNeeded value="false" /> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml index 38e090ac..ed6bb209 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml @@ -24,6 +24,16 @@ <concept> <code value="ping-response" /> <display value="Ping Response" /> - <definition value="The response status of a pinged organization" /> + <definition value="Response status of a pinged organization" /> + </concept> + <concept> + <code value="endpoint-identifier" /> + <display value="Endpoint Identifier" /> + <definition value="Identifier of enpoint expecting pong (response) message" /> + </concept> + <concept> + <code value="target-endpoints" /> + <display value="Target Endpoints" /> + <definition value="Ping target endpoints, search query resulting in match or include results with Endpoint resources" /> </concept> </CodeSystem> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-extension-ping-response.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-extension-ping-response.xml new file mode 100644 index 00000000..794ff1d8 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-extension-ping-response.xml @@ -0,0 +1,134 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag"/> + <code value="ALL"/> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/extension-ping-response"/> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="PingResponse"/> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <fhirVersion value="4.0.1"/> + <kind value="complex-type"/> + <abstract value="false"/> + <context> + <type value="element"/> + <expression value="Task.output"/> + </context> + <type value="Extension"/> + <baseDefinition value="http://hl7.org/fhir/StructureDefinition/Extension"/> + <derivation value="constraint"/> + <differential> + <element id="Extension.extension"> + <path value="Extension.extension"/> + <slicing> + <discriminator> + <type value="value"/> + <path value="url"/> + </discriminator> + <rules value="open"/> + </slicing> + <min value="3"/> + </element> + <element id="Extension.extension:correlation-key"> + <path value="Extension.extension"/> + <sliceName value="correlation-key"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:correlation-key.url"> + <path value="Extension.extension.url"/> + <fixedUri value="correlation-key"/> + </element> + <element id="Extension.extension:correlation-key.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <type> + <code value="string"/> + </type> + </element> + <element id="Extension.extension:organization-identifier"> + <path value="Extension.extension"/> + <sliceName value="organization-identifier"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:organization-identifier.url"> + <path value="Extension.extension.url"/> + <fixedUri value="organization-identifier"/> + </element> + <element id="Extension.extension:organization-identifier.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <type> + <code value="Identifier"/> + </type> + </element> + <element id="Extension.extension:organization-identifier.value[x].system"> + <path value="Extension.extension.value[x].system"/> + <min value="1"/> + <fixedUri value="http://highmed.org/sid/organization-identifier"/> + </element> + <element id="Extension.extension:organization-identifier.value[x].value"> + <path value="Extension.extension.value[x].value"/> + <min value="1"/> + </element> + <element id="Extension.extension:endpoint-identifier"> + <path value="Extension.extension"/> + <sliceName value="endpoint-identifier"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Extension.extension:endpoint-identifier.url"> + <path value="Extension.extension.url"/> + <fixedUri value="endpoint-identifier"/> + </element> + <element id="Extension.extension:endpoint-identifier.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <type> + <code value="Identifier"/> + </type> + </element> + <element id="Extension.extension:endpoint-identifier.value[x].system"> + <path value="Extension.extension.value[x].system"/> + <min value="1"/> + <fixedUri value="http://highmed.org/sid/endpoint-identifier"/> + </element> + <element id="Extension.extension:endpoint-identifier.value[x].value"> + <path value="Extension.extension.value[x].value"/> + <min value="1"/> + </element> + <element id="Extension.extension:error-message"> + <path value="Extension.extension"/> + <sliceName value="error-message"/> + <min value="0"/> + <max value="1"/> + </element> + <element id="Extension.extension:error-message.url"> + <path value="Extension.extension.url"/> + <fixedUri value="error-message"/> + </element> + <element id="Extension.extension:error-message.value[x]"> + <path value="Extension.extension.value[x]"/> + <min value="1"/> + <type> + <code value="string"/> + </type> + </element> + <element id="Extension.url"> + <path value="Extension.url"/> + <fixedUri value="http://highmed.org/fhir/StructureDefinition/extension-ping-response"/> + </element> + <element id="Extension.value[x]"> + <path value="Extension.value[x]"/> + <max value="0"/> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml index ab9fedac..f84b270f 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml @@ -30,8 +30,8 @@ <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <min value="3" /> - <max value="3" /> + <min value="4" /> + <max value="4" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> @@ -60,5 +60,62 @@ <sliceName value="correlation-key" /> <min value="1" /> </element> + <element id="Task.input:endpoint-identifier"> + <path value="Task.input" /> + <sliceName value="endpoint-identifier" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:endpoint-identifier.type"> + <path value="Task.input.type" /> + <binding> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/ping" /> + </binding> + </element> + <element id="Task.input:endpoint-identifier.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:endpoint-identifier.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/ping" /> + </element> + <element id="Task.input:endpoint-identifier.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="endpoint-identifier" /> + </element> + <element id="Task.input:endpoint-identifier.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="Reference" /> + <targetProfile value="http://highmed.org/fhir/StructureDefinition/endpoint" /> + </type> + </element> + <element id="Task.input:endpoint-identifier.value[x].reference"> + <path value="Task.input.value[x].reference" /> + <min value="0" /> + </element> + <element id="Task.input:endpoint-identifier.value[x].type"> + <path value="Task.input.value[x].type" /> + <max value="1" /> + <fixedUri value="Endpoint" /> + </element> + <element id="Task.input:endpoint-identifier.value[x].identifier"> + <path value="Task.input.value[x].identifier" /> + <max value="1" /> + </element> + <element id="Task.input:endpoint-identifier.value[x].identifier.system"> + <path value="Task.input.value[x].identifier.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/sid/endpoint-identifier" /> + </element> + <element id="Task.input:endpoint-identifier.value[x].identifier.value"> + <path value="Task.input.value[x].identifier.value" /> + <min value="1" /> + </element> </differential> </StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml index 3de0a43c..19606643 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml @@ -30,7 +30,8 @@ <valueString value="Parameter" /> </extension> <path value="Task.input" /> - <max value="1" /> + <min value="1" /> + <max value="2" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> @@ -59,6 +60,46 @@ <sliceName value="correlation-key" /> <max value="0" /> </element> + <element id="Task.input:target-endpoints"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="target-endpoints" /> + <min value="0" /> + <max value="1" /> + </element> + <element id="Task.input:target-endpoints.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/ping" /> + </binding> + </element> + <element id="Task.input:target-endpoints.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:target-endpoints.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/ping" /> + </element> + <element id="Task.input:target-endpoints.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="target-endpoints" /> + </element> + <element id="Task.input:target-endpoints.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="string" /> + </type> + </element> <element id="Task.output:business-key-out"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> <valueString value="Parameter" /> @@ -98,5 +139,69 @@ <code value="string" /> </type> </element> + <element id="Task.output:ping-response"> + <path value="Task.output"/> + <sliceName value="ping-response"/> + </element> + <element id="Task.output:ping-response.extension"> + <path value="Task.output.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + </element> + <element id="Task.output:ping-response.extension:ping-response-extension"> + <path value="Task.output.extension" /> + <sliceName value="ping-response-extension" /> + <min value="1" /> + <type> + <code value="Extension" /> + <profile value="http://highmed.org/fhir/StructureDefinition/extension-ping-response" /> + </type> + </element> + <element id="Task.output:ping-response.type"> + <path value="Task.output.type"/> + <binding> + <strength value="required"/> + <valueSet value="http://highmed.org/fhir/ValueSet/ping"/> + </binding> + </element> + <element id="Task.output:ping-response.type.coding"> + <path value="Task.output.type.coding"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.output:ping-response.type.coding.system"> + <path value="Task.output.type.coding.system"/> + <min value="1"/> + <fixedUri value="http://highmed.org/fhir/CodeSystem/ping"/> + </element> + <element id="Task.output:ping-response.type.coding.code"> + <path value="Task.output.type.coding.code"/> + <min value="1"/> + <fixedCode value="ping-response"/> + </element> + <element id="Task.output:ping-response.value[x]"> + <path value="Task.output.value[x]"/> + <type> + <code value="Coding"/> + </type> + </element> + <element id="Task.output:ping-response.value[x].system"> + <path value="Task.output.value[x].system"/> + <min value="1"/> + <fixedUri value="http://highmed.org/fhir/CodeSystem/ping-response"/> + </element> + <element id="Task.output:ping-response.value[x].code"> + <path value="Task.output.value[x].code"/> + <min value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://highmed.org/fhir/ValueSet/ping-response"/> + </binding> + </element> </differential> </StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-response.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-response.xml index 79f5ff37..9fd30588 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-response.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-response.xml @@ -5,22 +5,22 @@ <code value="ALL" /> </tag> </meta> - <url value="http://highmed.org/fhir/ValueSet/ping" /> + <url value="http://highmed.org/fhir/ValueSet/ping-response" /> <!-- version managed by bpe --> <version value="#{version}" /> - <name value="HiGHmed_Ping" /> - <title value="HiGHmed Ping" /> + <name value="HiGHmed_Ping_Response" /> + <title value="HiGHmed Ping Response" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> <!-- date managed by bpe --> <date value="#{date}" /> <publisher value="HiGHmed" /> - <description value="ValueSet with standard values for the process ping" /> + <description value="ValueSet with ping response status values" /> <immutable value="true" /> <compose> <include> - <system value="http://highmed.org/fhir/CodeSystem/ping" /> + <system value="http://highmed.org/fhir/CodeSystem/ping-response" /> </include> </compose> </ValueSet> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java index fe2c9500..1e68345a 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java @@ -4,7 +4,12 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_ENDPOINT_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PING; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PING_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PING_PROCESS_URI_AND_LATEST_VERSION; @@ -21,9 +26,13 @@ import java.util.Date; import java.util.UUID; +import org.highmed.dsf.bpe.util.PingResponseGenerator; import org.highmed.dsf.fhir.validation.ResourceValidator; import org.highmed.dsf.fhir.validation.ResourceValidatorImpl; import org.highmed.dsf.fhir.validation.ValidationSupportRule; +import org.highmed.dsf.fhir.variables.Target; +import org.hl7.fhir.r4.model.Identifier; +import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.ResourceType; import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task; @@ -44,9 +53,11 @@ public class TaskProfileTest @ClassRule public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-task-start-ping-process.xml", "highmed-task-ping.xml", - "highmed-task-pong.xml"), - Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml"), - Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml")); + "highmed-task-pong.xml", "highmed-extension-ping-response.xml"), + Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", "highmed-ping.xml", + "highmed-ping-response.xml"), + Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", "highmed-ping.xml", + "highmed-ping-response.xml")); private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), validationRule.getValidationSupport()); @@ -64,7 +75,24 @@ public void testTaskStartPingProcessProfileValid() throws Exception } @Test - public void testTaskStartPingProcessProfileValidWithOutput() throws Exception + public void testTaskStartPingProcessProfileValidWithTargetEndpoints() throws Exception + { + Task task = createValidTaskStartPingProcess(); + task.addInput() + .setValue(new StringType( + "Endpoint?identifier=http://highmed.org/sid/endpoint-identifier|endpoint.target.org")) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_PING) + .setCode(CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + @Test + public void testTaskStartPingProcessProfileValidWithBuisnessKeyOutput() throws Exception { Task task = createValidTaskStartPingProcess(); task.addOutput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() @@ -77,6 +105,25 @@ public void testTaskStartPingProcessProfileValidWithOutput() throws Exception || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); } + @Test + public void testTaskStartPingProcessProfileValidWithBusinessKeyAndPingResponseOutput() throws Exception + { + Task task = createValidTaskStartPingProcess(); + task.addOutput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + + Target target = Target.createBiDirectionalTarget("target.org", "endpoint.target.org", + "https://endpoint.target.org/fhir", UUID.randomUUID().toString()); + task.addOutput(new PingResponseGenerator().createOutput(target, + CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE, "some error message")); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + @Test public void testTaskStartPingProcessProfileNotValid1() throws Exception { @@ -166,6 +213,12 @@ private Task createValidTaskPing() .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY); + task.addInput() + .setValue(new Reference().setIdentifier(new Identifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER).setValue("endpoint.org.com")) + .setType(ResourceType.Endpoint.name())) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_PING) + .setCode(CODESYSTEM_HIGHMED_PING_VALUE_ENDPOINT_IDENTIFIER); return task; } diff --git a/pom.xml b/pom.xml index 5cb7d3ab..a9be6e4e 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,6 @@ <dependencyManagement> <dependencies> - <!-- highmed-dsf --> <dependency> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-process-base</artifactId> @@ -124,6 +123,11 @@ <artifactId>jackson-annotations</artifactId> <version>2.13.2</version> </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>5.3.19</version> + </dependency> <!-- testing --> <dependency> From a04924f730569c8c2f7a90854873bfe33ef52f2a Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Mon, 2 May 2022 12:32:00 +0200 Subject: [PATCH 111/125] changes to remove deprecated code --- .../dsf/bpe/service/SelectRequestTargets.java | 34 +++++++++++++------ .../service/SelectResponseTargetMedic.java | 21 +++++++++--- .../bpe/service/SelectResponseTargetTtp.java | 24 +++++++++---- .../dsf/bpe/service/StoreCorrelationKeys.java | 2 +- .../message/SendSingleMedicResultShare.java | 2 +- .../CalculateSingleMedicResultShares.java | 2 +- .../SelectMultiMedicResultShareTarget.java | 22 ++++++++---- .../bpe/service/SelectMultiMedicTargets.java | 24 +++++++++---- .../SelectSingleMedicResultShareTargets.java | 23 +++++++++---- ...SingleMedicResultShareCorrelationKeys.java | 2 +- .../variables/TargetsSerializationTest.java | 9 ++--- .../dsf/bpe/service/SelectRequestTargets.java | 34 +++++++++++++------ .../service/SelectResponseTargetMedic.java | 21 +++++++++--- .../bpe/service/SelectResponseTargetTtp.java | 22 ++++++++---- .../dsf/bpe/service/StoreCorrelationKeys.java | 2 +- .../bpe/service/SelectResourceAndTargets.java | 24 ++++++++++--- 16 files changed, 191 insertions(+), 77 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index 6f62e62e..7ffa7d2e 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -6,6 +6,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; @@ -37,6 +38,7 @@ import org.highmed.dsf.fhir.variables.TargetValues; import org.highmed.dsf.fhir.variables.Targets; import org.highmed.dsf.fhir.variables.TargetsValues; +import org.hl7.fhir.r4.model.Endpoint; import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; @@ -107,11 +109,12 @@ private Targets getMedicTargets(ResearchStudy researchStudy) List<Target> targets = researchStudy.getExtensionsByUrl(ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC) .stream().filter(Extension::hasValue).map(Extension::getValue).filter(v -> v instanceof Reference) .map(v -> (Reference) v).filter(Reference::hasIdentifier).map(Reference::getIdentifier) - .filter(Identifier::hasValue).map(Identifier::getValue) - .map(medicIdentifier -> Target.createBiDirectionalTarget(medicIdentifier, - getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIdentifier), - UUID.randomUUID().toString())) - .collect(Collectors.toList()); + .filter(Identifier::hasValue).map(Identifier::getValue).map(medicIdentifier -> + { + Endpoint endpoint = getEndpoint(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIdentifier); + return Target.createBiDirectionalTarget(medicIdentifier, getEndpointIdentifierValue(endpoint), + endpoint.getAddress(), UUID.randomUUID().toString()); + }).collect(Collectors.toList()); return new Targets(targets); } @@ -121,20 +124,29 @@ private Target getTtpTarget(ResearchStudy researchStudy) return researchStudy.getExtensionsByUrl(ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP).stream() .filter(Extension::hasValue).map(Extension::getValue).filter(v -> v instanceof Reference) .map(v -> (Reference) v).filter(Reference::hasIdentifier).map(Reference::getIdentifier) - .filter(Identifier::hasValue).map(Identifier::getValue) - .map(ttpIdentifier -> Target.createUniDirectionalTarget(ttpIdentifier, - getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP, ttpIdentifier))) - .findFirst().get(); + .filter(Identifier::hasValue).map(Identifier::getValue).map(ttpIdentifier -> + { + Endpoint endpoint = getEndpoint(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP, ttpIdentifier); + return Target.createUniDirectionalTarget(ttpIdentifier, getEndpointIdentifierValue(endpoint), + endpoint.getAddress()); + }).findFirst().get(); } - private String getAddress(String role, String identifier) + private Endpoint getEndpoint(String role, String identifier) { return endpointProvider - .getFirstConsortiumEndpointAdress(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, + .getFirstConsortiumEndpoint(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, role, identifier) .get(); } + private String getEndpointIdentifierValue(Endpoint endpoint) + { + return endpoint.getIdentifier().stream() + .filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem())).findFirst() + .map(Identifier::getValue).get(); + } + private BloomFilterConfig createBloomFilterConfig() { return new BloomFilterConfig(random.nextLong(), hmacSha2Generator.generateKey(), diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java index a03e36f9..71139dee 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java @@ -3,6 +3,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import java.util.Objects; @@ -15,6 +16,8 @@ import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.TargetValues; +import org.hl7.fhir.r4.model.Endpoint; +import org.hl7.fhir.r4.model.Identifier; import org.springframework.beans.factory.InitializingBean; public class SelectResponseTargetMedic extends AbstractServiceDelegate implements InitializingBean @@ -42,12 +45,20 @@ protected void doExecute(DelegateExecution execution) throws Exception { String medicIndentifier = getLeadingTaskFromExecutionVariables().getRequester().getIdentifier().getValue(); - Target medicTarget = Target.createUniDirectionalTarget(medicIndentifier, - endpointProvider.getFirstConsortiumEndpointAdress( - NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, - CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, - medicIndentifier).get()); + Endpoint endpoint = endpointProvider.getFirstConsortiumEndpoint( + NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIndentifier).get(); + + Target medicTarget = Target.createUniDirectionalTarget(medicIndentifier, getEndpointIdentifierValue(endpoint), + endpoint.getAddress()); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(medicTarget)); } + + private String getEndpointIdentifierValue(Endpoint endpoint) + { + return endpoint.getIdentifier().stream() + .filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem())).findFirst() + .map(Identifier::getValue).get(); + } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java index f36a0d2a..4b4a6eb2 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java @@ -6,6 +6,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import java.util.Objects; @@ -18,6 +19,8 @@ import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.TargetValues; +import org.hl7.fhir.r4.model.Endpoint; +import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Task; public class SelectResponseTargetTtp extends AbstractServiceDelegate @@ -45,12 +48,14 @@ protected void doExecute(DelegateExecution execution) { String ttpIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); String correlationKey = getCorrelationKey(); - Target ttpTarget = Target.createBiDirectionalTarget(ttpIdentifier, - endpointProvider.getFirstConsortiumEndpointAdress( - NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, - CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP, - ttpIdentifier).get(), - correlationKey); + + Endpoint endpoint = endpointProvider.getFirstConsortiumEndpoint( + NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP, ttpIdentifier).get(); + + Target ttpTarget = Target.createBiDirectionalTarget(ttpIdentifier, getEndpointIdentifierValue(endpoint), + endpoint.getAddress(), correlationKey); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(ttpTarget)); } @@ -63,4 +68,11 @@ private String getCorrelationKey() .orElseThrow(() -> new IllegalStateException( "No correlation key found, this error should have been caught by resource validation")); } + + private String getEndpointIdentifierValue(Endpoint endpoint) + { + return endpoint.getIdentifier().stream() + .filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem())).findFirst() + .map(Identifier::getValue).get(); + } } diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java index cc4fcdb3..ba50f5bd 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java @@ -73,7 +73,7 @@ private Targets getTargets(Task task) List<Target> targets = getTaskHelper() .getInputParameterStringValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY) - .map(correlationKey -> Target.createBiDirectionalTarget("", "", correlationKey)) + .map(correlationKey -> Target.createBiDirectionalTarget("", "", "", correlationKey)) .collect(Collectors.toList()); return new Targets(targets); diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java index 9f9481d8..46bfcd2b 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/message/SendSingleMedicResultShare.java @@ -33,7 +33,7 @@ public SendSingleMedicResultShare(FhirWebserviceClientProvider clientProvider, T @Override protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) { - String targetIdentifier = getTarget(execution).getTargetOrganizationIdentifierValue(); + String targetIdentifier = getTarget().getOrganizationIdentifierValue(); QueryResults shares = (QueryResults) execution .getVariable(BPMN_EXECUTION_VARIABLE_QUERY_RESULTS_SINGLE_MEDIC_SHARES); diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java index 9b45f063..f256ce32 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/CalculateSingleMedicResultShares.java @@ -65,7 +65,7 @@ private Stream<QueryResult> toArithmeticSharesForCohortAndOrganization(QueryResu throw new IllegalStateException("Number of shares does not match number of targets"); return IntStream.range(0, numParties) - .mapToObj(i -> QueryResult.mpcCountResult(organizations.get(i).getTargetOrganizationIdentifierValue(), + .mapToObj(i -> QueryResult.mpcCountResult(organizations.get(i).getOrganizationIdentifierValue(), queryResult.getCohortId(), shares[i].getValue().intValueExact())); } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTarget.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTarget.java index d3f70365..b092ddcc 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTarget.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTarget.java @@ -3,6 +3,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_CORRELATION_KEY; @@ -16,6 +17,8 @@ import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.TargetValues; +import org.hl7.fhir.r4.model.Endpoint; +import org.hl7.fhir.r4.model.Identifier; import org.springframework.beans.factory.InitializingBean; public class SelectMultiMedicResultShareTarget extends AbstractServiceDelegate implements InitializingBean @@ -44,13 +47,20 @@ protected void doExecute(DelegateExecution execution) throws Exception String identifier = getLeadingTaskFromExecutionVariables().getRequester().getIdentifier().getValue(); String correlationKey = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_CORRELATION_KEY); - Target medicTarget = Target.createBiDirectionalTarget(identifier, - endpointProvider.getFirstConsortiumEndpointAdress( - NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, - CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, - identifier).get(), - correlationKey); + Endpoint endpoint = endpointProvider.getFirstConsortiumEndpoint( + NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, identifier).get(); + + Target medicTarget = Target.createBiDirectionalTarget(identifier, getEndpointIdentifierValue(endpoint), + endpoint.getAddress(), correlationKey); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(medicTarget)); } + + private String getEndpointIdentifierValue(Endpoint endpoint) + { + return endpoint.getIdentifier().stream() + .filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem())).findFirst() + .map(Identifier::getValue).get(); + } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicTargets.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicTargets.java index 2b2b5400..6a6d02f0 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicTargets.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicTargets.java @@ -4,6 +4,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; @@ -21,6 +22,7 @@ import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.Targets; import org.highmed.dsf.fhir.variables.TargetsValues; +import org.hl7.fhir.r4.model.Endpoint; import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; @@ -60,20 +62,28 @@ private Targets getTargets(ResearchStudy researchStudy) List<Target> targets = researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).stream() .filter(Extension::hasValue).map(Extension::getValue).filter(v -> v instanceof Reference) .map(v -> (Reference) v).filter(Reference::hasIdentifier).map(Reference::getIdentifier) - .filter(Identifier::hasValue).map(Identifier::getValue) - .map(medicIdentifier -> Target.createBiDirectionalTarget(medicIdentifier, - getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIdentifier), - UUID.randomUUID().toString())) - .collect(Collectors.toList()); + .filter(Identifier::hasValue).map(Identifier::getValue).map(medicIdentifier -> + { + Endpoint endpoint = getEndpoint(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIdentifier); + return Target.createBiDirectionalTarget(medicIdentifier, getEndpointIdentifierValue(endpoint), + endpoint.getAddress(), UUID.randomUUID().toString()); + }).collect(Collectors.toList()); return new Targets(targets); } - private String getAddress(String role, String identifier) + private Endpoint getEndpoint(String role, String identifier) { return endpointProvider - .getFirstConsortiumEndpointAdress(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, + .getFirstConsortiumEndpoint(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, role, identifier) .get(); } + + private String getEndpointIdentifierValue(Endpoint endpoint) + { + return endpoint.getIdentifier().stream() + .filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem())).findFirst() + .map(Identifier::getValue).get(); + } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectSingleMedicResultShareTargets.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectSingleMedicResultShareTargets.java index b03af4e3..f460290f 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectSingleMedicResultShareTargets.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectSingleMedicResultShareTargets.java @@ -4,6 +4,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_RESEARCH_STUDY; import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.BPMN_EXECUTION_VARIABLE_CORRELATION_KEY; @@ -21,6 +22,7 @@ import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.Targets; import org.highmed.dsf.fhir.variables.TargetsValues; +import org.hl7.fhir.r4.model.Endpoint; import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; @@ -61,19 +63,28 @@ private Targets getTargets(ResearchStudy researchStudy, String correlationKey) List<Target> targets = researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).stream() .filter(Extension::hasValue).map(Extension::getValue).filter(v -> v instanceof Reference) .map(v -> (Reference) v).filter(Reference::hasIdentifier).map(Reference::getIdentifier) - .filter(Identifier::hasValue).map(Identifier::getValue) - .map(medicIdentifier -> Target.createBiDirectionalTarget(medicIdentifier, - getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIdentifier), correlationKey)) - .collect(Collectors.toList()); + .filter(Identifier::hasValue).map(Identifier::getValue).map(medicIdentifier -> + { + Endpoint endpoint = getEndpoint(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIdentifier); + return Target.createBiDirectionalTarget(medicIdentifier, getEndpointIdentifierValue(endpoint), + endpoint.getAddress(), correlationKey); + }).collect(Collectors.toList()); return new Targets(targets); } - private String getAddress(String role, String identifier) + private Endpoint getEndpoint(String role, String identifier) { return endpointProvider - .getFirstConsortiumEndpointAdress(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, + .getFirstConsortiumEndpoint(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, role, identifier) .get(); } + + private String getEndpointIdentifierValue(Endpoint endpoint) + { + return endpoint.getIdentifier().stream() + .filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem())).findFirst() + .map(Identifier::getValue).get(); + } } diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java index 15f4b043..daae0bcf 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/StoreSingleMedicResultShareCorrelationKeys.java @@ -51,7 +51,7 @@ private Targets getTargets(Task task) List<Target> targets = getTaskHelper() .getInputParameterStringValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY) - .map(correlationKey -> Target.createBiDirectionalTarget("", "", correlationKey)) + .map(correlationKey -> Target.createBiDirectionalTarget("", "", "", correlationKey)) .collect(Collectors.toList()); return new Targets(targets); diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/variables/TargetsSerializationTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/variables/TargetsSerializationTest.java index f5bc973b..36c94b9a 100644 --- a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/variables/TargetsSerializationTest.java +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/variables/TargetsSerializationTest.java @@ -25,7 +25,8 @@ public void serializeDeserializeTargets() throws Exception { ObjectMapper objectMapper = ObjectMapperFactory.createObjectMapper(FhirContext.forR4()); - Target target = Target.createUniDirectionalTarget("identifier", "endpoint"); + Target target = Target.createUniDirectionalTarget("target.org", "endpoint.target.org", + "https://endpoint.target.org/fhir"); Targets targets = new Targets(List.of(target)); String serialized = objectMapper.writeValueAsString(targets); @@ -37,9 +38,9 @@ public void serializeDeserializeTargets() throws Exception assertNotNull(deserialized); assertEquals(1, deserialized.getEntries().size()); assertNotNull(deserialized.getEntries().get(0)); - assertEquals(deserialized.getEntries().get(0).getTargetOrganizationIdentifierValue(), - target.getTargetOrganizationIdentifierValue()); - assertEquals(deserialized.getEntries().get(0).getTargetEndpointUrl(), target.getTargetEndpointUrl()); + assertEquals(deserialized.getEntries().get(0).getOrganizationIdentifierValue(), + target.getOrganizationIdentifierValue()); + assertEquals(deserialized.getEntries().get(0).getEndpointUrl(), target.getEndpointUrl()); assertEquals(deserialized.getEntries().get(0).getCorrelationKey(), target.getCorrelationKey()); } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index 995668cf..a593364f 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -7,6 +7,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.EXTENSION_HIGHMED_PARTICIPATING_TTP; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; @@ -35,6 +36,7 @@ import org.highmed.dsf.fhir.variables.TargetValues; import org.highmed.dsf.fhir.variables.Targets; import org.highmed.dsf.fhir.variables.TargetsValues; +import org.hl7.fhir.r4.model.Endpoint; import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; @@ -104,11 +106,12 @@ private Targets getMedicTargets(ResearchStudy researchStudy) List<Target> targets = researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_MEDIC).stream() .filter(Extension::hasValue).map(Extension::getValue).filter(v -> v instanceof Reference) .map(v -> (Reference) v).filter(Reference::hasIdentifier).map(Reference::getIdentifier) - .filter(Identifier::hasValue).map(Identifier::getValue) - .map(medicIdentifier -> Target.createBiDirectionalTarget(medicIdentifier, - getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIdentifier), - UUID.randomUUID().toString())) - .collect(Collectors.toList()); + .filter(Identifier::hasValue).map(Identifier::getValue).map(medicIdentifier -> + { + Endpoint endpoint = getEndpoint(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIdentifier); + return Target.createBiDirectionalTarget(medicIdentifier, getEndpointIdentifierValue(endpoint), + endpoint.getAddress(), UUID.randomUUID().toString()); + }).collect(Collectors.toList()); return new Targets(targets); } @@ -118,17 +121,26 @@ private Target getTtpTarget(ResearchStudy researchStudy) return researchStudy.getExtensionsByUrl(EXTENSION_HIGHMED_PARTICIPATING_TTP).stream() .filter(Extension::hasValue).map(Extension::getValue).filter(v -> v instanceof Reference) .map(v -> (Reference) v).filter(Reference::hasIdentifier).map(Reference::getIdentifier) - .filter(Identifier::hasValue).map(Identifier::getValue) - .map(ttpIdentifier -> Target.createUniDirectionalTarget(ttpIdentifier, - getAddress(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP, ttpIdentifier))) - .findFirst().get(); + .filter(Identifier::hasValue).map(Identifier::getValue).map(ttpIdentifier -> + { + Endpoint endpoint = getEndpoint(CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP, ttpIdentifier); + return Target.createUniDirectionalTarget(ttpIdentifier, getEndpointIdentifierValue(endpoint), + endpoint.getAddress()); + }).findFirst().get(); } - private String getAddress(String role, String identifier) + private Endpoint getEndpoint(String role, String identifier) { return endpointProvider - .getFirstConsortiumEndpointAdress(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, + .getFirstConsortiumEndpoint(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, role, identifier) .get(); } + + private String getEndpointIdentifierValue(Endpoint endpoint) + { + return endpoint.getIdentifier().stream() + .filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem())).findFirst() + .map(Identifier::getValue).get(); + } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java index a03e36f9..71139dee 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetMedic.java @@ -3,6 +3,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import java.util.Objects; @@ -15,6 +16,8 @@ import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.TargetValues; +import org.hl7.fhir.r4.model.Endpoint; +import org.hl7.fhir.r4.model.Identifier; import org.springframework.beans.factory.InitializingBean; public class SelectResponseTargetMedic extends AbstractServiceDelegate implements InitializingBean @@ -42,12 +45,20 @@ protected void doExecute(DelegateExecution execution) throws Exception { String medicIndentifier = getLeadingTaskFromExecutionVariables().getRequester().getIdentifier().getValue(); - Target medicTarget = Target.createUniDirectionalTarget(medicIndentifier, - endpointProvider.getFirstConsortiumEndpointAdress( - NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, - CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, - medicIndentifier).get()); + Endpoint endpoint = endpointProvider.getFirstConsortiumEndpoint( + NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, medicIndentifier).get(); + + Target medicTarget = Target.createUniDirectionalTarget(medicIndentifier, getEndpointIdentifierValue(endpoint), + endpoint.getAddress()); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(medicTarget)); } + + private String getEndpointIdentifierValue(Endpoint endpoint) + { + return endpoint.getIdentifier().stream() + .filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem())).findFirst() + .map(Identifier::getValue).get(); + } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java index 4c19f88c..fa1c418a 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java @@ -6,6 +6,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import java.util.Objects; @@ -18,6 +19,8 @@ import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.TargetValues; +import org.hl7.fhir.r4.model.Endpoint; +import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Task; import org.springframework.beans.factory.InitializingBean; @@ -47,12 +50,12 @@ protected void doExecute(DelegateExecution execution) throws Exception String ttpIdentifier = (String) execution.getVariable(BPMN_EXECUTION_VARIABLE_TTP_IDENTIFIER); String correlationKey = getCorrelationKey(execution); - Target ttpTarget = Target.createBiDirectionalTarget(ttpIdentifier, - endpointProvider.getFirstConsortiumEndpointAdress( - NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, - CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP, - ttpIdentifier).get(), - correlationKey); + Endpoint endpoint = endpointProvider.getFirstConsortiumEndpoint( + NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, + CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP, ttpIdentifier).get(); + + Target ttpTarget = Target.createBiDirectionalTarget(ttpIdentifier, getEndpointIdentifierValue(endpoint), + endpoint.getAddress(), correlationKey); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create(ttpTarget)); } @@ -67,4 +70,11 @@ private String getCorrelationKey(DelegateExecution execution) .orElseThrow(() -> new IllegalStateException( "No correlation key found, this error should have been caught by resource validation")); } + + private String getEndpointIdentifierValue(Endpoint endpoint) + { + return endpoint.getIdentifier().stream() + .filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem())).findFirst() + .map(Identifier::getValue).get(); + } } diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java index 64407fab..0eeb37a3 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/StoreCorrelationKeys.java @@ -38,7 +38,7 @@ protected void doExecute(DelegateExecution execution) throws Exception List<Target> targets = getTaskHelper() .getInputParameterStringValues(task, CODESYSTEM_HIGHMED_DATA_SHARING, CODESYSTEM_HIGHMED_DATA_SHARING_VALUE_PARTICIPATING_MEDIC_CORRELATION_KEY) - .map(correlationKey -> Target.createBiDirectionalTarget("", "", correlationKey)) + .map(correlationKey -> Target.createBiDirectionalTarget("", "", "", correlationKey)) .collect(Collectors.toList()); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(new Targets(targets))); diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/SelectResourceAndTargets.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/SelectResourceAndTargets.java index 17410614..b825b119 100644 --- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/SelectResourceAndTargets.java +++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/service/SelectResourceAndTargets.java @@ -2,12 +2,14 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_BUNDLE_ID; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE; import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_BUNDLE_REFERENCE; import static org.highmed.dsf.bpe.ConstantsUpdateResources.CODESYSTEM_HIGHMED_UPDATE_RESOURCE_VALUE_ORGANIZATION_IDENTIFIER_SEARCH_PARAMETER; import java.util.List; import java.util.Objects; +import java.util.Optional; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -22,6 +24,7 @@ import org.highmed.dsf.fhir.variables.Targets; import org.highmed.dsf.fhir.variables.TargetsValues; import org.hl7.fhir.r4.model.Endpoint; +import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; @@ -85,11 +88,22 @@ else if (!BUNDLE_ID_PATTERN.matcher(references.get(0).getReference()).matches()) .collect(Collectors.toList()); List<Target> targets = targetIdentifierSearchParameters.stream() - .flatMap(organizationProvider::searchRemoteOrganizationsIdentifiers) - .map(identifier -> Target.createUniDirectionalTarget(identifier.getValue(), - endpointProvider.getFirstDefaultEndpoint(identifier.getValue()).filter(Endpoint::hasAddress) - .map(Endpoint::getAddress).orElse(null))) - .filter(t -> t.getTargetEndpointUrl() != null).collect(Collectors.toList()); + .flatMap(organizationProvider::searchRemoteOrganizationsIdentifiers).map(identifier -> + { + Optional<Endpoint> endpoint = endpointProvider.getFirstDefaultEndpoint(identifier.getValue()); + return Target.createUniDirectionalTarget(identifier.getValue(), + getEndpointIdentifierValue(endpoint).orElse(null), + endpoint.filter(Endpoint::hasAddress).map(Endpoint::getAddress).orElse(null)); + }).filter(t -> t.getEndpointIdentifierValue() != null && t.getEndpointUrl() != null) + .collect(Collectors.toList()); execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(new Targets(targets))); } + + private Optional<String> getEndpointIdentifierValue(Optional<Endpoint> endpoint) + { + return endpoint + .flatMap(e -> e.getIdentifier().stream() + .filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem())).findFirst()) + .map(Identifier::getValue); + } } From 99ef38291897cd5194ba20da3ded5b8c6aa44e34 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Mon, 2 May 2022 13:51:08 +0200 Subject: [PATCH 112/125] code formatting --- .../java/org/highmed/dsf/bpe/service/SelectRequestTargets.java | 2 +- .../dsf/bpe/service/SelectMultiMedicResultShareTarget.java | 2 +- .../org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java index 7ffa7d2e..85cfa16a 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/service/SelectRequestTargets.java @@ -5,8 +5,8 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP; -import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_BLOOM_FILTER_CONFIG; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_MDAT_AES_KEY; import static org.highmed.dsf.bpe.ConstantsDataSharing.BPMN_EXECUTION_VARIABLE_NEEDS_RECORD_LINKAGE; diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTarget.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTarget.java index b092ddcc..539665fd 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTarget.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/service/SelectMultiMedicResultShareTarget.java @@ -50,7 +50,7 @@ protected void doExecute(DelegateExecution execution) throws Exception Endpoint endpoint = endpointProvider.getFirstConsortiumEndpoint( NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC, identifier).get(); - + Target medicTarget = Target.createBiDirectionalTarget(identifier, getEndpointIdentifierValue(endpoint), endpoint.getAddress(), correlationKey); diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java index fa1c418a..a4e5c987 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/service/SelectResponseTargetTtp.java @@ -53,7 +53,7 @@ protected void doExecute(DelegateExecution execution) throws Exception Endpoint endpoint = endpointProvider.getFirstConsortiumEndpoint( NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_HIGHMED_CONSORTIUM, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE, CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP, ttpIdentifier).get(); - + Target ttpTarget = Target.createBiDirectionalTarget(ttpIdentifier, getEndpointIdentifierValue(endpoint), endpoint.getAddress(), correlationKey); From d2301df3094a72290ba5f068c2a1e92b39d89a48 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 2 May 2022 16:27:37 +0200 Subject: [PATCH 113/125] add autostart functionality --- .../org/highmed/dsf/bpe/ConstantsPing.java | 21 ++ .../dsf/bpe/PingProcessPluginDefinition.java | 11 +- .../dsf/bpe/message/SendStartPing.java | 34 +++ .../dsf/bpe/service/SelectPingTargets.java | 1 - .../highmed/dsf/bpe/service/StartTimer.java | 61 +++++ .../highmed/dsf/bpe/service/StopTimer.java | 30 +++ .../dsf/bpe/spring/config/PingConfig.java | 21 ++ .../src/main/resources/bpe/autostart.bpmn | 241 ++++++++++++++++++ .../ActivityDefinition/highmed-autostart.xml | 69 +++++ .../fhir/CodeSystem/highmed-ping.xml | 7 +- .../highmed-task-start-autostart.xml | 144 +++++++++++ .../highmed-task-start-ping-process.xml | 10 +- .../highmed-task-stop-autostart.xml | 64 +++++ ...ostartPing3MedicFromTtpExampleStarter.java | 60 +++++ ...ostartPing3MedicFromTtpExampleStarter.java | 51 ++++ ...Ping3MedicFromTtpDockerExampleStarter.java | 16 ++ ...ostartPing3MedicFromTtpExampleStarter.java | 15 ++ ...Ping3MedicFromTtpDockerExampleStarter.java | 16 ++ ...ostartPing3MedicFromTtpExampleStarter.java | 15 ++ .../ActivityDefinitionProfileTest.java | 15 ++ .../dsf/fhir/profiles/TaskProfileTest.java | 107 +++++++- 21 files changed, 995 insertions(+), 14 deletions(-) create mode 100644 dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendStartPing.java create mode 100644 dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StartTimer.java create mode 100644 dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StopTimer.java create mode 100644 dsf-bpe-process-ping/src/main/resources/bpe/autostart.bpmn create mode 100644 dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-autostart.xml create mode 100644 dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-autostart.xml create mode 100644 dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-stop-autostart.xml create mode 100644 dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStartAutostartPing3MedicFromTtpExampleStarter.java create mode 100644 dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStopAutostartPing3MedicFromTtpExampleStarter.java create mode 100644 dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StartAutostartPing3MedicFromTtpDockerExampleStarter.java create mode 100644 dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StartAutostartPing3MedicFromTtpExampleStarter.java create mode 100644 dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StopAutostartPing3MedicFromTtpDockerExampleStarter.java create mode 100644 dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StopAutostartPing3MedicFromTtpExampleStarter.java diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java index 9d86687a..87dc9a4b 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java @@ -5,6 +5,21 @@ public interface ConstantsPing { + String PROFILE_HIGHMED_TASK_START_AUTOSTART = "http://highmed.org/fhir/StructureDefinition/task-start-autostart-ping-process"; + String PROFILE_HIGHMED_TASK_START_AUTOSTART_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_START_AUTOSTART + "|" + + VERSION; + String PROFILE_HIGHMED_TASK_START_AUTOSTART_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "autostartPing/"; + String PROFILE_HIGHMED_TASK_START_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_START_AUTOSTART_PROCESS_URI + + VERSION; + String PROFILE_HIGHMED_TASK_START_AUTOSTART_MESSAGE_NAME = "startAutostartPingProcessMessage"; + + String PROFILE_HIGHMED_TASK_STOP_AUTOSTART = "http://highmed.org/fhir/StructureDefinition/task-stop-autostart-ping-process"; + String PROFILE_HIGHMED_TASK_STOP_AUTOSTART_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_STOP_AUTOSTART + "|" + VERSION; + String PROFILE_HIGHMED_TASK_STOP_AUTOSTART_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "autostartPing/"; + String PROFILE_HIGHMED_TASK_STOP_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_STOP_AUTOSTART_PROCESS_URI + + VERSION; + String PROFILE_HIGHMED_TASK_STOP_AUTOSTART_MESSAGE_NAME = "stopAutostartPingProcessMessage"; + String PROFILE_HIGHMED_TASK_START_PING = "http://highmed.org/fhir/StructureDefinition/task-start-ping-process"; String PROFILE_HIGHMED_TASK_START_PING_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_START_PING + "|" + VERSION; String PROFILE_HIGHMED_TASK_START_PING_MESSAGE_NAME = "startPingProcessMessage"; @@ -25,6 +40,7 @@ public interface ConstantsPing String CODESYSTEM_HIGHMED_PING_VALUE_PING_RESPONSE = "ping-response"; String CODESYSTEM_HIGHMED_PING_VALUE_ENDPOINT_IDENTIFIER = "endpoint-identifier"; String CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS = "target-endpoints"; + String CODESYSTEM_HIGHMED_PING_VALUE_TIMER_INTERVAL = "timer-interval"; String CODESYSTEM_HIGHMED_PING_RESPONSE = "http://highmed.org/fhir/CodeSystem/ping-response"; String CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_RECEIVED = "received"; @@ -37,4 +53,9 @@ public interface ConstantsPing String EXTENSION_URL_ORGANIZATION_IDENTIFIER = "organization-identifier"; String EXTENSION_URL_ENDPOINT_IDENTIFIER = "endpoint-identifier"; String EXTENSION_URL_ERROR_MESSAGE = "error-message"; + + String BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL = "timerInterval"; + String BPMN_EXECUTION_VARIABLE_STOP_TIMER = "stopTimer"; + + String TIMER_INTERVAL_DEFAULT_VALUE = "PT24H"; } diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java index 5990f9c5..5b72bb92 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java @@ -43,7 +43,7 @@ public LocalDate getReleaseDate() @Override public Stream<String> getBpmnFiles() { - return Stream.of("bpe/ping.bpmn", "bpe/pong.bpmn"); + return Stream.of("bpe/autostart.bpmn", "bpe/ping.bpmn", "bpe/pong.bpmn"); } @Override @@ -56,9 +56,14 @@ public Stream<Class<?>> getSpringConfigClasses() public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader, PropertyResolver resolver) { + var aAutostart = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-autostart.xml"); var aPing = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-ping.xml"); var aPong = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-pong.xml"); + var tStartAutostart = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-start-autostart.xml"); + var tStopAutostart = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-stop-autostart.xml"); var tStartPing = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-start-ping-process.xml"); var tPong = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-pong.xml"); @@ -72,7 +77,9 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var vPing = ValueSetResource.file("fhir/ValueSet/highmed-ping.xml"); var vPingResponse = ValueSetResource.file("fhir/ValueSet/highmed-ping-response.xml"); - Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of("highmedorg_ping/" + VERSION, + Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( + "highmedorg_autostartPing/" + VERSION, + Arrays.asList(aAutostart, tStartAutostart, tStopAutostart, cPing, vPing), "highmedorg_ping/" + VERSION, Arrays.asList(aPing, tStartPing, ePingResponse, tPong, cPing, cPingResponse, vPing, vPingResponse), "highmedorg_pong/" + VERSION, Arrays.asList(aPong, tPing)); diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendStartPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendStartPing.java new file mode 100644 index 00000000..ae056fa9 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendStartPing.java @@ -0,0 +1,34 @@ +package org.highmed.dsf.bpe.message; + +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS; + +import java.util.stream.Stream; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.hl7.fhir.r4.model.Task; + +import ca.uhn.fhir.context.FhirContext; + +public class SendStartPing extends AbstractTaskMessageSend +{ + public SendStartPing(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) + { + super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); + } + + @Override + protected Stream<Task.ParameterComponent> getAdditionalInputParameters(DelegateExecution execution) + { + return getLeadingTaskFromExecutionVariables().getInput().stream().filter(Task.ParameterComponent::hasType) + .filter(i -> i.getType().getCoding().stream() + .anyMatch(c -> CODESYSTEM_HIGHMED_PING.equals(c.getSystem()) + && CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS.equals(c.getCode()))); + } +} diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java index 9cfd44f7..f0dd4333 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java @@ -96,7 +96,6 @@ public void doExecute(DelegateExecution execution) throws Exception Stream<Endpoint> remoteTargetEndpointsWithActiveOrganization = targetEndpoints .filter(e -> getOrganizationIdentifier(e, organizationIdentifierByOrganizationId).isPresent()); - List<Target> targets = remoteTargetEndpointsWithActiveOrganization.map(e -> { String organizationIdentifier = getOrganizationIdentifier(e, organizationIdentifierByOrganizationId).get(); diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StartTimer.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StartTimer.java new file mode 100644 index 00000000..19bf9ce3 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StartTimer.java @@ -0,0 +1,61 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; +import static org.highmed.dsf.bpe.ConstantsPing.BPMN_EXECUTION_VARIABLE_STOP_TIMER; +import static org.highmed.dsf.bpe.ConstantsPing.BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_TIMER_INTERVAL; +import static org.highmed.dsf.bpe.ConstantsPing.TIMER_INTERVAL_DEFAULT_VALUE; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.variable.Variables; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.organization.EndpointProvider; +import org.highmed.dsf.fhir.organization.OrganizationProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Target; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class StartTimer extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(StartTimer.class); + + private final OrganizationProvider organizationProvider; + private final EndpointProvider endpointProvider; + + public StartTimer(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, + EndpointProvider endpointProvider) + { + super(clientProvider, taskHelper, readAccessHelper); + + this.organizationProvider = organizationProvider; + this.endpointProvider = endpointProvider; + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + logger.debug("Setting variable '{}' to false", BPMN_EXECUTION_VARIABLE_STOP_TIMER); + execution.setVariable(BPMN_EXECUTION_VARIABLE_STOP_TIMER, Variables.booleanValue(false)); + + String timerInterval = getTimerInterval(); + logger.debug("Setting variable '{}' to {}", BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL, timerInterval); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL, Variables.stringValue(timerInterval)); + + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, + Target.createUniDirectionalTarget(organizationProvider.getLocalIdentifierValue(), + endpointProvider.getLocalEndpointIdentifier().getValue(), + endpointProvider.getLocalEndpointAddress())); + } + + private String getTimerInterval() + { + return getTaskHelper().getFirstInputParameterStringValue(getLeadingTaskFromExecutionVariables(), + CODESYSTEM_HIGHMED_PING, CODESYSTEM_HIGHMED_PING_VALUE_TIMER_INTERVAL) + .orElse(TIMER_INTERVAL_DEFAULT_VALUE); + } +} diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StopTimer.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StopTimer.java new file mode 100644 index 00000000..d8efeae3 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StopTimer.java @@ -0,0 +1,30 @@ +package org.highmed.dsf.bpe.service; + +import static org.highmed.dsf.bpe.ConstantsPing.BPMN_EXECUTION_VARIABLE_STOP_TIMER; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.variable.Variables; +import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; +import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; +import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; +import org.highmed.dsf.fhir.task.TaskHelper; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class StopTimer extends AbstractServiceDelegate +{ + private static final Logger logger = LoggerFactory.getLogger(StopTimer.class); + + public StopTimer(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, + ReadAccessHelper readAccessHelper) + { + super(clientProvider, taskHelper, readAccessHelper); + } + + @Override + protected void doExecute(DelegateExecution execution) throws Exception + { + logger.debug("Setting variable '{}' to true", BPMN_EXECUTION_VARIABLE_STOP_TIMER); + execution.setVariable(BPMN_EXECUTION_VARIABLE_STOP_TIMER, Variables.booleanValue(true)); + } +} diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java index ab5a55ba..a29f1e34 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java @@ -2,11 +2,14 @@ import org.highmed.dsf.bpe.message.SendPing; import org.highmed.dsf.bpe.message.SendPong; +import org.highmed.dsf.bpe.message.SendStartPing; import org.highmed.dsf.bpe.service.LogNoResponse; import org.highmed.dsf.bpe.service.LogPing; import org.highmed.dsf.bpe.service.LogPong; import org.highmed.dsf.bpe.service.SelectPingTargets; import org.highmed.dsf.bpe.service.SelectPongTarget; +import org.highmed.dsf.bpe.service.StartTimer; +import org.highmed.dsf.bpe.service.StopTimer; import org.highmed.dsf.bpe.util.PingResponseGenerator; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; @@ -40,6 +43,24 @@ public class PingConfig @Autowired private FhirContext fhirContext; + @Bean + public StartTimer startTimer() + { + return new StartTimer(clientProvider, taskHelper, readAccessHelper, organizationProvider, endpointProvider); + } + + @Bean + public SendStartPing sendStartPing() + { + return new SendStartPing(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); + } + + @Bean + public StopTimer stopTimer() + { + return new StopTimer(clientProvider, taskHelper, readAccessHelper); + } + @Bean public PingResponseGenerator responseGenerator() { diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/autostart.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/autostart.bpmn new file mode 100644 index 00000000..d296b367 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/resources/bpe/autostart.bpmn @@ -0,0 +1,241 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1bd6yss" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> + <bpmn:process id="highmedorg_autostartPing" isExecutable="true" camunda:versionTag="#{version}"> + <bpmn:endEvent id="Event_1ukqals"> + <bpmn:incoming>Flow_0stek1z</bpmn:incoming> + </bpmn:endEvent> + <bpmn:exclusiveGateway id="Gateway_1xqxerc"> + <bpmn:incoming>Flow_05mfu8d</bpmn:incoming> + <bpmn:incoming>Flow_1ltiore</bpmn:incoming> + <bpmn:outgoing>Flow_0g1txh0</bpmn:outgoing> + <bpmn:outgoing>Flow_0jy9ipp</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:startEvent id="AutostartPingStartMessageStartEvent" name="start autostart ping process"> + <bpmn:outgoing>Flow_09o8bb5</bpmn:outgoing> + <bpmn:messageEventDefinition id="MessageEventDefinition_1ot9xdv" messageRef="Message_13deqwn" /> + </bpmn:startEvent> + <bpmn:parallelGateway id="Gateway_00tj0cp"> + <bpmn:incoming>Flow_1bbw6lm</bpmn:incoming> + <bpmn:outgoing>Flow_05mfu8d</bpmn:outgoing> + <bpmn:outgoing>Flow_06toths</bpmn:outgoing> + </bpmn:parallelGateway> + <bpmn:intermediateCatchEvent id="Event_0eqigaq" name="wait"> + <bpmn:incoming>Flow_1asxc2j</bpmn:incoming> + <bpmn:outgoing>Flow_1ltiore</bpmn:outgoing> + <bpmn:timerEventDefinition id="TimerEventDefinition_0f3gxu4"> + <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">${timerInterval}</bpmn:timeDuration> + </bpmn:timerEventDefinition> + </bpmn:intermediateCatchEvent> + <bpmn:parallelGateway id="Gateway_0oa1bkj"> + <bpmn:incoming>Flow_0y9pdwn</bpmn:incoming> + <bpmn:incoming>Flow_13osd7u</bpmn:incoming> + <bpmn:outgoing>Flow_0stek1z</bpmn:outgoing> + </bpmn:parallelGateway> + <bpmn:sequenceFlow id="Flow_0stek1z" sourceRef="Gateway_0oa1bkj" targetRef="Event_1ukqals" /> + <bpmn:sequenceFlow id="Flow_09o8bb5" sourceRef="AutostartPingStartMessageStartEvent" targetRef="startTimer" /> + <bpmn:sequenceFlow id="Flow_1ltiore" sourceRef="Event_0eqigaq" targetRef="Gateway_1xqxerc" /> + <bpmn:sequenceFlow id="Flow_05mfu8d" sourceRef="Gateway_00tj0cp" targetRef="Gateway_1xqxerc" /> + <bpmn:sequenceFlow id="Flow_0g1txh0" name="stop timer set" sourceRef="Gateway_1xqxerc" targetRef="Gateway_129hw90"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${stopTimer}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:exclusiveGateway id="Gateway_0sx5e0s"> + <bpmn:incoming>Flow_1yj8623</bpmn:incoming> + <bpmn:outgoing>Flow_1asxc2j</bpmn:outgoing> + <bpmn:outgoing>Flow_1h835ja</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_1asxc2j" sourceRef="Gateway_0sx5e0s" targetRef="Event_0eqigaq"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!stopTimer}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_1h835ja" name="stop timer set" sourceRef="Gateway_0sx5e0s" targetRef="Gateway_129hw90"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${stopTimer}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:subProcess id="StopSubProcess"> + <bpmn:incoming>Flow_06toths</bpmn:incoming> + <bpmn:outgoing>Flow_0y9pdwn</bpmn:outgoing> + <bpmn:startEvent id="Event_02xmnq6"> + <bpmn:outgoing>Flow_1x5v76c</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:serviceTask id="StopTimer" name="stop timer" camunda:class="org.highmed.dsf.bpe.service.StopTimer"> + <bpmn:incoming>Flow_0m0cias</bpmn:incoming> + <bpmn:outgoing>Flow_1vxlaau</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:intermediateCatchEvent id="AutostartPingStopMessageStartEvent" name="stop autostart ping process"> + <bpmn:incoming>Flow_1x5v76c</bpmn:incoming> + <bpmn:outgoing>Flow_0m0cias</bpmn:outgoing> + <bpmn:messageEventDefinition id="MessageEventDefinition_1d7e8jd" messageRef="Message_1ws42uv" /> + </bpmn:intermediateCatchEvent> + <bpmn:sequenceFlow id="Flow_0m0cias" sourceRef="AutostartPingStopMessageStartEvent" targetRef="StopTimer" /> + <bpmn:sequenceFlow id="Flow_1x5v76c" sourceRef="Event_02xmnq6" targetRef="AutostartPingStopMessageStartEvent" /> + <bpmn:endEvent id="Event_1ckek3z"> + <bpmn:incoming>Flow_1vxlaau</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="Flow_1vxlaau" sourceRef="StopTimer" targetRef="Event_1ckek3z" /> + </bpmn:subProcess> + <bpmn:sequenceFlow id="Flow_06toths" sourceRef="Gateway_00tj0cp" targetRef="StopSubProcess" /> + <bpmn:sequenceFlow id="Flow_0y9pdwn" sourceRef="StopSubProcess" targetRef="Gateway_0oa1bkj" /> + <bpmn:sequenceFlow id="Flow_0jy9ipp" sourceRef="Gateway_1xqxerc" targetRef="startPingProcess"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!stopTimer}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="Flow_1bbw6lm" sourceRef="startTimer" targetRef="Gateway_00tj0cp" /> + <bpmn:serviceTask id="startTimer" name="start timer" camunda:class="org.highmed.dsf.bpe.service.StartTimer"> + <bpmn:incoming>Flow_09o8bb5</bpmn:incoming> + <bpmn:outgoing>Flow_1bbw6lm</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:exclusiveGateway id="Gateway_129hw90"> + <bpmn:incoming>Flow_1h835ja</bpmn:incoming> + <bpmn:incoming>Flow_0g1txh0</bpmn:incoming> + <bpmn:outgoing>Flow_13osd7u</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="Flow_13osd7u" sourceRef="Gateway_129hw90" targetRef="Gateway_0oa1bkj" /> + <bpmn:sequenceFlow id="Flow_1yj8623" sourceRef="startPingProcess" targetRef="Gateway_0sx5e0s" /> + <bpmn:intermediateThrowEvent id="startPingProcess" name="start ping process"> + <bpmn:extensionElements> + <camunda:inputOutput> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-start-ping-process|#{version}</camunda:inputParameter> + <camunda:inputParameter name="messageName">startPingProcessMessage</camunda:inputParameter> + <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/ping/#{version}</camunda:inputParameter> + </camunda:inputOutput> + </bpmn:extensionElements> + <bpmn:incoming>Flow_0jy9ipp</bpmn:incoming> + <bpmn:outgoing>Flow_1yj8623</bpmn:outgoing> + <bpmn:messageEventDefinition id="MessageEventDefinition_1gjl6d4" camunda:class="org.highmed.dsf.bpe.message.SendStartPing" /> + </bpmn:intermediateThrowEvent> + </bpmn:process> + <bpmn:message id="Message_13deqwn" name="startAutostartPingProcessMessage" /> + <bpmn:message id="Message_1ws42uv" name="stopAutostartPingProcessMessage" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_autostartPing"> + <bpmndi:BPMNEdge id="Flow_1yj8623_di" bpmnElement="Flow_1yj8623"> + <di:waypoint x="718" y="197" /> + <di:waypoint x="775" y="197" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_13osd7u_di" bpmnElement="Flow_13osd7u"> + <di:waypoint x="965" y="197" /> + <di:waypoint x="1035" y="197" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1bbw6lm_di" bpmnElement="Flow_1bbw6lm"> + <di:waypoint x="410" y="197" /> + <di:waypoint x="465" y="197" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0jy9ipp_di" bpmnElement="Flow_0jy9ipp"> + <di:waypoint x="625" y="197" /> + <di:waypoint x="682" y="197" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0y9pdwn_di" bpmnElement="Flow_0y9pdwn"> + <di:waypoint x="868" y="390" /> + <di:waypoint x="1060" y="390" /> + <di:waypoint x="1060" y="222" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_06toths_di" bpmnElement="Flow_06toths"> + <di:waypoint x="490" y="222" /> + <di:waypoint x="490" y="330" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1h835ja_di" bpmnElement="Flow_1h835ja"> + <di:waypoint x="825" y="197" /> + <di:waypoint x="915" y="197" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="827" y="176" width="67" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1asxc2j_di" bpmnElement="Flow_1asxc2j"> + <di:waypoint x="800" y="222" /> + <di:waypoint x="800" y="262" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0g1txh0_di" bpmnElement="Flow_0g1txh0"> + <di:waypoint x="600" y="172" /> + <di:waypoint x="600" y="100" /> + <di:waypoint x="940" y="100" /> + <di:waypoint x="940" y="172" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="603" y="82" width="67" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_05mfu8d_di" bpmnElement="Flow_05mfu8d"> + <di:waypoint x="515" y="197" /> + <di:waypoint x="575" y="197" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1ltiore_di" bpmnElement="Flow_1ltiore"> + <di:waypoint x="782" y="280" /> + <di:waypoint x="600" y="280" /> + <di:waypoint x="600" y="222" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_09o8bb5_di" bpmnElement="Flow_09o8bb5"> + <di:waypoint x="248" y="197" /> + <di:waypoint x="310" y="197" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0stek1z_di" bpmnElement="Flow_0stek1z"> + <di:waypoint x="1085" y="197" /> + <di:waypoint x="1172" y="197" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="Event_1ukqals_di" bpmnElement="Event_1ukqals"> + <dc:Bounds x="1172" y="179" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_1xqxerc_di" bpmnElement="Gateway_1xqxerc" isMarkerVisible="true"> + <dc:Bounds x="575" y="172" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0g2pqnk_di" bpmnElement="AutostartPingStartMessageStartEvent"> + <dc:Bounds x="212" y="179" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="199" y="222" width="68" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_00tj0cp_di" bpmnElement="Gateway_00tj0cp"> + <dc:Bounds x="465" y="172" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0eqigaq_di" bpmnElement="Event_0eqigaq"> + <dc:Bounds x="782" y="262" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="790" y="301" width="20" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0oa1bkj_di" bpmnElement="Gateway_0oa1bkj"> + <dc:Bounds x="1035" y="172" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_0sx5e0s_di" bpmnElement="Gateway_0sx5e0s" isMarkerVisible="true"> + <dc:Bounds x="775" y="172" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1kspnah_di" bpmnElement="StopSubProcess" isExpanded="true"> + <dc:Bounds x="440" y="330" width="428" height="120" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="Flow_1vxlaau_di" bpmnElement="Flow_1vxlaau"> + <di:waypoint x="760" y="390" /> + <di:waypoint x="812" y="390" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_1x5v76c_di" bpmnElement="Flow_1x5v76c"> + <di:waypoint x="506" y="390" /> + <di:waypoint x="572" y="390" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="Flow_0m0cias_di" bpmnElement="Flow_0m0cias"> + <di:waypoint x="608" y="390" /> + <di:waypoint x="660" y="390" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="Event_02xmnq6_di" bpmnElement="Event_02xmnq6"> + <dc:Bounds x="470" y="372" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_1cin90r_di" bpmnElement="StopTimer"> + <dc:Bounds x="660" y="350" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1maglns_di" bpmnElement="AutostartPingStopMessageStartEvent"> + <dc:Bounds x="572" y="372" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="558" y="415" width="67" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_1ckek3z_di" bpmnElement="Event_1ckek3z"> + <dc:Bounds x="812" y="372" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0laouxt_di" bpmnElement="startTimer"> + <dc:Bounds x="310" y="157" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_129hw90_di" bpmnElement="Gateway_129hw90" isMarkerVisible="true"> + <dc:Bounds x="915" y="172" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0dsz1xu_di" bpmnElement="startPingProcess"> + <dc:Bounds x="682" y="179" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="657" y="222" width="87" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-autostart.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-autostart.xml new file mode 100644 index 00000000..374ec959 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-autostart.xml @@ -0,0 +1,69 @@ +<ActivityDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> + <extension url="message-name"> + <valueString value="startAutostartPingProcessMessage" /> + </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-start-autostart-ping-process|#{version}" /> + </extension> + <extension url="requester"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ALL" /> + </valueCoding> + </extension> + <extension url="recipient"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ALL" /> + </valueCoding> + </extension> + </extension> + <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> + <extension url="message-name"> + <valueString value="stopAutostartPingProcessMessage" /> + </extension> + <extension url="task-profile"> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-stop-autostart-ping-process|#{version}" /> + </extension> + <extension url="requester"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ALL" /> + </valueCoding> + </extension> + <extension url="recipient"> + <valueCoding> + <system value="http://highmed.org/fhir/CodeSystem/process-authorization" /> + <code value="LOCAL_ALL" /> + </valueCoding> + </extension> + </extension> + <url value="http://highmed.org/bpe/Process/autostartPing" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="Autostart Ping" /> + <title value="Autostart PING process" /> + <subtitle value="Autostart Communication Testing Process" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="HiGHmed" /> + <contact> + <name value="HiGHmed" /> + <telecom> + <system value="email" /> + <value value="pmo@highmed.org" /> + </telecom> + </contact> + <description value="Process to autostart sending PING messages to remote Organizations and to receive corresponding PONG messages in a predefined interval" /> + <kind value="Task" /> +</ActivityDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml index ed6bb209..7128fd64 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml @@ -29,11 +29,16 @@ <concept> <code value="endpoint-identifier" /> <display value="Endpoint Identifier" /> - <definition value="Identifier of enpoint expecting pong (response) message" /> + <definition value="Identifier of endpoint expecting pong (response) message" /> </concept> <concept> <code value="target-endpoints" /> <display value="Target Endpoints" /> <definition value="Ping target endpoints, search query resulting in match or include results with Endpoint resources" /> </concept> + <concept> + <code value="timer-interval" /> + <display value="Timer Interval" /> + <definition value="Interval between two autostarts of the ping process" /> + </concept> </CodeSystem> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-autostart.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-autostart.xml new file mode 100644 index 00000000..92762760 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-autostart.xml @@ -0,0 +1,144 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/task-start-autostart-ping-process" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="TaskStartAutostartPingProcess" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Task" /> + <baseDefinition value="http://highmed.org/fhir/StructureDefinition/task-base" /> + <derivation value="constraint" /> + <differential> + <element id="Task.instantiatesUri"> + <path value="Task.instantiatesUri" /> + <fixedUri value="http://highmed.org/bpe/Process/autostartPing/#{version}" /> + </element> + <element id="Task.input"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <min value="2" /> + <max value="4" /> + </element> + <element id="Task.input:message-name"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="message-name" /> + </element> + <element id="Task.input:message-name.value[x]"> + <path value="Task.input.value[x]" /> + <fixedString value="startAutostartPingProcessMessage" /> + </element> + <element id="Task.input:business-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="business-key" /> + <max value="1" /> + </element> + <element id="Task.input:correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="correlation-key" /> + <max value="0" /> + </element> + <element id="Task.input:target-endpoints"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="target-endpoints" /> + <min value="0" /> + <max value="1" /> + </element> + <element id="Task.input:target-endpoints.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/ping" /> + </binding> + </element> + <element id="Task.input:target-endpoints.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:target-endpoints.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/ping" /> + </element> + <element id="Task.input:target-endpoints.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="target-endpoints" /> + </element> + <element id="Task.input:target-endpoints.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="string" /> + </type> + </element> + <element id="Task.input:timer-interval"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="timer-interval" /> + <min value="0" /> + <max value="1" /> + </element> + <element id="Task.input:timer-interval.type"> + <path value="Task.input.type" /> + <binding> + <extension url="http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName"> + <valueString value="TaskInputParameterType" /> + </extension> + <strength value="required" /> + <valueSet value="http://highmed.org/fhir/ValueSet/ping" /> + </binding> + </element> + <element id="Task.input:timer-interval.type.coding"> + <path value="Task.input.type.coding" /> + <min value="1" /> + <max value="1" /> + </element> + <element id="Task.input:timer-interval.type.coding.system"> + <path value="Task.input.type.coding.system" /> + <min value="1" /> + <fixedUri value="http://highmed.org/fhir/CodeSystem/ping" /> + </element> + <element id="Task.input:timer-interval.type.coding.code"> + <path value="Task.input.type.coding.code" /> + <min value="1" /> + <fixedCode value="timer-interval" /> + </element> + <element id="Task.input:timer-interval.value[x]"> + <path value="Task.input.value[x]" /> + <type> + <code value="string" /> + </type> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml index 19606643..6b69a95e 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml @@ -31,7 +31,7 @@ </extension> <path value="Task.input" /> <min value="1" /> - <max value="2" /> + <max value="3" /> </element> <element id="Task.input:message-name"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> @@ -44,14 +44,6 @@ <path value="Task.input.value[x]" /> <fixedString value="startPingProcessMessage" /> </element> - <element id="Task.input:business-key"> - <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> - <valueString value="Parameter" /> - </extension> - <path value="Task.input" /> - <sliceName value="business-key" /> - <max value="0" /> - </element> <element id="Task.input:correlation-key"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> <valueString value="Parameter" /> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-stop-autostart.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-stop-autostart.xml new file mode 100644 index 00000000..7d34b935 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-stop-autostart.xml @@ -0,0 +1,64 @@ +<StructureDefinition xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/StructureDefinition/task-stop-autostart-ping-process" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="TaskStopAutostartPingProcess" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <fhirVersion value="4.0.1" /> + <kind value="resource" /> + <abstract value="false" /> + <type value="Task" /> + <baseDefinition value="http://highmed.org/fhir/StructureDefinition/task-base" /> + <derivation value="constraint" /> + <differential> + <element id="Task.instantiatesUri"> + <path value="Task.instantiatesUri" /> + <fixedUri value="http://highmed.org/bpe/Process/autostartPing/#{version}" /> + </element> + <element id="Task.input"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <min value="2" /> + <max value="2" /> + </element> + <element id="Task.input:message-name"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="message-name" /> + </element> + <element id="Task.input:message-name.value[x]"> + <path value="Task.input.value[x]" /> + <fixedString value="stopAutostartPingProcessMessage" /> + </element> + <element id="Task.input:business-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="business-key" /> + <min value="1" /> + </element> + <element id="Task.input:correlation-key"> + <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> + <valueString value="Parameter" /> + </extension> + <path value="Task.input" /> + <sliceName value="correlation-key" /> + <max value="0" /> + </element> + </differential> +</StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStartAutostartPing3MedicFromTtpExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStartAutostartPing3MedicFromTtpExampleStarter.java new file mode 100644 index 00000000..7707a695 --- /dev/null +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStartAutostartPing3MedicFromTtpExampleStarter.java @@ -0,0 +1,60 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_TIMER_INTERVAL; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_AUTOSTART_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_AUTOSTART_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; + +import java.util.Date; + +import org.hl7.fhir.r4.model.ResourceType; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.TaskIntent; +import org.hl7.fhir.r4.model.Task.TaskStatus; + +public abstract class AbstractStartAutostartPing3MedicFromTtpExampleStarter +{ + public static final String BUSINESS_KEY = "95decd83-eb93-410b-b0df-6046256edd7d"; + + protected void main(String[] args, String baseUrl) throws Exception + { + Task task = createStartResource(); + ExampleStarter.forServer(args, baseUrl).startWith(task); + } + + private Task createStartResource() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_START_AUTOSTART_AND_LATEST_VERSION); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_START_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_START_AUTOSTART_MESSAGE_NAME)).getType() + .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(BUSINESS_KEY)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN) + .setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + task.addInput().setValue(new StringType("Endpoint?identifier=http://highmed.org/sid/endpoint-identifier|")) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_PING) + .setCode(CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS); + task.addInput().setValue(new StringType("PT7M")).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_PING) + .setCode(CODESYSTEM_HIGHMED_PING_VALUE_TIMER_INTERVAL); + + return task; + } +} diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStopAutostartPing3MedicFromTtpExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStopAutostartPing3MedicFromTtpExampleStarter.java new file mode 100644 index 00000000..637d7851 --- /dev/null +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStopAutostartPing3MedicFromTtpExampleStarter.java @@ -0,0 +1,51 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_AUTOSTART_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_AUTOSTART_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.start.AbstractStartAutostartPing3MedicFromTtpExampleStarter.BUSINESS_KEY; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; + +import java.util.Date; + +import org.hl7.fhir.r4.model.ResourceType; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.TaskIntent; +import org.hl7.fhir.r4.model.Task.TaskStatus; + +public abstract class AbstractStopAutostartPing3MedicFromTtpExampleStarter +{ + protected void main(String[] args, String baseUrl) throws Exception + { + Task task = createStartResource(); + ExampleStarter.forServer(args, baseUrl).startWith(task); + } + + private Task createStartResource() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_STOP_AUTOSTART_AND_LATEST_VERSION); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_STOP_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_STOP_AUTOSTART_MESSAGE_NAME)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(BUSINESS_KEY)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN) + .setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + + return task; + } +} diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StartAutostartPing3MedicFromTtpDockerExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StartAutostartPing3MedicFromTtpDockerExampleStarter.java new file mode 100644 index 00000000..34fab06f --- /dev/null +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StartAutostartPing3MedicFromTtpDockerExampleStarter.java @@ -0,0 +1,16 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.TTP_DOCKER_FHIR_BASE_URL; + +public class StartAutostartPing3MedicFromTtpDockerExampleStarter + extends AbstractStartAutostartPing3MedicFromTtpExampleStarter +{ + // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate + // password + public static void main(String[] args) throws Exception + { + new StartAutostartPing3MedicFromTtpDockerExampleStarter().main(args, TTP_DOCKER_FHIR_BASE_URL); + } +} diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StartAutostartPing3MedicFromTtpExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StartAutostartPing3MedicFromTtpExampleStarter.java new file mode 100644 index 00000000..df77c909 --- /dev/null +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StartAutostartPing3MedicFromTtpExampleStarter.java @@ -0,0 +1,15 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.TTP_FHIR_BASE_URL; + +public class StartAutostartPing3MedicFromTtpExampleStarter extends AbstractStartAutostartPing3MedicFromTtpExampleStarter +{ + // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate + // password + public static void main(String[] args) throws Exception + { + new StartAutostartPing3MedicFromTtpExampleStarter().main(args, TTP_FHIR_BASE_URL); + } +} diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StopAutostartPing3MedicFromTtpDockerExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StopAutostartPing3MedicFromTtpDockerExampleStarter.java new file mode 100644 index 00000000..11fd0cb3 --- /dev/null +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StopAutostartPing3MedicFromTtpDockerExampleStarter.java @@ -0,0 +1,16 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.TTP_DOCKER_FHIR_BASE_URL; + +public class StopAutostartPing3MedicFromTtpDockerExampleStarter + extends AbstractStopAutostartPing3MedicFromTtpExampleStarter +{ + // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate + // password + public static void main(String[] args) throws Exception + { + new StopAutostartPing3MedicFromTtpDockerExampleStarter().main(args, TTP_DOCKER_FHIR_BASE_URL); + } +} diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StopAutostartPing3MedicFromTtpExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StopAutostartPing3MedicFromTtpExampleStarter.java new file mode 100644 index 00000000..22769b7c --- /dev/null +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/StopAutostartPing3MedicFromTtpExampleStarter.java @@ -0,0 +1,15 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.TTP_FHIR_BASE_URL; + +public class StopAutostartPing3MedicFromTtpExampleStarter extends AbstractStopAutostartPing3MedicFromTtpExampleStarter +{ + // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate + // password + public static void main(String[] args) throws Exception + { + new StopAutostartPing3MedicFromTtpExampleStarter().main(args, TTP_FHIR_BASE_URL); + } +} diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java index d090f81e..29baaaad 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java @@ -46,6 +46,21 @@ public class ActivityDefinitionProfileTest private final ProcessAuthorizationHelper processAuthorizationHelper = new ProcessAuthorizationHelperImpl(); + @Test + public void testAutostartValid() throws Exception + { + ActivityDefinition ad = validationRule + .readActivityDefinition(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-autostart.xml")); + + ValidationResult result = resourceValidator.validate(ad); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + + assertTrue(processAuthorizationHelper.isValid(ad, taskProfile -> true, orgIdentifier -> true, role -> true)); + } + @Test public void testPingValid() throws Exception { diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java index 1e68345a..043f7af0 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java @@ -10,14 +10,21 @@ import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_TIMER_INTERVAL; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PING; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PING_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PING_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PONG_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PONG_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PONG_TASK; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_AUTOSTART; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_AUTOSTART_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_AUTOSTART; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_AUTOSTART_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.PingProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.PingProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; @@ -52,7 +59,8 @@ public class TaskProfileTest @ClassRule public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, - Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-task-start-ping-process.xml", "highmed-task-ping.xml", + Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-task-start-autostart.xml", + "highmed-task-stop-autostart.xml", "highmed-task-start-ping-process.xml", "highmed-task-ping.xml", "highmed-task-pong.xml", "highmed-extension-ping-response.xml"), Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", "highmed-ping.xml", "highmed-ping-response.xml"), @@ -62,6 +70,103 @@ public class TaskProfileTest private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), validationRule.getValidationSupport()); + @Test + public void testTaskStartAutostartProcessProfileValid() throws Exception + { + Task task = createValidTaskStartAutostartProcess(); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + @Test + public void testTaskStartAutostartProcessProfileValidWithTargetEndpoints() throws Exception + { + Task task = createValidTaskStartAutostartProcess(); + task.addInput() + .setValue(new StringType( + "Endpoint?identifier=http://highmed.org/sid/endpoint-identifier|endpoint.target.org")) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_PING) + .setCode(CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + @Test + public void testTaskStartAutostartProcessProfileValidTimerInterval() throws Exception + { + Task task = createValidTaskStartAutostartProcess(); + task.addInput().setValue(new StringType("PT24H")).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_PING) + .setCode(CODESYSTEM_HIGHMED_PING_VALUE_TIMER_INTERVAL); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + private Task createValidTaskStartAutostartProcess() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_START_AUTOSTART); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_START_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("TTP"); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("TTP"); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_START_AUTOSTART_MESSAGE_NAME)).getType() + .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + + return task; + } + + @Test + public void testTaskStopAutostartProcessProfileValid() throws Exception + { + Task task = createValidTaskStopAutostartProcess(); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + + private Task createValidTaskStopAutostartProcess() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_STOP_AUTOSTART); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_STOP_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("TTP"); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("TTP"); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_STOP_AUTOSTART_MESSAGE_NAME)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); + + return task; + } + @Test public void testTaskStartPingProcessProfileValid() throws Exception { From 62412c7220d33a79b1cf49e8605f7d8473a0ba84 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 2 May 2022 17:31:22 +0200 Subject: [PATCH 114/125] use specific serializers --- .../main/java/org/highmed/dsf/bpe/service/LogNoResponse.java | 3 ++- .../src/main/java/org/highmed/dsf/bpe/service/LogPong.java | 2 +- .../java/org/highmed/dsf/bpe/service/SelectPingTargets.java | 3 ++- .../main/java/org/highmed/dsf/bpe/service/StartTimer.java | 5 +++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java index 12594f95..b4dadc8a 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java @@ -12,6 +12,7 @@ import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.FhirResourceValues; import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.Targets; import org.hl7.fhir.r4.model.Task; @@ -48,7 +49,7 @@ public void doExecute(DelegateExecution execution) throws Exception Targets targets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); targets.getEntries().forEach(t -> logAndAddResponseToTask(task, t)); - execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_TASK, task); + execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_TASK, FhirResourceValues.create(task)); } private void logAndAddResponseToTask(Task task, Target target) diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java index e224f159..970d82c3 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java @@ -52,7 +52,7 @@ public void doExecute(DelegateExecution execution) Task leading = getLeadingTaskFromExecutionVariables(); leading.addOutput(responseGenerator.createOutput(target, CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_RECEIVED)); - execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_TASK, leading); + updateLeadingTaskInExecutionVariables(leading); Targets targets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); targets = targets.removeByEndpointIdentifierValue(target.getEndpointIdentifierValue()); diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java index f0dd4333..eb142450 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/SelectPingTargets.java @@ -27,6 +27,7 @@ import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; import org.highmed.dsf.fhir.variables.Targets; +import org.highmed.dsf.fhir.variables.TargetsValues; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent; import org.hl7.fhir.r4.model.Endpoint; @@ -105,7 +106,7 @@ public void doExecute(DelegateExecution execution) throws Exception UUID.randomUUID().toString()); }).collect(Collectors.toList()); - execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, new Targets(targets)); + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGETS, TargetsValues.create(new Targets(targets))); } private Optional<UriComponents> getTargetEndpointsSearchParameter() diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StartTimer.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StartTimer.java index 19bf9ce3..1e075931 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StartTimer.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StartTimer.java @@ -16,6 +16,7 @@ import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.TaskHelper; import org.highmed.dsf.fhir.variables.Target; +import org.highmed.dsf.fhir.variables.TargetValues; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,10 +47,10 @@ protected void doExecute(DelegateExecution execution) throws Exception logger.debug("Setting variable '{}' to {}", BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL, timerInterval); execution.setVariable(BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL, Variables.stringValue(timerInterval)); - execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create( Target.createUniDirectionalTarget(organizationProvider.getLocalIdentifierValue(), endpointProvider.getLocalEndpointIdentifier().getValue(), - endpointProvider.getLocalEndpointAddress())); + endpointProvider.getLocalEndpointAddress()))); } private String getTimerInterval() From 81c758dd20882c5469831bd64a92e0e604c980e9 Mon Sep 17 00:00:00 2001 From: Reto Wettstein <Reto.Wettstein@med.uni-heidelberg.de> Date: Mon, 2 May 2022 17:37:27 +0200 Subject: [PATCH 115/125] format and sort --- .../src/main/java/org/highmed/dsf/bpe/service/StartTimer.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StartTimer.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StartTimer.java index 1e075931..c14e3d4a 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StartTimer.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/StartTimer.java @@ -47,8 +47,8 @@ protected void doExecute(DelegateExecution execution) throws Exception logger.debug("Setting variable '{}' to {}", BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL, timerInterval); execution.setVariable(BPMN_EXECUTION_VARIABLE_TIMER_INTERVAL, Variables.stringValue(timerInterval)); - execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, TargetValues.create( - Target.createUniDirectionalTarget(organizationProvider.getLocalIdentifierValue(), + execution.setVariable(BPMN_EXECUTION_VARIABLE_TARGET, + TargetValues.create(Target.createUniDirectionalTarget(organizationProvider.getLocalIdentifierValue(), endpointProvider.getLocalEndpointIdentifier().getValue(), endpointProvider.getLocalEndpointAddress()))); } From 994d703bc42cf1ff697e3d7301f43ac23b1c4963 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Mon, 2 May 2022 19:18:30 +0200 Subject: [PATCH 116/125] removed not needed import --- .../src/main/java/org/highmed/dsf/bpe/service/LogPong.java | 1 - 1 file changed, 1 deletion(-) diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java index 970d82c3..9a29d63d 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java @@ -1,6 +1,5 @@ package org.highmed.dsf.bpe.service; -import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_LEADING_TASK; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_RECEIVED; From dde7634dcc560343b5bdeb921c93570b9eb5a6c8 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Tue, 3 May 2022 01:15:40 +0200 Subject: [PATCH 117/125] ping task output for pong send, some renaming, additional error logging --- .../org/highmed/dsf/bpe/ConstantsPing.java | 16 ++-- .../dsf/bpe/PingProcessPluginDefinition.java | 11 +-- .../highmed/dsf/bpe/logging/ErrorLogger.java | 29 +++++++ .../org/highmed/dsf/bpe/message/SendPing.java | 29 ++++--- .../org/highmed/dsf/bpe/message/SendPong.java | 81 ++++++++++++++++++- .../dsf/bpe/service/LogNoResponse.java | 16 ++-- .../org/highmed/dsf/bpe/service/LogPong.java | 11 +-- .../dsf/bpe/spring/config/PingConfig.java | 20 +++-- ...enerator.java => PingStatusGenerator.java} | 38 ++++++--- ...g-response.xml => highmed-ping-status.xml} | 33 ++++---- .../fhir/CodeSystem/highmed-ping.xml | 13 ++- ....xml => highmed-extension-ping-status.xml} | 4 +- .../StructureDefinition/highmed-task-ping.xml | 64 +++++++++++++++ .../highmed-task-start-ping-process.xml | 32 ++++---- .../fhir/ValueSet/highmed-ping-response.xml | 26 ------ .../fhir/ValueSet/highmed-ping-status.xml | 42 ++++++++++ .../resources/fhir/ValueSet/highmed-ping.xml | 2 +- .../fhir/ValueSet/highmed-pong-status.xml | 38 +++++++++ .../dsf/fhir/profiles/TaskProfileTest.java | 35 +++++--- 19 files changed, 418 insertions(+), 122 deletions(-) create mode 100644 dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/logging/ErrorLogger.java rename dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/{PingResponseGenerator.java => PingStatusGenerator.java} (63%) rename dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/{highmed-ping-response.xml => highmed-ping-status.xml} (54%) rename dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/{highmed-extension-ping-response.xml => highmed-extension-ping-status.xml} (98%) delete mode 100644 dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-response.xml create mode 100644 dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-status.xml create mode 100644 dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-pong-status.xml diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java index 87dc9a4b..f4784dc5 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java @@ -37,18 +37,20 @@ public interface ConstantsPing String PROFILE_HIGHMED_TASK_PONG_MESSAGE_NAME = "pongMessage"; String CODESYSTEM_HIGHMED_PING = "http://highmed.org/fhir/CodeSystem/ping"; - String CODESYSTEM_HIGHMED_PING_VALUE_PING_RESPONSE = "ping-response"; + String CODESYSTEM_HIGHMED_PING_VALUE_PING_STATUS = "ping-status"; + String CODESYSTEM_HIGHMED_PING_VALUE_PONG_STATUS = "pong-status"; String CODESYSTEM_HIGHMED_PING_VALUE_ENDPOINT_IDENTIFIER = "endpoint-identifier"; String CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS = "target-endpoints"; String CODESYSTEM_HIGHMED_PING_VALUE_TIMER_INTERVAL = "timer-interval"; - String CODESYSTEM_HIGHMED_PING_RESPONSE = "http://highmed.org/fhir/CodeSystem/ping-response"; - String CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_RECEIVED = "received"; - String CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_MISSING = "missing"; - String CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE = "not-reachable"; - String CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_ALLOWED = "not-allowed"; + String CODESYSTEM_HIGHMED_PING_STATUS = "http://highmed.org/fhir/CodeSystem/ping-status"; + String CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_MISSING = "pong-missing"; + String CODESYSTEM_HIGHMED_PING_STATUS_VALUE_NOT_ALLOWED = "not-allowed"; + String CODESYSTEM_HIGHMED_PING_STATUS_VALUE_NOT_REACHABLE = "not-reachable"; + String CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PING_SEND = "ping-send"; + String CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_SEND = "pong-send"; - String EXTENSION_URL_PING_RESPONSE = "http://highmed.org/fhir/StructureDefinition/extension-ping-response"; + String EXTENSION_URL_PING_STATUS = "http://highmed.org/fhir/StructureDefinition/extension-ping-status"; String EXTENSION_URL_CORRELATION_KEY = "correlation-key"; String EXTENSION_URL_ORGANIZATION_IDENTIFIER = "organization-identifier"; String EXTENSION_URL_ENDPOINT_IDENTIFIER = "endpoint-identifier"; diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java index 5b72bb92..d0af3e4d 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java @@ -69,19 +69,20 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var tPong = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-pong.xml"); var tPing = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-ping.xml"); var ePingResponse = StructureDefinitionResource - .file("fhir/StructureDefinition/highmed-extension-ping-response.xml"); + .file("fhir/StructureDefinition/highmed-extension-ping-status.xml"); var cPing = CodeSystemResource.file("fhir/CodeSystem/highmed-ping.xml"); - var cPingResponse = CodeSystemResource.file("fhir/CodeSystem/highmed-ping-response.xml"); + var cPingStatus = CodeSystemResource.file("fhir/CodeSystem/highmed-ping-status.xml"); var vPing = ValueSetResource.file("fhir/ValueSet/highmed-ping.xml"); - var vPingResponse = ValueSetResource.file("fhir/ValueSet/highmed-ping-response.xml"); + var vPingStatus = ValueSetResource.file("fhir/ValueSet/highmed-ping-status.xml"); + var vPongStatus = ValueSetResource.file("fhir/ValueSet/highmed-pong-status.xml"); Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( "highmedorg_autostartPing/" + VERSION, Arrays.asList(aAutostart, tStartAutostart, tStopAutostart, cPing, vPing), "highmedorg_ping/" + VERSION, - Arrays.asList(aPing, tStartPing, ePingResponse, tPong, cPing, cPingResponse, vPing, vPingResponse), - "highmedorg_pong/" + VERSION, Arrays.asList(aPong, tPing)); + Arrays.asList(aPing, tStartPing, ePingResponse, tPong, cPing, cPingStatus, vPing, vPingStatus), + "highmedorg_pong/" + VERSION, Arrays.asList(aPong, tPing, cPing, cPingStatus, vPing, vPongStatus)); return ResourceProvider.read(VERSION, RELEASE_DATE, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/logging/ErrorLogger.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/logging/ErrorLogger.java new file mode 100644 index 00000000..415e3fd0 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/logging/ErrorLogger.java @@ -0,0 +1,29 @@ +package org.highmed.dsf.bpe.logging; + +import org.highmed.dsf.fhir.variables.Target; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ErrorLogger +{ + private static final Logger pingLogger = LoggerFactory.getLogger("ping-error-logger"); + private static final Logger pongLogger = LoggerFactory.getLogger("pong-error-logger"); + + public void logPingStatus(Target target, String statusCode) + { + pingLogger.debug("Ping: Organization {} at Endpoint {} {}", target.getOrganizationIdentifierValue(), + target.getEndpointIdentifierValue(), statusCode); + } + + public void logPingStatus(Target target, String statusCode, String errorMessage) + { + pingLogger.debug("Ping: Organization {} at Endpoint {} {}: {}", target.getOrganizationIdentifierValue(), + target.getEndpointIdentifierValue(), statusCode, errorMessage); + } + + public void logPongStatus(Target target, String statusCode, String errorMessage) + { + pongLogger.debug("Pong: Organization {} at Endpoint {} {}: {}", target.getOrganizationIdentifierValue(), + target.getEndpointIdentifierValue(), statusCode, errorMessage); + } +} diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java index 6ae28948..b8206517 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPing.java @@ -1,8 +1,8 @@ package org.highmed.dsf.bpe.message; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; -import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_ALLOWED; -import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_STATUS_VALUE_NOT_ALLOWED; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_STATUS_VALUE_NOT_REACHABLE; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_ENDPOINT_IDENTIFIER; import java.util.Objects; @@ -12,7 +12,8 @@ import javax.ws.rs.core.Response; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.highmed.dsf.bpe.util.PingResponseGenerator; +import org.highmed.dsf.bpe.logging.ErrorLogger; +import org.highmed.dsf.bpe.util.PingStatusGenerator; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.EndpointProvider; @@ -30,16 +31,18 @@ public class SendPing extends AbstractTaskMessageSend { private final EndpointProvider endpointProvider; - private final PingResponseGenerator responseGenerator; + private final PingStatusGenerator statusGenerator; + private final ErrorLogger errorLogger; public SendPing(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext, - EndpointProvider endpointProvider, PingResponseGenerator responseGenerator) + EndpointProvider endpointProvider, PingStatusGenerator statusGenerator, ErrorLogger errorLogger) { super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); this.endpointProvider = endpointProvider; - this.responseGenerator = responseGenerator; + this.statusGenerator = statusGenerator; + this.errorLogger = errorLogger; } @Override @@ -48,7 +51,8 @@ public void afterPropertiesSet() throws Exception super.afterPropertiesSet(); Objects.requireNonNull(endpointProvider, "endpointProvider"); - Objects.requireNonNull(responseGenerator, "responseGenerator"); + Objects.requireNonNull(statusGenerator, "statusGenerator"); + Objects.requireNonNull(errorLogger, "errorLogger"); } @Override @@ -68,22 +72,27 @@ protected void handleSendTaskError(Exception exception, String errorMessage) if (task != null) { - String responseCode = CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE; + String statusCode = CODESYSTEM_HIGHMED_PING_STATUS_VALUE_NOT_REACHABLE; if (exception instanceof WebApplicationException) { WebApplicationException webApplicationException = (WebApplicationException) exception; if (webApplicationException.getResponse() != null && webApplicationException.getResponse() .getStatus() == Response.Status.FORBIDDEN.getStatusCode()) { - responseCode = CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_ALLOWED; + statusCode = CODESYSTEM_HIGHMED_PING_STATUS_VALUE_NOT_ALLOWED; } } - task.addOutput(responseGenerator.createOutput(target, responseCode, createErrorMessage(exception))); + String specialErrorMessage = createErrorMessage(exception); + + task.addOutput(statusGenerator.createPingStatusOutput(target, statusCode, specialErrorMessage)); updateLeadingTaskInExecutionVariables(task); + + errorLogger.logPingStatus(target, statusCode, specialErrorMessage); } super.handleSendTaskError(exception, errorMessage); + } @Override diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPong.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPong.java index 3ba8659c..0cd05d96 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPong.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/message/SendPong.java @@ -1,18 +1,97 @@ package org.highmed.dsf.bpe.message; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_STATUS_VALUE_NOT_ALLOWED; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_STATUS_VALUE_NOT_REACHABLE; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_SEND; + +import java.util.Objects; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.Response; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.highmed.dsf.bpe.logging.ErrorLogger; +import org.highmed.dsf.bpe.util.PingStatusGenerator; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.OrganizationProvider; import org.highmed.dsf.fhir.task.AbstractTaskMessageSend; import org.highmed.dsf.fhir.task.TaskHelper; +import org.highmed.dsf.fhir.variables.Target; +import org.hl7.fhir.r4.model.Task; import ca.uhn.fhir.context.FhirContext; public class SendPong extends AbstractTaskMessageSend { + private final PingStatusGenerator statusGenerator; + private final ErrorLogger errorLogger; + public SendPong(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext) + ReadAccessHelper readAccessHelper, OrganizationProvider organizationProvider, FhirContext fhirContext, + PingStatusGenerator statusGenerator, ErrorLogger errorLogger) { super(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); + + this.statusGenerator = statusGenerator; + this.errorLogger = errorLogger; + } + + @Override + public void afterPropertiesSet() throws Exception + { + super.afterPropertiesSet(); + + Objects.requireNonNull(statusGenerator, "statusGenerator"); + Objects.requireNonNull(errorLogger, "errorLogger"); + } + + @Override + public void doExecute(DelegateExecution execution) throws Exception + { + super.doExecute(execution); + + Target target = getTarget(); + Task task = getLeadingTaskFromExecutionVariables(); + task.addOutput(statusGenerator.createPongStatusOutput(target, CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_SEND)); + updateLeadingTaskInExecutionVariables(task); + } + + @Override + protected void handleEndEventError(Exception exception, String errorMessage) + { + Target target = getTarget(); + Task task = getLeadingTaskFromExecutionVariables(); + + if (task != null) + { + String statusCode = CODESYSTEM_HIGHMED_PING_STATUS_VALUE_NOT_REACHABLE; + if (exception instanceof WebApplicationException) + { + WebApplicationException webApplicationException = (WebApplicationException) exception; + if (webApplicationException.getResponse() != null && webApplicationException.getResponse() + .getStatus() == Response.Status.FORBIDDEN.getStatusCode()) + { + statusCode = CODESYSTEM_HIGHMED_PING_STATUS_VALUE_NOT_ALLOWED; + } + } + + String specialErrorMessage = createErrorMessage(exception); + + task.addOutput(statusGenerator.createPongStatusOutput(target, statusCode, specialErrorMessage)); + updateLeadingTaskInExecutionVariables(task); + + errorLogger.logPongStatus(target, statusCode, specialErrorMessage); + } + + super.handleEndEventError(exception, errorMessage); + } + + private String createErrorMessage(Exception exception) + { + return exception.getClass().getSimpleName() + + ((exception.getMessage() != null && !exception.getMessage().isBlank()) + ? (": " + exception.getMessage()) + : ""); } } diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java index b4dadc8a..a86f4cda 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogNoResponse.java @@ -2,13 +2,14 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_LEADING_TASK; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; -import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_MISSING; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_MISSING; import java.util.Objects; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.util.PingResponseGenerator; +import org.highmed.dsf.bpe.logging.ErrorLogger; +import org.highmed.dsf.bpe.util.PingStatusGenerator; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -23,14 +24,16 @@ public class LogNoResponse extends AbstractServiceDelegate { private static final Logger logger = LoggerFactory.getLogger(LogNoResponse.class); - private final PingResponseGenerator responseGenerator; + private final PingStatusGenerator responseGenerator; + private final ErrorLogger errorLogger; public LogNoResponse(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper, PingResponseGenerator responseGenerator) + ReadAccessHelper readAccessHelper, PingStatusGenerator responseGenerator, ErrorLogger errorLogger) { super(clientProvider, taskHelper, readAccessHelper); this.responseGenerator = responseGenerator; + this.errorLogger = errorLogger; } @Override @@ -39,6 +42,7 @@ public void afterPropertiesSet() throws Exception super.afterPropertiesSet(); Objects.requireNonNull(responseGenerator, "responseGenerator"); + Objects.requireNonNull(errorLogger, "errorLogger"); } @Override @@ -57,6 +61,8 @@ private void logAndAddResponseToTask(Task task, Target target) logger.warn("PONG from organization {} (endpoint {}) missing", target.getOrganizationIdentifierValue(), target.getEndpointIdentifierValue()); - task.addOutput(responseGenerator.createOutput(target, CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_MISSING)); + task.addOutput( + responseGenerator.createPingStatusOutput(target, CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_MISSING)); + errorLogger.logPingStatus(target, CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_MISSING); } } diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java index 9a29d63d..3be9c5f4 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java @@ -2,13 +2,13 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; -import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_RECEIVED; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PING_SEND; import java.util.Objects; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.highmed.dsf.bpe.delegate.AbstractServiceDelegate; -import org.highmed.dsf.bpe.util.PingResponseGenerator; +import org.highmed.dsf.bpe.util.PingStatusGenerator; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.task.TaskHelper; @@ -23,10 +23,10 @@ public class LogPong extends AbstractServiceDelegate { private static final Logger logger = LoggerFactory.getLogger(LogPong.class); - private final PingResponseGenerator responseGenerator; + private final PingStatusGenerator responseGenerator; public LogPong(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper, - ReadAccessHelper readAccessHelper, PingResponseGenerator responseGenerator) + ReadAccessHelper readAccessHelper, PingStatusGenerator responseGenerator) { super(clientProvider, taskHelper, readAccessHelper); @@ -50,7 +50,8 @@ public void doExecute(DelegateExecution execution) target.getEndpointIdentifierValue()); Task leading = getLeadingTaskFromExecutionVariables(); - leading.addOutput(responseGenerator.createOutput(target, CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_RECEIVED)); + leading.addOutput( + responseGenerator.createPingStatusOutput(target, CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PING_SEND)); updateLeadingTaskInExecutionVariables(leading); Targets targets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java index a29f1e34..8082453f 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/spring/config/PingConfig.java @@ -1,5 +1,6 @@ package org.highmed.dsf.bpe.spring.config; +import org.highmed.dsf.bpe.logging.ErrorLogger; import org.highmed.dsf.bpe.message.SendPing; import org.highmed.dsf.bpe.message.SendPong; import org.highmed.dsf.bpe.message.SendStartPing; @@ -10,7 +11,7 @@ import org.highmed.dsf.bpe.service.SelectPongTarget; import org.highmed.dsf.bpe.service.StartTimer; import org.highmed.dsf.bpe.service.StopTimer; -import org.highmed.dsf.bpe.util.PingResponseGenerator; +import org.highmed.dsf.bpe.util.PingStatusGenerator; import org.highmed.dsf.fhir.authorization.read.ReadAccessHelper; import org.highmed.dsf.fhir.client.FhirWebserviceClientProvider; import org.highmed.dsf.fhir.organization.EndpointProvider; @@ -62,22 +63,29 @@ public StopTimer stopTimer() } @Bean - public PingResponseGenerator responseGenerator() + public PingStatusGenerator responseGenerator() { - return new PingResponseGenerator(); + return new PingStatusGenerator(); + } + + @Bean + public ErrorLogger errorLogger() + { + return new ErrorLogger(); } @Bean public SendPing sendPing() { return new SendPing(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext, - endpointProvider, responseGenerator()); + endpointProvider, responseGenerator(), errorLogger()); } @Bean public SendPong sendPong() { - return new SendPong(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext); + return new SendPong(clientProvider, taskHelper, readAccessHelper, organizationProvider, fhirContext, + responseGenerator(), errorLogger()); } @Bean @@ -95,7 +103,7 @@ public LogPong logPong() @Bean public LogNoResponse logNoResponse() { - return new LogNoResponse(clientProvider, taskHelper, readAccessHelper, responseGenerator()); + return new LogNoResponse(clientProvider, taskHelper, readAccessHelper, responseGenerator(), errorLogger()); } @Bean diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseGenerator.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingStatusGenerator.java similarity index 63% rename from dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseGenerator.java rename to dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingStatusGenerator.java index b5171d2f..8e762c5d 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingResponseGenerator.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/util/PingStatusGenerator.java @@ -3,13 +3,14 @@ import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; -import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE; -import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_PING_RESPONSE; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_STATUS; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_PING_STATUS; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_PONG_STATUS; import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_CORRELATION_KEY; import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_ERROR_MESSAGE; import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_PING_RESPONSE; +import static org.highmed.dsf.bpe.ConstantsPing.EXTENSION_URL_PING_STATUS; import org.highmed.dsf.fhir.variables.Target; import org.hl7.fhir.r4.model.Coding; @@ -18,22 +19,37 @@ import org.hl7.fhir.r4.model.StringType; import org.hl7.fhir.r4.model.Task.TaskOutputComponent; -public class PingResponseGenerator +public class PingStatusGenerator { - public TaskOutputComponent createOutput(Target target, String pingResponseCode) + public TaskOutputComponent createPingStatusOutput(Target target, String statusCode) { - return createOutput(target, pingResponseCode, null); + return createPingStatusOutput(target, statusCode, null); } - public TaskOutputComponent createOutput(Target target, String pingResponseCode, String errorMessage) + public TaskOutputComponent createPingStatusOutput(Target target, String statusCode, String errorMessage) + { + return createStatusOutput(target, CODESYSTEM_HIGHMED_PING_VALUE_PING_STATUS, statusCode, errorMessage); + } + + public TaskOutputComponent createPongStatusOutput(Target target, String statusCode) + { + return createPongStatusOutput(target, statusCode, null); + } + + public TaskOutputComponent createPongStatusOutput(Target target, String statusCode, String errorMessage) + { + return createStatusOutput(target, CODESYSTEM_HIGHMED_PING_VALUE_PONG_STATUS, statusCode, errorMessage); + } + + private TaskOutputComponent createStatusOutput(Target target, String outputParameter, String statusCode, + String errorMessage) { TaskOutputComponent output = new TaskOutputComponent(); - output.setValue(new Coding().setSystem(CODESYSTEM_HIGHMED_PING_RESPONSE).setCode(pingResponseCode)); - output.getType().addCoding().setSystem(CODESYSTEM_HIGHMED_PING) - .setCode(CODESYSTEM_HIGHMED_PING_VALUE_PING_RESPONSE); + output.setValue(new Coding().setSystem(CODESYSTEM_HIGHMED_PING_STATUS).setCode(statusCode)); + output.getType().addCoding().setSystem(CODESYSTEM_HIGHMED_PING).setCode(outputParameter); Extension extension = output.addExtension(); - extension.setUrl(EXTENSION_URL_PING_RESPONSE); + extension.setUrl(EXTENSION_URL_PING_STATUS); extension.addExtension(EXTENSION_URL_CORRELATION_KEY, new StringType(target.getCorrelationKey())); extension.addExtension().setUrl(EXTENSION_URL_ORGANIZATION_IDENTIFIER) .setValue(new Identifier().setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-response.xml b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-status.xml similarity index 54% rename from dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-response.xml rename to dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-status.xml index 7251972b..25a8d548 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-response.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-status.xml @@ -5,40 +5,45 @@ <code value="ALL" /> </tag> </meta> - <url value="http://highmed.org/fhir/CodeSystem/ping-response" /> + <url value="http://highmed.org/fhir/CodeSystem/ping-status" /> <!-- version managed by bpe --> <version value="#{version}" /> - <name value="HiGHmed_Ping_Response" /> - <title value="HiGHmed Ping Response" /> + <name value="HiGHmed_Ping_Status" /> + <title value="HiGHmed Ping Status" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> <!-- date managed by bpe --> <date value="#{date}" /> <publisher value="HiGHmed" /> - <description value="CodeSystem with ping response status values" /> + <description value="CodeSystem with ping/pong status values" /> <caseSensitive value="true" /> <hierarchyMeaning value="grouped-by" /> <versionNeeded value="false" /> <content value="complete" /> - <concept> - <code value="received" /> - <display value="Received" /> - <definition value="Pong received from the pinged organization" /> - </concept> <concept> <code value="missing" /> <display value="Missing" /> - <definition value="Pong was not received from the pinged organization" /> + <definition value="No pong received from target organization" /> + </concept> + <concept> + <code value="not-allowed" /> + <display value="Not allowed" /> + <definition value="Not allowed to start pong-process at target organization" /> </concept> <concept> <code value="not-reachable" /> <display value="Not reachable" /> - <definition value="Ping could not be sent to the organization" /> + <definition value="Ping could not be sent to target organization" /> </concept> <concept> - <code value="not-allowed" /> - <display value="Not allowed" /> - <definition value="Missing authorization to start the Pong process at the organization" /> + <code value="ping-send" /> + <display value="Ping send" /> + <definition value="Ping successfully sent to target organization" /> + </concept> + <concept> + <code value="pong-send" /> + <display value="Pong send" /> + <definition value="Pong successfully sent to target organization" /> </concept> </CodeSystem> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml index 7128fd64..a0fa2ebe 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping.xml @@ -16,15 +16,20 @@ <!-- date managed by bpe --> <date value="#{date}" /> <publisher value="HiGHmed" /> - <description value="CodeSystem with standard values for the process ping" /> + <description value="CodeSystem with standard values for the process ping/pong" /> <caseSensitive value="true" /> <hierarchyMeaning value="grouped-by" /> <versionNeeded value="false" /> <content value="complete" /> <concept> - <code value="ping-response" /> - <display value="Ping Response" /> - <definition value="Response status of a pinged organization" /> + <code value="ping-status" /> + <display value="Ping Status" /> + <definition value="Ping status of target organization" /> + </concept> + <concept> + <code value="pong-status" /> + <display value="Pong Status" /> + <definition value="Pong status of target organization" /> </concept> <concept> <code value="endpoint-identifier" /> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-extension-ping-response.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-extension-ping-status.xml similarity index 98% rename from dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-extension-ping-response.xml rename to dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-extension-ping-status.xml index 794ff1d8..c1f8c1a4 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-extension-ping-response.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-extension-ping-status.xml @@ -5,7 +5,7 @@ <code value="ALL"/> </tag> </meta> - <url value="http://highmed.org/fhir/StructureDefinition/extension-ping-response"/> + <url value="http://highmed.org/fhir/StructureDefinition/extension-ping-status"/> <!-- version managed by bpe --> <version value="#{version}" /> <name value="PingResponse"/> @@ -124,7 +124,7 @@ </element> <element id="Extension.url"> <path value="Extension.url"/> - <fixedUri value="http://highmed.org/fhir/StructureDefinition/extension-ping-response"/> + <fixedUri value="http://highmed.org/fhir/StructureDefinition/extension-ping-status"/> </element> <element id="Extension.value[x]"> <path value="Extension.value[x]"/> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml index f84b270f..7b26069e 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml @@ -117,5 +117,69 @@ <path value="Task.input.value[x].identifier.value" /> <min value="1" /> </element> + <element id="Task.output:pong-status"> + <path value="Task.output"/> + <sliceName value="pong-status"/> + </element> + <element id="Task.output:pong-status.extension"> + <path value="Task.output.extension" /> + <slicing> + <discriminator> + <type value="value" /> + <path value="url" /> + </discriminator> + <rules value="open" /> + </slicing> + </element> + <element id="Task.output:pong-status.extension:pong-status-extension"> + <path value="Task.output.extension" /> + <sliceName value="pong-status-extension" /> + <min value="1" /> + <type> + <code value="Extension" /> + <profile value="http://highmed.org/fhir/StructureDefinition/extension-ping-status" /> + </type> + </element> + <element id="Task.output:pong-status.type"> + <path value="Task.output.type"/> + <binding> + <strength value="required"/> + <valueSet value="http://highmed.org/fhir/ValueSet/ping"/> + </binding> + </element> + <element id="Task.output:pong-status.type.coding"> + <path value="Task.output.type.coding"/> + <min value="1"/> + <max value="1"/> + </element> + <element id="Task.output:pong-status.type.coding.system"> + <path value="Task.output.type.coding.system"/> + <min value="1"/> + <fixedUri value="http://highmed.org/fhir/CodeSystem/ping"/> + </element> + <element id="Task.output:pong-status.type.coding.code"> + <path value="Task.output.type.coding.code"/> + <min value="1"/> + <fixedCode value="pong-status"/> + </element> + <element id="Task.output:pong-status.value[x]"> + <path value="Task.output.value[x]"/> + <type> + <code value="Coding"/> + </type> + </element> + <element id="Task.output:pong-status.value[x].system"> + <path value="Task.output.value[x].system"/> + <min value="1"/> + <fixedUri value="http://highmed.org/fhir/CodeSystem/ping-status"/> + </element> + <element id="Task.output:pong-status.value[x].code"> + <path value="Task.output.value[x].code"/> + <min value="1"/> + <binding> + <strength value="required"/> + <valueSet value="http://highmed.org/fhir/ValueSet/pong-status"/> + </binding> + </element> </differential> </StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml index 6b69a95e..f76093db 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml @@ -131,11 +131,11 @@ <code value="string" /> </type> </element> - <element id="Task.output:ping-response"> + <element id="Task.output:ping-status"> <path value="Task.output"/> - <sliceName value="ping-response"/> + <sliceName value="ping-status"/> </element> - <element id="Task.output:ping-response.extension"> + <element id="Task.output:ping-status.extension"> <path value="Task.output.extension" /> <slicing> <discriminator> @@ -145,54 +145,54 @@ <rules value="open" /> </slicing> </element> - <element id="Task.output:ping-response.extension:ping-response-extension"> + <element id="Task.output:ping-status.extension:ping-status-extension"> <path value="Task.output.extension" /> - <sliceName value="ping-response-extension" /> + <sliceName value="ping-status-extension" /> <min value="1" /> <type> <code value="Extension" /> - <profile value="http://highmed.org/fhir/StructureDefinition/extension-ping-response" /> + <profile value="http://highmed.org/fhir/StructureDefinition/extension-ping-status" /> </type> </element> - <element id="Task.output:ping-response.type"> + <element id="Task.output:ping-status.type"> <path value="Task.output.type"/> <binding> <strength value="required"/> <valueSet value="http://highmed.org/fhir/ValueSet/ping"/> </binding> </element> - <element id="Task.output:ping-response.type.coding"> + <element id="Task.output:ping-status.type.coding"> <path value="Task.output.type.coding"/> <min value="1"/> <max value="1"/> </element> - <element id="Task.output:ping-response.type.coding.system"> + <element id="Task.output:ping-status.type.coding.system"> <path value="Task.output.type.coding.system"/> <min value="1"/> <fixedUri value="http://highmed.org/fhir/CodeSystem/ping"/> </element> - <element id="Task.output:ping-response.type.coding.code"> + <element id="Task.output:ping-status.type.coding.code"> <path value="Task.output.type.coding.code"/> <min value="1"/> - <fixedCode value="ping-response"/> + <fixedCode value="ping-status"/> </element> - <element id="Task.output:ping-response.value[x]"> + <element id="Task.output:ping-status.value[x]"> <path value="Task.output.value[x]"/> <type> <code value="Coding"/> </type> </element> - <element id="Task.output:ping-response.value[x].system"> + <element id="Task.output:ping-status.value[x].system"> <path value="Task.output.value[x].system"/> <min value="1"/> - <fixedUri value="http://highmed.org/fhir/CodeSystem/ping-response"/> + <fixedUri value="http://highmed.org/fhir/CodeSystem/ping-status"/> </element> - <element id="Task.output:ping-response.value[x].code"> + <element id="Task.output:ping-status.value[x].code"> <path value="Task.output.value[x].code"/> <min value="1"/> <binding> <strength value="required"/> - <valueSet value="http://highmed.org/fhir/ValueSet/ping-response"/> + <valueSet value="http://highmed.org/fhir/ValueSet/ping-status"/> </binding> </element> </differential> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-response.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-response.xml deleted file mode 100644 index 9fd30588..00000000 --- a/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-response.xml +++ /dev/null @@ -1,26 +0,0 @@ -<ValueSet xmlns="http://hl7.org/fhir"> - <meta> - <tag> - <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> - <code value="ALL" /> - </tag> - </meta> - <url value="http://highmed.org/fhir/ValueSet/ping-response" /> - <!-- version managed by bpe --> - <version value="#{version}" /> - <name value="HiGHmed_Ping_Response" /> - <title value="HiGHmed Ping Response" /> - <!-- status managed by bpe --> - <status value="unknown" /> - <experimental value="false" /> - <!-- date managed by bpe --> - <date value="#{date}" /> - <publisher value="HiGHmed" /> - <description value="ValueSet with ping response status values" /> - <immutable value="true" /> - <compose> - <include> - <system value="http://highmed.org/fhir/CodeSystem/ping-response" /> - </include> - </compose> -</ValueSet> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-status.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-status.xml new file mode 100644 index 00000000..0f273e83 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-status.xml @@ -0,0 +1,42 @@ +<ValueSet xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/ValueSet/ping-status" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="HiGHmed_Ping_Status" /> + <title value="HiGHmed Ping Status" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="HiGHmed" /> + <description value="ValueSet with ping status values" /> + <immutable value="true" /> + <compose> + <include> + <system value="http://highmed.org/fhir/CodeSystem/ping-status" /> + <concept> + <code value="missing" /> + <display value="Missing" /> + </concept> + <concept> + <code value="not-allowed" /> + <display value="Not allowed" /> + </concept> + <concept> + <code value="not-reachable" /> + <display value="Not reachable" /> + </concept> + <concept> + <code value="ping-send" /> + <display value="Ping send" /> + </concept> + </include> + </compose> +</ValueSet> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping.xml index 79f5ff37..a1731a31 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping.xml @@ -16,7 +16,7 @@ <!-- date managed by bpe --> <date value="#{date}" /> <publisher value="HiGHmed" /> - <description value="ValueSet with standard values for the process ping" /> + <description value="ValueSet with standard values for the process ping/pong" /> <immutable value="true" /> <compose> <include> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-pong-status.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-pong-status.xml new file mode 100644 index 00000000..e9d98650 --- /dev/null +++ b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-pong-status.xml @@ -0,0 +1,38 @@ +<ValueSet xmlns="http://hl7.org/fhir"> + <meta> + <tag> + <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <code value="ALL" /> + </tag> + </meta> + <url value="http://highmed.org/fhir/ValueSet/pong-status" /> + <!-- version managed by bpe --> + <version value="#{version}" /> + <name value="HiGHmed_Pong_Status" /> + <title value="HiGHmed Pong Status" /> + <!-- status managed by bpe --> + <status value="unknown" /> + <experimental value="false" /> + <!-- date managed by bpe --> + <date value="#{date}" /> + <publisher value="HiGHmed" /> + <description value="ValueSet with pong status values" /> + <immutable value="true" /> + <compose> + <include> + <system value="http://highmed.org/fhir/CodeSystem/ping-status" /> + <concept> + <code value="not-allowed" /> + <display value="Not allowed" /> + </concept> + <concept> + <code value="not-reachable" /> + <display value="Not reachable" /> + </concept> + <concept> + <code value="pong-send" /> + <display value="Pong send" /> + </concept> + </include> + </compose> +</ValueSet> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java index 043f7af0..4b91bfb4 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java @@ -7,7 +7,8 @@ import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; -import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_STATUS_VALUE_NOT_REACHABLE; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_SEND; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_ENDPOINT_IDENTIFIER; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_TIMER_INTERVAL; @@ -33,7 +34,7 @@ import java.util.Date; import java.util.UUID; -import org.highmed.dsf.bpe.util.PingResponseGenerator; +import org.highmed.dsf.bpe.util.PingStatusGenerator; import org.highmed.dsf.fhir.validation.ResourceValidator; import org.highmed.dsf.fhir.validation.ResourceValidatorImpl; import org.highmed.dsf.fhir.validation.ValidationSupportRule; @@ -61,11 +62,11 @@ public class TaskProfileTest public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-task-start-autostart.xml", "highmed-task-stop-autostart.xml", "highmed-task-start-ping-process.xml", "highmed-task-ping.xml", - "highmed-task-pong.xml", "highmed-extension-ping-response.xml"), + "highmed-task-pong.xml", "highmed-extension-ping-status.xml"), Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", "highmed-ping.xml", - "highmed-ping-response.xml"), + "highmed-ping-status.xml"), Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", "highmed-ping.xml", - "highmed-ping-response.xml")); + "highmed-ping-status.xml", "highmed-pong-status.xml")); private ResourceValidator resourceValidator = new ResourceValidatorImpl(validationRule.getFhirContext(), validationRule.getValidationSupport()); @@ -211,7 +212,7 @@ public void testTaskStartPingProcessProfileValidWithBuisnessKeyOutput() throws E } @Test - public void testTaskStartPingProcessProfileValidWithBusinessKeyAndPingResponseOutput() throws Exception + public void testTaskStartPingProcessProfileValidWithBusinessKeyAndPingStatusOutput() throws Exception { Task task = createValidTaskStartPingProcess(); task.addOutput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() @@ -219,8 +220,8 @@ public void testTaskStartPingProcessProfileValidWithBusinessKeyAndPingResponseOu Target target = Target.createBiDirectionalTarget("target.org", "endpoint.target.org", "https://endpoint.target.org/fhir", UUID.randomUUID().toString()); - task.addOutput(new PingResponseGenerator().createOutput(target, - CODESYSTEM_HIGHMED_PING_RESPONSE_VALUE_NOT_REACHABLE, "some error message")); + task.addOutput(new PingStatusGenerator().createPingStatusOutput(target, + CODESYSTEM_HIGHMED_PING_STATUS_VALUE_NOT_REACHABLE, "some error message")); ValidationResult result = resourceValidator.validate(task); ValidationSupportRule.logValidationMessages(logger, result); @@ -299,6 +300,22 @@ public void testTaskPingValid() throws Exception || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); } + @Test + public void testTaskPingValidWithPingStatusOutput() throws Exception + { + Task task = createValidTaskPing(); + task.addOutput(new PingStatusGenerator().createPongStatusOutput( + Target.createBiDirectionalTarget("target.org", "endpoint.target.org", + "https://endpoint.target.org/fhir", UUID.randomUUID().toString()), + CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_SEND)); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(0, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + private Task createValidTaskPing() { Task task = new Task(); @@ -320,7 +337,7 @@ private Task createValidTaskPing() .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY); task.addInput() .setValue(new Reference().setIdentifier(new Identifier() - .setSystem(NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER).setValue("endpoint.org.com")) + .setSystem(NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER).setValue("endpoint.target.org")) .setType(ResourceType.Endpoint.name())) .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_PING) .setCode(CODESYSTEM_HIGHMED_PING_VALUE_ENDPOINT_IDENTIFIER); From 07d706a3b5aa4998587ddce50d8ae4ca51d9e20d Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Tue, 3 May 2022 03:02:31 +0200 Subject: [PATCH 118/125] fixes and renamed ping/pong status codes --- .../java/org/highmed/dsf/bpe/ConstantsPing.java | 4 ++-- .../dsf/bpe/PingProcessPluginDefinition.java | 7 ++++--- .../org/highmed/dsf/bpe/service/LogPong.java | 4 ++-- .../fhir/CodeSystem/highmed-ping-status.xml | 16 ++++++++-------- .../fhir/ValueSet/highmed-ping-status.xml | 15 ++++++++------- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java index f4784dc5..873db5ab 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java @@ -44,10 +44,10 @@ public interface ConstantsPing String CODESYSTEM_HIGHMED_PING_VALUE_TIMER_INTERVAL = "timer-interval"; String CODESYSTEM_HIGHMED_PING_STATUS = "http://highmed.org/fhir/CodeSystem/ping-status"; - String CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_MISSING = "pong-missing"; String CODESYSTEM_HIGHMED_PING_STATUS_VALUE_NOT_ALLOWED = "not-allowed"; String CODESYSTEM_HIGHMED_PING_STATUS_VALUE_NOT_REACHABLE = "not-reachable"; - String CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PING_SEND = "ping-send"; + String CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_MISSING = "pong-missing"; + String CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_RECEIVED = "pong-received"; String CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_SEND = "pong-send"; String EXTENSION_URL_PING_STATUS = "http://highmed.org/fhir/StructureDefinition/extension-ping-status"; diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java index d0af3e4d..e9387610 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java @@ -68,7 +68,7 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader .file("fhir/StructureDefinition/highmed-task-start-ping-process.xml"); var tPong = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-pong.xml"); var tPing = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-ping.xml"); - var ePingResponse = StructureDefinitionResource + var ePingStatus = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-extension-ping-status.xml"); var cPing = CodeSystemResource.file("fhir/CodeSystem/highmed-ping.xml"); @@ -81,8 +81,9 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( "highmedorg_autostartPing/" + VERSION, Arrays.asList(aAutostart, tStartAutostart, tStopAutostart, cPing, vPing), "highmedorg_ping/" + VERSION, - Arrays.asList(aPing, tStartPing, ePingResponse, tPong, cPing, cPingStatus, vPing, vPingStatus), - "highmedorg_pong/" + VERSION, Arrays.asList(aPong, tPing, cPing, cPingStatus, vPing, vPongStatus)); + Arrays.asList(aPing, tStartPing, ePingStatus, tPong, cPing, cPingStatus, vPing, vPingStatus), + "highmedorg_pong/" + VERSION, + Arrays.asList(aPong, tPing, ePingStatus, cPing, cPingStatus, vPing, vPongStatus)); return ResourceProvider.read(VERSION, RELEASE_DATE, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java index 3be9c5f4..5f967bcb 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/service/LogPong.java @@ -2,7 +2,7 @@ import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGET; import static org.highmed.dsf.bpe.ConstantsBase.BPMN_EXECUTION_VARIABLE_TARGETS; -import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PING_SEND; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_RECEIVED; import java.util.Objects; @@ -51,7 +51,7 @@ public void doExecute(DelegateExecution execution) Task leading = getLeadingTaskFromExecutionVariables(); leading.addOutput( - responseGenerator.createPingStatusOutput(target, CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PING_SEND)); + responseGenerator.createPingStatusOutput(target, CODESYSTEM_HIGHMED_PING_STATUS_VALUE_PONG_RECEIVED)); updateLeadingTaskInExecutionVariables(leading); Targets targets = (Targets) execution.getVariable(BPMN_EXECUTION_VARIABLE_TARGETS); diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-status.xml b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-status.xml index 25a8d548..454c1dab 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-status.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/CodeSystem/highmed-ping-status.xml @@ -21,11 +21,6 @@ <hierarchyMeaning value="grouped-by" /> <versionNeeded value="false" /> <content value="complete" /> - <concept> - <code value="missing" /> - <display value="Missing" /> - <definition value="No pong received from target organization" /> - </concept> <concept> <code value="not-allowed" /> <display value="Not allowed" /> @@ -37,9 +32,14 @@ <definition value="Ping could not be sent to target organization" /> </concept> <concept> - <code value="ping-send" /> - <display value="Ping send" /> - <definition value="Ping successfully sent to target organization" /> + <code value="pong-missing" /> + <display value="Pong missing" /> + <definition value="No pong received from target organization" /> + </concept> + <concept> + <code value="pong-received" /> + <display value="Pong received" /> + <definition value="Pong received from target organization" /> </concept> <concept> <code value="pong-send" /> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-status.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-status.xml index 0f273e83..ded7431a 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-status.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/ValueSet/highmed-ping-status.xml @@ -1,7 +1,8 @@ <ValueSet xmlns="http://hl7.org/fhir"> <meta> <tag> - <system value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> + <system + value="http://highmed.org/fhir/CodeSystem/read-access-tag" /> <code value="ALL" /> </tag> </meta> @@ -21,10 +22,6 @@ <compose> <include> <system value="http://highmed.org/fhir/CodeSystem/ping-status" /> - <concept> - <code value="missing" /> - <display value="Missing" /> - </concept> <concept> <code value="not-allowed" /> <display value="Not allowed" /> @@ -34,8 +31,12 @@ <display value="Not reachable" /> </concept> <concept> - <code value="ping-send" /> - <display value="Ping send" /> + <code value="pong-missing" /> + <display value="Pong missing" /> + </concept> + <concept> + <code value="pong-received" /> + <display value="Pong received" /> </concept> </include> </compose> From 75673000262dbf1f6c61ab606ca354f460e9ac84 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Tue, 3 May 2022 15:59:44 +0200 Subject: [PATCH 119/125] added ISO 8601 regex pattern for the timer interval input parameter --- .../highmed-task-start-autostart.xml | 6 ++++++ .../highmed/dsf/fhir/profiles/TaskProfileTest.java | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-autostart.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-autostart.xml index 92762760..c2bde407 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-autostart.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-autostart.xml @@ -139,6 +139,12 @@ <type> <code value="string" /> </type> + <constraint> + <key value="timer-interval-regex" /> + <severity value="error" /> + <human value="Must be ISO 8601 time duration pattern" /> + <expression value="matches('^P(?:([0-9]+)Y)?(?:([0-9]+)M)?(?:([0-9]+)D)?(T(?:([0-9]+)H)?(?:([0-9]+)M)?(?:([0-9]+)(?:[.,]([0-9]{0,9}))?S)?)?$')" /> + </constraint> </element> </differential> </StructureDefinition> \ No newline at end of file diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java index 4b91bfb4..e496602b 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java @@ -114,6 +114,20 @@ public void testTaskStartAutostartProcessProfileValidTimerInterval() throws Exce || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); } + @Test + public void testTaskStartAutostartProcessProfileNotValidTimerInterval() throws Exception + { + Task task = createValidTaskStartAutostartProcess(); + task.addInput().setValue(new StringType("invalid_duration")).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_PING).setCode(CODESYSTEM_HIGHMED_PING_VALUE_TIMER_INTERVAL); + + ValidationResult result = resourceValidator.validate(task); + ValidationSupportRule.logValidationMessages(logger, result); + + assertEquals(1, result.getMessages().stream().filter(m -> ResultSeverityEnum.ERROR.equals(m.getSeverity()) + || ResultSeverityEnum.FATAL.equals(m.getSeverity())).count()); + } + private Task createValidTaskStartAutostartProcess() { Task task = new Task(); From cedc7c822555e2c3fa05cd2d7a45569fda4237c5 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Tue, 3 May 2022 19:55:56 +0200 Subject: [PATCH 120/125] some renaming, additional process name constants --- .../org/highmed/dsf/bpe/ConstantsPing.java | 45 +++-- .../dsf/bpe/PingProcessPluginDefinition.java | 40 +++-- .../{autostart.bpmn => ping-autostart.bpmn} | 154 +++++++++--------- .../src/main/resources/bpe/ping.bpmn | 6 +- .../src/main/resources/bpe/pong.bpmn | 14 +- ...tostart.xml => highmed-ping-autostart.xml} | 14 +- .../fhir/ActivityDefinition/highmed-ping.xml | 6 +- .../fhir/ActivityDefinition/highmed-pong.xml | 2 +- .../StructureDefinition/highmed-task-ping.xml | 2 +- .../StructureDefinition/highmed-task-pong.xml | 2 +- ... => highmed-task-start-ping-autostart.xml} | 8 +- ...rocess.xml => highmed-task-start-ping.xml} | 6 +- ...l => highmed-task-stop-ping-autostart.xml} | 8 +- ...ostartPing3MedicFromTtpExampleStarter.java | 12 +- ...ostartPing3MedicFromTtpExampleStarter.java | 14 +- .../ActivityDefinitionProfileTest.java | 4 +- .../dsf/fhir/profiles/TaskProfileTest.java | 32 ++-- 17 files changed, 192 insertions(+), 177 deletions(-) rename dsf-bpe-process-ping/src/main/resources/bpe/{autostart.bpmn => ping-autostart.bpmn} (75%) rename dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/{highmed-autostart.xml => highmed-ping-autostart.xml} (85%) rename dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/{highmed-task-start-autostart.xml => highmed-task-start-ping-autostart.xml} (96%) rename dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/{highmed-task-start-ping-process.xml => highmed-task-start-ping.xml} (98%) rename dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/{highmed-task-stop-autostart.xml => highmed-task-stop-ping-autostart.xml} (90%) diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java index 873db5ab..35920d19 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java @@ -5,36 +5,47 @@ public interface ConstantsPing { - String PROFILE_HIGHMED_TASK_START_AUTOSTART = "http://highmed.org/fhir/StructureDefinition/task-start-autostart-ping-process"; - String PROFILE_HIGHMED_TASK_START_AUTOSTART_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_START_AUTOSTART + "|" - + VERSION; - String PROFILE_HIGHMED_TASK_START_AUTOSTART_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "autostartPing/"; - String PROFILE_HIGHMED_TASK_START_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_START_AUTOSTART_PROCESS_URI + String PROCESS_NAME_PING_AUTOSTART = "pingAutostart"; + String PROCESS_NAME_PING = "ping"; + String PROCESS_NAME_PONG = "pong"; + + String PROCESS_FULL_NAME_PING_AUTOSTART = "highmedorg_" + PROCESS_NAME_PING_AUTOSTART; + String PROCESS_FULL_NAME_PING = "highmedorg_" + PROCESS_NAME_PING; + String PROCESS_FULL_NAME_PONG = "highmedorg_" + PROCESS_NAME_PONG; + + String PROFILE_HIGHMED_TASK_START_PING_AUTOSTART = "http://highmed.org/fhir/StructureDefinition/task-start-ping-autostart"; + String PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_START_PING_AUTOSTART + + "|" + VERSION; + String PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + + PROCESS_NAME_PING_AUTOSTART + "/"; + String PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_PROCESS_URI + VERSION; - String PROFILE_HIGHMED_TASK_START_AUTOSTART_MESSAGE_NAME = "startAutostartPingProcessMessage"; + String PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_MESSAGE_NAME = "startPingAutostart"; - String PROFILE_HIGHMED_TASK_STOP_AUTOSTART = "http://highmed.org/fhir/StructureDefinition/task-stop-autostart-ping-process"; - String PROFILE_HIGHMED_TASK_STOP_AUTOSTART_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_STOP_AUTOSTART + "|" + VERSION; - String PROFILE_HIGHMED_TASK_STOP_AUTOSTART_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "autostartPing/"; - String PROFILE_HIGHMED_TASK_STOP_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_STOP_AUTOSTART_PROCESS_URI + String PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART = "http://highmed.org/fhir/StructureDefinition/task-stop-ping-autostart"; + String PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART + "|" + + VERSION; + String PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + PROCESS_NAME_PING_AUTOSTART + + "/"; + String PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_PROCESS_URI + VERSION; - String PROFILE_HIGHMED_TASK_STOP_AUTOSTART_MESSAGE_NAME = "stopAutostartPingProcessMessage"; + String PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_MESSAGE_NAME = "stopPingAutostart"; - String PROFILE_HIGHMED_TASK_START_PING = "http://highmed.org/fhir/StructureDefinition/task-start-ping-process"; + String PROFILE_HIGHMED_TASK_START_PING = "http://highmed.org/fhir/StructureDefinition/task-start-ping"; String PROFILE_HIGHMED_TASK_START_PING_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_START_PING + "|" + VERSION; - String PROFILE_HIGHMED_TASK_START_PING_MESSAGE_NAME = "startPingProcessMessage"; + String PROFILE_HIGHMED_TASK_START_PING_MESSAGE_NAME = "startPing"; String PROFILE_HIGHMED_TASK_PING = "http://highmed.org/fhir/StructureDefinition/task-ping"; String PROFILE_HIGHMED_TASK_PING_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_PING + "|" + VERSION; - String PROFILE_HIGHMED_TASK_PING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "ping/"; + String PROFILE_HIGHMED_TASK_PING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + PROCESS_NAME_PING + "/"; String PROFILE_HIGHMED_TASK_PING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_PING_PROCESS_URI + VERSION; - String PROFILE_HIGHMED_TASK_PING_MESSAGE_NAME = "pingMessage"; + String PROFILE_HIGHMED_TASK_PING_MESSAGE_NAME = "ping"; String PROFILE_HIGHMED_TASK_PONG_TASK = "http://highmed.org/fhir/StructureDefinition/task-pong"; String PROFILE_HIGHMED_TASK_PONG_TASK_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_PONG_TASK + "|" + VERSION; - String PROFILE_HIGHMED_TASK_PONG_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "pong/"; + String PROFILE_HIGHMED_TASK_PONG_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + PROCESS_NAME_PONG + "/"; String PROFILE_HIGHMED_TASK_PONG_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_PONG_PROCESS_URI + VERSION; - String PROFILE_HIGHMED_TASK_PONG_MESSAGE_NAME = "pongMessage"; + String PROFILE_HIGHMED_TASK_PONG_MESSAGE_NAME = "pong"; String CODESYSTEM_HIGHMED_PING = "http://highmed.org/fhir/CodeSystem/ping"; String CODESYSTEM_HIGHMED_PING_VALUE_PING_STATUS = "ping-status"; diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java index e9387610..369324ce 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java @@ -1,5 +1,9 @@ package org.highmed.dsf.bpe; +import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_FULL_NAME_PING; +import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_FULL_NAME_PING_AUTOSTART; +import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_FULL_NAME_PONG; + import java.time.LocalDate; import java.util.Arrays; import java.util.List; @@ -43,7 +47,7 @@ public LocalDate getReleaseDate() @Override public Stream<String> getBpmnFiles() { - return Stream.of("bpe/autostart.bpmn", "bpe/ping.bpmn", "bpe/pong.bpmn"); + return Stream.of("bpe/ping-autostart.bpmn", "bpe/ping.bpmn", "bpe/pong.bpmn"); } @Override @@ -56,34 +60,34 @@ public Stream<Class<?>> getSpringConfigClasses() public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader, PropertyResolver resolver) { - var aAutostart = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-autostart.xml"); var aPing = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-ping.xml"); + var aPingAutostart = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-ping-autostart.xml"); var aPong = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-pong.xml"); - var tStartAutostart = StructureDefinitionResource - .file("fhir/StructureDefinition/highmed-task-start-autostart.xml"); - var tStopAutostart = StructureDefinitionResource - .file("fhir/StructureDefinition/highmed-task-stop-autostart.xml"); - var tStartPing = StructureDefinitionResource - .file("fhir/StructureDefinition/highmed-task-start-ping-process.xml"); - var tPong = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-pong.xml"); - var tPing = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-ping.xml"); - var ePingStatus = StructureDefinitionResource - .file("fhir/StructureDefinition/highmed-extension-ping-status.xml"); - var cPing = CodeSystemResource.file("fhir/CodeSystem/highmed-ping.xml"); var cPingStatus = CodeSystemResource.file("fhir/CodeSystem/highmed-ping-status.xml"); + var ePingStatus = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-extension-ping-status.xml"); + var tPing = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-ping.xml"); + var tPong = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-pong.xml"); + var tStartPing = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-start-ping.xml"); + var tStartPingAutostart = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-start-ping-autostart.xml"); + var tStopPingAutostart = StructureDefinitionResource + .file("fhir/StructureDefinition/highmed-task-stop-ping-autostart.xml"); + var vPing = ValueSetResource.file("fhir/ValueSet/highmed-ping.xml"); var vPingStatus = ValueSetResource.file("fhir/ValueSet/highmed-ping-status.xml"); var vPongStatus = ValueSetResource.file("fhir/ValueSet/highmed-pong-status.xml"); Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( - "highmedorg_autostartPing/" + VERSION, - Arrays.asList(aAutostart, tStartAutostart, tStopAutostart, cPing, vPing), "highmedorg_ping/" + VERSION, - Arrays.asList(aPing, tStartPing, ePingStatus, tPong, cPing, cPingStatus, vPing, vPingStatus), - "highmedorg_pong/" + VERSION, - Arrays.asList(aPong, tPing, ePingStatus, cPing, cPingStatus, vPing, vPongStatus)); + PROCESS_FULL_NAME_PING + "/" + VERSION, + Arrays.asList(aPing, cPing, cPingStatus, ePingStatus, tStartPing, tPong, vPing, vPingStatus), + PROCESS_FULL_NAME_PING_AUTOSTART + "/" + VERSION, + Arrays.asList(aPingAutostart, cPing, tStartPingAutostart, tStopPingAutostart, vPing), + PROCESS_FULL_NAME_PONG + "/" + VERSION, + Arrays.asList(aPong, cPing, cPingStatus, ePingStatus, tPing, vPing, vPongStatus)); return ResourceProvider.read(VERSION, RELEASE_DATE, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/autostart.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/ping-autostart.bpmn similarity index 75% rename from dsf-bpe-process-ping/src/main/resources/bpe/autostart.bpmn rename to dsf-bpe-process-ping/src/main/resources/bpe/ping-autostart.bpmn index d296b367..2a8d18fc 100644 --- a/dsf-bpe-process-ping/src/main/resources/bpe/autostart.bpmn +++ b/dsf-bpe-process-ping/src/main/resources/bpe/ping-autostart.bpmn @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1bd6yss" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0"> - <bpmn:process id="highmedorg_autostartPing" isExecutable="true" camunda:versionTag="#{version}"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1bd6yss" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.11.1"> + <bpmn:process id="highmedorg_pingAutostart" isExecutable="true" camunda:versionTag="#{version}"> <bpmn:endEvent id="Event_1ukqals"> <bpmn:incoming>Flow_0stek1z</bpmn:incoming> </bpmn:endEvent> @@ -10,7 +10,7 @@ <bpmn:outgoing>Flow_0g1txh0</bpmn:outgoing> <bpmn:outgoing>Flow_0jy9ipp</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:startEvent id="AutostartPingStartMessageStartEvent" name="start autostart ping process"> + <bpmn:startEvent id="AutostartPingStartMessageStartEvent" name="start ping autostart"> <bpmn:outgoing>Flow_09o8bb5</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_1ot9xdv" messageRef="Message_13deqwn" /> </bpmn:startEvent> @@ -59,7 +59,7 @@ <bpmn:incoming>Flow_0m0cias</bpmn:incoming> <bpmn:outgoing>Flow_1vxlaau</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:intermediateCatchEvent id="AutostartPingStopMessageStartEvent" name="stop autostart ping process"> + <bpmn:intermediateCatchEvent id="AutostartPingStopMessageStartEvent" name="stop ping autostart"> <bpmn:incoming>Flow_1x5v76c</bpmn:incoming> <bpmn:outgoing>Flow_0m0cias</bpmn:outgoing> <bpmn:messageEventDefinition id="MessageEventDefinition_1d7e8jd" messageRef="Message_1ws42uv" /> @@ -73,7 +73,7 @@ </bpmn:subProcess> <bpmn:sequenceFlow id="Flow_06toths" sourceRef="Gateway_00tj0cp" targetRef="StopSubProcess" /> <bpmn:sequenceFlow id="Flow_0y9pdwn" sourceRef="StopSubProcess" targetRef="Gateway_0oa1bkj" /> - <bpmn:sequenceFlow id="Flow_0jy9ipp" sourceRef="Gateway_1xqxerc" targetRef="startPingProcess"> + <bpmn:sequenceFlow id="Flow_0jy9ipp" sourceRef="Gateway_1xqxerc" targetRef="startPing"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${!stopTimer}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="Flow_1bbw6lm" sourceRef="startTimer" targetRef="Gateway_00tj0cp" /> @@ -87,12 +87,12 @@ <bpmn:outgoing>Flow_13osd7u</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="Flow_13osd7u" sourceRef="Gateway_129hw90" targetRef="Gateway_0oa1bkj" /> - <bpmn:sequenceFlow id="Flow_1yj8623" sourceRef="startPingProcess" targetRef="Gateway_0sx5e0s" /> - <bpmn:intermediateThrowEvent id="startPingProcess" name="start ping process"> + <bpmn:sequenceFlow id="Flow_1yj8623" sourceRef="startPing" targetRef="Gateway_0sx5e0s" /> + <bpmn:intermediateThrowEvent id="startPing" name="start ping"> <bpmn:extensionElements> <camunda:inputOutput> - <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-start-ping-process|#{version}</camunda:inputParameter> - <camunda:inputParameter name="messageName">startPingProcessMessage</camunda:inputParameter> + <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-start-ping|#{version}</camunda:inputParameter> + <camunda:inputParameter name="messageName">startPing</camunda:inputParameter> <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/ping/#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> @@ -101,140 +101,140 @@ <bpmn:messageEventDefinition id="MessageEventDefinition_1gjl6d4" camunda:class="org.highmed.dsf.bpe.message.SendStartPing" /> </bpmn:intermediateThrowEvent> </bpmn:process> - <bpmn:message id="Message_13deqwn" name="startAutostartPingProcessMessage" /> - <bpmn:message id="Message_1ws42uv" name="stopAutostartPingProcessMessage" /> + <bpmn:message id="Message_13deqwn" name="startPingAutostart" /> + <bpmn:message id="Message_1ws42uv" name="stopPingAutostart" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_autostartPing"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_pingAutostart"> <bpmndi:BPMNEdge id="Flow_1yj8623_di" bpmnElement="Flow_1yj8623"> - <di:waypoint x="718" y="197" /> - <di:waypoint x="775" y="197" /> + <di:waypoint x="668" y="197" /> + <di:waypoint x="725" y="197" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_13osd7u_di" bpmnElement="Flow_13osd7u"> - <di:waypoint x="965" y="197" /> - <di:waypoint x="1035" y="197" /> + <di:waypoint x="915" y="197" /> + <di:waypoint x="985" y="197" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1bbw6lm_di" bpmnElement="Flow_1bbw6lm"> - <di:waypoint x="410" y="197" /> - <di:waypoint x="465" y="197" /> + <di:waypoint x="360" y="197" /> + <di:waypoint x="415" y="197" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0jy9ipp_di" bpmnElement="Flow_0jy9ipp"> - <di:waypoint x="625" y="197" /> - <di:waypoint x="682" y="197" /> + <di:waypoint x="575" y="197" /> + <di:waypoint x="632" y="197" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0y9pdwn_di" bpmnElement="Flow_0y9pdwn"> - <di:waypoint x="868" y="390" /> - <di:waypoint x="1060" y="390" /> - <di:waypoint x="1060" y="222" /> + <di:waypoint x="818" y="390" /> + <di:waypoint x="1010" y="390" /> + <di:waypoint x="1010" y="222" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_06toths_di" bpmnElement="Flow_06toths"> - <di:waypoint x="490" y="222" /> - <di:waypoint x="490" y="330" /> + <di:waypoint x="440" y="222" /> + <di:waypoint x="440" y="330" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1h835ja_di" bpmnElement="Flow_1h835ja"> - <di:waypoint x="825" y="197" /> - <di:waypoint x="915" y="197" /> + <di:waypoint x="775" y="197" /> + <di:waypoint x="865" y="197" /> <bpmndi:BPMNLabel> - <dc:Bounds x="827" y="176" width="67" height="14" /> + <dc:Bounds x="777" y="176" width="67" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1asxc2j_di" bpmnElement="Flow_1asxc2j"> - <di:waypoint x="800" y="222" /> - <di:waypoint x="800" y="262" /> + <di:waypoint x="750" y="222" /> + <di:waypoint x="750" y="262" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0g1txh0_di" bpmnElement="Flow_0g1txh0"> - <di:waypoint x="600" y="172" /> - <di:waypoint x="600" y="100" /> - <di:waypoint x="940" y="100" /> - <di:waypoint x="940" y="172" /> + <di:waypoint x="550" y="172" /> + <di:waypoint x="550" y="100" /> + <di:waypoint x="890" y="100" /> + <di:waypoint x="890" y="172" /> <bpmndi:BPMNLabel> - <dc:Bounds x="603" y="82" width="67" height="14" /> + <dc:Bounds x="553" y="82" width="67" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_05mfu8d_di" bpmnElement="Flow_05mfu8d"> - <di:waypoint x="515" y="197" /> - <di:waypoint x="575" y="197" /> + <di:waypoint x="465" y="197" /> + <di:waypoint x="525" y="197" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1ltiore_di" bpmnElement="Flow_1ltiore"> - <di:waypoint x="782" y="280" /> - <di:waypoint x="600" y="280" /> - <di:waypoint x="600" y="222" /> + <di:waypoint x="732" y="280" /> + <di:waypoint x="550" y="280" /> + <di:waypoint x="550" y="222" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_09o8bb5_di" bpmnElement="Flow_09o8bb5"> - <di:waypoint x="248" y="197" /> - <di:waypoint x="310" y="197" /> + <di:waypoint x="198" y="197" /> + <di:waypoint x="260" y="197" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0stek1z_di" bpmnElement="Flow_0stek1z"> - <di:waypoint x="1085" y="197" /> - <di:waypoint x="1172" y="197" /> + <di:waypoint x="1035" y="197" /> + <di:waypoint x="1122" y="197" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="Event_1ukqals_di" bpmnElement="Event_1ukqals"> - <dc:Bounds x="1172" y="179" width="36" height="36" /> + <dc:Bounds x="1122" y="179" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_1xqxerc_di" bpmnElement="Gateway_1xqxerc" isMarkerVisible="true"> - <dc:Bounds x="575" y="172" width="50" height="50" /> + <dc:Bounds x="525" y="172" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_0g2pqnk_di" bpmnElement="AutostartPingStartMessageStartEvent"> - <dc:Bounds x="212" y="179" width="36" height="36" /> + <dc:Bounds x="162" y="179" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="199" y="222" width="68" height="27" /> + <dc:Bounds x="161" y="222" width="46" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_00tj0cp_di" bpmnElement="Gateway_00tj0cp"> - <dc:Bounds x="465" y="172" width="50" height="50" /> + <dc:Bounds x="415" y="172" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_0eqigaq_di" bpmnElement="Event_0eqigaq"> - <dc:Bounds x="782" y="262" width="36" height="36" /> + <dc:Bounds x="732" y="262" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="790" y="301" width="20" height="14" /> + <dc:Bounds x="740" y="301" width="20" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0oa1bkj_di" bpmnElement="Gateway_0oa1bkj"> - <dc:Bounds x="1035" y="172" width="50" height="50" /> + <dc:Bounds x="985" y="172" width="50" height="50" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Gateway_0sx5e0s_di" bpmnElement="Gateway_0sx5e0s" isMarkerVisible="true"> - <dc:Bounds x="775" y="172" width="50" height="50" /> + <dc:Bounds x="725" y="172" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Activity_0laouxt_di" bpmnElement="startTimer"> + <dc:Bounds x="260" y="157" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Gateway_129hw90_di" bpmnElement="Gateway_129hw90" isMarkerVisible="true"> + <dc:Bounds x="865" y="172" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="Event_0dsz1xu_di" bpmnElement="startPing"> + <dc:Bounds x="632" y="179" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="628" y="222" width="46" height="14" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1kspnah_di" bpmnElement="StopSubProcess" isExpanded="true"> - <dc:Bounds x="440" y="330" width="428" height="120" /> + <dc:Bounds x="390" y="330" width="428" height="120" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Flow_1vxlaau_di" bpmnElement="Flow_1vxlaau"> - <di:waypoint x="760" y="390" /> - <di:waypoint x="812" y="390" /> + <di:waypoint x="710" y="390" /> + <di:waypoint x="762" y="390" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_1x5v76c_di" bpmnElement="Flow_1x5v76c"> - <di:waypoint x="506" y="390" /> - <di:waypoint x="572" y="390" /> + <di:waypoint x="456" y="390" /> + <di:waypoint x="522" y="390" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="Flow_0m0cias_di" bpmnElement="Flow_0m0cias"> - <di:waypoint x="608" y="390" /> - <di:waypoint x="660" y="390" /> + <di:waypoint x="558" y="390" /> + <di:waypoint x="610" y="390" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="Event_02xmnq6_di" bpmnElement="Event_02xmnq6"> - <dc:Bounds x="470" y="372" width="36" height="36" /> + <dc:Bounds x="420" y="372" width="36" height="36" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Activity_1cin90r_di" bpmnElement="StopTimer"> - <dc:Bounds x="660" y="350" width="100" height="80" /> + <dc:Bounds x="610" y="350" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1maglns_di" bpmnElement="AutostartPingStopMessageStartEvent"> - <dc:Bounds x="572" y="372" width="36" height="36" /> + <dc:Bounds x="522" y="372" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="558" y="415" width="67" height="27" /> + <dc:Bounds x="520" y="415" width="45" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Event_1ckek3z_di" bpmnElement="Event_1ckek3z"> - <dc:Bounds x="812" y="372" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Activity_0laouxt_di" bpmnElement="startTimer"> - <dc:Bounds x="310" y="157" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Gateway_129hw90_di" bpmnElement="Gateway_129hw90" isMarkerVisible="true"> - <dc:Bounds x="915" y="172" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="Event_0dsz1xu_di" bpmnElement="startPingProcess"> - <dc:Bounds x="682" y="179" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="657" y="222" width="87" height="14" /> - </bpmndi:BPMNLabel> + <dc:Bounds x="762" y="372" width="36" height="36" /> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn index cdc14e85..b726dc37 100644 --- a/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn +++ b/dsf-bpe-process-ping/src/main/resources/bpe/ping.bpmn @@ -11,7 +11,7 @@ <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/pong/#{version}</camunda:inputParameter> - <camunda:inputParameter name="messageName">pingMessage</camunda:inputParameter> + <camunda:inputParameter name="messageName">ping</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-ping|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> @@ -69,8 +69,8 @@ </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_1mpgmm5" sourceRef="BoundaryEvent_0s1l6j2" targetRef="logNoResponse" /> </bpmn:process> - <bpmn:message id="Message_10o3b8y" name="pongMessage" /> - <bpmn:message id="Message_1pklz6t" name="startPingProcessMessage" /> + <bpmn:message id="Message_10o3b8y" name="pong" /> + <bpmn:message id="Message_1pklz6t" name="startPing" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_ping"> <bpmndi:BPMNEdge id="Flow_1mpgmm5_di" bpmnElement="Flow_1mpgmm5"> diff --git a/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn b/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn index 6f4214b6..8fa87d19 100644 --- a/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn +++ b/dsf-bpe-process-ping/src/main/resources/bpe/pong.bpmn @@ -10,7 +10,7 @@ <bpmn:extensionElements> <camunda:inputOutput> <camunda:inputParameter name="instantiatesUri">http://highmed.org/bpe/Process/ping/#{version}</camunda:inputParameter> - <camunda:inputParameter name="messageName">pongMessage</camunda:inputParameter> + <camunda:inputParameter name="messageName">pong</camunda:inputParameter> <camunda:inputParameter name="profile">http://highmed.org/fhir/StructureDefinition/task-pong|#{version}</camunda:inputParameter> </camunda:inputOutput> </bpmn:extensionElements> @@ -36,11 +36,16 @@ </bpmn:boundaryEvent> <bpmn:sequenceFlow id="Flow_0yr2pmf" sourceRef="Event_1u9ooa5" targetRef="Event_05zzvx3" /> </bpmn:process> - <bpmn:message id="Message_0u91abp" name="pingMessage" /> + <bpmn:message id="Message_0u91abp" name="ping" /> <bpmn:message id="Message_1h0kvyq" name="pong" /> <bpmn:error id="Error_1j0t9ud" name="target_not_allowed" errorCode="target_not_allowed" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="highmedorg_pong"> + <bpmndi:BPMNEdge id="Flow_0yr2pmf_di" bpmnElement="Flow_0yr2pmf"> + <di:waypoint x="528" y="178" /> + <di:waypoint x="528" y="210" /> + <di:waypoint x="580" y="210" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ism9wt_di" bpmnElement="SequenceFlow_1ism9wt"> <di:waypoint x="528" y="120" /> <di:waypoint x="580" y="120" /> @@ -53,11 +58,6 @@ <di:waypoint x="209" y="120" /> <di:waypoint x="262" y="120" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="Flow_0yr2pmf_di" bpmnElement="Flow_0yr2pmf"> - <di:waypoint x="528" y="178" /> - <di:waypoint x="528" y="210" /> - <di:waypoint x="580" y="210" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="StartEvent_1qh431z_di" bpmnElement="StartEvent_1"> <dc:Bounds x="173" y="102" width="36" height="36" /> </bpmndi:BPMNShape> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-autostart.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping-autostart.xml similarity index 85% rename from dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-autostart.xml rename to dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping-autostart.xml index 374ec959..e19a77b3 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-autostart.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping-autostart.xml @@ -7,10 +7,10 @@ </meta> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> - <valueString value="startAutostartPingProcessMessage" /> + <valueString value="startPingAutostart" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-start-autostart-ping-process|#{version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-start-ping-autostart|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -27,10 +27,10 @@ </extension> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> - <valueString value="stopAutostartPingProcessMessage" /> + <valueString value="stopPingAutostart" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-stop-autostart-ping-process|#{version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-stop-ping-autostart|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -45,11 +45,11 @@ </valueCoding> </extension> </extension> - <url value="http://highmed.org/bpe/Process/autostartPing" /> + <url value="http://highmed.org/bpe/Process/pingAutostart" /> <!-- version managed by bpe --> <version value="#{version}" /> - <name value="Autostart Ping" /> - <title value="Autostart PING process" /> + <name value="Ping Autostart" /> + <title value="PING Autostart process" /> <subtitle value="Autostart Communication Testing Process" /> <!-- status managed by bpe --> <status value="unknown" /> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping.xml index 46f8f47b..5a0c1bf3 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-ping.xml @@ -7,10 +7,10 @@ </meta> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> - <valueString value="startPingProcessMessage" /> + <valueString value="startPing" /> </extension> <extension url="task-profile"> - <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-start-ping-process|#{version}" /> + <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-start-ping|#{version}" /> </extension> <extension url="requester"> <valueCoding> @@ -27,7 +27,7 @@ </extension> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> - <valueString value="pongMessage" /> + <valueString value="pong" /> </extension> <extension url="task-profile"> <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-pong|#{version}" /> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-pong.xml b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-pong.xml index 0a08bfee..50fc615d 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-pong.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/ActivityDefinition/highmed-pong.xml @@ -7,7 +7,7 @@ </meta> <extension url="http://highmed.org/fhir/StructureDefinition/extension-process-authorization"> <extension url="message-name"> - <valueString value="pingMessage" /> + <valueString value="ping" /> </extension> <extension url="task-profile"> <valueCanonical value="http://highmed.org/fhir/StructureDefinition/task-ping|#{version}" /> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml index 7b26069e..fa9266d4 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-ping.xml @@ -42,7 +42,7 @@ </element> <element id="Task.input:message-name.value[x]"> <path value="Task.input.value[x]" /> - <fixedString value="pingMessage" /> + <fixedString value="ping" /> </element> <element id="Task.input:business-key"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-pong.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-pong.xml index ab27da19..8902c126 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-pong.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-pong.xml @@ -42,7 +42,7 @@ </element> <element id="Task.input:message-name.value[x]"> <path value="Task.input.value[x]" /> - <fixedString value="pongMessage" /> + <fixedString value="pong" /> </element> <element id="Task.input:business-key"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-autostart.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-autostart.xml similarity index 96% rename from dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-autostart.xml rename to dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-autostart.xml index c2bde407..3b5adddd 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-autostart.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-autostart.xml @@ -5,10 +5,10 @@ <code value="ALL" /> </tag> </meta> - <url value="http://highmed.org/fhir/StructureDefinition/task-start-autostart-ping-process" /> + <url value="http://highmed.org/fhir/StructureDefinition/task-start-ping-autostart" /> <!-- version managed by bpe --> <version value="#{version}" /> - <name value="TaskStartAutostartPingProcess" /> + <name value="TaskStartPingAutostart" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> @@ -23,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/autostartPing/#{version}" /> + <fixedUri value="http://highmed.org/bpe/Process/pingAutostart/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> @@ -42,7 +42,7 @@ </element> <element id="Task.input:message-name.value[x]"> <path value="Task.input.value[x]" /> - <fixedString value="startAutostartPingProcessMessage" /> + <fixedString value="startPingAutostart" /> </element> <element id="Task.input:business-key"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping.xml similarity index 98% rename from dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml rename to dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping.xml index f76093db..4d532a07 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping-process.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-start-ping.xml @@ -5,10 +5,10 @@ <code value="ALL" /> </tag> </meta> - <url value="http://highmed.org/fhir/StructureDefinition/task-start-ping-process" /> + <url value="http://highmed.org/fhir/StructureDefinition/task-start-ping" /> <!-- version managed by bpe --> <version value="#{version}" /> - <name value="TaskStartProcess" /> + <name value="TaskStartPing" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> @@ -42,7 +42,7 @@ </element> <element id="Task.input:message-name.value[x]"> <path value="Task.input.value[x]" /> - <fixedString value="startPingProcessMessage" /> + <fixedString value="startPing" /> </element> <element id="Task.input:correlation-key"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-stop-autostart.xml b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-stop-ping-autostart.xml similarity index 90% rename from dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-stop-autostart.xml rename to dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-stop-ping-autostart.xml index 7d34b935..72316cf3 100644 --- a/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-stop-autostart.xml +++ b/dsf-bpe-process-ping/src/main/resources/fhir/StructureDefinition/highmed-task-stop-ping-autostart.xml @@ -5,10 +5,10 @@ <code value="ALL" /> </tag> </meta> - <url value="http://highmed.org/fhir/StructureDefinition/task-stop-autostart-ping-process" /> + <url value="http://highmed.org/fhir/StructureDefinition/task-stop-ping-autostart" /> <!-- version managed by bpe --> <version value="#{version}" /> - <name value="TaskStopAutostartPingProcess" /> + <name value="TaskStopPingAutostart" /> <!-- status managed by bpe --> <status value="unknown" /> <experimental value="false" /> @@ -23,7 +23,7 @@ <differential> <element id="Task.instantiatesUri"> <path value="Task.instantiatesUri" /> - <fixedUri value="http://highmed.org/bpe/Process/autostartPing/#{version}" /> + <fixedUri value="http://highmed.org/bpe/Process/pingAutostart/#{version}" /> </element> <element id="Task.input"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> @@ -42,7 +42,7 @@ </element> <element id="Task.input:message-name.value[x]"> <path value="Task.input.value[x]" /> - <fixedString value="stopAutostartPingProcessMessage" /> + <fixedString value="stopPingAutostart" /> </element> <element id="Task.input:business-key"> <extension url="http://hl7.org/fhir/StructureDefinition/structuredefinition-explicit-type-name"> diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStartAutostartPing3MedicFromTtpExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStartAutostartPing3MedicFromTtpExampleStarter.java index 7707a695..50de460c 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStartAutostartPing3MedicFromTtpExampleStarter.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStartAutostartPing3MedicFromTtpExampleStarter.java @@ -7,9 +7,9 @@ import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS; import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_TIMER_INTERVAL; -import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_AUTOSTART_AND_LATEST_VERSION; -import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_AUTOSTART_MESSAGE_NAME; -import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; import java.util.Date; @@ -33,8 +33,8 @@ protected void main(String[] args, String baseUrl) throws Exception private Task createStartResource() { Task task = new Task(); - task.getMeta().addProfile(PROFILE_HIGHMED_TASK_START_AUTOSTART_AND_LATEST_VERSION); - task.setInstantiatesUri(PROFILE_HIGHMED_TASK_START_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_AND_LATEST_VERSION); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION); task.setStatus(TaskStatus.REQUESTED); task.setIntent(TaskIntent.ORDER); task.setAuthoredOn(new Date()); @@ -45,7 +45,7 @@ private Task createStartResource() .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP); - task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_START_AUTOSTART_MESSAGE_NAME)).getType() + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_MESSAGE_NAME)).getType() .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); task.addInput().setValue(new StringType(BUSINESS_KEY)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN) .setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStopAutostartPing3MedicFromTtpExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStopAutostartPing3MedicFromTtpExampleStarter.java index 637d7851..82b1675a 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStopAutostartPing3MedicFromTtpExampleStarter.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractStopAutostartPing3MedicFromTtpExampleStarter.java @@ -4,9 +4,9 @@ import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY; import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; -import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_AUTOSTART_AND_LATEST_VERSION; -import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_AUTOSTART_MESSAGE_NAME; -import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.start.AbstractStartAutostartPing3MedicFromTtpExampleStarter.BUSINESS_KEY; import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP; @@ -29,8 +29,8 @@ protected void main(String[] args, String baseUrl) throws Exception private Task createStartResource() { Task task = new Task(); - task.getMeta().addProfile(PROFILE_HIGHMED_TASK_STOP_AUTOSTART_AND_LATEST_VERSION); - task.setInstantiatesUri(PROFILE_HIGHMED_TASK_STOP_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_AND_LATEST_VERSION); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION); task.setStatus(TaskStatus.REQUESTED); task.setIntent(TaskIntent.ORDER); task.setAuthoredOn(new Date()); @@ -41,8 +41,8 @@ private Task createStartResource() .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_TTP); - task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_STOP_AUTOSTART_MESSAGE_NAME)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_MESSAGE_NAME)).getType() + .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); task.addInput().setValue(new StringType(BUSINESS_KEY)).getType().addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN) .setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java index 29baaaad..66cc035c 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/ActivityDefinitionProfileTest.java @@ -49,8 +49,8 @@ public class ActivityDefinitionProfileTest @Test public void testAutostartValid() throws Exception { - ActivityDefinition ad = validationRule - .readActivityDefinition(Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-autostart.xml")); + ActivityDefinition ad = validationRule.readActivityDefinition( + Paths.get("src/main/resources/fhir/ActivityDefinition/highmed-ping-autostart.xml")); ValidationResult result = resourceValidator.validate(ad); ValidationSupportRule.logValidationMessages(logger, result); diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java index e496602b..558d0568 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/fhir/profiles/TaskProfileTest.java @@ -18,14 +18,14 @@ import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PONG_MESSAGE_NAME; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PONG_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PONG_TASK; -import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_AUTOSTART; -import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_AUTOSTART_MESSAGE_NAME; -import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_AUTOSTART; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_MESSAGE_NAME; -import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_AUTOSTART; -import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_AUTOSTART_MESSAGE_NAME; -import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION; import static org.highmed.dsf.bpe.PingProcessPluginDefinition.RELEASE_DATE; import static org.highmed.dsf.bpe.PingProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; @@ -60,9 +60,9 @@ public class TaskProfileTest @ClassRule public static final ValidationSupportRule validationRule = new ValidationSupportRule(VERSION, RELEASE_DATE, - Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-task-start-autostart.xml", - "highmed-task-stop-autostart.xml", "highmed-task-start-ping-process.xml", "highmed-task-ping.xml", - "highmed-task-pong.xml", "highmed-extension-ping-status.xml"), + Arrays.asList("highmed-task-base-0.5.0.xml", "highmed-extension-ping-status.xml", "highmed-task-ping.xml", + "highmed-task-pong.xml", "highmed-task-start-ping.xml", "highmed-task-start-ping-autostart.xml", + "highmed-task-stop-ping-autostart.xml"), Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", "highmed-ping.xml", "highmed-ping-status.xml"), Arrays.asList("highmed-read-access-tag-0.5.0.xml", "highmed-bpmn-message-0.5.0.xml", "highmed-ping.xml", @@ -131,8 +131,8 @@ public void testTaskStartAutostartProcessProfileNotValidTimerInterval() throws E private Task createValidTaskStartAutostartProcess() { Task task = new Task(); - task.getMeta().addProfile(PROFILE_HIGHMED_TASK_START_AUTOSTART); - task.setInstantiatesUri(PROFILE_HIGHMED_TASK_START_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_START_PING_AUTOSTART); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION); task.setStatus(TaskStatus.REQUESTED); task.setIntent(TaskIntent.ORDER); task.setAuthoredOn(new Date()); @@ -141,7 +141,7 @@ private Task createValidTaskStartAutostartProcess() task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("TTP"); - task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_START_AUTOSTART_MESSAGE_NAME)).getType() + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_MESSAGE_NAME)).getType() .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); @@ -164,8 +164,8 @@ public void testTaskStopAutostartProcessProfileValid() throws Exception private Task createValidTaskStopAutostartProcess() { Task task = new Task(); - task.getMeta().addProfile(PROFILE_HIGHMED_TASK_STOP_AUTOSTART); - task.setInstantiatesUri(PROFILE_HIGHMED_TASK_STOP_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_PROCESS_URI_AND_LATEST_VERSION); task.setStatus(TaskStatus.REQUESTED); task.setIntent(TaskIntent.ORDER); task.setAuthoredOn(new Date()); @@ -174,8 +174,8 @@ private Task createValidTaskStopAutostartProcess() task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER).setValue("TTP"); - task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_STOP_AUTOSTART_MESSAGE_NAME)).getType().addCoding() - .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_STOP_PING_AUTOSTART_MESSAGE_NAME)).getType() + .addCoding().setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); task.addInput().setValue(new StringType(UUID.randomUUID().toString())).getType().addCoding() .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_BUSINESS_KEY); From b85fa100021e58007e53455e1aacd480f03a1850 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Tue, 3 May 2022 19:56:45 +0200 Subject: [PATCH 121/125] new class for testing resource loading --- .../bpe/PingProcessPluginDefinitionTest.java | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/PingProcessPluginDefinitionTest.java diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/PingProcessPluginDefinitionTest.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/PingProcessPluginDefinitionTest.java new file mode 100644 index 00000000..4dfa8492 --- /dev/null +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/PingProcessPluginDefinitionTest.java @@ -0,0 +1,42 @@ +package org.highmed.dsf.bpe; + +import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_FULL_NAME_PING; +import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_FULL_NAME_PING_AUTOSTART; +import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_FULL_NAME_PONG; +import static org.highmed.dsf.bpe.PingProcessPluginDefinition.VERSION; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.stream.Stream; + +import org.highmed.dsf.fhir.resources.ResourceProvider; +import org.hl7.fhir.r4.model.MetadataResource; +import org.junit.Test; +import org.springframework.core.env.StandardEnvironment; + +import ca.uhn.fhir.context.FhirContext; + +public class PingProcessPluginDefinitionTest +{ + @Test + public void testGetResourceProvider() throws Exception + { + PingProcessPluginDefinition definition = new PingProcessPluginDefinition(); + ResourceProvider provider = definition.getResourceProvider(FhirContext.forR4(), getClass().getClassLoader(), + new StandardEnvironment()); + assertNotNull(provider); + + assertResourcesStream(8, + provider.getResources(PROCESS_FULL_NAME_PING + "/" + VERSION, s -> ResourceProvider.empty())); + assertResourcesStream(5, + provider.getResources(PROCESS_FULL_NAME_PING_AUTOSTART + "/" + VERSION, s -> ResourceProvider.empty())); + assertResourcesStream(7, + provider.getResources(PROCESS_FULL_NAME_PONG + "/" + VERSION, s -> ResourceProvider.empty())); + } + + private void assertResourcesStream(int expectedResources, Stream<MetadataResource> resourcesStream) + { + assertNotNull(resourcesStream); + assertEquals(expectedResources, resourcesStream.count()); + } +} From 083d860ac9513cccef0ca9d1cb481ebbdac08781 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Tue, 3 May 2022 19:58:01 +0200 Subject: [PATCH 122/125] new example starter for testing with a complex endpoint search query --- ...tractPingTtpsFromMedic1ExampleStarter.java | 56 +++++++++++++++++++ ...ingTtpsFromMedic1DockerExampleStarter.java | 15 +++++ .../PingTtpsFromMedic1ExampleStarter.java | 15 +++++ 3 files changed, 86 insertions(+) create mode 100644 dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractPingTtpsFromMedic1ExampleStarter.java create mode 100644 dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/PingTtpsFromMedic1DockerExampleStarter.java create mode 100644 dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/PingTtpsFromMedic1ExampleStarter.java diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractPingTtpsFromMedic1ExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractPingTtpsFromMedic1ExampleStarter.java new file mode 100644 index 00000000..eddc5952 --- /dev/null +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/AbstractPingTtpsFromMedic1ExampleStarter.java @@ -0,0 +1,56 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN; +import static org.highmed.dsf.bpe.ConstantsBase.CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME; +import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING; +import static org.highmed.dsf.bpe.ConstantsPing.CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_PING_PROCESS_URI_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_AND_LATEST_VERSION; +import static org.highmed.dsf.bpe.ConstantsPing.PROFILE_HIGHMED_TASK_START_PING_MESSAGE_NAME; +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.*; + +import java.util.Date; + +import org.hl7.fhir.r4.model.ResourceType; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.Task; +import org.hl7.fhir.r4.model.Task.TaskIntent; +import org.hl7.fhir.r4.model.Task.TaskStatus; + +public abstract class AbstractPingTtpsFromMedic1ExampleStarter +{ + protected void main(String[] args, String baseUrl) throws Exception + { + Task task = createStartResource(); + ExampleStarter.forServer(args, baseUrl).startWith(task); + } + + private Task createStartResource() + { + Task task = new Task(); + task.getMeta().addProfile(PROFILE_HIGHMED_TASK_START_PING_AND_LATEST_VERSION); + task.setInstantiatesUri(PROFILE_HIGHMED_TASK_PING_PROCESS_URI_AND_LATEST_VERSION); + task.setStatus(TaskStatus.REQUESTED); + task.setIntent(TaskIntent.ORDER); + task.setAuthoredOn(new Date()); + task.getRequester().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1); + task.getRestriction().addRecipient().setType(ResourceType.Organization.name()).getIdentifier() + .setSystem(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER) + .setValue(NAMINGSYSTEM_HIGHMED_ORGANIZATION_IDENTIFIER_VALUE_MEDIC_1); + + task.addInput().setValue(new StringType(PROFILE_HIGHMED_TASK_START_PING_MESSAGE_NAME)).getType().addCoding() + .setSystem(CODESYSTEM_HIGHMED_BPMN).setCode(CODESYSTEM_HIGHMED_BPMN_VALUE_MESSAGE_NAME); + + task.addInput().setValue(new StringType( + "OrganizationAffiliation?primary-organization:identifier=http://highmed.org/sid/organization-identifier|highmed.org" + + "&role=http://highmed.org/fhir/CodeSystem/organization-role|TTP" + + "&_include=OrganizationAffiliation:endpoint")) + .getType().addCoding().setSystem(CODESYSTEM_HIGHMED_PING) + .setCode(CODESYSTEM_HIGHMED_PING_VALUE_TARGET_ENDPOINTS); + + return task; + } +} diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/PingTtpsFromMedic1DockerExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/PingTtpsFromMedic1DockerExampleStarter.java new file mode 100644 index 00000000..aad47ef6 --- /dev/null +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/PingTtpsFromMedic1DockerExampleStarter.java @@ -0,0 +1,15 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.MEDIC_1_DOCKER_FHIR_BASE_URL; + +public class PingTtpsFromMedic1DockerExampleStarter extends AbstractPingTtpsFromMedic1ExampleStarter +{ + // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate + // password + public static void main(String[] args) throws Exception + { + new PingTtpsFromMedic1DockerExampleStarter().main(args, MEDIC_1_DOCKER_FHIR_BASE_URL); + } +} diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/PingTtpsFromMedic1ExampleStarter.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/PingTtpsFromMedic1ExampleStarter.java new file mode 100644 index 00000000..64d912cd --- /dev/null +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/start/PingTtpsFromMedic1ExampleStarter.java @@ -0,0 +1,15 @@ +package org.highmed.dsf.bpe.start; + +import static org.highmed.dsf.bpe.start.ConstantsExampleStarters.MEDIC_1_FHIR_BASE_URL; + +public class PingTtpsFromMedic1ExampleStarter extends AbstractPingTtpsFromMedic1ExampleStarter +{ + // Environment variable "DSF_CLIENT_CERTIFICATE_PATH" or args[0]: the path to the client-certificate + // highmed-dsf/dsf-tools/dsf-tools-test-data-generator/cert/Webbrowser_Test_User/Webbrowser_Test_User_certificate.p12 + // Environment variable "DSF_CLIENT_CERTIFICATE_PASSWORD" or args[1]: the password of the client-certificate + // password + public static void main(String[] args) throws Exception + { + new PingTtpsFromMedic1ExampleStarter().main(args, MEDIC_1_FHIR_BASE_URL); + } +} From b69c9c8135fda393fc2d701cd0de42fae24cc31e Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Tue, 3 May 2022 21:54:07 +0200 Subject: [PATCH 123/125] new resource loading test classes for all process plugins, some cleanup --- .../highmed/dsf/bpe/ConstantsDataSharing.java | 17 +++++-- .../DataSharingProcessPluginDefinition.java | 30 ++++++------ ...ataSharingProcessPluginDefinitionTest.java | 41 +++++++++++++++++ .../dsf/bpe/ConstantsFeasibilityMpc.java | 16 +++++-- ...FeasibilityMpcProcessPluginDefinition.java | 30 +++++++----- ...ibilityMpcProcessPluginDefinitionTest.java | 44 ++++++++++++++++++ .../highmed/dsf/bpe/ConstantsFeasibility.java | 18 ++++++-- .../FeasibilityProcessPluginDefinition.java | 30 ++++++------ ...easibilityProcessPluginDefinitionTest.java | 46 +++++++++++++++++++ .../dsf/bpe/ConstantsLocalServices.java | 2 + .../LocalServicesProcessPluginDefinition.java | 16 ++++--- ...alServicesProcessPluginDefinitionTest.java | 39 ++++++++++++++++ .../org/highmed/dsf/bpe/ConstantsPing.java | 6 +-- .../dsf/bpe/PingProcessPluginDefinition.java | 30 ++++++------ .../bpe/PingProcessPluginDefinitionTest.java | 35 +++++++------- .../dsf/bpe/ConstantsUpdateAllowList.java | 12 ++++- ...pdateAllowListProcessPluginDefinition.java | 12 +++-- ...eAllowListProcessPluginDefinitionTest.java | 35 ++++++++++++++ .../dsf/bpe/ConstantsUpdateResources.java | 10 +++- ...pdateResourcesProcessPluginDefinition.java | 12 +++-- ...eResourcesProcessPluginDefinitionTest.java | 36 +++++++++++++++ 21 files changed, 417 insertions(+), 100 deletions(-) create mode 100644 dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinitionTest.java create mode 100644 dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinitionTest.java create mode 100644 dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinitionTest.java create mode 100644 dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinitionTest.java create mode 100644 dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinitionTest.java create mode 100644 dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinitionTest.java diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java index 966dd55c..5afea9b1 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/ConstantsDataSharing.java @@ -5,6 +5,14 @@ public interface ConstantsDataSharing { + String PROCESS_NAME_COMPUTE_DATA_SHARING = "computeDataSharing"; + String PROCESS_NAME_EXECUTE_DATA_SHARING = "executeDataSharing"; + String PROCESS_NAME_REQUEST_DATA_SHARING = "requestDataSharing"; + + String PROCESS_NAME_FULL_COMPUTE_DATA_SHARING = "highmedorg_" + PROCESS_NAME_COMPUTE_DATA_SHARING; + String PROCESS_NAME_FULL_EXECUTE_DATA_SHARING = "highmedorg_" + PROCESS_NAME_EXECUTE_DATA_SHARING; + String PROCESS_NAME_FULL_REQUEST_DATA_SHARING = "highmedorg_" + PROCESS_NAME_REQUEST_DATA_SHARING; + String BPMN_EXECUTION_ERROR_CODE_SINGLE_MEDIC_DATA_SHARING_RESULT = "errorSingleMedicDataSharingResult"; String BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_RECEIVED_DATA_SHARING_RESULT = "errorMultiMedicReceivedDataSharingResult"; String BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_PSEUDONYMIZED_DATA_SHARING_RESULT = "errorMultiMedicPseudonymizedDataSharingResult"; @@ -50,7 +58,8 @@ public interface ConstantsDataSharing String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_AND_VERSION = "http://highmed.org/fhir/StructureDefinition/task-request-data-sharing" + "|" + VERSION; - String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestDataSharing/"; + String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + + PROCESS_NAME_REQUEST_DATA_SHARING + "/"; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_REQUEST_DATA_SHARING_MESSAGE_NAME = "requestDataSharingMessage"; @@ -58,7 +67,8 @@ public interface ConstantsDataSharing String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing"; String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_AND_VERSION = "http://highmed.org/fhir/StructureDefinition/task-execute-data-sharing" + "|" + VERSION; - String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "executeDataSharing/"; + String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + + PROCESS_NAME_EXECUTE_DATA_SHARING + "/"; String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_DATA_SHARING_MESSAGE_NAME = "executeDataSharingMessage"; @@ -66,7 +76,8 @@ public interface ConstantsDataSharing String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING = "http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing"; String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_AND_VERSION = "http://highmed.org/fhir/StructureDefinition/task-compute-data-sharing" + "|" + VERSION; - String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "computeDataSharing/"; + String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + + PROCESS_NAME_COMPUTE_DATA_SHARING + "/"; String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_COMPUTE_DATA_SHARING_MESSAGE_NAME = "computeDataSharingMessage"; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java index 7160f9cf..31c57655 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java @@ -1,5 +1,9 @@ package org.highmed.dsf.bpe; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROCESS_NAME_FULL_COMPUTE_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROCESS_NAME_FULL_EXECUTE_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROCESS_NAME_FULL_REQUEST_DATA_SHARING; + import java.time.LocalDate; import java.util.Arrays; import java.util.List; @@ -57,31 +61,31 @@ public Stream<Class<?>> getSpringConfigClasses() public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader, PropertyResolver resolver) { + var c = CodeSystemResource.file("fhir/CodeSystem/highmed-data-sharing.xml"); + var aCom = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-computeDataSharing.xml"); var aExe = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeDataSharing.xml"); var aReq = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-requestDataSharing.xml"); - var cDS = CodeSystemResource.file("fhir/CodeSystem/highmed-data-sharing.xml"); - var sRSDS = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-research-study-data-sharing.xml"); - var sTCom = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-compute-data-sharing.xml"); - var sTExe = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-execute-data-sharing.xml"); - var sTErrM = StructureDefinitionResource + var sCom = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-compute-data-sharing.xml"); + var sExe = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-execute-data-sharing.xml"); + var sErrM = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-multi-medic-error-data-sharing.xml"); - var sTResM = StructureDefinitionResource + var sResM = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-multi-medic-result-data-sharing.xml"); - var sTReq = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-request-data-sharing.xml"); - var sTResS = StructureDefinitionResource + var sReq = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-request-data-sharing.xml"); + var sResS = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-single-medic-result-data-sharing.xml"); - var vDS = ValueSetResource.file("fhir/ValueSet/highmed-data-sharing.xml"); + var v = ValueSetResource.file("fhir/ValueSet/highmed-data-sharing.xml"); Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( - "highmedorg_computeDataSharing/" + VERSION, Arrays.asList(aCom, cDS, sTCom, sTResS, vDS), - "highmedorg_executeDataSharing/" + VERSION, Arrays.asList(aExe, cDS, sTExe, sRSDS, vDS), - "highmedorg_requestDataSharing/" + VERSION, - Arrays.asList(aReq, cDS, sTReq, sRSDS, sTResM, sTErrM, vDS)); + PROCESS_NAME_FULL_COMPUTE_DATA_SHARING + "/" + VERSION, Arrays.asList(c, aCom, sCom, sResS, v), + PROCESS_NAME_FULL_EXECUTE_DATA_SHARING + "/" + VERSION, Arrays.asList(c, aExe, sExe, sRSDS, v), + PROCESS_NAME_FULL_REQUEST_DATA_SHARING + "/" + VERSION, + Arrays.asList(c, aReq, sReq, sRSDS, sResM, sErrM, v)); return ResourceProvider.read(VERSION, RELEASE_DATE, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, diff --git a/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinitionTest.java b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinitionTest.java new file mode 100644 index 00000000..48a7e26f --- /dev/null +++ b/dsf-bpe-process-data-sharing/src/test/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinitionTest.java @@ -0,0 +1,41 @@ +package org.highmed.dsf.bpe; + +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROCESS_NAME_FULL_COMPUTE_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROCESS_NAME_FULL_EXECUTE_DATA_SHARING; +import static org.highmed.dsf.bpe.ConstantsDataSharing.PROCESS_NAME_FULL_REQUEST_DATA_SHARING; +import static org.highmed.dsf.bpe.DataSharingProcessPluginDefinition.VERSION; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.highmed.dsf.fhir.resources.ResourceProvider; +import org.junit.Test; +import org.springframework.core.env.StandardEnvironment; + +import ca.uhn.fhir.context.FhirContext; + +public class DataSharingProcessPluginDefinitionTest +{ + @Test + public void testResourceLoading() throws Exception + { + ProcessPluginDefinition definition = new DataSharingProcessPluginDefinition(); + ResourceProvider provider = definition.getResourceProvider(FhirContext.forR4(), getClass().getClassLoader(), + new StandardEnvironment()); + assertNotNull(provider); + + var computeDataSharing = provider.getResources(PROCESS_NAME_FULL_COMPUTE_DATA_SHARING + "/" + VERSION, + s -> ResourceProvider.empty()); + assertNotNull(computeDataSharing); + assertEquals(5, computeDataSharing.count()); + + var executeDataSharing = provider.getResources(PROCESS_NAME_FULL_EXECUTE_DATA_SHARING + "/" + VERSION, + s -> ResourceProvider.empty()); + assertNotNull(executeDataSharing); + assertEquals(5, executeDataSharing.count()); + + var requestDataSharing = provider.getResources(PROCESS_NAME_FULL_REQUEST_DATA_SHARING + "/" + VERSION, + s -> ResourceProvider.empty()); + assertNotNull(requestDataSharing); + assertEquals(7, requestDataSharing.count()); + } +} diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibilityMpc.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibilityMpc.java index 9cda8e8c..d0b3260f 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibilityMpc.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibilityMpc.java @@ -5,6 +5,16 @@ public interface ConstantsFeasibilityMpc { + String PROCESS_NAME_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE = "executeFeasibilityMpcMultiShare"; + String PROCESS_NAME_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE = "executeFeasibilityMpcSingleShare"; + String PROCESS_NAME_REQUEST_FEASIBILITY_MPC = "requestFeasibilityMpc"; + + String PROCESS_NAME_FULL_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE = "highmedorg_" + + PROCESS_NAME_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE; + String PROCESS_NAME_FULL_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE = "highmedorg_" + + PROCESS_NAME_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE; + String PROCESS_NAME_FULL_REQUEST_FEASIBILITY_MPC = "highmedorg_" + PROCESS_NAME_REQUEST_FEASIBILITY_MPC; + String BPMN_EXECUTION_VARIABLE_CORRELATION_KEY = "correlationKey"; // String BPMN_EXECUTION_VARIABLE_CORRELATION_KEYS_SINGLE_MEDIC_SHARE = "correlationKeysSingleMedicShare"; @@ -22,7 +32,7 @@ public interface ConstantsFeasibilityMpc String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC + "|" + VERSION; String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_PROCESS_URI = PROCESS_HIGHMED_URI_BASE - + "requestFeasibilityMpc/"; + + PROCESS_NAME_REQUEST_FEASIBILITY_MPC + "/"; String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MPC_MESSAGE_NAME = "requestFeasibilityMpcMessage"; @@ -31,7 +41,7 @@ public interface ConstantsFeasibilityMpc String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE + "|" + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_PROCESS_URI = PROCESS_HIGHMED_URI_BASE - + "executeFeasibilityMpcMultiShare/"; + + PROCESS_NAME_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE + "/"; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE_MESSAGE_NAME = "executeFeasibilityMpcMultiShareMessage"; @@ -40,7 +50,7 @@ public interface ConstantsFeasibilityMpc String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE + "|" + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE_PROCESS_URI = PROCESS_HIGHMED_URI_BASE - + "executeFeasibilityMpcSingleShare/"; + + PROCESS_NAME_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE + "/"; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE_MESSAGE_NAME = "executeFeasibilityMpcSingleShareMessage"; diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java index facd1733..5ba21a36 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java @@ -1,5 +1,9 @@ package org.highmed.dsf.bpe; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROCESS_NAME_FULL_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROCESS_NAME_FULL_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE; +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.PROCESS_NAME_FULL_REQUEST_FEASIBILITY_MPC; + import java.time.LocalDate; import java.util.Arrays; import java.util.List; @@ -69,33 +73,35 @@ public List<String> getDependencyNamesAndVersions() public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader, PropertyResolver resolver) { + var c = CodeSystemResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, + "http://highmed.org/fhir/CodeSystem/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); + var aExeM = ActivityDefinitionResource .file("fhir/ActivityDefinition/highmed-executeFeasibilityMpcMultiShare.xml"); var aExeS = ActivityDefinitionResource .file("fhir/ActivityDefinition/highmed-executeFeasibilityMpcSingleShare.xml"); var aReq = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-requestFeasibilityMpc.xml"); - var cDS = CodeSystemResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, - "http://highmed.org/fhir/CodeSystem/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); - - var sTExeM = StructureDefinitionResource + var sExeM = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-multi-share.xml"); - var sTExeS = StructureDefinitionResource + var sExeS = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-execute-feasibility-mpc-single-share.xml"); - var sTReq = StructureDefinitionResource + var sReq = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-request-feasibility-mpc.xml"); - var sTResM = StructureDefinitionResource + var sResM = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-multi-medic-result-share-feasibility-mpc.xml"); - var sTResS = StructureDefinitionResource + var sResS = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-single-medic-result-share-feasibility-mpc.xml"); - var vDS = ValueSetResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, + var v = ValueSetResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/ValueSet/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( - "highmedorg_executeFeasibilityMpcMultiShare/" + VERSION, Arrays.asList(aExeM, cDS, sTExeM, sTResS, vDS), - "highmedorg_executeFeasibilityMpcSingleShare/" + VERSION, Arrays.asList(aExeS, cDS, sTExeS, vDS), - "highmedorg_requestFeasibilityMpc/" + VERSION, Arrays.asList(aReq, cDS, sTReq, sTResM, vDS)); + PROCESS_NAME_FULL_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE + "/" + VERSION, + Arrays.asList(c, aExeM, sExeM, sResS, v), + PROCESS_NAME_FULL_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE + "/" + VERSION, + Arrays.asList(c, aExeS, sExeS, v), PROCESS_NAME_FULL_REQUEST_FEASIBILITY_MPC + "/" + VERSION, + Arrays.asList(c, aReq, sReq, sResM, v)); return ResourceProvider.read(VERSION, RELEASE_DATE, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, diff --git a/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinitionTest.java b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinitionTest.java new file mode 100644 index 00000000..e1e90228 --- /dev/null +++ b/dsf-bpe-process-feasibility-mpc/src/test/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinitionTest.java @@ -0,0 +1,44 @@ +package org.highmed.dsf.bpe; + +import static org.highmed.dsf.bpe.ConstantsFeasibilityMpc.*; +import static org.highmed.dsf.bpe.FeasibilityMpcProcessPluginDefinition.VERSION; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.highmed.dsf.fhir.resources.ResourceProvider; +import org.junit.Test; +import org.springframework.core.env.StandardEnvironment; + +import ca.uhn.fhir.context.FhirContext; + +public class FeasibilityMpcProcessPluginDefinitionTest +{ + @Test + public void testResourceLoading() throws Exception + { + ProcessPluginDefinition dataSharing = new DataSharingProcessPluginDefinition(); + ResourceProvider dataSharingProvider = dataSharing.getResourceProvider(FhirContext.forR4(), + getClass().getClassLoader(), new StandardEnvironment()); + assertNotNull(dataSharingProvider); + + ProcessPluginDefinition definition = new FeasibilityMpcProcessPluginDefinition(); + ResourceProvider provider = definition.getResourceProvider(FhirContext.forR4(), getClass().getClassLoader(), + new StandardEnvironment()); + assertNotNull(provider); + + var executeFeasibilityMpcMultiShare = provider.getResources( + PROCESS_NAME_FULL_EXECUTE_FEASIBILITY_MPC_MULTI_SHARE + "/" + VERSION, s -> dataSharingProvider); + assertNotNull(executeFeasibilityMpcMultiShare); + assertEquals(5, executeFeasibilityMpcMultiShare.count()); + + var executeFeasibilityMpcSingleShare = provider.getResources( + PROCESS_NAME_FULL_EXECUTE_FEASIBILITY_MPC_SINGLE_SHARE + "/" + VERSION, s -> dataSharingProvider); + assertNotNull(executeFeasibilityMpcSingleShare); + assertEquals(4, executeFeasibilityMpcSingleShare.count()); + + var requestFeasibilityMpc = provider.getResources(PROCESS_NAME_FULL_REQUEST_FEASIBILITY_MPC + "/" + VERSION, + s -> dataSharingProvider); + assertNotNull(requestFeasibilityMpc); + assertEquals(5, requestFeasibilityMpc.count()); + } +} diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java index 924b1aa1..8e993889 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/ConstantsFeasibility.java @@ -5,6 +5,15 @@ public interface ConstantsFeasibility { + String PROCESS_NAME_COMPUTE_FEASIBILITY = "computeFeasibility"; + String PROCESS_NAME_EXECUTE_FEASIBILITY = "executeFeasibility"; + String PROCESS_NAME_REQUEST_FEASIBILITY = "requestFeasibility"; + + String PROCESS_NAME_FULL_COMPUTE_FEASIBILITY = "highmedorg_" + PROCESS_NAME_COMPUTE_FEASIBILITY; + String PROCESS_NAME_FULL_EXECUTE_FEASIBILITY = "highmedorg_" + PROCESS_NAME_EXECUTE_FEASIBILITY; + String PROCESS_NAME_FULL_REQUEST_FEASIBILITY = "highmedorg_" + PROCESS_NAME_REQUEST_FEASIBILITY; + + String BPMN_EXECUTION_ERROR_CODE_MULTI_MEDIC_FEASIBILITY_RESULT = "errorMultiMedicFeasibilityResult"; // Must be 3 or larger, as otherwise it is possible to draw conclusions about the individual MeDICs @@ -16,7 +25,8 @@ public interface ConstantsFeasibility String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-request-feasibility"; String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY + "|" + VERSION; - String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "requestFeasibility/"; + String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + + PROCESS_NAME_REQUEST_FEASIBILITY + "/"; String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_REQUEST_FEASIBILITY_MESSAGE_NAME = "requestFeasibilityMessage"; @@ -26,7 +36,8 @@ public interface ConstantsFeasibility String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-execute-feasibility"; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY + "|" + VERSION; - String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "executeFeasibility/"; + String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + + PROCESS_NAME_EXECUTE_FEASIBILITY + "/"; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_FEASIBILITY_MESSAGE_NAME = "executeFeasibilityMessage"; @@ -34,7 +45,8 @@ public interface ConstantsFeasibility String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY = "http://highmed.org/fhir/StructureDefinition/task-compute-feasibility"; String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY + "|" + VERSION; - String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "computeFeasibility/"; + String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + + PROCESS_NAME_COMPUTE_FEASIBILITY + "/"; String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_COMPUTE_FEASIBILITY_MESSAGE_NAME = "computeFeasibilityMessage"; diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java index bfda306e..49457c23 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java @@ -1,5 +1,9 @@ package org.highmed.dsf.bpe; +import static org.highmed.dsf.bpe.ConstantsFeasibility.PROCESS_NAME_FULL_COMPUTE_FEASIBILITY; +import static org.highmed.dsf.bpe.ConstantsFeasibility.PROCESS_NAME_FULL_EXECUTE_FEASIBILITY; +import static org.highmed.dsf.bpe.ConstantsFeasibility.PROCESS_NAME_FULL_REQUEST_FEASIBILITY; + import java.time.LocalDate; import java.util.Arrays; import java.util.List; @@ -67,29 +71,29 @@ public List<String> getDependencyNamesAndVersions() public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader, PropertyResolver resolver) { + var c = CodeSystemResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, + "http://highmed.org/fhir/CodeSystem/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); + var aCom = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-computeFeasibility.xml"); var aExe = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeFeasibility.xml"); var aReq = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-requestFeasibility.xml"); - var cDS = CodeSystemResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, - "http://highmed.org/fhir/CodeSystem/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); - - var sTCom = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-compute-feasibility.xml"); - var sTErr = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-error-feasibility.xml"); - var sTExe = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-execute-feasibility.xml"); - var sTResM = StructureDefinitionResource + var sCom = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-compute-feasibility.xml"); + var sErr = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-error-feasibility.xml"); + var sExe = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-execute-feasibility.xml"); + var sResM = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-multi-medic-result-feasibility.xml"); - var sTReq = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-request-feasibility.xml"); - var sTResS = StructureDefinitionResource + var sReq = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-request-feasibility.xml"); + var sResS = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-single-medic-result-feasibility.xml"); - var vDS = ValueSetResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, + var v = ValueSetResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/ValueSet/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( - "highmedorg_computeFeasibility/" + VERSION, Arrays.asList(aCom, cDS, sTCom, sTResS, vDS), - "highmedorg_executeFeasibility/" + VERSION, Arrays.asList(aExe, cDS, sTExe, vDS), - "highmedorg_requestFeasibility/" + VERSION, Arrays.asList(aReq, cDS, sTReq, sTResM, sTErr, vDS)); + PROCESS_NAME_FULL_COMPUTE_FEASIBILITY + "/" + VERSION, Arrays.asList(c, aCom, sCom, sResS, v), + PROCESS_NAME_FULL_EXECUTE_FEASIBILITY + "/" + VERSION, Arrays.asList(c, aExe, sExe, v), + PROCESS_NAME_FULL_REQUEST_FEASIBILITY + "/" + VERSION, Arrays.asList(c, aReq, sReq, sResM, sErr, v)); return ResourceProvider.read(VERSION, RELEASE_DATE, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, diff --git a/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinitionTest.java b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinitionTest.java new file mode 100644 index 00000000..2b85e8e0 --- /dev/null +++ b/dsf-bpe-process-feasibility/src/test/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinitionTest.java @@ -0,0 +1,46 @@ +package org.highmed.dsf.bpe; + +import static org.highmed.dsf.bpe.ConstantsFeasibility.PROCESS_NAME_FULL_COMPUTE_FEASIBILITY; +import static org.highmed.dsf.bpe.ConstantsFeasibility.PROCESS_NAME_FULL_EXECUTE_FEASIBILITY; +import static org.highmed.dsf.bpe.ConstantsFeasibility.PROCESS_NAME_FULL_REQUEST_FEASIBILITY; +import static org.highmed.dsf.bpe.FeasibilityProcessPluginDefinition.VERSION; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.highmed.dsf.fhir.resources.ResourceProvider; +import org.junit.Test; +import org.springframework.core.env.StandardEnvironment; + +import ca.uhn.fhir.context.FhirContext; + +public class FeasibilityProcessPluginDefinitionTest +{ + @Test + public void testResourceLoading() throws Exception + { + ProcessPluginDefinition dataSharing = new DataSharingProcessPluginDefinition(); + ResourceProvider dataSharingProvider = dataSharing.getResourceProvider(FhirContext.forR4(), + getClass().getClassLoader(), new StandardEnvironment()); + assertNotNull(dataSharingProvider); + + ProcessPluginDefinition definition = new FeasibilityProcessPluginDefinition(); + ResourceProvider provider = definition.getResourceProvider(FhirContext.forR4(), getClass().getClassLoader(), + new StandardEnvironment()); + assertNotNull(provider); + + var computeFeasibility = provider.getResources(PROCESS_NAME_FULL_COMPUTE_FEASIBILITY + "/" + VERSION, + s -> dataSharingProvider); + assertNotNull(computeFeasibility); + assertEquals(5, computeFeasibility.count()); + + var executeFeasibilityMpcSingleShare = provider + .getResources(PROCESS_NAME_FULL_EXECUTE_FEASIBILITY + "/" + VERSION, s -> dataSharingProvider); + assertNotNull(executeFeasibilityMpcSingleShare); + assertEquals(4, executeFeasibilityMpcSingleShare.count()); + + var requestFeasibilityMpc = provider.getResources(PROCESS_NAME_FULL_REQUEST_FEASIBILITY + "/" + VERSION, + s -> dataSharingProvider); + assertNotNull(requestFeasibilityMpc); + assertEquals(6, requestFeasibilityMpc.count()); + } +} diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java index a0cd410f..9fc9b45c 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/ConstantsLocalServices.java @@ -5,6 +5,8 @@ public interface ConstantsLocalServices { + String PROCESS_NAME_FULL_LOCAL_SERVICES_INTEGRATION = "highmedorg_localServicesIntegration"; + String PROFILE_HIGHMED_TASK_LOCAL_SERVICES = "http://highmed.org/fhir/StructureDefinition/task-local-services-integration"; String PROFILE_HIGHMED_TASK_LOCAL_SERVICES_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_LOCAL_SERVICES + "|" + VERSION; String PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_LOCAL_SERVICES_PROCESS_URI diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java index a57b7796..88307191 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java @@ -1,5 +1,7 @@ package org.highmed.dsf.bpe; +import static org.highmed.dsf.bpe.ConstantsLocalServices.PROCESS_NAME_FULL_LOCAL_SERVICES_INTEGRATION; + import java.time.LocalDate; import java.util.Arrays; import java.util.List; @@ -69,17 +71,19 @@ public List<String> getDependencyNamesAndVersions() public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader, PropertyResolver resolver) { - var aL = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-localServicesIntegration.xml"); - var sTL = StructureDefinitionResource + var c = CodeSystemResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, + "http://highmed.org/fhir/CodeSystem/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); + + var a = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-localServicesIntegration.xml"); + + var s = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-local-services-integration.xml"); - var cDS = CodeSystemResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, - "http://highmed.org/fhir/CodeSystem/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); - var vDS = ValueSetResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, + var v = ValueSetResource.dependency(DEPENDENCY_DATA_SHARING_NAME_AND_VERSION, "http://highmed.org/fhir/ValueSet/data-sharing", DEPENDENCY_DATA_SHARING_VERSION); Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map - .of("highmedorg_localServicesIntegration/" + VERSION, Arrays.asList(aL, sTL, cDS, vDS)); + .of(PROCESS_NAME_FULL_LOCAL_SERVICES_INTEGRATION + "/" + VERSION, Arrays.asList(c, a, s, v)); return ResourceProvider.read(VERSION, RELEASE_DATE, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, diff --git a/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinitionTest.java b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinitionTest.java new file mode 100644 index 00000000..90e449ca --- /dev/null +++ b/dsf-bpe-process-local-services/src/test/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinitionTest.java @@ -0,0 +1,39 @@ +package org.highmed.dsf.bpe; + +import static org.highmed.dsf.bpe.ConstantsLocalServices.*; +import static org.highmed.dsf.bpe.LocalServicesProcessPluginDefinition.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.highmed.dsf.fhir.resources.ResourceProvider; +import org.junit.Test; +import org.springframework.core.env.StandardEnvironment; + +import ca.uhn.fhir.context.FhirContext; + +public class LocalServicesProcessPluginDefinitionTest +{ + @Test + public void testResourceLoading() throws Exception + { + ProcessPluginDefinition dataSharing = new DataSharingProcessPluginDefinition(); + ResourceProvider dataSharingProvider = dataSharing.getResourceProvider(FhirContext.forR4(), + getClass().getClassLoader(), new StandardEnvironment()); + assertNotNull(dataSharingProvider); + + ProcessPluginDefinition feasibility = new FeasibilityProcessPluginDefinition(); + ResourceProvider feasibilityProvider = feasibility.getResourceProvider(FhirContext.forR4(), + getClass().getClassLoader(), new StandardEnvironment()); + assertNotNull(feasibilityProvider); + + ProcessPluginDefinition definition = new LocalServicesProcessPluginDefinition(); + ResourceProvider provider = definition.getResourceProvider(FhirContext.forR4(), getClass().getClassLoader(), + new StandardEnvironment()); + assertNotNull(provider); + + var localServicesIntegration = provider + .getResources(PROCESS_NAME_FULL_LOCAL_SERVICES_INTEGRATION + "/" + VERSION, s -> dataSharingProvider); + assertNotNull(localServicesIntegration); + assertEquals(4, localServicesIntegration.count()); + } +} diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java index 35920d19..e5acecfc 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/ConstantsPing.java @@ -9,9 +9,9 @@ public interface ConstantsPing String PROCESS_NAME_PING = "ping"; String PROCESS_NAME_PONG = "pong"; - String PROCESS_FULL_NAME_PING_AUTOSTART = "highmedorg_" + PROCESS_NAME_PING_AUTOSTART; - String PROCESS_FULL_NAME_PING = "highmedorg_" + PROCESS_NAME_PING; - String PROCESS_FULL_NAME_PONG = "highmedorg_" + PROCESS_NAME_PONG; + String PROCESS_NAME_FULL_PING_AUTOSTART = "highmedorg_" + PROCESS_NAME_PING_AUTOSTART; + String PROCESS_NAME_FULL_PING = "highmedorg_" + PROCESS_NAME_PING; + String PROCESS_NAME_FULL_PONG = "highmedorg_" + PROCESS_NAME_PONG; String PROFILE_HIGHMED_TASK_START_PING_AUTOSTART = "http://highmed.org/fhir/StructureDefinition/task-start-ping-autostart"; String PROFILE_HIGHMED_TASK_START_PING_AUTOSTART_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_START_PING_AUTOSTART diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java index 369324ce..e19f4b1d 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java @@ -1,8 +1,8 @@ package org.highmed.dsf.bpe; -import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_FULL_NAME_PING; -import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_FULL_NAME_PING_AUTOSTART; -import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_FULL_NAME_PONG; +import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_NAME_FULL_PING; +import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART; +import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_NAME_FULL_PONG; import java.time.LocalDate; import java.util.Arrays; @@ -67,14 +67,14 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var cPing = CodeSystemResource.file("fhir/CodeSystem/highmed-ping.xml"); var cPingStatus = CodeSystemResource.file("fhir/CodeSystem/highmed-ping-status.xml"); - var ePingStatus = StructureDefinitionResource + var sPingStatus = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-extension-ping-status.xml"); - var tPing = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-ping.xml"); - var tPong = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-pong.xml"); - var tStartPing = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-start-ping.xml"); - var tStartPingAutostart = StructureDefinitionResource + var sPing = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-ping.xml"); + var sPong = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-pong.xml"); + var sStartPing = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-start-ping.xml"); + var sStartPingAutostart = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-start-ping-autostart.xml"); - var tStopPingAutostart = StructureDefinitionResource + var sStopPingAutostart = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-stop-ping-autostart.xml"); var vPing = ValueSetResource.file("fhir/ValueSet/highmed-ping.xml"); @@ -82,12 +82,12 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader var vPongStatus = ValueSetResource.file("fhir/ValueSet/highmed-pong-status.xml"); Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( - PROCESS_FULL_NAME_PING + "/" + VERSION, - Arrays.asList(aPing, cPing, cPingStatus, ePingStatus, tStartPing, tPong, vPing, vPingStatus), - PROCESS_FULL_NAME_PING_AUTOSTART + "/" + VERSION, - Arrays.asList(aPingAutostart, cPing, tStartPingAutostart, tStopPingAutostart, vPing), - PROCESS_FULL_NAME_PONG + "/" + VERSION, - Arrays.asList(aPong, cPing, cPingStatus, ePingStatus, tPing, vPing, vPongStatus)); + PROCESS_NAME_FULL_PING + "/" + VERSION, + Arrays.asList(aPing, cPing, cPingStatus, sPingStatus, sStartPing, sPong, vPing, vPingStatus), + PROCESS_NAME_FULL_PING_AUTOSTART + "/" + VERSION, + Arrays.asList(aPingAutostart, cPing, sStartPingAutostart, sStopPingAutostart, vPing), + PROCESS_NAME_FULL_PONG + "/" + VERSION, + Arrays.asList(aPong, cPing, cPingStatus, sPingStatus, sPing, vPing, vPongStatus)); return ResourceProvider.read(VERSION, RELEASE_DATE, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, diff --git a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/PingProcessPluginDefinitionTest.java b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/PingProcessPluginDefinitionTest.java index 4dfa8492..a7a97404 100644 --- a/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/PingProcessPluginDefinitionTest.java +++ b/dsf-bpe-process-ping/src/test/java/org/highmed/dsf/bpe/PingProcessPluginDefinitionTest.java @@ -1,16 +1,13 @@ package org.highmed.dsf.bpe; -import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_FULL_NAME_PING; -import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_FULL_NAME_PING_AUTOSTART; -import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_FULL_NAME_PONG; +import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_NAME_FULL_PING; +import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_NAME_FULL_PING_AUTOSTART; +import static org.highmed.dsf.bpe.ConstantsPing.PROCESS_NAME_FULL_PONG; import static org.highmed.dsf.bpe.PingProcessPluginDefinition.VERSION; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import java.util.stream.Stream; - import org.highmed.dsf.fhir.resources.ResourceProvider; -import org.hl7.fhir.r4.model.MetadataResource; import org.junit.Test; import org.springframework.core.env.StandardEnvironment; @@ -19,24 +16,24 @@ public class PingProcessPluginDefinitionTest { @Test - public void testGetResourceProvider() throws Exception + public void testResourceLoading() throws Exception { - PingProcessPluginDefinition definition = new PingProcessPluginDefinition(); + ProcessPluginDefinition definition = new PingProcessPluginDefinition(); ResourceProvider provider = definition.getResourceProvider(FhirContext.forR4(), getClass().getClassLoader(), new StandardEnvironment()); assertNotNull(provider); - assertResourcesStream(8, - provider.getResources(PROCESS_FULL_NAME_PING + "/" + VERSION, s -> ResourceProvider.empty())); - assertResourcesStream(5, - provider.getResources(PROCESS_FULL_NAME_PING_AUTOSTART + "/" + VERSION, s -> ResourceProvider.empty())); - assertResourcesStream(7, - provider.getResources(PROCESS_FULL_NAME_PONG + "/" + VERSION, s -> ResourceProvider.empty())); - } + var ping = provider.getResources(PROCESS_NAME_FULL_PING + "/" + VERSION, s -> ResourceProvider.empty()); + assertNotNull(ping); + assertEquals(8, ping.count()); - private void assertResourcesStream(int expectedResources, Stream<MetadataResource> resourcesStream) - { - assertNotNull(resourcesStream); - assertEquals(expectedResources, resourcesStream.count()); + var pingAutostart = provider.getResources(PROCESS_NAME_FULL_PING_AUTOSTART + "/" + VERSION, + s -> ResourceProvider.empty()); + assertNotNull(pingAutostart); + assertEquals(5, pingAutostart.count()); + + var pong = provider.getResources(PROCESS_NAME_FULL_PONG + "/" + VERSION, s -> ResourceProvider.empty()); + assertNotNull(pong); + assertEquals(7, pong.count()); } } diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java index f83c42e3..c3ae2371 100644 --- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java +++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateAllowList.java @@ -5,13 +5,20 @@ public interface ConstantsUpdateAllowList { + String PROCESS_NAME_DOWNLOAD_ALLOW_LIST = "downloadAllowList"; + String PROCESS_NAME_UPDATE_ALLOW_LIST = "updateAllowList"; + + String PROCESS_NAME_FULL_DOWNLOAD_ALLOW_LIST = "highmedorg_" + PROCESS_NAME_DOWNLOAD_ALLOW_LIST; + String PROCESS_NAME_FULL_UPDATE_ALLOW_LIST = "highmedorg_" + PROCESS_NAME_UPDATE_ALLOW_LIST; + String CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST = "http://highmed.org/fhir/CodeSystem/update-allow-list"; String CODESYSTEM_HIGHMED_UPDATE_ALLOW_LIST_VALUE_ALLOW_LIST = "allow_list"; String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST = "http://highmed.org/fhir/StructureDefinition/task-download-allow-list"; String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST + "|" + VERSION; - String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "downloadAllowList/"; + String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + + PROCESS_NAME_DOWNLOAD_ALLOW_LIST + "/"; String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_DOWNLOAD_ALLOW_LIST_MESSAGE_NAME = "downloadAllowListMessage"; @@ -19,7 +26,8 @@ public interface ConstantsUpdateAllowList String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST = "http://highmed.org/fhir/StructureDefinition/task-update-allow-list"; String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST + "|" + VERSION; - String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + "updateAllowList/"; + String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI = PROCESS_HIGHMED_URI_BASE + + PROCESS_NAME_UPDATE_ALLOW_LIST + "/"; String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_UPDATE_ALLOW_LIST_MESSAGE_NAME = "updateAllowListMessage"; diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java index c667868c..4d458ddb 100644 --- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java +++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java @@ -1,5 +1,8 @@ package org.highmed.dsf.bpe; +import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROCESS_NAME_FULL_DOWNLOAD_ALLOW_LIST; +import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROCESS_NAME_FULL_UPDATE_ALLOW_LIST; + import java.time.LocalDate; import java.util.Arrays; import java.util.List; @@ -56,16 +59,19 @@ public Stream<Class<?>> getSpringConfigClasses() public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader, PropertyResolver resolver) { + var c = CodeSystemResource.file("fhir/CodeSystem/highmed-update-allow-list.xml"); + var aDown = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-downloadAllowList.xml"); var aUp = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-updateAllowList.xml"); - var c = CodeSystemResource.file("fhir/CodeSystem/highmed-update-allow-list.xml"); + var sDown = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-download-allow-list.xml"); var sUp = StructureDefinitionResource.file("fhir/StructureDefinition/highmed-task-update-allow-list.xml"); + var v = ValueSetResource.file("fhir/ValueSet/highmed-update-allow-list.xml"); Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( - "highmedorg_downloadAllowList/" + VERSION, Arrays.asList(aDown, c, sDown, v), - "highmedorg_updateAllowList/" + VERSION, Arrays.asList(aUp, c, sUp, v)); + PROCESS_NAME_FULL_DOWNLOAD_ALLOW_LIST + "/" + VERSION, Arrays.asList(c, aDown, sDown, v), + PROCESS_NAME_FULL_UPDATE_ALLOW_LIST + "/" + VERSION, Arrays.asList(c, aUp, sUp, v)); return ResourceProvider.read(VERSION, RELEASE_DATE, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, diff --git a/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinitionTest.java b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinitionTest.java new file mode 100644 index 00000000..e0ed70bc --- /dev/null +++ b/dsf-bpe-process-update-allow-list/src/test/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinitionTest.java @@ -0,0 +1,35 @@ +package org.highmed.dsf.bpe; + +import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROCESS_NAME_FULL_DOWNLOAD_ALLOW_LIST; +import static org.highmed.dsf.bpe.ConstantsUpdateAllowList.PROCESS_NAME_FULL_UPDATE_ALLOW_LIST; +import static org.highmed.dsf.bpe.UpdateAllowListProcessPluginDefinition.VERSION; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.highmed.dsf.fhir.resources.ResourceProvider; +import org.junit.Test; +import org.springframework.core.env.StandardEnvironment; + +import ca.uhn.fhir.context.FhirContext; + +public class UpdateAllowListProcessPluginDefinitionTest +{ + @Test + public void testResourceLoading() throws Exception + { + ProcessPluginDefinition definition = new UpdateAllowListProcessPluginDefinition(); + ResourceProvider provider = definition.getResourceProvider(FhirContext.forR4(), getClass().getClassLoader(), + new StandardEnvironment()); + assertNotNull(provider); + + var download = provider.getResources(PROCESS_NAME_FULL_DOWNLOAD_ALLOW_LIST + "/" + VERSION, + s -> ResourceProvider.empty()); + assertNotNull(download); + assertEquals(4, download.count()); + + var update = provider.getResources(PROCESS_NAME_FULL_UPDATE_ALLOW_LIST + "/" + VERSION, + s -> ResourceProvider.empty()); + assertNotNull(update); + assertEquals(4, update.count()); + } +} diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java index e6a7b7ec..4670e3cf 100644 --- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java +++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/ConstantsUpdateResources.java @@ -5,6 +5,12 @@ public interface ConstantsUpdateResources { + String PROCESS_NAME_EXECUTE_UPDATE_RESOURCES = "executeUpdateResources"; + String PROCESS_NAME_REQUEST_UPDATE_RESOURCES = "requestUpdateResources"; + + String PROCESS_NAME_FULL_EXECUTE_UPDATE_RESOURCES = "highmedorg_" + PROCESS_NAME_EXECUTE_UPDATE_RESOURCES; + String PROCESS_NAME_FULL_REQUEST_UPDATE_RESOURCES = "highmedorg_" + PROCESS_NAME_REQUEST_UPDATE_RESOURCES; + String BPMN_EXECUTION_VARIABLE_BUNDLE = "bundle"; String CODESYSTEM_HIGHMED_UPDATE_RESOURCE = "http://highmed.org/fhir/CodeSystem/update-resources"; @@ -15,7 +21,7 @@ public interface ConstantsUpdateResources String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES + "|" + VERSION; String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI = PROCESS_HIGHMED_URI_BASE - + "requestUpdateResources/"; + + PROCESS_NAME_REQUEST_UPDATE_RESOURCES + "/"; String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_REQUEST_UPDATE_RESOURCES_MESSAGE_NAME = "requestUpdateResourcesMessage"; @@ -24,7 +30,7 @@ public interface ConstantsUpdateResources String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES + "|" + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI = PROCESS_HIGHMED_URI_BASE - + "executeUpdateResources/"; + + PROCESS_NAME_EXECUTE_UPDATE_RESOURCES + "/"; String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI_AND_LATEST_VERSION = PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_PROCESS_URI + VERSION; String PROFILE_HIGHMED_TASK_EXECUTE_UPDATE_RESOURCES_MESSAGE_NAME = "executeUpdateResourcesMessage"; diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java index b3dcc346..b0ecad8d 100644 --- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java +++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java @@ -1,5 +1,8 @@ package org.highmed.dsf.bpe; +import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROCESS_NAME_FULL_EXECUTE_UPDATE_RESOURCES; +import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROCESS_NAME_FULL_REQUEST_UPDATE_RESOURCES; + import java.time.LocalDate; import java.util.Arrays; import java.util.List; @@ -56,18 +59,21 @@ public Stream<Class<?>> getSpringConfigClasses() public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader, PropertyResolver resolver) { + var c = CodeSystemResource.file("fhir/CodeSystem/highmed-update-resources.xml"); + var aExec = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-executeUpdateResources.xml"); var aReq = ActivityDefinitionResource.file("fhir/ActivityDefinition/highmed-requestUpdateResources.xml"); - var c = CodeSystemResource.file("fhir/CodeSystem/highmed-update-resources.xml"); + var sExec = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-execute-update-resources.xml"); var sReq = StructureDefinitionResource .file("fhir/StructureDefinition/highmed-task-request-update-resources.xml"); + var v = ValueSetResource.file("fhir/ValueSet/highmed-update-resources.xml"); Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( - "highmedorg_executeUpdateResources/" + VERSION, Arrays.asList(aExec, c, sExec, v), - "highmedorg_requestUpdateResources/" + VERSION, Arrays.asList(aReq, c, sReq, v)); + PROCESS_NAME_FULL_EXECUTE_UPDATE_RESOURCES + "/" + VERSION, Arrays.asList(c, aExec, sExec, v), + PROCESS_NAME_FULL_REQUEST_UPDATE_RESOURCES + "/" + VERSION, Arrays.asList(c, aReq, sReq, v)); return ResourceProvider.read(VERSION, RELEASE_DATE, () -> fhirContext.newXmlParser().setStripVersionsFromReferences(false), classLoader, resolver, diff --git a/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinitionTest.java b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinitionTest.java new file mode 100644 index 00000000..08c25ee3 --- /dev/null +++ b/dsf-bpe-process-update-resources/src/test/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinitionTest.java @@ -0,0 +1,36 @@ +package org.highmed.dsf.bpe; + +import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROCESS_NAME_FULL_EXECUTE_UPDATE_RESOURCES; +import static org.highmed.dsf.bpe.ConstantsUpdateResources.PROCESS_NAME_FULL_REQUEST_UPDATE_RESOURCES; +import static org.highmed.dsf.bpe.UpdateResourcesProcessPluginDefinition.VERSION; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import org.highmed.dsf.fhir.resources.ResourceProvider; +import org.junit.Test; +import org.springframework.core.env.StandardEnvironment; + +import ca.uhn.fhir.context.FhirContext; + +public class UpdateResourcesProcessPluginDefinitionTest +{ + @Test + public void testResourceLoading() throws Exception + { + ProcessPluginDefinition definition = new UpdateResourcesProcessPluginDefinition(); + ResourceProvider provider = definition.getResourceProvider(FhirContext.forR4(), getClass().getClassLoader(), + new StandardEnvironment()); + assertNotNull(provider); + + var exec = provider.getResources(PROCESS_NAME_FULL_EXECUTE_UPDATE_RESOURCES + "/" + VERSION, + s -> ResourceProvider.empty()); + assertNotNull(exec); + assertEquals(4, exec.count()); + + + var req = provider.getResources(PROCESS_NAME_FULL_REQUEST_UPDATE_RESOURCES + "/" + VERSION, + s -> ResourceProvider.empty()); + assertNotNull(req); + assertEquals(4, req.count()); + } +} From 6436adc1c0c71df737ef0ec1c75072c972d4f663 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Mon, 9 May 2022 11:33:25 +0200 Subject: [PATCH 124/125] adds ignore annotations to (is-)getters that should not be serialized --- .../main/java/org/highmed/dsf/bpe/variable/QueryResult.java | 4 ++++ .../java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java | 2 ++ 2 files changed, 6 insertions(+) diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java index 6ec5d15d..87ddfd54 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/QueryResult.java @@ -3,6 +3,7 @@ import org.highmed.openehr.model.structure.ResultSet; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; public class QueryResult @@ -78,16 +79,19 @@ public String getResultSetUrl() return resultSetUrl; } + @JsonIgnore public boolean isCohortSizeResult() { return resultSet == null && resultSetUrl == null; } + @JsonIgnore public boolean isIdResultSetResult() { return resultSet != null && resultSetUrl == null; } + @JsonIgnore public boolean isIdResultSetUrlResult() { return resultSet == null && resultSetUrl != null; diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java index 06b39322..46d68a17 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/variable/SecretKeyWrapper.java @@ -10,6 +10,7 @@ import org.slf4j.LoggerFactory; import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; public class SecretKeyWrapper @@ -48,6 +49,7 @@ private SecretKeyWrapper(@JsonProperty("bytes") byte[] bytes, @JsonProperty("alg this.algorithm = algorithm; } + @JsonIgnore public SecretKey getSecretKey() { return new SecretKeySpec(bytes, algorithm); From a8f9e6cdfb1b838e0344ac1e0fffe07d59b8f734 Mon Sep 17 00:00:00 2001 From: Hauke Hund <hauke.hund@hs-heilbronn.de> Date: Wed, 11 May 2022 00:09:10 +0200 Subject: [PATCH 125/125] 0.6.0 release --- dsf-bpe-process-data-sharing/pom.xml | 2 +- .../highmed/dsf/bpe/DataSharingProcessPluginDefinition.java | 2 +- dsf-bpe-process-feasibility-mpc/pom.xml | 2 +- .../dsf/bpe/FeasibilityMpcProcessPluginDefinition.java | 2 +- dsf-bpe-process-feasibility/pom.xml | 2 +- .../highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java | 2 +- dsf-bpe-process-local-services/pom.xml | 2 +- .../highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java | 2 +- dsf-bpe-process-ping/pom.xml | 2 +- .../java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java | 2 +- dsf-bpe-process-update-allow-list/pom.xml | 2 +- .../dsf/bpe/UpdateAllowListProcessPluginDefinition.java | 2 +- dsf-bpe-process-update-resources/pom.xml | 2 +- .../dsf/bpe/UpdateResourcesProcessPluginDefinition.java | 2 +- pom.xml | 4 ++-- 15 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dsf-bpe-process-data-sharing/pom.xml b/dsf-bpe-process-data-sharing/pom.xml index 39b2aed0..133b7d56 100644 --- a/dsf-bpe-process-data-sharing/pom.xml +++ b/dsf-bpe-process-data-sharing/pom.xml @@ -9,7 +9,7 @@ <parent> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> <groupId>org.highmed.dsf</groupId> - <version>0.6.0-SNAPSHOT</version> + <version>0.6.0</version> </parent> <properties> diff --git a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java index 31c57655..39f4ec83 100644 --- a/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java +++ b/dsf-bpe-process-data-sharing/src/main/java/org/highmed/dsf/bpe/DataSharingProcessPluginDefinition.java @@ -25,7 +25,7 @@ public class DataSharingProcessPluginDefinition implements ProcessPluginDefinition { public static final String VERSION = "0.6.0"; - public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 4, 14); + public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 5, 10); @Override public String getName() diff --git a/dsf-bpe-process-feasibility-mpc/pom.xml b/dsf-bpe-process-feasibility-mpc/pom.xml index e195a0af..1c0a943b 100644 --- a/dsf-bpe-process-feasibility-mpc/pom.xml +++ b/dsf-bpe-process-feasibility-mpc/pom.xml @@ -9,7 +9,7 @@ <parent> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> <groupId>org.highmed.dsf</groupId> - <version>0.6.0-SNAPSHOT</version> + <version>0.6.0</version> </parent> <properties> diff --git a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java index 5ba21a36..18dce86a 100644 --- a/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java +++ b/dsf-bpe-process-feasibility-mpc/src/main/java/org/highmed/dsf/bpe/FeasibilityMpcProcessPluginDefinition.java @@ -26,7 +26,7 @@ public class FeasibilityMpcProcessPluginDefinition implements ProcessPluginDefinition { public static final String VERSION = "0.6.0"; - public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 4, 14); + public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 5, 10); private static final String DEPENDENCY_DATA_SHARING_VERSION = "0.6.0"; private static final String DEPENDENCY_DATA_SHARING_NAME_AND_VERSION = "dsf-bpe-process-data-sharing-0.6.0"; diff --git a/dsf-bpe-process-feasibility/pom.xml b/dsf-bpe-process-feasibility/pom.xml index 3d640ae0..8597bff8 100644 --- a/dsf-bpe-process-feasibility/pom.xml +++ b/dsf-bpe-process-feasibility/pom.xml @@ -9,7 +9,7 @@ <parent> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> <groupId>org.highmed.dsf</groupId> - <version>0.6.0-SNAPSHOT</version> + <version>0.6.0</version> </parent> <properties> diff --git a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java index 49457c23..38edeafc 100644 --- a/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java +++ b/dsf-bpe-process-feasibility/src/main/java/org/highmed/dsf/bpe/FeasibilityProcessPluginDefinition.java @@ -26,7 +26,7 @@ public class FeasibilityProcessPluginDefinition implements ProcessPluginDefinition { public static final String VERSION = "0.6.0"; - public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 4, 14); + public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 5, 10); private static final String DEPENDENCY_DATA_SHARING_VERSION = "0.6.0"; private static final String DEPENDENCY_DATA_SHARING_NAME_AND_VERSION = "dsf-bpe-process-data-sharing-0.6.0"; diff --git a/dsf-bpe-process-local-services/pom.xml b/dsf-bpe-process-local-services/pom.xml index e237c898..d3d6ed72 100644 --- a/dsf-bpe-process-local-services/pom.xml +++ b/dsf-bpe-process-local-services/pom.xml @@ -9,7 +9,7 @@ <parent> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> <groupId>org.highmed.dsf</groupId> - <version>0.6.0-SNAPSHOT</version> + <version>0.6.0</version> </parent> <properties> diff --git a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java index 88307191..654ff7f4 100644 --- a/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java +++ b/dsf-bpe-process-local-services/src/main/java/org/highmed/dsf/bpe/LocalServicesProcessPluginDefinition.java @@ -24,7 +24,7 @@ public class LocalServicesProcessPluginDefinition implements ProcessPluginDefinition { public static final String VERSION = "0.6.0"; - public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 4, 14); + public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 5, 10); private static final String DEPENDENCY_DATA_SHARING_VERSION = "0.6.0"; private static final String DEPENDENCY_DATA_SHARING_NAME_AND_VERSION = "dsf-bpe-process-data-sharing-0.6.0"; diff --git a/dsf-bpe-process-ping/pom.xml b/dsf-bpe-process-ping/pom.xml index 10900435..fcf272a7 100644 --- a/dsf-bpe-process-ping/pom.xml +++ b/dsf-bpe-process-ping/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> - <version>0.6.0-SNAPSHOT</version> + <version>0.6.0</version> </parent> <properties> diff --git a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java index e19f4b1d..b1a90c2e 100644 --- a/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java +++ b/dsf-bpe-process-ping/src/main/java/org/highmed/dsf/bpe/PingProcessPluginDefinition.java @@ -24,7 +24,7 @@ public class PingProcessPluginDefinition implements ProcessPluginDefinition { public static final String VERSION = "0.6.0"; - public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 4, 14); + public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 5, 10); @Override public String getName() diff --git a/dsf-bpe-process-update-allow-list/pom.xml b/dsf-bpe-process-update-allow-list/pom.xml index 4cde3472..141d56fc 100644 --- a/dsf-bpe-process-update-allow-list/pom.xml +++ b/dsf-bpe-process-update-allow-list/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> - <version>0.6.0-SNAPSHOT</version> + <version>0.6.0</version> </parent> <properties> diff --git a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java index 4d458ddb..1786e221 100644 --- a/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java +++ b/dsf-bpe-process-update-allow-list/src/main/java/org/highmed/dsf/bpe/UpdateAllowListProcessPluginDefinition.java @@ -23,7 +23,7 @@ public class UpdateAllowListProcessPluginDefinition implements ProcessPluginDefinition { public static final String VERSION = "0.6.0"; - public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 4, 14); + public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 5, 10); @Override public String getName() diff --git a/dsf-bpe-process-update-resources/pom.xml b/dsf-bpe-process-update-resources/pom.xml index 87a559bb..8aa9d21a 100644 --- a/dsf-bpe-process-update-resources/pom.xml +++ b/dsf-bpe-process-update-resources/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> - <version>0.6.0-SNAPSHOT</version> + <version>0.6.0</version> </parent> <properties> diff --git a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java index b0ecad8d..6f40a879 100644 --- a/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java +++ b/dsf-bpe-process-update-resources/src/main/java/org/highmed/dsf/bpe/UpdateResourcesProcessPluginDefinition.java @@ -23,7 +23,7 @@ public class UpdateResourcesProcessPluginDefinition implements ProcessPluginDefinition { public static final String VERSION = "0.6.0"; - public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 4, 14); + public static final LocalDate RELEASE_DATE = LocalDate.of(2022, 5, 10); @Override public String getName() diff --git a/pom.xml b/pom.xml index 15e435b8..eeba23df 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ <groupId>org.highmed.dsf</groupId> <artifactId>dsf-bpe-highmed-processes-pom</artifactId> - <version>0.6.0-SNAPSHOT</version> + <version>0.6.0</version> <packaging>pom</packaging> <modules> @@ -25,7 +25,7 @@ <compileTarget>11</compileTarget> <main.basedir>${project.basedir}</main.basedir> - <dsf.version>0.6.0-SNAPSHOT</dsf.version> + <dsf.version>0.6.0</dsf.version> </properties> <name>highmed-processes</name>