Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/release/0.6.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
hhund committed May 10, 2022
2 parents 39c5153 + a5b1528 commit 4c6c6a3
Show file tree
Hide file tree
Showing 277 changed files with 6,926 additions and 3,102 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dsf-docker-test-setup/bpe/log/*.log.gz
dsf-docker-test-setup/bpe/plugin/*.jar
dsf-docker-test-setup/bpe/process/*.jar
dsf-docker-test-setup/bpe/psn/*.jceks
dsf-docker-test-setup/bpe/psn/*.p12
dsf-docker-test-setup/bpe/secrets/*.pem

dsf-docker-test-setup/fhir/log/*.log
Expand All @@ -61,6 +62,7 @@ dsf-docker-test-setup-3medic-ttp-docker/**/bpe/log/*.log.gz
dsf-docker-test-setup-3medic-ttp-docker/**/bpe/plugin/*.jar
dsf-docker-test-setup-3medic-ttp-docker/**/bpe/process/*.jar
dsf-docker-test-setup-3medic-ttp-docker/**/bpe/psn/*.jceks
dsf-docker-test-setup-3medic-ttp-docker/**/bpe/psn/*.p12

dsf-docker-test-setup-3medic-ttp-docker/**/fhir/log/*.log
dsf-docker-test-setup-3medic-ttp-docker/**/fhir/log/*.log.gz
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ preferred-citation:
doi: 10.3233/SHTI210060
type: proceedings
title: "HiGHmed Data Sharing Framework (HiGHmed DSF)"
version: 0.5.5
date-released: 2022-03-21
version: 0.6.0
date-released: 2022-03-10
url: https://github.com/highmed/highmed-dsf/wiki
repository-code: https://github.com/highmed/highmed-dsf
repository-artifact: https://github.com/highmed/highmed-dsf/releases
Expand Down
11 changes: 10 additions & 1 deletion dsf-bpe/dsf-bpe-process-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-bpe-pom</artifactId>
<version>0.5.5</version>
<version>0.6.0</version>
</parent>

<dependencies>
Expand All @@ -20,6 +20,10 @@
<artifactId>dsf-fhir-auth</artifactId>
</dependency>

<dependency>
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-pseudonymization-client</artifactId>
</dependency>
<dependency>
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-pseudonymization-medic</artifactId>
Expand All @@ -34,6 +38,11 @@
<artifactId>dsf-mpi-client</artifactId>
</dependency>

<dependency>
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-consent-client</artifactId>
</dependency>

<dependency>
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-openehr-model</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,50 @@ public interface ConstantsBase
String CODESYSTEM_HIGHMED_BPMN_VALUE_CORRELATION_KEY = "correlation-key";
String CODESYSTEM_HIGHMED_BPMN_VALUE_ERROR = "error";

/**
* @deprecated as of release 0.6.0, use {@link #CODESYSTEM_HIGHMED_ORGANIZATION_ROLE} instead
*/
@Deprecated
String CODESYSTEM_HIGHMED_ORGANIZATION_TYPE = "http://highmed.org/fhir/CodeSystem/organization-type";
/**
* @deprecated as of release 0.6.0, use {@link #CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP} instead
*/
@Deprecated
String CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_TTP = "TTP";
/**
* @deprecated as of release 0.6.0, use {@link #CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC} instead
*/
@Deprecated
String CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_MEDIC = "MeDIC";
/**
* @deprecated as of release 0.6.0, use {@link #CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_DTS} instead
*/
@Deprecated
String CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_DTS = "DTS";
/**
* @deprecated as of release 0.6.0, use {@link #CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_COS} instead
*/
@Deprecated
String CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_COS = "COS";
/**
* @deprecated as of release 0.6.0, use {@link #CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_CRR} instead
*/
@Deprecated
String CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_CRR = "CRR";
/**
* @deprecated as of release 0.6.0, use {@link #CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_HRP} instead
*/
@Deprecated
String CODESYSTEM_HIGHMED_ORGANIZATION_TYPE_VALUE_HRP = "HRP";

String CODESYSTEM_HIGHMED_ORGANIZATION_ROLE = "http://highmed.org/fhir/CodeSystem/organization-role";
String CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_TTP = "TTP";
String CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_MEDIC = "MeDIC";
String CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_DTS = "DTS";
String CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_COS = "COS";
String CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_CRR = "CRR";
String CODESYSTEM_HIGHMED_ORGANIZATION_ROLE_VALUE_HRP = "HRP";

