<commit_before>{% extends "bookmarks/email_base.html" %}
{% load template_extras %}
{% load humanize %}
{% block title %}Your monthly alert from OpenPrescribing{% endblock %}

{% block content %}

<p><b>Hello!</b></p>

<p>Welcome to your your monthly update about <a href="{{ domain }}{{ bookmark.dashboard_url }}">{{bookmark.name}}</a>.</p>

<p>{{ intro_text }}</p>

{% if has_stats %}
  {% if stats.best %}
  <h3 class="better"><img src="cid:{{info_icon}}">Prescribing measures in the best decile</h3>
    {% for measure in stats.best %}
      {% if forloop.first %}
        <p>Over the last three months, this {{ bookmark.org_type }} was in the best decile on
        <a href="{{ domain }}{{ bookmark.dashboard_url }}#{{measure.id}}">{{ measure.name }}</a>.
      {% elif stats.best|length == 2 %}
        It was also in the best decile on <a href="{{ domain }}{{ bookmark.dashboard_url }}#{{measure.id}}">{{ measure.name }}</a>.</p>
      {% else %}
        {% if forloop.counter == 2 %}</p>
          It was also in the best decile on:
          <ul>
        {% endif %}
            <li><a href="{{ domain }}{{ bookmark.dashboard_url }}#{{measure.id}}">{{ measure.name }}</a></li>
        {% if forloop.last %}
          </ul>
        {% endif %}
      {% endif %}
    {% endfor %}
  {% endif %}

  {% if stats.most_changing.improvements %}
    <h3 class="better"><img src="cid:{{info_icon}}">Prescribing measures which are getting better</h3>
      {% for measure, percent_from, percent_to, _ in stats.most_changing.improvements %}
        {% if forloop.counter == 1 %}
          <p>This {{ bookmark.org_type }} improved by {{percent_from|delta:percent_to|wholenum}} centiles over the last 9 months on <a href="{{ domain }}{{ bookmark.dashboard_url }}#{{measure.id}}">{{ measure.name }}</a>.
        {% elif stats.most_changing.improvements|length == 2 %}
          It also improved by {{percent_from|delta:percent_to|wholenum}} centiles on <a href="{{ domain }}{{ bookmark.dashboard_url }}#{{measure.id}}">{{ measure.name }}</a>.</p>
        {% else %}<commit_msg>Add invitation to get in touch to start of email<commit_after>{% extends "bookmarks/email_base.html" %}
{% load template_extras %}
{% load humanize %}
{% block title %}Your monthly alert from OpenPrescribing{% endblock %}

{% block content %}

<p><b>Hello!</b></p>

<p>Welcome to your your monthly update about <a href="{{ domain }}{{ bookmark.dashboard_url }}">{{bookmark.name}}</a>.</p>

<p>{{ intro_text }}</p>

<p>These alerts are still experimental, so if you see things that don't make sense, then please let us know by replying to this email!</p>

{% if has_stats %}
  {% if stats.best %}
  <h3 class="better"><img src="cid:{{info_icon}}">Prescribing measures in the best decile</h3>
    {% for measure in stats.best %}
      {% if forloop.first %}
        <p>Over the last three months, this {{ bookmark.org_type }} was in the best decile on
        <a href="{{ domain }}{{ bookmark.dashboard_url }}#{{measure.id}}">{{ measure.name }}</a>.
      {% elif stats.best|length == 2 %}
        It was also in the best decile on <a href="{{ domain }}{{ bookmark.dashboard_url }}#{{measure.id}}">{{ measure.name }}</a>.</p>
      {% else %}
        {% if forloop.counter == 2 %}</p>
          It was also in the best decile on:
          <ul>
        {% endif %}
            <li><a href="{{ domain }}{{ bookmark.dashboard_url }}#{{measure.id}}">{{ measure.name }}</a></li>
        {% if forloop.last %}
          </ul>
        {% endif %}
      {% endif %}
    {% endfor %}
  {% endif %}

  {% if stats.most_changing.improvements %}
    <h3 class="better"><img src="cid:{{info_icon}}">Prescribing measures which are getting better</h3>
      {% for measure, percent_from, percent_to, _ in stats.most_changing.improvements %}
        {% if forloop.counter == 1 %}
          <p>This {{ bookmark.org_type }} improved by {{percent_from|delta:percent_to|wholenum}} centiles over the last 9 months on <a href="{{ domain }}{{ bookmark.dashboard_url }}#{{measure.id}}">{{ measure.name }}</a>.
        {% elif stats.most_changing.improvements|length == 2 %}
          It also improved by {{percent_from|delta:percent_to|wholenum}} centiles on <a href="{{ domain }}{{ bookmark.dashboard_url }}#{{measure.id}}">{{ measure.name }}</a>.</p>
        {% else %}
{'fraction_non_alphanumeric': 0.1901783646050498, 'fraction_numerical': 0.004169562195969423, 'mean_word_length': 3.2837301587301586, 'pattern_counts': {'":': 0, '<': 75, '<?xml version=': 0, '>': 75, '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': '6958638', 'n_tokens_mistral': 1483, 'n_tokens_neox': 1350, 'n_words': 381}