Skip to content

Commit

Permalink
intergrate OpenHIM into the Pipeline (google#90)
Browse files Browse the repository at this point in the history
* intergrate OpenHIM

* correct read me for openhim
  • Loading branch information
mozzy11 authored Jan 14, 2021
1 parent 60f02d0 commit 0087779
Show file tree
Hide file tree
Showing 4 changed files with 235 additions and 1 deletion.
82 changes: 81 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 : [email protected] 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/[email protected] 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
59 changes: 59 additions & 0 deletions openhim-compose.yaml
Original file line number Diff line number Diff line change
@@ -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

82 changes: 82 additions & 0 deletions utils/openhim-config.json
Original file line number Diff line number Diff line change
@@ -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": []
}
13 changes: 13 additions & 0 deletions utils/openhim-default.json
Original file line number Diff line number Diff line change
@@ -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": "<a href='http://openhim.org/' target='_blank'>Powered by OpenHIM</a>",
"loginBanner": "",
"mediatorLastHeartbeatWarningSeconds": 60,
"mediatorLastHeartbeatDangerSeconds": 120
}

0 comments on commit 0087779

Please sign in to comment.