Skip to content

Commit

Permalink
Merge pull request #269 from ens-lgil/feature/stats_page_update
Browse files Browse the repository at this point in the history
Add number of entries in header of the 'distribution' tables
  • Loading branch information
ens-lgil committed Jun 22, 2023
2 parents 240daa7 + 71ed7fa commit ccb2e56
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
30 changes: 28 additions & 2 deletions catalog/templates/catalog/docs/stats.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</ol>
</nav>

<h2>PGS Catalog statistics</h2>
<h2><span class="fa-solid fa-chart-pie pgs_color_1 pr-2"></span>PGS Catalog statistics</h2>

<div class="d-flex justify-content-between mt-5">
<div class="mr-5">
Expand Down Expand Up @@ -129,7 +129,7 @@ <h5 class="pgs_bg_color_1 mb-0" style="padding:6px 8px;text-align:center"><b>Wei

<div class="mt-5">
<hr/>
<h5><span class="toggle_btn pgs_btn_plus" id="method_dist" data-toggle="tooltip" title="Click to display the Method distribution table"><b>Score Method</b> distribution </span></h5>
<h5><span class="toggle_btn pgs_btn_plus" id="method_dist" data-toggle="tooltip" title="Click to display the Method distribution table"><b>Score Method</b> distribution (<span class="pgs_color_1">{{ method_data|length }}</span>) </span></h5>
<div class="toggle_list mt-2" id="list_method_dist">
<table class="table table-bordered table_pgs_h">
<thead class="thead-dark">
Expand All @@ -151,4 +151,30 @@ <h5><span class="toggle_btn pgs_btn_plus" id="method_dist" data-toggle="tooltip"
</table>
</div>
</div>


<div class="mt-5">
<hr/>
<h5><span class="toggle_btn pgs_btn_plus" id="reported_trait_dist" data-toggle="tooltip" title="Click to display the Reported trait distribution table"><b>Reported Trait</b> distribution (<span class="pgs_color_1">{{ reported_trait_data|length }}</span>) </span></h5>
<div class="toggle_list mt-2" id="list_reported_trait_dist">
<table class="table table-bordered table_pgs_h">
<thead class="thead-dark">
<tr>
<th>Reported Trait</th>
<th>%age</th>
<th>Count</th>
</tr>
</thead>
<tbody>
{% for reported_trait in reported_trait_data %}
<tr>
<td style="max-width:600px;white-space:normal;text-align:left">{{ reported_trait.name }}</td>
<td>{{ reported_trait.value }}%</td>
<td>{{ reported_trait.count }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{%endblock%}
6 changes: 5 additions & 1 deletion catalog/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ def releases(request):
pub_per_year_item = { 'year': p_year, 'count': pub_per_year[p_year] }
pub_per_year_data['all'].append(pub_per_year_item)

# Sepatate the "Released" and "Not released" Publications
# Separate the "Released" and "Not released" Publications
nr_publications = Publication.objects.filter(date_released__isnull=True)
if len(nr_publications) > 0:
nr_pub_per_year = {}
Expand Down Expand Up @@ -813,6 +813,9 @@ def stats(request):
# Methods
method_data = get_data_distribution('method_name',scores_count,colours)

# Reported traits
reported_trait_data = get_data_distribution('trait_reported',scores_count,colours)

context = {
'variants_number_per_score': '{:,}'.format(variants_number_per_score),
'scores_per_pub': round(scores_count/publications_count,1),
Expand All @@ -821,6 +824,7 @@ def stats(request):
'genomebuild_data': genomebuild_data,
'weight_type_data': weight_type_data,
'method_data': method_data,
'reported_trait_data': reported_trait_data,
'has_chart': 1
}
return render(request, 'catalog/docs/stats.html', context)
Expand Down

0 comments on commit ccb2e56

Please sign in to comment.