bellotastudios/gradecraft-development — pull request #275 by JangoSteve (2013-08-30 03:37:25+00:00)
Title: Mongo analytics

This isn't quite there yet, but it's pretty close. So far, it tracks predictor events and scores over time, per-assignment and per-assignment-per-user.

There are a couple new dependencies here, as this implementation requires both Redis and Mongo. The Redis part is only being used to queue up background jobs via [Sidekiq](http://sidekiq.org/) to make the analytics events lightning fast by not blocking the app. So it can easily be taken out if we'd like.

To get started with this, make sure MongoDB and Redis are installed. On Mac, these can both be installed with Homebrew:

```
brew install mongodb
brew install redis
```

Once these are installed, just start the app with foreman (make sure to run `bundle install` first).

```
foreman start
```

Now login as a student and start predicting some scores. The scores are being stored over time in the following aggregate intervals:

* all-time (total)
* yearly
* monthly
* weekly
* daily
* hourly
* minutely

As time goes one, we can decide which of these we want to keep for each analytics aggregate, but for now we'll just store everything.

Also, for now, we are storing each and every analytics event, but in the future as we scale, we can easily remove the individual event tracking without affecting the aggregate tracking in the analytics. In theory, all our graphs can be built by pulling all the pre-processed aggregate info from mongo, so removing the individual events should have no effect other than preventing us from adding new analytics based on the past events.

Left to do (for now):

1. Make some rake tasks for populating some analytics data (will make todo-3 easier).
2. Log login and logout events.
3. Implement graphs for staff analytics dashboard.