Skip to content
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

Failure to Sync Encounters and Observations from CHT to OpenMRS via Mediator #157

Open
lorerod opened this issue Jan 20, 2025 · 1 comment
Labels
Type: Bug Fix something that isn't working as intended

Comments

@lorerod
Copy link
Contributor

lorerod commented Jan 20, 2025

Describe the bug
Encounters and Observations created in CHT fail to sync to OpenMRS via the Mediator, with an error logged: "Not re-sending encounter from CHT."

To Reproduce

  1. Start the docker container using ./startup.sh up-openmrs
  2. Follow the steps in OpenHIM Admin Console guide, installing CHT Mediator and OpenMrs Mediator
  3. Follow the steps in Local setup of CHT Configuration guide
  4. Use the OpenMRS Interop.postman_collection.json with the corresponding dev.json env variables.
  5. Change "key": "CHT_ADMIN_USER" to have value admin instead of medic
  6. Execute the first six calls in the postman collection:
  • Mediator Status
  • OpenMRS Api Status
  • createPatientIdentifierType
  • createDocumentIdentifierType
  • CHT Create Patient
  • Get FHIR Patient
  1. Until this point, the mediator log looks fine. No errors. The last lines in the log:
2025-01-20 14:28:41 Node.js v18.20.5
2025-01-20 14:28:43 
2025-01-20 14:28:43 > [email protected] start
2025-01-20 14:28:43 > node ./dist/index.js
2025-01-20 14:28:43 
2025-01-20 14:28:45 2025-01-20 17:28:45 INFO: Server listening on port 6000 
2025-01-20 14:28:46 2025-01-20 17:28:46 INFO: Successfully registered mediator. 
2025-01-20 14:28:46 2025-01-20 17:28:46 INFO: Successfully registered mediator. 
  1. Execute OpenMRS FHIR Sync Patient
  2. Everything looks as expected.
  • Transactions log OpenHIM Admin console:

Image

  • Mediator log:
2025-01-20 14:43:11 2025-01-20 17:43:11 INFO: Comparing Patient 
2025-01-20 14:43:11 2025-01-20 17:43:11 INFO: Incoming:  
2025-01-20 14:43:11 2025-01-20 17:43:11 INFO: Outgoing: 2843bb6d46e7889001a1db73990007f9 
2025-01-20 14:43:11 2025-01-20 17:43:11 INFO: Sending Patient 2843bb6d46e7889001a1db73990007f9 to OpenMRS 
2025-01-20 14:43:13 2025-01-20 17:43:13 INFO: Updating Patient 2843bb6d46e7889001a1db73990007f9 with openMRSId cb643218-41e0-4dcf-9f1b-83c63a8c1bc9 
2025-01-20 14:43:14 2025-01-20 17:43:14 INFO: Comparing Encounter 
2025-01-20 14:43:14 2025-01-20 17:43:14 INFO: Incoming:  
2025-01-20 14:43:14 2025-01-20 17:43:14 INFO: Outgoing:  
  1. Execute the GET OpenMRS Patient step. It was successful with a response body containing "total": 1
  2. Execute CHT Create Report. The transactions log looks as expected:

Image

  1. Get FHIR Encounter returned a "total": 1 and Get FHIR Observations should return "total": 2 as expected.
  2. Execute OpenMRS FHIR Sync Encounter
  3. Mediator log shows an error:
2025-01-20 14:52:18 2025-01-20 17:52:18 INFO: Comparing Patient 
2025-01-20 14:52:18 2025-01-20 17:52:18 INFO: Incoming:  
2025-01-20 14:52:18 2025-01-20 17:52:18 INFO: Outgoing:  
2025-01-20 14:52:18 2025-01-20 17:52:18 INFO: Comparing Encounter 
2025-01-20 14:52:18 2025-01-20 17:52:18 INFO: Incoming:  
2025-01-20 14:52:18 2025-01-20 17:52:18 INFO: Outgoing: 26a633b6-9f43-43d5-a00a-302ffea26223 
2025-01-20 14:52:18 2025-01-20 17:52:18 ERROR: Not re-sending encounter from cht 26a633b6-9f43-43d5-a00a-302ffea26223 
  1. Transactions log in OpenHIM admin console look like this:

Image

  1. GET OpenMRS Encounter returns "total": 0, expected 1
  2. GET OpenMRS Observations returns "total": 0, expected 2.

Expected behavior
The OpenMRS Encounter and Observations should be created.

Environment

  • Branch: at the moment of the creation of this ticket, the branch I use is openmrs-mediator
  • Client platform: Docker desktop on MacOS Intel
@lorerod lorerod added the Type: Bug Fix something that isn't working as intended label Jan 20, 2025
@witash
Copy link
Contributor

witash commented Jan 28, 2025

It looks like the polling doesn't start automatically once the channel is added.
I was able to start it by going to the channel and saving it (without making any changes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Fix something that isn't working as intended
Projects
Status: No status
Development

No branches or pull requests

2 participants