Skip to content

Commit

Permalink
Merge remote-tracking branch
Browse files Browse the repository at this point in the history
'origin/issues/39_internal_bundle_validation' into develop
  • Loading branch information
hhund committed Jun 18, 2022
2 parents 08883dc + 7bc60c1 commit eb0027a
Show file tree
Hide file tree
Showing 75 changed files with 5,297 additions and 214 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,17 @@ codex-processes-ap1-docker-test-setup/**/bpe/last_event/time.file
codex-processes-ap1-docker-test-setup/**/bpe/plugin/*.jar
codex-processes-ap1-docker-test-setup/**/bpe/process/*.jar

codex-processes-ap1-docker-test-setup/dic/bpe/cache/**/*.json.gz

codex-processes-ap1-docker-test-setup/**/fhir/conf/bundle.xml
codex-processes-ap1-docker-test-setup/**/fhir/log/*.log
codex-processes-ap1-docker-test-setup/**/fhir/log/*.log.gz

codex-processes-ap1-docker-test-setup/secrets/*.pem
codex-processes-ap1-docker-test-setup/.env
codex-processes-ap1-docker-test-setup/.env
codex-processes-ap1-docker-test-setup/docker-compose.override.yml

###
# codex-process-data-transfer ignores
###
codex-process-data-transfer/application.properties
103 changes: 84 additions & 19 deletions codex-process-data-transfer/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<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 https://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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>codex-process-data-transfer</artifactId>
Expand All @@ -16,32 +14,23 @@
</properties>

<dependencies>
<!-- provided by DSF -->
<dependency>
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-bpe-process-base</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client</artifactId>
<scope>provided</scope>
<groupId>org.highmed.dsf</groupId>
<artifactId>dsf-tools-documentation-generator</artifactId>
</dependency>

<!-- must be added as regular DSF plugin -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<scope>provided</scope>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client</artifactId>
</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.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand All @@ -51,6 +40,15 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/ValidateDataLearningTest.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
Expand Down Expand Up @@ -157,6 +155,26 @@
<outputDirectory>../codex-processes-ap1-docker-test-setup/gth/bpe/plugin</outputDirectory>
</configuration>
</execution>

<execution>
<id>copy-standalone-dependencies</id>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
<includeArtifactIds>hapi-fhir-base,hapi-fhir-client,hapi-fhir-converter,hapi-fhir-structures-r4,hapi-fhir-structures-r5,hapi-fhir-validation,hapi-fhir-validation-resources-r4,
hapi-fhir-validation-resources-r5,org.hl7.fhir.convertors,org.hl7.fhir.dstu2,org.hl7.fhir.dstu2016may,org.hl7.fhir.dstu3,org.hl7.fhir.r4,org.hl7.fhir.r5,org.hl7.fhir.utilities,
org.hl7.fhir.validation,jackson-annotations,jackson-core,jackson-databind,jackson-module-jaxb-annotations,caffeine,guava,
commons-codec,commons-io,crypto-utils,log4j2-utils,jakarta.activation,jakarta.annotation-api,jakarta.ws.rs-api,jakarta.xml.bind-api,commons-compress,commons-lang3,commons-text,
httpclient,httpcore,log4j-api,log4j-core,log4j-slf4j-impl,bcpkix-jdk15on,bcprov-jdk15on,bcutil-jdk15on,ucum,hk2-api,hk2-locator,hk2-utils,osgi-resource-locator,
aopalliance-repackaged,jakarta.inject,jersey-apache-connector,jersey-client,jersey-common,jersey-entity-filtering,jersey-hk2,jersey-media-jaxb,jersey-media-json-jackson,
dsf-bpe-process-base,dsf-fhir-rest-adapter,dsf-fhir-validation,dsf-openehr-model,jcl-over-slf4j,
slf4j-api,spring-aop,spring-beans,spring-context,spring-core,spring-expression,spring-jcl,thymeleaf,unbescape,xpp3,xpp3_xpath
</includeArtifactIds>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand Down Expand Up @@ -209,6 +227,53 @@
</filesets>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<appendAssemblyId>false</appendAssemblyId>
<descriptors>
<descriptor>src/assembly/zip.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>zip-assembly</id>
<phase>install</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
<phase>prepare-package</phase>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>
org.highmed.dsf.tools.generator.DocumentationGenerator
</argument>
<argument>
de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.spring.config
</argument>
</arguments>
<includeProjectDependencies>true</includeProjectDependencies>
<addResourcesToClasspath>true</addResourcesToClasspath>
<classpathScope>compile</classpathScope>
<workingDirectory>${project.basedir}</workingDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>
26 changes: 26 additions & 0 deletions codex-process-data-transfer/src/assembly/zip.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>zip</id>
<formats>
<format>zip</format>
</formats>
<baseDirectory></baseDirectory>
<fileSets>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory></outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}/lib</directory>
<outputDirectory>lib</outputDirectory>
<includes>
<include>*.jar</include>
</includes>
</fileSet>
</fileSets>
</assembly>
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,20 @@ public interface ConstantsDataTransfer
* dic-source/dic-pseudonym-original
*/
String PSEUDONYM_PATTERN_STRING = "(?<source>[^/]+)/(?<original>[^/]+)";

