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

{% block breadcrumb_content %}
    {{ super() }}
    <li class="active">{% link_for _(title), controller='ckanext.nhm.controllers.stats:StatsController', action='records' %}</li>
{% endblock %}

{% block stats_content %}

      <section id="stats-total-datasets">
      <h4>{{ _('Total number of records') }}</h4>

      {% set xaxis = {'mode': 'time', 'timeformat': '%d-%m-%y'} %}
      {% set yaxis = {'min': 0, 'tickDecimals': 0} %}
      <table class="table table-chunky table-bordered table-striped" data-module="plot" data-module-xaxis="{{ h.dump_json(xaxis) }}" data-module-yaxis="{{ h.dump_json(yaxis) }}">
        <thead>
          <tr>
            <th>{{ _("Date") }}</th>
            <th>{{ _("Records") }}</th>
          </tr>
        </thead>
        <tbody>
          {% for row in c.num_records %}
            <tr>
              <th data-type="date" data-value="{{ row.date.strftime("%s") }}"><time datetime="{{ row.date.isoformat() }}">{{ h.render_datetime(row.date) }}</time></th>
              <td>{{ row.count }}</td>
            </tr>
          {% endfor %}
        </tbody>
      </table>
    </section>

    <section id="stats-record-count">
      <h4>{{ _('Records per dataset') }}</h4>

      <table class="table table-chunky table-bordered table-striped">
        <thead>
          <tr>
            <th>{{ _("Dataset") }}</th>
            <th>{{ _("Resource") }}</th>
            <th>{{ _("Number of records") }}</th>
          </tr>
        </thead>
        <tbody>

          {% for row in c.datastore_stats['resources'] %}

            {% set last_date = row.count.keys()[-1] %}



            <tr>
              <th><a href="{{ h.url_for(controller='package', action='read', id=row.pkg_name ) }}">{{ row.pkg_title }}</a></th>
              <th><a href="{{ h.url_for(controller='package', action='resource_read', id=row.pkg_name, resource_id=row.id ) }}">{{ row.name }}</a></th>
              <td>{{ h.delimit_number(row.count[last_date]) }}</td>
            </tr>
          {% endfor %}

          <tr>
              <td colspan="2">Total</td>
              <td>{{ h.delimit_number(c.datastore_stats['total']) }}</td>
          </tr>

        </tbody>
      </table>

      </section>

    <p class="info">Record statistics are updated daily - these figures were last updated on {{ h.render_datetime(c.datastore_stats['date']) }} </p>

{% endblock %}<commit_msg>Simplified stats endpoint<commit_after>{% extends "stats/base.html" %}

{% block breadcrumb_content %}
    {{ super() }}
    <li class="active">{% link_for _(title), controller='ckanext.nhm.controllers.stats:StatsController', action='records' %}</li>
{% endblock %}

{% block stats_content %}

      <section id="stats-total-datasets">
      <h4>{{ _('Total number of records') }}</h4>

      {% set xaxis = {'mode': 'time', 'timeformat': '%d-%m-%y'} %}
      {% set yaxis = {'min': 0, 'tickDecimals': 0} %}
      <table class="table table-chunky table-bordered table-striped" data-module="plot" data-module-xaxis="{{ h.dump_json(xaxis) }}" data-module-yaxis="{{ h.dump_json(yaxis) }}">
        <thead>
          <tr>
            <th>{{ _("Date") }}</th>
            <th>{{ _("Records") }}</th>
          </tr>
        </thead>
        <tbody>
          {% for row in c.num_records %}
            <tr>
              <th data-type="date" data-value="{{ row.date.strftime("%s") }}"><time datetime="{{ row.date.isoformat() }}">{{ h.render_datetime(row.date) }}</time></th>
              <td>{{ row.count }}</td>
            </tr>
          {% endfor %}
        </tbody>
      </table>
    </section>

    <section id="stats-record-count">
      <h4>{{ _('Records per dataset') }}</h4>

      <table class="table table-chunky table-bordered table-striped">
        <thead>
          <tr>
            <th>{{ _("Dataset") }}</th>
            <th>{{ _("Resource") }}</th>
            <th>{{ _("Number of records") }}</th>
          </tr>
        </thead>
        <tbody>

          {% for row in c.datastore_stats['resources'] %}
            <tr>
              <th><a href="{{ h.url_for(controller='package', action='read', id=row.pkg_name ) }}">{{ row.pkg_title }}</a></th>
              <th><a href="{{ h.url_for(controller='package', action='resource_read', id=row.pkg_name, resource_id=row.id ) }}">{{ row.name }}</a></th>
              <td>{{ h.delimit_number(row.total) }}</td>
            </tr>
          {% endfor %}

          <tr>
              <td colspan="2"><strong>Total</strong></td>
              <td><strong>{{ h.delimit_number(c.datastore_stats['total']) }}</strong></td>
          </tr>

        </tbody>
      </table>

      </section>

{% endblock %}
{'fraction_non_alphanumeric': 0.2191751700680272, 'fraction_numerical': 0.0031887755102040817, 'mean_word_length': 2.1963315217391304, 'pattern_counts': {'":': 0, '<': 133, '<?xml version=': 0, '>': 133, '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': '2758391', 'n_tokens_mistral': 1617, 'n_tokens_neox': 1513, 'n_words': 305}