Creating aggregation at the SQL layer when downloading obs and encounters.