medic / cht-interoperability

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

Create subscription resource in FHIR server once follow up request is received #26

Closed njogz closed 1 year ago

njogz commented 1 year ago

This will enable the requesting system to be notified once a follow up request has been done.

njogz commented 1 year ago

Steps for AT testing:

  1. Make sure you have a local CHT instance running and the config is loaded. Also ensure you are logged in as an offline user and not an admin.
  2. Create a new patient in the CHT. This ensures that the patient is also created in the FHIR database.
  3. Get the patient's UUID and use that in the sample payload { "patient_id": "<generated_uuid>", "callback_url": "<a_URL_where_the_status_should_be_sent>" }
  4. Use a client like Postman or CUrl to send the payload in the previous step to http://localhost:5001/mediator/service-request
  5. Head back to the CHT and click on the tasks tab. A new task for the created patient should be listed on the left hand side. If it is not click on the Sync now menu which is the first item on the hamburger menu on the top right of your screen.
  6. Fill in the form attached to the task and submit. The callback url you provided in the request should be called with a status of the encounter.
andrablaj commented 1 year ago

Thanks for the clarifications @njogz! I got to step n. 2 so far. 😅

This ensures that the patient is also created in the FHIR database.

How can we check that the patient is created in the FHIR Database? I think sharing the relevant URLs would be very helpful.

njogz commented 1 year ago

@andrablaj you can have a look at the openHIM admin console at http://localhost:9000. The transaction log will have the requests and there should be one to a fhir/Patient endpoint and the response should be a 201 with the FHIR resource that was created.

andrablaj commented 1 year ago

@njogz @samuelimoisili @lorerod I will share here the steps I followed to try to reproduce the flow in this ticket:

  1. Run CHT locally in development mode.
  2. Upload the config from this branch.
  3. A simple way to verify if the config is loaded correctly is to access a URL like https://*****.my.local-ip.co/#/contacts/someUUID/report/interop_follow_up and to retrieve correctly the follow up form.
  4. Login as an offline user in CHT.
  5. Run OpenHIM locally as instructed in the README.
  6. Create a patient in CHT. At this step, we should see a fhir/Patient resource creation in the Transaction log of Admin Console. However, I am unable to see that resource creation in the log at this point.
  7. Optional step: check the config via http://localhost:5984/_utils/#database/medic/settings.
  8. Make a LTFU request via Postman, on http://localhost:5001/mediator/service-request. The body should look like this:
    { 
    "patient_id": "uuid-of-the-patient-previously-created", 
    "callback_url": "https://interop.free.beeceptor.com/callback" 
    }

    I stopped here as I didn't manage to have the patient creation work properly in step 6.

Any configuration that I might have missed that is not yet documented in this ticket?

lorerod commented 1 year ago

@njogz @samuelimoisili I'm having the same issue as @andrablaj

  1. Run CHT locally in development mode.
  2. Upload the config from this branch.
  3. Put the interoperability project up using 26-create-subscription-resource branch and following the README
  4. I check the mediator calling GET http://localhost:5001/mediator/ and got a 200 ok with body
    {
    "status": "success"
    }
  5. Login to my local CHT as an offline user.
  6. Create a patient in CHT.
  7. I can't see a fhir/Patient resource creation in the Transaction log of Admin Console. This is what I see:

Captura de pantalla 2023-02-24 a la(s) 16 36 01

  1. I made a LTFU request via Postman, on http://localhost:5001/mediator/service-request:
    { "patient_id": "c4d3e29f-e908-49ea-82d9-099421eb138a", 
    "callback_url": "https://interop.free.beeceptor.com/callback" }

    And I got 500 Interval Server Error as response.

  2. Checked the Transaction log of Admin Console and I can see this:

Captura de pantalla 2023-02-24 a la(s) 16 38 28

Maybe we are missing some configuration in the CHT?

njogz commented 1 year ago

@andrablaj @lorerod there was a misconfiguration in the cht-config that I have since fixed. The request for creating a patient should work now.

andrablaj commented 1 year ago

@njogz, thank you for the updates!

I uploaded the updated config from here, and followed the same steps as here, but I still don't see the

fhir/Patient resource creation in the Transaction log of Admin Console

Do you have any suggestions on how to check what I am doing differently?