<commit_before>module Genome
  module Importers
    module ClearityFoundation

      def self.source_info
        {
          base_url: 'https://www.clearityfoundation.org/healthcare-pros/',
          site_url: 'https://www.clearityfoundation.org/',
          citation: 'https://www.clearityfoundation.org/',
          source_db_version: '26-July-2013',
          source_type_id: DataModel::SourceType.INTERACTION,
          source_trust_level_id: DataModel::SourceTrustLevel.EXPERT_CURATED,
          source_db_name: 'ClearityFoundation',
          full_name: 'Clearity Foundation',
        }
      end

      def self.run(tsv_path)
        TSVImporter.import tsv_path, ClearityRow, source_info do
          interaction known_action_type: 'unknown' do
            gene :gene_name, nomenclature: 'Gene Target Symbol', transform: ->(x) { x.upcase } do
              name :entrez_gene_id, nomenclature: 'Entrez Gene ID'
              attribute :reported_gene_name, name: 'Clearity Reported Gene Name'
            end

            drug :drug_name, nomenclature: 'Primary Drug Name', primary_name: :drug_name do
              attribute :drug_class, name: 'Drug Class'
              name :drug_trade_name, nomenclature: 'Drug Trade Name'
              name :pubchem_id, nomenclature: 'PubChem Drug ID' 
              attribute :drug_subclass, name: 'Drug Classification'
              attribute :linked_class_info, name: 'Link to Clearity Drug Class Schematic'
            end

            attribute :interaction_mechanism, name: 'Mechanism of Interaction'
          end
        end.save!
      end
    end
  end
end
<commit_msg>only store drug trade names if they are present<commit_after>module Genome
  module Importers
    module ClearityFoundation

      def self.source_info
        {
          base_url: 'https://www.clearityfoundation.org/healthcare-pros/',
          site_url: 'https://www.clearityfoundation.org/',
          citation: 'https://www.clearityfoundation.org/',
          source_db_version: '26-July-2013',
          source_type_id: DataModel::SourceType.INTERACTION,
          source_trust_level_id: DataModel::SourceTrustLevel.EXPERT_CURATED,
          source_db_name: 'ClearityFoundation',
          full_name: '<NAME>',
        }
      end

      def self.run(tsv_path)
        blank_filter = ->(x) { x.blank? }
        TSVImporter.import tsv_path, ClearityRow, source_info do
          interaction known_action_type: 'unknown' do
            gene :gene_name, nomenclature: 'Gene Target Symbol', transform: ->(x) { x.upcase } do
              name :entrez_gene_id, nomenclature: 'Entrez Gene ID'
              attribute :reported_gene_name, name: 'Clearity Reported Gene Name'
            end

            drug :drug_name, nomenclature: 'Primary Drug Name', primary_name: :drug_name do
              attribute :drug_class, name: 'Drug Class'
              name :drug_trade_name, nomenclature: 'Drug Trade Name', unless: blank_filter
              name :pubchem_id, nomenclature: 'PubChem Drug ID' 
              attribute :drug_subclass, name: 'Drug Classification'
              attribute :linked_class_info, name: 'Link to Clearity Drug Class Schematic'
            end

            attribute :interaction_mechanism, name: 'Mechanism of Interaction'
          end
        end.save!
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.0849084908490849, 'fraction_numerical': 0.0036003600360036, 'mean_word_length': 2.408997955010225, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, 'https://': 6, 'lorem ipsum': 0, 'www.': 6, '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': '536011', 'n_tokens_mistral': 1014, 'n_tokens_neox': 938, 'n_words': 240}