Merge branch 'master' into ja_20231203_hapi_7_0

This commit is contained in:
James Agnew
2023-12-15 09:42:24 -05:00
9 changed files with 69 additions and 39 deletions

View File

@@ -21,7 +21,7 @@ jobs:
steps: steps:
- name: Container meta for default (distroless) image - name: Container meta for default (distroless) image
id: docker_meta id: docker_meta
uses: docker/metadata-action@v3 uses: docker/metadata-action@v5
with: with:
images: ${{ env.IMAGES }} images: ${{ env.IMAGES }}
tags: | tags: |
@@ -30,7 +30,7 @@ jobs:
- name: Container meta for tomcat image - name: Container meta for tomcat image
id: docker_tomcat_meta id: docker_tomcat_meta
uses: docker/metadata-action@v3 uses: docker/metadata-action@v5
with: with:
images: ${{ env.IMAGES }} images: ${{ env.IMAGES }}
tags: | tags: |
@@ -39,20 +39,20 @@ jobs:
suffix=-tomcat,onlatest=true suffix=-tomcat,onlatest=true
- name: Set up QEMU - name: Set up QEMU
uses: docker/setup-qemu-action@v1 uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v3
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v1 uses: docker/login-action@v3
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Cache Docker layers - name: Cache Docker layers
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: /tmp/.buildx-cache path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }} key: ${{ runner.os }}-buildx-${{ github.sha }}
@@ -61,7 +61,7 @@ jobs:
- name: Build and push default (distroless) image - name: Build and push default (distroless) image
id: docker_build id: docker_build
uses: docker/build-push-action@v2 uses: docker/build-push-action@v5
with: with:
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache
@@ -73,7 +73,7 @@ jobs:
- name: Build and push tomcat image - name: Build and push tomcat image
id: docker_build_tomcat id: docker_build_tomcat
uses: docker/build-push-action@v2 uses: docker/build-push-action@v5
with: with:
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache

View File

@@ -193,14 +193,14 @@ The easiest way to run this server entirely depends on your environment requirem
### Using jetty ### Using jetty
```bash ```bash
mvn jetty:run mvn -Pjetty jetty:run
``` ```
If you need to run this server on a different port (using Maven), you can change the port in the run command as follows: If you need to run this server on a different port (using Maven), you can change the port in the run command as follows:
```bash ```bash
mvn -Djetty.port=8888 jetty:run mvn -Pjetty -Djetty.port=8888 jetty:run
``` ```
Server will then be accessible at http://localhost:8888/ and eg. http://localhost:8888/fhir/metadata. Remember to adjust you overlay configuration in the application.yaml to eg. Server will then be accessible at http://localhost:8888/ and eg. http://localhost:8888/fhir/metadata. Remember to adjust you overlay configuration in the application.yaml to eg.

View File

@@ -624,11 +624,20 @@
<!-- Use the boot profile for development and debugging options when using your IDE --> <!-- Use the boot profile for development and debugging options when using your IDE -->
<profile> <profile>
<id>boot</id> <id>boot</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<version>${spring_boot_version}</version> <version>${spring_boot_version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
</dependencies> </dependencies>
</profile> </profile>

View File

@@ -27,6 +27,7 @@ public class AppProperties {
private Boolean ips_enabled = false; private Boolean ips_enabled = false;
private Boolean openapi_enabled = false; private Boolean openapi_enabled = false;
private Boolean mdm_enabled = false; private Boolean mdm_enabled = false;
private String mdm_rules_json_location = "mdm-rules.json";
private boolean advanced_lucene_indexing = false; private boolean advanced_lucene_indexing = false;
private boolean enable_index_of_type = false; private boolean enable_index_of_type = false;
private Boolean allow_cascading_deletes = false; private Boolean allow_cascading_deletes = false;
@@ -191,7 +192,15 @@ public class AppProperties {
this.mdm_enabled = mdm_enabled; this.mdm_enabled = mdm_enabled;
} }
public Cors getCors() { public String getMdm_rules_json_location() {
return mdm_rules_json_location;
}
public void setMdm_rules_json_location(String mdm_rules_json_location) {
this.mdm_rules_json_location = mdm_rules_json_location;
}
public Cors getCors() {
return cors; return cors;
} }

View File

@@ -55,10 +55,6 @@ public class Application extends SpringBootServletInitializer {
// UI is now accessible at http://localhost:8080/ // UI is now accessible at http://localhost:8080/
} }
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(Application.class);
}
@Autowired @Autowired
AutowireCapableBeanFactory beanFactory; AutowireCapableBeanFactory beanFactory;
@@ -75,31 +71,9 @@ public class Application extends SpringBootServletInitializer {
return servletRegistrationBean; return servletRegistrationBean;
} }
@Bean
public ServletRegistrationBean overlayRegistrationBean() {
AnnotationConfigWebApplicationContext annotationConfigWebApplicationContext =
new AnnotationConfigWebApplicationContext();
annotationConfigWebApplicationContext.register(FhirTesterConfig.class);
DispatcherServlet dispatcherServlet = new DispatcherServlet(annotationConfigWebApplicationContext);
dispatcherServlet.setContextClass(AnnotationConfigWebApplicationContext.class);
dispatcherServlet.setContextConfigLocation(FhirTesterConfig.class.getName());
ServletRegistrationBean registrationBean = new ServletRegistrationBean();
registrationBean.setServlet(dispatcherServlet);
registrationBean.addUrlMappings("/*");
registrationBean.setLoadOnStartup(1);
return registrationBean;
}
@Bean @Bean
public ServletWebServerFactory servletWebServerFactory() { public ServletWebServerFactory servletWebServerFactory() {
return new JettyServletWebServerFactory(); return new JettyServletWebServerFactory();
} }
// @Bean
// IRepositoryFactory repositoryFactory(DaoRegistry theDaoRegistry, RestfulServer theRestfulServer) {
// return rd -> new HapiFhirRepository(theDaoRegistry, rd, theRestfulServer);
// }
} }

