Skip to content

Commit

Permalink
further cleanup jazzmin templates
Browse files Browse the repository at this point in the history
  • Loading branch information
open-risk committed Apr 22, 2022
1 parent 7a18d08 commit 1204f21
Show file tree
Hide file tree
Showing 22 changed files with 19,672 additions and 622 deletions.
9,455 changes: 9,455 additions & 0 deletions cpvdata.csv

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions dumpfixtures.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
#!/bin/bash
source ./venv/bin/activate
python3 manage.py dumpdata --format=json --indent 2 reference.GPCSector -o reference/fixtures/GPCSector.json

python3 manage.py dumpdata --format=json --indent 2 start.DocPage -o start/fixtures/DocPage.json
python3 manage.py dumpdata --format=json --indent 2 start.ORMKeyword -o start/fixtures/ORMKeyword.json

python3 manage.py dumpdata --format=json --indent 2 reference.EmissionFactor -o reference/fixtures/EmissionFactor.json
python3 manage.py dumpdata --format=json --indent 2 reference.BuildingEmissionFactor -o reference/fixtures/BuildingEmissionFactor.json
python3 manage.py dumpdata --format=json --indent 2 start.ORMKeyword -o start/fixtures/ORMKeyword.json
python3 manage.py dumpdata --format=json --indent 2 start.DocPage -o start/fixtures/DocPage.json
python3 manage.py dumpdata --format=json --indent 2 reference.GPCSector -o reference/fixtures/GPCSector.json

python3 manage.py dumpdata --format=json --indent 2 portfolio.PortfolioManager -o portfolio/fixtures/PortfolioManager.json
python3 manage.py dumpdata --format=json --indent 2 portfolio.Project -o portfolio/fixtures/Project.json
python3 manage.py dumpdata --format=json --indent 2 portfolio.ProjectActivity -o portfolio/fixtures/ProjectActivity.json
python3 manage.py dumpdata --format=json --indent 2 portfolio.PrimaryEffect -o portfolio/fixtures/PrimaryEffect.json
python3 manage.py dumpdata --format=json --indent 2 portfolio.SecondaryEffect -o portfolio/fixtures/SecondaryEffect.json
python3 manage.py dumpdata --format=json --indent 2 portfolio.GPCEmissionsSource -o portfolio/fixtures/GPCEmissionsSource.json

python3 manage.py dumpdata auth.User --indent 2 > start/fixtures/users.json
python3 manage.py dumpdata auth.Group --indent 2 > start/fixtures/groups.json
python3 manage.py dumpdata --format=json --indent 2 portfolio.PointSource -o portfolio/fixtures/PointSource.json
Expand Down
4 changes: 3 additions & 1 deletion loadfixtures.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/bash
source ./venv/bin/activate

python3 manage.py loaddata start/fixtures/DocPage.json
python3 manage.py loaddata start/fixtures/ORMKeyword.json
python3 manage.py loaddata reference/fixtures/GPCSector.json

python3 manage.py loaddata reference/fixtures/EmissionFactor.json
python3 manage.py loaddata reference/fixtures/BuildingEmissionFactor.json
python3 manage.py loaddata reference/fixtures/GPCSector.json


python3 manage.py loaddata reference/fixtures/NUTS3PointData.json

Expand Down
4 changes: 4 additions & 0 deletions policy/static/policy/css/policy.css
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,10 @@ table.display thead th {
color: #000;
}

.dark-mode .card .card {
color: #262323!important;
}

.category {
padding: 7px;
}
Expand Down
47 changes: 47 additions & 0 deletions policy/static/policy/js/table_metrics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// DATATABLE OF METRICS
//

var dictionary = {
"Max" : ["Maximum Value", "The maximum value observed for the timeseries, at any time"],
"Q75" : ["75% Percentile", "One in four observations is above this threshold"],
"Median" : ["Median Value", "Half of the observations are above (below) this threshold"],
"Q25" : ["25% Percentile", "One in four observations is below this threshold"],
"Min" : ["Minimum Value", "The minimum value observed for the timeseries, at any time"],
"Vol" : ["Volatility", "The standard deviation calculated using the entire timeseries"],
"Mean" : ["Mean Value", "The average observation calculated using the entire timeseries"],
"ObsCount" : ["No of Observations", "The total number of valid observations"],
"FirstDate" : ["Earliest Measurement", "The first available observation"],
"LastDate" : ["Latest Measurement", "The latest (most recent) available observation"],
"Frequency" : ["Measurement Frequency", "The time interval between successive observations"],
"Skew" : ["Skew", "The third moment of the distribution calculated using all observations"],
"Kurtosis" : ["Kurtosis","The fourth moment of the distribution calculated using all observations"]
}

