-
Notifications
You must be signed in to change notification settings - Fork 13
/
analytics_la_categories.html
134 lines (125 loc) · 5.93 KB
/
analytics_la_categories.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
---
title: Local authority category breakdown
layout: default
permalink: /analytics/local-authority-categories/
full_width: true
---
{% include breadcrumbs.html parent="Analytics" %}
{% assign COLOUR_NONE = "background-color:rgba(253, 5, 34, 1)" %}
{% assign COLOUR_LOW = "background-color:rgba(255, 123, 103, 1)" %}
{% assign COLOUR_MEDIUM = "background-color:rgba(255, 191, 177, 1)" %}
{% assign COLOUR_HIGH = "background-color:rgba(255, 255, 255, 1)" %}
{% assign HEADER = "writing-mode: vertical-lr; transform: rotate(180deg);" %}
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs/dt-1.12.1/fh-3.2.3/datatables.min.css"/>
<h1>{{ page.title }}</h1>
{% assign categories = site.data.categories %}
<table id="category-breakdown-table" class="table table-responsive table-bordered table-striped">
<thead>
<tr>
<th>Council</th>
{% for category in categories %}
<th><span style="{{HEADER}}">{{category.name }}</span></th>
{% endfor %}
<th>Total</th>
</tr>
</thead>
<tbody>
{% assign local_authorities = site.organizations | where: "type", "Local authority" %}
{% assign local_authorities_count = local_authorities | size %}
{% for la in local_authorities %}
{% assign dataset_count_total = 0 %}
<tr>
<td>{{ la.title }}</td>
{% for category in categories %}
{% assign dataset_count = site.datasets | where_exp: "item", "item.organization contains la.title" | where_exp: "item", "item.category contains category.name" | size %}
{% assign dataset_count_total = dataset_count_total | plus: dataset_count %}
{% if dataset_count < 1 %}
<td style="{{COLOUR_NONE}}">{{dataset_count}}</td>
{% elsif dataset_count >= 1 and dataset_count <= 3 %}
<td style="{{COLOUR_LOW}}">{{dataset_count}}</td>
{% elsif dataset_count >= 4 and dataset_count <= 6 %}
<td style="{{COLOUR_MEDIUM}}">{{dataset_count}}</td>
{% elsif dataset_count > 6 %}
<td style="{{COLOUR_HIGH}}">{{dataset_count}}</td>
{% else %}
<td>{{dataset_count}}</td>
{% endif %}
{% endfor %}
<th>{{dataset_count_total}}</th>
</tr>
{% endfor %}
</tbody>
<tfoot>
<tr>
<th># councils with no data</th>
{% for category in categories %}
{% assign las_no_data_count = 0 %}
{% for la in local_authorities %}
{% assign dataset_count = site.datasets | where_exp: "item", "item.organization contains la.title" | where_exp: "item", "item.category contains category.name" | size %}
{% if dataset_count == 0 %}
{% assign las_no_data_count = las_no_data_count | plus: 1 %}
{% endif %}
{% endfor %}
<td>{{las_no_data_count}}/{{ local_authorities_count }}</td>
{% endfor %}
<th style="background-color:#f9f9f9"></th>
</tr>
<tr>
<th>% of councils with no data</th>
{% for category in categories %}
{% assign las_no_data_count = 0 %}
{% for la in local_authorities %}
{% assign dataset_count = site.datasets | where_exp: "item", "item.organization contains la.title" | where_exp: "item", "item.category contains category.name" | size %}
{% if dataset_count == 0 %}
{% assign las_no_data_count = las_no_data_count | plus: 1 %}
{% endif %}
{% endfor %}
{% assign las_no_data_percent = las_no_data_count | times: 100.0 | divided_by: local_authorities_count %}
<td>{{ las_no_data_percent | round: 0 }}</td>
{% endfor %}
<th style="background-color:#f9f9f9"></th>
</tr>
</tfoot>
</table>
<section class="container">
<h2>Additional information</h2>
<p>Some datasets may have more than one category applied to them meaning that the total dataset count in the far-right total column is larger than the amount of datasets belonging to an organisation. For example, a Community Council boundaries dataset may have both the <em>Council and Government</em> and <em>Elections / Politics</em> categories applied.</p>
<p>The following colour scheme is employed for the number ranges in the table above:</p>
<table class="table table-bordered">
<thead>
<tr>
<th>Level</th>
<th>Range</th>
</tr>
</thead>
<tbody>
<tr style="{{COLOUR_NONE}}">
<td>None</td>
<td>0 datasets</td>
</tr>
<tr style="{{COLOUR_LOW}}">
<td>Low</td>
<td>1-3 datasets</td>
</tr>
<tr style="{{COLOUR_MEDIUM}}">
<td>Medium</td>
<td>4-6 datasets</td>
</tr>
<tr style="{{COLOUR_HIGH}}">
<td>High</td>
<td>7+ datasets</td>
</tr>
</tbody>
</table>
<p>We have set these number ranges as static values that we hope to evolve over time as the landscape of Open Data in Scotland evolves. As of this moment, there too great a disparity between the upper and lower ranges of datasets to automatically generate range groupings based on the minimum, median and maximum count of datasets per category.</p>
<p>We welcome any feedback on how we can improve our scoring system. If you have any comments, suggestions or want to tell us if something doesn't look right, please <a href="/about/#contact_us">contact us</a>.</p>
</section>
<script type="text/javascript" src="https://cdn.datatables.net/v/bs/dt-1.12.1/fh-3.2.3/datatables.min.js"></script>
<script>
$('#category-breakdown-table').DataTable( {
fixedHeader: true,
dom: 't',
paging: false,
ordering: false
} );
</script>