care icon indicating copy to clipboard operation
care copied to clipboard

Cache counts on /api/v1/facility/ route

Open sainak opened this issue 5 months ago • 1 comments

/api/v1/facility/ is causing n+1 quires due to count of beds and patients, to optimize this, instead store the count in redis tasks:

  • store count of active patients and beds in redis
  • invalidate count when the data changes
  • come up with an optimized way or storing count of multiple facilities if it doesnt exists
  • make the helper funcions abstract so that they can be used with other fields/models

sainak avatar Sep 22 '24 11:09 sainak