Skip to content

Commit

Permalink
general update before release
Browse files Browse the repository at this point in the history
  • Loading branch information
marton-balazs-kovacs committed Jun 10, 2021
1 parent 7c2b6ae commit 61c9363
Show file tree
Hide file tree
Showing 42 changed files with 214 additions and 108 deletions.
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: tenzing
Title: Documenting Contributions to Scientific Scholarly Output with CRediT
Version: 0.1.0
Version: 0.2.0
Authors@R:
c(person(given = "Marton",
family = "Kovacs",
Expand Down Expand Up @@ -48,7 +48,8 @@ Imports:
callr,
clipr,
htmlwidgets,
googlesheets4
googlesheets4,
markdown
RoxygenNote: 7.1.1
Suggests:
testthat,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export("%>%")
export(add_initials)
export(clean_infosheet)
export(mod_about_modal_server)
export(mod_about_modal_ui)
export(mod_credit_roles_server)
Expand Down
16 changes: 16 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# tenzing 0.2.0

## New features
* New output option is added. The new option allows users to generate the funding acknowledgment section of their manuscript. For this output it is possible to use initials or full names.
* For the contributor list output option now it is possible to use initials instead of full names. Users can also choose to list the contributions according to the CRediT taxonomy after the names of the contributors.
* `tenzing` now allows users to read the infosheet directly from Google sheets by providing the share URL of the spreadsheet.
* The app allows users to review their infosheet within the app even if it does not pass the validation checks.
* There are two new columns added to the infosheet: ORCiD iD and Funding.
* The name of the CRediT taxonomy roles in the infosheet are now fixed as well their URLs directing to each role in the taxonomy's documentation.
* The title page output option now allows users to add multiple first authors and prints an additional text listing the names of the shared first authors and the email address of the corresponding author.
* The app got a new, cleaner look.

## Bug fixes
* The functions that transform full names to initials are updated and now can handle most names correctly.
* The oxford comma is now added to the output options.

98 changes: 52 additions & 46 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,97 +13,102 @@ app_ui <- function() {
h4(id = "sub-title", "Documenting contributorship with CRediT")
)
),
# Page
# Tenzing tab
tabPanel(
"tenzing",
column(2),
column(8,
# First step
div(
class = "main-steps-container",
div(
class = "main-steps-title-container",
h1("1.",
class = "main-steps-title-number"),
h3("Create your infosheet",
class = "main-steps-title"),
div(
class = "help-icon-container",
title = "Copy the infosheet template in Google Drive. Go to File -> Make a copy",
icon("far fa-question-circle", lib = "font-awesome", class = "help-icon")
)
),
class = "main-steps-title-container",
h1("1.",
class = "main-steps-title-number"),
h3("Create your infosheet",
class = "main-steps-title"),
div(
class = "help-icon-container",
title = "Copy the infosheet template in Google Drive. Go to File -> Make a copy",
icon("far fa-question-circle", lib = "font-awesome", class = "help-icon")
)
),
wellPanel(
class = "main-steps-panel",
tags$p("Duplicate and edit the ",
style = "display: inline; margin-bottom: 0;"),
tags$a(href = "https://docs.google.com/spreadsheets/d/1Gl0cwqN_nTsdFH9yhSvi9NypBfDCEhViGq4A3MnBrG8/edit?usp=sharing",
"infosheet template",
target="_blank",
style = "display: inline; color: #ffdf57; text-decoration: underline;"),
style = "display: inline; color: #ffdf57; text-decoration: underline;")
)
),
),
# Second step
div(
class = "main-steps-container",
div(
class = "main-steps-title-container",
h1("2.",
class = "main-steps-title-number"),
h3("Load your infosheet",
class = "main-steps-title"),
div(
class = "help-icon-container",
title = "Use the share URL of the filled out infosheet and click on the upload button. OR upload your infosheet in a .csv, .tsv or .xlsx format.",
icon("far fa-question-circle", lib = "font-awesome", class = "help-icon")
)
),
class = "main-steps-title-container",
h1("2.",
class = "main-steps-title-number"),
h3("Load your infosheet",
class = "main-steps-title"),
div(
class = "help-icon-container",
title = "Use the share URL of the filled out infosheet and click on the upload button. OR upload your infosheet in a .csv, .tsv or .xlsx format.",
icon("far fa-question-circle", lib = "font-awesome", class = "help-icon")
)
),
wellPanel(
class = "main-steps-panel",
mod_read_spreadsheet_ui("read_spreadsheet"),
mod_show_spreadsheet_ui("show_spreadsheet")
),
),
)
),
# Third step
div(
class = "main-steps-container",
div(
class = "main-steps-title-container",
h1("3.",
class = "main-steps-title-number"),
h3("Download the output",
class = "main-steps-title"),
div(
class = "help-icon-container",
title = "You need a valid infosheet to generate the outputs. Once you have it, click on one of the output buttons to preview and download the output.",
icon("far fa-question-circle", lib = "font-awesome", class = "help-icon")
)
),
class = "main-steps-title-container",
h1("3.",
class = "main-steps-title-number"),
h3("Download the output",
class = "main-steps-title"),
div(
class = "help-icon-container",
title = "You need a valid infosheet to generate the outputs. Once you have it, click on one of the output buttons to preview and download the output.",
icon("far fa-question-circle", lib = "font-awesome", class = "help-icon")
)
),
wellPanel(
class = "main-steps-panel",
mod_credit_roles_ui("credit_roles"),
mod_title_page_ui("title_page"),
mod_xml_report_ui("xml_report"),
mod_show_yaml_ui("show_yaml"),
mod_funding_information_ui("funding_information")
)
),
HTML("<p style='text-align: right;'>We recommend using this journal article citation when referring to tenzing:</br>
Holcombe, A. O., Kovacs, M., Aust, F., & Aczel, B. (2020). Documenting contributions to scholarly articles using CRediT and tenzing. <i>Plos one, 15</i>(12), e0244611.
(<a href='https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0244611'>link to paper</a>)</p>")
)
),
# Citation
HTML("<p><b>Citation:</b></br>
<a href='https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0244611'; target='_blank'>Holcombe, A. O., Kovacs, M., Aust, F., & Aczel, B. (2020). Documenting contributions to scholarly articles using CRediT and tenzing. <i>PLoS ONE, 15</i>(12), e0244611.</a></p>")
),
column(2)
),
),
# How to use tab
tabPanel(
"How to use tenzing",
wellPanel(
id = "intro-panel",
includeMarkdown(app_sys("app/www/introduction.Rmd"))
)
),
# About tab
tabPanel(
"About",
wellPanel(
id = "about-panel",
includeMarkdown(app_sys("app/www/about.Rmd"))
)
includeMarkdown(app_sys("app/www/about.Rmd"))
)
)
),

