-
Notifications
You must be signed in to change notification settings - Fork 9
PLAT-623 sync/async receiver openhim import #180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
490b38b
register sync/async channels for JeMPI
Mark-Labuschagne 85db90e
Merge branch 'main' into PLAT-623-sync-receiver-openhim-import
Mark-Labuschagne 51b8a37
Merge branch 'main' into PLAT-623-sync-receiver-openhim-import
Mark-Labuschagne 85f36e5
Update client-registry-jempi/importer/openhim/openhimConfig.js
Mark-Labuschagne d832424
Update client-registry-jempi/swarm.sh
Mark-Labuschagne 524e64a
removed obselete defaults
Mark-Labuschagne 6093a50
linting
Mark-Labuschagne 02674d9
fixed typo in client-registry-jempi env var
Mark-Labuschagne d6618f3
fixed async fhir patient endpoint
Mark-Labuschagne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
client-registry-jempi/importer/openhim/docker-compose.config.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| version: '3.9' | ||
|
|
||
| services: | ||
| jempi-openhim-config-importer: | ||
| image: node:erbium-alpine | ||
| deploy: | ||
| restart_policy: | ||
| condition: none | ||
| environment: | ||
| OPENHIM_CORE_SERVICE_NAME: openhim-core | ||
| OPENHIM_MEDIATOR_API_PORT: 8080 | ||
| OPENHIM_API_USERNAME: root@openhim.org | ||
| OPENHIM_API_PASSWORD: ${JEMPI_OPENHIM_PASSWORD} | ||
| NODE_TLS_REJECT_UNAUTHORIZED: 0 | ||
| command: sh -c "node openhimConfig.js" | ||
| configs: | ||
| - source: openhim-config-importer-openhimConfig.js | ||
| target: /openhimConfig.js | ||
| - source: openhim-config-importer-openhim-import.json | ||
| target: /openhim-import.json | ||
|
|
||
| configs: | ||
| openhim-config-importer-openhimConfig.js: | ||
| file: ./openhimConfig.js | ||
| name: openhim-config-importer-openhimConfig.js-${openhim_config_importer_openhimConfig_js_DIGEST:?err} | ||
| labels: | ||
| name: openhim | ||
| openhim-config-importer-openhim-import.json: | ||
| file: ./openhim-import.json | ||
| name: openhim-config-importer-openhim-import.json-${openhim_config_importer_openhim_import_js_DIGEST:?err} | ||
| labels: | ||
| name: openhim | ||
|
|
||
106 changes: 106 additions & 0 deletions
106
client-registry-jempi/importer/openhim/openhim-import.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| { | ||
| "Channels": [ | ||
| { | ||
| "methods": ["POST"], | ||
| "type": "http", | ||
| "allow": ["instant"], | ||
| "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": "JeMPI Sync Receiver", | ||
| "secured": false, | ||
| "host": "jempi-sync-reciever", | ||
| "port": 50000, | ||
| "path": "", | ||
| "pathTransform": "", | ||
| "primary": true, | ||
| "username": "", | ||
| "password": "" | ||
| } | ||
| ], | ||
| "requestBody": true, | ||
| "responseBody": true, | ||
| "rewriteUrlsConfig": [], | ||
| "name": "JeMPI Sync Receiver", | ||
| "urlPattern": "^/fhir/Patient.*$", | ||
| "priority": 10, | ||
| "matchContentRegex": null, | ||
| "matchContentXpath": null, | ||
| "matchContentValue": null, | ||
| "matchContentJson": null, | ||
| "pollingSchedule": null, | ||
| "tcpHost": null, | ||
| "tcpPort": null, | ||
| "updatedBy": { | ||
| "id": "605c8ddd9e66da001494935e", | ||
| "name": "Super User" | ||
| }, | ||
| "alerts": [] | ||
| }, | ||
| { | ||
| "methods": ["POST"], | ||
| "type": "http", | ||
| "allow": ["instant"], | ||
| "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": "JeMPI Async Receiver", | ||
| "secured": false, | ||
| "host": "jempi-async-reciever", | ||
| "port": 50000, | ||
| "path": "", | ||
| "pathTransform": "", | ||
| "primary": true, | ||
| "username": "", | ||
| "password": "" | ||
| } | ||
| ], | ||
| "requestBody": true, | ||
| "responseBody": true, | ||
| "rewriteUrlsConfig": [], | ||
| "name": "JeMPI Async Receiver", | ||
| "urlPattern": "^/async/fhir/Patient/?$", | ||
| "priority": 1, | ||
| "matchContentRegex": null, | ||
| "matchContentXpath": null, | ||
| "matchContentValue": null, | ||
| "matchContentJson": null, | ||
| "pollingSchedule": null, | ||
| "tcpHost": null, | ||
| "tcpPort": null, | ||
| "updatedBy": { | ||
| "id": "605c8ddd9e66da001494935e", | ||
| "name": "Super User" | ||
| }, | ||
| "alerts": [] | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| "use strict"; | ||
|
|
||
| const fs = require("fs"); | ||
| const https = require("https"); | ||
| const path = require("path"); | ||
|
|
||
| const OPENHIM_CORE_SERVICE_NAME = process.env.OPENHIM_CORE_SERVICE_NAME; | ||
| const OPENHIM_API_PASSWORD = process.env.OPENHIM_API_PASSWORD; | ||
| const OPENHIM_MEDIATOR_API_PORT = process.env.OPENHIM_MEDIATOR_API_PORT; | ||
| const OPENHIM_API_USERNAME = process.env.OPENHIM_API_USERNAME; | ||
|
|
||
| const authHeader = new Buffer.from( | ||
| `${OPENHIM_API_USERNAME}:${OPENHIM_API_PASSWORD}` | ||
| ).toString("base64"); | ||
|
|
||
| const jsonData = JSON.parse( | ||
| fs.readFileSync(path.resolve(__dirname, "openhim-import.json")) | ||
| ); | ||
|
|
||
| const data = JSON.stringify(jsonData); | ||
|
|
||
| const options = { | ||
| protocol: "https:", | ||
| hostname: OPENHIM_CORE_SERVICE_NAME, | ||
| port: OPENHIM_MEDIATOR_API_PORT, | ||
| path: "/metadata", | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| "Content-Length": data.length, | ||
| Authorization: `Basic ${authHeader}`, | ||
| }, | ||
| }; | ||
|
|
||
| const req = https.request(options, (res) => { | ||
| if (res.statusCode == 401) { | ||
| throw new Error(`Incorrect OpenHIM API credentials`); | ||
| } | ||
|
|
||
| if (res.statusCode != 201) { | ||
| throw new Error(`Failed to import OpenHIM config: ${res.statusCode}`); | ||
| } | ||
|
|
||
| console.log("Successfully imported OpenHIM config"); | ||
| }); | ||
|
|
||
| req.on("error", (error) => { | ||
| console.error("Failed to import OpenHIM config: ", error); | ||
| }); | ||
|
|
||
| req.write(data); | ||
| req.end(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.