updated to match 5.0.0

This commit is contained in:
Ken Stevens
2020-04-27 12:49:15 -04:00
parent 7b5e0ae903
commit 4f8d34cbb4
7 changed files with 105 additions and 25 deletions

View File

@@ -1,6 +1,7 @@
package ca.uhn.fhir.jpa.starter;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.jpa.subscription.match.config.WebsocketDispatcherConfig;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
public class ApplicationContext extends AnnotationConfigWebApplicationContext {
@@ -20,7 +21,7 @@ public class ApplicationContext extends AnnotationConfigWebApplicationContext {
}
if (HapiProperties.getSubscriptionWebsocketEnabled()) {
register(ca.uhn.fhir.jpa.config.WebsocketDispatcherConfig.class);
register(WebsocketDispatcherConfig.class);
}
}

View File

@@ -0,0 +1,27 @@
package ca.uhn.fhir.jpa.starter;
import ca.uhn.fhir.empi.api.IEmpiSettings;
import ca.uhn.fhir.empi.rules.config.EmpiSettingsImpl;
import ca.uhn.fhir.jpa.empi.config.EmpiConsumerConfig;
import ca.uhn.fhir.jpa.empi.config.EmpiSubmitterConfig;
import com.google.common.base.Charsets;
import org.apache.commons.io.IOUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
import java.io.IOException;
@Configuration
@Import({EmpiSubmitterConfig.class, EmpiConsumerConfig.class})
public class EmpiConfig {
@Bean
IEmpiSettings empiProperties() throws IOException {
DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
Resource resource = resourceLoader.getResource("empi-rules.json");
String json = IOUtils.toString(resource.getInputStream(), Charsets.UTF_8);
return new EmpiSettingsImpl().setEnabled(HapiProperties.getEmpiEnabled()).setScriptText(json);
}
}

View File

