Skip to content

Commit

Permalink
Merge pull request #290 from ItsMurumba/TB-408
Browse files Browse the repository at this point in the history
Adds Reprocess package (UI + Mediator)
  • Loading branch information
bradsawadye authored May 15, 2024
2 parents 44a566b + 3f8693a commit 5ba58ca
Show file tree
Hide file tree
Showing 7 changed files with 149 additions and 11 deletions.
8 changes: 1 addition & 7 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ packages:
- identity-access-manager-keycloak
- openhim-mapping-mediator
- database-postgres
- reprocess-mediator
- fhir-ig-importer

profiles:
Expand Down Expand Up @@ -75,10 +76,3 @@ profiles:
envFiles:
- mpi.env

- name: test-recipe
packages:
- fhir-ig-importer
- kafka-mapper-consumer
envFiles:
- cdr-dw.env
dev: true
7 changes: 3 additions & 4 deletions documentation/recipes/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

---
description: Pre-defined recipes for common use cases
---

# 📜 Recipes

OpenHIM platform comes bundles with a set of generic packages that can be deployed and configured to support a number of different use cases. To help users of OpenHIM Platform get started with something they can make use of immediately, a number of default OpenHIM Platform reciepes are provided. These help you get started with everything you need setup and configured for a particular use case.

We current support the following default recipes:

OpenHIM platform comes bundled with a set of generic packages that can be deployed and configured to support a number of different use cases. To help users of OpenHIM Platform get started with something they can make use of immediately, a number of default OpenHIM Platform recipes are provided. These help you get started with everything you need setup and configured for a particular use case.

We currently support the following default recipes:

<table data-view="cards"><thead><tr><th align="center"></th><th></th><th data-hidden></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><strong>Central Data Repository with Data Warehouse</strong></td><td>A FHIR-based Shared Health record linked to an MPI for linking and matching patient demographics and a default reporting pipeline to transform and visualise FHIR data.</td><td></td><td><a href="central-data-repository-with-data-warehousing.md">central-data-repository-with-data-warehousing.md</a></td></tr><tr><td align="center"><strong>Central Data Repository</strong></td><td>A FHIR-based Shared Health record linked to an MPI for linking and matching patient demographics. No reporting is include but all FHIR data is pushed to Kafka for external system to use.</td><td></td><td><a href="central-data-repository-no-reporting.md">central-data-repository-no-reporting.md</a></td></tr><tr><td align="center"><strong>Master Patient Index</strong></td><td>A master patient index setup using JeMPI. it also includes OpenHIM as the API gateway providing security, a mapping mediator to allow FHIR-based communication with JeMPI and Keycloak to support user management.</td><td></td><td><a href="master-patient-index.md">master-patient-index.md</a></td></tr></tbody></table>
5 changes: 5 additions & 0 deletions interoperability-layer-openhim/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
public:
default:
prometheus:
reprocess:
environment:
- mongo_url=${OPENHIM_MONGO_URL}
- mongo_atnaUrl=${OPENHIM_MONGO_ATNAURL}
Expand All @@ -22,6 +23,7 @@ services:
- api_openid_callbackUrl=${KC_OPENHIM_ROOT_URL}
- api_openid_clientId=${KC_OPENHIM_CLIENT_ID}
- api_openid_clientSecret=${KC_OPENHIM_CLIENT_SECRET}
- openhimConsoleBaseUrl=${OPENHIM_CONSOLE_BASE_URL}
deploy:
replicas: ${OPENHIM_CORE_INSTANCES}
placement:
Expand Down Expand Up @@ -84,4 +86,7 @@ networks:
prometheus:
name: prometheus_public
external: true
reprocess:
name: reprocess_public
external: true
default:
14 changes: 14 additions & 0 deletions reprocess-mediator/docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3.9'

services:
reprocess-mediator:
ports:
- target: 3000
published: 3000
mode: host

reprocess-mediator-ui:
ports:
- target: 80
published: 3030
mode: host
31 changes: 31 additions & 0 deletions reprocess-mediator/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: '3.9'

services:
reprocess-mediator:
image: jembi/reprocess-mediator:${REPROCESS_CORE_VERSION}
networks:
openhim:
reprocess:
environment:
TRUST_SELF_SIGNED: ${TRUST_SELF_SIGNED}
OPENHIM_MEDIATOR_URL: ${OPENHIM_MEDIATOR_URL}
OPENHIM_USERNAME: ${OPENHIM_USERNAME}
OPENHIM_PASSWORD: ${OPENHIM_PASSWORD}
REGISTER_MEDIATOR: ${REGISTER_MEDIATOR}

reprocess-mediator-ui:
image: jembi/reprocess-mediator-ui:${REPROCESS_UI_VERSION}
networks:
openhim:
reprocess:
environment:
REPROCESSOR_API_BASE_URL: ${REPROCESSOR_API_BASE_URL}

networks:
openhim:
name: openhim_public
external: true
reprocess:
name: reprocess_public
external: true

18 changes: 18 additions & 0 deletions reprocess-mediator/package-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"id": "reprocess-mediator",
"name": "Reprocess Mediator",
"description": "A mediator that allows for configuring and reprocessing of transactions",
"type": "use-case",
"version": "1.4.2",
"dependencies": ["interoperability-layer-openhim"],
"environmentVariables": {
"TRUST_SELF_SIGNED": "true",
"OPENHIM_MEDIATOR_URL": "https://openhim-core:8080",
"OPENHIM_USERNAME": "[email protected]",
"OPENHIM_PASSWORD": "instant101",
"REGISTER_MEDIATOR": "true",
"REPROCESSOR_API_BASE_URL": "http://reprocess-mediator:3000",
"REPROCESS_CORE_VERSION": "latest",
"REPROCESS_UI_VERSION": "latest"
}
}
77 changes: 77 additions & 0 deletions reprocess-mediator/swarm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash

declare ACTION=""
declare COMPOSE_FILE_PATH=""
declare UTILS_PATH=""
declare STACK="reprocess-mediator"
declare MODE=""

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 COMPOSE_FILE_PATH
readonly UTILS_PATH
readonly STACK
readonly MODE
}

# shellcheck disable=SC1091
function import_sources() {
source "${UTILS_PATH}/docker-utils.sh"
source "${UTILS_PATH}/log.sh"
}

function initialize_package() {
local reprocess_dev_compose_filename=""

if [[ "${MODE}" == "dev" ]]; then
log info "Running package in DEV mode"
reprocess_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" "$reprocess_dev_compose_filename"
) || {
log error "Failed to deploy package"
exit 1
}
}

function destroy_package() {
docker::stack_destroy $STACK

docker::prune_configs "reprocess-mediator"
}

main() {
init_vars "$@"
import_sources

if [[ "${ACTION}" == "init" ]] || [[ "${ACTION}" == "up" ]]; then
log info "Running package"

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 "$@"

0 comments on commit 5ba58ca

Please sign in to comment.