Merge 4821 back to master (#4825)
* Merge 4821 into master * Update to PRE3 snapshot
This commit is contained in:
parent
350d1a422c
commit
87e8a810cd
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
type: add
|
||||
issue: 4821
|
||||
title: "Update the clinical reasoning module version to the latest release of 3.0.0-PRE2"
|
|
@ -33,25 +33,20 @@ import ca.uhn.fhir.cr.common.HapiTerminologyProvider;
|
|||
import ca.uhn.fhir.cr.common.IDataProviderFactory;
|
||||
import ca.uhn.fhir.cr.common.IFhirDalFactory;
|
||||
import ca.uhn.fhir.cr.common.ILibraryLoaderFactory;
|
||||
import ca.uhn.fhir.cr.common.ILibraryManagerFactory;
|
||||
import ca.uhn.fhir.cr.common.ILibrarySourceProviderFactory;
|
||||
import ca.uhn.fhir.cr.common.ITerminologyProviderFactory;
|
||||
import ca.uhn.fhir.i18n.Msg;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoValueSet;
|
||||
import ca.uhn.fhir.jpa.cache.IResourceChangeListenerRegistry;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
|
||||
import org.cqframework.cql.cql2elm.CqlTranslatorOptions;
|
||||
import org.cqframework.cql.cql2elm.LibraryManager;
|
||||
import org.cqframework.cql.cql2elm.LibrarySourceProvider;
|
||||
import org.cqframework.cql.cql2elm.ModelManager;
|
||||
import org.cqframework.cql.cql2elm.model.Model;
|
||||
import org.cqframework.cql.cql2elm.quick.FhirLibrarySourceProvider;
|
||||
import org.hl7.cql.model.ModelIdentifier;
|
||||
import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.opencds.cqf.cql.engine.data.CompositeDataProvider;
|
||||
import org.opencds.cqf.cql.engine.fhir.model.Dstu3FhirModelResolver;
|
||||
import org.opencds.cqf.cql.engine.fhir.model.R4FhirModelResolver;
|
||||
|
@ -61,7 +56,6 @@ import org.opencds.cqf.cql.engine.runtime.Code;
|
|||
import org.opencds.cqf.cql.evaluator.CqlOptions;
|
||||
import org.opencds.cqf.cql.evaluator.builder.DataProviderComponents;
|
||||
import org.opencds.cqf.cql.evaluator.builder.EndpointInfo;
|
||||
import org.opencds.cqf.cql.evaluator.cql2elm.model.CacheAwareModelManager;
|
||||
import org.opencds.cqf.cql.evaluator.cql2elm.util.LibraryVersionSelector;
|
||||
import org.opencds.cqf.cql.evaluator.engine.execution.CacheAwareLibraryLoaderDecorator;
|
||||
import org.opencds.cqf.cql.evaluator.engine.execution.TranslatingLibraryLoader;
|
||||
|
@ -69,6 +63,7 @@ import org.opencds.cqf.cql.evaluator.engine.model.CachingModelResolverDecorator;
|
|||
import org.opencds.cqf.cql.evaluator.engine.retrieve.BundleRetrieveProvider;
|
||||
import org.opencds.cqf.cql.evaluator.fhir.Constants;
|
||||
import org.opencds.cqf.cql.evaluator.fhir.adapter.AdapterFactory;
|
||||
import org.opencds.cqf.cql.evaluator.library.EvaluationSettings;
|
||||
import org.opencds.cqf.cql.evaluator.measure.MeasureEvaluationOptions;
|
||||
import org.opencds.cqf.cql.evaluator.spring.fhir.adapter.AdapterConfiguration;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -87,13 +82,22 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
|
||||
@Import(AdapterConfiguration.class)
|
||||
|
||||
@Configuration
|
||||
public abstract class BaseClinicalReasoningConfig extends BaseRepositoryConfig {
|
||||
@Import({AdapterConfiguration.class, BaseRepositoryConfig.class})
|
||||
public abstract class BaseClinicalReasoningConfig {
|
||||
|
||||
private static final Logger ourLogger = LoggerFactory.getLogger(BaseClinicalReasoningConfig.class);
|
||||
|
||||
@Bean
|
||||
EvaluationSettings evaluationSettings(CqlOptions theCqlOptions, Map<ModelIdentifier, Model> theGlobalModelCache, Map<org.cqframework.cql.elm.execution.VersionedIdentifier, org.cqframework.cql.elm.execution.Library> theGlobalLibraryCache) {
|
||||
var evaluationSettings = new EvaluationSettings();
|
||||
evaluationSettings.setCqlOptions(theCqlOptions);
|
||||
evaluationSettings.setModelCache(theGlobalModelCache);
|
||||
evaluationSettings.setLibraryCache(theGlobalLibraryCache);
|
||||
|
||||
return evaluationSettings;
|
||||
}
|
||||
@Bean
|
||||
CrProviderFactory cqlProviderFactory() {
|
||||
return new CrProviderFactory();
|
||||
|
@ -153,7 +157,7 @@ public abstract class BaseClinicalReasoningConfig extends BaseRepositoryConfig {
|
|||
@Scope("prototype")
|
||||
public ModelManager modelManager(
|
||||
Map<ModelIdentifier, Model> theGlobalModelCache) {
|
||||
return new CacheAwareModelManager(theGlobalModelCache);
|
||||
return new ModelManager(theGlobalModelCache);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -229,15 +233,7 @@ public abstract class BaseClinicalReasoningConfig extends BaseRepositoryConfig {
|
|||
lcp.add(new FhirLibrarySourceProvider());
|
||||
}
|
||||
|
||||
return new CacheAwareLibraryLoaderDecorator(
|
||||
new TranslatingLibraryLoader(theModelManager, lcp, theCqlTranslatorOptions, null), theGlobalLibraryCache) {
|
||||
// TODO: This is due to a bug with the ELM annotations which prevent options
|
||||
// from matching the way they should
|
||||
@Override
|
||||
protected Boolean translatorOptionsMatch(org.cqframework.cql.elm.execution.Library library) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
return new TranslatingLibraryLoader(theModelManager, lcp, theCqlTranslatorOptions, theGlobalLibraryCache);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -296,7 +292,7 @@ public abstract class BaseClinicalReasoningConfig extends BaseRepositoryConfig {
|
|||
return new LibraryVersionSelector(theAdapterFactory);
|
||||
}
|
||||
|
||||
@Bean(name = "cqlExecutor")
|
||||
@Bean
|
||||
public Executor cqlExecutor() {
|
||||
CqlForkJoinWorkerThreadFactory factory = new CqlForkJoinWorkerThreadFactory();
|
||||
ForkJoinPool myCommonPool = new ForkJoinPool(Math.min(32767, Runtime.getRuntime().availableProcessors()),
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.springframework.context.annotation.Bean;
|
|||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
@Import(AdapterConfiguration.class)
|
||||
@Configuration
|
||||
public abstract class BaseRepositoryConfig {
|
||||
@Bean
|
||||
|
|
|
@ -25,12 +25,14 @@ import ca.uhn.fhir.rest.api.server.RequestDetails;
|
|||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
@Configuration
|
||||
public class CrDstu3Config extends BaseClinicalReasoningConfig {
|
||||
@Import(BaseClinicalReasoningConfig.class)
|
||||
public class CrDstu3Config {
|
||||
|
||||
@Bean
|
||||
public Function<RequestDetails, MeasureService> dstu3MeasureServiceFactory(ApplicationContext theApplicationContext) {
|
||||
|
|
|
@ -31,12 +31,15 @@ import ca.uhn.fhir.rest.api.server.RequestDetails;
|
|||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Configuration
|
||||
public class CrR4Config extends BaseClinicalReasoningConfig {
|
||||
@Import(BaseClinicalReasoningConfig.class)
|
||||
public class CrR4Config {
|
||||
|
||||
@Bean
|
||||
public Function<RequestDetails, MeasureService> r4MeasureServiceFactory(ApplicationContext theApplicationContext) {
|
||||
|
@ -61,10 +64,10 @@ public class CrR4Config extends BaseClinicalReasoningConfig {
|
|||
@Bean
|
||||
public Function<RequestDetails, CareGapsService> r4CareGapsServiceFactory(Function<RequestDetails, MeasureService> theR4MeasureServiceFactory,
|
||||
CrProperties theCrProperties,
|
||||
DaoRegistry theDaoRegistry) {
|
||||
DaoRegistry theDaoRegistry, Executor cqlExecutor) {
|
||||
return r -> {
|
||||
var ms = theR4MeasureServiceFactory.apply(r);
|
||||
var cs = new CareGapsService(theCrProperties, ms, theDaoRegistry, cqlExecutor(), r);
|
||||
var cs = new CareGapsService(theCrProperties, ms, theDaoRegistry, cqlExecutor, r);
|
||||
return cs;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,75 +1,16 @@
|
|||
package ca.uhn.fhir.cr.dstu3;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.support.IValidationSupport;
|
||||
import ca.uhn.fhir.cr.TestCrConfig;
|
||||
import ca.uhn.fhir.cr.common.CodeCacheResourceChangeListener;
|
||||
import ca.uhn.fhir.cr.common.CqlExceptionHandlingInterceptor;
|
||||
import ca.uhn.fhir.cr.common.CqlForkJoinWorkerThreadFactory;
|
||||
import ca.uhn.fhir.cr.common.ElmCacheResourceChangeListener;
|
||||
import ca.uhn.fhir.cr.common.HapiFhirDal;
|
||||
import ca.uhn.fhir.cr.common.HapiFhirRetrieveProvider;
|
||||
import ca.uhn.fhir.cr.common.HapiLibrarySourceProvider;
|
||||
import ca.uhn.fhir.cr.common.HapiTerminologyProvider;
|
||||
import ca.uhn.fhir.cr.common.IDataProviderFactory;
|
||||
import ca.uhn.fhir.cr.common.IFhirDalFactory;
|
||||
import ca.uhn.fhir.cr.common.ILibraryLoaderFactory;
|
||||
import ca.uhn.fhir.cr.common.ILibraryManagerFactory;
|
||||
import ca.uhn.fhir.cr.common.ILibrarySourceProviderFactory;
|
||||
import ca.uhn.fhir.cr.common.ITerminologyProviderFactory;
|
||||
import ca.uhn.fhir.cr.config.CrProperties;
|
||||
import ca.uhn.fhir.cr.config.CrProviderFactory;
|
||||
import ca.uhn.fhir.cr.config.CrProviderLoader;
|
||||
import ca.uhn.fhir.cr.config.PreExpandedValidationSupportLoader;
|
||||
import ca.uhn.fhir.cr.dstu3.measure.MeasureOperationsProvider;
|
||||
import ca.uhn.fhir.cr.dstu3.measure.MeasureService;
|
||||
import ca.uhn.fhir.i18n.Msg;
|
||||
import ca.uhn.fhir.jpa.api.dao.DaoRegistry;
|
||||
import ca.uhn.fhir.jpa.cache.IResourceChangeListenerRegistry;
|
||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||
import ca.uhn.fhir.rest.api.server.RequestDetails;
|
||||
import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory;
|
||||
import org.cqframework.cql.cql2elm.CqlTranslatorOptions;
|
||||
import org.cqframework.cql.cql2elm.LibraryManager;
|
||||
import org.cqframework.cql.cql2elm.LibrarySourceProvider;
|
||||
import org.cqframework.cql.cql2elm.ModelManager;
|
||||
import org.cqframework.cql.cql2elm.model.Model;
|
||||
import org.cqframework.cql.cql2elm.quick.FhirLibrarySourceProvider;
|
||||
import org.hl7.cql.model.ModelIdentifier;
|
||||
import org.hl7.fhir.common.hapi.validation.support.ValidationSupportChain;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.opencds.cqf.cql.engine.data.CompositeDataProvider;
|
||||
import org.opencds.cqf.cql.engine.fhir.model.Dstu3FhirModelResolver;
|
||||
import org.opencds.cqf.cql.engine.fhir.model.R4FhirModelResolver;
|
||||
import org.opencds.cqf.cql.engine.fhir.searchparam.SearchParameterResolver;
|
||||
import org.opencds.cqf.cql.engine.model.ModelResolver;
|
||||
import org.opencds.cqf.cql.engine.runtime.Code;
|
||||
import org.opencds.cqf.cql.evaluator.CqlOptions;
|
||||
import org.opencds.cqf.cql.evaluator.builder.DataProviderComponents;
|
||||
import org.opencds.cqf.cql.evaluator.builder.EndpointInfo;
|
||||
import org.opencds.cqf.cql.evaluator.cql2elm.model.CacheAwareModelManager;
|
||||
import org.opencds.cqf.cql.evaluator.cql2elm.util.LibraryVersionSelector;
|
||||
import org.opencds.cqf.cql.evaluator.engine.execution.CacheAwareLibraryLoaderDecorator;
|
||||
import org.opencds.cqf.cql.evaluator.engine.execution.TranslatingLibraryLoader;
|
||||
import org.opencds.cqf.cql.evaluator.engine.model.CachingModelResolverDecorator;
|
||||
import org.opencds.cqf.cql.evaluator.engine.retrieve.BundleRetrieveProvider;
|
||||
import org.opencds.cqf.cql.evaluator.fhir.Constants;
|
||||
import org.opencds.cqf.cql.evaluator.fhir.adapter.AdapterFactory;
|
||||
import org.opencds.cqf.cql.evaluator.measure.MeasureEvaluationOptions;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.security.concurrent.DelegatingSecurityContextExecutor;
|
||||
import org.springframework.security.core.context.SecurityContextHolder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Configuration
|
||||
|
@ -84,6 +25,19 @@ public class TestCrDstu3Config {
|
|||
};
|
||||
}
|
||||
|
||||
static class CqlTranslatorOptionsHelper {
|
||||
void setCqlCompatibilityLevelTo13(CqlTranslatorOptions theCqlTranslatorOptions) {
|
||||
theCqlTranslatorOptions.setCompatibilityLevel("1.3");
|
||||
}
|
||||
}
|
||||
|
||||
@Bean
|
||||
CqlTranslatorOptionsHelper setTranslatorOptionsForTest(CqlTranslatorOptions theCqlTranslatorOptions) {
|
||||
var helper = new CqlTranslatorOptionsHelper();
|
||||
helper.setCqlCompatibilityLevelTo13(theCqlTranslatorOptions);
|
||||
return helper;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Scope("prototype")
|
||||
public MeasureService dstu3measureService() {
|
||||
|
@ -94,225 +48,4 @@ public class TestCrDstu3Config {
|
|||
public MeasureOperationsProvider dstu3measureOperationsProvider() {
|
||||
return new MeasureOperationsProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
CrProviderFactory cqlProviderFactory() {
|
||||
return new CrProviderFactory();
|
||||
}
|
||||
|
||||
@Bean
|
||||
CrProviderLoader cqlProviderLoader(FhirContext theFhirContext, ResourceProviderFactory theResourceProviderFactory, CrProviderFactory theCqlProviderFactory) {
|
||||
return new CrProviderLoader(theFhirContext, theResourceProviderFactory, theCqlProviderFactory);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CrProperties crProperties() {
|
||||
var cqlProperties = new CrProperties.CqlProperties();
|
||||
var translatorOptions = cqlProperties.getCqlTranslatorOptions();
|
||||
translatorOptions.setCompatibilityLevel("1.3");
|
||||
cqlProperties.setCqlTranslatorOptions(translatorOptions);
|
||||
var properties = new CrProperties();
|
||||
properties.setCqlProperties(cqlProperties);
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CrProperties.CqlProperties cqlProperties(CrProperties theCrProperties) {
|
||||
return theCrProperties.getCqlProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CrProperties.MeasureProperties measureProperties(CrProperties theCrProperties) {
|
||||
return theCrProperties.getMeasureProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MeasureEvaluationOptions measureEvaluationOptions(CrProperties theCrProperties) {
|
||||
return theCrProperties.getMeasureProperties().getMeasureEvaluationOptions();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CqlOptions cqlOptions(CrProperties theCrProperties) {
|
||||
return theCrProperties.getCqlProperties().getCqlOptions();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CqlExceptionHandlingInterceptor cqlExceptionHandlingInterceptor() {
|
||||
return new CqlExceptionHandlingInterceptor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CqlTranslatorOptions cqlTranslatorOptions(FhirContext theFhirContext, CrProperties.CqlProperties theCqlProperties) {
|
||||
CqlTranslatorOptions options = theCqlProperties.getCqlOptions().getCqlTranslatorOptions();
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ModelManager modelManager(
|
||||
Map<ModelIdentifier, Model> theGlobalModelCache) {
|
||||
return new CacheAwareModelManager(theGlobalModelCache);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ILibraryManagerFactory libraryManagerFactory(
|
||||
ModelManager theModelManager) {
|
||||
return (providers) -> {
|
||||
LibraryManager libraryManager = new LibraryManager(theModelManager);
|
||||
for (LibrarySourceProvider provider : providers) {
|
||||
libraryManager.getLibrarySourceLoader().registerProvider(provider);
|
||||
}
|
||||
return libraryManager;
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SearchParameterResolver searchParameterResolver(FhirContext theFhirContext) {
|
||||
return new SearchParameterResolver(theFhirContext);
|
||||
}
|
||||
|
||||
@Bean
|
||||
IFhirDalFactory fhirDalFactory(DaoRegistry theDaoRegistry) {
|
||||
return rd -> new HapiFhirDal(theDaoRegistry, rd);
|
||||
}
|
||||
|
||||
@Bean
|
||||
IDataProviderFactory dataProviderFactory(ModelResolver theModelResolver, DaoRegistry theDaoRegistry,
|
||||
SearchParameterResolver theSearchParameterResolver) {
|
||||
return (rd, t) -> {
|
||||
HapiFhirRetrieveProvider provider = new HapiFhirRetrieveProvider(theDaoRegistry, theSearchParameterResolver, rd);
|
||||
if (t != null) {
|
||||
provider.setTerminologyProvider(t);
|
||||
provider.setExpandValueSets(true);
|
||||
provider.setMaxCodesPerQuery(500);
|
||||
provider.setModelResolver(theModelResolver);
|
||||
}
|
||||
return new CompositeDataProvider(theModelResolver, provider);
|
||||
};
|
||||
}
|
||||
|
||||
@Bean
|
||||
org.opencds.cqf.cql.evaluator.builder.DataProviderFactory builderDataProviderFactory(FhirContext theFhirContext, ModelResolver theModelResolver) {
|
||||
return new org.opencds.cqf.cql.evaluator.builder.DataProviderFactory() {
|
||||
@Override
|
||||
public DataProviderComponents create(EndpointInfo theEndpointInfo) {
|
||||
// to do implement endpoint
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataProviderComponents create(IBaseBundle theDataBundle) {
|
||||
return new DataProviderComponents(Constants.FHIR_MODEL_URI, theModelResolver,
|
||||
new BundleRetrieveProvider(theFhirContext, theDataBundle));
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HapiFhirRetrieveProvider fhirRetrieveProvider(DaoRegistry theDaoRegistry,
|
||||
SearchParameterResolver theSearchParameterResolver) {
|
||||
return new HapiFhirRetrieveProvider(theDaoRegistry, theSearchParameterResolver);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ITerminologyProviderFactory terminologyProviderFactory(
|
||||
IValidationSupport theValidationSupport,
|
||||
Map<org.cqframework.cql.elm.execution.VersionedIdentifier, List<Code>> theGlobalCodeCache) {
|
||||
return rd -> new HapiTerminologyProvider(theValidationSupport, theGlobalCodeCache,
|
||||
rd);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ILibrarySourceProviderFactory librarySourceProviderFactory(DaoRegistry theDaoRegistry) {
|
||||
return rd -> new HapiLibrarySourceProvider(theDaoRegistry, rd);
|
||||
}
|
||||
|
||||
@Bean
|
||||
ILibraryLoaderFactory libraryLoaderFactory(
|
||||
Map<org.cqframework.cql.elm.execution.VersionedIdentifier, org.cqframework.cql.elm.execution.Library> theGlobalLibraryCache,
|
||||
ModelManager theModelManager, CqlTranslatorOptions theCqlTranslatorOptions, CrProperties.CqlProperties theCqlProperties) {
|
||||
return lcp -> {
|
||||
|
||||
if (theCqlProperties.getCqlOptions().useEmbeddedLibraries()) {
|
||||
lcp.add(new FhirLibrarySourceProvider());
|
||||
}
|
||||
|
||||
return new CacheAwareLibraryLoaderDecorator(
|
||||
new TranslatingLibraryLoader(theModelManager, lcp, theCqlTranslatorOptions, null), theGlobalLibraryCache) {
|
||||
// TODO: This is due to a bug with the ELM annotations which prevent options
|
||||
// from matching the way they should
|
||||
@Override
|
||||
protected Boolean translatorOptionsMatch(org.cqframework.cql.elm.execution.Library library) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: Use something like caffeine caching for this so that growth is limited.
|
||||
@Bean
|
||||
public Map<org.cqframework.cql.elm.execution.VersionedIdentifier, org.cqframework.cql.elm.execution.Library> globalLibraryCache() {
|
||||
return new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Map<org.cqframework.cql.elm.execution.VersionedIdentifier, List<Code>> globalCodeCache() {
|
||||
return new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Map<ModelIdentifier, Model> globalModelCache() {
|
||||
return new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public ElmCacheResourceChangeListener elmCacheResourceChangeListener(
|
||||
IResourceChangeListenerRegistry theResourceChangeListenerRegistry, DaoRegistry theDaoRegistry,
|
||||
Map<org.cqframework.cql.elm.execution.VersionedIdentifier, org.cqframework.cql.elm.execution.Library> theGlobalLibraryCache) {
|
||||
ElmCacheResourceChangeListener listener = new ElmCacheResourceChangeListener(theDaoRegistry, theGlobalLibraryCache);
|
||||
theResourceChangeListenerRegistry.registerResourceResourceChangeListener("Library",
|
||||
SearchParameterMap.newSynchronous(), listener, 1000);
|
||||
return listener;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public CodeCacheResourceChangeListener codeCacheResourceChangeListener(
|
||||
IResourceChangeListenerRegistry theResourceChangeListenerRegistry, DaoRegistry theDaoRegistry,
|
||||
Map<org.cqframework.cql.elm.execution.VersionedIdentifier, List<Code>> theGlobalCodeCache) {
|
||||
CodeCacheResourceChangeListener listener = new CodeCacheResourceChangeListener(theDaoRegistry, theGlobalCodeCache);
|
||||
theResourceChangeListenerRegistry.registerResourceResourceChangeListener("ValueSet",
|
||||
SearchParameterMap.newSynchronous(), listener, 1000);
|
||||
return listener;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ModelResolver modelResolver(FhirContext theFhirContext) {
|
||||
return new CachingModelResolverDecorator(new Dstu3FhirModelResolver());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LibraryVersionSelector libraryVersionSelector(AdapterFactory theAdapterFactory) {
|
||||
return new LibraryVersionSelector(theAdapterFactory);
|
||||
}
|
||||
|
||||
@Bean(name = "cqlExecutor")
|
||||
public Executor cqlExecutor() {
|
||||
CqlForkJoinWorkerThreadFactory factory = new CqlForkJoinWorkerThreadFactory();
|
||||
ForkJoinPool myCommonPool = new ForkJoinPool(Math.min(32767, Runtime.getRuntime().availableProcessors()),
|
||||
factory,
|
||||
null, false);
|
||||
|
||||
return new DelegatingSecurityContextExecutor(myCommonPool,
|
||||
SecurityContextHolder.getContext());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PreExpandedValidationSupportLoader preExpandedValidationSupportLoader(ValidationSupportChain theSupportChain,
|
||||
FhirContext theFhirContext) {
|
||||
return new PreExpandedValidationSupportLoader(theSupportChain, theFhirContext);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import ca.uhn.fhir.cr.r4.plandefinition.PlanDefinitionOperationsProvider;
|
|||
import ca.uhn.fhir.cr.r4.questionnaire.QuestionnaireOperationsProvider;
|
||||
import ca.uhn.fhir.cr.r4.questionnaireresponse.QuestionnaireResponseOperationsProvider;
|
||||
import org.opencds.cqf.cql.evaluator.activitydefinition.r4.ActivityDefinitionProcessor;
|
||||
import org.opencds.cqf.cql.evaluator.library.EvaluationSettings;
|
||||
import org.opencds.cqf.cql.evaluator.plandefinition.r4.PlanDefinitionProcessor;
|
||||
import org.opencds.cqf.cql.evaluator.questionnaire.r4.QuestionnaireProcessor;
|
||||
import org.opencds.cqf.cql.evaluator.questionnaireresponse.r4.QuestionnaireResponseProcessor;
|
||||
|
@ -20,10 +21,9 @@ import org.springframework.context.annotation.Import;
|
|||
@Configuration
|
||||
@Import(TestCrConfig.class)
|
||||
public class TestCrR4Config {
|
||||
|
||||
@Bean
|
||||
IActivityDefinitionProcessorFactory r4ActivityDefinitionProcessorFactory() {
|
||||
return r -> new ActivityDefinitionProcessor(r);
|
||||
IActivityDefinitionProcessorFactory r4ActivityDefinitionProcessorFactory(EvaluationSettings theEvaluationSettings) {
|
||||
return r -> new ActivityDefinitionProcessor(r, theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
@ -32,8 +32,8 @@ public class TestCrR4Config {
|
|||
}
|
||||
|
||||
@Bean
|
||||
IPlanDefinitionProcessorFactory r4PlanDefinitionProcessorFactory() {
|
||||
return r -> new PlanDefinitionProcessor(r);
|
||||
IPlanDefinitionProcessorFactory r4PlanDefinitionProcessorFactory(EvaluationSettings theEvaluationSettings) {
|
||||
return r -> new PlanDefinitionProcessor(r, theEvaluationSettings);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
|
2
pom.xml
2
pom.xml
|
@ -972,7 +972,7 @@
|
|||
|
||||
<elastic_apm_version>1.28.4</elastic_apm_version>
|
||||
<!-- CQL Support -->
|
||||
<clinical-reasoning.version>3.0.0-SNAPSHOT</clinical-reasoning.version>
|
||||
<clinical-reasoning.version>3.0.0-PRE3-SNAPSHOT</clinical-reasoning.version>
|
||||
|
||||
<!-- Site properties -->
|
||||
<fontawesomeVersion>5.4.1</fontawesomeVersion>
|
||||
|
|
Loading…
Reference in New Issue