Skip to content

Commit

Permalink
Implement some minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
njahn82 committed Mar 13, 2023
1 parent 51e2631 commit 291ba05
Show file tree
Hide file tree
Showing 21 changed files with 1,113 additions and 266 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ jct/
oam/
/.quarto/
/_freeze/
index_files/
8 changes: 8 additions & 0 deletions 404.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: 404 error
subtitle: The page you're looking for doesn't exist. 😕
format: html
---

Check the sidebar navigation and search to find your publisher-specific dashboard.

1 change: 1 addition & 0 deletions R/country_league.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ country_pub_df <-

shared_oa_country_df <- SharedData$new(country_pub_df)

# From https://connorrothschild.github.io/v2/post/economist-table-replication-using-reactable/
react_table_oa_country <- reactable::reactable(
shared_oa_country_df,
style = list(),
Expand Down
22 changes: 18 additions & 4 deletions R/country_publisher_league.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
if(exists("oam")) {
esac_df <- oam
} else {
esac_df <- hoaddata::jct_hybrid_jns |>
distinct(issn_l, esac_publisher)
distinct(issn_l, esac_publisher)
}

country_total <- jn_aff_df |>
distinct(issn_l, cr_year, country_code, articles_total) |>
Expand All @@ -20,11 +24,21 @@ country_df_by_publisher <- left_join(country_total, country_cc, by = c("cr_year"
mutate_if(is.numeric, ~replace(., is.na(.), 0)) |>
filter(!is.na(country_code)) |>
mutate(
country_name = countrycode::countrycode(country_code, origin = "iso2c", destination = "country.name"))
country_name =
countrycode::countrycode(
country_code, origin = "iso2c", destination = "country.name"
)
) |>
mutate(country_name = gsub("&", "and", country_name)) |>
mutate(esac_publisher = forcats::fct_relevel(
forcats::as_factor(esac_publisher), publ_league)
)


country_pub_league <- country_df |>
mutate(esac_publisher = "All") |>
bind_rows(country_df_by_publisher)
bind_rows(country_df_by_publisher) |>
mutate(esac_publisher = forcats::fct_relevel(forcats::as_factor(esac_publisher), c("All", publ_league)))

# Max values to define width of bar charts
bar_max_width <- country_pub_league |>
Expand Down Expand Up @@ -124,7 +138,7 @@ react_table_oa_country <- reactable::reactable(
}
),
prop = colDef(
name = "% of total",
name = "% OA",
format = colFormat(percent = TRUE, digits = 1),
style = list(fontWeight = "bold"),
class = "number",
Expand Down
6 changes: 4 additions & 2 deletions R/cr_upw.R
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ upw_col_ <- function() { list(
minWidth = 100
),
perc_diff = colDef(
name = "% Difference",
format = colFormat(percent = TRUE, digits = 1),
name = "Difference",
cell = function(value) {
value <- paste0(format(round(value * 100, 1), nsmall = 1), "pp")
},
class = "number",
align = "right",
width = 120,
Expand Down
2 changes: 1 addition & 1 deletion R/journal_tbl.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ venues_df <- venues |>
!is.na(homepage_url) ~ glue::glue('{display_name}<a href="{homepage_url}" target="_blank"><sup><small><i class="bi bi-box-arrow-up-right"></i></small></sup></a>'),
is.na(homepage_url) ~ display_name)
) |>
mutate(issn_link = glue::glue('ISSN-L: <a href="https://zdb-katalog.de/list.xhtml?t={issn_l}&key=iss&frm=O&asc=false" target="_blank">{issn_l}</a> | OpenAlex: <a href="{id}" target="_blank">{gsub("https://openalex.org/", "", id)}</a>')) |>
mutate(issn_link = glue::glue('ISSN-L: <a href="https://zdb-katalog.de/list.xhtml?t={issn_l}&key=iss&frm=O&asc=false" target="_blank">{issn_l}</a>')) |>
mutate(journal_display = glue::glue('<div><div style="font-weight:bold">{journal_name}</div><div style="font-size: 0.7rem">{issn_link}</div></div>'))

# Sparkline
Expand Down
7 changes: 4 additions & 3 deletions R/pub_scatter.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ scatter_pub <- function(my_df = my_df) {
linetype = "dashed",
size = 1
) +
theme_minimal(base_family = "Atkinson Hyperlegible", base_size = 16) +
theme_minimal(base_family = "Atkinson Hyperlegible", base_size = 15) +
labs(x = "Articles (log scale)", y = "OA") +
theme(panel.grid.minor.x = element_blank(),
panel.grid.minor.y = element_blank(),
Expand All @@ -61,11 +61,12 @@ plot_scatterplot <-
scatter_pub()
plotly::ggplotly(plot_all, tooltip = c("text")) |>
style(hoverlabel = list(bgcolor = "white", font = list(
family = "Source Sans Pro",
family = "Atkinson Hyperlegible",
size = 18))) |>
animation_slider(
currentvalue = list(prefix = "Publication year: "),
pad = list(t = "50")
redraw = FALSE,
pad = list(t = 50, r = 50)
) |>
animation_button(visible = TRUE) |>
config(displayModeBar = FALSE)
Expand Down
4 changes: 3 additions & 1 deletion R/publisher_league.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ jn_league_df <- left_join(journals_per_publisher, journals_with_oa_per_publisher
pub_league <- summarize_pubs(var_summary = c(cr_year, esac_publisher)) |>
right_join(jn_league_df, by = c("cr_year", "esac_publisher", "collection")) |>
mutate_if(is.numeric, ~ replace(., is.na(.), 0)) |>
mutate(oa_prop = oa_articles / articles)
mutate(oa_prop = oa_articles / articles) |>
mutate(esac_publisher = forcats::fct_relevel(forcats::as_factor(esac_publisher), publ_league))


# Prepare bar width relative to Crosstalk selection
bar_max_width <- pub_league |>
Expand Down
38 changes: 19 additions & 19 deletions _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ project:

website:
title: "HOAD"
twitter-card: true
open-graph: true
page-footer:
left: |
Developed at the <a href="https://www.sub.uni-goettingen.de/sub-aktuell/">Göttingen State and University Library</a>
left:
- text: "This website is licensed under <a href='https://creativecommons.org/publicdomain/zero/1.0/'>CC0</a>."
center:
- text: "About"
href: about.qmd
- text: "License"
href: license.qmd
- text: "Privacy"
href: privacy.qmd
- text: "Imprint"
href: https://www.sub.uni-goettingen.de/impressum/
right:
Expand All @@ -29,20 +29,21 @@ website:
tools:
- icon: github
href: https://github.com/subugoe/hoaddash
text: "GitHub Repo"
- icon: bar-chart
text: "GitHub Dashboard Repo"
- icon: "file-bar-graph"
href: https://github.com/subugoe/hoaddata
text: "Data Repo"
- icon: person-fill
text: "mailto:[email protected]"
text: "GitHub Data Repo"
- icon: "bug"
text: "Report a Bug"
href: https://github.com/subugoe/hoaddash/issues
style: "docked"
search: true
collapse-level: 1
contents:
- text: Overview
href: jct/index.qmd
- section: "Publishers"
contents:
- text: Overview
href: index.qmd
- href: jct/elsevier/index.qmd
text: "Elsevier"
- href: jct/springernature/index.qmd
Expand Down Expand Up @@ -84,6 +85,7 @@ website:
- section: "Agreements with German consortia"
contents:
- text: "Overview"
href: oam/index.qmd
- section: "Consortia"
contents:
- section: "DEAL"
Expand Down Expand Up @@ -121,7 +123,7 @@ website:
- text: "AIP"
href: oam/aiptib/index.qmd
- text: "ESC"
href: oam/esctib/index.qmd
href: oam/ecstib/index.qmd
- text: "IOP"
href: oam/ioptib/index.qmd
- text: "Portland Press"
Expand All @@ -134,11 +136,9 @@ website:
contents:
- text: "Taylor and Francis"
href: oam/taylorfranciszbw
- section: "About"
contents:
- text: "How it works"
- text: "Contribute"

- text: "About"
href: "about.qmd"
footer: funding_note.md
format:
html:
theme:
Expand Down
Loading

0 comments on commit 291ba05

Please sign in to comment.