From 116d46673df97bcda9de27f19886d0e12dc1c997 Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Tue, 23 Apr 2024 11:21:11 +0200 Subject: [PATCH 1/9] add bootstrapper service config --- .../docker-compose.combined.yml | 16 ++++++++++++++++ client-registry-jempi/package-metadata.json | 4 +++- client-registry-jempi/swarm.sh | 7 +++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/client-registry-jempi/docker-compose.combined.yml b/client-registry-jempi/docker-compose.combined.yml index 02a239cf..1ebab66d 100644 --- a/client-registry-jempi/docker-compose.combined.yml +++ b/client-registry-jempi/docker-compose.combined.yml @@ -99,6 +99,22 @@ services: kafka: default: + jempi-bootstrapper: + image: jembi/jempi-bootstrapper:${JEMPI_BOOTSTRAPPER_IMAGE_TAG} + environment: + POSTGRESQL_IP: ${JEMPI_REPMGR_PRIMARY_HOST} + POSTGRESQL_PORT: 5432 + POSTGRESQL_USER: ${POSTGRESQL_USERNAME} + POSTGRESQL_PASSWORD: ${POSTGRESQL_PASSWORD} + POSTGRESQL_DATABASE: ${POSTGRESQL_DATABASE} + POSTGRESQL_USERS_DB: ${POSTGRESQL_USERS_DB} + POSTGRESQL_NOTIFICATIONS_DB: ${POSTGRESQL_NOTIFICATIONS_DB} + POSTGRESQL_AUDIT_DB: ${POSTGRESQL_AUDIT_DB} + POSTGRESQL_KC_TEST_DB: ${POSTGRESQL_KC_TEST_DB} + KAFKA_BOOTSTRAP_SERVERS: ${KAFKA_HOSTS} + KAFKA_APPLICATION_ID: ${KAFKA_APPLICATION_ID_BOOTSTRAPPER} + DGRAPH_HOSTS: ${DGRAPH_HOSTS} + DGRAPH_PORTS: ${DGRAPH_PORTS} jempi-postgresql-01: image: bitnami/postgresql-repmgr:15.2.0 diff --git a/client-registry-jempi/package-metadata.json b/client-registry-jempi/package-metadata.json index 6b0f40de..114fb314 100644 --- a/client-registry-jempi/package-metadata.json +++ b/client-registry-jempi/package-metadata.json @@ -85,6 +85,8 @@ "KAFKA_CLIENT_ID_ASYNC": "client-id-syncrx", "KAFKA_APPLICATION_ID_ETL": "app-id-etl", "KAFKA_APPLICATION_ID_CTRL": "app-id-ctrl", - "KAFKA_CLIENT_ID_CTRL": "client-id-ctrl" + "KAFKA_CLIENT_ID_CTRL": "client-id-ctrl", + "KAFKA_APPLICATION_ID_BOOTSTRAPPER": "app-id-bootstrapper", + "JEMPI_BOOTSTRAPPER_IMAGE_TAG": "1.0.0-beta1" } } diff --git a/client-registry-jempi/swarm.sh b/client-registry-jempi/swarm.sh index cb556585..c05d8f38 100644 --- a/client-registry-jempi/swarm.sh +++ b/client-registry-jempi/swarm.sh @@ -73,6 +73,13 @@ function initialize_package() { log info "Deploy other combined services" docker::deploy_service $STACK "${COMPOSE_FILE_PATH}" "docker-compose.combined.yml" "$combined_dev_compose_param" "$combined_cluster_compose_param" + log info "initiate bootstrapper data resetAll" + if docker service ps -q jempi_jempi-bootstrapper &>/dev/null; then + try "docker exec -i $(docker ps -q -f name=jempi_jempi-bootstrapper) ./bootstrapper.sh data resetAll" throw "Could not initiate bootstrapper " + else + log warn "Service 'jempi bootstrapper' does not appear to be running" + fi + log info "Deploy JeMPI API" docker::deploy_service $STACK "${COMPOSE_FILE_PATH}" "docker-compose.api.yml" "$api_dev_compose_param" From 2257165adcb2f12e66a2b27cb0085a508ea85a4a Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Tue, 23 Apr 2024 11:24:14 +0200 Subject: [PATCH 2/9] update bootstrapper config with kc test db --- client-registry-jempi/docker-compose.combined.yml | 3 +++ client-registry-jempi/package-metadata.json | 6 +++++- client-registry-jempi/swarm.sh | 14 +++++++------- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/client-registry-jempi/docker-compose.combined.yml b/client-registry-jempi/docker-compose.combined.yml index 1ebab66d..740218d4 100644 --- a/client-registry-jempi/docker-compose.combined.yml +++ b/client-registry-jempi/docker-compose.combined.yml @@ -115,6 +115,9 @@ services: KAFKA_APPLICATION_ID: ${KAFKA_APPLICATION_ID_BOOTSTRAPPER} DGRAPH_HOSTS: ${DGRAPH_HOSTS} DGRAPH_PORTS: ${DGRAPH_PORTS} + networks: + kafka: + default: jempi-postgresql-01: image: bitnami/postgresql-repmgr:15.2.0 diff --git a/client-registry-jempi/package-metadata.json b/client-registry-jempi/package-metadata.json index 114fb314..caf8c8cd 100644 --- a/client-registry-jempi/package-metadata.json +++ b/client-registry-jempi/package-metadata.json @@ -60,7 +60,11 @@ "KC_JEMPI_CLIENT_ID": "jempi-oauth", "KC_JEMPI_CLIENT_SECRET": "Tbe3llP5OJIlqUjz7K1wPp8YDAdCOEMn", "KC_JEMPI_ROOT_URL": "http://localhost:3033", - "POSTGRESQL_DATABASE": "notifications", + "POSTGRESQL_USERS_DB": "users_db", + "POSTGRESQL_NOTIFICATIONS_DB": "notifications_db", + "POSTGRESQL_AUDIT_DB": "audit_db", + "POSTGRESQL_KC_TEST_DB": "kc_test_db", + "POSTGRESQL_DATABASE": "postgres", "POSTGRESQL_USERNAME": "postgres", "JEMPI_REPMGR_PASSWORD": "dev_password_only", "JEMPI_REPMGR_PRIMARY_HOST": "jempi-postgresql-01", diff --git a/client-registry-jempi/swarm.sh b/client-registry-jempi/swarm.sh index c05d8f38..28c40611 100644 --- a/client-registry-jempi/swarm.sh +++ b/client-registry-jempi/swarm.sh @@ -73,13 +73,6 @@ function initialize_package() { log info "Deploy other combined services" docker::deploy_service $STACK "${COMPOSE_FILE_PATH}" "docker-compose.combined.yml" "$combined_dev_compose_param" "$combined_cluster_compose_param" - log info "initiate bootstrapper data resetAll" - if docker service ps -q jempi_jempi-bootstrapper &>/dev/null; then - try "docker exec -i $(docker ps -q -f name=jempi_jempi-bootstrapper) ./bootstrapper.sh data resetAll" throw "Could not initiate bootstrapper " - else - log warn "Service 'jempi bootstrapper' does not appear to be running" - fi - log info "Deploy JeMPI API" docker::deploy_service $STACK "${COMPOSE_FILE_PATH}" "docker-compose.api.yml" "$api_dev_compose_param" @@ -93,6 +86,13 @@ function initialize_package() { log warn "Service 'interoperability-layer-openhim' does not appear to be running... skipping configuring of async/sync JeMPI channels" fi + log info "initiate bootstrapper data resetAll" + if docker service ps -q jempi_jempi-bootstrapper &>/dev/null; then + try "docker exec -i $(docker ps -q -f name=jempi_jempi-bootstrapper) ./bootstrapper.sh data resetAll" throw "Could not initiate bootstrapper " + else + log warn "Service 'jempi bootstrapper' does not appear to be running" + fi + ) || { log error "Failed to deploy package" From ec93a858b10cf893339ab3418e28427294562c4e Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Tue, 23 Apr 2024 13:24:26 +0200 Subject: [PATCH 3/9] update jempi image tags and readme --- client-registry-jempi/README.md | 19 +++-- .../searchAllProbabilisticResponse.json | 2 +- .../mapping-mediator/searchAllResponse.json | 2 +- .../mapping-mediator/update-response.json | 78 +++++++++---------- client-registry-jempi/package-metadata.json | 16 ++-- 5 files changed, 60 insertions(+), 57 deletions(-) diff --git a/client-registry-jempi/README.md b/client-registry-jempi/README.md index acc247ae..21fbad23 100644 --- a/client-registry-jempi/README.md +++ b/client-registry-jempi/README.md @@ -1,10 +1,9 @@ - # JeMPI Client Registry Component - docker-swarm This component consists of two services: -* JeMPI Web UI - http://localhost:3033 -* JeMPI API - http://localhost:50000/JeMPI +- JeMPI Web UI - http://localhost:3033 +- JeMPI API - http://localhost:50000/JeMPI ## Api endpoints @@ -15,7 +14,7 @@ This component consists of two services: via the api (in JeMPI format) ```sh -POST - http://localhost:50000/JeMPI/cr-register +POST - http://localhost:50000/JeMPI/crRegister { "candidateThreshold": 0.9, @@ -83,6 +82,7 @@ The `candidateThreshold` can optionally be set in the request query. The default ] } ``` + > The identifier with the system 'NationalID' maps to the 'nationalId' property in JeMPI ## Querying a patient by id @@ -90,7 +90,10 @@ The `candidateThreshold` can optionally be set in the request query. The default via the api (returns patient in JeMPI formated) ```sh -GET - http://localhost:50000/JeMPI/expanded-golden-record/ +POST - http://localhost:50000/JeMPI/expandedGoldenRecord +{ + "gid":"" +} ``` via the [mapping mediator](https://github.com/jembi/openhim-mediator-mapping) (returns patient in fhir format) @@ -104,7 +107,7 @@ GET - http://localhost:3003/fhir/Patient/ via the api (in JeMPI format) ```sh -PATCH - http://localhost:50000/JeMPI/cr-update-fields +POST - http://localhost:50000/JeMPI/crUpdateFields { "goldenId": "0x5", @@ -167,7 +170,7 @@ PUT - http://localhost:3003/fhir/Patient/ via the api (returns in JeMPI format) ```sh -POST http://localhost:50000/JeMPI/cr-find +POST http://localhost:50000/JeMPI/crFind { "operand": { @@ -201,7 +204,7 @@ Query parameters - family, given, telecom, identifier, gender, birthDate, addres via the api (in JeMPI format) ```sh -POST - http://localhost:50000/JeMPI/cr-find +POST - http://localhost:50000/JeMPI/crFind { "operand": { diff --git a/client-registry-jempi/importer/mapping-mediator/searchAllProbabilisticResponse.json b/client-registry-jempi/importer/mapping-mediator/searchAllProbabilisticResponse.json index 3b52c67d..8a59ff10 100644 --- a/client-registry-jempi/importer/mapping-mediator/searchAllProbabilisticResponse.json +++ b/client-registry-jempi/importer/mapping-mediator/searchAllProbabilisticResponse.json @@ -66,7 +66,7 @@ "id": "jempiSearchAllProbabilisticResponse", "config": { "method": "post", - "url": "http://jempi-api:50000/JeMPI/cr-find" + "url": "http://jempi-api:50000/JeMPI/crFind" } } ] diff --git a/client-registry-jempi/importer/mapping-mediator/searchAllResponse.json b/client-registry-jempi/importer/mapping-mediator/searchAllResponse.json index 59b3bece..54257b54 100644 --- a/client-registry-jempi/importer/mapping-mediator/searchAllResponse.json +++ b/client-registry-jempi/importer/mapping-mediator/searchAllResponse.json @@ -21,7 +21,7 @@ "forwardExistingRequestBody": true, "config": { "method": "post", - "url": "http://jempi-api:50000/JeMPI/cr-find" + "url": "http://jempi-api:50000/JeMPI/crFind" } } ] diff --git a/client-registry-jempi/importer/mapping-mediator/update-response.json b/client-registry-jempi/importer/mapping-mediator/update-response.json index dba06cba..8757090c 100644 --- a/client-registry-jempi/importer/mapping-mediator/update-response.json +++ b/client-registry-jempi/importer/mapping-mediator/update-response.json @@ -1,43 +1,43 @@ { - "name": "Update Patient Response", - "endpoint": { - "pattern": "/update-patient-response/:patientId", - "method": "POST" - }, - "transformation": { - "input": "JSON", - "output": "JSON" - }, - "inputTransforms": { - "familyName": "$exists(requestBody.name) and $exists(requestBody.name[0]) and $exists(requestBody.name[0].family) ? {'name': 'familyName', 'value': requestBody.name[0].family} : null", - "givenName": "$exists(requestBody.name) and $exists(requestBody.name[0]) and $exists(requestBody.name[0].given) and $exists(requestBody.name[0].given[0]) ? {'name': 'givenName', 'value': requestBody.name[0].given[0]} : null", - "birthDate": "$exists(requestBody.birthDate) ? {'name': 'dob', 'value': requestBody.birthDate} : null", - "gender": "$exists(requestBody.gender) ? {'name': 'gender', 'value': requestBody.gender} : null", - "city": "$exists(requestBody.address) and $exists(requestBody.address[0]) and $exists(requestBody.address[0].city) ? {'name': 'city', 'value': requestBody.address[0].city} : null", - "phoneNumber": "$exists(requestBody.telecom) and $exists(requestBody.telecom[0]) and $exists(requestBody.telecom[0].value) ? {'name': 'phoneNumber', 'value': requestBody.telecom[0].value} : null", - "nationalId": "$exists(requestBody.identifier) and $exists(requestBody.identifier[0]) and $count($filter(requestBody.identifier, function($v) {$contains($v.system, 'NationalID')})) > 0 ? {'name': 'nationalId', 'value': $filter(requestBody.identifier, function($v) {$contains($v.system, 'NationalID')})[0].value} : null" - }, - "inputMapping": { - "urlParams.patientId": "goldenId", - "transforms.familyName": "fields[]+", - "transforms.givenName": "fields[]+", - "transforms.birthDate": "fields[]+", - "transforms.gender": "fields[]+", - "transforms.city": "fields[]+", - "transforms.phoneNumber": "fields[]+", - "transforms.nationalId": "fields[]+" - }, - "requests": { - "response": { - "id": "jempiUpdateResponse", - "primary": true, - "config": { - "method": "patch", - "headers": { - "contentType": "application/json" - }, - "url": "http://jempi-api:50000/JeMPI/cr-update-fields" - } + "name": "Update Patient Response", + "endpoint": { + "pattern": "/update-patient-response/:patientId", + "method": "POST" + }, + "transformation": { + "input": "JSON", + "output": "JSON" + }, + "inputTransforms": { + "familyName": "$exists(requestBody.name) and $exists(requestBody.name[0]) and $exists(requestBody.name[0].family) ? {'name': 'familyName', 'value': requestBody.name[0].family} : null", + "givenName": "$exists(requestBody.name) and $exists(requestBody.name[0]) and $exists(requestBody.name[0].given) and $exists(requestBody.name[0].given[0]) ? {'name': 'givenName', 'value': requestBody.name[0].given[0]} : null", + "birthDate": "$exists(requestBody.birthDate) ? {'name': 'dob', 'value': requestBody.birthDate} : null", + "gender": "$exists(requestBody.gender) ? {'name': 'gender', 'value': requestBody.gender} : null", + "city": "$exists(requestBody.address) and $exists(requestBody.address[0]) and $exists(requestBody.address[0].city) ? {'name': 'city', 'value': requestBody.address[0].city} : null", + "phoneNumber": "$exists(requestBody.telecom) and $exists(requestBody.telecom[0]) and $exists(requestBody.telecom[0].value) ? {'name': 'phoneNumber', 'value': requestBody.telecom[0].value} : null", + "nationalId": "$exists(requestBody.identifier) and $exists(requestBody.identifier[0]) and $count($filter(requestBody.identifier, function($v) {$contains($v.system, 'NationalID')})) > 0 ? {'name': 'nationalId', 'value': $filter(requestBody.identifier, function($v) {$contains($v.system, 'NationalID')})[0].value} : null" + }, + "inputMapping": { + "urlParams.patientId": "goldenId", + "transforms.familyName": "fields[]+", + "transforms.givenName": "fields[]+", + "transforms.birthDate": "fields[]+", + "transforms.gender": "fields[]+", + "transforms.city": "fields[]+", + "transforms.phoneNumber": "fields[]+", + "transforms.nationalId": "fields[]+" + }, + "requests": { + "response": { + "id": "jempiUpdateResponse", + "primary": true, + "config": { + "method": "post", + "headers": { + "contentType": "application/json" + }, + "url": "http://jempi-api:50000/JeMPI/crUpdateFields" } } } +} diff --git a/client-registry-jempi/package-metadata.json b/client-registry-jempi/package-metadata.json index caf8c8cd..5f987422 100644 --- a/client-registry-jempi/package-metadata.json +++ b/client-registry-jempi/package-metadata.json @@ -33,12 +33,12 @@ "JEMPI_ETL_MEMORY_RESERVE": "500M", "JEMPI_API_INSTANCES": 1, "JEMPI_KAFKA_TOPICS": "JeMPI-async-etl,JeMPI-interaction-controller,JeMPI-interaction-em,JeMPI-interaction-linker,JeMPI-mu-linker,JeMPI-audit-trail,JeMPI-notifications", - "JEMPI_ASYNC_RECEIVER_IMAGE_TAG": "test-recipes", - "JEMPI_CONTROLLER_IMAGE_TAG": "test-recipes", - "JEMPI_LINKER_IMAGE_TAG": "test-recipes", - "JEMPI_API_IMAGE_TAG": "test-recipes", - "JEMPI_API_KC_IMAGE_TAG": "test-recipes", - "JEMPI_ETL_IMAGE_TAG": "test-recipes", + "JEMPI_ASYNC_RECEIVER_IMAGE_TAG": "1.0.1-beta", + "JEMPI_CONTROLLER_IMAGE_TAG": "1.0.1-beta", + "JEMPI_LINKER_IMAGE_TAG": "1.0.1-beta", + "JEMPI_API_IMAGE_TAG": "1.0.1-beta", + "JEMPI_API_KC_IMAGE_TAG": "1.0.1-beta", + "JEMPI_ETL_IMAGE_TAG": "1.0.1-beta", "JEMPI_ASYNC_RECEIVER_INSTANCES": 1, "JEMPI_CONTROLLER_INSTANCES": 1, "JEMPI_LINKER_INSTANCES": 1, @@ -49,7 +49,7 @@ "REACT_APP_JEMPI_BASE_API_HOST": "http://localhost", "REACT_APP_JEMPI_BASE_API_PORT": "50000", "REACT_APP_MOCK_BACKEND": "false", - "JEMPI_WEB_VERSION": "test-recipes", + "JEMPI_WEB_VERSION": "1.0.1-beta", "JEMPI_WEB_INSTANCES": 1, "JEMPI_WEB_MEMORY_LIMIT": "2G", "JEMPI_WEB_MEMORY_RESERVE": "500M", @@ -91,6 +91,6 @@ "KAFKA_APPLICATION_ID_CTRL": "app-id-ctrl", "KAFKA_CLIENT_ID_CTRL": "client-id-ctrl", "KAFKA_APPLICATION_ID_BOOTSTRAPPER": "app-id-bootstrapper", - "JEMPI_BOOTSTRAPPER_IMAGE_TAG": "1.0.0-beta1" + "JEMPI_BOOTSTRAPPER_IMAGE_TAG": "1.0.1-beta" } } From 03c5eb26122af3bf7cc4d6920ef9a27acf77661c Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Tue, 23 Apr 2024 15:27:24 +0200 Subject: [PATCH 4/9] update jempi config for notification and audit db --- client-registry-jempi/docker-compose.api.yml | 11 +++++++++-- client-registry-jempi/docker-compose.combined.yml | 6 ++++++ client-registry-jempi/swarm.sh | 12 +++++++----- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/client-registry-jempi/docker-compose.api.yml b/client-registry-jempi/docker-compose.api.yml index e5a0da2b..4cf156de 100644 --- a/client-registry-jempi/docker-compose.api.yml +++ b/client-registry-jempi/docker-compose.api.yml @@ -7,9 +7,10 @@ services: LOG4J2_LEVEL: ${LOG4J2_LEVEL} POSTGRESQL_IP: ${JEMPI_REPMGR_PRIMARY_HOST} POSTGRESQL_PORT: 5432 - POSTGRESQL_DATABASE: ${POSTGRESQL_DATABASE} POSTGRESQL_USER: ${POSTGRESQL_USERNAME} POSTGRESQL_PASSWORD: ${POSTGRESQL_PASSWORD} + POSTGRESQL_NOTIFICATIONS_DB: ${POSTGRESQL_NOTIFICATIONS_DB} + POSTGRESQL_AUDIT_DB: ${POSTGRESQL_AUDIT_DB} KAFKA_BOOTSTRAP_SERVERS: ${KAFKA_HOSTS} KAFKA_APPLICATION_ID: ${KAFKA_APPLICATION_ID_API} DGRAPH_HOSTS: ${DGRAPH_HOSTS} @@ -17,6 +18,8 @@ services: API_HTTP_PORT: 50000 LINKER_IP: jempi-linker LINKER_HTTP_PORT: 50000 + CONTROLLER_IP: jempi-controller + CONTROLLER_HTTP_PORT: 50000 volumes: - "jempi-shared-data:/app/csv" deploy: @@ -47,9 +50,11 @@ services: JEMPI_SESSION_DOMAIN_NAME: ${JEMPI_SESSION_DOMAIN_NAME} POSTGRESQL_IP: ${JEMPI_REPMGR_PRIMARY_HOST} POSTGRESQL_PORT: 5432 - POSTGRESQL_DATABASE: ${POSTGRESQL_DATABASE} POSTGRESQL_USER: ${POSTGRESQL_USERNAME} POSTGRESQL_PASSWORD: ${POSTGRESQL_PASSWORD} + POSTGRESQL_USERS_DB: ${POSTGRESQL_USERS_DB} + POSTGRESQL_NOTIFICATIONS_DB: ${POSTGRESQL_NOTIFICATIONS_DB} + POSTGRESQL_AUDIT_DB: ${POSTGRESQL_AUDIT_DB} KAFKA_BOOTSTRAP_SERVERS: ${KAFKA_HOSTS} KAFKA_APPLICATION_ID: ${KAFKA_APPLICATION_ID_API} DGRAPH_HOSTS: ${DGRAPH_HOSTS} @@ -57,6 +62,8 @@ services: API_KC_HTTP_PORT: 50000 LINKER_IP: jempi-linker LINKER_HTTP_PORT: 50000 + CONTROLLER_IP: jempi-controller + CONTROLLER_HTTP_PORT: 50000 volumes: - "jempi-shared-data:/app/csv" deploy: diff --git a/client-registry-jempi/docker-compose.combined.yml b/client-registry-jempi/docker-compose.combined.yml index 740218d4..3bca3f1e 100644 --- a/client-registry-jempi/docker-compose.combined.yml +++ b/client-registry-jempi/docker-compose.combined.yml @@ -48,6 +48,10 @@ services: POSTGRESQL_DATABASE: ${POSTGRESQL_DATABASE} POSTGRESQL_USER: ${POSTGRESQL_USERNAME} POSTGRESQL_PASSWORD: ${POSTGRESQL_PASSWORD} + POSTGRESQL_NOTIFICATIONS_DB: ${POSTGRESQL_NOTIFICATIONS_DB} + POSTGRESQL_AUDIT_DB: ${POSTGRESQL_AUDIT_DB} + DGRAPH_HOSTS: ${DGRAPH_HOSTS} + DGRAPH_PORTS: ${DGRAPH_PORTS} KAFKA_BOOTSTRAP_SERVERS: ${KAFKA_HOSTS} KAFKA_APPLICATION_ID: ${KAFKA_APPLICATION_ID_CTRL} KAFKA_CLIENT_ID: ${KAFKA_CLIENT_ID_CTRL} @@ -77,6 +81,8 @@ services: POSTGRESQL_DATABASE: ${POSTGRESQL_DATABASE} POSTGRESQL_USER: ${POSTGRESQL_USERNAME} POSTGRESQL_PASSWORD: ${POSTGRESQL_PASSWORD} + POSTGRESQL_NOTIFICATIONS_DB: ${POSTGRESQL_NOTIFICATIONS_DB} + POSTGRESQL_AUDIT_DB: ${POSTGRESQL_AUDIT_DB} KAFKA_BOOTSTRAP_SERVERS: ${KAFKA_HOSTS} KAFKA_APPLICATION_ID_INTERACTIONS: ${KAFKA_APPLICATION_ID_INTERACTIONS} KAFKA_APPLICATION_ID_MU: ${KAFKA_APPLICATION_ID_MU} diff --git a/client-registry-jempi/swarm.sh b/client-registry-jempi/swarm.sh index 28c40611..d1323691 100644 --- a/client-registry-jempi/swarm.sh +++ b/client-registry-jempi/swarm.sh @@ -86,11 +86,13 @@ function initialize_package() { log warn "Service 'interoperability-layer-openhim' does not appear to be running... skipping configuring of async/sync JeMPI channels" fi - log info "initiate bootstrapper data resetAll" - if docker service ps -q jempi_jempi-bootstrapper &>/dev/null; then - try "docker exec -i $(docker ps -q -f name=jempi_jempi-bootstrapper) ./bootstrapper.sh data resetAll" throw "Could not initiate bootstrapper " - else - log warn "Service 'jempi bootstrapper' does not appear to be running" + if [[ "${ACTION}" == "init" ]]; then + log info "initiate bootstrapper data resetAll" + if docker service ps -q jempi_jempi-bootstrapper &>/dev/null; then + try "docker exec -i $(docker ps -q -f name=jempi_jempi-bootstrapper) ./bootstrapper.sh data resetAll" throw "Could not initiate bootstrapper " + else + log warn "Service 'jempi bootstrapper' does not appear to be running" + fi fi ) || From 38799a61379f7e02d2b1e07f16cba3b6a3ba242e Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Tue, 23 Apr 2024 15:27:56 +0200 Subject: [PATCH 5/9] update jempi mapping endpoint config --- .../docker-compose.config.yml | 7 +++++ .../patientLinksInteractionResponse.json | 27 +++++++++++++++++++ .../patientLinksResponse.json | 15 ++++++----- .../mapping-mediator/register-response.json | 2 +- 4 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 client-registry-jempi/importer/mapping-mediator/patientLinksInteractionResponse.json diff --git a/client-registry-jempi/importer/mapping-mediator/docker-compose.config.yml b/client-registry-jempi/importer/mapping-mediator/docker-compose.config.yml index 361e16e9..d785853e 100644 --- a/client-registry-jempi/importer/mapping-mediator/docker-compose.config.yml +++ b/client-registry-jempi/importer/mapping-mediator/docker-compose.config.yml @@ -23,6 +23,8 @@ services: target: /searchAll.json - source: mediator-config-patientLinks.json target: /patientLinks.json + - source: mediator-config-patientLinksInteractionResponse.json + target: /patientLinksInteractionResponse.json - source: mediator-config-patientLinksResponse.json target: /patientLinksResponse.json - source: mediator-config-searchAllResponse.json @@ -77,6 +79,11 @@ configs: name: mediator-config-patientLinks.json-${mediator_config_patientLinks_json_DIGEST:?err} labels: name: jempi + mediator-config-patientLinksInteractionResponse.json: + file: ./patientLinksInteractionResponse.json + name: mediator-config-patientLinksInteractionResponse.json-${mediator_config_patientLinksInteractionResponse_json_DIGEST:?err} + labels: + name: jempi mediator-config-patientLinksResponse.json: file: ./patientLinksResponse.json name: mediator-config-patientLinksResponse.json-${mediator_config_patientLinksResponse_json_DIGEST:?err} diff --git a/client-registry-jempi/importer/mapping-mediator/patientLinksInteractionResponse.json b/client-registry-jempi/importer/mapping-mediator/patientLinksInteractionResponse.json new file mode 100644 index 00000000..9ae15179 --- /dev/null +++ b/client-registry-jempi/importer/mapping-mediator/patientLinksInteractionResponse.json @@ -0,0 +1,27 @@ +{ + "name": "Get patient links interaction response", + "endpoint": { + "pattern": "/response/links/interaction/:interactionId", + "method": "GET" + }, + "transformation": { + "input": "JSON", + "output": "JSON" + }, + "inputTransforms": { + "urlParams.interactionId": "uidList[]+" + }, + "requests": { + "response": { + "id": "jempiSearchGoldenId", + "primary": true, + "config": { + "method": "post", + "headers": { + "contentType": "application/json" + }, + "url": "http://jempi-api:50000/JeMPI/expandedInteractionsCsv" + } + } + } +} diff --git a/client-registry-jempi/importer/mapping-mediator/patientLinksResponse.json b/client-registry-jempi/importer/mapping-mediator/patientLinksResponse.json index 7ffd8cb8..9c067e69 100644 --- a/client-registry-jempi/importer/mapping-mediator/patientLinksResponse.json +++ b/client-registry-jempi/importer/mapping-mediator/patientLinksResponse.json @@ -1,5 +1,5 @@ { - "name": "Get patient links response", + "name": "Get interaction links response", "endpoint": { "pattern": "/response/links/:patientId", "method": "GET" @@ -11,12 +11,15 @@ "inputTransforms": { "goldenId": "$exists(lookupRequests.jempiSearchGoldenId.data[0].goldenRecordsWithScore[0].goldenRecord.uid) ? lookupRequests.jempiSearchGoldenId.data[0].goldenRecordsWithScore[0].goldenRecord.uid : ''" }, + "inputMapping": { + "transforms.goldenId": "gid" + }, "requests": { "response": { "id": "jempiSearchResponse", "config": { - "method": "get", - "url": "http://jempi-api:50000/JeMPI/expanded-golden-record/:goldenId", + "method": "post", + "url": "http://jempi-api:50000/JeMPI/expandedGoldenRecord", "params": { "url": { "goldenId": { @@ -30,10 +33,10 @@ "id": "jempiSearchGoldenId", "config": { "method": "get", - "url": "http://jempi-api:50000/JeMPI/expanded-interactions-csv", + "url": "http://openhim-mapping-mediator:3003/response/links/interaction/:patientId", "params": { - "query": { - "uidList": { + "url": { + "patientId": { "path": "urlParams.patientId" } } diff --git a/client-registry-jempi/importer/mapping-mediator/register-response.json b/client-registry-jempi/importer/mapping-mediator/register-response.json index be9d87a1..ecc21a54 100644 --- a/client-registry-jempi/importer/mapping-mediator/register-response.json +++ b/client-registry-jempi/importer/mapping-mediator/register-response.json @@ -37,7 +37,7 @@ "headers": { "contentType": "application/fhir+json" }, - "url": "http://jempi-api:50000/JeMPI/link-interaction" + "url": "http://jempi-api:50000/JeMPI/crLink" } } } From 864b267f40df38daf0f68ea499d7245272abfa0d Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Tue, 23 Apr 2024 16:21:02 +0200 Subject: [PATCH 6/9] rename interactionid param to patientid --- .../mapping-mediator/patientLinksInteractionResponse.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client-registry-jempi/importer/mapping-mediator/patientLinksInteractionResponse.json b/client-registry-jempi/importer/mapping-mediator/patientLinksInteractionResponse.json index 9ae15179..fed3fe5b 100644 --- a/client-registry-jempi/importer/mapping-mediator/patientLinksInteractionResponse.json +++ b/client-registry-jempi/importer/mapping-mediator/patientLinksInteractionResponse.json @@ -1,7 +1,7 @@ { "name": "Get patient links interaction response", "endpoint": { - "pattern": "/response/links/interaction/:interactionId", + "pattern": "/response/links/interaction/:patientId", "method": "GET" }, "transformation": { @@ -9,7 +9,7 @@ "output": "JSON" }, "inputTransforms": { - "urlParams.interactionId": "uidList[]+" + "urlParams.patientId": "uidList[]+" }, "requests": { "response": { From 81f8c64980ac826711d15d8d2b1dfeba395201c1 Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Tue, 23 Apr 2024 16:21:14 +0200 Subject: [PATCH 7/9] create fhir/links channel --- .../importer/openhim/openhim-import.json | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/client-registry-jempi/importer/openhim/openhim-import.json b/client-registry-jempi/importer/openhim/openhim-import.json index 7e49269b..ea515949 100644 --- a/client-registry-jempi/importer/openhim/openhim-import.json +++ b/client-registry-jempi/importer/openhim/openhim-import.json @@ -62,6 +62,68 @@ "id": "6527e7676dec203bde9f2aeb", "name": "Super User" } + }, + { + "name": "MPI Mediator - Links", + "urlPattern": "^/fhir/links.*$", + "isAsynchronousProcess": false, + "methods": [ + "GET", + "POST", + "DELETE", + "PUT", + "OPTIONS", + "HEAD", + "TRACE", + "CONNECT", + "PATCH" + ], + "type": "http", + "tcpPort": null, + "tcpHost": null, + "pollingSchedule": null, + "requestBody": true, + "responseBody": true, + "allow": ["instant"], + "whitelist": [], + "authType": "private", + "routes": [ + { + "name": "Generic Mapping Mediator", + "type": "http", + "status": "enabled", + "secured": false, + "host": "openhim-mapping-mediator", + "port": 3003, + "path": "", + "pathTransform": "", + "primary": true, + "username": "", + "password": "", + "forwardAuthHeader": false + } + ], + "matchContentTypes": [], + "matchContentRegex": null, + "matchContentXpath": null, + "matchContentJson": null, + "matchContentValue": null, + "properties": [], + "txViewAcl": [], + "txViewFullAcl": [], + "txRerunAcl": [], + "status": "enabled", + "rewriteUrls": false, + "addAutoRewriteRules": true, + "rewriteUrlsConfig": [], + "autoRetryEnabled": false, + "autoRetryPeriodMinutes": 60, + "updatedBy": { + "id": "65e1e4efa8321c79f2ec73af", + "name": "Super User" + }, + "alerts": [], + "priority": 1 } ] } From 6fd2ea22385cb9ee28cc623ce66ab8e1ae09da7d Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Wed, 24 Apr 2024 06:53:43 +0200 Subject: [PATCH 8/9] update links mapping configuration --- .../patientLinksInteractionResponse.json | 9 ++------- .../importer/mapping-mediator/patientLinksResponse.json | 9 +-------- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/client-registry-jempi/importer/mapping-mediator/patientLinksInteractionResponse.json b/client-registry-jempi/importer/mapping-mediator/patientLinksInteractionResponse.json index fed3fe5b..87cc1eef 100644 --- a/client-registry-jempi/importer/mapping-mediator/patientLinksInteractionResponse.json +++ b/client-registry-jempi/importer/mapping-mediator/patientLinksInteractionResponse.json @@ -5,21 +5,16 @@ "method": "GET" }, "transformation": { - "input": "JSON", "output": "JSON" }, - "inputTransforms": { + "inputMapping": { "urlParams.patientId": "uidList[]+" }, "requests": { "response": { - "id": "jempiSearchGoldenId", - "primary": true, + "id": "jempiSearchInteractionForGoldenId", "config": { "method": "post", - "headers": { - "contentType": "application/json" - }, "url": "http://jempi-api:50000/JeMPI/expandedInteractionsCsv" } } diff --git a/client-registry-jempi/importer/mapping-mediator/patientLinksResponse.json b/client-registry-jempi/importer/mapping-mediator/patientLinksResponse.json index 9c067e69..206b3fd7 100644 --- a/client-registry-jempi/importer/mapping-mediator/patientLinksResponse.json +++ b/client-registry-jempi/importer/mapping-mediator/patientLinksResponse.json @@ -19,14 +19,7 @@ "id": "jempiSearchResponse", "config": { "method": "post", - "url": "http://jempi-api:50000/JeMPI/expandedGoldenRecord", - "params": { - "url": { - "goldenId": { - "path": "transforms.goldenId" - } - } - } + "url": "http://jempi-api:50000/JeMPI/expandedGoldenRecord" } }, "lookup": { From e1226e0baa8b7d5016d8f6e2b1ee0adc0366b3d9 Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Wed, 24 Apr 2024 15:00:29 +0200 Subject: [PATCH 9/9] update search mapping config --- .../docker-compose.config.yml | 7 ++++++ .../importer/mapping-mediator/search.json | 4 ++-- .../importer/mapping-mediator/searchAll.json | 2 +- .../mapping-mediator/searchAllResponse.json | 2 +- .../mapping-mediator/searchResponse.json | 22 +++++++++++++++++++ 5 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 client-registry-jempi/importer/mapping-mediator/searchResponse.json diff --git a/client-registry-jempi/importer/mapping-mediator/docker-compose.config.yml b/client-registry-jempi/importer/mapping-mediator/docker-compose.config.yml index d785853e..6945ca72 100644 --- a/client-registry-jempi/importer/mapping-mediator/docker-compose.config.yml +++ b/client-registry-jempi/importer/mapping-mediator/docker-compose.config.yml @@ -29,6 +29,8 @@ services: target: /patientLinksResponse.json - source: mediator-config-searchAllResponse.json target: /searchAllResponse.json + - source: mediator-config-searchResponse.json + target: /searchResponse.json - source: mediator-config-searchAllProbabilistic.json target: /searchAllProbabilistic.json - source: mediator-config-searchAllProbabilisticResponse.json @@ -94,6 +96,11 @@ configs: name: mediator-config-searchAllResponse.json-${mediator_config_searchAllResponse_json_DIGEST:?err} labels: name: jempi + mediator-config-searchResponse.json: + file: ./searchResponse.json + name: mediator-config-searchResponse.json-${mediator_config_searchResponse_json_DIGEST:?err} + labels: + name: jempi mediator-config-searchAllProbabilistic.json: file: ./searchAllProbabilistic.json name: mediator-config-searchAllProbabilistic.json-${mediator_config_searchAllProbabilistic_json_DIGEST:?err} diff --git a/client-registry-jempi/importer/mapping-mediator/search.json b/client-registry-jempi/importer/mapping-mediator/search.json index 023afc39..7fb467c5 100644 --- a/client-registry-jempi/importer/mapping-mediator/search.json +++ b/client-registry-jempi/importer/mapping-mediator/search.json @@ -8,7 +8,7 @@ "input": "JSON", "output": "JSON" }, - "inputTransforms" : { + "inputTransforms": { "id": "lookupRequests.jempiSearch.data.goldenRecord.uid", "gender": "$exists(lookupRequests.jempiSearch.data.goldenRecord.demographicData.gender) ? lookupRequests.jempiSearch.data.goldenRecord.demographicData.gender : null", "birthDate": "$exists(lookupRequests.jempiSearch.data.goldenRecord.demographicData.dob) ? lookupRequests.jempiSearch.data.goldenRecord.demographicData.dob : null", @@ -45,7 +45,7 @@ "id": "jempiSearch", "config": { "method": "get", - "url": "http://jempi-api:50000/JeMPI/expanded-golden-record/:patientId", + "url": "http://openhim-mapping-mediator:3003/search-response/:patientId", "params": { "url": { "patientId": { diff --git a/client-registry-jempi/importer/mapping-mediator/searchAll.json b/client-registry-jempi/importer/mapping-mediator/searchAll.json index 284d56b6..49134fca 100644 --- a/client-registry-jempi/importer/mapping-mediator/searchAll.json +++ b/client-registry-jempi/importer/mapping-mediator/searchAll.json @@ -55,7 +55,7 @@ } } }, - "url": "http://openhim-mapping-mediator:3003/search-response" + "url": "http://openhim-mapping-mediator:3003/search-response-all" } } ] diff --git a/client-registry-jempi/importer/mapping-mediator/searchAllResponse.json b/client-registry-jempi/importer/mapping-mediator/searchAllResponse.json index 54257b54..4df7fe1b 100644 --- a/client-registry-jempi/importer/mapping-mediator/searchAllResponse.json +++ b/client-registry-jempi/importer/mapping-mediator/searchAllResponse.json @@ -1,7 +1,7 @@ { "name": "Search Endpoint deterministic response", "endpoint": { - "pattern": "/search-response", + "pattern": "/search-response-all", "method": "GET" }, "transformation": { diff --git a/client-registry-jempi/importer/mapping-mediator/searchResponse.json b/client-registry-jempi/importer/mapping-mediator/searchResponse.json new file mode 100644 index 00000000..fb96b43d --- /dev/null +++ b/client-registry-jempi/importer/mapping-mediator/searchResponse.json @@ -0,0 +1,22 @@ +{ + "name": "Search patient response by patient id", + "endpoint": { + "pattern": "/search-response/:patientId", + "method": "GET" + }, + "transformation": { + "output": "JSON" + }, + "inputMapping": { + "urlParams.patientId": "gid" + }, + "requests": { + "response": { + "id": "jempiSearchGoldenRecordById", + "config": { + "method": "post", + "url": "http://jempi-api:50000/JeMPI/expandedGoldenRecord" + } + } + } +}