Generalize stats_data for filtering
Merge pull request #4265 from dimagi/generalize_stats_data

Generalize stats_data for filtering