rapidpro / casepro

Case management dashboard for RapidPro
BSD 3-Clause "New" or "Revised" License
21 stars 31 forks source link

Track daily counts of replies sent by different users, partners and orgs #70

Closed rowanseymour closed 8 years ago

rowanseymour commented 8 years ago

Currently on partner dashboard we should counts of replies sent by that partner's users. These are calculated on the fly, and that works for our production instance because total number of replies is still < 100,000.

With upcoming org-level dashboard and as database grows, need to add proper tracking of these counts. We can track on a per-day basis and aggregate to generate per-month charts.

From our experience with RapidPro, the most reliable way to track counts and avoid database deadlocks is to use an insert/squash pattern. As new items are created, they insert a count into a table, and a background process is responsible for squashing those into daily totals.

rowanseymour commented 8 years ago

Added in https://github.com/rapidpro/casepro/pull/71