String HAPI_USER_DATA_SOURCE_ID_ELEMENT = "source-id";

String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR = "http://www.netzwerk-universitaetsmedizin.de/fhir/CodeSystem/data-transfer-error";
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_VALUE_VALIDATION_FAILED = "validation-failed";

String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_SOURCE = "http://www.netzwerk-universitaetsmedizin.de/fhir/CodeSystem/data-transfer-error-source";
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_SOURCE_VALUE_MEDIC = "MeDIC";
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_SOURCE_VALUE_GTH = "GTH";
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_SOURCE_VALUE_FTTP = "fTTP";
String CODESYSTEM_NUM_CODEX_DATA_TRANSFER_ERROR_SOURCE_VALUE_CRR = "CRR";

String EXTENSION_ERROR_METADATA = "https://www.netzwerk-universitaetsmedizin.de/fhir/StructureDefinition/error-metadata";
String EXTENSION_ERROR_METADATA_TYPE = "type";
String EXTENSION_ERROR_METADATA_SOURCE = "source";
String EXTENSION_ERROR_METADATA_REFERENCE = "reference";
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import org.highmed.dsf.fhir.resources.ResourceProvider;
import org.highmed.dsf.fhir.resources.StructureDefinitionResource;
import org.highmed.dsf.fhir.resources.ValueSetResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.PropertyResolver;

Expand All @@ -22,9 +24,13 @@
import de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.client.GeccoClientFactory;
import de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.spring.config.TransferDataConfig;
import de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.spring.config.TransferDataSerializerConfig;
import de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.spring.config.ValidationConfig;
import de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.validation.BundleValidatorFactory;

