<commit_before>class InteractionSearchResultApiPresenter
  def initialize(search_result)
    @result = search_result
  end

  def search_term
    @result.search_term
  end

  def gene_name
    gene.name
  end

  def gene_long_name
    gene.long_name
  end

  def potentially_druggable_categories
    gene.gene_claims.flat_map { |gc| gc.gene_claim_categories }
    .map { |c| c.name }
    .uniq
  end

  def has_interactions?
    @interactions.size > 0
  end

  def interactions
    @interactions ||= @result.interaction_claims.map do |i|
      InteractionWrapper.new(i)
    end
  end

  private
  def gene
    @result.interaction_claims
      .first
      .gene_claim
      .genes
      .first
  end

  InteractionWrapper = Struct.new(:interaction_claim) do
    def types_string
      interaction_claim
        .interaction_claim_types
        .map(&:type)
        .join(',')
    end

    def interaction_id
      interaction_claim.id<commit_msg>Fix interaction search result API<commit_after>class InteractionSearchResultApiPresenter
  def initialize(search_result)
    @result = search_result
  end

  def search_term
    @result.search_term
  end

  def gene_name
    gene.name
  end

  def gene_long_name
    gene.long_name
  end

  def potentially_druggable_categories
    gene.gene_claims.flat_map { |gc| gc.gene_claim_categories }
    .map { |c| c.name }
    .uniq
  end

  def has_interactions?
    @interactions.size > 0
  end

  def interactions
    @interactions ||= @result.interaction_claims.map do |i|
      InteractionWrapper.new(i)
    end
  end

  private
  def gene
    @result.interaction_claims
      .first
      .interaction
      .gene
  end

  InteractionWrapper = Struct.new(:interaction_claim) do
    def types_string
      interaction_claim
        .interaction_claim_types
        .map(&:type)
        .join(',')
    end

    def interaction_id
      interaction_claim.id
{'fraction_non_alphanumeric': 0.0679304897314376, 'fraction_numerical': 0.00105318588730911, 'mean_word_length': 2.6468330134357005, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1459397', 'n_tokens_mistral': 639, 'n_tokens_neox': 609, 'n_words': 132}