Appointment scheduling performance is slow

In Amman production we see that performance of appointment scheduling is slow. Below are the stats:

can we take a look at the Appointment scheduling performance: load page of appointment scheduling – it is 4.72 secs from the summary to the appointment list and then it is 5.39 seconds without the filter enabled. Also the save from the calendar view takes 4.97 seconds – when scheduling form the calendar view – additionally the slider remains open causing the user to click save multiple times and therefore the patient is scheduled several times. It takes 2.8 seconds for the slider to close

We have: 13 services 12 providers ~100 appointments/day

Raised JIRA defect for the same - https://bahmni.atlassian.net/browse/BAH-459

We are also analyzing from our side. Will keep this thread updated if there are any new findings. It would be great if someone can pick this up.

On debugging with @pramidat Pramida we found that the call to API that fetches appointments is happening twice. On is in https://github.com/Bahmni/openmrs-module-bahmniapps/blob/master/ui/app/appointments/appointmentInitialization.js and the other is happening when the DOM gets processed.(https://github.com/Bahmni/openmrs-module-bahmniapps/blob/c3712986b43fb5c10dfb5c5a5d10c90d493c37f9/ui/app/appointments/views/manage/calendar/calendarView.html#L3). As part of this card refactored this so that we don’t inject the appointments context in the controller and it happens only through DOM.

Another scope of performance improvement is when we switch views (calendar to list or the vice versa): we need not essentially make the API call as the data(list of appointments) is same and only the view changes. But this needs further thought (to understand the possibility) and refactoring. Creating a new card to track this: https://bahmni.atlassian.net/browse/BAH-462

2 Likes