to the draft parser (incorporating patch from trunk), store the extracted country instead of trying to turn it into an ISO country code, add country and continent name models and add initial data for those, add helper function for cleaning the countries, add author country and continent charts, move the affiliation models to stats/models.py, fix a bunch of bugs. - Legacy-Id: 12846
125 lines
3.4 KiB
HTML
125 lines
3.4 KiB
HTML
<h3>{{ stats_title }}</h3>
|
|
|
|
<div id="chart"></div>
|
|
|
|
<script>
|
|
var chartConf = {
|
|
chart: {
|
|
type: 'column'
|
|
},
|
|
title: {
|
|
text: '{{ stats_title|escapejs }}'
|
|
},
|
|
xAxis: {
|
|
type: "category",
|
|
title: {
|
|
text: 'Country'
|
|
}
|
|
},
|
|
yAxis: {
|
|
title: {
|
|
text: 'Number of authors'
|
|
}
|
|
},
|
|
tooltip: {
|
|
formatter: function () {
|
|
var s = '<b>' + this.points[0].key + '</b>';
|
|
|
|
$.each(this.points, function () {
|
|
s += '<br/>' + chartConf.yAxis.title.text + ': ' + this.y;
|
|
});
|
|
|
|
return s;
|
|
},
|
|
shared: true
|
|
},
|
|
series: {{ chart_data }}
|
|
};
|
|
</script>
|
|
|
|
<h3>Data</h3>
|
|
|
|
<table class="table table-condensed stats-data">
|
|
<thead>
|
|
<tr>
|
|
<th>Country</th>
|
|
<th>Percentage of authors</th>
|
|
<th>Authors</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for country, percentage, names in table_data %}
|
|
<tr>
|
|
<td>{{ country|default:"(unknown)" }}</td>
|
|
<td>{{ percentage|floatformat:2 }}%</td>
|
|
<td>{% include "stats/includes/number_with_details_cell.html" %}</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
|
|
<p>The country information for an author can vary between documents,
|
|
so the sum of multiple rows in the table can be more than 100%. This
|
|
is especially true for the row with unknown country information -
|
|
many authors may have one or more author entries with an
|
|
unrecognized country.</p>
|
|
|
|
<p>An author is counted in EU if the country is a member of the EU
|
|
now, even if that was not the case at publication.
|
|
EU members:
|
|
{% for c in eu_countries %}{{ c.name }}{% if not forloop.last %}, {% endif %}{% endfor %}.</p>
|
|
|
|
<h3>Country Aliases</h3>
|
|
|
|
<p>In generating the above statistics, some heuristics have been
|
|
applied to figure out which country each author is from.</p>
|
|
|
|
{% if request.GET.showaliases %}
|
|
<p><a href="{{ hide_aliases_url }}" class="btn btn-default">Hide generated aliases</a></p>
|
|
|
|
{% if request.user.is_staff %}
|
|
<p>Note: since you're an admin, some extra links are visible. You
|
|
can either correct a document author entry directly in case the
|
|
information is obviously missing or add an alias if an unknown
|
|
<a href="{% url "admin:name_countryname_changelist" %}">country name</a>
|
|
is being used.
|
|
</p>
|
|
|
|
{% endif %}
|
|
|
|
{% if alias_data %}
|
|
<table class="table table-condensed">
|
|
<thead>
|
|
<th>Country</th>
|
|
<th>Alias</th>
|
|
<th></th>
|
|
</thead>
|
|
|
|
{% for name, alias, country in alias_data %}
|
|
<tr>
|
|
<td>
|
|
{% ifchanged %}
|
|
{% if country and request.user.is_staff %}
|
|
<a href="{% url "admin:name_countryname_change" country.pk %}">
|
|
{% endif %}
|
|
{{ name|default:"(unknown)" }}
|
|
{% if country and request.user.is_staff %}
|
|
</a>
|
|
{% endif %}
|
|
{% endifchanged %}
|
|
</td>
|
|
<td>{{ alias }}</td>
|
|
<td>
|
|
{% if request.user.is_staff and name != "EU" %}
|
|
<a href="{% url "admin:doc_documentauthor_changelist" %}?country={{ alias|urlencode }}">Matching authors</a>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</table>
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
<p><a href="{{ show_aliases_url }}" class="btn btn-default">Show generated aliases</a></p>
|
|
{% endif %}
|