Use sensor_id

Requires migration described in: ``` cql/20141105_sensor_id.cql ```
Make the ```(if...``` a function and write a test for it.