diff --git a/common/src/main/java/org/opencds/cqf/common/config/FhirServerConfig.java b/common/src/main/java/org/opencds/cqf/common/config/FhirServerConfig.java index 3f03153b5..4063b8f53 100644 --- a/common/src/main/java/org/opencds/cqf/common/config/FhirServerConfig.java +++ b/common/src/main/java/org/opencds/cqf/common/config/FhirServerConfig.java @@ -82,6 +82,7 @@ public DaoConfig daoConfig() { retVal.setEmailFromAddress(this.emailFrom); retVal.setEnforceReferentialIntegrityOnDelete(this.enforceReferentialIntegrityOnDelete); retVal.setEnforceReferentialIntegrityOnWrite(this.enforceReferentialIntegrityOnWrite); + retVal.setMaximumExpansionSize(100000); Integer maxFetchSize = HapiProperties.getMaximumFetchSize(); retVal.setFetchSizeDefaultMaximum(maxFetchSize); @@ -197,5 +198,5 @@ Map globalModelCache() { @Bean(name="globalLibraryCache") Map globalLibraryCache() { return new ConcurrentHashMap(); - } + } } diff --git a/dstu3/src/main/java/org/opencds/cqf/dstu3/config/FhirServerConfigDstu3.java b/dstu3/src/main/java/org/opencds/cqf/dstu3/config/FhirServerConfigDstu3.java index 736a78f78..9ccf7f9e1 100644 --- a/dstu3/src/main/java/org/opencds/cqf/dstu3/config/FhirServerConfigDstu3.java +++ b/dstu3/src/main/java/org/opencds/cqf/dstu3/config/FhirServerConfigDstu3.java @@ -13,7 +13,11 @@ import org.hl7.elm.r1.VersionedIdentifier; import org.opencds.cqf.common.config.HapiProperties; import org.opencds.cqf.common.providers.CacheAwareTerminologyProvider; +import org.opencds.cqf.common.retrieve.JpaFhirRetrieveProvider; +import org.opencds.cqf.cql.engine.data.CompositeDataProvider; +import org.opencds.cqf.cql.engine.data.DataProvider; import org.opencds.cqf.cql.engine.fhir.model.Dstu3FhirModelResolver; +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.engine.terminology.TerminologyProvider; @@ -39,8 +43,10 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import ca.uhn.fhir.context.ConfigurationException; +import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.cql.dstu3.listener.ElmCacheResourceChangeListener; import ca.uhn.fhir.cql.dstu3.provider.JpaTerminologyProvider; +import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.cache.IResourceChangeListenerRegistry; import ca.uhn.fhir.jpa.config.BaseJavaConfigDstu3; @@ -138,6 +144,20 @@ public TerminologyProvider terminologyProvider(Map> termi return new CacheAwareTerminologyProvider(terminologyCache, jpaTerminologyProvider); } + @Bean SearchParameterResolver searchParameterResolver(FhirContext fhirContext) { + return new SearchParameterResolver(fhirContext); + } + + // TODO: Respect config options + @Bean + public DataProvider dataProvider(ModelResolver modelResolver, DaoRegistry daoRegistry, SearchParameterResolver searchParameterResolver, TerminologyProvider terminologyProvider) { + JpaFhirRetrieveProvider retrieveProvider = new JpaFhirRetrieveProvider(daoRegistry, searchParameterResolver); + retrieveProvider.setTerminologyProvider(terminologyProvider); + retrieveProvider.setExpandValueSets(true); + return new CompositeDataProvider(modelResolver, retrieveProvider); + } + + @Bean(name = "dstu3ModelResolver") public ModelResolver modelResolver() { return new CachingModelResolverDecorator(new Dstu3FhirModelResolver()); diff --git a/dstu3/src/main/java/org/opencds/cqf/dstu3/evaluation/MeasureEvaluationSeed.java b/dstu3/src/main/java/org/opencds/cqf/dstu3/evaluation/MeasureEvaluationSeed.java index 1555703a5..44d1224f9 100644 --- a/dstu3/src/main/java/org/opencds/cqf/dstu3/evaluation/MeasureEvaluationSeed.java +++ b/dstu3/src/main/java/org/opencds/cqf/dstu3/evaluation/MeasureEvaluationSeed.java @@ -6,13 +6,11 @@ import org.apache.commons.lang3.tuple.Triple; import org.cqframework.cql.elm.execution.Library; import org.hl7.fhir.dstu3.model.Measure; -import org.opencds.cqf.common.config.HapiProperties; import org.opencds.cqf.common.evaluation.EvaluationProviderFactory; import org.opencds.cqf.common.helpers.DateHelper; import org.opencds.cqf.common.helpers.LoggingHelper; import org.opencds.cqf.common.helpers.UsingHelper; import org.opencds.cqf.cql.engine.data.DataProvider; -import org.opencds.cqf.cql.engine.debug.DebugMap; import org.opencds.cqf.cql.engine.execution.Context; import org.opencds.cqf.cql.engine.execution.LibraryLoader; import org.opencds.cqf.cql.engine.runtime.DateTime; diff --git a/dstu3/src/main/resources/hapi.properties b/dstu3/src/main/resources/hapi.properties index fd912e1b6..4a47aed9b 100644 --- a/dstu3/src/main/resources/hapi.properties +++ b/dstu3/src/main/resources/hapi.properties @@ -76,15 +76,20 @@ fhirpath_interceptor.enabled=false # datasource.username= # datasource.password= +# datasource.driver=org.apache.derby.jdbc.EmbeddedDriver +# datasource.url=jdbc:derby:target/derbyDstu3;create=true +# hibernate.dialect=org.hibernate.dialect.DerbyTenSevenDialect +# spring.jpa.hibernate.ddl-auto=update +# datasource.username= +# datasource.password= -datasource.driver=org.apache.derby.jdbc.EmbeddedDriver -datasource.url=jdbc:derby:target/derbyDstu3;create=true -hibernate.dialect=org.hibernate.dialect.DerbyTenSevenDialect +datasource.driver=org.hsqldb.jdbc.JDBCDriver +datasource.url=jdbc:hsqldb:file:target/testdbDstu3 +hibernate.dialect=org.hibernate.dialect.HSQLDialect spring.jpa.hibernate.ddl-auto=update -datasource.username= +datasource.username=sa datasource.password= - # datasource.driver=org.postgresql.Driver # datasource.url=jdbc:postgresql://localhost:5432/hapi # hibernate.dialect=org.hibernate.dialect.PostgreSQL95Dialect diff --git a/pom.xml b/pom.xml index 62a72e0fe..ab8bcd93f 100644 --- a/pom.xml +++ b/pom.xml @@ -51,9 +51,9 @@ 5.4.1 5.4.5 1.3.1-SNAPSHOT - 1.5.2-SNAPSHOT - 1.2.1-SNAPSHOT - 1.5.3 + 1.5.2 + 1.3.0-SNAPSHOT + 1.5.4 1.3.1-SNAPSHOT 1.7.30 @@ -351,6 +351,12 @@ 10.14.2.0 + + org.hsqldb + hsqldb + 2.5.2 + + org.postgresql postgresql diff --git a/r4/src/main/java/org/opencds/cqf/r4/config/FhirServerConfigR4.java b/r4/src/main/java/org/opencds/cqf/r4/config/FhirServerConfigR4.java index bcd7510e1..7345ffad3 100644 --- a/r4/src/main/java/org/opencds/cqf/r4/config/FhirServerConfigR4.java +++ b/r4/src/main/java/org/opencds/cqf/r4/config/FhirServerConfigR4.java @@ -13,7 +13,11 @@ import org.hl7.elm.r1.VersionedIdentifier; import org.opencds.cqf.common.config.HapiProperties; import org.opencds.cqf.common.providers.CacheAwareTerminologyProvider; +import org.opencds.cqf.common.retrieve.JpaFhirRetrieveProvider; +import org.opencds.cqf.cql.engine.data.CompositeDataProvider; +import org.opencds.cqf.cql.engine.data.DataProvider; 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.engine.terminology.TerminologyProvider; @@ -40,8 +44,10 @@ import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; import ca.uhn.fhir.context.ConfigurationException; +import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.cql.r4.listener.ElmCacheResourceChangeListener; import ca.uhn.fhir.cql.r4.provider.JpaTerminologyProvider; +import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.cache.IResourceChangeListenerRegistry; import ca.uhn.fhir.jpa.config.BaseJavaConfigR4; @@ -165,4 +171,17 @@ public ElmCacheResourceChangeListener elmCacheResourceChangeListener(IResourceCh resourceChangeListenerRegistry.registerResourceResourceChangeListener("Library", SearchParameterMap.newSynchronous(), listener, 1000); return listener; } + + @Bean SearchParameterResolver searchParameterResolver(FhirContext fhirContext) { + return new SearchParameterResolver(fhirContext); + } + + // TODO: Respect config options + @Bean + public DataProvider dataProvider(ModelResolver modelResolver, DaoRegistry daoRegistry, SearchParameterResolver searchParameterResolver, TerminologyProvider terminologyProvider) { + JpaFhirRetrieveProvider retrieveProvider = new JpaFhirRetrieveProvider(daoRegistry, searchParameterResolver); + retrieveProvider.setTerminologyProvider(terminologyProvider); + retrieveProvider.setExpandValueSets(true); + return new CompositeDataProvider(modelResolver, retrieveProvider); + } } diff --git a/r4/src/main/java/org/opencds/cqf/r4/providers/MeasureOperationsProvider.java b/r4/src/main/java/org/opencds/cqf/r4/providers/MeasureOperationsProvider.java index 4d445eff1..e38a59944 100644 --- a/r4/src/main/java/org/opencds/cqf/r4/providers/MeasureOperationsProvider.java +++ b/r4/src/main/java/org/opencds/cqf/r4/providers/MeasureOperationsProvider.java @@ -93,7 +93,6 @@ public class MeasureOperationsProvider { private LibraryHelper libraryHelper; private static final Logger logger = LoggerFactory.getLogger(MeasureOperationsProvider.class); - @Inject public MeasureOperationsProvider(DaoRegistry registry, EvaluationProviderFactory factory, NarrativeProvider narrativeProvider, HQMFProvider hqmfProvider, diff --git a/r4/src/main/resources/hapi.properties b/r4/src/main/resources/hapi.properties index 9deee11b4..934d859ab 100644 --- a/r4/src/main/resources/hapi.properties +++ b/r4/src/main/resources/hapi.properties @@ -77,14 +77,20 @@ fhirpath_interceptor.enabled=false # datasource.password= -datasource.driver=org.apache.derby.jdbc.EmbeddedDriver -datasource.url=jdbc:derby:target/derbyR4;create=true -hibernate.dialect=org.hibernate.dialect.DerbyTenSevenDialect +# datasource.driver=org.apache.derby.jdbc.EmbeddedDriver +# datasource.url=jdbc:derby:target/derbyR4;create=true +# hibernate.dialect=org.hibernate.dialect.DerbyTenSevenDialect +# spring.jpa.hibernate.ddl-auto=update +# datasource.username= +# datasource.password= + +datasource.driver=org.hsqldb.jdbc.JDBCDriver +datasource.url=jdbc:hsqldb:file:target/testdbR4 +hibernate.dialect=org.hibernate.dialect.HSQLDialect spring.jpa.hibernate.ddl-auto=update -datasource.username= +datasource.username=sa datasource.password= - # datasource.driver=org.postgresql.Driver # datasource.url=jdbc:postgresql://localhost:5432/hapi # hibernate.dialect=org.hibernate.dialect.PostgreSQL95Dialect