Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to lastest evaluator pre-release, fixes to some caching #347

Merged
merged 1 commit into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -197,5 +198,5 @@ Map<VersionedIdentifier, Model> globalModelCache() {
@Bean(name="globalLibraryCache")
Map<org.cqframework.cql.elm.execution.VersionedIdentifier, Library> globalLibraryCache() {
return new ConcurrentHashMap<org.cqframework.cql.elm.execution.VersionedIdentifier, Library>();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -138,6 +144,20 @@ public TerminologyProvider terminologyProvider(Map<String, Iterable<Code>> 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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
15 changes: 10 additions & 5 deletions dstu3/src/main/resources/hapi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
<hapi.version>5.4.1</hapi.version>
<fhir.core.version>5.4.5</fhir.core.version>
<cqf-tooling.version>1.3.1-SNAPSHOT</cqf-tooling.version>
<cql-engine.version>1.5.2-SNAPSHOT</cql-engine.version>
<cql-evaluator.version>1.2.1-SNAPSHOT</cql-evaluator.version>
<cqframework.version>1.5.3</cqframework.version>
<cql-engine.version>1.5.2</cql-engine.version>
<cql-evaluator.version>1.3.0-SNAPSHOT</cql-evaluator.version>
<cqframework.version>1.5.4</cqframework.version>
<cds-hooks.version>1.3.1-SNAPSHOT</cds-hooks.version>
<slf4j.version>1.7.30</slf4j.version>

Expand Down Expand Up @@ -351,6 +351,12 @@
<version>10.14.2.0</version>
</dependency>

<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.5.2</version>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
Expand Down
19 changes: 19 additions & 0 deletions r4/src/main/java/org/opencds/cqf/r4/config/FhirServerConfigR4.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 11 additions & 5 deletions r4/src/main/resources/hapi.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down