<commit_before>class Outcome < StudyRelationship
  has_many :outcome_measured_values, autosave: true
  has_many :outcome_analyses, inverse_of: :outcome, autosave: true
  has_many :outcome_groups, inverse_of: :outcome, autosave: true
  has_many :result_groups, :through => :outcome_groups

  def self.create_all_from(opts)
    all=opts[:xml].xpath('//clinical_results').xpath("outcome_list").xpath('outcome')
    outcomes=[]
    xml=all.pop
    while xml
      opts[:outcome_xml]=xml
      opts[:xml]=xml
      opts[:result_type]='Outcome'
      opts[:groups]=create_group_set(opts)
      opts[:result_type]='Outcome'
      opts[:type]=xml.xpath('type').text
      opts[:title]=xml.xpath('title').text
      opts[:description]=xml.xpath('description').text
      opts[:time_frame]=xml.xpath('time_frame').text
      opts[:safety_issue]=xml.xpath('safety_issue').text
      opts[:population]=xml.xpath('population').text
      opts[:posting_date]=xml.xpath('posting_date').text
      o=new.create_from(opts)
      outcomes << o
      xml=all.pop
    end
    import outcomes.flatten, recursive: true
  end

  def attribs
    {
      :outcome_type   => get_opt('type'),
      :title          => get_opt('title'),
      :description    => get_opt('description'),
      :time_frame     => get_opt('time_frame'),
      :safety_issue   => get_opt('safety_issue'),
      :population     => get_opt('population'),
      :anticipated_posting_month_year  => get_opt('posting_date'),
      :outcome_groups          => OutcomeGroup.create_all_from({:outcome=>self,:groups=>opts[:groups]}),
      :outcome_measured_values => OutcomeMeasuredValue.create_all_from(opts.merge(:outcome=>self)),
      :outcome_analyses        => OutcomeAnalysis.create_all_from(opts.merge(:outcome=>self)),
    }
  end

end<commit_msg>remove unnecessary code<commit_after>class Outcome < StudyRelationship
  has_many :outcome_measured_values, autosave: true
  has_many :outcome_analyses, inverse_of: :outcome, autosave: true
  has_many :outcome_groups, inverse_of: :outcome, autosave: true
  has_many :result_groups, :through => :outcome_groups

  def self.create_all_from(opts)
    all=opts[:xml].xpath('//clinical_results').xpath("outcome_list").xpath('outcome')
    outcomes=[]
    xml=all.pop
    while xml
      opts[:outcome_xml]=xml
      opts[:xml]=xml
      opts[:result_type]='Outcome'
      opts[:groups]=create_group_set(opts)
      opts[:type]=xml.xpath('type').text
      opts[:title]=xml.xpath('title').text
      opts[:description]=xml.xpath('description').text
      opts[:time_frame]=xml.xpath('time_frame').text
      opts[:safety_issue]=xml.xpath('safety_issue').text
      opts[:population]=xml.xpath('population').text
      opts[:posting_date]=xml.xpath('posting_date').text
      o=new.create_from(opts)
      outcomes << o
      xml=all.pop
    end
    import outcomes.flatten, recursive: true
  end

  def attribs
    {
      :outcome_type   => get_opt('type'),
      :title          => get_opt('title'),
      :description    => get_opt('description'),
      :time_frame     => get_opt('time_frame'),
      :safety_issue   => get_opt('safety_issue'),
      :population     => get_opt('population'),
      :anticipated_posting_month_year  => get_opt('posting_date'),
      :outcome_groups          => OutcomeGroup.create_all_from({:nct_id=>opts[:nct_id],:outcome=>self,:groups=>opts[:groups]}),
      :outcome_measured_values => OutcomeMeasuredValue.create_all_from(opts.merge(:outcome=>self)),
      :outcome_analyses        => OutcomeAnalysis.create_all_from(opts.merge(:outcome=>self)),
    }
  end

end
{'fraction_non_alphanumeric': 0.1471078976640712, 'fraction_numerical': 0.0, 'mean_word_length': 4.00974930362117, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 30}, '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': '5591332', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1181, 'n_words': 152}