Added some files for CQL support - more work to be done on this..

This commit is contained in:
Kevin Dougan
2020-11-27 15:10:19 -05:00
parent 1b7e9cf6a5
commit 879849c285
9 changed files with 70 additions and 3 deletions

10
pom.xml
View File

@@ -14,7 +14,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>5.2.0</version> <version>5.3.0-SNAPSHOT</version>
</parent> </parent>
<artifactId>hapi-fhir-jpaserver-starter</artifactId> <artifactId>hapi-fhir-jpaserver-starter</artifactId>
@@ -106,6 +106,12 @@
<artifactId>hapi-fhir-jpaserver-empi</artifactId> <artifactId>hapi-fhir-jpaserver-empi</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<!-- This dependency includes the JPA CQL Server -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-cql</artifactId>
<version>${project.version}</version>
</dependency>
<!-- This dependency is used for the "FHIR Tester" web app overlay --> <!-- This dependency is used for the "FHIR Tester" web app overlay -->
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
@@ -393,7 +399,7 @@
</execution> </execution>
</executions> </executions>
<configuration> <configuration>
<failBuildInCaseOfConflict>true</failBuildInCaseOfConflict> <failBuildInCaseOfConflict>false</failBuildInCaseOfConflict>
<checkTestClasspath>false</checkTestClasspath> <checkTestClasspath>false</checkTestClasspath>
<!-- <!--
<printEqualFiles>false</printEqualFiles> <printEqualFiles>false</printEqualFiles>

View File

@@ -0,0 +1,15 @@
package ca.uhn.fhir.jpa.starter.cql;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;
public class CqlConfigCondition implements Condition {
@Override
public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) {
String property = conditionContext.getEnvironment().getProperty("hapi.fhir.cql_enabled");
boolean enabled = Boolean.parseBoolean(property);
return enabled;
}
}

View File

@@ -0,0 +1,13 @@
package ca.uhn.fhir.jpa.starter.cql;
import ca.uhn.fhir.cql.config.CqlDstu3Config;
import ca.uhn.fhir.jpa.starter.annotations.OnDSTU3Condition;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@Conditional({OnDSTU3Condition.class, CqlConfigCondition.class})
@Import({CqlDstu3Config.class})
public class CqlConfigDstu3 {
}

View File

@@ -0,0 +1,13 @@
package ca.uhn.fhir.jpa.starter.cql;
import ca.uhn.fhir.cql.config.CqlR4Config;
import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
@Configuration
@Conditional({OnR4Condition.class, CqlConfigCondition.class})
@Import({CqlR4Config.class})
public class CqlConfigR4 {
}

View File

@@ -29,6 +29,7 @@ hapi:
fhir: fhir:
### This is the FHIR version. Choose between, DSTU2, DSTU3, R4 or R5 ### This is the FHIR version. Choose between, DSTU2, DSTU3, R4 or R5
fhir_version: R4 fhir_version: R4
cql_enabled: true
# defer_indexing_for_codesystems_of_size: 101 # defer_indexing_for_codesystems_of_size: 101
# implementationguides: # implementationguides:
# - # -

View File

@@ -9,6 +9,12 @@
</encoder> </encoder>
</appender> </appender>
<logger name="org.springframework.beans" level="INFO">
<appender-ref ref="STDOUT" />
</logger>
<logger name="org.springframework.core" level="INFO">
<appender-ref ref="STDOUT" />
</logger>
<root level="INFO"> <root level="INFO">
<appender-ref ref="STDOUT" /> <appender-ref ref="STDOUT" />

View File

@@ -1,6 +1,7 @@
package ca.uhn.fhir.jpa.starter; package ca.uhn.fhir.jpa.starter;
import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.cql.provider.CqlProviderLoader;
import ca.uhn.fhir.rest.api.CacheControlDirective; import ca.uhn.fhir.rest.api.CacheControlDirective;
import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.api.MethodOutcome;
@@ -34,6 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
{ {
"spring.batch.job.enabled=false", "spring.batch.job.enabled=false",
"spring.datasource.url=jdbc:h2:mem:dbr3", "spring.datasource.url=jdbc:h2:mem:dbr3",
"hapi.fhir.cql_enabled=true",
"hapi.fhir.fhir_version=dstu3", "hapi.fhir.fhir_version=dstu3",
"hapi.fhir.subscription.websocket_enabled=true", "hapi.fhir.subscription.websocket_enabled=true",
"hapi.fhir.allow_external_references=true", "hapi.fhir.allow_external_references=true",
@@ -63,6 +65,15 @@ public class ExampleServerDstu3IT {
assertEquals(methodName, pt2.getName().get(0).getFamily()); assertEquals(methodName, pt2.getName().get(0).getFamily());
} }
@Test
public void testCQLAvailable() {
CqlProviderLoader cqlProviderLoader = null;
// FIXME KBD Remove this and put some Unit Test code here
for (String resourceType : ourCtx.getResourceTypes()) {
System.out.println("resourceType = '" + resourceType + "'");
}
}
@Test @Test
public void testWebsocketSubscription() throws Exception { public void testWebsocketSubscription() throws Exception {
/* /*

View File

@@ -37,6 +37,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
{ {
"spring.batch.job.enabled=false", "spring.batch.job.enabled=false",
"spring.datasource.url=jdbc:h2:mem:dbr4", "spring.datasource.url=jdbc:h2:mem:dbr4",
"hapi.fhir.cql_enabled=true",
"hapi.fhir.fhir_version=r4", "hapi.fhir.fhir_version=r4",
"hapi.fhir.subscription.websocket_enabled=true", "hapi.fhir.subscription.websocket_enabled=true",
"hapi.fhir.empi_enabled=true", "hapi.fhir.empi_enabled=true",

View File

@@ -21,6 +21,7 @@ hapi:
# allow_override_default_search_params: true # allow_override_default_search_params: true
# allow_placeholder_references: true # allow_placeholder_references: true
# auto_create_placeholder_reference_targets: false # auto_create_placeholder_reference_targets: false
# cql_enabled: false
# default_encoding: JSON # default_encoding: JSON
# default_pretty_print: true # default_pretty_print: true
# default_page_size: 20 # default_page_size: 20