public class DataTransferProcessPluginDefinition implements ProcessPluginDefinition
{
private static final Logger logger = LoggerFactory.getLogger(DataTransferProcessPluginDefinition.class);

public static final String VERSION = "0.5.0";
public static final LocalDate DATE = LocalDate.of(2021, 9, 6);

Expand Down Expand Up @@ -55,7 +61,7 @@ public Stream<String> getBpmnFiles()
@Override
public Stream<Class<?>> getSpringConfigClasses()
{
return Stream.of(TransferDataConfig.class, TransferDataSerializerConfig.class);
return Stream.of(TransferDataConfig.class, TransferDataSerializerConfig.class, ValidationConfig.class);
}

@Override
Expand All @@ -68,28 +74,34 @@ public ResourceProvider getResourceProvider(FhirContext fhirContext, ClassLoader
var aRec = ActivityDefinitionResource.file("fhir/ActivityDefinition/num-codex-data-receive.xml");

var cD = CodeSystemResource.file("fhir/CodeSystem/num-codex-data-transfer.xml");
var cDeS = CodeSystemResource.file("fhir/CodeSystem/num-codex-data-transfer-error-source.xml");
var cDe = CodeSystemResource.file("fhir/CodeSystem/num-codex-data-transfer-error.xml");

var nD = NamingSystemResource.file("fhir/NamingSystem/num-codex-dic-pseudonym-identifier.xml");
var nC = NamingSystemResource.file("fhir/NamingSystem/num-codex-crr-pseudonym-identifier.xml");
var nB = NamingSystemResource.file("fhir/NamingSystem/num-codex-bloom-filter-identifier.xml");

var sTexErMe = StructureDefinitionResource
.file("fhir/StructureDefinition/num-codex-extension-error-metadata.xml");
var sTstaDrec = StructureDefinitionResource
.file("fhir/StructureDefinition/num-codex-task-start-data-receive.xml");
var sTstaDsen = StructureDefinitionResource.file("fhir/StructureDefinition/num-codex-task-start-data-send.xml");
var sTstaDtra = StructureDefinitionResource
.file("fhir/StructureDefinition/num-codex-task-start-data-translate.xml");
var sTstaDtri = StructureDefinitionResource
.file("fhir/StructureDefinition/num-codex-task-start-data-trigger.xml");
var sTstoDtri = StructureDefinitionResource
.file("fhir/StructureDefinition/num-codex-task-stop-data-trigger.xml");
var sTstaDsen = StructureDefinitionResource.file("fhir/StructureDefinition/num-codex-task-start-data-send.xml");
var sTstaDtra = StructureDefinitionResource
.file("fhir/StructureDefinition/num-codex-task-start-data-translate.xml");
var sTstaDrec = StructureDefinitionResource
.file("fhir/StructureDefinition/num-codex-task-start-data-receive.xml");

var vD = ValueSetResource.file("fhir/ValueSet/num-codex-data-transfer.xml");
var vDeS = ValueSetResource.file("fhir/ValueSet/num-codex-data-transfer-error-source.xml");
var vDe = ValueSetResource.file("fhir/ValueSet/num-codex-data-transfer-error.xml");

Map<String, List<AbstractResource>> resourcesByProcessKeyAndVersion = Map.of( //
"wwwnetzwerk-universitaetsmedizinde_dataTrigger/" + VERSION,
Arrays.asList(aTri, cD, nD, sTstaDtri, sTstoDtri, vD), //
"wwwnetzwerk-universitaetsmedizinde_dataSend/" + VERSION,
Arrays.asList(aSen, cD, nD, nB, sTstaDsen, vD), //
Arrays.asList(aSen, cD, cDeS, cDe, nD, nB, sTexErMe, sTstaDsen, vD, vDeS, vDe), //
"wwwnetzwerk-universitaetsmedizinde_dataTranslate/" + VERSION,
Arrays.asList(aTra, cD, nD, nC, sTstaDtra, vD), //
"wwwnetzwerk-universitaetsmedizinde_dataReceive/" + VERSION,
Expand All @@ -114,5 +126,18 @@ public void onProcessesDeployed(ApplicationContext pluginApplicationContext, Lis
{
pluginApplicationContext.getBean(FttpClientFactory.class).testConnection();
}

if (activeProcesses.contains("wwwnetzwerk-universitaetsmedizinde_dataSend"))
{
boolean testOk = pluginApplicationContext.getBean(ValidationConfig.class)
.testConnectionToTerminologyServer();

if (testOk)
pluginApplicationContext.getBean(BundleValidatorFactory.class).init();
else
logger.warn(
"Due to an error while testing the connection to the terminology server {} was not initialized, validation of bundles will be skipped.",
BundleValidatorFactory.class.getSimpleName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

public interface GeccoClient
{
String getServerBase();

FhirContext getFhirContext();

void testConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,27 @@ private static final class GeccoClientStub implements GeccoClient
}

@Override
public void testConnection()
public String getServerBase()
{
logger.warn("Stub implementation, no connection test performed");
return null;
}

@Override
public GeccoFhirClient getFhirClient()
public FhirContext getFhirContext()
{
return new GeccoFhirClientStub(this);
return fhirContext;
}

@Override
public FhirContext getFhirContext()
public void testConnection()
{
return fhirContext;
logger.warn("Stub implementation, no connection test performed");
}

@Override
public GeccoFhirClient getFhirClient()
{
return new GeccoFhirClientStub(this);
}

@Override
Expand Down Expand Up @@ -141,6 +147,11 @@ public GeccoClientFactory(Path trustStorePath, Path certificatePath, Path privat
this.useChainedParameterNotLogicalReference = useChainedParameterNotLogicalReference;
}

public String getServerBase()
{
return geccoServerBase;
}

public void testConnection()
{
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ private void configureLoggingInterceptor(IGenericClient client)
}
}

@Override
public String getServerBase()
{
return geccoServerBase;
}

@Override
public FhirContext getFhirContext()
{
return fhirContext;
}

@Override
public void testConnection()
{
Expand Down Expand Up @@ -154,12 +166,6 @@ public GeccoFhirClient getFhirClient()
}
}

@Override
public FhirContext getFhirContext()
{
return fhirContext;
}

@Override
public Path getSearchBundleOverride()
{
Expand Down
Loading

0 comments on commit eb0027a

Please sign in to comment.