<commit_before>class StudentProfileChart < Struct.new :data

  def prepare_interventions(interventions)
    return if data[:interventions].blank?
    data[:interventions].with_start_and_end_dates.map do |intervention|
      intervention.to_highcharts
    end
  end

  def to_highcharts_growth_percentile_series(student_assessments)
    student_assessments.map do |s|
      [s.date_taken.year, s.date_taken.month, s.date_taken.day, s.growth_percentile]
    end
  end

  def to_highcharts_percentile_rank_series(student_assessments)
    student_assessments.map do |s|
      [s.date_taken.year, s.date_taken.month, s.date_taken.day, s.percentile_rank]
    end
  end

  def to_highcharts_scale_score_series(student_assessments)
    student_assessments.map do |s|
      [s.date_taken.year, s.date_taken.month, s.date_taken.day, s.scale_score]
    end
  end
<commit_msg>Guard against Missing Student Assessments<commit_after>class StudentProfileChart < Struct.new :data

  def prepare_interventions(interventions)
    return if data[:interventions].blank?
    data[:interventions].with_start_and_end_dates.map do |intervention|
      intervention.to_highcharts
    end
  end

  def to_highcharts_growth_percentile_series(student_assessments)
    return if student_assessments.is_a? MissingStudentAssessmentCollection
    student_assessments.map do |s|
      [s.date_taken.year, s.date_taken.month, s.date_taken.day, s.growth_percentile]
    end
  end

  def to_highcharts_percentile_rank_series(student_assessments)
    return if student_assessments.is_a? MissingStudentAssessmentCollection
    student_assessments.map do |s|
      [s.date_taken.year, s.date_taken.month, s.date_taken.day, s.percentile_rank]
    end
  end

  def to_highcharts_scale_score_series(student_assessments)
    return if student_assessments.is_a? MissingStudentAssessmentCollection
    student_assessments.map do |s|
      [s.date_taken.year, s.date_taken.month, s.date_taken.day, s.scale_score]
    end
  end

{'fraction_non_alphanumeric': 0.0757193336698637, 'fraction_numerical': 0.0, 'mean_word_length': 4.695402298850575, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3727870', 'n_tokens_mistral': 702, 'n_tokens_neox': 657, 'n_words': 112}