Adding support for '*' cornercase
This commit is contained in:
@@ -928,6 +928,7 @@ public class AppProperties {
|
|||||||
request_tenant_partitioning_mode = theRequest_tenant_partitioning_mode;
|
request_tenant_partitioning_mode = theRequest_tenant_partitioning_mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class RemoteSystem {
|
public static class RemoteSystem {
|
||||||
private String system;
|
private String system;
|
||||||
private String url;
|
private String url;
|
||||||
|
|||||||
@@ -30,20 +30,60 @@ public class FhirServerConfigR4 {
|
|||||||
|
|
||||||
@Bean(name = "myHybridRemoteValidationSupportChain")
|
@Bean(name = "myHybridRemoteValidationSupportChain")
|
||||||
@Conditional({OnR4Condition.class, OnRemoteTerminologyPresent.class})
|
@Conditional({OnR4Condition.class, OnRemoteTerminologyPresent.class})
|
||||||
public IValidationSupport addRemoteValidation(ValidationSupportChain theValidationSupport, FhirContext theFhirContext, AppProperties theAppProperties)
|
public IValidationSupport addRemoteValidation(
|
||||||
{
|
ValidationSupportChain theValidationSupport, FhirContext theFhirContext, AppProperties theAppProperties) {
|
||||||
theAppProperties.getRemoteTerminologyServicesMap().forEach((key, remoteSystem) -> {
|
var values = theAppProperties.getRemoteTerminologyServicesMap().values();
|
||||||
theValidationSupport.addValidationSupport(0 , new RemoteTerminologyServiceValidationSupport(theFhirContext, remoteSystem.getUrl()){
|
|
||||||
|
// If the remote terminology service is "*" and is the only one then forward all requests to the remote
|
||||||
|
// terminology service
|
||||||
|
if (values.size() == 1 && "*".equalsIgnoreCase(values.iterator().next().getSystem())) {
|
||||||
|
var remoteSystem = values.iterator().next();
|
||||||
|
theValidationSupport.addValidationSupport(
|
||||||
|
0, new RemoteTerminologyServiceValidationSupport(theFhirContext, remoteSystem.getUrl()) {
|
||||||
@Override
|
@Override
|
||||||
public CodeValidationResult validateCode(ValidationSupportContext theValidationSupportContext, ConceptValidationOptions theOptions, String theCodeSystem, String theCode, String theDisplay, String theValueSetUrl) {
|
public CodeValidationResult validateCode(
|
||||||
|
ValidationSupportContext theValidationSupportContext,
|
||||||
|
ConceptValidationOptions theOptions,
|
||||||
|
String theCodeSystem,
|
||||||
|
String theCode,
|
||||||
|
String theDisplay,
|
||||||
|
String theValueSetUrl) {
|
||||||
|
return super.validateCode(
|
||||||
|
theValidationSupportContext,
|
||||||
|
theOptions,
|
||||||
|
theCodeSystem,
|
||||||
|
theCode,
|
||||||
|
theDisplay,
|
||||||
|
theValueSetUrl);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return theValidationSupport;
|
||||||
|
|
||||||
|
// If there are multiple remote terminology services, then add each one to the validation chain
|
||||||
|
} else {
|
||||||
|
values.forEach((remoteSystem) -> theValidationSupport.addValidationSupport(
|
||||||
|
0, new RemoteTerminologyServiceValidationSupport(theFhirContext, remoteSystem.getUrl()) {
|
||||||
|
@Override
|
||||||
|
public CodeValidationResult validateCode(
|
||||||
|
ValidationSupportContext theValidationSupportContext,
|
||||||
|
ConceptValidationOptions theOptions,
|
||||||
|
String theCodeSystem,
|
||||||
|
String theCode,
|
||||||
|
String theDisplay,
|
||||||
|
String theValueSetUrl) {
|
||||||
if (remoteSystem.getSystem().equalsIgnoreCase(theCodeSystem)) {
|
if (remoteSystem.getSystem().equalsIgnoreCase(theCodeSystem)) {
|
||||||
return super.validateCode(theValidationSupportContext, theOptions, theCodeSystem, theCode, theDisplay, theValueSetUrl);
|
return super.validateCode(
|
||||||
|
theValidationSupportContext,
|
||||||
|
theOptions,
|
||||||
|
theCodeSystem,
|
||||||
|
theCode,
|
||||||
|
theDisplay,
|
||||||
|
theValueSetUrl);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
}));
|
||||||
});
|
}
|
||||||
|
|
||||||
return theValidationSupport;
|
return theValidationSupport;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -290,12 +290,15 @@ hapi:
|
|||||||
# retain_cached_searches_mins: 60
|
# retain_cached_searches_mins: 60
|
||||||
# reuse_cached_search_results_millis: 60000
|
# reuse_cached_search_results_millis: 60000
|
||||||
remote_terminology_service:
|
remote_terminology_service:
|
||||||
|
# all:
|
||||||
|
# system: '*'
|
||||||
|
# url: 'https://tx.fhir.org/r4/'
|
||||||
snomed:
|
snomed:
|
||||||
system: 'http://snomed.info/sct'
|
system: 'http://snomed.info/sct'
|
||||||
url: 'https://tx.fhir.org/r4/'
|
url: 'https://tx.fhir.org/r4/'
|
||||||
loinc:
|
loinc:
|
||||||
system: 'http://loinc.org'
|
system: 'http://loinc.org'
|
||||||
url: 'https://fhir.loinc.org/'
|
url: 'https://hapi.fhir.org/baseR4/'
|
||||||
tester:
|
tester:
|
||||||
home:
|
home:
|
||||||
name: Local Tester
|
name: Local Tester
|
||||||
|
|||||||
Reference in New Issue
Block a user