care
care copied to clipboard
Cache counts on /api/v1/facility/ route
/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