Skip to content

Commit

Permalink
Release 0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Gematik-Entwicklung committed Jul 14, 2023
1 parent e93b067 commit 43ebf6c
Show file tree
Hide file tree
Showing 47 changed files with 1,155 additions and 75 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ Die Validierungseinstellungen auch angepasst werden:
options.setProfileValidityPeriodCheckStrategy(ProfileValidityPeriodCheckStrategy.IGNORE);
options.setProfiles(List.of("https://fhir.kbv.de/StructureDefinition/KBV_PR_ERP_Bundle|1.0.1"));
options.setAcceptedEncodings(List.of("xml", "json"));
ValidationResult result = erpModule.validateFile("c:/temp/KBV_PR_ERP_Bundle.xml");
ValidationResult result = erpModule.validateFile("c:/temp/KBV_PR_ERP_Bundle.xml", options);
System.out.println(result.isValid());
System.out.println(result.getValidationMessages());
```
Die Anpassung der Validierungseinstellungen soll allerdings nur für Testzwecke erfolgen, da damit die Bewertung der eingegebenen Instanz gegenüber Standardeinstellungen verfälscht wird.

Expand Down
14 changes: 14 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

# Release Notes Gematik Referenzvalidator

## Release 0.7.1

### added
- kbv.ita.eau 1.1.1 integrated
- de.gematik.erezept-workflow.r4 1.2.2 integrated
- de.abda.erezeptabgabedatenbasis 1.2.1 integrated

### changed
- corrections in ERP and EAU FHIR-Package dependencies
- resources with profiles from kbv.ita.erp#1.0.2 can now be validated if embedded into GEM_ERP_PR_MedicationDispense 1.2-resources
- fixed Java example in README.md for usage of ValidationOptions
- performance optimizations
- no INFO or WARNINGS if not in verbose mode

## Release 0.7.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>0.7.0</version>
<version>0.7.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private boolean isDetailsShouldBePrinted(ValidationResult results) {
if(isAtLeastOneErrorInMessages(results))
return true;

return !isOnlyErrorsInOutput;
return isVerbose;
}

private static boolean isAtLeastOneErrorInMessages(ValidationResult results) {
Expand Down
1 change: 1 addition & 0 deletions cli/src/main/resources/log4j.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=WARN, A1
log4j.logger.ca.uhn.fhir.parser = ERROR
log4j.logger.de.gematik.refv = INFO

# A1 is set to be a ConsoleAppender.
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>0.7.0</version>
<version>0.7.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import java.util.List;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;

@Slf4j
Expand All @@ -50,13 +51,14 @@ public class GenericValidator {
private final HapiFhirValidatorFactory hapiFhirValidatorFactory;

private final SeverityLevelTransformer severityLevelTransformator;

private final ConcurrentHashMap<DependencyList, FhirValidator> hapiFhirValidatorCache;

public GenericValidator(FhirContext context) {
this.fhirContext = context;
this.referencedProfileLocator = new ReferencedProfileLocator();
this.hapiFhirValidatorFactory = new HapiFhirValidatorFactory(fhirContext);
this.severityLevelTransformator = new SeverityLevelTransformer();
this.hapiFhirValidatorCache = new ConcurrentHashMap<>();
}

public ValidationResult validate(
Expand Down Expand Up @@ -174,11 +176,12 @@ private void addWarningAboutDeactivatedValidityPeriodCheckTo(ValidationResult re
private ValidationResult validateUsingDependencyList(String resourceBody, ValidationModuleConfiguration configuration, DependencyList dependencyList, Profile profileInResource, String userDefinedProfile) {
log.debug("Applying dependency list: {}", dependencyList);

FhirValidator fhirValidator = hapiFhirValidatorFactory.createInstance(
var fhirValidator = hapiFhirValidatorCache.computeIfAbsent(dependencyList, k ->
hapiFhirValidatorFactory.createInstance(
dependencyList.getPackages(),
dependencyList.getPatches(),
configuration
);
));

var options = new ca.uhn.fhir.validation.ValidationOptions();
if(userDefinedProfile != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
package de.gematik.refv.commons.validation;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.IValidationSupport;
import ca.uhn.fhir.util.ClasspathUtil;
import ca.uhn.fhir.validation.FhirValidator;
import de.gematik.refv.commons.configuration.ValidationModuleConfiguration;
import de.gematik.refv.commons.validation.support.IgnoreCodeSystemValidationSupport;
import de.gematik.refv.commons.validation.support.IgnoreValueSetValidationSupport;
import de.gematik.refv.commons.validation.support.PipedCanonicalCoreResourcesValidationSupport;
import lombok.SneakyThrows;
import org.hl7.fhir.common.hapi.validation.support.CachingValidationSupport;
import org.hl7.fhir.common.hapi.validation.support.PrePopulatedValidationSupport;
import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain;
import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator;
Expand Down Expand Up @@ -68,18 +68,17 @@ public FhirValidator createInstance(
patchesPrePopulatedValidationSupport.addResource(newResource);
}

IValidationSupport validationSupport = fhirContext.getValidationSupport();

var validationSupport = fhirContext.getValidationSupport();
var validationSupportChain = new ValidationSupportChain(
new IgnoreCodeSystemValidationSupport(fhirContext, codeSystemsToIgnore),
new IgnoreValueSetValidationSupport(fhirContext, valueSetsToIgnore),
validationSupport,
new CachingValidationSupport(new IgnoreCodeSystemValidationSupport(fhirContext, codeSystemsToIgnore)),
new CachingValidationSupport(new IgnoreValueSetValidationSupport(fhirContext, valueSetsToIgnore)),
new CachingValidationSupport(validationSupport),
new PipedCanonicalCoreResourcesValidationSupport(fhirContext),
patchesPrePopulatedValidationSupport
);

for (String packagePath : packageFilenames) {
PrePopulatedValidationSupport prePopulatedValidationSupport = packageCache.addOrGet(packagePath);
var prePopulatedValidationSupport = packageCache.addOrGet(packagePath);
validationSupportChain.addValidationSupport(prePopulatedValidationSupport);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
package de.gematik.refv.commons.validation;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.support.IValidationSupport;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.hl7.fhir.common.hapi.validation.support.NpmPackageValidationSupport;
import org.hl7.fhir.common.hapi.validation.support.PrePopulatedValidationSupport;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
Expand All @@ -29,19 +29,19 @@
public class PackageCache {
private FhirContext fhirContext;

private Map<String, PrePopulatedValidationSupport> packages = new ConcurrentHashMap<>();
private Map<String, IValidationSupport> packages = new ConcurrentHashMap<>();

public PackageCache(FhirContext fhirContext) {
this.fhirContext = fhirContext;
}


public PrePopulatedValidationSupport addOrGet(String packagePath) {
public IValidationSupport addOrGet(String packagePath) {
return packages.computeIfAbsent(packagePath, path -> createPrePopulatedSupportFromPackage(packagePath));
}

@SneakyThrows
private PrePopulatedValidationSupport createPrePopulatedSupportFromPackage(String packagePath) {
private IValidationSupport createPrePopulatedSupportFromPackage(String packagePath) {
log.info("Loading package " + packagePath + "...");
NpmPackageValidationSupport validationSupport = new NpmPackageValidationSupport(fhirContext);
validationSupport.loadPackageFromClasspath("package/" + packagePath);
Expand Down
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>0.7.0</version>
<version>0.7.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ void setOptions() {
options.setProfileValidityPeriodCheckStrategy(ProfileValidityPeriodCheckStrategy.IGNORE);
options.setProfiles(List.of("https://fhir.kbv.de/StructureDefinition/KBV_PR_ERP_Bundle|1.0.1"));
options.setAcceptedEncodings(List.of("xml", "json"));
ValidationResult result = erpModule.validateFile("c:/temp/KBV_PR_ERP_Bundle.xml");
ValidationResult result = erpModule.validateFile("c:/temp/KBV_PR_ERP_Bundle.xml", options);
System.out.println(result.isValid());
System.out.println(result.getValidationMessages());
}
}
4 changes: 3 additions & 1 deletion docs/concept/concept.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ E-Rezept: Nutzung- und Stakeholderanforderungen an den Referenzvalidator
class="external-link"
href="https://github.com/gematik/api-erp/blob/master/docs/erp_fhirversion.adoc" rel="nofollow" target="_blank">Profil-Roadmap</a>). Insbesondere sollen die im Kontext von E-Rezept eingesetzten <a href="https://applications.kbv.de/overview.xhtml" target="_blank">Schlüsseltabellen der KBV</a> sowie deren Gültigkeitszeiträume und Release-Zyklen berücksichtigt werden.
</p>
<p>1.2.2. Das E-Rezept muss als Ergebnis eine Valid / Invalid-Antwort und als Ergänzung weitere eventuell erkannte Konformitätsprobleme ausgeben können.</p>
<p>Die Auswahl der FHIR-Packages, die zur Validierung hinzugezogen werden müssen, richtet sich nach den von der jeweiligen Standardisierungsorganisation festgelegten Abhängigkeiten des FHIR-Packages, das für das jeweilige Profil verbindlich ist. Abweichend davon und falls verfügbar müssen FHIR-Packages der Abhängigkeiten mit der höchsten Patch-Versionnummer eingesetzt werden (auch rückwirkend). Als Zeitpunkt zur Auswahl der geltenden Terminologien dienen die <a href="#creation-date-elements">Erstellungszeitpunktangaben</a> aus den zu validierenden Ressourcen.
<p>1.2.2. Das E-Rezept muss als Ergebnis eine Valid / Invalid-Antwort und, falls Invalid, als Ergänzung weitere eventuell erkannte Konformitätsprobleme ausgeben können. </p>
<p>1.2.3. Um die Valid / Invalid-Antwort zu produzieren, muss der Referenzvalidator die <a href="#validation-configuration">Validierung-Konfiguration</a> und <a href="#result-interpretation">Interpretationsregeln</a> anwenden. </p>
<p>1.2.4. Der Referenzvalidator kann als Startparameter eine unterstützte Profil-URL akzeptieren, um die Konformität der eingegebenen Instanz zu dem zugrundeliegenden Profil zu überprüfen.</p>
<p>1.3.1. Der Referenzvalidator
Expand Down Expand Up @@ -381,6 +382,7 @@ Referenzvalidator: Infrastrukturelle Anforderungen
</ol>
</li>
<li>1.1.3. Der Referenzvalidator muss die Release-Version, unterstützten Module, Profile, Profilversionen, Gültigkeitszeiträume, FHIR-Paket-Abhängigkeiten als Information ausgeben können</li>
<li>1.1.4. Mittels eines Startparameters muss der Referenzvalidator interne Protokolle und sämtliche Validierungsmeldungen unabhängig vom Validierungsergebnis ausgeben können.</li>
</ul>
<p><br></p></div>
</td>
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<groupId>de.gematik.refv</groupId>
<artifactId>referencevalidator</artifactId>
<packaging>pom</packaging>
<version>0.7.0</version>
<version>0.7.1</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 @@ -80,7 +80,7 @@
<version.log4j2>2.20.0</version.log4j2>
<version.slf4j-api>2.0.7</version.slf4j-api>
<version.slf4j-log4j>2.0.7</version.slf4j-log4j>
<version.junit-jupiter-api>5.9.2</version.junit-jupiter-api>
<version.junit-jupiter-api>5.9.3</version.junit-jupiter-api>
<version.jackson-data-format>2.15.2</version.jackson-data-format>
<version.woodstox>6.5.0</version.woodstox>
<version.site>3.12.1</version.site>
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>0.7.0</version>
<version>0.7.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion valmodule-diga/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>0.7.0</version>
<version>0.7.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

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>0.7.0</version>
<version>0.7.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
8 changes: 3 additions & 5 deletions valmodule-eau/src/main/resources/eau-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,17 @@ dependencyLists:
- "de.basisprofil.r4-0.9.13/Extension-seitenlokalisation.json"
packages:
- "kbv.ita.eau-1.0.2.tgz"
- "gematik.kbv.sfhir.cs.vs-1.2.0.tgz"
- "gematik.kbv.eau.sfhir.cs.vs-1.0.0.tgz"
- "kbv.ita.for-1.0.3.tgz"
- "kbv.basis-1.1.3.tgz"
- "de.basisprofil.r4-0.9.13.tgz"
validFrom: "2021-07-01"
validTill: "2023-06-30"

kbv.ita.eau.1.1.0:
patches:
- "de.basisprofil.r4-0.9.13/Extension-seitenlokalisation.json"
packages:
- "kbv.ita.eau-1.1.0.tgz"
- "gematik.kbv.sfhir.cs.vs-1.2.0.tgz"
- "kbv.ita.eau-1.1.1.tgz"
- "gematik.kbv.eau.sfhir.cs.vs-1.1.0.tgz"
- "kbv.ita.for-1.1.0.tgz"
- "kbv.basis-1.3.0.tgz"
- "de.basisprofil.r4-1.3.2.tgz"
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 43ebf6c

Please sign in to comment.