<commit_before>Template.residentActivityTypesChart.onRendered(function () {
  let activities = Template.currentData().activities;

  activities = _.map(activities, function (activity) {
    activity.type = activity.activityType();
    return activity;
  });

  // Group activities by activity type
  const activityTypeCounts = d3.nest()
    .key(function (activity) {
      return activity.type;
    })
    .rollup(function (activityType) { return activityType.length })
    .entries(activities);
});
<commit_msg>Comments<commit_after>Template.residentActivityTypesChart.onRendered(function () {
  // Get activities from template data
  let activities = Template.currentData().activities;

  // Add 'type' field to each activity,
  // Containing activity type name
  activities = _.map(activities, function (activity) {
    activity.type = activity.activityType();
    return activity;
  });

  // Group activities by activity type
  const activityTypeCounts = d3.nest()
    .key(function (activity) {
      return activity.type;
    })
    .rollup(function (activityType) { return activityType.length })
    .entries(activities);
});

{'fraction_non_alphanumeric': 0.1171806167400881, 'fraction_numerical': 0.001762114537444934, 'mean_word_length': 3.9177489177489178, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '926631', 'n_tokens_mistral': 316, 'n_tokens_neox': 308, 'n_words': 73}