Expand Down Expand Up @@ -134,6 +139,7 @@ golem_add_external_resources <- function(){
tags$link(rel = "stylesheet", type = "text/css", href = "www/custom.css"),
# Add custom JS functions
tags$script(src = "www/sweet_alert.js"),
# Change window title
tags$script("document.title = 'tenzing';"),
tags$script(src = "www/tooltip.js"),
tags$script(src = "https://cdnjs.cloudflare.com/ajax/libs/prism/1.8.4/prism.min.js"),
Expand Down
3 changes: 2 additions & 1 deletion R/initials.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ add_initials <- function(infosheet) {
#' Abbreviates multiple words to first letters
#'
#' @param string Character. A character vector with the names
#' @param collapse Character. A string that will be used to separate names
#'
#' @return Returns a character vector with one element.
#'
#' @examples
#' tenzing:::abbreviate_middle_names("Franz Jude Wayne")
#' tenzing:::abbreviate("Franz Jude Wayne", collapse = "")
abbreviate <- function(string, collapse) {
string <- string[string != ""]
if(length(string) > 0) {
Expand Down
8 changes: 4 additions & 4 deletions R/mod_credit_roles.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ mod_credit_roles_ui <- function(id){

# Module Server

#' @rdname mod_human_readable_report
#' @rdname mod_credit_roles
#' @export
#' @keywords internal

Expand Down Expand Up @@ -64,7 +64,7 @@ mod_credit_roles_server <- function(id, input_data){
style = "display:inline-block; float:right;",
shinyWidgets::materialSwitch(
NS(id, "order_by"),
label = "Author names",
label = "Contributor names",
inline = TRUE),
span("Roles")
)
Expand Down Expand Up @@ -94,7 +94,7 @@ mod_credit_roles_server <- function(id, input_data){

## Switch for order_by input
order <- reactive({
ifelse(input$order_by, "author", "role")
ifelse(input$order_by, "contributor", "role")
})

# Download ---------------------------
Expand All @@ -104,7 +104,7 @@ mod_credit_roles_server <- function(id, input_data){
## Restructure dataframe for the human readable output
to_download <- reactive({
if (all(input_data()[dplyr::pull(credit_taxonomy, `CRediT Taxonomy`)] == FALSE)) {
"There are no CRediT roles checked for either of the contributors."
"There are no CRediT roles checked for any of the contributors."
} else {
print_credit_roles(infosheet = input_data(), initials = input$initials, order_by = order())
}
Expand Down
7 changes: 6 additions & 1 deletion R/mod_read_spreadsheet.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ mod_read_spreadsheet_server <- function(id) {
# Reading infosheet ---------------------------
# Create one activate reactive from two buttons
# If either of the buttons are pressed the reactive fires
# TODO: This current solution is designed for to inputs on the
# same page. However, now that they are separated to two tabs
# the input should be triggered by which tab is open and one
# upload button should be enough.
activate <- reactive(
if (input$upload_url == 0 & input$upload_file == 0) {
NULL
Expand Down Expand Up @@ -127,10 +131,11 @@ mod_read_spreadsheet_server <- function(id) {
}
})

# Hide show spreadsheet on start
golem::invoke_js("hideid", "show-div")

# Control show spreadsheet button behaviour based on read
observeEvent(activate(),{
### Buttons that need a validated infosheet
if(!is.null(table_data())) {
golem::invoke_js("reable", "#show_spreadsheet-show_data")
golem::invoke_js("showid", "show-div")
Expand Down
4 changes: 2 additions & 2 deletions R/mod_title_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ mod_title_page_ui <- function(id){

# Module Server

#' @rdname mod_contribs_affiliation_page
#' @rdname mod_title_page
#' @export
#' @keywords internal

Expand Down Expand Up @@ -75,7 +75,7 @@ mod_title_page_server <- function(id, input_data){

## Restructure dataframe for the contributors affiliation output
to_download <- reactive({
print_title_page(infosheet = input_data())
print_title_page(infosheet = input_data(), text_format = "rmd")
})

## Set up parameters to pass to Rmd document
Expand Down
9 changes: 5 additions & 4 deletions R/print_credit_roles.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,15 @@
#' @param initials Logical. If true initials will be included instead of full
#' names in the output
#' @param order_by Character. Whether the contributing authors listed for each role ("role"), or
#' the roles are listed after the name of each author ("author").
#' the roles are listed after the name of each contributor ("contributor").
#'
#' @return The function returns a string containing the CRediT roles
#' with the contributors listed for each role they partake in.
#' @export
#' @examples
#' validate_infosheet(infosheet = infosheet_template)
#' print_credit_roles(infosheet = infosheet_template)
#' example_infosheet <- read_infosheet(infosheet = system.file("extdata", "infosheet_template_example.csv", package = "tenzing", mustWork = TRUE))
#' validate_infosheet(infosheet = example_infosheet)
#' print_credit_roles(infosheet = example_infosheet)
print_credit_roles <- function(infosheet, text_format = "rmd", initials = FALSE, order_by = "role") {
# Validate input ---------------------------
if (all(infosheet[dplyr::pull(credit_taxonomy, `CRediT Taxonomy`)] == FALSE)) {
Expand Down Expand Up @@ -90,7 +91,7 @@ print_credit_roles <- function(infosheet, text_format = "rmd", initials = FALSE
}

# Ordered by authors ---------------------------
} else if (order_by == "author") {
} else if (order_by == "contributor") {
# Restructure to fit the chosen order ---------------------------
roles_data <-
roles_data %>%
Expand Down
4 changes: 2 additions & 2 deletions R/print_funding.R
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#' @export
print_funding <- function(infosheet, initials = FALSE) {
# Validate input ---------------------------
if (all(is.na(infosheet$Funding))) stop("There is no funding information provided for either of the contributors.")
if (all(is.na(infosheet$Funding))) stop("There is no funding information provided for any of the contributors.")

# Restructure dataframe ---------------------------
if (initials) {
Expand Down Expand Up @@ -47,7 +47,7 @@ print_funding <- function(infosheet, initials = FALSE) {
res <-
funding_data %>%
dplyr::transmute(
out = glue::glue("{Names} {dplyr::if_else(n_names > 1, 'were', 'was')} supported by the {Funding}")) %>%
out = glue::glue("{Names} {dplyr::if_else(n_names > 1, 'were', 'was')} supported by {Funding}")) %>%
dplyr::summarise(out = glue::glue_collapse(out, sep = "; ")) %>%
dplyr::mutate(out = stringr::str_c(out, "."))

Expand Down
7 changes: 4 additions & 3 deletions R/print_title_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
#' \code{Order in publication} column of the infosheet.
#' @export
#' @examples
#' validate_infosheet(infosheet = infosheet_template)
#' print_title_page(infosheet = infosheet_template)
#' example_infosheet <- read_infosheet(infosheet = system.file("extdata", "infosheet_template_example.csv", package = "tenzing", mustWork = TRUE))
#' validate_infosheet(infosheet = example_infosheet)
#' print_title_page(infosheet = example_infosheet)
print_title_page <- function(infosheet, text_format = "rmd") {
# Validation ---------------------------
## Check if there are shared first authors
Expand Down Expand Up @@ -51,7 +52,7 @@ print_title_page <- function(infosheet, text_format = "rmd") {
dplyr::select(-affiliation) %>%
dplyr::mutate(affiliation_no = as.character(affiliation_no)) %>%
dplyr::group_by(`Order in publication`, Name) %>%
dplyr::summarise(affiliation_no = stringr::str_c(na.omit(affiliation_no), collapse = ", ")) %>%
dplyr::summarise(affiliation_no = stringr::str_c(na.omit(affiliation_no), collapse = ",")) %>%
dplyr::mutate(affiliation_no = dplyr::case_when(
shared_first & `Order in publication` == 1 ~ paste0(affiliation_no, "*"),
TRUE ~ affiliation_no)) %>%
Expand Down
5 changes: 3 additions & 2 deletions R/print_xml.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
#' listed for each CRediT role they partake in.
#' @export
#' @examples
#' validate_infosheet(infosheet = infosheet_template)
#' print_xml(infosheet = infosheet_template)
#' example_infosheet <- read_infosheet(infosheet = system.file("extdata", "infosheet_template_example.csv", package = "tenzing", mustWork = TRUE))
#' validate_infosheet(infosheet = example_infosheet)
#' print_xml(infosheet = example_infosheet)
print_xml <- function(infosheet) {
# Prepare the infosheet data
contrib_data <-
Expand Down
5 changes: 3 additions & 2 deletions R/print_yaml.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
#' @return The function returns a YAML document
#' @export
#' @examples
#' validate_infosheet(infosheet = infosheet_template)
#' print_yaml(infosheet = infosheet_template)
#' example_infosheet <- read_infosheet(infosheet = system.file("extdata", "infosheet_template_example.csv", package = "tenzing", mustWork = TRUE))
#' validate_infosheet(infosheet = example_infosheet)
#' print_yaml(infosheet = example_infosheet)
print_yaml <- function(infosheet) {
# Restructure input data
affiliation_data <- infosheet %>%
Expand Down
4 changes: 2 additions & 2 deletions R/read_infosheet.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ read_infosheet <- function(infosheet_path) {
#' of the name columns are empty.
#'
#' @param infosheet the imported infosheet
#'
#' @return sgllg
#' @export
#' @return The function returns the infosheet without empty additional rows.
clean_infosheet <- function(infosheet) {
infosheet %>%
tibble::as_tibble() %>%
Expand Down
Loading

0 comments on commit 61c9363

Please sign in to comment.