Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
5e4451f
feat(#114): Create OpenMRS Mediator for Patient resource
witash Mar 14, 2024
4e3de0f
feat(#114): add endpoints for openmrs and cht
witash Apr 7, 2024
534b1fd
feat(#114): add missing routes
witash Apr 8, 2024
50a3f3f
feat(#114): add openmrs poller
witash Apr 16, 2024
494ae3d
feat(#114): id exchange and sms forms
witash Apr 22, 2024
8c3c4fe
feat(#114): add patient to bundle from openmrs
witash Apr 23, 2024
6ed106d
feat(#114): allow palce id in name
witash Apr 29, 2024
76e9012
feat(#124): remove openmrs endpoints, add mappers for cht, openmrs
witash May 20, 2024
ffaa7e0
feat(#124): add openmrs sync
witash May 20, 2024
9b7978d
feat(#114): add sequence diagrams for document endpoints
witash May 21, 2024
ac83b03
feat(#125): sequence diagrams for outgoing patients
witash May 21, 2024
1fb1351
feat(#114): fix uit tests
witash May 22, 2024
d9e1c13
feat(#125): sequence diagrams for incoming patients and forms
witash May 23, 2024
449de72
feat(#114): sonar fixes
witash May 24, 2024
613bf6b
feat(#114): add openmrs channel to configurator
witash May 24, 2024
6d03a4f
feat(#114): fix bundle format
witash May 27, 2024
aba7c95
feat(#114): get observations and patients together with encounters
witash May 31, 2024
fda229f
feat(#114): configurator changes
witash May 31, 2024
f7a834d
feat(#114): add openmrs to startup
witash May 31, 2024
dfe749d
feat(#114): add timeout, fix timing issues
witash Jun 4, 2024
6c3ff27
feat(#114): pagination for openmrs sync
witash Jun 6, 2024
3eab817
feat(#114): fix reference for encounters and don't allow updates
witash Jun 10, 2024
0e38c83
feat(#114): fix unit tests
witash Jun 10, 2024
d05968e
feat(#114): fix unit tests
witash Jun 10, 2024
70aee07
feat(#114): remove cht from main startup script
witash Jun 11, 2024
6141ce8
feat(#114): adding source ot prevent infinite loops
witash Jun 21, 2024
5bb2eae
feat(#114): don't save encounters until complete
witash Jun 21, 2024
12e2a53
feat(#114): boundary conditions for sync
witash Jun 24, 2024
88f1014
feat(#114): add sync_interval to index
witash Jun 24, 2024
7a5243c
feat(#114): fix tests
witash Jun 24, 2024
3db5945
feat(#114): fix defualt sync_interval
witash Jun 24, 2024
82e29ec
feat(#114): fix unit tests for default sync_interval
witash Sep 9, 2024
ee8e8dd
feat: add platform to failing containers
njuguna-n Sep 18, 2024
6d2c7d2
no service line in compose files, pin to cht core 4.10, improve start…
mrjones-plip Sep 18, 2024
e91be25
fix(#138): change ltfu mediator to cht mediator and add openmrs mediator
witash Oct 2, 2024
c1cc023
fix(#138): env.template changes and small fixes
witash Oct 3, 2024
f325edd
chore (#123): openmrs mediator e2e test (#128)
lorerod Oct 4, 2024
7470359
fix(#123): fixing tests
witash Oct 8, 2024
a0fc96b
fix(#123): fixing tests
witash Oct 8, 2024
86bdc31
chore(#142): adding tests to increase coverage
witash Oct 18, 2024
59f607b
Merge branch 'main' into openmrs-mediator
witash Oct 21, 2024
1a5be52
chore(#142): sonar fixes
witash Oct 22, 2024
d6db1d6
chore(#142): sonar fixes
witash Oct 22, 2024
7d279c1
chore(#142): adding tests to increase coverage (#143)
witash Oct 23, 2024
d5b0252
fix: fixing startup script
witash Oct 23, 2024
ef558a2
chore(#136): skipping e2e-tests until rate limiting is fixed
witash Oct 23, 2024
d8cb295
feat(#138): move polling to openhim channel config (#139)
witash Oct 25, 2024
e3f1a4c
chore(#142): add tests and small fixes
witash Oct 28, 2024
dfe2107
Merge branch '142-unit-tests' into openmrs-mediator
witash Oct 28, 2024
59bf494
fix(#123): use up-test command in retry_startup
Oct 31, 2024
0f7ef52
fix(#123): remove conditional to enable E2E tests in CI
Oct 31, 2024
61ccd62
fix(#123): remove conditional to enable E2E tests in CI
Oct 31, 2024
5be2b00
fix: convert sync period to milliseconds before subtracting from the …
njuguna-n Nov 1, 2024
8abfa10
fix(#123): remove conditional to enable E2E tests in CI
Nov 1, 2024
3cc6a55
fix(#123): revert remove conditional to enable E2E tests in CI
Nov 1, 2024
3216ce7
fix(#123): add wait time before asserting fhir response
Nov 6, 2024
71df8de
fix(#123): add logic to retry image pulls
Nov 6, 2024
1ec5181
fix(#123): enable e2e test in ci
Nov 6, 2024
670f3a5
feat: make encounter requests idempotent by using the identifier
njuguna-n Nov 8, 2024
0bca7ae
feat: get fhir resource by identifier
njuguna-n Nov 11, 2024
dcb5e61
feat(#147): adding value types (#149)
witash Nov 13, 2024
40716e8
chore: adding sample forms
witash Nov 19, 2024
1de75e4
fix: removing date check
witash Nov 19, 2024
c9354ff
chore: address sonarlint issues
njuguna-n Nov 25, 2024
7b89788
chore: remove unused variable
andrablaj Nov 28, 2024
f361ca4
fix: adding postman collection
witash Jan 9, 2025
9290c0f
fix: app setting changes for testing
witash Jan 10, 2025
85d0484
Merge branch 'main' into openmrs-mediator
witash Jan 10, 2025
539f03e
feat: separating test and openmrs job
witash Jan 10, 2025
07ca30d
fix: removing unecessarry test
witash Jan 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Test

on: [push, pull_request]
on: [push]

jobs:
unit:
Expand Down
20 changes: 20 additions & 0 deletions cht-config/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM node:16-slim

RUN apt update \
&& apt install --no-install-recommends -y \
curl \
git \
python3-pip \
python3-setuptools \
python3-wheel \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* \
&& python3 -m pip install git+https://github.com/medic/pyxform.git@medic-conf-1.17#egg=pyxform-medic

WORKDIR /scripts/cht-config

COPY ./ ./

RUN npm install --ignore-scripts && npm install -g --ignore-scripts cht-conf

CMD ["npm", "run", "deploy"]
242 changes: 225 additions & 17 deletions cht-config/app_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,31 +442,41 @@
"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",
"password_key": "openhim1"
}
},
"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": {
Expand Down Expand Up @@ -541,6 +551,37 @@
"expr": "[ { \"type\": [ { \"text\": \"Community health worker\" } ] } ]"
}
}
},
"openmrs_height_weight": {
"relevant_to": "doc.type === 'data_record' && doc.form === 'HEIGHT_WEIGHT'",
"destination": {
"base_url": "http://openhim-core:5001",
"path": "/mediator/cht/encounter",
"auth": {
"type": "basic",
"username": "interop-client",
"password_key": "openhim1"
}
},
"mapping": {
"id": "doc._id",
"patient_uuid": "doc.fields.patient_uuid",
"reported_date": "doc.reported_date",
"observations.0.valueQuantity.value": "doc.fields.height",
"observations.0.valueQuantity.unit": {
"expr": "\"cm\""
},
"observations.0.code": {
"expr": "\"5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\""
},
"observations.1.valueQuantity.value": "doc.fields.weight",
"observations.1.valueQuantity.unit": {
"expr": "\"kg\""
},
"observations.1.code": {
"expr": "\"5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\""
}
}
}
},
"forms": {
Expand Down Expand Up @@ -570,6 +611,173 @@
},
"set_task": true
}
},
"HEIGHT_WEIGHT": {
"meta": {
"code": "height_weight",
"translation_key": "forms.openmrs_height_weight.title",
"icon": "medic-person"
},
"fields": {
"patient_uuid": {
"labels": {
"tiny": {
"en": "ID"
},
"short": {
"translation_key": "patient_id"
}
},
"position": 0,
"type": "string",
"length": [
1,
13
],
"required": true
},
"height": {
"labels": {
"short": {
"en": "Heght in cm"
}
},
"position": 1,
"type": "integer",
"required": true
},
"weight": {
"labels": {
"short": {
"en": "Weight in kg"
}
},
"position": 2,
"type": "integer",
"required": true
}
},
"public_form": true
},
"OPENMRS_INCOMING": {
"meta": {
"code": "openmrs_incoming",
"translation_key": "forms.openmrs_height_weight.title",
"icon": "medic-person"
},
"fields": {
"5090AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA": {
"labels": {
"short": {
"en": "Heght in cm"
}
},
"position": 0,
"type": "integer",
"required": true
},
"5089AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA": {
"labels": {
"short": {
"en": "Weight in kg"
}
},
"position": 1,
"type": "integer",
"required": true
}
},
"public_form": 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
}
}
}
}
2 changes: 1 addition & 1 deletion cht-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test-targets": "npm run eslint && TZ=Africa/Nairobi mocha --reporter progress test/targets/*.spec.js --timeout 10000",
"test-contact-summary": "npm run eslint && TZ=Africa/Nairobi mocha --reporter progress test/contact-summary/*.spec.js --timeout 10000",
"test-unit": "TZ=Africa/Nairobi mocha --recursive --reporter spec test --timeout 20000",
"deploy": "wait-on http://api:5988/ && sleep 100 && sh ./script.sh"
"deploy": "wait-on http://api:5988/ && sh ./script.sh"
},
"devDependencies": {
"chai": "^4.2.0",
Expand Down
21 changes: 5 additions & 16 deletions configurator/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
FROM node:16-alpine

RUN apk add g++ make py3-pip git curl chromium
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also still needed @witash

Copy link
Copy Markdown
Member

@binokaryg binokaryg Jun 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I am getting this error without it:

148.7 /bin/sh: python: not found
------
failed to solve: process "/bin/sh -c 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" did not complete successfully: exit code: 127

FROM node:22-alpine

WORKDIR /scripts/configurator

COPY ./configurator ./
COPY ./package.json ./package.json
COPY ./package-lock.json ./package-lock.json

RUN npm install

WORKDIR /scripts/cht-config

COPY ../cht-config ./

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

RUN echo "cd /scripts/configurator && npm run configure && cd /scripts/cht-config && npm run deploy && exit 0" > ./startup.sh

RUN chmod +x ./startup.sh
COPY ./ ./

CMD ["sh", "./startup.sh"]
CMD ["npm", "run", "configure"]
14 changes: 13 additions & 1 deletion configurator/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,23 @@ const OPENHIM_API_USERNAME =
const OPENHIM_CLIENT_PASSWORD = process.env.OPENHIM_CLIENT_PASSWORD || 'interop-password';
const OPENHIM_USER_PASSWORD = process.env.OPENHIM_USER_PASSWORD || 'interop-password';

const OPENMRS_HOST = process.env.OPENMRS_HOST;
const OPENMRS_PORT = process.env.OPENMRS_PORT || 8080;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value here conflicts with the default value for OPENHIM_API_PORT.

const OPENMRS_USERNAME = process.env.OPENMRS_USERNAME;
const OPENMRS_PASSWORD = process.env.OPENMRS_PASSWORD;
const OPENMRS_PROTOCOL = process.env.OPENMRS_PROTOCOL || 'http';

module.exports = {
OPENHIM_API_HOSTNAME,
OPENHIM_API_PASSWORD,
OPENHIM_API_PORT,
OPENHIM_API_USERNAME,
OPENHIM_CLIENT_PASSWORD,
OPENHIM_USER_PASSWORD
OPENHIM_USER_PASSWORD,

OPENMRS_HOST,
OPENMRS_PORT,
OPENMRS_USERNAME,
OPENMRS_PASSWORD,
OPENMRS_PROTOCOL
};
4 changes: 4 additions & 0 deletions configurator/env.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ OPENHIM_PASSWORD = 'openhim-password';
OPENHIM_USERNAME = 'root@openhim.org';
OPENHIM_CLIENT_PASSWORD = 'interop-password';
OPENHIM_USER_PASSWORD = 'interop-password';

OPENMRS_HOST='openmrs'
OPENMRS_PASSWORD='Admin123'
OPENMRS_USERNAME='admin'
Loading