var metricSet = [];
for (var key in dictionary) {
var dataEntry = [dictionary[key][0], metrics[key], dictionary[key][1]];
metricSet.push(dataEntry);
}
metricSet.push(["Measurement Unit", units, "The unit of measurement (or percentage)"]);


table2 = $('#metrics').DataTable( {
data: metricSet,
"bPaginate": false,
"responsive": true,
"bSort" : false,
"ordering": false,
"info": false,
"searching": false,
"pageLength": -1,
columns: [
{ width: "25%", title: "Risk Metrics" },
{ width: "15%", title: "Values" },
{ width: "60%", title: "Description" },
]
} );




12 changes: 6 additions & 6 deletions policy/templates/policy/dataflow_country_aggregate.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ <h4><i class="fa fa-info-circle"></i> Aggregate Country Data</h4>
<td>{{ DataSeries.title_long }}</td>
<td>{{ DataSeries.last_observation_date }}</td>
<td><a href="{% url 'policy:DataSeries2' DataSeries.identifier %}"
target="_blank"> <i
class="fa fa-table fa-2x"></i> </a> <a
href="{% url 'policy:Plot' DataSeries.identifier %}" target="_blank"> <i
class="fa fa-area-chart fa-2x"></i> </a> <a
href="{% url 'policy:Metrics' DataSeries.identifier %}" target="_blank"> <i
class="fa fa-thermometer fa-2x"></i> </a>
target="_blank"> <i class="fas fa-border-all fa-2x"></i> </a>
<a href="{% url 'policy:Plot' DataSeries.identifier %}" target="_blank">
<i class="fas fa-chart-area fa-2x"></i>
</a>
<a href="{% url 'policy:Metrics' DataSeries.identifier %}" target="_blank"> <i
class="fas fa-thermometer fa-2x"></i> </a>
</td>
</tr>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion policy/templates/policy/dataseries_metrics.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends "start/generic.html" %}
{% extends "start/tabular.html" %}
{% load i18n static %}
{% load custom_tags %}
{% load humanize %}
Expand Down
99 changes: 99 additions & 0 deletions policy/templates/policy/dataseries_plot.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
{% extends "start/d3.html" %}
{% load i18n static %}
{% load custom_tags %}
{% load humanize %}

{% block extrastyle %}
{{ block.super }}
<link rel="stylesheet" type="text/css" href="{% static 'policy/css/policy.css' %}"/>
{% endblock %}

{% block extrahead %}
{{ block.super }}
<script type="text/javascript" charset="utf-8"
src="{% static 'policy/js/timeseries_graph_numerical.js' %}"></script>
<script type="text/javascript" charset="utf-8"
src="{% static 'policy/js/timeseries_graph_ordinal.js' %}"></script>
{% endblock %}

{% block title %}
{{ title }} Policy Data Plot for {{ object.title }}
{% endblock %}

{% block messages %}
<div class="helpblock" id="page_content_front">
<h4><i class="fa fa-area-chart"></i> Policy Data: Timeseries Plot</h4>
<p class="helpblocktext"><b>Dataseries: {{ object.title }}</b><br><i>Details: {{ object.title_long }}</i></p>
</div>
{% endblock %}

{% block content %}

{% include "policy/ds_breadcrumb.html" %}


<div class="card card-primary card-outline">
<div class="card-body">
<div id="timeseries_graph" style="background-color: white"></div>
</div>
</div>
<div class="card card-primary card-outline">
<div class="card-body">
{% if object.field_type == 'numerical' %}
<h3>Summary Statistics:</h3>
<table id="metrics" style="width:180px">
<tr class="even">
<td>Maximum Value</td>
<td>{{ maxval }}</td>
</tr>
<tr class="odd">
<td>Minimum Value</td>
<td>{{ minval }}</td>
</tr>
<tr class="even">
<td>Average Value</td>
<td>{{ average }}</td>
</tr>
<tr class="odd">
<td>Latest Value</td>
<td>{{ latest }}</td>
</tr>
<tr>
<td></td>
</tr>
<tr class="odd">
<td>Date</td>
<td id="date_element">2020-01-05</td>
</tr>
<tr class="even">
<td>Value</td>
<td id="value_element">0</td>
</tr>
</table>
{% else %}
<h3>Policy Value Dictionary:</h3>
<table id="metrics">
{% for key, value in code_list.items %}
<tr>
<td>{{ key }}</td>
<td>{{ value }}</td>
</tr>
{% endfor %}
</table>
{% endif %}
</div>

