Rewrite get_domain_stats_data function
Merge pull request #4253 from dimagi/rewrite_domain_stats

Rewrite get_domain_stats_data function