VEH-22: Journey Stats Generation



Issue Information

Issue Type: Sub-task
 
Priority: Major
Status: In Progress

Reported By:
Ben Tasker
Assigned To:
Ben Tasker
Project: VehMan (VEH)
Resolution: Unresolved
Target version: 1.5,

Created: 2013-11-02 14:30:09
Time Spent Working
Child of: VEH-17: Stats Submodule


Description
Need to create a module similar to that in VEH-19 to generate statistics based on JourneyTracks (chosen as adding a stat indicator to the trackpoints table would massively increase the table size due to the number of records)


Issue Links

Toggle State Changes

Activity


btasker added '1.0.1' to Fix Version
Stats might include

- Daily journey time
- Time moving
- Time stationary
- Avg Speed
- Modal Speed
- Distance travelled (Might be a bit processor intensive though)
- Number of journeys recorded

Part way through implementation, but current implementation is likely to fail if journeys falling within a day are processed in seperate stats runs - something that's more likely with the monthly stats. Will need to rework the selection mechanism to ensure that the full day/month gets reworked.

An alternative would be to create a couple of stats points so that average speeds could be worked out incrementally. So as well as the stats above, we'd have the following stored in the stats table (though not necessarily user visible)

- Total speed (a sum of all trackpoints)
- Trackpoint count

Wouldn't help with modal speed though, the only way to (accurately) recalculate that would be to run back over all the trackpoints (which for an entire month might be an incredibly expensive operation)
The only way to accurately get a modal speed is going to be to re-process the speeds. Take the following example

|Day|Speeds|Modal|
|1|65 65 65 65 65 65 70 70|65|
|2|65 70 70 70|70|
|3|65 65 65 65 70 70 70 70 70|70|

There are 10x70, 11x65 in that table. If we use the calculated modals we get a modal speed of 70, wherehas if we combine the number we (correctly) get 65.

One option might be to defer generation of monthly stats until the end of the month, and then re-run the month if a new journey trackpoint is added. Would need to get the scheduler up and running first though.

In the meantime, it probably makes sense to just not store the modal speed for the month (as hitting this issue for days is less likely) and where needed to aggregate the daily. Will raise a seperate bug for the fix.
btasker changed status from 'Open' to 'In Progress'
As a temporary workaround, the aggregate modal should be used when generating charts/stats. As it's a temporary workaround we'll just not store that data in the stats table until a proper fix is created for VEH-33.

Actually, given the potential for mis-calculations until this is resolved, I'm going to defer the fix until a later version.
btasker added '1.5' to Fix Version
btasker removed '1.0.1' from Fix Version