Energieseminar / Inselfitness

1 stars 3 forks source link

created the forking fork #11

Closed julienthevenoz closed 7 months ago

julienthevenoz commented 7 months ago

Created the Inseldataframes class. Everyday 5min or whatever you can call write_to_daily which will simply take the last line of reading.csv, check it and add it to "daily.csv" if correct (if uncorrect, writes a dummy line instead ; I thought this way we can count how often data is incorrectly logged but maybe it's not useful).

Everyday you can call daily_cleanup which 0) deletes all the dummy/incorrect logged lines and tells you how many were deleted 1) creates/updates a monthly_file with 48 (2 per hour) datapoints from the daily_file 2) saves 4 datapoints (mean, median, max,min) of the daily_file to the forever_file.

Things that could possibly be left to do : I didn't include any getter functions yet. the write_to_monthly part assumes we are logging every 5 minutes (total of 288 datapoints). So to keep 2 datapoints per hour it simply ignores 5 in 6 datapoints (yes it's a crude mechanism). If we log more/less we need to change that number. Also this means if many lines have been logged uncorrectly and thus deleted, we actually will have less than 48 datapoints. For example if the logging has failed 10 times in the morning (278 datapoints), the loop will iterate through the 278 points, keeping one in 6, and the last point it will save will be 275 (276-1 because starts at 0) which will be the 46th point. TL;DR if logging works well no big deal, if it bugs a lot this system isn't ideal

FelixMau commented 7 months ago

Thank you very much for your contribution!

FYI: Changes will be made on original repo, if you like to follow on changes :)