-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhubs.qmd
More file actions
285 lines (216 loc) · 8.55 KB
/
Copy pathhubs.qmd
File metadata and controls
285 lines (216 loc) · 8.55 KB
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
---
title: '{{< fa list >}} List of hubs'
---
::: {.callout-tip appearance="simple"}
Do you have a hub, but it's not listed? [{{< fa question-circle >}} Tell us about your hub!](/contact.qmd){.btn .btn-outline-dark .ms-auto}
:::
:::{.d-none}
{{< include /_data/active-hubs.qmd >}}
:::
::: {.panel-tabset}
## Cards
### Real-time Collaborative Public Health Hubs
The hubs listed below are all active. Many of these hubs have **open source data** available and
ready to analyze in hubverse format.
::: {.column-screen-inset}
:::{#orgs .grid style='--bs-gap: 0.5em'}
{{< partial /_partials/hub.qmd hubs.uscdc id="uscdc">}}
{{< partial /_partials/hub.qmd hubs.smhct id="smhct">}}
{{< partial /_partials/hub.qmd hubs.epiengage id="epiengage">}}
{{< partial /_partials/hub.qmd hubs.ai4casting id="ai4casting">}}
{{< partial /_partials/hub.qmd hubs.ecdc id="ecdc">}}
{{< partial /_partials/hub.qmd hubs.cadph id="cadph">}}
{{< partial /_partials/hub.qmd hubs.accidda id="accidda">}}
{{< partial /_partials/hub.qmd hubs.acefa id="acefa">}}
{{< partial /_partials/hub.qmd hubs.dailypartita id="dailypartita">}}
{{< partial /_partials/hub.qmd hubs.insightnet id="insightnet">}}
:::
:::
### Archival Hubs
::: {.column-screen-inset}
:::{#orgs .grid style='--bs-gap: 0.5em'}
{{< partial /_partials/hub.qmd hubs.hubverse id="hubverse">}}
{{< partial /_partials/hub.qmd hubs.ecdc-archival id="ecdc-archival">}}
{{< partial /_partials/hub.qmd hubs.hopkinsidd id="hopkinsidd">}}
:::
:::
### Training Hubs
::: {.column-screen-inset}
:::{#orgs .grid style='--bs-gap: 0.5em'}
{{< partial /_partials/hub.qmd hubs.reichlab-training id="reichlab-training">}}
{{< partial /_partials/hub.qmd hubs.sjfox id="sjfox">}}
{{< partial /_partials/hub.qmd hubs.bleicham id="bleicham">}}
:::
:::
### Model Development Hubs
::: {.column-screen-inset}
:::{#orgs .grid style='--bs-gap: 0.5em'}
{{< partial /_partials/hub.qmd hubs.reichlab-modeldev id="reichlab-modeldev">}}
:::
:::
## Table
::: {.column-screen-inset}
```{python}
#| echo: false
#| warning: false
import sys
import pandas as pd
from pathlib import Path
from IPython.display import display, HTML
# community/ is the working directory when this chunk runs, so add the
# project root to sys.path so that scripts.hub_table can be imported.
sys.path.insert(0, str(Path("..").resolve()))
from scripts.hub_table import build_hub_dataframe, canon_repo_key, load_hub_row_counts
df = build_hub_dataframe(Path("../_data/active-hubs.qmd"))
df = df.sort_values("Hub", key=lambda s: s.str.lower(), ascending=False).reset_index(drop=True)
hub_row_counts = load_hub_row_counts(Path("../output/hub_stats_summary.csv"))
CATEGORY_BADGE = {
"Active": "primary",
"Archival": "secondary",
"Training": "info",
"Model Development": "warning",
}
total_hubs = len(df)
total_orgs = df["Organization"].nunique()
total_models = int(df["Models"].dropna().sum())
total_data_rows = sum(hub_row_counts.values())
summary_html = (
f"<strong>{total_hubs:,}</strong> hubs · "
f"<strong>{total_orgs:,}</strong> organizations · "
f"<strong>{total_models:,}</strong> models · "
f"<strong>{total_data_rows:,}</strong> data rows"
)
_last_updated_file = Path("../output/hub_stats_last_updated.txt")
if _last_updated_file.exists():
last_updated = _last_updated_file.read_text().strip()
else:
import subprocess
_git = subprocess.run(
["git", "log", "-1", "--format=%cs", "--", "output/hub_stats_summary.csv"],
capture_output=True, text=True, cwd=Path("..").resolve()
)
last_updated = _git.stdout.strip() or "unavailable"
rows_html = ""
for _, row in df.iterrows():
badge = CATEGORY_BADGE.get(row["Category"], "secondary")
models = "" if pd.isna(row["Models"]) else int(row["Models"])
repo_slug = row.get("RepoSlug") or ""
key = canon_repo_key(repo_slug) if repo_slug else ""
data_rows = hub_row_counts.get(key)
data_val = data_rows if data_rows is not None else ""
data_display = f"{data_rows:,}" if data_rows is not None else ""
rows_html += f"""
<tr>
<td>{row['Hub']}</td>
<td>{row['Organization']}</td>
<td><span class="badge text-bg-{badge}">{row['Category']}</span></td>
<td class="text-center" data-val="{models}">{models}</td>
<td class="text-center" data-val="{data_val}">{data_display}</td>
<td>{row['Repo']}</td>
<td class="text-center">{row['S3 Bucket']}</td>
<td class="text-center">{row['Insights']}</td>
<td class="text-center">{row['Forecasts']}</td>
<td class="text-center">{row['Evaluations']}</td>
</tr>"""
display(HTML(f"""
<style>
#hub-table thead th.sortable {{
cursor: pointer;
user-select: none;
white-space: nowrap;
}}
#hub-table thead th.sortable:hover {{ background-color: rgba(0,0,0,.05); }}
#hub-table thead th.sortable::after {{ content: " ⇅"; opacity: .4; }}
#hub-table thead th.sort-asc::after {{ content: " ↑"; opacity: 1; }}
#hub-table thead th.sort-desc::after {{ content: " ↓"; opacity: 1; }}
#hub-table th:nth-child(6),
#hub-table td:nth-child(6) {{ min-width: 16rem; }}
</style>
<script>
(function() {{
var sortCol = 0, sortDir = -1;
function sortHubTable(colIndex) {{
var table = document.getElementById('hub-table');
var tbody = table.querySelector('tbody');
var rows = Array.from(tbody.querySelectorAll('tr'));
var headers = Array.from(table.querySelectorAll('thead th'));
sortDir = (colIndex === sortCol) ? -sortDir : 1;
sortCol = colIndex;
headers.forEach(function(h) {{
h.classList.remove('sort-asc', 'sort-desc');
}});
headers[colIndex].classList.add(sortDir === 1 ? 'sort-asc' : 'sort-desc');
rows.sort(function(a, b) {{
var aCell = a.cells[colIndex];
var bCell = b.cells[colIndex];
// Use data-val attribute for numeric columns, otherwise text content
var aVal = aCell.dataset.val !== undefined ? aCell.dataset.val : aCell.textContent.trim();
var bVal = bCell.dataset.val !== undefined ? bCell.dataset.val : bCell.textContent.trim();
// Empty values always sort last
if (aVal === '' && bVal !== '') return 1;
if (bVal === '' && aVal !== '') return -1;
// Numeric sort when both values are numbers
var aNum = parseFloat(aVal), bNum = parseFloat(bVal);
if (!isNaN(aNum) && !isNaN(bNum)) return sortDir * (aNum - bNum);
return sortDir * aVal.localeCompare(bVal, undefined, {{sensitivity: 'base'}});
}});
rows.forEach(function(r) {{ tbody.appendChild(r); }});
}}
function filterHubTable() {{
var q = document.getElementById('hub-search').value.toLowerCase();
document.querySelectorAll('#hub-table tbody tr').forEach(function(r) {{
r.style.display = r.textContent.toLowerCase().includes(q) ? '' : 'none';
}});
}}
document.addEventListener('DOMContentLoaded', function() {{
document.querySelectorAll('#hub-table thead th.sortable').forEach(function(th, i) {{
th.addEventListener('click', function() {{ sortHubTable(i); }});
}});
document.querySelectorAll('#hub-table thead th')[0].classList.add('sort-desc');
document.getElementById('hub-search').addEventListener('input', filterHubTable);
}});
}})();
</script>
<p class="text-muted small mb-2">Stats are updated weekly every Monday. Last updated: {last_updated}.</p>
<input type="text" id="hub-search" placeholder="Search hubs..."
class="form-control mb-3" aria-label="Search hubs">
<div class="table-responsive">
<table id="hub-table" class="table table-sm table-striped table-hover align-middle">
<thead>
<tr>
<th class="sortable">Hub</th>
<th class="sortable">Organization</th>
<th class="sortable">Category</th>
<th class="sortable text-center">Models</th>
<th class="sortable text-center">Data Rows</th>
<th>Repo</th>
<th class="text-center">S3 Bucket</th>
<th class="text-center">Insights</th>
<th class="text-center">Forecasts</th>
<th class="text-center">Evaluations</th>
</tr>
</thead>
<tbody>{rows_html}</tbody>
<tfoot>
<tr>
<td colspan="10" class="text-center text-muted small py-2">{summary_html}</td>
</tr>
</tfoot>
</table>
</div>
"""))
```
:::
:::
:::: {.page-nav}
::: {.prev-page}
[‹](/community/index.qmd){.prev-arrow}
[Previous](/community/index.qmd){.prev-label}
[**Community**](/community/index.qmd){.prev-title}
:::
::: {.next-page}
[Next](/community/contributors.md){.next-label}
[›](/community/contributors.md){.next-arrow}
[**Contributors**](/community/contributors.md){.next-title}
:::
::::