medic / cht-interoperability

CHT - eCHIS interoperability project
GNU Affero General Public License v3.0
2 stars 3 forks source link

23 mediator encounter endpoint #49

Closed njogz closed 1 year ago

njogz commented 1 year ago

Description

Create an endpoint for handling encounters in the mediator

Closes medic/interoperability#23

Code review checklist

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

andrablaj commented 1 year ago

@njogz I tried the LTFU flow by using this branch, and when I submitted the task, I got the following error in the sentinel log:

2023-03-29 11:49:05 ERROR: Failed to push f957f3a7-716a-4fe7-b7bf-c4dab15da839 to FHIR_encounter: Error: connect ECONNREFUSED 127.0.0.1:5001

Is there extra configuration needed for the encounter creation?

njogz commented 1 year ago

@andrablaj there is no extra config required. The issue was a URL that I had failed to update. I have done so and tested and it works well now.

njogz commented 1 year ago

I have tested the full LTFU workflow from creating a patient to sending a service request and submitting the resulting task in the CHT. It all works as expected (see screenshot below)

image

@lorerod I believe with the tests above this can be safely merged.

lorerod commented 1 year ago

Yes @njogz I agree.

andrablaj commented 1 year ago

Thanks @njogz! I tried to reproduce LTFU locally, and I don't see the task in the CHT anymore after submitting the service-request. I tried with several patients, destroyed and restarted the containers several times, and no change.

I nevertheless see the reports in the Reports tab, but somehow the Tasks don't get synched.

Screenshot 2023-03-30 at 13 13 29

Any thoughts?

andrablaj commented 1 year ago

OK, I deleted my cache, started over, and now I see all the tasks for the test patients I've previously created in the CHT:

Screenshot 2023-03-30 at 13 32 13

What's interesting is now, if I create a new patient, the service-request is failing with 500 - unable to create the follow-up task.

Screenshot 2023-03-30 at 13 46 46
njogz commented 1 year ago

Hmmm... I remember seeing the same error when testing the dockerise PR. It turned out that the cht password I had set in my environment was the one being picked and not the default one password. Do you mind logging the value of chtApiUrl created here to see if it's the correct value?

andrablaj commented 1 year ago

Sorry, I logged it as ERROR so I can see it 😅

2023-03-30 13:57:43 2023-03-30 13:57:43 ERROR: http:/admin:password@nginx/api/v2/records

Am I seeing this badly, or is there a missing /?

njogz commented 1 year ago

That looks okay to me. Do the same credentials work when you use them to log in on the CHT?

andrablaj commented 1 year ago

Yes, I use the same credentials to login into the CHT.

njogz commented 1 year ago

I'm not sure what's going on. I have not been able to replicate your issue despite recreating the containers a few times, but I am getting another weird error where the CHT config is undefined for some reason.

image
andrablaj commented 1 year ago

If I access the follow-up form flow via https://*****/contacts/patientUUID/report/interop_follow_up and submit it, I can see the encounter being submitted correctly.

Screenshot 2023-03-30 at 16 27 19

It's really the service-request that seems problematic. I will try the LTFU flow with the main branch.

andrablaj commented 1 year ago

OK, I managed to reproduce the problem with the main branch, so this does not seem connected to this PR. service-request is failing with unable to create the follow up task error.

Screenshot 2023-03-30 at 16 34 33

You can merge this PR, as the encounter endpoint works correctly. Can you open another issue to investigate why the task creation is suddenly broken?

njogz commented 1 year ago

Yes. I have create the issue

andrablaj commented 1 year ago

@njogz I found the problem, it was introduced with a previous PR. I managed to fix the main branch, I will open a PR shortly

andrablaj commented 1 year ago

@njogz I believe that with that fix, the flow should be back to normal. Can you please bring merge the main to this and let's try to test again?

njogz commented 1 year ago

I had already merged this to the main branch so testing on the main branch should be sufficient.