Implement last updated feature of mongo engine

Implement MongoStorageEngine.get_last_updated. Given a data-set name
return the most recent _updated_at timestamp. This is required to be
able to determine if a data-set has been updated recently enough to be
considered up to date.
Integrate last updated feature of mongo engine

This introduces a new data-set class called NewDataSet. This is a
temporary class for the duration of the refactor that, once complete can
be renamed to DataSet. The external interface of is_recent_enough stays
exactly the same, but internally it defers to the storage engine for to get
the last update time.

This also integrates is_recent_enough with the read API detailed status view
that makes use of it.
Implement empty data set feature of mongo engine

Implement MongoStorageEngine.empty method to allow a data set to be
emptied.
Integrate empty data set feature with write API
Implement save method on MongoStorageEngine
Integrate storage engine save with write API

Integrate the new MongoStorageEngine save method with the write API and
admin app. The integration with the admin app is not right, but fixing
that at the same time is a bit too much.

This required a bit of refactoring.
1. Create a store method with the same interface as parse_and_store on
   NewDataSet
2. Refactor pre-processing steps to be a series of functions applied to
   the records and refactor tests
3. Add some tests around those steps being called
4. Integrate NewDataSet with the write API

This commit does not include removing the legacy saving code and tests.
Removes redundant saving code

Removes code related to the previous method of saving. See previous commits
for context.

- Remove saving from DataSet, it is being done in NewDataSet
- Remove Record, it is no longer necesarry, dicts are used instead.
- Remove test code associated with the dead code.
Add delete_dataset method to mongo storage engine

I missed this one in earlier commits and only realised when I tried to
remove the Database class from the write API.
Integrate dataset deletion against mongo storage
Refactor mongo db access and cleanup

- Rename from storage to mongo to be explicit about the fact we're dealing
  with a pymongo object here.
- Add a common clean_mongo method to do the cleanup
- Move mongo methods into the base client as they're part of the commong
  interface.
Remove Database from write and admin apps

It is no longer needed, MongoStorageEngine is used instead.
Set '_updated_at' when a record is saved

The '_updated_at' should when the record was last updated. This was
missed in the earlier save work.
Add basic querying to MongoStorageEngine

Add the ability to do the most basic form of query with no filtering,
limiting, sorting or grouping.

Ensure datetime fields are converted to UTC.
Add ability to filter to MongoStorageEngine.query

Add the ability to filter by field and by start / end times.
Add sort and limit to MongoStorageEngine.query
Add group and period to MongoStorageEngine.query

This adds the group_by and period parameters. However, this does not
implement collect fields. That will come in a later commit.
Add collect fields to MongoStorageEngine.query

Add collect fields to grouped queries. This just adds the collecting of
the values, applying collect functions to these will be implemented
outside of the storage engine for the moment as it is currently done in
python.
Integrate mongo storage engine query

This is the smallest change I could figure out to integrate the mongo
storage engine's query.
Highlights:
- No response munging is done in the mongo layer now, it's done in
  NewDataSet
- A few functions about the query have been moved into properties on the
  Query object.
- None of the flask apps depend on DataSet or Database anymore
Move DataSet tests over to NewDataSet

Rewrite some tests on DataSet to the new class NewDataSet.
Change migrations to depend on MongoStorageEngine

This is a hack and migrations should be removed or fixed properly.

This change marks all existing migrations as deprecated as they don't
really make so much sense with the new model.