Hello,
We have a need to validate resources based on custom profiles. For that we load a lot of packages into PrePopulatedValidationSupport. That is a list what we are loading into PrePopulatedValidationSupport.
"de.gematik.isip/1.0.2",
"hl7.fhir.r4.core/4.0.1",
"de.basisprofil.r4/1.4.0",
"de.gematik.isik-basismodul-stufe1/1.0.10",
"de.gematik.isik-basismodul/2.0.5",
"de.gematik.isik-basismodul/3.0.4",
"de.medizininformatikinitiative.kerndatensatz.diagnose/2.0.0-alpha3",
"kbv.ita.eau/1.1.1",
"de.gematik.isik-terminplanung/2.0.4",
"kbv.basis/1.3.0",
"kbv.mio.ueberleitungsbogen/1.0.0"
Then we build next bean:
public ValidationSupportChain beanValidationSupportChain() {
return new ValidationSupportChain(
createPrePopulatedValidationSupport(),//with all packages
new DefaultProfileValidationSupport(fhirContextR4),
new InMemoryTerminologyServerValidationSupport(fhirContextR4),
new CommonCodeSystemsTerminologyService(fhirContextR4),
new SnapshotGeneratingValidationSupport(fhirContextR4)
);
}
and then we finally build our validator:
private final FhirValidator validator;
public PclFhirValidator(final FhirContext ctx, ValidationSupportChain validationSupportChain) {
CachingValidationSupport.CacheTimeouts cacheTimeouts = new CachingValidationSupport.CacheTimeouts()
.setLookupCodeMillis(10 * DateUtils.MILLIS_PER_MINUTE)
.setExpandValueSetMillis(DateUtils.MILLIS_PER_MINUTE)
.setTranslateCodeMillis(10 * DateUtils.MILLIS_PER_MINUTE)
.setValidateCodeMillis(60 * DateUtils.MILLIS_PER_MINUTE)
.setMiscMillis(10 * DateUtils.MILLIS_PER_MINUTE);
CachingValidationSupport validationSupport = new CachingValidationSupport(validationSupportChain, cacheTimeouts);
validator = ctx.newValidator();
FhirInstanceValidator instanceValidator = new FhirInstanceValidator(validationSupport);
validator.registerValidatorModule(instanceValidator);
}
Our validator with each new package become slower and slower.
Does someone know how we can speed up our validation? any tips or suggestions would be nice)