[agg] Refactor: remove get_datasets function, present twice