wip(history): add aggregate query for HAIs