<commit_before>ActiveAdmin.register EvidenceItem do
  menu :priority => 3
  permit_params :description, :clinical_significance, :evidence_direction, :rating, :evidence_level_id

  config.sort_order = 'updated_at_desc'

  filter :description
  filter :variant
  filter :clinical_significance
  filter :rating
  filter :evidence_direction
  filter :status
  filter :evidence_level

  controller do
    def scoped_collection
      resource_class.includes(:creator, variant: [:gene])
    end
  end

  form do |f|
    f.semantic_errors(*f.object.errors.keys)
    f.inputs do
      f.input :description
      f.input :clinical_significance
      f.input :evidence_direction
      f.input :evidence_level
      f.input :rating
    end
    f.actions
  end

  index do
    selectable_column
    column :gene do |ei|
      ei.variant.gene.name if ei.variant && ei.variant.gene
    end
    column :variant
    column :description
    column :clinical_significance<commit_msg>add collections for drop-down filtering<commit_after>ActiveAdmin.register EvidenceItem do
  menu :priority => 3
  permit_params :description, :clinical_significance, :evidence_direction, :rating, :evidence_level_id

  config.sort_order = 'updated_at_desc'

  filter :description
  filter :variant_gene_id, as: :select, collection: ->(){ Gene.order(:name).all }, label: 'Gene'
  filter :variant, as: :select, collection: ->(){ Variant.order(:name).all }
  filter :clinical_significance, as: :select, collection: ->(){ EvidenceItem.uniq.pluck(:clinical_significance) }
  filter :rating, as: :select, collection: ->(){ EvidenceItem.uniq.pluck(:rating).sort }
  filter :evidence_direction, as: :select, collection: ->(){ EvidenceItem.uniq.pluck(:evidence_direction) }
  filter :status, as: :select, collection: ->(){ EvidenceItem.uniq.pluck(:status) }
  filter :evidence_level

  controller do
    def scoped_collection
      resource_class.includes(:creator, variant: [:gene])
    end
  end

  form do |f|
    f.semantic_errors(*f.object.errors.keys)
    f.inputs do
      f.input :description
      f.input :clinical_significance
      f.input :evidence_direction
      f.input :evidence_level
      f.input :rating
    end
    f.actions
  end

  index do
    selectable_column
    column :gene do |ei|
      ei.variant.gene.name if ei.variant && ei.variant.gene
    end
    column :variant
    column :description
    column :clinical_significance
{'fraction_non_alphanumeric': 0.1016597510373444, 'fraction_numerical': 0.0008298755186721991, 'mean_word_length': 3.7367387033398822, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '2852943', 'n_tokens_mistral': 793, 'n_tokens_neox': 719, 'n_words': 179}