I'm writing an app to control water consumptions in different water meters. Simplifying it, I can get a list of readings of the consumption in each meter each 15 minutes. I have a query that returns something like this:
Date | ReadingPoint | Consumption
-----------------+--------------+------------
03/05/2014 02:00 | 1 | 12
03/05/2014 02:00 | 2 | 12
03/05/2014 02:15 | 1 | 7
03/05/2014 02:15 | 2 | 7
03/05/2014 02:30 | 1 | 11
03/05/2014 02:30 | 2 | 11
03/05/2014 02:45 | 1 | 23
03/05/2014 02:45 | 2 | 23
....
I need to periodically store some pre-calculations over these readings. Some examples:
- Store the total consumption of each day
- Store the maximum reading of each day
- Store the monthly average consumption
This calculations are user-defined, so I'm not sure how to modelize this. This pre-calculated tables will be intensively queried, so I think the ideal way to do it is to store each calculation in a different table, but I'm not sure if django can do this kind of dynamic model creation.
So here are my questions:
I'm sure there are tools to do this kind of things, but I've never needed to do this before, and I'd like to avoid days or weeks of research and testing. Is there any "standard" way to achieve this behaviour?
For launching the process(es) that make the pre-calculations I'm thinking of using Celery. Is it a right choice?