View File

@@ -180,6 +180,13 @@ public class FhirServerConfigCommon {
jpaStorageSettings.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_size()); jpaStorageSettings.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_size());
jpaStorageSettings.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_max_size()); jpaStorageSettings.setBundleBatchPoolSize(appProperties.getBundle_batch_pool_max_size());
if (appProperties.getMdm_enabled()) {
// MDM requires the subscription of type message
ourLog.info("Enabling message subscriptions");
jpaStorageSettings.addSupportedSubscriptionType(
org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType.MESSAGE);
}
storageSettings(appProperties, jpaStorageSettings); storageSettings(appProperties, jpaStorageSettings);
return jpaStorageSettings; return jpaStorageSettings;
} }

View File

@@ -2,6 +2,7 @@ package ca.uhn.fhir.jpa.starter.mdm;
import ca.uhn.fhir.jpa.mdm.config.MdmConsumerConfig; import ca.uhn.fhir.jpa.mdm.config.MdmConsumerConfig;
import ca.uhn.fhir.jpa.mdm.config.MdmSubmitterConfig; import ca.uhn.fhir.jpa.mdm.config.MdmSubmitterConfig;
import ca.uhn.fhir.jpa.searchparam.config.NicknameServiceConfig;
import ca.uhn.fhir.jpa.starter.AppProperties; import ca.uhn.fhir.jpa.starter.AppProperties;
import ca.uhn.fhir.mdm.api.IMdmSettings; import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.rules.config.MdmRuleValidator; import ca.uhn.fhir.mdm.rules.config.MdmRuleValidator;
@@ -20,14 +21,14 @@ import java.nio.charset.StandardCharsets;
@Configuration @Configuration
@Conditional(MdmConfigCondition.class) @Conditional(MdmConfigCondition.class)
@Import({MdmConsumerConfig.class, MdmSubmitterConfig.class}) @Import({MdmConsumerConfig.class, MdmSubmitterConfig.class, NicknameServiceConfig.class})
public class MdmConfig { public class MdmConfig {
@Bean @Bean
IMdmSettings mdmSettings(@Autowired MdmRuleValidator theMdmRuleValidator, AppProperties appProperties) IMdmSettings mdmSettings(@Autowired MdmRuleValidator theMdmRuleValidator, AppProperties appProperties)
throws IOException { throws IOException {
DefaultResourceLoader resourceLoader = new DefaultResourceLoader(); DefaultResourceLoader resourceLoader = new DefaultResourceLoader();
Resource resource = resourceLoader.getResource("mdm-rules.json"); Resource resource = resourceLoader.getResource(appProperties.getMdm_rules_json_location());
String json = IOUtils.toString(resource.getInputStream(), StandardCharsets.UTF_8); String json = IOUtils.toString(resource.getInputStream(), StandardCharsets.UTF_8);
return new MdmSettings(theMdmRuleValidator) return new MdmSettings(theMdmRuleValidator)
.setEnabled(appProperties.getMdm_enabled()) .setEnabled(appProperties.getMdm_enabled())

View File

@@ -137,6 +137,7 @@ hapi:
# graphql_enabled: true # graphql_enabled: true
narrative_enabled: false narrative_enabled: false
mdm_enabled: false mdm_enabled: false
mdm_rules_json_location: "mdm-rules.json"
# local_base_urls: # local_base_urls:
# - https://hapi.fhir.org/baseR4 # - https://hapi.fhir.org/baseR4
# partitioning: # partitioning:

View File

@@ -0,0 +1,29 @@
package ca.uhn.fhir.jpa.starter;
import static org.assertj.core.api.Assertions.assertThat;
import org.hl7.fhir.dstu2.model.Subscription.SubscriptionChannelType;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import ca.uhn.fhir.jpa.api.config.JpaStorageSettings;
import ca.uhn.fhir.jpa.nickname.INicknameSvc;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, classes = {Application.class}, properties = {
"hapi.fhir.fhir_version=r4",
"hapi.fhir.mdm_enabled=true"
})
class MdmTest {
@Autowired
INicknameSvc nicknameService;
@Autowired
JpaStorageSettings jpaStorageSettings;
@Test
void testApplicationStartedSuccessfully() {
assertThat(nicknameService).isNotNull();
assertThat(jpaStorageSettings.getSupportedSubscriptionTypes()).contains(SubscriptionChannelType.MESSAGE);
}
}