add groupby for Study.modalities_counts