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 
             
            
              
                
            
           
          
            
              
                suthagar23  
              
                  
                    August 10, 2019,  3:22pm
                   
                  2 
               
             
            
              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 .
             
            
              
            
           
          
            
              
                suthagar23  
              
                  
                    August 10, 2019,  4:08pm
                   
                  5 
               
             
            
              location wise then means? How do you plan?
Have you already checked our existing OpenMRS Available APIs?
             
            
              
            
           
          
            
              
                mozzy  
              
                  
                    August 10, 2019,  5:22pm
                   
                  6 
               
             
            
              
@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.
 suthagar23:
 
How do you plan?
 
 
what about developing the API’s we required and use them?@suthagar23 
             
            
              
            
           
          
            
              
                suthagar23  
              
                  
                    August 11, 2019, 12:19pm
                   
                  9 
               
             
            
              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.
             
            
              
            
           
          
            
              
                suthagar23  
              
                  
                    August 11, 2019, 12:47pm
                   
                  11 
               
             
            
              
 vankineenitawrun:
 
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 
             
            
              
            
           
          
            
            
              
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.
             
            
              
            
           
          
            
              
                suthagar23  
              
                  
                    August 11, 2019,  2:20pm
                   
                  13 
               
             
            
              
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)
{
“Location2”: “patient3,patient4…”
}
similarly for encounters and Users.
             
            
              
            
           
          
            
              
                suthagar23  
              
                  
                    August 12, 2019,  4:11am
                   
                  15 
               
             
            
              
{
“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.
             
            
              
            
           
          
            
            
              
 suthagar23:
 
This would be better,
 
 
 {     "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.
             
            
              
            
           
          
            
              
                suthagar23  
              
                  
                    August 13, 2019,  7:42am
                   
                  18 
               
             
            
              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?
             
            
              
            
           
          
            
              
                suthagar23  
              
                  
                    August 14, 2019,  2:34pm
                   
                  20 
               
             
            
              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.
 vankineenitawrun:
 
{ "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.
 
 
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}