<commit_before>module CleverIntegration::Parsers::Teacher

  def self.run(hash)
    name = self.generate_name(hash[:name][:first], hash[:name][:last])
    {
      clever_id: hash[:id],
      email: hash[:email].downcase,
      name: name,
      district_id: hash[:district]
    }
  end

  private

  def self.generate_name(first_name, last_name)
    JoinNames.new(first_name, last_name).call
  end
end
<commit_msg>add newrelic error catcher to teacher parser (#5306)<commit_after>module CleverIntegration::Parsers::Teacher

  def self.run(hash)
    begin
      name = self.generate_name(hash[:name][:first], hash[:name][:last])
      {
        clever_id: hash[:id],
        email: hash[:email].downcase,
        name: name,
        district_id: hash[:district]
      }
    rescue NoMethodError
      NewRelic::Agent.add_custom_attributes({
        user_info: hash
      })
      NewRelic::Agent.notice_error(e)
    end
  end

  private

  def self.generate_name(first_name, last_name)
    JoinNames.new(first_name, last_name).call
  end
end

{'fraction_non_alphanumeric': 0.12103746397694524, 'fraction_numerical': 0.0038424591738712775, 'mean_word_length': 3.288065843621399, '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': '1919094', 'n_tokens_mistral': 357, 'n_tokens_neox': 345, 'n_words': 63}