Skip to content

Commit

Permalink
Add FHIR IG importer to platform
Browse files Browse the repository at this point in the history
  • Loading branch information
drizzentic committed Apr 24, 2024
1 parent 9b5ff1a commit 93b6561
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 2 deletions.
16 changes: 16 additions & 0 deletions fhir-ig-importer/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '3.9'

services:
fhir-ig-importer-mediator:
ports:
- target: 3333
published: 3333
mode: host
fhir-ig-importer-ui:
ports:
- target: 8080
published: 3000
mode: host
- target: 8081
published: 3003
mode: host
36 changes: 36 additions & 0 deletions fhir-ig-importer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
version: '3.9'

services:
fhir-ig-importer-mediator:
image: jembi/fhir-ig-importer-mediator:${FHIR_IG_IMPORTER_CORE_VERSION}
networks:
ig-importer-network:
hapi-fhir:
deploy:
replicas: ${FHIR_IG_IMPORTER_CORE_INSTANCES}
placement:
max_replicas_per_node: 1
environment:
HAPI_FHIR_BASE_URL: ${HAPI_FHIR_BASE_URL}
HAPI_FHIR_INSTANCES: ${HAPI_FHIR_INSTANCES}
FHIR_IG_IMPORTER_CORE_PORT: ${FHIR_IG_IMPORTER_CORE_PORT}
FHIR_IG_IMPORTER_CORE_HOST: ${FHIR_IG_IMPORTER_CORE_HOST}

fhir-ig-importer-ui:
image: jembi/fhir-ig-importer-ui:${FHIR_IG_IMPORTER_UI_VERSION}
networks:
ig-importer-network:
hapi-fhir:
deploy:
replicas: ${FHIR_IG_IMPORTER_UI_INSTANCES}
placement:
max_replicas_per_node: 1
environment:
FHIR_IG_IMPORTER_CORE_URL: ${FHIR_IG_IMPORTER_CORE_URL}
networks:
ig-importer-network:
name: ig-importer-network
hapi-fhir:
name: hapi-fhir_public
external: true

19 changes: 19 additions & 0 deletions fhir-ig-importer/package-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"id": "fhir-ig-importer",
"name": "FHIR IG Importer",
"description": "The package provides mechanism of loading a fhir IG and deploying to the fhir server. The package has a microfrontend and mediator app",
"type": "infrastructure",
"version": "0.0.1",
"dependencies": ["interoperability-layer-openhim"],
"environmentVariables": {
"HAPI_FHIR_BASE_URL": "http://localhost:3447/fhir",
"HAPI_FHIR_INSTANCES": 1,
"FHIR_IG_IMPORTER_CORE_PORT": 3333,
"FHIR_IG_IMPORTER_CORE_HOST": "localhost",
"FHIR_IG_IMPORTER_CORE_URL": "http://localhost:3333/fhir/ig/v1.0",
"FHIR_IG_IMPORTER_UI_VERSION": "latest",
"FHIR_IG_IMPORTER_CORE_VERSION": "latest",
"FHIR_IG_IMPORTER_UI_INSTANCES": 1,
"FHIR_IG_IMPORTER_CORE_INSTANCES": 1
}
}
77 changes: 77 additions & 0 deletions fhir-ig-importer/swarm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash

declare ACTION=""
declare MODE=""
declare COMPOSE_FILE_PATH=""
declare UTILS_PATH=""
declare STACK="fhir-ig-importer"

function init_vars() {
ACTION=$1
MODE=$2

COMPOSE_FILE_PATH=$(
cd "$(dirname "${BASH_SOURCE[0]}")" || exit
pwd -P
)
UTILS_PATH="${COMPOSE_FILE_PATH}/../utils"
readonly ACTION
readonly MODE
readonly COMPOSE_FILE_PATH
readonly UTILS_PATH
readonly STACK
}
# shellcheck disable=SC1091
function import_sources() {
source "${UTILS_PATH}/docker-utils.sh"
source "${UTILS_PATH}/config-utils.sh"
source "${UTILS_PATH}/log.sh"
}

function initialize_package() {
local fhir_ig_importer_dev_compose_filename=""

if [[ "${MODE}" == "dev" ]]; then
log info "Running package in DEV mode"
fhir_ig_importer_dev_compose_filename="docker-compose.dev.yml"
else
log info "Running package in PROD mode"
fi

(
docker::deploy_service "$STACK" "${COMPOSE_FILE_PATH}" "docker-compose.yml" "$fhir_ig_importer_dev_compose_filename"
) || {
log error "Failed to deploy package"
exit 1
}
}

function destroy_package() {
docker::stack_destroy "$STACK"
}

main() {
init_vars "$@"
import_sources

if [[ "${ACTION}" == "init" ]] || [[ "${ACTION}" == "up" ]]; then
if [[ "${CLUSTERED_MODE}" == "true" ]]; then
log info "Running package in Cluster node mode"
else
log info "Running package in Single node mode"
fi

initialize_package
elif [[ "${ACTION}" == "down" ]]; then
log info "Scaling down package"

docker::scale_services "$STACK" 0
elif [[ "${ACTION}" == "destroy" ]]; then
log info "Destroying package"
destroy_package
else
log error "Valid options are: init, up, down, or destroy"
fi
}

main "$@"
4 changes: 2 additions & 2 deletions interoperability-layer-openhim/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3.9"

services:
openhim-core:
image: jembi/openhim-core:v8.4.0
image: jembi/openhim-core:poc
networks:
kafka:
hapi-fhir:
Expand Down Expand Up @@ -39,7 +39,7 @@ services:
- prometheus-port=8080

openhim-console:
image: ${OPENHIM_CONSOLE_VERSION}
image: drono/openhim-console-mf:test
environment:
OPENHIM_CORE_MEDIATOR_HOSTNAME: ${OPENHIM_CORE_MEDIATOR_HOSTNAME}
OPENHIM_MEDIATOR_API_PORT: ${OPENHIM_MEDIATOR_API_PORT}
Expand Down

0 comments on commit 93b6561

Please sign in to comment.