<commit_before><div class="row-fluid">
  <div class="offset1 span10">
    <div class="row-fluid">&nbsp;</div>
    <div class="row-fluid">
      <div class="pull-left">
        <p class="lead">Search Results: (<%= pluralize(@results[:rows].count, 'row')%>)</p>
      </div>
      <div class="btn-group pull-right">
        <%= link_to(raw('<i class="icon-bookmark"></i> Link to this Search'), params.except(:authenticity_token), :class => 'btn btn-small') %>
        <%= link_to(raw('<i class="icon-download-alt icon-white"></i> Download Results (CSV)'), params.except(:authenticity_token).merge({:format => :csv}), :class => 'btn btn-small btn-primary') %>
      </div>
    </div>
    <div class="row-fluid">&nbsp;</div>
    <div class="row-fluid">
      <table class="table table-condensed table-bordered table-striped table-hover ">
        <tr>
          <th>OTU</th>
          <% @results[:columns][:categorical_traits].each do |trait| %>
            <th><%= trait[:name] %></th>
            <% if @results[:columns][:categorical_trait_notes_ids].include? trait[:id] %>
              <th>Notes: <%= trait[:name] %></th>
            <% end %>
          <% end %>
          <% @results[:columns][:continuous_traits].each do |trait| %>
            <th><%= trait[:name] %></th>
            <% if @results[:columns][:continuous_trait_notes_ids].include? trait[:id] %>
              <th>Notes: <%= trait[:name] %></th>
            <% end %>
          <% end %>
          <% @results[:columns][:otu_metadata_field_names].each do |metadata_field| %>
            <th><%= metadata_field %></th>
          <% end %>
        </tr>
        <% source_ids = [] %>
        <% @results[:rows].each do |otu_id, row_hash| %>
        <tr>
          <td><%= row_hash[:name] %>
          </td>
            <% @results[:columns][:categorical_traits].each do |trait|
              categorical_trait_values = row_hash[:categorical][trait[:id]] if row_hash[:categorical] %>
            <td>
              <% if categorical_trait_values
                   categorical_trait_values[:values].each do |value_hash|
                     value_hash.each do |value_id, formatted_value| %>
                      <%= formatted_value %>
                      <% if @results[:include_references]
                        source_reference_id = categorical_trait_values[:sources][value_id]
                        source_ids << source_reference_id unless source_reference_id.in? source_ids
                        source_number = source_ids.index(source_reference_id) + 1
                      %>
                        [<%= link_to("#{source_number}", "#source_#{source_number}") %>]
                      <% end %>
                      <% end %>
                  <% end %>
              <% end %>
            </td>
            <% if @results[:columns][:categorical_trait_notes_ids].include? trait[:id] %>
              <td><%= categorical_trait_values[:notes] if categorical_trait_values %></td>
            <% end %>
          <% end %>
          <% @results[:columns][:continuous_traits].each do |trait|
            continuous_trait_values = row_hash[:continuous][trait[:id]] if row_hash[:continuous] %>
            <td>
              <% if continuous_trait_values
                   continuous_trait_values[:values].each do |value_hash|
                     value_hash.each do |value_id, formatted_value| %>
                    <%= formatted_value %>
                    <% if @results[:include_references]
                         source_reference_id = continuous_trait_values[:sources][value_id]
                         source_ids << source_reference_id unless source_reference_id.in? source_ids
                         source_number = source_ids.index(source_reference_id) + 1
                    %>
                      [<%= link_to("#{source_number}", "#source_#{source_number}") %>]
                    <% end %>
                  <% end %>
                <% end %>
              <% end %>
            </td>
            <% if @results[:columns][:continuous_trait_notes_ids].include? trait[:id] %>
              <td><%= continuous_trait_values[:notes] if continuous_trait_values %></td>
            <% end %>
          <% end %>
          <% @results[:columns][:otu_metadata_field_names].each do |metadata_field_name| %>
            <td>
              <% if (row_hash[:metadata][metadata_field_name] || '').length > 30 %>
                <span class="notes_popover" rel="popover" data-content="<%= row_hash[:metadata][metadata_field_name] %>" data-original-title="<%= metadata_field_name %>"><%= truncate(row_hash[:metadata][metadata_field_name]) %></span>
              <% else %>
                <%= row_hash[:metadata][metadata_field_name] %>
              <% end %>
            </td>
          <% end %>
        </tr>
        <% end %>
      </table>
    </div>
    <% if @results[:include_references] %>
      <div class="row-fluid">
        <table class="table table-condensed table-bordered table-striped table-hover ">
          <tr></tr><th>#</th><th>Source</th></tr>
          <% source_ids.each_with_index do |source_id, index| %>
          <tr id="<%= "source_#{index + 1}" %>">
            <td><%= index + 1 %></td>
            <td><%= @results[:sources].find{|x| x[:id] == source_id}[:name] %></td>
          </tr>
          <% end %>
        </table>
      </div>
    <% end %>
   </div>
</div>
<script type="text/javascript">
  $(document).ready(function() {
    $('.notes_popover, .source_popover').popover({trigger: 'hover', html: true, placement: 'bottom', delay: {hide: 100} });
  });
