Last Updated: 2023-12-03
In Project S, I had an architecture whereby the client phone app called the /appointments endpoint and got a list of appointments. The idea was that the doctor would get all the appointments they need to handle for the next hour with one call. One of the main uses in the phone app was to give yes/no answers as to whether the patient in front of them was due at the exact time.
With time the /appointments endpoint needed a lot of join data. And the tables were getting bigger etc. This meant that the endpoint got steadily slower.
What we should have done instead is scan the appointment of each individual patient and then validate against the backend one by one. With that architecture, scaling would have been much easier.