Skip to content

Commit

Permalink
Publish Release 2.5.0
Browse files Browse the repository at this point in the history
Automerge Pull-Request for Release 2.5.0
  • Loading branch information
gematik1 authored Aug 15, 2024
2 parents 8f4d9a5 + e19ca9b commit d276b02
Show file tree
Hide file tree
Showing 30 changed files with 2,033 additions and 27 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Siehe [Release Notes](ReleaseNotes.md)

| **Modul** | **Version** |
|------------------------------------------------|-------------|
| E-Rezept | 2.3 |
| E-Rezept | 2.4 |
| Elektronische Arbeitsunfähigkeitsbescheinigung | 0.9 |
| FHIR Core | 1.0 |
| E-Rezept Abrechnungsdaten (experimentell) | 0.2 |
Expand Down
9 changes: 9 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

# Release Notes Gematik Referenzvalidator

## Release 2.5.0

### added

- ERP module (version update to 2.4):
- integrated [de.abda.eRezeptAbgabedatenPKV#1.3.0](https://simplifier.net/packages/de.abda.erezeptabgabedatenpkv/1.3.0) package (valid from 1.11.2024)
- integrated [KBV Schlüsseltabelle S_KBV_DARREICHUNGSFORM v1.14](https://applications.kbv.de/S_KBV_DARREICHUNGSFORM_V1.14.xhtml) (valid from 1.10.2024)
- Added warnings for the case, when Bundle.entry.fullUrl doesn't match the Bundle.entry.id (cf. [Bundle definitions](https://hl7.org/fhir/R4/bundle-definitions.html#Bundle.entry.fullUrl)). Notice: warnings are generally issued only if the validator has been started with the `--verbose` option.

## Release 2.4.0

### added
Expand Down
2 changes: 1 addition & 1 deletion cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>referencevalidator</artifactId>
<groupId>de.gematik.refv</groupId>
<version>2.4.1-SNAPSHOT</version>
<version>2.5.0</version>
</parent>
<properties>
<integrationtest.folder>${basedir}/target/test-classes/pluginloader-integration-test</integrationtest.folder>
Expand Down
2 changes: 1 addition & 1 deletion commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>referencevalidator</artifactId>
<groupId>de.gematik.refv</groupId>
<version>2.4.1-SNAPSHOT</version>
<version>2.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
Copyright (c) 2022-2024 gematik GmbH
Licensed under the Apache License, Version 2.0 (the License);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package de.gematik.refv.commons.validation;

import ca.uhn.fhir.validation.IValidationContext;
import ca.uhn.fhir.validation.IValidatorModule;
import ca.uhn.fhir.validation.ResultSeverityEnum;
import ca.uhn.fhir.validation.SingleValidationMessage;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.utilities.Utilities;

import java.text.MessageFormat;

/**
* The module is a backport of fullUrl and ID match validation introduced by a <a href="https://github.com/hapifhir/org.hl7.fhir.core/commit/4c6a318749d164466d2bf31918a3969f239c4ca8">version of Java Core Validator</a>, which is later than the one used at the moment.
* However, the original implementation behaves incorrectly for fullUrls being URNs (cf. BundleValidationModuleTests.validateResourceWithValidUrnFullUrlAndId).
* Once the original implementation is fixed, this module can be completely removed.
*/
class BundleValidationModule implements IValidatorModule {

private static final String FULLURL_AND_ID_MISMATCH_CODE = "BUNDLE_ENTRY_URL_MATCHES_TYPE_ID";
private static final String MESSAGE_TEMPLATE = "The fullUrl ''{0}'' looks like a RESTful server URL, so it must end with the correct type and id (/{1}/{2})";

@Override
public void validateResource(IValidationContext<IBaseResource> iValidationContext) {
var resource = iValidationContext.getResource();
if(!(resource instanceof Bundle))
return;

var bundle = (Bundle)resource;
var i = 0;
for(var entry: bundle.getEntry()) {
String fullUrl = entry.getFullUrl();
String resourceType = entry.getResource().fhirType();
String id = entry.getResource().getIdPart();

if(StringUtils.isBlank(fullUrl) || StringUtils.isBlank(id) || !Utilities.isURL(fullUrl))
continue;

if(!fullUrl.endsWith("/"+ resourceType + "/" + id)) {
SingleValidationMessage message = new SingleValidationMessage();
message.setSeverity(ResultSeverityEnum.WARNING);
message.setMessage(MessageFormat.format(MESSAGE_TEMPLATE, fullUrl, resourceType, id));
message.setMessageId(FULLURL_AND_ID_MISMATCH_CODE);
message.setLocationString(MessageFormat.format("Bundle.entry[{0}]", i));
iValidationContext.addValidationMessage(message);
}

i++;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ private FhirValidator createHapiFhirValidator(ValidationModuleConfiguration conf
hapiValidatorModule.setAnyExtensionsAllowed(configuration.isAnyExtensionsAllowed());
FhirValidator fhirValidator = fhirContext.newValidator();
fhirValidator.registerValidatorModule(hapiValidatorModule);
fhirValidator.registerValidatorModule(new BundleValidationModule());
return fhirValidator;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
Copyright (c) 2022-2024 gematik GmbH
Licensed under the Apache License, Version 2.0 (the License);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an 'AS IS' BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package de.gematik.refv.commons.validation;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.validation.IValidationContext;
import ca.uhn.fhir.validation.ResultSeverityEnum;
import ca.uhn.fhir.validation.ValidationContext;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Patient;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

class BundleValidationModuleTests {


@CsvSource({
"http://example.com/Patient/123,123",
"urn:test:blabla,123", // Non-URL fullUrl
"Patient/456,123", // relative fullUrl
",123", // empty fullUrl
"http://example.com/Patient/123,", // empty id
})
@ParameterizedTest
void validateResourceWithValidFullUrlAndId(String fullUrl, String id) {
Bundle bundle = new Bundle();
Bundle.BundleEntryComponent entry = new Bundle.BundleEntryComponent();
entry.setFullUrl(fullUrl);
entry.setResource(new Patient().setId(id));
bundle.addEntry(entry);

IValidationContext<IBaseResource> context = createValidationContext(bundle);
new BundleValidationModule().validateResource(context);

assertTrue(context.toResult().getMessages().isEmpty(), "No validation messages should be present for valid fullUrl and id: " + context.toResult().toString());
}

@Test
void validateResourceWithFullUrlNotEndingWithId() {
Bundle bundle = new Bundle();
Bundle.BundleEntryComponent entry = new Bundle.BundleEntryComponent();
entry.setFullUrl("http://example.com/Patient/456");
entry.setResource(new Patient().setId("123"));
bundle.addEntry(entry);

IValidationContext<IBaseResource> context = createValidationContext(bundle);
new BundleValidationModule().validateResource(context);

assertEquals(1, context.toResult().getMessages().size(), "One validation message should be present for fullUrl not ending with id");
assertEquals(ResultSeverityEnum.WARNING, context.toResult().getMessages().get(0).getSeverity(), "Validation message should be a warning");
}

@Test
void validateResourceWithNonBundleResource() {
Patient patient = new Patient();
IValidationContext<IBaseResource> context = createValidationContext(patient);
new BundleValidationModule().validateResource(context);

assertTrue(context.toResult().getMessages().isEmpty(), "No validation messages should be present for non-bundle resource");
}

private IValidationContext<IBaseResource> createValidationContext(IBaseResource resource) {
return ValidationContext.forResource(FhirContext.forR4Cached(), resource, null);
}
}
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>referencevalidator</artifactId>
<groupId>de.gematik.refv</groupId>
<version>2.4.1-SNAPSHOT</version>
<version>2.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
24 changes: 12 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<groupId>de.gematik.refv</groupId>
<artifactId>referencevalidator</artifactId>
<packaging>pom</packaging>
<version>2.4.1-SNAPSHOT</version>
<version>2.5.0</version>
<name>gematik Referenzvalidator</name>
<description>Der Referenzvalidator ermöglicht eine erweiterte Validierung von FHIR-Ressourcen, die in den Anwendungen der Telematikinfrastruktur (TI) verwendet werden. Der Referenzvalidator liefert autoritative Antworten zur Validität von übertragenen Datensätzen und ist somit eine Referenz für eventuell sonst im Rahmen einer TI-Anwendung eingesetzte FHIR-Validatoren.</description>
<url>https://github.com/gematik/app-referencevalidator</url>
Expand Down Expand Up @@ -71,28 +71,28 @@
<maven.compiler.release>11</maven.compiler.release>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<version.surefire>3.3.0</version.surefire>
<version.surefire>3.3.1</version.surefire>
<version.compiler>3.13.0</version.compiler>
<version.hapi-fhir-validation>6.6.2</version.hapi-fhir-validation>
<version.lombok>1.18.34</version.lombok>
<version.log4j2>2.23.1</version.log4j2>
<version.slf4j-api>2.0.13</version.slf4j-api>
<version.slf4j-api>2.0.16</version.slf4j-api>
<version.slf4j-log4j>2.0.13</version.slf4j-log4j>
<version.junit-jupiter-api>5.10.3</version.junit-jupiter-api>
<version.jackson>2.17.1</version.jackson>
<version.jackson>2.17.2</version.jackson>
<version.woodstox>7.0.0</version.woodstox>
<version.site>3.12.1</version.site>
<version.maven-release>3.1.0</version.maven-release>
<version.maven-release>3.1.1</version.maven-release>
<version.jar>3.4.2</version.jar>
<version.build.helper>3.6.0</version.build.helper>
<version.maven-source-plugin>3.3.1</version.maven-source-plugin>
<version.maven-javadoc-plugin>3.7.0</version.maven-javadoc-plugin>
<version.maven-javadoc-plugin>3.8.0</version.maven-javadoc-plugin>
<version.maven-assembly-plugin>3.7.1</version.maven-assembly-plugin>
<version.buildnumber>3.2.0</version.buildnumber>
<version.picocli>4.7.6</version.picocli>
<version.mockito>5.12.0</version.mockito>
<version.jacoco>0.8.12</version.jacoco>
<version.maven-failsafe-plugin>3.3.0</version.maven-failsafe-plugin>
<version.maven-failsafe-plugin>3.3.1</version.maven-failsafe-plugin>
<version.maven-enforcer-plugin>3.5.0</version.maven-enforcer-plugin>

<sonar.coverage.jacoco.xmlReportPaths>**/site/jacoco-it/jacoco.xml,**/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
Expand All @@ -101,18 +101,18 @@
</sonar.junit.reportPaths>
<version.nexus-staging-maven-plugin>1.7.0</version.nexus-staging-maven-plugin>
<version.maven-gpg-plugin>3.2.4</version.maven-gpg-plugin>
<assertj-core.version>3.26.0</assertj-core.version>
<assertj-core.version>3.26.3</assertj-core.version>
<version.snapshot-generator>0.4.0</version.snapshot-generator>
<spotless-maven-plugin.version>2.43.0</spotless-maven-plugin.version>
<version.maven-resources>3.3.1</version.maven-resources>
<commons-compress.version>1.26.2</commons-compress.version>
<guava.version>33.2.1-jre</guava.version>
<thymeleaf.version>3.1.2.RELEASE</thymeleaf.version>
<checker-qual.version>3.45.0</checker-qual.version>
<commons-codec.version>1.17.0</commons-codec.version>
<error_prone_annotations.version>2.28.0</error_prone_annotations.version>
<checker-qual.version>3.46.0</checker-qual.version>
<commons-codec.version>1.17.1</commons-codec.version>
<error_prone_annotations.version>2.29.2</error_prone_annotations.version>
<commons-io.version>2.16.1</commons-io.version>
<commons-lang3.version>3.14.0</commons-lang3.version>
<commons-lang3.version>3.15.0</commons-lang3.version>
</properties>


Expand Down
2 changes: 1 addition & 1 deletion snapshot-generator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>de.gematik.refv</groupId>
<artifactId>referencevalidator</artifactId>
<version>2.4.1-SNAPSHOT</version>
<version>2.5.0</version>
</parent>

<artifactId>snapshot-generator</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion valmodule-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>referencevalidator</artifactId>
<groupId>de.gematik.refv</groupId>
<version>2.4.1-SNAPSHOT</version>
<version>2.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion valmodule-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>de.gematik.refv</groupId>
<artifactId>referencevalidator</artifactId>
<version>2.4.1-SNAPSHOT</version>
<version>2.5.0</version>
</parent>

<groupId>de.gematik.refv.valmodule</groupId>
Expand Down
2 changes: 1 addition & 1 deletion valmodule-eau/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>referencevalidator</artifactId>
<groupId>de.gematik.refv</groupId>
<version>2.4.1-SNAPSHOT</version>
<version>2.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion valmodule-erp-perf-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>de.gematik.refv</groupId>
<artifactId>referencevalidator</artifactId>
<version>2.4.1-SNAPSHOT</version>
<version>2.5.0</version>
</parent>

<groupId>de.gematik.fhir</groupId>
Expand Down
2 changes: 1 addition & 1 deletion valmodule-erp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>referencevalidator</artifactId>
<groupId>de.gematik.refv</groupId>
<version>2.4.1-SNAPSHOT</version>
<version>2.5.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Loading

0 comments on commit d276b02

Please sign in to comment.