Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

sensor_idyearfieldcountsumaveragestart_timeend_timeupdated
123452003temperature1208400.060.0


123452003pH120240.02.0



  • are start/end times for bins actually useful for anything? there could be holes in between endpoints
  • store completeness by sensor /stream?

bins_month

sensor_idmonthyearfieldcountsumaveragestart_timeend_timeupdated
1234562003temperature10600.060.0


1234562003pH1020.02.0


...

bins_special

year
sensor_idlabelhourdaymonthfieldcountsumaveragestart_timeend_timeupdated
12345water_yearspring2003temperature1360180.060.001/01/200303/31/2003
12345springpH36.02.001/01/200303/31/2003
12345springwater_year2003pH12.02.001/01/200301/31/2003

for bins_special, do we actually need count/sum/average here, or does it simply need a start/end time and an aggregation level (year/month/etc) that defines the custom aggregation unit and use the bins_year, bins_month to populate?

  • for spring, we get monthly averages only within start/end time
  • for spring, we get yearly average only including months within start/end

bins_special (alt option)

labelstart_timeend_timeupdated
springJan 1Mar 31
springJan 1Mar 31
  • if i want special bin by year, only consider points between start and end time. 
    • if start/end time includes entire year, use bins_year
    • if < 1 year time span, aggregate month + day bins until you cover entire time span
  • if i want by months, include each month between start/end time
    • for complete months, use bins_month
    • for partial months, aggregate day bins until you cover entire time span


Other possible tables:

bins_season - do we need to cache this, or calculate from monthly bins? latter option suggested above.

bins_total - do we need to cache this, or is it fast enough to calculate from yearly bins?

...

  • cron job (hourly? 5 minutes?)
  • whenever new datapoint is added (at most 1 bin per table would need to be created or updated) - upsert


Trends region

Image Added