<commit_before>{% from os.path import basename %}
{% from qiita_pet.handlers.util import download_link_or_path %}

<!-- modal view to enter preprocessing parameters -->
<div class="modal fade" id="preprocess-modal-view-{{prep_id}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Choose preprocessing parameters</h4>
      </div>
      <form action="/study/preprocess" method="post" onsubmit='return submit_preprocess();'>
        <div class="modal-body">
          <div>
            <div class="form-group">
              <table>
                {% for idx, form_item in enumerate(preprocess_form, start=1) %}
                  <tr>
                    <td width="50%">{% raw form_item.label %}</td>
                    <td width="50%">{% raw form_item(tabindex=idx, class_='form-control') %}</td>
                  </tr>
                {% end %}
                <tr>
                  <td>
                    <input type='submit' id='start_preprocess_submit' class='btn btn-success' value="Start preprocessing">
                    <input type='hidden' name='study_id' value="{{study_id}}">
                    <input type='hidden' name='prep_template_id' value="{{prep_id}}">
                  </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
        <div class="modal-footer">
        </div>
      </form>
    </div>
  </div>
</div>

<div class="panel panel-default">
  <div class="panel-heading">
    <h4 class="panel-title">
      <a data-toggle="collapse" data-parent="#prep-accordion" href="#collapse{{prep_id}}">{{data_type}} (ID: {{prep_id}})</a>
    </h4>
  </div>
  <div id="collapse{{prep_id}}" class="panel-collapse collapse">
    <div class="panel-body">
      <b>Files:</b><br/>
      <table border="0" style="margin-left: 10px;">
        <tr>
          <td style="padding:3px;">
            <a class="btn btn-default glyphicon glyphicon-eye-open" href="/metadata_summary/?study_id={{study_id}}&prep_template={{prep_id}}" style="word-spacing: -10px;"> Show prep template summary</a>
          </td>
        </tr>
        {% for ptid, ptpath, ptype in filepaths %}
          <tr>
            <td>
            {% raw download_link_or_path(is_local_request, ptpath, ptid, ptype) %}
            </td>
          </tr>
        {% end %}
      </table>
      <br/>
      {% if is_editable %}
        <!-- We pass a 0 as a preprocessed data id here, since the preprocessed data 0 does not exists -->
        {% module EditInvestigationType(ena_terms, user_defined_terms, prep_id, investigation_type, 0) %}
      {% end %}
      <br/>
      {% if not preprocessed_data or preprocessing_status.startswith('failed') %}
        {% if study_status == 'sandbox' %}
          <a class="btn btn-primary glyphicon glyphicon-play" data-toggle="modal" data-target="#preprocess-modal-view-{{prep_id}}" style="word-spacing: -10px;"> Preprocess</a>
        {% end %}
          <br>
          <i>Status:</i> {{preprocessing_status}}
          <br>
          {% if 'zero-size array' in preprocessing_status %}
            <b>Your barcodes do not seem to match your prep template info</b>
          {% end %}
      {% else %}
        <b>Preprocessed data generated: </b>
        <a href="#" onClick="display_tab('preprocessed_data_tab', {{preprocessed_data[0]}});">{{preprocessed_data[0]}}</a>
        {% for pdi in preprocessed_data[1:] %}<commit_msg>@squirrelo and @ElDeveloper were complaining<commit_after>{% from os.path import basename %}
{% from qiita_pet.handlers.util import download_link_or_path %}

<!-- modal view to enter preprocessing parameters -->
<div class="modal fade" id="preprocess-modal-view-{{prep_id}}" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title" id="myModalLabel">Choose preprocessing parameters</h4>
      </div>
      <form action="/study/preprocess" method="post" onsubmit='return submit_preprocess();'>
        <div class="modal-body">
          <div>
            <div class="form-group">
              <table>
                {% for idx, form_item in enumerate(preprocess_form, start=1) %}
                  <tr>
                    <td width="50%">{% raw form_item.label %}</td>
                    <td width="50%">{% raw form_item(tabindex=idx, class_='form-control') %}</td>
                  </tr>
                {% end %}
                <tr>
                  <td>
                    <input type='submit' id='start_preprocess_submit' class='btn btn-success' value="Start preprocessing">
                    <input type='hidden' name='study_id' value="{{study_id}}">
                    <input type='hidden' name='prep_template_id' value="{{prep_id}}">
                  </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
        <div class="modal-footer">
        </div>
      </form>
    </div>
  </div>
</div>

<div class="panel panel-default">
  <div class="panel-heading">
    <h4 class="panel-title">
      <a data-toggle="collapse" data-parent="#prep-accordion" href="#collapse{{prep_id}}">{{data_type}} (ID: {{prep_id}})</a>
    </h4>
  </div>
  <div id="collapse{{prep_id}}" class="panel-collapse collapse">
    <div class="panel-body">
      <b>Files:</b><br/>
      <table border="0" style="margin-left: 10px;">
        <tr>
          <td style="padding:3px;">
            <a class="btn btn-default glyphicon glyphicon-eye-open" href="/metadata_summary/?study_id={{study_id}}&prep_template={{prep_id}}" style="word-spacing: -10px;">Show prep template summary</a>
          </td>
        </tr>
        {% for ptid, ptpath, ptype in filepaths %}
          <tr>
            <td>
            {% raw download_link_or_path(is_local_request, ptpath, ptid, ptype) %}
            </td>
          </tr>
        {% end %}
      </table>
      <br/>
      {% if is_editable %}
        <!-- We pass a 0 as a preprocessed data id here, since the preprocessed data 0 does not exists -->
        {% module EditInvestigationType(ena_terms, user_defined_terms, prep_id, investigation_type, 0) %}
      {% end %}
      <br/>
      {% if not preprocessed_data or preprocessing_status.startswith('failed') %}
        {% if study_status == 'sandbox' %}
          <a class="btn btn-primary glyphicon glyphicon-play" data-toggle="modal" data-target="#preprocess-modal-view-{{prep_id}}" style="word-spacing: -10px;"> Preprocess</a>
        {% end %}
          <br>
          <i>Status:</i> {{preprocessing_status}}
          <br>
          {% if 'zero-size array' in preprocessing_status %}
            <b>Your barcodes do not seem to match your prep template info</b>
          {% end %}
      {% else %}
        <b>Preprocessed data generated: </b>
        <a href="#" onClick="display_tab('preprocessed_data_tab', {{preprocessed_data[0]}});">{{preprocessed_data[0]}}</a>
        {% for pdi in preprocessed_data[1:] %}
{'fraction_non_alphanumeric': 0.16833830306316075, 'fraction_numerical': 0.006505828137706696, 'mean_word_length': 2.369406392694064, 'pattern_counts': {'":': 0, '<': 157, '<?xml version=': 0, '>': 157, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4628782', 'n_tokens_mistral': 2410, 'n_tokens_neox': 2206, 'n_words': 489}