Skip to content

Commit 4e6545a

Browse files
authored
Merge pull request #79 from ctanes/main
Added publications and species counts to index.
2 parents f87c2c2 + 57599c2 commit 4e6545a

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

app/app.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
get_taxonomic_assignments,
3131
)
3232
from pathlib import Path
33-
from sqlalchemy import select, text, func
33+
from sqlalchemy import select, text, func, desc
3434
from sqlalchemy.pool import NullPool
3535
from app.datatables import datatables_response, init_app, query_columns
3636
from app.nl_query import generate_sql, generate_sql_modification
@@ -141,6 +141,20 @@ def index():
141141
except Exception as e:
142142
print(f"Error fetching special collection counts: {e}")
143143

144+
try:
145+
# Get counts of all the species in the collection
146+
species = (
147+
db.session.query(Isolate.suspected_organism, func.count(Isolate.sample_id).label("count"))
148+
.filter(Isolate.suspected_organism.is_not(None))
149+
.filter(Isolate.suspected_organism != "Unknown")
150+
.group_by(Isolate.suspected_organism)
151+
.order_by(desc("count"))
152+
.limit(10)
153+
.all()
154+
)
155+
except Exception as e:
156+
print(f"Error fetching species counts: {e}")
157+
144158
return render_template(
145159
"index.html",
146160
version=__version__,
@@ -149,6 +163,7 @@ def index():
149163
isolate_count=isolate_count,
150164
patient_count=patient_count,
151165
special_collection_counts=special_collections,
166+
species_counts=species,
152167
)
153168

154169

app/templates/index.html

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,32 @@ <h3 style="text-transform:none;">Welcome to the Microbial ARchive and Cryo-colle
2323

2424
<h4>
2525
The database currently holds {{ isolate_count }} isolates from {{ patient_count }} patients.
26-
</h4>
26+
</h4><br>
2727

28-
<p>The efforts to curate the isolates include:</p>
28+
<h5>The efforts to curate the isolates include:</h5>
2929
<ul class="list-unstyled">
3030
{% for collection, val in special_collection_counts.items() %}
3131
<li class="mb-2"><strong>{{ collection }}</strong> ({{ val[0] }} isolates){% if val[1] %} - {{ val[1] }}{% endif %}</li>
3232
{% endfor %}
33+
</ul><br>
34+
35+
<h5>The most common species in the database are:</h5>
36+
<ul class="list-unstyled">
37+
{% for species, val in species_counts %}
38+
<li class="mb-2"><strong>{{ species }}:</strong> {{ val }} isolates</li>
39+
{% endfor %}
40+
</ul><br>
41+
42+
43+
<h4>
44+
Publications
45+
</h4>
46+
47+
<p>We are working on multiple projects in parallel using this data. The current publications are listed below:</p>
48+
<ul class="list-unstyled">
49+
<li class="mb-2">She Q, Srinivasan L, Theiller E, Galis BE, Napper T, Feder A, Arvanitis A, Jones SM, Hayes E, Puopolo KM, Baldassano RN, David MZ, Coffin SE, Gibbs KA, Potter RF, Smith KP, Harris RM, Zackular JP, Moustafa AM, Planet PJ. Rapid dissemination of Staphylococcus aureus in the neonatal intensive care unit is associated with invasive infection. Nat Commun. 2026 Feb 9. doi: 10.1038/s41467-026-69074-z. Epub ahead of print. <a href="https://pubmed.ncbi.nlm.nih.gov/41663361/">PMID: 41663361</a>.</li>
3350
</ul>
51+
3452
</div>
3553

3654
<div>

0 commit comments

Comments
 (0)