@@ -1,17 +1,18 @@
package ca.uhn.fhir.jpa.starter;
import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.binstore.DatabaseBlobBinaryStorageSvcImpl;
import ca.uhn.fhir.jpa.binstore.IBinaryStorageSvc;
import ca.uhn.fhir.jpa.dao.DaoConfig;
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
import ca.uhn.fhir.jpa.subscription.module.channel.SubscriptionDeliveryHandlerFactory;
import ca.uhn.fhir.jpa.subscription.module.subscriber.email.IEmailSender;
import ca.uhn.fhir.jpa.subscription.module.subscriber.email.JavaMailEmailSender;
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionDeliveryHandlerFactory;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender;
import ca.uhn.fhir.jpa.subscription.match.deliver.email.JavaMailEmailSender;
import org.apache.commons.dbcp2.BasicDataSource;
import org.hl7.fhir.dstu2.model.Subscription;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.Lazy;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.thymeleaf.util.Validate;
@@ -23,7 +24,8 @@ import java.sql.Driver;
* This is the primary configuration file for the example server
*/
@Configuration
@EnableTransactionManagement()
@EnableTransactionManagement
@Import(EmpiConfig.class)
public class FhirServerConfigCommon {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirServerConfigCommon.class);
@@ -191,7 +193,7 @@ public class FhirServerConfigCommon {
retVal.setSmtpServerPort(this.emailPort);
retVal.setSmtpServerUsername(this.emailUsername);
retVal.setSmtpServerPassword(this.emailPassword);
// TODO KHS add these when HAPI 4.2.0 is released
// FIXME KHS add these once this has merged in hapi
// retVal.setAuth(this.emailAuth);
// retVal.setStartTlsEnable(this.emailStartTlsEnable);
// retVal.setStartTlsRequired(this.emailStartTlsRequired);

View File

@@ -57,6 +57,7 @@ public class HapiProperties {
static final String SUBSCRIPTION_EMAIL_ENABLED = "subscription.email.enabled";
static final String SUBSCRIPTION_RESTHOOK_ENABLED = "subscription.resthook.enabled";
static final String SUBSCRIPTION_WEBSOCKET_ENABLED = "subscription.websocket.enabled";
static final String EMPI_ENABLED = "empi.enabled";
static final String ALLOWED_BUNDLE_TYPES = "allowed_bundle_types";
static final String TEST_PORT = "test.port";
static final String TESTER_CONFIG_REFUSE_TO_FETCH_THIRD_PARTY_URLS = "tester.config.refuse_to_fetch_third_party_urls";
@@ -373,6 +374,10 @@ public class HapiProperties {
return HapiProperties.getBooleanProperty(SUBSCRIPTION_WEBSOCKET_ENABLED, false);
}
public static Boolean getEmpiEnabled() {
return HapiProperties.getBooleanProperty(EMPI_ENABLED, false);
}
public static Boolean getAllowContainsSearches() {
return HapiProperties.getBooleanProperty(ALLOW_CONTAINS_SEARCHES, true);
}

View File

@@ -4,11 +4,11 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.interceptor.api.IInterceptorBroadcaster;
import ca.uhn.fhir.interceptor.api.IInterceptorService;
import ca.uhn.fhir.jpa.api.config.DaoConfig;
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.binstore.BinaryStorageInterceptor;
import ca.uhn.fhir.jpa.bulk.BulkDataExportProvider;
import ca.uhn.fhir.jpa.dao.DaoConfig;
import ca.uhn.fhir.jpa.dao.DaoRegistry;
import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.interceptor.CascadingDeleteInterceptor;
import ca.uhn.fhir.jpa.provider.GraphQLProvider;
import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu2;
@@ -22,9 +22,9 @@ import ca.uhn.fhir.jpa.provider.r4.JpaSystemProviderR4;
import ca.uhn.fhir.jpa.provider.r5.JpaConformanceProviderR5;
import ca.uhn.fhir.jpa.provider.r5.JpaSystemProviderR5;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.subscription.SubscriptionInterceptorLoader;
import ca.uhn.fhir.jpa.subscription.module.interceptor.SubscriptionDebugLogInterceptor;
import ca.uhn.fhir.jpa.util.ResourceProviderFactory;
import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.jpa.subscription.submit.interceptor.SubscriptionSubmitInterceptorLoader;
import ca.uhn.fhir.jpa.subscription.util.SubscriptionDebugLogInterceptor;
import ca.uhn.fhir.model.dstu2.composite.MetaDt;
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
import ca.uhn.fhir.rest.server.HardcodedServerAddressStrategy;
@@ -34,6 +34,7 @@ import ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor;
import ca.uhn.fhir.rest.server.interceptor.ResponseValidatingInterceptor;
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
import ca.uhn.fhir.validation.IValidatorModule;
import ca.uhn.fhir.validation.ResultSeverityEnum;
import java.util.HashSet;
@@ -123,21 +124,21 @@ public class JpaRestfulServer extends RestfulServer {
IFhirSystemDao<Bundle, Meta> systemDao = appCtx
.getBean("mySystemDaoDstu3", IFhirSystemDao.class);
JpaConformanceProviderDstu3 confProvider = new JpaConformanceProviderDstu3(this, systemDao,
appCtx.getBean(DaoConfig.class));
appCtx.getBean(DaoConfig.class), appCtx.getBean(ISearchParamRegistry.class));
confProvider.setImplementationDescription("HAPI FHIR DSTU3 Server");
setServerConformanceProvider(confProvider);
} else if (fhirVersion == FhirVersionEnum.R4) {
IFhirSystemDao<org.hl7.fhir.r4.model.Bundle, org.hl7.fhir.r4.model.Meta> systemDao = appCtx
.getBean("mySystemDaoR4", IFhirSystemDao.class);
JpaConformanceProviderR4 confProvider = new JpaConformanceProviderR4(this, systemDao,
appCtx.getBean(DaoConfig.class));
appCtx.getBean(DaoConfig.class), appCtx.getBean(ISearchParamRegistry.class));
confProvider.setImplementationDescription("HAPI FHIR R4 Server");
setServerConformanceProvider(confProvider);
} else if (fhirVersion == FhirVersionEnum.R5) {
IFhirSystemDao<org.hl7.fhir.r5.model.Bundle, org.hl7.fhir.r5.model.Meta> systemDao = appCtx
.getBean("mySystemDaoR5", IFhirSystemDao.class);
JpaConformanceProviderR5 confProvider = new JpaConformanceProviderR5(this, systemDao,
appCtx.getBean(DaoConfig.class));
appCtx.getBean(DaoConfig.class), appCtx.getBean(ISearchParamRegistry.class));
confProvider.setImplementationDescription("HAPI FHIR R5 Server");
setServerConformanceProvider(confProvider);
} else {
@@ -259,9 +260,10 @@ public class JpaRestfulServer extends RestfulServer {
HapiProperties.getSubscriptionRestHookEnabled()) {
// Loads subscription interceptors (SubscriptionActivatingInterceptor, SubscriptionMatcherInterceptor)
// with activation of scheduled subscription
SubscriptionInterceptorLoader subscriptionInterceptorLoader = appCtx
.getBean(SubscriptionInterceptorLoader.class);
subscriptionInterceptorLoader.registerInterceptors();
SubscriptionSubmitInterceptorLoader subscriptionInterceptorLoader = appCtx
.getBean(SubscriptionSubmitInterceptorLoader.class);
subscriptionInterceptorLoader.start();
// Subscription debug logging
IInterceptorService interceptorService = appCtx.getBean(IInterceptorService.class);
@@ -272,7 +274,7 @@ public class JpaRestfulServer extends RestfulServer {
DaoRegistry daoRegistry = appCtx.getBean(DaoRegistry.class);
IInterceptorBroadcaster interceptorBroadcaster = appCtx.getBean(IInterceptorBroadcaster.class);
if (HapiProperties.getAllowCascadingDeletes()) {
CascadingDeleteInterceptor cascadingDeleteInterceptor = new CascadingDeleteInterceptor(
CascadingDeleteInterceptor cascadingDeleteInterceptor = new CascadingDeleteInterceptor(getFhirContext(),
daoRegistry, interceptorBroadcaster);
getInterceptorService().registerInterceptor(cascadingDeleteInterceptor);
}
@@ -345,6 +347,11 @@ public class JpaRestfulServer extends RestfulServer {
registerProvider(appCtx.getBean(BulkDataExportProvider.class));
}
if (HapiProperties.getEmpiEnabled()) {
// FIXME KHS
}
}
}

View File

@@ -0,0 +1,32 @@
{
"resourceSearchParams" : [ {
"resourceType" : "Patient",
"searchParam" : "birthdate"
}, {
"resourceType" : "All",
"searchParam" : "identifier"
} ],
"filterSearchParams" : [ {
"resourceType" : "All",
"searchParam" : "active",
"fixedValue" : "true"
} ],
"matchFields" : [ {
"name" : "given-name",
"resourceType" : "All",
"resourcePath" : "name.given",
"metric" : "COSINE",
"matchThreshold" : 0.8
}, {
"name" : "last-name",
"resourceType" : "All",
"resourcePath" : "name.family",
"metric" : "JARO_WINKLER",
"matchThreshold" : 0.8
}],
"weightMap" : {
"given-name" : "POSSIBLE_MATCH",
"given-name,last-name" : "MATCH"
},
"eidSystem": "http://company.io/fhir/NamingSystem/custom-eid-system"
}