String CODESYSTEM_HIGHMED_QUERY_TYPE = "http://highmed.org/fhir/CodeSystem/query-type";
String CODESYSTEM_HIGMED_QUERY_TYPE_VALUE_AQL = "application/x-aql-query";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
package org.highmed.dsf.bpe;

import java.time.LocalDate;
import java.util.Collections;
import java.util.List;
import java.util.ServiceLoader;
import java.util.stream.Stream;

import org.camunda.bpm.engine.impl.variable.serializer.TypedValueSerializer;
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 org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.PropertyResolver;
Expand Down Expand Up @@ -44,6 +51,18 @@ default String getNameAndVersion()
return getName() + "-" + getVersion();
}

/**
* <i>Override this method to replace <code>#{date}</code> in FHIR and BPMN files with the returned value.</i>
*
* @return the release date of the process plugin, if not overridden {@link LocalDate#MIN}
* @see ResourceProvider#read(String, LocalDate, java.util.function.Supplier, ClassLoader, PropertyResolver,
* java.util.Map)
*/
default LocalDate getReleaseDate()
{
return LocalDate.MIN;
}

/**
* Return <code>Stream.of("foo.bpmn");</code> for a foo.bpmn file located in the root folder of the process plugin
* jar. The returned files will be read via {@link ClassLoader#getResourceAsStream(String)}.
Expand All @@ -60,14 +79,31 @@ default String getNameAndVersion()
Stream<Class<?>> getSpringConfigClasses();

/**
* <i>Override this method to return a {@link ResourceProvider} with fhir metadata resources (ActivityDefinition,
* CodeSystem, NamingSystem, StructureDefinition, ValueSet) needed by this process plugin.</i>
*
* @param fhirContext
* the applications fhir context, never <code>null</code>
* applications fhir context, never <code>null</code>
* @param classLoader
* the classLoader that was used to initialize the process plugin, never <code>null</code>
* class loader that was used to initialize the process plugin, never <code>null</code>
* @param resolver
* the property resolver used to access config properties and to replace place holders in fhir resources,
* property resolver used to access config properties and to replace place holders in fhir resources,
* never <code>null</code>
* @return {@link ResourceProvider} with FHIR resources needed to enable the included processes
* @return {@link ResourceProvider} with FHIR resources needed to enable the included processes, if not overridden
* {@link ResourceProvider#empty()}
*
* @see ActivityDefinitionResource#file(String)
* @see CodeSystemResource#file(String)
* @see NamingSystemResource#file(String)
* @see StructureDefinitionResource#file(String)
* @see ValueSetResource#file(String)
*
* @see FhirContext#newJsonParser()
* @see FhirContext#newXmlParser()
*
* @see ResourceProvider#read(String, java.util.function.Supplier, ClassLoader, PropertyResolver, java.util.Map)
* @see ResourceProvider#read(String, LocalDate, java.util.function.Supplier, ClassLoader, PropertyResolver,
* java.util.Map)
*/
default ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader classLoader,
PropertyResolver resolver)
Expand All @@ -83,4 +119,17 @@ default List<String> getDependencyNamesAndVersions()
{
return Collections.emptyList();
}

/**
* <i>Override this method to implement custom logic after a process has been deployed and is active, e.g. test the
* connection to an external server needed by a process.</i>
*
* @param pluginApplicationContext
* the process plugin spring application context, never <code>null</code>
* @param activeProcesses
* active processes from this plugin by process key
*/
default void onProcessesDeployed(ApplicationContext pluginApplicationContext, List<String> activeProcesses)
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,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.hl7.fhir.r4.model.Task;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -27,7 +28,7 @@ public abstract class AbstractServiceDelegate implements JavaDelegate, Initializ
private final TaskHelper taskHelper;
private final ReadAccessHelper readAccessHelper;

private DelegateExecution execution;
protected DelegateExecution execution;

public AbstractServiceDelegate(FhirWebserviceClientProvider clientProvider, TaskHelper taskHelper,
ReadAccessHelper readAccessHelper)
Expand Down Expand Up @@ -158,4 +159,49 @@ protected final Task getLeadingTaskFromExecutionVariables()
Task leadingTask = (Task) execution.getVariable(BPMN_EXECUTION_VARIABLE_LEADING_TASK);
return leadingTask != null ? leadingTask : getCurrentTaskFromExecutionVariables();
}

