Removed some slow code. Small bits of tidying up.
Refactored SQLAlchemy Models.

Added an intermediate table that represents the relationship between
series and device. Previously this was done via the data_point but as
the table was getting large the joins became slow.

In the process added Alembic for database migrations. This patch
includes the initial migration to get to the original state and the
migration to update and migrate data to the new models.