</script><commit_msg>Add 'Sources' label to table<commit_after><div class="row-fluid">
  <div class="offset1 span10">
    <div class="row-fluid">&nbsp;</div>
    <div class="row-fluid">
      <div class="pull-left">
        <p class="lead">Search Results: (<%= pluralize(@results[:rows].count, 'row')%>)</p>
      </div>
      <div class="btn-group pull-right">
        <%= link_to(raw('<i class="icon-bookmark"></i> Link to this Search'), params.except(:authenticity_token), :class => 'btn btn-small') %>
        <%= link_to(raw('<i class="icon-download-alt icon-white"></i> Download Results (CSV)'), params.except(:authenticity_token).merge({:format => :csv}), :class => 'btn btn-small btn-primary') %>
      </div>
    </div>
    <div class="row-fluid">&nbsp;</div>
    <div class="row-fluid">
      <table class="table table-condensed table-bordered table-striped table-hover ">
        <tr>
          <th>OTU</th>
          <% @results[:columns][:categorical_traits].each do |trait| %>
            <th><%= trait[:name] %></th>
            <% if @results[:columns][:categorical_trait_notes_ids].include? trait[:id] %>
              <th>Notes: <%= trait[:name] %></th>
            <% end %>
          <% end %>
          <% @results[:columns][:continuous_traits].each do |trait| %>
            <th><%= trait[:name] %></th>
            <% if @results[:columns][:continuous_trait_notes_ids].include? trait[:id] %>
              <th>Notes: <%= trait[:name] %></th>
            <% end %>
          <% end %>
          <% @results[:columns][:otu_metadata_field_names].each do |metadata_field| %>
            <th><%= metadata_field %></th>
          <% end %>
        </tr>
        <% source_ids = [] %>
        <% @results[:rows].each do |otu_id, row_hash| %>
        <tr>
          <td><%= row_hash[:name] %>
          </td>
            <% @results[:columns][:categorical_traits].each do |trait|
              categorical_trait_values = row_hash[:categorical][trait[:id]] if row_hash[:categorical] %>
            <td>
              <% if categorical_trait_values
                   categorical_trait_values[:values].each do |value_hash|
                     value_hash.each do |value_id, formatted_value| %>
                      <%= formatted_value %>
                      <% if @results[:include_references]
                        source_reference_id = categorical_trait_values[:sources][value_id]
                        source_ids << source_reference_id unless source_reference_id.in? source_ids
                        source_number = source_ids.index(source_reference_id) + 1
                      %>
                        [<%= link_to("#{source_number}", "#source_#{source_number}") %>]
                      <% end %>
                      <% end %>
                  <% end %>
              <% end %>
            </td>
            <% if @results[:columns][:categorical_trait_notes_ids].include? trait[:id] %>
              <td><%= categorical_trait_values[:notes] if categorical_trait_values %></td>
            <% end %>
          <% end %>
          <% @results[:columns][:continuous_traits].each do |trait|
            continuous_trait_values = row_hash[:continuous][trait[:id]] if row_hash[:continuous] %>
            <td>
              <% if continuous_trait_values
                   continuous_trait_values[:values].each do |value_hash|
                     value_hash.each do |value_id, formatted_value| %>
                    <%= formatted_value %>
                    <% if @results[:include_references]
                         source_reference_id = continuous_trait_values[:sources][value_id]
                         source_ids << source_reference_id unless source_reference_id.in? source_ids
                         source_number = source_ids.index(source_reference_id) + 1
                    %>
                      [<%= link_to("#{source_number}", "#source_#{source_number}") %>]
                    <% end %>
                  <% end %>
                <% end %>
              <% end %>
            </td>
            <% if @results[:columns][:continuous_trait_notes_ids].include? trait[:id] %>
              <td><%= continuous_trait_values[:notes] if continuous_trait_values %></td>
            <% end %>
          <% end %>
          <% @results[:columns][:otu_metadata_field_names].each do |metadata_field_name| %>
            <td>
              <% if (row_hash[:metadata][metadata_field_name] || '').length > 30 %>
                <span class="notes_popover" rel="popover" data-content="<%= row_hash[:metadata][metadata_field_name] %>" data-original-title="<%= metadata_field_name %>"><%= truncate(row_hash[:metadata][metadata_field_name]) %></span>
              <% else %>
                <%= row_hash[:metadata][metadata_field_name] %>
              <% end %>
            </td>
          <% end %>
        </tr>
        <% end %>
      </table>
    </div>
    <% if @results[:include_references] %>
      <div class="row-fluid">
        <p class="lead">Sources</p>
      </div>
      <div class="row-fluid">
        <table class="table table-condensed table-bordered table-striped table-hover ">
          <tr></tr><th>#</th><th>Source</th></tr>
          <% source_ids.each_with_index do |source_id, index| %>
          <tr id="<%= "source_#{index + 1}" %>">
            <td><%= index + 1 %></td>
            <td><%= @results[:sources].find{|x| x[:id] == source_id}[:name] %></td>
          </tr>
          <% end %>
        </table>
      </div>
    <% end %>
   </div>
</div>
<script type="text/javascript">
  $(document).ready(function() {
    $('.notes_popover, .source_popover').popover({trigger: 'hover', html: true, placement: 'bottom', delay: {hide: 100} });
  });
</script>
{'fraction_non_alphanumeric': 0.17362462409340174, 'fraction_numerical': 0.0021227666725632407, 'mean_word_length': 2.0452464314570427, 'pattern_counts': {'":': 0, '<': 289, '<?xml version=': 0, '>': 289, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '105839', 'n_tokens_mistral': 3565, 'n_tokens_neox': 3250, 'n_words': 548}