Skip to content

Commit bb12eb5

Browse files
agt24claude
andcommitted
Add Journal preset, update funder aliases, and UI improvements
- Add Journal Preset dropdown (Top 10 by count, Top 10 by percent) - Update funder aliases from v3 to v4 - Add percent sign to mouseover text for percent metrics - Add page title and description with links to repos - Disable Country filtering (temporarily, ~25% coverage) - Update Aggregation menu labels for clarity - Sort Journal/Funder dropdowns by Data Sharing % - Display Data Sharing % in dropdown labels - Update README to describe dashboard with link to opensciencemetrics.org - Update parquet file to dashboard_20251211-1738.parquet 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 45975ef commit bb12eb5

File tree

2 files changed

+75
-55
lines changed

2 files changed

+75
-55
lines changed

README.md

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,70 @@
22

33
OpenSciMetrics (OSM) applies NLP and LLM-based metrics and indicators related to transparency, data sharing, rigor, and open science on biomedical publications.
44

5-
# Running the app
5+
## Dashboard
66

7-
N.B. pdf parsing does not work on Apple silicon...
7+
The Open Science Metrics Dashboard visualizes data sharing and code sharing trends across biomedical research funders and journals, based on analysis of PubMed Central publications.
88

9-
- With docker-compose and python >=3.11 installed, run the following from the project's root directory:
9+
**Live Dashboard:** [https://www.opensciencemetrics.org](https://www.opensciencemetrics.org)
1010

11-
```
12-
pip install .
13-
osm -f path/to/pdf-or-xml -u uuid
14-
```
11+
### Features
1512

16-
If you have many files to upload you may with to start up the docker-compose dependencies in a separate terminal window:
13+
- **Splitting Variables:** View trends by Journal or Funder
14+
- **Presets:** Quick selection of top journals/funders by data sharing count or percent
15+
- **Aggregation Metrics:** Data Sharing %, Code Sharing %, article counts
16+
- **Interactive Charts:** Toggle individual lines, hover for details
17+
- **Year Range Filter:** Focus on specific time periods (default: 2010-2024)
1718

18-
```
19-
docker compose up # docker-compose on some systems
20-
```
19+
## CLI Tool (Legacy)
2120

22-
And then tell the osm tool that this has been handled:
21+
The repository also contains a command line tool for processing individual PDFs and XMLs. Note: This tool is not currently being actively maintained.
2322

24-
```
25-
osm -f path/to/pdf-or-xml -u uuid --user-managed-compose
26-
osm -f path/to/pdf-or-xml2 -u uuid2 --user-managed-compose
27-
```
23+
With docker-compose and python >=3.11 installed:
2824

29-
# Contributing
25+
```bash
26+
pip install .
27+
osm -f path/to/pdf-or-xml -u uuid
28+
```
3029

31-
N.B. On Apple silicon you must use emulation and download the mongo container in advance:
30+
For processing many files, start docker-compose dependencies separately:
3231

33-
```
34-
export DOCKER_DEFAULT_PLATFORM=linux/amd64
35-
docker pull mongo:4.4.6
32+
```bash
33+
docker compose up # In one terminal
34+
osm -f path/to/pdf-or-xml -u uuid --user-managed-compose # In another terminal
3635
```
3736

38-
To contribute to the project please run the following commands to set up a development environment:
37+
## Contributing
3938

40-
```
39+
To set up a development environment:
40+
41+
```bash
4142
pip install -e .
4243
docker compose -f compose.yaml -f compose.development.override.yaml up --build
4344
```
44-
And in another terminal:
4545

46-
```
46+
In another terminal:
47+
48+
```bash
4749
export OSM_API="http://localhost:80"
4850
osm -f path/to/pdf-or-xml -u uuid --user-managed-compose
4951
```
5052

53+
### Pre-commit Hooks
5154

52-
## Using pre-commit for commit checks
53-
54-
Pre-commit will run all of its hooks on every commit you make. To install
55-
pre-commit and its hooks, run the following commands:
55+
Pre-commit runs checks on every commit. To install:
5656

57-
```
57+
```bash
5858
pip install pre-commit
5959
pre-commit install
6060
```
61+
62+
### Apple Silicon Notes
63+
64+
On Apple silicon, you must use emulation:
65+
66+
```bash
67+
export DOCKER_DEFAULT_PLATFORM=linux/amd64
68+
docker pull mongo:4.4.6
69+
```
70+
71+
Note: PDF parsing does not work on Apple silicon.

web/dashboard/streamlit_app.py

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,6 @@ def get_journal_labels(journal_list: list[str]) -> list[str]:
289289

290290
# Preset to journal list mapping
291291
JOURNAL_PRESETS = {
292-
"Top 5 by count + Top 5 by percent": top_5_journals_combined,
293292
"Top 10 by data sharing count": top_10_journals_by_count,
294293
"Top 10 by data sharing percent": top_10_journals_by_percent,
295294
}
@@ -303,9 +302,9 @@ def on_journal_preset_change() -> None:
303302

304303

305304
if splitting_variable == "journal":
306-
# Initialize journal selection if not set
305+
# Initialize journal selection if not set (use first preset)
307306
if "journal" not in st.session_state:
308-
st.session_state["journal"] = get_journal_labels(top_5_journals_combined)
307+
st.session_state["journal"] = get_journal_labels(top_10_journals_by_count)
309308

310309
journal_preset = st.selectbox(
311310
"Journals preset",
@@ -314,19 +313,24 @@ def on_journal_preset_change() -> None:
314313
key="journal_preset_select",
315314
on_change=on_journal_preset_change,
316315
)
317-
default_journal_labels: list[str] = st.session_state.get(
318-
"journal", get_journal_labels(top_5_journals_combined)
319-
)
320-
else:
321-
default_journal_labels = []
322316

323317
with row_2_col_1:
324-
selected_journal_labels = st.multiselect(
325-
"Journal (sorted by Data Sharing %)",
326-
options=unique_journal_labels,
327-
default=default_journal_labels,
328-
key="journal",
329-
)
318+
# When using session state (splitting_variable == "journal"), don't pass default
319+
# to avoid "widget with key was created with default but also had value set via
320+
# Session State API" warning
321+
if splitting_variable == "journal":
322+
selected_journal_labels = st.multiselect(
323+
"Journal (sorted by Data Sharing %)",
324+
options=unique_journal_labels,
325+
key="journal",
326+
)
327+
else:
328+
selected_journal_labels = st.multiselect(
329+
"Journal (sorted by Data Sharing %)",
330+
options=unique_journal_labels,
331+
default=[],
332+
key="journal",
333+
)
330334
# Map back to actual journal names for filtering
331335
journals = [journal_display_map[label] for label in selected_journal_labels]
332336

@@ -416,19 +420,24 @@ def on_funder_preset_change() -> None:
416420
key="funder_preset_select",
417421
on_change=on_funder_preset_change,
418422
)
419-
default_funder_labels: list[str] = st.session_state.get(
420-
"funder", get_funder_labels(top_5_combined)
421-
)
422-
else:
423-
default_funder_labels = []
424423

425424
with row_2_col_3:
426-
selected_funder_labels = st.multiselect(
427-
"Funder (sorted by Data Sharing %)",
428-
options=unique_funder_labels,
429-
default=default_funder_labels,
430-
key="funder",
431-
)
425+
# When using session state (splitting_variable == "funder"), don't pass default
426+
# to avoid "widget with key was created with default but also had value set via
427+
# Session State API" warning
428+
if splitting_variable == "funder":
429+
selected_funder_labels = st.multiselect(
430+
"Funder (sorted by Data Sharing %)",
431+
options=unique_funder_labels,
432+
key="funder",
433+
)
434+
else:
435+
selected_funder_labels = st.multiselect(
436+
"Funder (sorted by Data Sharing %)",
437+
options=unique_funder_labels,
438+
default=[],
439+
key="funder",
440+
)
432441
# Map back to actual funder names for filtering
433442
funders = [funder_display_map[label] for label in selected_funder_labels]
434443

0 commit comments

Comments
 (0)