<commit_before>{% extends "base.html" %}

<!-- Example row of columns -->
{% block stuff %}

<div class="container-fluid">
  <h2>Project Applications</h2>

  <p>
    Counts of the different sequencing applications that have been run.
  </p>

  <div class="single_chart_container" id="chart_container">
    <svg id="pie"></svg>
  </div>

  <table class="table table-bordered" id="application_table">
    <thead></thead>
    <tbody></tbody>
  </table>
</div>

<script>
$.getJSON("/api/v1/applications", function(data) {
  for (d in data) {
    var trow = '<tr onclick="document.location = '
    trow += "'/application/" + d + "'"
    trow += '" onmouseover="this.style.cursor='
    trow += "'pointer'"
    trow += '">'
    trow += '<td>' + d + '</td><td>' + data[d]+ '</td></tr>'
    $("#application_table tbody").append(trow)
  };

  var f_data = [{key: "Applications", values: []}]
  for (d in data) {
    var app_count = Object()
    app_count.application = d
    app_count.count = data[d]
    f_data[0]["values"].push(app_count)
  }

  nv.addGraph(function() {
    var chart = nv.models.pieChart()
        .x(function(d) { return d.application })
        .y(function(d) { return d.count })
        .showLabels(true)

    d3.select("#pie")
        .datum(f_data)
        .call(chart)

    return chart
  })

})
</script>

{% end %}<commit_msg>Refactored applications.html to use server side generated plot<commit_after>{% extends "base.html" %}

<!-- Example row of columns -->
{% block stuff %}

<div class="container-fluid">
  <h2>Project Applications</h2>

  <p>
    Counts of the different sequencing applications that have been run.
  </p>

  <div class="single_chart_container" id="chart_container">
    <img src="/api/v1/applications.png">
  </div>

  <table class="table table-bordered" id="application_table">
    <thead></thead>
    <tbody></tbody>
  </table>

  <h2>Samples applications</h2>
  <div class="single_chart_container" id="chart_container">
    <img src="/api/v1/applications.png">
  </div>

</div>

<script>
$.getJSON("/api/v1/applications", function(data) {
  for (d in data) {
    var trow = '<tr onclick="document.location = '
    trow += "'/application/" + d + "'"
    trow += '" onmouseover="this.style.cursor='
    trow += "'pointer'"
    trow += '">'
    trow += '<td>' + d + '</td><td>' + data[d]+ '</td></tr>'
    $("#application_table tbody").append(trow)
  };

})

</script>

{% end %}
{'fraction_non_alphanumeric': 0.19834710743801653, 'fraction_numerical': 0.0049586776859504135, 'mean_word_length': 3.2473684210526317, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, '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': '3185489', 'n_tokens_mistral': 867, 'n_tokens_neox': 835, 'n_words': 184}