/**
* <i>Uses this method to update the process engine variable {@link ConstantsBase#BPMN_EXECUTION_VARIABLE_TASK},
* after modifying the {@link Task}.</i>
*
* @param task
* not <code>null</code>
* @throws IllegalStateException
* if execution of this service delegate has not been started
* @see ConstantsBase#BPMN_EXECUTION_VARIABLE_TASK
*/
protected final void updateCurrentTaskInExecutionVariables(Task task)
{
if (execution == null)
throw new IllegalStateException("execution not started");

Objects.requireNonNull(task, "task");
execution.setVariable(BPMN_EXECUTION_VARIABLE_TASK, FhirResourceValues.create(task));
}

/**
* <i>Uses this method to update the process engine variable
* {@link ConstantsBase#BPMN_EXECUTION_VARIABLE_LEADING_TASK}, after modifying the {@link Task}.</i>
*
* Updates the current task if no leading task is set.
*
* @param task
* not <code>null</code>
* @throws IllegalStateException
* if execution of this service delegate has not been started
* @see ConstantsBase#BPMN_EXECUTION_VARIABLE_LEADING_TASK
*/
protected final void updateLeadingTaskInExecutionVariables(Task task)
{
if (execution == null)
throw new IllegalStateException("execution not started");

Objects.requireNonNull(task, "task");
Task leadingTask = (Task) execution.getVariable(BPMN_EXECUTION_VARIABLE_LEADING_TASK);

if (leadingTask != null)
execution.setVariable(BPMN_EXECUTION_VARIABLE_LEADING_TASK, FhirResourceValues.create(task));
else
updateCurrentTaskInExecutionVariables(task);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.highmed.dsf.fhir.json;

import org.highmed.dsf.fhir.variables.FhirResourceJacksonDeserializer;
import org.highmed.dsf.fhir.variables.FhirResourceJacksonSerializer;
import org.highmed.openehr.json.OpenEhrObjectMapperFactory;
import org.hl7.fhir.r4.model.Resource;

import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.MapperFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;

import ca.uhn.fhir.context.FhirContext;

public class ObjectMapperFactory
{
private ObjectMapperFactory()
{
}

public static ObjectMapper createObjectMapper(FhirContext fhirContext)
{
return JsonMapper.builder().serializationInclusion(Include.NON_NULL).serializationInclusion(Include.NON_EMPTY)
.addModule(fhirModule(fhirContext)).addModule(OpenEhrObjectMapperFactory.openEhrModule())
.disable(MapperFeature.AUTO_DETECT_CREATORS).disable(MapperFeature.AUTO_DETECT_FIELDS)
// .disable(MapperFeature.AUTO_DETECT_GETTERS).disable(MapperFeature.AUTO_DETECT_IS_GETTERS)
.disable(MapperFeature.AUTO_DETECT_SETTERS).build();
}

public static SimpleModule fhirModule(FhirContext fhirContext)
{
return new SimpleModule().addSerializer(Resource.class, new FhirResourceJacksonSerializer(fhirContext))
.addDeserializer(Resource.class, new FhirResourceJacksonDeserializer(fhirContext));
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package org.highmed.dsf.fhir.organization;

import static org.highmed.dsf.bpe.ConstantsBase.NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER;

import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.stream.Collectors;

import org.hl7.fhir.r4.model.Endpoint;
import org.hl7.fhir.r4.model.Identifier;

public interface EndpointProvider
{
Expand All @@ -16,6 +19,12 @@ default String getLocalEndpointAddress()
return getLocalEndpoint().getAddress();
}

default Identifier getLocalEndpointIdentifier()
{
return getLocalEndpoint().getIdentifier().stream()
.filter(i -> NAMINGSYSTEM_HIGHMED_ENDPOINT_IDENTIFIER.equals(i.getSystem())).findFirst().get();
}

Map<String, Endpoint> getDefaultEndpointsByOrganizationIdentifier();

default Map<String, String> getDefaultEndpointAdressesByOrganizationIdentifier()
Expand Down Expand Up @@ -58,4 +67,11 @@ default Optional<String> getFirstConsortiumEndpointAdress(String consortiumIdent
return getFirstConsortiumEndpoint(consortiumIdentifierValue, roleSystem, roleCode, organizationIdentifierValue)
.map(Endpoint::getAddress);
}

Optional<Endpoint> getEndpoint(String endpointIdentifierValue);

default Optional<String> getEndpointAddress(String endpointIdentifierValue)
{
return getEndpoint(endpointIdentifierValue).map(Endpoint::getAddress);
}
}
Loading

0 comments on commit 4c6c6a3

Please sign in to comment.