<commit_before>{% extends 'base.html' %}
{% load i18n %}

{% block body_class %}{% endblock %}

{% block title %}{% trans "API for candidates" %}{% endblock %}

{% block hero %}
  <h1>{% trans "Using the candidate data" %}</h1>
{% endblock %}

{% block content %}

<div class="help-api">

<div class="panel callout radius">
  <h2>Using our data</h2>
  <p>The data on this site is provided under a <a href="https://creativecommons.org/licenses/by-sa/3.0/">
    CC BY-SA license.</a></p>
  <p>This means you are free to reuse the data for any reason, as long as you give attribution to "Democracy Club"
    and any reuse is shared under the same license.  <a href="https://creativecommons.org/licenses/by-sa/3.0/">
      Please read the full terms for more information.</a></p>
  <p>This license excludes:</p>
  <ul>
    <li>The party logos, which are taken from the Electoral Commission's website</li>
    <li>Candidate photos, which are typically either submitted by the candidates themselves,
      or from sources where it seems reasonable that we might use them on this site,
      such as the party's official page for that candidate, or their social media profile picture.</li>
  </ul>
  <p>If the CC-BY-SA licence is problematic for you, but you feel that you have a worthwhile use of the data in mind,
    please contact us to discuss your situation further.</p>
  <h3>Giving attribution</h3>
  <p>If you are reusing our data, please credit "Democracy Club" on the same page(s) as the data is used,
    and provide a link (or write the URL in the case of printed material) to
    <a href="https://democracyclub.org.uk">https://democracyclub.org.uk</a></p>
  <p>We would like you to include <a href="https://democracyclub.org.uk/static/images/logo-large.png">
    our logo</a> alongside the data, but we understand that this won't always be possible.</p>
</div>


<p>{% blocktrans trimmed %}
The data that's submitted to this site is available as a CSV/Excel download and
programmatically via a RESTful API.
{% endblocktrans %}</p>

<h2>{% trans "Election results" %}</h2>

<p>{% blocktrans trimmed %}
There is <a href="{{ help_results_url }}">a separate page
explaining how to get election results from this site</a>.
{% endblocktrans %}</p>

<h2>{% trans "CSV/Excel Download" %}</h2>

  <h3>{% trans "All Candidates" %}</h3>

  <p>{% blocktrans trimmed %}
    This CSV file contains details of all candidates in the database
  {% endblocktrans %}</p>

  <ul>
    <li><a href="{{ MEDIA_URL }}candidates-all.csv">{% blocktrans %}Download of the all candidates {% endblocktrans %}</a></li>
  </ul>

  {% for era in grouped_elections %}
    <div>
      <h3>{% if era.current %}
        {% trans "Current Elections" %}
      {% else %}
        {% trans "Past Elections" %}
      {% endif %}</h3>
        {% for date, roles in era.dates.items %}
        <h4>{{ date }}</h4>
          {% for role_data in roles %}
            <h5>{{ role_data.role }}</h5>
            <ul>
              {% for election in role_data.elections %}
                {% with slug=election.election.slug title=election.election.name %}
                  <li><a href="{{ MEDIA_URL }}candidates-{{ slug }}.csv">{% blocktrans %}Download of the {{ title }} candidates {% endblocktrans %}</a></li>
                {% endwith %}
              {% endfor %}
            </ul>
          {% endfor %}
        {% endfor %}

  </div>
  {% endfor %}

<h2>{% trans "API" %}</h2>

<h3>{% trans "This API is a work in progress" %}</h3>

<p>
  {% blocktrans trimmed %}
    This is an alpha version of the YourNextRepresentative API,<commit_msg>Link to API and CSV sections form header para<commit_after>{% extends 'base.html' %}
{% load i18n %}

{% block body_class %}{% endblock %}

{% block title %}{% trans "API for candidates" %}{% endblock %}

{% block hero %}
  <h1>{% trans "Using the candidate data" %}</h1>
{% endblock %}

{% block content %}

<div class="help-api">


<p>{% blocktrans trimmed %}
The data that's submitted to this site is available as a <a href="#csv">CSV/Excel download</a> and
<a href="#api">programmatically via a RESTful API</a>.
{% endblocktrans %}</p>


<div class="panel callout radius">
  <h2>Using our data</h2>
  <p>The data on this site is provided under a <a href="https://creativecommons.org/licenses/by-sa/3.0/">
    CC BY-SA license.</a></p>
  <p>This means you are free to reuse the data for any reason, as long as you give attribution to "Democracy Club"
    and any reuse is shared under the same license.  <a href="https://creativecommons.org/licenses/by-sa/3.0/">
      Please read the full terms for more information.</a></p>
  <p>This license excludes:</p>
  <ul>
    <li>The party logos, which are taken from the Electoral Commission's website</li>
    <li>Candidate photos, which are typically either submitted by the candidates themselves,
      or from sources where it seems reasonable that we might use them on this site,
      such as the party's official page for that candidate, or their social media profile picture.</li>
  </ul>
  <p>If the CC-BY-SA licence is problematic for you, but you feel that you have a worthwhile use of the data in mind,
    please contact us to discuss your situation further.</p>
  <h3>Giving attribution</h3>
  <p>If you are reusing our data, please credit "Democracy Club" on the same page(s) as the data is used,
    and provide a link (or write the URL in the case of printed material) to
    <a href="https://democracyclub.org.uk">https://democracyclub.org.uk</a></p>
  <p>We would like you to include <a href="https://democracyclub.org.uk/static/images/logo-large.png">
    our logo</a> alongside the data, but we understand that this won't always be possible.</p>
</div>


<h2>{% trans "Election results" %}</h2>

<p>{% blocktrans trimmed %}
There is <a href="{{ help_results_url }}">a separate page
explaining how to get election results from this site</a>.
{% endblocktrans %}</p>

<h2 id="csv">{% trans "CSV/Excel Download" %}</h2>

  <h3>{% trans "All Candidates" %}</h3>

  <p>{% blocktrans trimmed %}
    This CSV file contains details of all candidates in the database
  {% endblocktrans %}</p>

  <ul>
    <li><a href="{{ MEDIA_URL }}candidates-all.csv">{% blocktrans %}Download of the all candidates {% endblocktrans %}</a></li>
  </ul>

  {% for era in grouped_elections %}
    <div>
      <h3>{% if era.current %}
        {% trans "Current Elections" %}
      {% else %}
        {% trans "Past Elections" %}
      {% endif %}</h3>
        {% for date, roles in era.dates.items %}
        <h4>{{ date }}</h4>
          {% for role_data in roles %}
            <h5>{{ role_data.role }}</h5>
            <ul>
              {% for election in role_data.elections %}
                {% with slug=election.election.slug title=election.election.name %}
                  <li><a href="{{ MEDIA_URL }}candidates-{{ slug }}.csv">{% blocktrans %}Download of the {{ title }} candidates {% endblocktrans %}</a></li>
                {% endwith %}
              {% endfor %}
            </ul>
          {% endfor %}
        {% endfor %}

  </div>
  {% endfor %}

<h2 id="api">{% trans "API" %}</h2>

<h3>{% trans "This API is a work in progress" %}</h3>

<p>
  {% blocktrans trimmed %}
    This is an alpha version of the YourNextRepresentative API,
{'fraction_non_alphanumeric': 0.1473972602739726, 'fraction_numerical': 0.007671232876712329, 'mean_word_length': 3.071946458449526, 'pattern_counts': {'":': 0, '<': 155, '<?xml version=': 0, '>': 155, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2352736', 'n_tokens_mistral': 2441, 'n_tokens_neox': 2224, 'n_words': 843}