<script>
let values = {{ object.values | safe }};
let units = "{{ object.unit }}";
let dates = {{ object.dates | safe }};
let metrics = {{ object.metrics | safe }};
let title = "{{ object.title_long }}";
console.log(title);
let datatype = "{{ object.field_type }}";
console.log(datatype);
</script>

<script type="text/javascript" charset="utf-8" src="{% static 'policy/js/plot.js' %}"></script>

{% endblock %}
2 changes: 1 addition & 1 deletion policy/templates/policy/ds_breadcrumb.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<span><a title="Metrics" href="{% url 'policy:Metrics' object.identifier %}"><i
class="fa fa-thermometer fa-2x"></i></a></span>
<span><a title="Plot" href="{% url 'policy:Plot' object.identifier %}"><i
class="fa fa-area-chart fa-2x"></i></a></span>
class="fas fa-chart-area fa-2x"></i></a></span>
</span>
</div>
</div>
10 changes: 0 additions & 10 deletions policy/templates/policy/policy_overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
</div>
</div>



<div class="card card-primary card-outline">
<div class="card-info">
<div class="card-header">
Expand All @@ -34,14 +32,6 @@ <h4><i class="fa fa-info-circle"></i> Dataseries Table </h4>
<h3><i class="fa fa-dashboard"></i> Current Statistics</h3>
{% include "policy/tbl_statistics.html" %}

<h3><i class="fa fa-download"></i> March 3 2021 - 0.2 Release</h3>
<p>Updated data dictionary to reflect v2.7 Oxford codebook
</p>

<h3><i class="fa fa-download"></i> June 6 2020 - 0.1 Release</h3>
<p>Release 0.1 features the basic functionality, incorporating only complete data series and minimal processing or other modelling work.
</p>

</div>
</div>
</div>
Expand Down
30 changes: 30 additions & 0 deletions policy/templates/policy/tbl_statistics.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<div>
<table id="db_stats" class="display responsive">
<tbody>
<tr>
<td>Targeted Data Sets (Raw Sources)</td>
<td><span id="total_datasets">100000</span></td>
</tr>
<tr>
<td>Integrated Data Sets (After Data Cleaning)</td>
<td><span id="tracked_datasets">100000</span></td>
</tr>
<tr>
<td>Active Data Sets (Recently Changed)</td>
<td><span id="live_datasets">100000</span></td>
</tr>
<tr>
<td>Focus Metrics</td>
<td>3</td>
</tr>
<tr>
<td>Visualization Types</td>
<td>3</td>
</tr>
</tbody>
</table>
</div>

<script>
$('#db_stats').DataTable();
</script>
1 change: 0 additions & 1 deletion policy/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,6 @@ def get_context_data(self, **kwargs):
dataflow = DataFlow.objects.get(identifier=dataseries.df_name)
unit = dataseries.unit
context.update({'unit': json.dumps(unit)})
# context.update({'root_view': root_view})
context.update({'df_size': dataflow.dashboard_n})
return context

Expand Down
24 changes: 10 additions & 14 deletions reporting/templates/portfolio_overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@
{{ title }} Portfolio Overview
{% endblock %}

{% block messages %}
<div class="helpblock">
<p>Portfolio Overview</p>
</div>
{% endblock %}

{% block content %}

<div class="card card-primary card-outline">
<div class="card-body">
<div class="helpblock">
<p>Portfolio Overview</p>
</div>
</div>
</div>

<div class="card-info">
<div class="card-header">
<h4>Procurement Data</h4>
Expand All @@ -28,7 +31,7 @@ <h4>Procurement Data</h4>
</tr>
</thead>
<tbody>
<tr>
<tr class="even">
<td>Portfolio Managers</td>
<td>{{ pm_count }}</td>
</tr>
Expand Down Expand Up @@ -58,14 +61,7 @@ <h4>Procurement Data</h4>
</div>

<script>
$('#data_list').DataTable({
"pagingType": "full_numbers",
"responsive": true,
"bSort": true,
"displayLength": 50,
"autoWidth": true,
"searching": false
});
$('#data_list').DataTable();
</script>

{% endblock %}
5 changes: 5 additions & 0 deletions start/static/start/css/jazzmin.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
margin-left: 10px!important;
}

.dark-mode .navbar-navy {
background-color: #393e43;
color: #fff;
}

/*.select2-container--open .select2-dropdown {*/
/* display: inline !important;*/
/*}*/
Expand Down
Loading

0 comments on commit 1204f21

Please sign in to comment.