From ce3890db7a7391cf902d4fd68ea1347867aa55a6 Mon Sep 17 00:00:00 2001 From: CalebSLane Date: Mon, 19 Aug 2024 16:36:45 -0700 Subject: [PATCH 1/3] remove astm bridge container as part of setup script teardown --- install/installerTemplate/linux/setup_OpenELIS.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/install/installerTemplate/linux/setup_OpenELIS.py b/install/installerTemplate/linux/setup_OpenELIS.py index 0ba26f0094..af0b0c2b80 100644 --- a/install/installerTemplate/linux/setup_OpenELIS.py +++ b/install/installerTemplate/linux/setup_OpenELIS.py @@ -82,6 +82,7 @@ DOCKER_FHIR_API_CONTAINER_NAME = "external-fhir-api" DOCKER_NGINX_CONTAINER_NAME = "openelisglobal-proxy" DOCKER_FRONTEND_CONTAINER_NAME = "openelisglobal-frontend" +DOCKER_ASTM_BRIDGE_CONTAINER_NAME = "astm-http-bridge" DOCKER_AUTOHEAL_CONTAINER_NAME = "autoheal-oe" DOCKER_DB_CONTAINER_NAME = "openelisglobal-database" DOCKER_DB_BACKUPS_DIR = "/backups/" # path in docker container @@ -871,6 +872,11 @@ def uninstall_docker_images(): cmd = 'docker rm $(docker stop $(docker ps -a -q --filter="name=' + DOCKER_FRONTEND_CONTAINER_NAME + '" --format="{{.ID}}"))' os.system(cmd) + if ASTM_PROXY: + log("removing astm-bridge image...", PRINT_TO_CONSOLE) + cmd = 'docker rm $(docker stop $(docker ps -a -q --filter="name=' + DOCKER_ASTM_BRIDGE_CONTAINER_NAME + '" --format="{{.ID}}"))' + os.system(cmd) + log("removing autoheal image...", PRINT_TO_CONSOLE) cmd = 'docker rm $(docker stop $(docker ps -a -q --filter="name=' + DOCKER_AUTOHEAL_CONTAINER_NAME + '" --format="{{.ID}}"))' os.system(cmd) From 43ab01e9c8b985434f7e49b863270182abb4052f Mon Sep 17 00:00:00 2001 From: CalebSLane Date: Thu, 22 Aug 2024 11:39:45 -0700 Subject: [PATCH 2/3] add configurable time to FHIR API Workflow --- .../fhir/service/FhirApiWorkFlowServiceImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirApiWorkFlowServiceImpl.java b/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirApiWorkFlowServiceImpl.java index 84907ec2b6..cc49fad8da 100644 --- a/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirApiWorkFlowServiceImpl.java +++ b/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirApiWorkFlowServiceImpl.java @@ -4,10 +4,15 @@ import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.gclient.IQuery; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.Optional; @@ -84,9 +89,10 @@ public class FhirApiWorkFlowServiceImpl implements FhirApiWorkflowService { @Value("${org.openelisglobal.remote.source.identifier:}#{T(java.util.Collections).emptyList()}") private List remoteStoreIdentifier; - @Scheduled(initialDelay = 10 * 1000, fixedRate = 2 * 60 * 1000) @Override + @Scheduled(initialDelay = 10 * 1000, fixedRateString="${org.openelisglobal.remote.poll.frequency:120000}") public void pollForRemoteTasks() { + System.out.println(System.currentTimeMillis()); processWorkflow(ResourceType.Task); } From f2048dca1810cde4de2dd21c3719116459c41aa1 Mon Sep 17 00:00:00 2001 From: CalebSLane Date: Thu, 22 Aug 2024 15:46:23 -0700 Subject: [PATCH 3/3] allow the http basic auth in local fhir store --- .../org/openelisglobal/dataexchange/fhir/FhirUtil.java | 8 ++++++-- .../fhir/service/FhirApiWorkFlowServiceImpl.java | 10 ++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/openelisglobal/dataexchange/fhir/FhirUtil.java b/src/main/java/org/openelisglobal/dataexchange/fhir/FhirUtil.java index 16f9099be3..421ba77949 100644 --- a/src/main/java/org/openelisglobal/dataexchange/fhir/FhirUtil.java +++ b/src/main/java/org/openelisglobal/dataexchange/fhir/FhirUtil.java @@ -33,8 +33,7 @@ public class FhirUtil implements FhirClientFetcher { @Override public IGenericClient getFhirClient(String fhirStorePath) { IGenericClient fhirClient = fhirContext.newRestfulGenericClient(fhirStorePath); - if (!GenericValidator.isBlankOrNull(fhirConfig.getUsername()) - && !fhirConfig.getLocalFhirStorePath().equals(fhirStorePath)) { + if (!GenericValidator.isBlankOrNull(fhirConfig.getUsername())) { IClientInterceptor authInterceptor = new BasicAuthInterceptor(fhirConfig.getUsername(), fhirConfig.getPassword()); fhirClient.registerInterceptor(authInterceptor); @@ -45,6 +44,11 @@ public IGenericClient getFhirClient(String fhirStorePath) { public IGenericClient getLocalFhirClient() { IGenericClient fhirClient = fhirContext.newRestfulGenericClient(fhirConfig.getLocalFhirStorePath()); + if (!GenericValidator.isBlankOrNull(fhirConfig.getUsername())) { + IClientInterceptor authInterceptor = new BasicAuthInterceptor(fhirConfig.getUsername(), + fhirConfig.getPassword()); + fhirClient.registerInterceptor(authInterceptor); + } return fhirClient; } diff --git a/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirApiWorkFlowServiceImpl.java b/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirApiWorkFlowServiceImpl.java index cc49fad8da..37ef903427 100644 --- a/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirApiWorkFlowServiceImpl.java +++ b/src/main/java/org/openelisglobal/dataexchange/fhir/service/FhirApiWorkFlowServiceImpl.java @@ -4,15 +4,10 @@ import ca.uhn.fhir.rest.api.MethodOutcome; import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.gclient.IQuery; - -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; -import java.util.Locale; import java.util.Map; import java.util.Map.Entry; import java.util.Optional; @@ -90,9 +85,8 @@ public class FhirApiWorkFlowServiceImpl implements FhirApiWorkflowService { private List remoteStoreIdentifier; @Override - @Scheduled(initialDelay = 10 * 1000, fixedRateString="${org.openelisglobal.remote.poll.frequency:120000}") + @Scheduled(initialDelay = 10 * 1000, fixedRateString = "${org.openelisglobal.remote.poll.frequency:120000}") public void pollForRemoteTasks() { - System.out.println(System.currentTimeMillis()); processWorkflow(ResourceType.Task); } @@ -481,7 +475,7 @@ private void processTaskImportOrder(Task remoteTask, String remoteStorePath, IGe remoteTask.setStatus(taskStatus); sourceFhirClient.update().resource(remoteTask).execute(); } - IGenericClient localFhirClient = fhirContext.newRestfulGenericClient(localFhirStorePath); + IGenericClient localFhirClient = fhirUtil.getFhirClient(localFhirStorePath); localFhirClient.update().resource(localObjects.task).execute(); // taskBasedOnRemoteTask.setStatus(taskStatus); // localFhirClient.update().resource(taskBasedOnRemoteTask).execute();