diff --git a/README.md b/README.md index c7fe0eee0..0f3730853 100644 --- a/README.md +++ b/README.md @@ -298,7 +298,15 @@ Parameters (e.g port/url ) have been configured to point to http://localhost:809 Remember to appropriately change other parameters such as source url, sink path, and any required authentication information. -#### 3. Fire up Batch Pipeline +#### 3. Fire up Hapi Fhir instance + +``` +$ docker-compose -f sink-compose.yml up # change ports appropriately (optional) +``` + +You should be able to access OpenMRS via http://localhost:8098/fhir/ + +#### 4. Fire up Batch Pipeline ``` $ mvn clean install @@ -364,3 +372,75 @@ descriptions, try: ``` $ python sample_indicator.py --help ``` +# Integrating with OpenHIM (Middleware component) +For the case, where there are several OpenMRS systems, +OpenHIM can be used as a middleware component to integrate/track/log requests from several OpenMRS instances. + +## 1. Fire up OpenHIM Instance +After spinning up the Hapi FHIR instance, see details above, you can spin up an OpenHIM instance. + + `$ docker-compose -f openhim-compose.yaml up # change ports appropriately (optional)` +You should be able to access OpenHIM via http://localhost:9000 +Use the default credentials i.e + + `username : root@openhim.org and password : openhim-password` + +Note: You will have problems logging in if your OpenHIM server is still setup to use a self-signed certificate (the default). +Visit the following link: https://localhost:8093/authenticate/root@openhim.org in Chrome. + +You should see a message saying “Your connection is not private”. Click “Advanced” and then click “Proceed”. + +Once you have done this, you should see some JSON text displayed on the screen, you can ignore this and close the page. This will ignore the fact that the certificate is self-signed. + +Now, you should be able to go back to the OpenHIM console login page and login. This problem will occur every now and then until you load a properly signed certificate into the OpenHIM core server. + +For the first Login .youll be requested to change your root password! + +Then Go to the 'Export/Import' tab and import the default config file under `Utils/openhim-config.json` for a basic configuration. + +NB the default configurations have the following default configs: + +For the Client : + + `client : hapi` , `client-password : Admin123` + +For the server to route to : + + `Host: 172.17.0.1` (Docker Bridge Ip address), `Port: 8098` (Port for the Hapi fhir server) . + +see section *Using Docker compose* to fire up the Hapi fhir server and openmrs. +Note that Openhim listens to client requests at `port:5001` by default. + +you can now start the pipeline with these args below to point to the OpenHIm instance + + `--sinkUserName=hapi --sinkPassword=Admin123 --fhirSinkPath=http://localhost:5001/fhir` + +ie + +for batch + + mvn compile exec:java -pl batch \ + "-Dexec.args=--openmrsServerUrl=http://localhost:8099/openmrs --searchList=Patient \ + --batchSize=20 --targetParallelism=20 \ + --fhirSinkPath=http://localhost:5001/fhir \ + --sinkUserName=hapi --sinkPassword=Admin123 \ + --openmrsUserName=admin --openmrsPassword=Admin123 " + +for streaming + + mvn compile exec:java -pl streaming-binlog \ + -Dexec.args="--databaseHostName=localhost \ + --databasePort=3306 --databaseUser=root --databasePassword=debezium\ + --databaseName=mysql --databaseSchema=openmrs --databaseServerId=77 \ + --openmrsUserName=admin --openmrsPassword=Admin123 \ + --openmrsServerUrl=http://localhost:8099/openmrs \ + --fhirSinkPath=http://localhost:5001/fhir \ + --sinkUserName=hapi --sinkPassword=Admin123 \ + --fileParquetPath=/tmp/" + + +You can track all the transactions in the OpenHIM instance Under the Tab `Transaction Log` + +see demo at https://youtu.be/U1Sz3GUKbIw + +see https://openhim.readthedocs.io/en/latest/how-to/how-to-setup-and-configure-openhim.html for more details about setting up OpenHIM \ No newline at end of file diff --git a/openhim-compose.yaml b/openhim-compose.yaml new file mode 100644 index 000000000..52f3c4b68 --- /dev/null +++ b/openhim-compose.yaml @@ -0,0 +1,59 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +version: '3' + +services: + mongo-plir: + restart: "always" + container_name: openhim-mongo-plir + expose: + - "27017" + image: mongo:3.4 + healthcheck: + test: "exit 0" + + core-plir: + restart: "always" + container_name: openhim-core-plir + image: jembi/openhim-core:latest + environment: + - mongo_url=mongodb://mongo-plir/openhim + - mongo_atnaUrl=mongodb://mongo-plir/openhim + ports: + - "5001:5001" + - "8093:8080" + expose : + - "5000" + - "5050" + - "5051" + - "5052" + - "7788" + healthcheck: + test: "exit 0" + depends_on: + - mongo-plir + + console-plir: + restart: "always" + container_name: openhim-console-plir + image: jembi/openhim-console:latest + ports: + - "9000:80" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:80/"] + timeout: 20s + volumes: + - ./utils/openhim-default.json:/usr/share/nginx/html/config/default.json + \ No newline at end of file diff --git a/utils/openhim-config.json b/utils/openhim-config.json new file mode 100644 index 000000000..34913cf3e --- /dev/null +++ b/utils/openhim-config.json @@ -0,0 +1,82 @@ +{ + "Users": [], + "Clients": [ + { + "roles": [ + "admin" + ], + "clientID": "hapi", + "name": "HAPI-CLIENT", + "passwordAlgorithm": "sha512", + "passwordSalt": "41271397c2fafc9d6a74660f5e611961", + "passwordHash": "8f559989c523231c47eeda17d6951448428ebb9cb47fbeefc89b9c08d157ce6c89979b52c18ce95efef98e1f300a44b97a2e2c4ee10aff0b001a10e69535e33d" + } + ], + "Channels": [ + { + "methods": [ + "GET", + "POST", + "DELETE", + "PUT", + "OPTIONS", + "HEAD", + "TRACE", + "CONNECT", + "PATCH" + ], + "type": "http", + "allow": [ + "hapi" + ], + "whitelist": [], + "authType": "private", + "matchContentTypes": [], + "properties": [], + "txViewAcl": [], + "txViewFullAcl": [], + "txRerunAcl": [], + "status": "enabled", + "rewriteUrls": false, + "addAutoRewriteRules": true, + "autoRetryEnabled": false, + "autoRetryPeriodMinutes": 60, + "routes": [ + { + "type": "http", + "status": "enabled", + "forwardAuthHeader": false, + "name": "HAPI-ROUTE", + "secured": false, + "host": "172.17.0.1", + "port": 8098, + "path": "", + "pathTransform": "", + "primary": true, + "username": "hapi", + "password": "hapi123" + } + ], + "requestBody": true, + "responseBody": true, + "rewriteUrlsConfig": [], + "name": "HAPI-SYNC", + "urlPattern": "$", + "matchContentRegex": null, + "matchContentXpath": null, + "matchContentValue": null, + "matchContentJson": null, + "pollingSchedule": null, + "tcpHost": null, + "tcpPort": null, + "updatedBy": { + "id": "5ffd8711fa52440012ed54fe", + "name": "Super User" + }, + "alerts": [] + } + ], + "Mediators": [], + "ContactGroups": [], + "KeystoreModelAPI": [] +} diff --git a/utils/openhim-default.json b/utils/openhim-default.json new file mode 100644 index 000000000..e3e1cf5e7 --- /dev/null +++ b/utils/openhim-default.json @@ -0,0 +1,13 @@ +{ + "version": "1.10.0", + "minimumCoreVersion": "3.4.0", + "protocol": "https", + "host": "localhost", + "port": 8093, + "title": "Admin Console", + "footerTitle": "OpenHIM Administration Console", + "footerPoweredBy": "Powered by OpenHIM", + "loginBanner": "", + "mediatorLastHeartbeatWarningSeconds": 60, + "mediatorLastHeartbeatDangerSeconds": 120 + } \ No newline at end of file