Move project stats function to aggregates module.