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

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:
### This is the FHIR version. Choose between, DSTU2, DSTU3, R4 or R5
fhir_version: R4
cql_enabled: true
# defer_indexing_for_codesystems_of_size: 101
# implementationguides:
# -

View File

@@ -9,9 +9,15 @@
</encoder>
</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">
<appender-ref ref="STDOUT" />
</root>
</configuration>
</configuration>

View File

@@ -1,6 +1,7 @@
package ca.uhn.fhir.jpa.starter;
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.EncodingEnum;
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.datasource.url=jdbc:h2:mem:dbr3",
"hapi.fhir.cql_enabled=true",
"hapi.fhir.fhir_version=dstu3",
"hapi.fhir.subscription.websocket_enabled=true",
"hapi.fhir.allow_external_references=true",
@@ -63,6 +65,15 @@ public class ExampleServerDstu3IT {
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
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.datasource.url=jdbc:h2:mem:dbr4",
"hapi.fhir.cql_enabled=true",
"hapi.fhir.fhir_version=r4",
"hapi.fhir.subscription.websocket_enabled=true",
"hapi.fhir.empi_enabled=true",

View File

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