From b168573fcb858c7558d94208d0f5717cb18811f1 Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Tue, 3 Oct 2023 14:38:02 +0200 Subject: [PATCH 01/29] TB-205 update api env vars --- client-registry-jempi/docker-compose.api.yml | 20 +++++++++----------- client-registry-jempi/package-metadata.json | 8 +++++++- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/client-registry-jempi/docker-compose.api.yml b/client-registry-jempi/docker-compose.api.yml index 7f32f9db..e83cd308 100644 --- a/client-registry-jempi/docker-compose.api.yml +++ b/client-registry-jempi/docker-compose.api.yml @@ -4,17 +4,15 @@ services: jempi-api: image: jembi/jempi-api:${JEMPI_API_IMAGE_TAG} environment: - KC_REALM_NAME: ${KC_REALM_NAME} - KC_JEMPI_CLIENT_ID: ${KC_JEMPI_CLIENT_ID} - KC_JEMPI_CLIENT_SECRET: ${KC_JEMPI_CLIENT_SECRET} - KC_API_URL: ${KC_API_URL} - KC_JEMPI_ROOT_URL: ${KC_JEMPI_ROOT_URL} - JEMPI_SESSION_SECRET: ${JEMPI_SESSION_SECRET} - kafka.bootstrap.servers: ${KAFKA_HOSTS} - JEMPI_FILE_IMPORT_MAX_SIZE_BYTE: ${JEMPI_FILE_IMPORT_MAX_SIZE_BYTE} - JEMPI_SESSION_SECURE: ${JEMPI_SESSION_SECURE} - JEMPI_SESSION_DOMAIN_NAME: ${DOMAIN_NAME} - postgres.server: ${JEMPI_REPMGR_PARTNER_NODES} + POSTGRESQL_USER: ${POSTGRESQL_USERNAME} + POSTGRESQL_PASSWORD: ${POSTGRESQL_PASSWORD} + POSTGRESQL_DATABASE: ${POSTGRESQL_DATABASE} + KAFKA_BOOTSTRAP_SERVERS: ${KAFKA_HOSTS} + KAFKA_APPLICATION_ID: ${KAFKA_APPLICATION_ID_API} + DGRAPH_HOSTS: ${DGRAPH_HOSTS} + DGRAPH_PORTS: ${DGRAPH_PORTS} + HTTP_SERVER_PORT: ${HTTP_SERVER_PORT} + LOG4J2_LEVEL: ${LOG4J2_LEVEL} deploy: replicas: ${JEMPI_API_INSTANCES} resources: diff --git a/client-registry-jempi/package-metadata.json b/client-registry-jempi/package-metadata.json index 2a21dcec..6f9ac78f 100644 --- a/client-registry-jempi/package-metadata.json +++ b/client-registry-jempi/package-metadata.json @@ -75,6 +75,12 @@ "JEMPI_POSTGRES_MEMORY_LIMIT": "3G", "JEMPI_POSTGRES_MEMORY_RESERVE": "500M", "JEMPI_SESSION_SECURE": false, - "DOMAIN_NAME": "" + "DOMAIN_NAME": "", + "POSTGRESQL_PASSWORD": "postgres", + "KAFKA_APPLICATION_ID_API": "api-app-id", + "DGRAPH_HOSTS": "jempi-alpha-01,jempi-alpha-02,jempi-alpha-03", + "DGRAPH_PORTS": "9080,9081,9082", + "HTTP_SERVER_PORT": "50000", + "LOG4J2_LEVEL": "DEBUG" } } From e383c21f9177cafd75714be99cc2955d9d65fd6f Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Tue, 3 Oct 2023 14:47:08 +0200 Subject: [PATCH 02/29] TB-204 update linker env vars --- .../docker-compose.combined.yml | 16 ++++++++++++++-- client-registry-jempi/package-metadata.json | 11 ++++++++++- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/client-registry-jempi/docker-compose.combined.yml b/client-registry-jempi/docker-compose.combined.yml index dd345eb8..22b7f135 100644 --- a/client-registry-jempi/docker-compose.combined.yml +++ b/client-registry-jempi/docker-compose.combined.yml @@ -15,7 +15,7 @@ services: networks: kafka: default: - + jempi-sync-receiver: image: jembi/jempi-sync-receiver:${JEMPI_SYNC_RECEIVER_IMAGE_TAG} environment: @@ -79,7 +79,19 @@ services: jempi-linker: image: jembi/jempi-linker:${JEMPI_LINKER_IMAGE_TAG} environment: - kafka.bootstrap.servers: ${KAFKA_HOSTS} + POSTGRESQL_USER: ${POSTGRESQL_USERNAME} + POSTGRESQL_PASSWORD: ${POSTGRESQL_PASSWORD} + POSTGRESQL_DATABASE: ${POSTGRESQL_DATABASE} + KAFKA_BOOTSTRAP_SERVERS: ${KAFKA_HOSTS} + KAFKA_APPLICATION_ID_INTERACTIONS: ${KAFKA_APPLICATION_ID_INTERACTIONS} + KAFKA_APPLICATION_ID_MU: ${KAFKA_APPLICATION_ID_MU} + KAFKA_CLIENT_ID_NOTIFICATIONS: ${KAFKA_CLIENT_ID_NOTIFICATIONS} + DGRAPH_HOSTS: ${DGRAPH_HOSTS} + DGRAPH_PORTS: ${DGRAPH_PORTS} + HTTP_SERVER_PORT: ${HTTP_SERVER_PORT} + LOG4J2_LEVEL: ${LOG4J2_LEVEL} + LINKER_MATCH_THRESHOLD: ${LINKER_MATCH_THRESHOLD} + LINKER_MATCH_THRESHOLD_MARGIN: ${LINKER_MATCH_THRESHOLD_MARGIN} deploy: replicas: ${JEMPI_LINKER_INSTANCES} resources: diff --git a/client-registry-jempi/package-metadata.json b/client-registry-jempi/package-metadata.json index 6f9ac78f..c98eba10 100644 --- a/client-registry-jempi/package-metadata.json +++ b/client-registry-jempi/package-metadata.json @@ -81,6 +81,15 @@ "DGRAPH_HOSTS": "jempi-alpha-01,jempi-alpha-02,jempi-alpha-03", "DGRAPH_PORTS": "9080,9081,9082", "HTTP_SERVER_PORT": "50000", - "LOG4J2_LEVEL": "DEBUG" + "LOG4J2_LEVEL": "DEBUG", + "KAFKA_APPLICATION_ID_INTERACTIONS": "app-id-link1", + "KAFKA_APPLICATION_ID_MU": "app-id-link2", + "KAFKA_CLIENT_ID_NOTIFICATIONS": "app-id-link3", + "LINKER_MATCH_THRESHOLD": 0.65, + "LINKER_MATCH_THRESHOLD_MARGIN": 0.1, + "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" } } From fa230ebea51b82148ba88a5e2ec9a2b31793bb3b Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Tue, 3 Oct 2023 15:21:40 +0200 Subject: [PATCH 03/29] TB-209 update async-processor env vars --- client-registry-jempi/docker-compose.combined.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client-registry-jempi/docker-compose.combined.yml b/client-registry-jempi/docker-compose.combined.yml index 22b7f135..57703885 100644 --- a/client-registry-jempi/docker-compose.combined.yml +++ b/client-registry-jempi/docker-compose.combined.yml @@ -4,7 +4,9 @@ services: jempi-async-receiver: image: jembi/jempi-async-receiver:${JEMPI_ASYNC_RECEIVER_IMAGE_TAG} environment: - kafka.bootstrap.servers: ${KAFKA_HOSTS} + LOG4J2_LEVEL: ${LOG4J2_LEVEL} + KAFKA_BOOTSTRAP_SERVERS: ${KAFKA_HOSTS} + KAFKA_CLIENT_ID: ${KAFKA_CLIENT_ID_ASYNC} deploy: replicas: ${JEMPI_ASYNC_RECEIVER_INSTANCES} resources: From e4d3c56fd37c3dbe1917a657adea5337aae86ea9 Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Wed, 4 Oct 2023 09:57:00 +0200 Subject: [PATCH 04/29] update linker service name --- client-registry-jempi/docker-compose.combined-dev.yml | 2 +- client-registry-jempi/docker-compose.combined.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client-registry-jempi/docker-compose.combined-dev.yml b/client-registry-jempi/docker-compose.combined-dev.yml index 1f33a0f1..411b8840 100644 --- a/client-registry-jempi/docker-compose.combined-dev.yml +++ b/client-registry-jempi/docker-compose.combined-dev.yml @@ -15,7 +15,7 @@ services: protocol: tcp mode: host - jempi-linker: + linker: ports: - published: 50010 target: 50000 diff --git a/client-registry-jempi/docker-compose.combined.yml b/client-registry-jempi/docker-compose.combined.yml index 57703885..855321a6 100644 --- a/client-registry-jempi/docker-compose.combined.yml +++ b/client-registry-jempi/docker-compose.combined.yml @@ -78,7 +78,7 @@ services: kafka: default: - jempi-linker: + linker: image: jembi/jempi-linker:${JEMPI_LINKER_IMAGE_TAG} environment: POSTGRESQL_USER: ${POSTGRESQL_USERNAME} From b376ba30127bd9f0422beb867d29d17980afe685 Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Thu, 5 Oct 2023 10:50:52 +0200 Subject: [PATCH 05/29] TB-204 update config with LINKER_HOST var --- client-registry-jempi/docker-compose.api.yml | 1 + client-registry-jempi/docker-compose.combined-dev.yml | 2 +- client-registry-jempi/docker-compose.combined.yml | 2 +- client-registry-jempi/package-metadata.json | 9 +++------ 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/client-registry-jempi/docker-compose.api.yml b/client-registry-jempi/docker-compose.api.yml index e83cd308..22fb84b4 100644 --- a/client-registry-jempi/docker-compose.api.yml +++ b/client-registry-jempi/docker-compose.api.yml @@ -13,6 +13,7 @@ services: DGRAPH_PORTS: ${DGRAPH_PORTS} HTTP_SERVER_PORT: ${HTTP_SERVER_PORT} LOG4J2_LEVEL: ${LOG4J2_LEVEL} + LINKER_HOST: ${LINKER_HOST} deploy: replicas: ${JEMPI_API_INSTANCES} resources: diff --git a/client-registry-jempi/docker-compose.combined-dev.yml b/client-registry-jempi/docker-compose.combined-dev.yml index 411b8840..1f33a0f1 100644 --- a/client-registry-jempi/docker-compose.combined-dev.yml +++ b/client-registry-jempi/docker-compose.combined-dev.yml @@ -15,7 +15,7 @@ services: protocol: tcp mode: host - linker: + jempi-linker: ports: - published: 50010 target: 50000 diff --git a/client-registry-jempi/docker-compose.combined.yml b/client-registry-jempi/docker-compose.combined.yml index 855321a6..57703885 100644 --- a/client-registry-jempi/docker-compose.combined.yml +++ b/client-registry-jempi/docker-compose.combined.yml @@ -78,7 +78,7 @@ services: kafka: default: - linker: + jempi-linker: image: jembi/jempi-linker:${JEMPI_LINKER_IMAGE_TAG} environment: POSTGRESQL_USER: ${POSTGRESQL_USERNAME} diff --git a/client-registry-jempi/package-metadata.json b/client-registry-jempi/package-metadata.json index c98eba10..228dda44 100644 --- a/client-registry-jempi/package-metadata.json +++ b/client-registry-jempi/package-metadata.json @@ -4,11 +4,7 @@ "description": "A patient matching and deduplicater for the platform", "type": "infrastructure", "version": "0.0.1", - "dependencies": [ - "interoperability-layer-openhim", - "message-bus-kafka", - "identity-access-manager-keycloak" - ], + "dependencies": ["message-bus-kafka"], "environmentVariables": { "KAFKA_HOSTS": "kafka-01:9092", "JEMPI_ZERO_MEMORY_LIMIT": "3G", @@ -90,6 +86,7 @@ "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", + "LINKER_HOST": "jempi-linker:50000" } } From e952de7350f6b3fb242f724497c8c08e3bee482b Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Thu, 5 Oct 2023 12:02:20 +0200 Subject: [PATCH 06/29] TB-207 update controller env vars --- client-registry-jempi/docker-compose.combined.yml | 11 ++++++++++- client-registry-jempi/package-metadata.json | 3 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/client-registry-jempi/docker-compose.combined.yml b/client-registry-jempi/docker-compose.combined.yml index 57703885..912c7071 100644 --- a/client-registry-jempi/docker-compose.combined.yml +++ b/client-registry-jempi/docker-compose.combined.yml @@ -51,7 +51,16 @@ services: jempi-controller: image: jembi/jempi-controller:${JEMPI_CONTROLLER_IMAGE_TAG} environment: - kafka.bootstrap.servers: ${KAFKA_HOSTS} + POSTGRESQL_USER: ${POSTGRESQL_USERNAME} + POSTGRESQL_PASSWORD: ${POSTGRESQL_PASSWORD} + POSTGRESQL_DATABASE: ${POSTGRESQL_DATABASE} + POSTGRESQL_HOST: ${POSTGRESQL_HOST} + KAFKA_BOOTSTRAP_SERVERS: ${KAFKA_HOSTS} + KAFKA_APPLICATION_ID: ${KAFKA_APPLICATION_ID_CTRL} + KAFKA_CLIENT_ID: ${KAFKA_CLIENT_ID_CTRL} + HTTP_SERVER_PORT: ${HTTP_SERVER_PORT} + LOG4J2_LEVEL: ${LOG4J2_LEVEL} + LINKER_HOST: ${LINKER_HOST} deploy: replicas: ${JEMPI_CONTROLLER_INSTANCES} resources: diff --git a/client-registry-jempi/package-metadata.json b/client-registry-jempi/package-metadata.json index 228dda44..88761b19 100644 --- a/client-registry-jempi/package-metadata.json +++ b/client-registry-jempi/package-metadata.json @@ -87,6 +87,7 @@ "KAFKA_APPLICATION_ID_ETL": "app-id-etl", "KAFKA_APPLICATION_ID_CTRL": "app-id-ctrl", "KAFKA_CLIENT_ID_CTRL": "client-id-ctrl", - "LINKER_HOST": "jempi-linker:50000" + "LINKER_HOST": "jempi-linker:50000", + "POSTGRESQL_HOST": "jempi-postgresql-01:5432" } } From 2768d9e374e40c287d573edd923a515e7710c79d Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Thu, 5 Oct 2023 12:50:14 +0200 Subject: [PATCH 07/29] TB-210 remove old jempi images and config --- .../docker-compose.combined-dev.yml | 6 --- .../docker-compose.combined.yml | 45 ------------------- client-registry-jempi/package-metadata.json | 14 +----- 3 files changed, 1 insertion(+), 64 deletions(-) diff --git a/client-registry-jempi/docker-compose.combined-dev.yml b/client-registry-jempi/docker-compose.combined-dev.yml index 1f33a0f1..80d14f9c 100644 --- a/client-registry-jempi/docker-compose.combined-dev.yml +++ b/client-registry-jempi/docker-compose.combined-dev.yml @@ -1,12 +1,6 @@ version: '3.9' services: - jempi-sync-receiver: - ports: - - published: 50040 - target: 50000 - protocol: tcp - mode: host jempi-controller: ports: diff --git a/client-registry-jempi/docker-compose.combined.yml b/client-registry-jempi/docker-compose.combined.yml index 912c7071..044aed94 100644 --- a/client-registry-jempi/docker-compose.combined.yml +++ b/client-registry-jempi/docker-compose.combined.yml @@ -17,36 +17,6 @@ services: networks: kafka: default: - - jempi-sync-receiver: - image: jembi/jempi-sync-receiver:${JEMPI_SYNC_RECEIVER_IMAGE_TAG} - environment: - kafka.bootstrap.servers: ${KAFKA_HOSTS} - deploy: - replicas: ${JEMPI_SYNC_RECEIVER_INSTANCES} - resources: - limits: - memory: ${JEMPI_SYNC_RECEIVER_MEMORY_LIMIT} - reservations: - memory: ${JEMPI_SYNC_RECEIVER_MEMORY_RESERVE} - networks: - kafka: - default: - - jempi-pre-processor: - image: jembi/jempi-pre-processor:${JEMPI_PRE_PROCESSOR_IMAGE_TAG} - environment: - kafka.bootstrap.servers: ${KAFKA_HOSTS} - deploy: - replicas: ${JEMPI_PRE_PROCESSOR_INSTANCES} - resources: - limits: - memory: ${JEMPI_PRE_PROCESSOR_MEMORY_LIMIT} - reservations: - memory: ${JEMPI_PRE_PROCESSOR_MEMORY_RESERVE} - networks: - kafka: - default: jempi-controller: image: jembi/jempi-controller:${JEMPI_CONTROLLER_IMAGE_TAG} @@ -72,21 +42,6 @@ services: kafka: default: - jempi-em-calculator: - image: jembi/jempi-em-calculator:${JEMPI_EM_CALCULATOR_IMAGE_TAG} - environment: - kafka.bootstrap.servers: ${KAFKA_HOSTS} - deploy: - replicas: ${JEMPI_EM_CALCULATOR_INSTANCES} - resources: - limits: - memory: ${JEMPI_EM_CALCULATOR_MEMORY_LIMIT} - reservations: - memory: ${JEMPI_EM_CALCULATOR_MEMORY_RESERVE} - networks: - kafka: - default: - jempi-linker: image: jembi/jempi-linker:${JEMPI_LINKER_IMAGE_TAG} environment: diff --git a/client-registry-jempi/package-metadata.json b/client-registry-jempi/package-metadata.json index 88761b19..e70b4e2c 100644 --- a/client-registry-jempi/package-metadata.json +++ b/client-registry-jempi/package-metadata.json @@ -4,7 +4,7 @@ "description": "A patient matching and deduplicater for the platform", "type": "infrastructure", "version": "0.0.1", - "dependencies": ["message-bus-kafka"], + "dependencies": ["message-bus-kafka", "interoperability-layer-openhim"], "environmentVariables": { "KAFKA_HOSTS": "kafka-01:9092", "JEMPI_ZERO_MEMORY_LIMIT": "3G", @@ -19,32 +19,20 @@ "JEMPI_RATEL_MEMORY_RESERVE": "500M", "JEMPI_ASYNC_RECEIVER_MEMORY_LIMIT": "3G", "JEMPI_ASYNC_RECEIVER_MEMORY_RESERVE": "500M", - "JEMPI_EM_CALCULATOR_MEMORY_LIMIT": "3G", - "JEMPI_EM_CALCULATOR_MEMORY_RESERVE": "500M", "JEMPI_CONTROLLER_MEMORY_LIMIT": "3G", "JEMPI_CONTROLLER_MEMORY_RESERVE": "500M", "JEMPI_LINKER_MEMORY_LIMIT": "3G", "JEMPI_LINKER_MEMORY_RESERVE": "500M", - "JEMPI_PRE_PROCESSOR_MEMORY_LIMIT": "3G", - "JEMPI_PRE_PROCESSOR_MEMORY_RESERVE": "500M", - "JEMPI_SYNC_RECEIVER_MEMORY_LIMIT": "3G", - "JEMPI_SYNC_RECEIVER_MEMORY_RESERVE": "500M", "JEMPI_API_MEMORY_LIMIT": "3G", "JEMPI_API_MEMORY_RESERVE": "500M", "JEMPI_API_INSTANCES": 1, "JEMPI_KAFKA_TOPICS": "JeMPI-async-preprocessor,JeMPI-patient-controller,JeMPI-patient-em,JeMPI-patient-linker,JeMPI-mu-linker,JeMPI-notifications", "JEMPI_ASYNC_RECEIVER_IMAGE_TAG": "0.2.0", - "JEMPI_SYNC_RECEIVER_IMAGE_TAG": "0.2.0", - "JEMPI_PRE_PROCESSOR_IMAGE_TAG": "0.2.0", "JEMPI_CONTROLLER_IMAGE_TAG": "0.2.0", - "JEMPI_EM_CALCULATOR_IMAGE_TAG": "0.2.0", "JEMPI_LINKER_IMAGE_TAG": "0.2.0", "JEMPI_API_IMAGE_TAG": "0.2.0", "JEMPI_ASYNC_RECEIVER_INSTANCES": 1, - "JEMPI_SYNC_RECEIVER_INSTANCES": 1, - "JEMPI_PRE_PROCESSOR_INSTANCES": 1, "JEMPI_CONTROLLER_INSTANCES": 1, - "JEMPI_EM_CALCULATOR_INSTANCES": 1, "JEMPI_LINKER_INSTANCES": 1, "JEMPI_OPENHIM_PASSWORD": "instant101", "JEMPI_SESSION_SECRET": "c05ll3lesrinf39t7mc5h6un6r0c69lgfno69dsak3vabeqamouq4328cuaekros401ajdpkh60rrt", From 7a1ea7c883bc178cf7e5a1c285fae3cedae25b5b Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Thu, 5 Oct 2023 13:08:08 +0200 Subject: [PATCH 08/29] TB-208 create etl image and config --- .../docker-compose.combined.yml | 17 +++++++++++++++++ client-registry-jempi/package-metadata.json | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/client-registry-jempi/docker-compose.combined.yml b/client-registry-jempi/docker-compose.combined.yml index 044aed94..70fd33a3 100644 --- a/client-registry-jempi/docker-compose.combined.yml +++ b/client-registry-jempi/docker-compose.combined.yml @@ -18,6 +18,23 @@ services: kafka: default: + jempi-etl: + image: jembi/jempi-etl:${JEMPI_ETL_IMAGE_TAG} + environment: + LOG4J2_LEVEL: ${LOG4J2_LEVEL} + KAFKA_BOOTSTRAP_SERVERS: ${KAFKA_HOSTS} + KAFKA_APPLICATION_ID: ${KAFKA_APPLICATION_ID} + deploy: + replicas: ${JEMPI_ETL_INSTANCES} + resources: + limits: + memory: ${JEMPI_ETL_MEMORY_LIMIT} + reservations: + memory: ${JEMPI_ETL_MEMORY_RESERVE} + networks: + kafka: + default: + jempi-controller: image: jembi/jempi-controller:${JEMPI_CONTROLLER_IMAGE_TAG} environment: diff --git a/client-registry-jempi/package-metadata.json b/client-registry-jempi/package-metadata.json index e70b4e2c..7e9433db 100644 --- a/client-registry-jempi/package-metadata.json +++ b/client-registry-jempi/package-metadata.json @@ -25,15 +25,19 @@ "JEMPI_LINKER_MEMORY_RESERVE": "500M", "JEMPI_API_MEMORY_LIMIT": "3G", "JEMPI_API_MEMORY_RESERVE": "500M", + "JEMPI_ETL_MEMORY_LIMIT": "3G", + "JEMPI_ETL_MEMORY_RESERVE": "500M", "JEMPI_API_INSTANCES": 1, "JEMPI_KAFKA_TOPICS": "JeMPI-async-preprocessor,JeMPI-patient-controller,JeMPI-patient-em,JeMPI-patient-linker,JeMPI-mu-linker,JeMPI-notifications", "JEMPI_ASYNC_RECEIVER_IMAGE_TAG": "0.2.0", "JEMPI_CONTROLLER_IMAGE_TAG": "0.2.0", "JEMPI_LINKER_IMAGE_TAG": "0.2.0", "JEMPI_API_IMAGE_TAG": "0.2.0", + "JEMPI_ETL_IMAGE_TAG": "0.1.0", "JEMPI_ASYNC_RECEIVER_INSTANCES": 1, "JEMPI_CONTROLLER_INSTANCES": 1, "JEMPI_LINKER_INSTANCES": 1, + "JEMPI_ETL_INSTANCES": 1, "JEMPI_OPENHIM_PASSWORD": "instant101", "JEMPI_SESSION_SECRET": "c05ll3lesrinf39t7mc5h6un6r0c69lgfno69dsak3vabeqamouq4328cuaekros401ajdpkh60rrt", "JEMPI_FILE_IMPORT_MAX_SIZE_BYTE": 128000000, From dcb6c067cd51bb67e4112d76fa5ffaa0718110ac Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Fri, 6 Oct 2023 09:20:17 +0200 Subject: [PATCH 09/29] TB-205 create shared volume for csv upload/import --- client-registry-jempi/docker-compose.api.yml | 8 ++++---- client-registry-jempi/docker-compose.combined.yml | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/client-registry-jempi/docker-compose.api.yml b/client-registry-jempi/docker-compose.api.yml index 22fb84b4..fcf3e05e 100644 --- a/client-registry-jempi/docker-compose.api.yml +++ b/client-registry-jempi/docker-compose.api.yml @@ -14,6 +14,8 @@ services: HTTP_SERVER_PORT: ${HTTP_SERVER_PORT} LOG4J2_LEVEL: ${LOG4J2_LEVEL} LINKER_HOST: ${LINKER_HOST} + volumes: + - "jempi-shared-data:/app/csv" deploy: replicas: ${JEMPI_API_INSTANCES} resources: @@ -23,18 +25,16 @@ services: memory: ${JEMPI_API_MEMORY_RESERVE} networks: reverse-proxy: - keycloak: kafka: default: +volumes: + jempi-shared-data: networks: reverse-proxy: name: reverse-proxy_public external: true - keycloak: - name: keycloak_public - external: true kafka: name: kafka_public external: true diff --git a/client-registry-jempi/docker-compose.combined.yml b/client-registry-jempi/docker-compose.combined.yml index 70fd33a3..b60df61f 100644 --- a/client-registry-jempi/docker-compose.combined.yml +++ b/client-registry-jempi/docker-compose.combined.yml @@ -7,6 +7,8 @@ services: LOG4J2_LEVEL: ${LOG4J2_LEVEL} KAFKA_BOOTSTRAP_SERVERS: ${KAFKA_HOSTS} KAFKA_CLIENT_ID: ${KAFKA_CLIENT_ID_ASYNC} + volumes: + - "jempi-shared-data:/app/csv" deploy: replicas: ${JEMPI_ASYNC_RECEIVER_INSTANCES} resources: @@ -23,7 +25,7 @@ services: environment: LOG4J2_LEVEL: ${LOG4J2_LEVEL} KAFKA_BOOTSTRAP_SERVERS: ${KAFKA_HOSTS} - KAFKA_APPLICATION_ID: ${KAFKA_APPLICATION_ID} + KAFKA_APPLICATION_ID: ${KAFKA_APPLICATION_ID_ETL} deploy: replicas: ${JEMPI_ETL_INSTANCES} resources: @@ -115,6 +117,7 @@ services: volumes: jempi-psql-01-data: + jempi-shared-data: networks: kafka: From e93342ff69bcf9ea563d9d048b66d75cbd923d05 Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Fri, 6 Oct 2023 09:25:14 +0200 Subject: [PATCH 10/29] TB-215 update jempi web config --- client-registry-jempi/docker-compose.web.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/client-registry-jempi/docker-compose.web.yml b/client-registry-jempi/docker-compose.web.yml index 53a7b5ba..b7486db8 100644 --- a/client-registry-jempi/docker-compose.web.yml +++ b/client-registry-jempi/docker-compose.web.yml @@ -9,7 +9,6 @@ services: REACT_APP_KC_FRONTEND_URL: ${KC_FRONTEND_URL} REACT_APP_KC_REALM_NAME: ${KC_REALM_NAME} REACT_APP_KC_JEMPI_CLIENT_ID: ${KC_JEMPI_CLIENT_ID} - command: sh -c "yarn build && serve -s build" deploy: replicas: ${JEMPI_WEB_INSTANCES} placement: @@ -21,14 +20,10 @@ services: memory: ${JEMPI_WEB_MEMORY_RESERVE} networks: reverse-proxy: - keycloak: default: networks: reverse-proxy: name: reverse-proxy_public external: true - keycloak: - name: keycloak_public - external: true default: From dcefccf665d8404b274a4211ca2742ddd32e490a Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Fri, 6 Oct 2023 09:26:26 +0200 Subject: [PATCH 11/29] TB-201 update jempi notifications script and jempi kafka topics --- client-registry-jempi/importer/jempi_psql_init_db.sql | 8 +++++--- client-registry-jempi/package-metadata.json | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/client-registry-jempi/importer/jempi_psql_init_db.sql b/client-registry-jempi/importer/jempi_psql_init_db.sql index 705ec1a1..34b2cd61 100644 --- a/client-registry-jempi/importer/jempi_psql_init_db.sql +++ b/client-registry-jempi/importer/jempi_psql_init_db.sql @@ -19,13 +19,15 @@ CREATE TABLE IF NOT EXISTS Notification_State CREATE TABLE IF NOT EXISTS Notification ( Id uuid DEFAULT gen_random_uuid() PRIMARY KEY, - Type_Id uuid, + Type VARCHAR(50), Created date, Reviewd_By uuid, Reviewed_At timestamp without time zone, - State_Id uuid, + State VARCHAR(50), Patient_Id VARCHAR(50), - Names VARCHAR(100) + Names VARCHAR(100), + Golden_Id VARCHAR(50), + Score Numeric ); CREATE TABLE IF NOT EXISTS Action diff --git a/client-registry-jempi/package-metadata.json b/client-registry-jempi/package-metadata.json index 7e9433db..a051ca08 100644 --- a/client-registry-jempi/package-metadata.json +++ b/client-registry-jempi/package-metadata.json @@ -4,7 +4,7 @@ "description": "A patient matching and deduplicater for the platform", "type": "infrastructure", "version": "0.0.1", - "dependencies": ["message-bus-kafka", "interoperability-layer-openhim"], + "dependencies": ["message-bus-kafka"], "environmentVariables": { "KAFKA_HOSTS": "kafka-01:9092", "JEMPI_ZERO_MEMORY_LIMIT": "3G", @@ -28,7 +28,7 @@ "JEMPI_ETL_MEMORY_LIMIT": "3G", "JEMPI_ETL_MEMORY_RESERVE": "500M", "JEMPI_API_INSTANCES": 1, - "JEMPI_KAFKA_TOPICS": "JeMPI-async-preprocessor,JeMPI-patient-controller,JeMPI-patient-em,JeMPI-patient-linker,JeMPI-mu-linker,JeMPI-notifications", + "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": "0.2.0", "JEMPI_CONTROLLER_IMAGE_TAG": "0.2.0", "JEMPI_LINKER_IMAGE_TAG": "0.2.0", From 7d6b5056f324b47842e1c0a60b7ba0a2f4e59455 Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Fri, 6 Oct 2023 10:16:38 +0200 Subject: [PATCH 12/29] TB-205 update jempi image tags --- client-registry-jempi/package-metadata.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client-registry-jempi/package-metadata.json b/client-registry-jempi/package-metadata.json index a051ca08..36badc22 100644 --- a/client-registry-jempi/package-metadata.json +++ b/client-registry-jempi/package-metadata.json @@ -29,10 +29,10 @@ "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": "0.2.0", - "JEMPI_CONTROLLER_IMAGE_TAG": "0.2.0", - "JEMPI_LINKER_IMAGE_TAG": "0.2.0", - "JEMPI_API_IMAGE_TAG": "0.2.0", + "JEMPI_ASYNC_RECEIVER_IMAGE_TAG": "0.3.0", + "JEMPI_CONTROLLER_IMAGE_TAG": "0.3.0", + "JEMPI_LINKER_IMAGE_TAG": "0.3.0", + "JEMPI_API_IMAGE_TAG": "0.3.0", "JEMPI_ETL_IMAGE_TAG": "0.1.0", "JEMPI_ASYNC_RECEIVER_INSTANCES": 1, "JEMPI_CONTROLLER_INSTANCES": 1, @@ -43,7 +43,7 @@ "JEMPI_FILE_IMPORT_MAX_SIZE_BYTE": 128000000, "REACT_APP_JEMPI_BASE_URL": "http://localhost:50000/JeMPI", "REACT_APP_MOCK_BACKEND": "false", - "JEMPI_WEB_VERSION": "latest", + "JEMPI_WEB_VERSION": "0.3.0", "JEMPI_WEB_INSTANCES": 1, "JEMPI_WEB_MEMORY_LIMIT": "2G", "JEMPI_WEB_MEMORY_RESERVE": "500M", From dd6d4014f4d752dc1e69ffe76322f5c4e71455fd Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Tue, 10 Oct 2023 08:48:08 +0200 Subject: [PATCH 13/29] Add the mapings for search, update and create These will map the fhir paylod into jempi format as well as map th jempi response into fhir format --- .../docker-compose.config.yml | 63 +++++++++++++ .../importer/mapping-mediator/metadata.js | 92 +++++++++++++++++++ .../mapping-mediator/register-response.json | 51 ++++++++++ .../importer/mapping-mediator/register.json | 46 ++++++++++ .../importer/mapping-mediator/search.json | 57 ++++++++++++ .../mapping-mediator/update-response.json | 46 ++++++++++ .../importer/mapping-mediator/update.json | 46 ++++++++++ 7 files changed, 401 insertions(+) create mode 100644 client-registry-jempi/importer/mapping-mediator/docker-compose.config.yml create mode 100644 client-registry-jempi/importer/mapping-mediator/metadata.js create mode 100644 client-registry-jempi/importer/mapping-mediator/register-response.json create mode 100644 client-registry-jempi/importer/mapping-mediator/register.json create mode 100644 client-registry-jempi/importer/mapping-mediator/search.json create mode 100644 client-registry-jempi/importer/mapping-mediator/update-response.json create mode 100644 client-registry-jempi/importer/mapping-mediator/update.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 new file mode 100644 index 00000000..4c2c7965 --- /dev/null +++ b/client-registry-jempi/importer/mapping-mediator/docker-compose.config.yml @@ -0,0 +1,63 @@ +version: '3.9' + +services: + mapping-mediator-config-importer: + image: jembi/instantohie-config-importer + deploy: + restart_policy: + condition: none + configs: + - source: mediator-config-metadata.js + target: /metadata.js + - source: mediator-config-register.json + target: /register.json + - source: mediator-config-register-response.json + target: /register-response.json + - source: mediator-config-update-response.json + target: /update-response.json + - source: mediator-config-update.json + target: /update.json + - source: mediator-config-search.json + target: /search.json + networks: + mapping-mediator: + # This command will only attempt to import the config when the uptime responds with a 2xx + command: sh -c "wait-on -t 60000 http-get://openhim-mapping-mediator:3003/uptime && node /metadata.js" + +configs: + mediator-config-metadata.js: + file: ./metadata.js + name: mediator-config-metadata.js-${mediator_config_metadata_js_DIGEST:?err} + labels: + name: jempi + mediator-config-register.json: + file: ./register.json + name: mediator-config-register.json-${mediator_config_register_json_DIGEST:?err} + labels: + name: jempi + mediator-config-register-response.json: + file: ./register-response.json + name: mediator-config-register-response.json-${mediator_config_register_response_json_DIGEST:?err} + labels: + name: jempi + mediator-config-update-response.json: + file: ./update-response.json + name: mediator-config-update-response.json-${mediator_config_update_response_json_DIGEST:?err} + labels: + name: jempi + mediator-config-update.json: + file: ./update.json + name: mediator-config-update.json-${mediator_config_update_json_DIGEST:?err} + labels: + name: jempi + mediator-config-search.json: + file: ./search.json + name: mediator-config-search.json-${mediator_config_search_json_DIGEST:?err} + labels: + name: jempi + + +networks: + mapping-mediator: + name: openhim_mapping_mediator_public + external: true diff --git a/client-registry-jempi/importer/mapping-mediator/metadata.js b/client-registry-jempi/importer/mapping-mediator/metadata.js new file mode 100644 index 00000000..539d9d48 --- /dev/null +++ b/client-registry-jempi/importer/mapping-mediator/metadata.js @@ -0,0 +1,92 @@ +'use strict' + +const axios = require('axios') +const fs = require('fs') +const path = require('path') + +const MEDIATOR_HOSTNAME = process.env.MEDIATOR_HOST_NAME || 'openhim-mapping-mediator' +const MEDIATOR_API_PORT = process.env.MEDIATOR_API_PORT || 3003 + +// Function for sending importing the configuration +const sendRequest = async (data, method, endpointId) => { + const url = endpointId + ? `http://${MEDIATOR_HOSTNAME}:${MEDIATOR_API_PORT}/endpoints/${endpointId}` + : `http://${MEDIATOR_HOSTNAME}:${MEDIATOR_API_PORT}/endpoints` + + const options = { + url: url, + method: method, + headers: { + 'Content-Type': 'application/json' + }, + data: JSON.stringify(data) + } + + try { + const response = await axios(options) + + console.log( + `Successfully Imported OpenHIM Mediator Config.\n\nImport summary:${JSON.stringify( + response.data + )}` + ) + } catch (error) { + throw new Error( + `Failed to import OpenHIM Mediator config: ${error.message}` + ) + } +} + +const getEndpoints = async (callback) => { + const options = { + url: `http://${MEDIATOR_HOSTNAME}:${MEDIATOR_API_PORT}/endpoints`, + method: 'get', + headers: { + 'Content-Type': 'application/json' + } + } + + try { + const response = await axios(options) + callback(null, response.data) + } catch (error) { + callback( + new Error( + `Failed to fetch OpenHIM Mediator Mapping endpoints: ${error.response.data}` + ) + ) + } +} + +const importMetaData = async () => { + // get the endpoints list incase we need to do a update instead of a create + // If the endpoint already exists, perform an update + getEndpoints((_error, endpoints) => { + const dirPath = path.resolve(__dirname) + const files = fs.readdirSync(dirPath) + files.reduce((_acc, curr) => { + const jsonRegex = /(.*?(\bjson\b)[^$]*)/ + + if (curr.match(jsonRegex)) { + let method = 'post' + let endpointId = null + + const jsonData = JSON.parse( + fs.readFileSync(path.join(dirPath, curr), 'utf8') + ) + const matchingEndpoint = endpoints.filter( + (endpoint) => endpoint.endpoint.pattern === jsonData.endpoint.pattern + )[0] + + if (matchingEndpoint) { + endpointId = matchingEndpoint._id + method = 'put' + } + + sendRequest(jsonData, method, endpointId) + } + }, {}) + }) +} + +importMetaData() diff --git a/client-registry-jempi/importer/mapping-mediator/register-response.json b/client-registry-jempi/importer/mapping-mediator/register-response.json new file mode 100644 index 00000000..be8e5a7c --- /dev/null +++ b/client-registry-jempi/importer/mapping-mediator/register-response.json @@ -0,0 +1,51 @@ +{ + "name": "Register Patient response", + "endpoint": { + "pattern": "/register-response", + "method": "POST" + }, + "transformation": { + "input": "JSON", + "output": "JSON" + }, + "inputTransforms": { + "currentDate": "$now()", + "sourcePatient": "$exists(requestBody.identifier) and $exists(requestBody.identifier[0]) and $exists(requestBody.identifier[0].value) ? {'patient': requestBody.identifier[0].value, 'facility': requestBody.identifier[0].system} : null", + "nationalId": "$exists(requestBody.identifier) and $exists(requestBody.identifier[0]) and $count($filter(requestBody.identifier, function($v) {$contains($v.system, 'NationalID')})) > 0 ? $filter(requestBody.identifier, function($v) {$contains($v.system, 'NationalID')})[0].value : null", + "name": "$exists(requestBody.name) and $exists(requestBody.name[0]) and $exists(requestBody.name[0].given[0]) ? requestBody.name[0].given[0] : null", + "familyName": "$exists(requestBody.name) and $exists(requestBody.name[0]) ? requestBody.name[0].family : null", + "city": "$exists(requestBody.address) and $exists(requestBody.address[0]) ? requestBody.address[0].city : null", + "phoneNumber": "$exists(requestBody.telecom) and $exists(requestBody.telecom[0]) ? requestBody.telecom[0].value : null" + }, + "inputMapping": { + "constants.candidateThreshold": "candidateThreshold", + "transforms.sourcePatient": "sourceId", + "transforms.nationalId": "demographicData.nationalId", + "transforms.familyName": "demographicData.familyName", + "transforms.name": "demographicData.givenName", + "requestBody.gender": "demographicData.gender", + "requestBody.birthDate": "demographicData.dob", + "transforms.city": "demographicData.city", + "transforms.phoneNumber": "demographicData.phoneNumber", + "transforms.currentDate": "uniqueInteractionData.auxDateCreated" + }, + "constants": { + "candidateThreshold": 0.9 + }, + "requests": { + "response": { + "id": "jempi", + "primary": true, + "config": { + "method": "post", + "headers": { + "contentType": "application/fhir+json" + }, + "url": "http://jempi-api:50000/JeMPI/cr-register" + }, + "extract": { + "JeMPIResponse": "$.body" + } + } + } +} diff --git a/client-registry-jempi/importer/mapping-mediator/register.json b/client-registry-jempi/importer/mapping-mediator/register.json new file mode 100644 index 00000000..61de918b --- /dev/null +++ b/client-registry-jempi/importer/mapping-mediator/register.json @@ -0,0 +1,46 @@ +{ + "name": "Register Patient", + "endpoint": { + "pattern": "/fhir/Patient", + "method": "POST" + }, + "transformation": { + "input": "JSON", + "output": "JSON" + }, + "constants": { + "active": true + }, + "inputTransforms": { + "id": "lookupRequests.jempi.data.linkInfo.goldenUID" + }, + "inputMapping": { + "requestBody.resourceType": "resourceType", + "transforms.id": "id", + "requestBody.identifier": "identifier", + "constants.active": "active", + "requestBody.name": "name", + "requestBody.gender": "gender", + "requestBody.birthDate": "birthDate", + "requestBody.address": "address", + "requestBody.telecom": "telecom" + }, + "requests": { + "lookup": [ + { + "id": "jempi", + "forwardExistingRequestBody": true, + "config": { + "method": "post", + "headers": { + "contentType": "application/fhir+json" + }, + "url": "http://openhim-mapping-mediator:3003/register-response" + }, + "extract": { + "JeMPIResponse": "$.body" + } + } + ] + } +} diff --git a/client-registry-jempi/importer/mapping-mediator/search.json b/client-registry-jempi/importer/mapping-mediator/search.json new file mode 100644 index 00000000..43cdd2f8 --- /dev/null +++ b/client-registry-jempi/importer/mapping-mediator/search.json @@ -0,0 +1,57 @@ +{ + "name": "Search Patient by id", + "endpoint": { + "pattern": "/fhir/Patient/:patientId", + "method": "POST" + }, + "transformation": { + "input": "JSON", + "output": "JSON" + }, + "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", + "name": "$exists(lookupRequests.jempiSearch.data.goldenRecord.demographicData.givenName) ? lookupRequests.jempiSearch.data.goldenRecord.demographicData.givenName : null", + "lastName": "$exists(lookupRequests.jempiSearch.data.goldenRecord.demographicData.familyName) ? lookupRequests.jempiSearch.data.goldenRecord.demographicData.familyName : null", + "city": "$exists(lookupRequests.jempiSearch.data.goldenRecord.demographicData.city) ? lookupRequests.jempiSearch.data.goldenRecord.demographicData.city : null", + "identifierValue": "$exists(lookupRequests.jempiSearch.data.goldenRecord.sourceId) and $exists(lookupRequests.jempiSearch.data.goldenRecord.sourceId.patient) ? lookupRequests.jempiSearch.data.goldenRecord.sourceId.patient : null", + "identifierSystem": "$exists(lookupRequests.jempiSearch.data.goldenRecord.sourceId) and $exists(lookupRequests.jempiSearch.data.goldenRecord.sourceId.facility) ? lookupRequests.jempiSearch.data.goldenRecord.sourceId.facility : null", + "nationalId": "$exists(lookupRequests.jempiSearch.data.goldenRecord.demographicData.nationalId) ? {'value': lookupRequests.jempiSearch.data.goldenRecord.demographicData.nationalId, 'system': constants.nidSystem} : null", + "phoneNumber": "$exists(lookupRequests.jempiSearch.data.goldenRecord.demographicData.phoneNumber) ? {'value': lookupRequests.jempiSearch.data.goldenRecord.demographicData.phoneNumber, 'system': constants.phone} : null" + }, + "inputMapping": { + "constants.resourceType": "resourceType", + "transforms.id": "id", + "transforms.gender": "gender", + "transforms.birthDate": "birthDate", + "transforms.lastName": "name[0].family", + "transforms.name": "name[0].given[0]", + "transforms.city": "address[0].city", + "transforms.identifierSystem": "identifier[0].system", + "transforms.identifierValue": "identifier[0].value", + "transforms.nationalId": "identifier[]+", + "transforms.phoneNumber": "telecom[]+" + }, + "constants": { + "nidSystem": "NationalID", + "resourceType": "Patient", + "phone": "phone" + }, + "requests": { + "lookup": { + "id": "jempiSearch", + "config": { + "method": "get", + "url": "http://jempi-api:50000/JeMPI/expanded-golden-record/:patientId", + "params": { + "url": { + "patientId": { + "path": "urlParams.patientId" + } + } + } + } + } + } +} diff --git a/client-registry-jempi/importer/mapping-mediator/update-response.json b/client-registry-jempi/importer/mapping-mediator/update-response.json new file mode 100644 index 00000000..a0f05efd --- /dev/null +++ b/client-registry-jempi/importer/mapping-mediator/update-response.json @@ -0,0 +1,46 @@ +{ + "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) ? {'name': 'givenName', 'value': requestBody.name[0].given} : null", + "birthDate": "$exists(requestBody.birthDate) ? {'name': 'birthDate', '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 ? $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": "jempi", + "primary": true, + "config": { + "method": "patch", + "headers": { + "contentType": "application/json" + }, + "url": "http://jempi_api:50000/JeMPI/cr-update-fields" + }, + "extract": { + "JeMPIResponse": "$.body" + } + } + } + } diff --git a/client-registry-jempi/importer/mapping-mediator/update.json b/client-registry-jempi/importer/mapping-mediator/update.json new file mode 100644 index 00000000..b143c684 --- /dev/null +++ b/client-registry-jempi/importer/mapping-mediator/update.json @@ -0,0 +1,46 @@ +{ + "name": "Update Patient", + "endpoint": { + "pattern": "/fhir/Patient/:patientId", + "method": "POST" + }, + "transformation": { + "input": "JSON", + "output": "JSON" + }, + "inputMapping": { + "urlParams.patientId": "id", + "requestBody.resourceType": "resourceType", + "requestBody.identifier": "identifier", + "requestBody.name": "name", + "requestBody.gender": "gender", + "requestBody.birthDate": "birthDate", + "requestBody.address": "address", + "requestBody.telecom": "telecom" + }, + "requests": { + "lookup": [ + { + "id": "jempi", + "forwardExistingRequestBody": true, + "config": { + "method": "post", + "params": { + "url": { + "patientId": { + "path": "urlParams.patientId" + } + } + }, + "headers": { + "contentType": "application/json" + }, + "url": "http://openhim-mapping-mediator:3003/update-patient-response/:patientId" + }, + "extract": { + "JeMPIResponse": "$.body" + } + } + ] + } + } From 267aaf2bf902252804ca051ec08c8ea914f59c35 Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Tue, 10 Oct 2023 08:50:38 +0200 Subject: [PATCH 14/29] Add the dependencies used by the client registry --- client-registry-jempi/package-metadata.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client-registry-jempi/package-metadata.json b/client-registry-jempi/package-metadata.json index 228dda44..ae311994 100644 --- a/client-registry-jempi/package-metadata.json +++ b/client-registry-jempi/package-metadata.json @@ -4,7 +4,11 @@ "description": "A patient matching and deduplicater for the platform", "type": "infrastructure", "version": "0.0.1", - "dependencies": ["message-bus-kafka"], + "dependencies": [ + "openhim-mapping-mediator", + "message-bus-kafka", + "identity-access-manager-keycloak" + ], "environmentVariables": { "KAFKA_HOSTS": "kafka-01:9092", "JEMPI_ZERO_MEMORY_LIMIT": "3G", From 010f03a7fe3e8d101b0266051ca4adc3017d43ec Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Tue, 10 Oct 2023 08:51:28 +0200 Subject: [PATCH 15/29] Run the importer scripts that add the mappoings to the mapping mediator --- client-registry-jempi/swarm.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client-registry-jempi/swarm.sh b/client-registry-jempi/swarm.sh index 5ef5ce66..cb556585 100644 --- a/client-registry-jempi/swarm.sh +++ b/client-registry-jempi/swarm.sh @@ -62,6 +62,9 @@ function initialize_package() { log info "Importing JeMPI Kafka topics" docker::deploy_config_importer $STACK "$COMPOSE_FILE_PATH/importer/docker-compose.config.yml" "jempi-kafka-config-importer" "jempi-kafka" + log info "Importing mapping endpoints" + docker::deploy_config_importer $STACK "$COMPOSE_FILE_PATH/importer/mapping-mediator/docker-compose.config.yml" "mapping-mediator-config-importer" "jempi" + log info "Deploy Dgraph" docker::deploy_service $STACK "${COMPOSE_FILE_PATH}" "docker-compose.dgraph-zero.yml" "$dgraph_zero_dev_compose_param" "$dgraph_zero_cluster_compose_param" From 9355229e158743ceb44fef845cae82bb76837ded Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Tue, 10 Oct 2023 08:52:53 +0200 Subject: [PATCH 16/29] Add the hapi fhir network to the mapping mediator as well as bump the image version This is so the mediator is able to send data to hapi fhir --- openhim-mapping-mediator/docker-compose.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openhim-mapping-mediator/docker-compose.yml b/openhim-mapping-mediator/docker-compose.yml index 9a393d29..9ee5054a 100644 --- a/openhim-mapping-mediator/docker-compose.yml +++ b/openhim-mapping-mediator/docker-compose.yml @@ -2,7 +2,7 @@ version: '3.9' services: openhim-mapping-mediator: - image: jembi/openhim-mediator-mapping:v3.2.0 + image: jembi/openhim-mediator-mapping:v3.2.1 environment: OPENHIM_REGISTER: ${OPENHIM_REGISTER} MONGO_URL: ${OPENHIM_MONGO_URL} @@ -17,6 +17,7 @@ services: mongo: kafka: public: + hapi: networks: openhim: @@ -31,3 +32,6 @@ networks: public: name: openhim_mapping_mediator_public external: true + hapi: + name: hapi-fhir_public + external: true From 28bee6bb9a24d3af1938640001d203ffb31f033a Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Tue, 10 Oct 2023 12:02:52 +0200 Subject: [PATCH 17/29] Fix bugs and typos --- .../importer/mapping-mediator/register.json | 4 ++-- .../importer/mapping-mediator/update-response.json | 10 +++++----- .../importer/mapping-mediator/update.json | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/client-registry-jempi/importer/mapping-mediator/register.json b/client-registry-jempi/importer/mapping-mediator/register.json index 61de918b..a6f64cd8 100644 --- a/client-registry-jempi/importer/mapping-mediator/register.json +++ b/client-registry-jempi/importer/mapping-mediator/register.json @@ -12,7 +12,7 @@ "active": true }, "inputTransforms": { - "id": "lookupRequests.jempi.data.linkInfo.goldenUID" + "id": "lookupRequests.jempiRegister.data.linkInfo.goldenUID" }, "inputMapping": { "requestBody.resourceType": "resourceType", @@ -28,7 +28,7 @@ "requests": { "lookup": [ { - "id": "jempi", + "id": "jempiRegister", "forwardExistingRequestBody": true, "config": { "method": "post", diff --git a/client-registry-jempi/importer/mapping-mediator/update-response.json b/client-registry-jempi/importer/mapping-mediator/update-response.json index a0f05efd..44845877 100644 --- a/client-registry-jempi/importer/mapping-mediator/update-response.json +++ b/client-registry-jempi/importer/mapping-mediator/update-response.json @@ -10,12 +10,12 @@ }, "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) ? {'name': 'givenName', 'value': requestBody.name[0].given} : null", - "birthDate": "$exists(requestBody.birthDate) ? {'name': 'birthDate', 'value': requestBody.birthDate} : 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 ? $filter(requestBody.identifier, function($v) {$contains($v.system, 'NationalID')})[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", @@ -29,14 +29,14 @@ }, "requests": { "response": { - "id": "jempi", + "id": "jempiUpdateResponse", "primary": true, "config": { "method": "patch", "headers": { "contentType": "application/json" }, - "url": "http://jempi_api:50000/JeMPI/cr-update-fields" + "url": "http://jempi-api:50000/JeMPI/cr-update-fields" }, "extract": { "JeMPIResponse": "$.body" diff --git a/client-registry-jempi/importer/mapping-mediator/update.json b/client-registry-jempi/importer/mapping-mediator/update.json index b143c684..3f73d486 100644 --- a/client-registry-jempi/importer/mapping-mediator/update.json +++ b/client-registry-jempi/importer/mapping-mediator/update.json @@ -1,8 +1,8 @@ { "name": "Update Patient", "endpoint": { - "pattern": "/fhir/Patient/:patientId", - "method": "POST" + "pattern": "/fhir/update/Patient/:patientId", + "method": "PUT" }, "transformation": { "input": "JSON", @@ -21,7 +21,7 @@ "requests": { "lookup": [ { - "id": "jempi", + "id": "jempiUpdate", "forwardExistingRequestBody": true, "config": { "method": "post", From 9f823604f3218e22b60a16c921164384c6b54cdc Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Tue, 10 Oct 2023 12:30:29 +0200 Subject: [PATCH 18/29] Fix bug Add closing bracket --- .../importer/mapping-mediator/update-response.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client-registry-jempi/importer/mapping-mediator/update-response.json b/client-registry-jempi/importer/mapping-mediator/update-response.json index 44845877..dc0101b3 100644 --- a/client-registry-jempi/importer/mapping-mediator/update-response.json +++ b/client-registry-jempi/importer/mapping-mediator/update-response.json @@ -10,7 +10,7 @@ }, "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", + "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", From e189ba06d2a6372419812a3db60ddf0df5ee3f3a Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Tue, 10 Oct 2023 15:18:27 +0200 Subject: [PATCH 19/29] Bump the platform version --- config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.yaml b/config.yaml index ed7be6bd..04c40d90 100644 --- a/config.yaml +++ b/config.yaml @@ -1,5 +1,5 @@ projectName: platform -image: jembi/platform:2.4.3 +image: jembi/platform:2.5.0 logPath: /tmp/logs packages: From 6a97be8ef6afb5baffbaa2c10f21c744e357a6b9 Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Tue, 10 Oct 2023 15:23:30 +0200 Subject: [PATCH 20/29] fix typo --- client-registry-jempi/importer/mapping-mediator/metadata.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client-registry-jempi/importer/mapping-mediator/metadata.js b/client-registry-jempi/importer/mapping-mediator/metadata.js index 539d9d48..a04ba686 100644 --- a/client-registry-jempi/importer/mapping-mediator/metadata.js +++ b/client-registry-jempi/importer/mapping-mediator/metadata.js @@ -7,7 +7,7 @@ const path = require('path') const MEDIATOR_HOSTNAME = process.env.MEDIATOR_HOST_NAME || 'openhim-mapping-mediator' const MEDIATOR_API_PORT = process.env.MEDIATOR_API_PORT || 3003 -// Function for sending importing the configuration +// Function for sending the configuration const sendRequest = async (data, method, endpointId) => { const url = endpointId ? `http://${MEDIATOR_HOSTNAME}:${MEDIATOR_API_PORT}/endpoints/${endpointId}` From 5050bd6ca45def514bb5b126ddd6351f998e05a0 Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Wed, 11 Oct 2023 08:55:29 +0200 Subject: [PATCH 21/29] Add documentation This adds information on how to create, read and update patients via the JeMPI api or through the mapping mediator (in fhir format) --- client-registry-jempi/README.md | 161 ++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 client-registry-jempi/README.md diff --git a/client-registry-jempi/README.md b/client-registry-jempi/README.md new file mode 100644 index 00000000..f2bdca9d --- /dev/null +++ b/client-registry-jempi/README.md @@ -0,0 +1,161 @@ + +# JeMPI Client Registry Component - docker-swarm + +This component consists of two services: + +* JeMPI Web UI - http://localhost:3033 +* JeMPI API - http://localhost:50000/JeMPI + +## Api endpoints + +> This service uses the openhim mapping mediator to map fhir formated patients into the JeMPI format + +### Registering a patient + +via the api (in JeMPI format) + +```sh +POST - http://localhost:50000/JeMPI/cr-register + +{ + "candidateThreshold": 0.9, + "sourceId": { + "facility": "fac1", + "patient": "pat1" + }, + "uniqueInteractionData": { + "auxDateCreated": "2016-10-30T14:22:25.285", + "auxId" : "1234", + "auxClinicalData" : "SOME DATA" + }, + "demographicData": { + "givenName": "XXX", + "familyName": "YYY", + "gender": "female", + "dob": "20000101", + "phoneNumber": "123456789", + "city": "Cape Town", + "nationalId": "1234567890" + } +} +``` + +via the [mapping mediator](https://github.com/jembi/openhim-mediator-mapping) (in fhir format) + +```sh + +POST http://localhost:3003/fhir/Patient + +{ + "resourceType": "Patient", + "gender": "male", + "birthDate": "1968-04-15", + "name": [ + { + "family": "cread", + "given": [ + "Jacess" + ] + } + ], + "address": [ + { + "city": "Indianapolis" + } + ], + "identifier": [ + { + "system": "https://instantopenhie.org/client1", + "value": "6b4573e7-f9dc-49ea-9ebb-daaa6b74a534" + }, + { + "value": "60934be6-ce88-48af-958e-02d88f77eec9", + "system": "NationalID" + } + ], + "telecom": [ + { + "value": "899-882-4991", + "system": "phone" + } + ] +} +``` +> The identifier with the system 'NationalID' maps to the 'nationalId' property in JeMPI + +## Querying a patient by id + +via the api (returns patient in JeMPI formated) + +```sh +GET - http://localhost:50000/JeMPI/expanded-golden-record/ +``` + +via the [mapping mediator](https://github.com/jembi/openhim-mediator-mapping) (returns patient in fhir format) + +```sh +GET - http://localhost:3003/fhir/Patient/ +``` + +## Updating a patient + +via the api (in JeMPI format) + +```sh +PATCH - http://localhost:50000/JeMPI/cr-update-fields + +{ + "goldenId": "0x5", + "fields": [ + { + "name": "givenName", + "value": "xxx" + }, + { + "name": "familyName", + "value": "yyy" + } + ] +} +``` + +via the [mapping mediator](https://github.com/jembi/openhim-mediator-mapping) (in fhir format) + +```sh +PUT - http://localhost:3003/fhir/update/Patient/ + +{ + "resourceType": "Patient", + "gender": "male", + "birthDate": "1968-04-15", + "name": [ + { + "family": "cread", + "given": [ + "Jacess" + ] + } + ], + "address": [ + { + "city": "Indianapolis" + } + ], + "identifier": [ + { + "system": "https://instantopenhie.org/client1", + "value": "6b4573e7-f9dc-49ea-9ebb-daaa6b74a534" + }, + { + "value": "60934be6-ce88-48af-958e-02d88f77eec9", + "system": "NationalID" + } + ], + "telecom": [ + { + "value": "899-882-4991", + "system": "phone" + } + ] +} +``` From 5b58fab1936332e8d98cc04e50815363ccb0c8b1 Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Thu, 12 Oct 2023 06:10:24 +0200 Subject: [PATCH 22/29] add new user for ansible --- .../development/group_vars/all.yml | 38 ++++++++----------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/infrastructure/ansible/inventories/development/group_vars/all.yml b/infrastructure/ansible/inventories/development/group_vars/all.yml index ad00f74f..64964a8d 100644 --- a/infrastructure/ansible/inventories/development/group_vars/all.yml +++ b/infrastructure/ansible/inventories/development/group_vars/all.yml @@ -8,22 +8,6 @@ sudoers: username: ryancrichton state: present key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCrGR7DPVKSIMjWO7m8vq6PFBJT8vmiiJRguePcuff8DUvUYmH/imAcvlcswZvnrlZgEtHLdleYKii4Fc/HcNwfoQOdxbdDbRamxhdSr+sHa4V97ziMi1+eXdJOItXjF9+ZyeFG0P2d8BH+6+X8NZ9q+3iM4iEg/08LqXyLU52rcRutmHo+3K0pZQETHOeiiIxBHzgtlDZIMclw12U5NU/f7W5+9jfDatLDhIO13x4iTeES0d5B5RivBtJoQb1y0glqgVtrCDuRgMk/p51Ravf7a8eFHgcVWYhcVqjakOviWMeHHnPI4IQSLK2yXGArsMurOQwoZ16r03Vse9mf3rmrLf30fD6cWdyRxgSkuWCDqJUvGQiGIJfybfsPLz/EPSvGjRx96DFPoqZ5meuLZW6bvQx5FjTLUU/G5KKvFujEkhL0WPTZO+XikIJVgvMp7DtgbOqRCDYcJM1F2oyccAnitmh0k43O2VkpKN8HYzVM1YAl7oxY4XdWbuAvZpNi7814WaM3/SCo5iKi39EbuQ0m8mDWloxroDtpc3RtY6gRWjx8exndpd6gD8yEKxSuzIwpdaWp1gGreCs+0/QPu4QjhQQuKPfrOKksJhaNF59i1Ww9RtRYW8R8wkgJYznxAKlyWDcYMc2PIvFPLLAvOD9JLouCBwjF3h07EFYZ+90wUw== - - name: michael.loosen@jembi.org - username: michaelloosen - state: present - key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINGNVNlWwpQKVXPSngEOOdJjuCyVEQoBXv+nHqmcM6vW - - name: barry.dwyer@jembi.org - username: barrydwyer - state: absent - key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICw4vvV33xxrTzxAiPoRhuwyWUzmgrP5NPo2n4bmKx7P - - name: mark.labuschagne@jembi.org - username: marklabuschagne - state: absent - key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHa1ghm9JsRl6JDtWU8AV+U70jehqlWaXmpjRg3afqB4 - - name: castello.govender@jembi.org - username: castellogovender - state: absent - key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDWl3Vc+v0fiuVBIVTDehGGUgZqfvn0JG2oNS7oMV9X2s3p8VwndKm6/oa5bOO4+sp9Z/8ychvo7S2MNXBRQAzTEXo5Oej5E/aZqaFzvpjgI79cnSidIHTzOUw0rUk2EwpSCpJVSXCjSjxGLbbLI35+KltLVoNXGmpNFq4Xi7XwT9aXIm5KQcbumV1NFRGPl+XiaRHioo37gFtub9XjODdQFfs9KGMS2oEuzzFFaXj5unUDZo+lZlEp67HHwq6EpDLR5xf7l96xBvMpQ/MS2pTxCoHVqXx3IDL5CXBBrgUKS8lUuhPPUJxPeARz4DuU7SmWxhNwTDspAEROQ8Rsq6M+kvdslFVeJ4O5M2Rs75mDTUCAkmZTixkTMuMmWqBuQT3zPA7d8Gf0YLhKfwgyH8y5YeJgpU01o2wbH6em/n2isI+pSIatdUFQAKuFdzJiawQJEB5UobKwN2tKVP8ImjrfN+q8nuqHZwTTGW0AaCrb985aQFTgMbYwQeR3mkBNOE0= - name: lumiere@symbionix.co username: lumieremondo state: present @@ -36,6 +20,10 @@ sudoers: username: arran state: present key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB8edPB2Qhi0DGEgSTel4yNo9Wa68g4UtHYipaVfaMN8 arran@LAPTOP-2GA5K346 + - name: matthew.erispe@jembi.org + username: matthewerispe + state: present + key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCwfQ8ypu5+4rGNfMeSzB+ADffE4qT/519AFVDTIWgV4FaJipsgHdYFTVnxkJHAiixTKAqEJ2SF1RJ2/pIH2hX5p2GNWhrXuOmnqiOZEByPSsqidSNS8aMCfIzt7UZ6XvIPhagZnEQ7NCA1BOuOqzWISIEKjSqA3MvfZ5kniis5J9cbTqkGB+pgW75fuQIxtmK7iCZbwuXOO735PzkKgeT/vfg4fTlbmOeikSNO6QaamGRZ+NJfprCIx5j5GKc970k6V9d4RcQltHojgWI7Wl2VRLsprm7Xy2keaTGXfjnCDwQ2cQRUgBqIoWyDoUzNqvDYXrEAfM19sNEICMx90fXaJeGrNbMg2jjWuyPacSnB0moDtECt4zd2svozGEWnVvdY8KDAWgMbTUlrufNOzh7hyrDMpaBSmSN9npyTpekM0kWlykfU++oEexXMi41b0cZLJc9ocPJCeKZ0fzpachHW35zsUh2E6OCgbXdDxNugVrG4ecz9nUqjJGyYhCX6mhz9VxpB46wEPQ/E2rTsnIfd+xMYoyLqLzCfKf/Z8CL8/Ifq7uDRxczRmo5sCrjByOdwyUGY+JoFQMc5OcEzfyepVmcwfuhuASBGAZOr1zM1ituqG614d7W+GDRHwCeAS8zUZKFdYvL5C4nOg+OxojqnC8zSGwN3ZcnMXHvvzKdQHw== docker_users: - name: bradford.sawadye@jembi.org @@ -74,8 +62,12 @@ docker_users: username: arran state: present key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB8edPB2Qhi0DGEgSTel4yNo9Wa68g4UtHYipaVfaMN8 arran@LAPTOP-2GA5K346 + - name: matthew.erispe@jembi.org + username: matthewerispe + state: present + key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCwfQ8ypu5+4rGNfMeSzB+ADffE4qT/519AFVDTIWgV4FaJipsgHdYFTVnxkJHAiixTKAqEJ2SF1RJ2/pIH2hX5p2GNWhrXuOmnqiOZEByPSsqidSNS8aMCfIzt7UZ6XvIPhagZnEQ7NCA1BOuOqzWISIEKjSqA3MvfZ5kniis5J9cbTqkGB+pgW75fuQIxtmK7iCZbwuXOO735PzkKgeT/vfg4fTlbmOeikSNO6QaamGRZ+NJfprCIx5j5GKc970k6V9d4RcQltHojgWI7Wl2VRLsprm7Xy2keaTGXfjnCDwQ2cQRUgBqIoWyDoUzNqvDYXrEAfM19sNEICMx90fXaJeGrNbMg2jjWuyPacSnB0moDtECt4zd2svozGEWnVvdY8KDAWgMbTUlrufNOzh7hyrDMpaBSmSN9npyTpekM0kWlykfU++oEexXMi41b0cZLJc9ocPJCeKZ0fzpachHW35zsUh2E6OCgbXdDxNugVrG4ecz9nUqjJGyYhCX6mhz9VxpB46wEPQ/E2rTsnIfd+xMYoyLqLzCfKf/Z8CL8/Ifq7uDRxczRmo5sCrjByOdwyUGY+JoFQMc5OcEzfyepVmcwfuhuASBGAZOr1zM1ituqG614d7W+GDRHwCeAS8zUZKFdYvL5C4nOg+OxojqnC8zSGwN3ZcnMXHvvzKdQHw== -firewall_subnet_restriction: '10.1.10.0/16' +firewall_subnet_restriction: "10.1.10.0/16" # docker_swarm_hostname_1: ip-172-31-36-41 # docker_swarm_hostname_2: ip-172-31-35-12 @@ -85,9 +77,9 @@ firewall_subnet_restriction: '10.1.10.0/16' docker_username: ethiopiacdrbot docker_email: ryan+ethiopiacdrbot@jembi.org docker_password: !vault | - $ANSIBLE_VAULT;1.1;AES256 - 34323064326163323965306565316239366335633632633862333339323965633539376162623138 - 3166356333333635656337383236306535343164636632640a323031326166653339663162663763 - 39356130373863326163306139343332396262353036333532303530383363376237336138336136 - 3262303664386464380a613834373538376639373330363361396165333533343137613464653761 - 36383536633362653535343666333731333630383639613065393935346336613636 + $ANSIBLE_VAULT;1.1;AES256 + 34323064326163323965306565316239366335633632633862333339323965633539376162623138 + 3166356333333635656337383236306535343164636632640a323031326166653339663162663763 + 39356130373863326163306139343332396262353036333532303530383363376237336138336136 + 3262303664386464380a613834373538376639373330363361396165333533343137613464653761 + 36383536633362653535343666333731333630383639613065393935346336613636 From f2ad80067a8daebe433b248900b57a6a892c87c6 Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Thu, 12 Oct 2023 06:26:51 +0200 Subject: [PATCH 23/29] remove old users --- .../inventories/development/group_vars/all.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/infrastructure/ansible/inventories/development/group_vars/all.yml b/infrastructure/ansible/inventories/development/group_vars/all.yml index 64964a8d..854733f1 100644 --- a/infrastructure/ansible/inventories/development/group_vars/all.yml +++ b/infrastructure/ansible/inventories/development/group_vars/all.yml @@ -34,22 +34,6 @@ docker_users: username: ryancrichton state: present key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCrGR7DPVKSIMjWO7m8vq6PFBJT8vmiiJRguePcuff8DUvUYmH/imAcvlcswZvnrlZgEtHLdleYKii4Fc/HcNwfoQOdxbdDbRamxhdSr+sHa4V97ziMi1+eXdJOItXjF9+ZyeFG0P2d8BH+6+X8NZ9q+3iM4iEg/08LqXyLU52rcRutmHo+3K0pZQETHOeiiIxBHzgtlDZIMclw12U5NU/f7W5+9jfDatLDhIO13x4iTeES0d5B5RivBtJoQb1y0glqgVtrCDuRgMk/p51Ravf7a8eFHgcVWYhcVqjakOviWMeHHnPI4IQSLK2yXGArsMurOQwoZ16r03Vse9mf3rmrLf30fD6cWdyRxgSkuWCDqJUvGQiGIJfybfsPLz/EPSvGjRx96DFPoqZ5meuLZW6bvQx5FjTLUU/G5KKvFujEkhL0WPTZO+XikIJVgvMp7DtgbOqRCDYcJM1F2oyccAnitmh0k43O2VkpKN8HYzVM1YAl7oxY4XdWbuAvZpNi7814WaM3/SCo5iKi39EbuQ0m8mDWloxroDtpc3RtY6gRWjx8exndpd6gD8yEKxSuzIwpdaWp1gGreCs+0/QPu4QjhQQuKPfrOKksJhaNF59i1Ww9RtRYW8R8wkgJYznxAKlyWDcYMc2PIvFPLLAvOD9JLouCBwjF3h07EFYZ+90wUw== - - name: michael.loosen@jembi.org - username: michaelloosen - state: present - key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINGNVNlWwpQKVXPSngEOOdJjuCyVEQoBXv+nHqmcM6vW - - name: barry.dwyer@jembi.org - username: barrydwyer - state: absent - key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICw4vvV33xxrTzxAiPoRhuwyWUzmgrP5NPo2n4bmKx7P - - name: mark.labuschagne@jembi.org - username: marklabuschagne - state: absent - key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHa1ghm9JsRl6JDtWU8AV+U70jehqlWaXmpjRg3afqB4 - - name: castello.govender@jembi.org - username: castellogovender - state: absent - key: ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDWl3Vc+v0fiuVBIVTDehGGUgZqfvn0JG2oNS7oMV9X2s3p8VwndKm6/oa5bOO4+sp9Z/8ychvo7S2MNXBRQAzTEXo5Oej5E/aZqaFzvpjgI79cnSidIHTzOUw0rUk2EwpSCpJVSXCjSjxGLbbLI35+KltLVoNXGmpNFq4Xi7XwT9aXIm5KQcbumV1NFRGPl+XiaRHioo37gFtub9XjODdQFfs9KGMS2oEuzzFFaXj5unUDZo+lZlEp67HHwq6EpDLR5xf7l96xBvMpQ/MS2pTxCoHVqXx3IDL5CXBBrgUKS8lUuhPPUJxPeARz4DuU7SmWxhNwTDspAEROQ8Rsq6M+kvdslFVeJ4O5M2Rs75mDTUCAkmZTixkTMuMmWqBuQT3zPA7d8Gf0YLhKfwgyH8y5YeJgpU01o2wbH6em/n2isI+pSIatdUFQAKuFdzJiawQJEB5UobKwN2tKVP8ImjrfN+q8nuqHZwTTGW0AaCrb985aQFTgMbYwQeR3mkBNOE0= - name: lumiere@symbionix.co username: lumieremondo state: present From e52ca1a019169b02dd163ed0598a3cff0c2c80cf Mon Sep 17 00:00:00 2001 From: Matthew Erispe Date: Thu, 12 Oct 2023 07:25:52 +0200 Subject: [PATCH 24/29] update jempi feature --- .../features/cluster-mode/jempi.cluster.feature | 10 +++------- test/cucumber/features/single-mode/jempi.feature | 10 +++------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/test/cucumber/features/cluster-mode/jempi.cluster.feature b/test/cucumber/features/cluster-mode/jempi.cluster.feature index e1a3bf95..69dbb7a2 100644 --- a/test/cucumber/features/cluster-mode/jempi.cluster.feature +++ b/test/cucumber/features/cluster-mode/jempi.cluster.feature @@ -28,11 +28,8 @@ Feature: Client Registry JeMPI? And The service "jempi-async-receiver" should be started with 1 replica And The service "jempi-async-receiver" should be connected to the networks | kafka_public | jempi_default | - And The service "jempi-sync-receiver" should be started with 1 replica - And The service "jempi-sync-receiver" should be connected to the networks - | kafka_public | jempi_default | - And The service "jempi-pre-processor" should be started with 1 replica - And The service "jempi-pre-processor" should be connected to the networks + And The service "jempi-etl" should be started with 1 replica + And The service "jempi-etl" should be connected to the networks | kafka_public | jempi_default | And The service "jempi-controller" should be started with 1 replica And The service "jempi-controller" should be connected to the networks @@ -72,8 +69,7 @@ Feature: Client Registry JeMPI? And The service "jempi-alpha-02" should be removed And The service "jempi-alpha-03" should be removed And The service "jempi-async-receiver" should be removed - And The service "jempi-sync-receiver" should be removed - And The service "jempi-pre-processor" should be removed + And The service "jempi-etl" should be removed And The service "jempi-controller" should be removed And The service "jempi-em-calculator" should be removed And The service "jempi-linker" should be removed diff --git a/test/cucumber/features/single-mode/jempi.feature b/test/cucumber/features/single-mode/jempi.feature index d4fdfa8a..a591f803 100644 --- a/test/cucumber/features/single-mode/jempi.feature +++ b/test/cucumber/features/single-mode/jempi.feature @@ -20,11 +20,8 @@ Feature: Client Registry JeMPI? And The service "jempi-async-receiver" should be started with 1 replica And The service "jempi-async-receiver" should be connected to the networks | kafka_public | jempi_default | - And The service "jempi-sync-receiver" should be started with 1 replica - And The service "jempi-sync-receiver" should be connected to the networks - | kafka_public | jempi_default | - And The service "jempi-pre-processor" should be started with 1 replica - And The service "jempi-pre-processor" should be connected to the networks + And The service "jempi-etl" should be started with 1 replica + And The service "jempi-etl" should be connected to the networks | kafka_public | jempi_default | And The service "jempi-controller" should be started with 1 replica And The service "jempi-controller" should be connected to the networks @@ -58,8 +55,7 @@ Feature: Client Registry JeMPI? And The service "jempi-alpha-02" should be removed And The service "jempi-alpha-03" should be removed And The service "jempi-async-receiver" should be removed - And The service "jempi-sync-receiver" should be removed - And The service "jempi-pre-processor" should be removed + And The service "jempi-etl" should be removed And The service "jempi-controller" should be removed And The service "jempi-em-calculator" should be removed And The service "jempi-linker" should be removed From 67b967a9678958c417709fefe2d4674c96966b11 Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Thu, 12 Oct 2023 12:30:08 +0200 Subject: [PATCH 25/29] Add the keyclock network to the jempi web For the web to communicate with keycloak --- client-registry-jempi/docker-compose.web.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client-registry-jempi/docker-compose.web.yml b/client-registry-jempi/docker-compose.web.yml index b7486db8..1f4d507e 100644 --- a/client-registry-jempi/docker-compose.web.yml +++ b/client-registry-jempi/docker-compose.web.yml @@ -20,10 +20,14 @@ services: memory: ${JEMPI_WEB_MEMORY_RESERVE} networks: reverse-proxy: + keycloak: default: networks: reverse-proxy: name: reverse-proxy_public external: true + keycloak: + name: keycloak_public + external: true default: From b619dbc15c50fbf0350c254087056a61a35e1742 Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Mon, 16 Oct 2023 14:39:45 +0200 Subject: [PATCH 26/29] Add mappings for the jempi endpoint for retrieving the patients This adds mappings that will be used in the mapping mediator for mapping the jempi patient into fhir format TB-180 --- .../docker-compose.config.yml | 15 +++- .../importer/mapping-mediator/searchAll.json | 43 ++++++++++++ .../mapping-mediator/searchAllResponse.json | 69 +++++++++++++++++++ 3 files changed, 126 insertions(+), 1 deletion(-) create mode 100644 client-registry-jempi/importer/mapping-mediator/searchAll.json create mode 100644 client-registry-jempi/importer/mapping-mediator/searchAllResponse.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 4c2c7965..7c761fdf 100644 --- a/client-registry-jempi/importer/mapping-mediator/docker-compose.config.yml +++ b/client-registry-jempi/importer/mapping-mediator/docker-compose.config.yml @@ -19,6 +19,10 @@ services: target: /update.json - source: mediator-config-search.json target: /search.json + - source: mediator-config-searchAll.json + target: /searchAll.json + - source: mediator-config-searchAllResponse.json + target: /searchAllResponse.json networks: mapping-mediator: # This command will only attempt to import the config when the uptime responds with a 2xx @@ -55,7 +59,16 @@ configs: name: mediator-config-search.json-${mediator_config_search_json_DIGEST:?err} labels: name: jempi - + mediator-config-searchAll.json: + file: ./searchAll.json + name: mediator-config-searchAll.json-${mediator_config_searchAll_json_DIGEST:?err} + labels: + name: jempi + mediator-config-searchAllResponse.json: + file: ./searchAllResponse.json + name: mediator-config-searchAllResponse.json-${mediator_config_searchAllResponse_json_DIGEST:?err} + labels: + name: jempi networks: mapping-mediator: diff --git a/client-registry-jempi/importer/mapping-mediator/searchAll.json b/client-registry-jempi/importer/mapping-mediator/searchAll.json new file mode 100644 index 00000000..54c04047 --- /dev/null +++ b/client-registry-jempi/importer/mapping-mediator/searchAll.json @@ -0,0 +1,43 @@ +{ + "name": "Search Endpoint", + "endpoint": { + "pattern": "/fhir/Patients", + "method": "POST" + }, + "transformation": { + "input": "JSON", + "output": "JSON" + }, + "constants": { + "resourceType": "Bundle", + "type": "searchset" + }, + "inputTransforms": { + "total": "$count(lookupRequests.jempiSearchAll.data.goldenRecords)", + "entry": "$map(lookupRequests.jempiSearchAll.data.goldenRecords, function($v) {{'fullUrl': 'Patient/' & $v.goldenId, 'resource': {'resourceType': 'Patient','id': $v.goldenId,'name': {'given': [$v.demographicData.givenName],'family': $v.demographicData.familyName},'address': [{'city': $v.demographicData.city}],'birthDate': $v.demographicData.dob,'telecom': [{'value': $v.demographicData.phoneNumber,'system': 'phone'}],'identifier': [{'system': $v.sourceId.facility,'value': $v.sourceId.patient},{'system': 'NationalID','value': $v.demographicData.nationalId}],'gender': $v.demographicData.gender}}})" + }, + "inputMapping": { + "constants.resourceType": "resourceType", + "constants.type": "type", + "transforms.total": "total", + "transforms.entry": "entry" + }, + "requests": { + "lookup": [ + { + "id": "jempiSearchAll", + "forwardExistingRequestBody": true, + "config": { + "method": "post", + "headers": { + "contentType": "application/json" + }, + "url": "http://openhim-mapping-mediator:3003/search-response" + }, + "extract": { + "JeMPIResponse": "$.body" + } + } + ] + } +} diff --git a/client-registry-jempi/importer/mapping-mediator/searchAllResponse.json b/client-registry-jempi/importer/mapping-mediator/searchAllResponse.json new file mode 100644 index 00000000..aa9a4bb5 --- /dev/null +++ b/client-registry-jempi/importer/mapping-mediator/searchAllResponse.json @@ -0,0 +1,69 @@ +{ + "name": "Search Response Endpoint", + "endpoint": { + "pattern": "/search-response", + "method": "POST" + }, + "transformation": { + "input": "JSON", + "output": "JSON" + }, + "inputValidation": { + "type": "object", + "properties": { + "requestBody": { + "type": "object", + "properties": { + "parameters": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "valueCode": { + "type": "string" + }, + "valueString": { + "type": "string" + } + }, + "required": ["name", "valueCode", "valueString"] + }, + "minItems": 1 + } + }, + "required": [ + "parameters" + ] + } + } + }, + "inputTransforms": { + "operands": "$append([], $map(requestBody.parameters, function($v) {{'operator': $v.name, 'operand': {'fn': 'eq', 'name': $v.valueCode, 'value': $v.valueString}}}))" + }, + "constants": { + "operator": "or", + "function": "match", + "operandFunction": "eq" + }, + "inputMapping": { + "transforms.operands": "operands", + "transforms.operands[0].operand": "operand" + }, + "requests": { + "response": [ + { + "id": "jempiSearchAllResponse", + "config": { + "method": "post", + "url": "http://jempi-api:50000/JeMPI/cr-find" + }, + "extract": { + "JeMPIResponse": "$.body" + } + } + ] + } +} From 3312c58714a26a24da33a2bb1dd495493fc7bdbe Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Mon, 16 Oct 2023 14:41:49 +0200 Subject: [PATCH 27/29] Update the readme with instructions for retrieving patients in jempi and fhir format TB-180 --- client-registry-jempi/README.md | 48 +++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/client-registry-jempi/README.md b/client-registry-jempi/README.md index f2bdca9d..39446d7e 100644 --- a/client-registry-jempi/README.md +++ b/client-registry-jempi/README.md @@ -159,3 +159,51 @@ PUT - http://localhost:3003/fhir/update/Patient/ ] } ``` + +## Query all patients deterministic + +via the api (returns in JeMPI format) + +```sh +POST http://localhost:50000/JeMPI/cr-find + +{ + "operand": { + "fn": "eq", + "name": "givenName", + "value": "xxx" + }, + "operands": [ + { + "operator": "and", + "operand": { + "fn": "eq", + "name": "familyName", + "value": "yyy" + } + } + ] +} +``` + +via the [mapping mediator](https://github.com/jembi/openhim-mediator-mapping) (in fhir format) + +```sh +POST http://localhost:3003/fhir/Patients + +{ + "resourceType": "Parameters", + "parameters": [ + { + "name": "and", // matches to the operator (options are "and" and "or") + "valueCode": "familyName", // matches to the field name (options are "givenName", "familyName", "dob", "nationalId", "gender", "city" and "phoneNumber") + "valueString": "creexxxeead" // matches to value of the field + }, + { + "name": "and", + "valueCode": "city", + "valueString": "Indianapeeolis" + } + ] +} +``` From c0b62453cea26e1359dcd5f409e2a60175bae911 Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Mon, 16 Oct 2023 17:48:29 +0200 Subject: [PATCH 28/29] Increase the timeout for the tests The number of packages to be tested has increased and it now takes long for the tests to finish --- .github/workflows/ci-cluster.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-cluster.yml b/.github/workflows/ci-cluster.yml index c3c3386d..0eae1e68 100644 --- a/.github/workflows/ci-cluster.yml +++ b/.github/workflows/ci-cluster.yml @@ -72,7 +72,7 @@ jobs: run-e2e-tests: runs-on: ubuntu-20.04 needs: configure-e2e-server - timeout-minutes: 80 + timeout-minutes: 120 steps: - uses: actions/checkout@v3 with: From 7e0f09142d6971aa26e7d6b5c2466677056a39cc Mon Sep 17 00:00:00 2001 From: bradsawadye Date: Mon, 16 Oct 2023 18:01:31 +0200 Subject: [PATCH 29/29] Only run tests for one package when the infrastructure files are changed --- .github/workflows/run-tests.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run-tests.sh b/.github/workflows/run-tests.sh index 2c6a5831..a144aa89 100755 --- a/.github/workflows/run-tests.sh +++ b/.github/workflows/run-tests.sh @@ -8,6 +8,9 @@ CHANGED_FILES=($@) cd ../../test/cucumber/ || exit +# This ensures that the openhim and its mediators' tests are run only once when the openhim and its mediators have all been modified +openhimRan="false" + declare -A changed_packages for package in "${CHANGED_FILES[@]}"; do if [[ $package == *"features/cluster-mode"* ]]; then @@ -28,12 +31,10 @@ elif [[ "${!changed_packages[*]}" == *"features/single-mode"* ]] && [[ $NODE_MOD DOCKER_HOST=ssh://ubuntu@$GITHUB_RUN_ID.jembi.cloud yarn test:single elif [[ "${!changed_packages[*]}" == *"features/cluster-mode"* ]] && [[ $NODE_MODE == "cluster" ]]; then DOCKER_HOST=ssh://ubuntu@$GITHUB_RUN_ID.jembi.cloud yarn test:cluster -elif [[ "${!changed_packages[*]}" == *"infrastructure"* ]]; then - DOCKER_HOST=ssh://ubuntu@$GITHUB_RUN_ID.jembi.cloud yarn test:"$NODE_MODE" +elif [[ "${!changed_packages[*]}" == *"infrastructure"* ]] && [[ $openhimRan == "false" ]]; then + openhimRan="true" + DOCKER_HOST=ssh://ubuntu@$GITHUB_RUN_ID.jembi.cloud yarn test:"$NODE_MODE":openhim else - # This ensures that the openhim and its mediators' tests are run only once when the openhim and its mediators have all been modified - openhimRan="false" - for folder_name in "${!changed_packages[@]}"; do echo "$folder_name was changed"