Rest EndPoint to get All encounters and Patients

As my GSoC project, I am implementing an OWA page to show the number of users, patients and Encounters by grouping according to Location.

Require a rest endPoint to get All the Patients and Encounters in OpenMRS.

Any help is welcome.

cc: @suthagar23, @dkayiwa

I think, that will be overhead - we can’t get all patients in one shot. Can you think in a different way?

I think we should try getting location wise then .

location wise then means? How do you plan? Have you already checked our existing OpenMRS Available APIs?

@vankineenitawrun we already have endpoints to do that ,but it depends on what params you would want to configure . You can still write your own custom search handlers to make your own custom end point you may want want

@mozzy can please attach the resource for the custom search of encounter, patients and Also how to get the complete list.

Get the entities Location-wise, but I think this is not possible with the OpenMRS API’s. Yes checked the available API’s did n’t find helpful.

what about developing the API’s we required and use them?
@suthagar23

Can you give me short ideas about your plan? I don’t encourage to make changes in existing APIs, and exposing all patient information through a API as well.

To show the information of patients, users and encounters in the owa page of LBAC we need to get them.

For this building of Rest API’s. we are exposing only the information which he is accessible.

This is obvious :slight_smile:, To make this happen, How do you plan to make changes in the current implementation? Detail those changes here

First, on the loading of Page get the Locations UUID accessible by the user and get the individual entities of this location. Currently, there aren’t any API existing to get the entity by Location or get complete all entities at once.

For this, I am planning to build Rest API’s to get these details.

Not changing any Implementations that are already present. Planning on Adding Rest End-points in our Module.

Not changing any Implementations that are already present. Planning on Adding Rest End-points in our Module.

Can you draft the APIs and params here before making actual development?

GET request to get patients returns

{

“patient1”: “location1”,

“patient2” : “location2”,

… All the Accessible Patients. }

(or)

{
“Location1” : “patient1,patient2,…”,

“Location2”: “patient3,patient4…”

} similarly for encounters and Users.

{ “Location1” : “patient1,patient2,…”,

“Location2”: “patient3,patient4…”

}

This would be better, then how do you plan to get this information (Patients for a location)?

First get the patients in the system and then group them according to their Location.

{ "Total Patients": 9, "Outpatient Clinic": [], "Total Locations": 8, "Registration Desk": [ "james1" ], "Pharmacy": [], "Amani Hospital": [], "Unknown Location": [], "Inpatient Ward": [ "james3" ], "Laboratory": [ "p2", "p33", "p24" ], "Isolation Ward": [ "mk", "james2" ] } Sample output of the API.

What will happen, if a location has about 100K patients?

Owa Page for the patients.

since we are only showing the count wise distribution should we the change the API to return Location-wise count?

Nice UI, go ahead

What do you think about the API? Which one is most suitable for exposing the data of 100K patients?

since we are only showing the count of people from individual Location it is fine. Rather than names and extra information, we will Location-wise count.

changing to

{ “Total Patients”: 9, “Outpatient Clinic”: 0, “Total Locations”: 8, “Registration Desk”: 1, “Pharmacy”: 0, “Amani Hospital”: 0, “Unknown Location”: 0, “Inpatient Ward”: 1, “Laboratory”: 3, “Isolation Ward”: 4}