diff --git a/cht-config/app_settings.json b/cht-config/app_settings.json index 80522ce3..7a9a319a 100644 --- a/cht-config/app_settings.json +++ b/cht-config/app_settings.json @@ -442,11 +442,11 @@ "mark_for_outbound": true }, "outbound": { - "FHIR_patient": { - "relevant_to": "doc.type === 'person' && doc.role == 'patient'", + "patient": { + "relevant_to": "doc.type === 'person' && doc.patient_id && doc.role === 'patient'", "destination": { "base_url": "http://openhim-core:5001", - "path": "/mediator/patient", + "path": "/mediator/cht/patient", "auth": { "type": "basic", "username": "interop-client", @@ -454,19 +454,29 @@ } }, "mapping": { - "resourceType": { - "expr": "'Patient'" - }, - "identifier": { - "expr": "[{ \"system\": \"cht\", \"use\": \"official\", \"value\": doc._id }]", - "optional": false - }, - "name": { - "expr": "[ { \"use\":\"official\", \"family\": doc.name , \"given\": [ doc.short_name ] } ]", - "optional": false - }, - "gender": "doc.sex", - "birthDate": "doc.date_of_birth" + "doc._id": "doc._id", + "doc.name": "doc.name", + "doc.phone": "doc.phone", + "doc.date_of_birth": "doc.date_of_birth", + "doc.sex": "doc.sex", + "doc.patient_id": "doc.patient_id" + } + }, + "patient_id": { + "relevant_to": "doc.type === 'data_record' && doc.form === 'OPENMRS_PATIENT'", + "destination": { + "base_url": "http://openhim-core:5001", + "path": "/mediator/cht/patient_ids", + "auth": { + "type": "basic", + "username": "interop-client", + "password_key": "openhim1" + } + }, + "mapping": { + "doc._id": "doc._id", + "doc.patient_id": "doc.patient_id", + "doc.external_id": "doc.fields.external_id" } }, "FHIR_practitioner": { @@ -570,6 +580,96 @@ }, "set_task": true } + }, + "OPENMRS_PATIENT": { + "meta": { + "code": "openmrs_patient", + "translation_key": "forms.n.title", + "icon": "medic-person" + }, + "fields": { + "age_in_days": { + "labels": { + "tiny": { + "en": "Age in Days" + }, + "short": { + "en": "Age in Days" + } + }, + "position": 0, + "type": "integer", + "required": true + }, + "patient_name": { + "labels": { + "tiny": { + "en": "patient_name" + }, + "short": { + "en": "Patient Name" + } + }, + "position": 1, + "type": "string", + "length": [ + 1, + 40 + ], + "required": true + }, + "phone_number": { + "labels": { + "tiny": { + "en": "patient phone" + }, + "short": { + "en": "patient Phone" + } + }, + "position": 2, + "flags":{ + "allow_duplicate": false + }, + "type": "phone_number", + "required": true + }, + "location_id": { + "labels": { + "tiny": { + "en": "location_id" + }, + "short": { + "en": "location_id" + } + }, + "position": 3, + "type": "string", + "length": [ + 1, + 60 + ], + "required": true + }, + "external_id": { + "labels": { + "tiny": { + "en": "OpenMRS ID" + }, + "short": { + "en": "OpenMRS ID" + } + }, + "position": 4, + "type": "string", + "length": [ + 1, + 60 + ], + "required": true + } + }, + "public_form": true } } -} \ No newline at end of file +} diff --git a/configurator/Dockerfile b/configurator/Dockerfile index 0e23ce33..65f8af85 100644 --- a/configurator/Dockerfile +++ b/configurator/Dockerfile @@ -11,7 +11,7 @@ WORKDIR /scripts/cht-config COPY ../cht-config ./ -RUN npm install && npm install -g cht-conf +RUN npm install && npm install -g cht-conf && python -m pip install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic WORKDIR /scripts/configurator diff --git a/configurator/config/index.js b/configurator/config/index.js index 164db124..7967c821 100644 --- a/configurator/config/index.js +++ b/configurator/config/index.js @@ -10,7 +10,7 @@ const OPENHIM_CLIENT_PASSWORD = process.env.OPENHIM_CLIENT_PASSWORD || 'interop- const OPENHIM_USER_PASSWORD = process.env.OPENHIM_USER_PASSWORD || 'interop-password'; const OPENMRS_HOST = process.env.OPENMRS || 'openmrs'; -const OPENMRS_PORT = process.env.OPENMRS_PORT || 8090; +const OPENMRS_PORT = process.env.OPENMRS_PORT || 8080; const OPENMRS_USERNAME = process.env.OPENMRS_USERNAME || 'admin'; const OPENMRS_PASSWORD = diff --git a/configurator/libs/generators.js b/configurator/libs/generators.js index c56c4ec7..3e272c4f 100644 --- a/configurator/libs/generators.js +++ b/configurator/libs/generators.js @@ -131,7 +131,7 @@ async function generateOpenMRSChannel (host, port, username, password, type) { host: host, port: port, path: '', - pathTransform: 's/openmrs/openmrs\/ws\/fhir2\/R4/g', + pathTransform: 's/openmrs/openmrs\\/ws\\/fhir2\\/R4/g', primary: true, username: username, password: password diff --git a/docker/docker-compose.openmrs-poller.yml b/docker/docker-compose.openmrs-poller.yml deleted file mode 100644 index 0eec108c..00000000 --- a/docker/docker-compose.openmrs-poller.yml +++ /dev/null @@ -1,15 +0,0 @@ -version: '3.9' - -services: - openmrs-poller: - build: ../openmrs-poller - container_name: openmrs-poller - networks: - - cht-net - environment: - - OPENMRS_URL=${OPENMRS_URL} - - OPENMRS_USER=${OPENMRS_USER} - - OPENMRS_PASSWORD=${OPENMRS_PASSWORD} - - OPENHIM_URL=${OPENHIM_URL} - - OPENHIM_USER=${OPENHIM_USER} - - OPENHIM_PASSWORD=${OPENHIM_PASSWORD}