Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
2e827e2
add label select on upload, initial filter to duplicate table, and mi…
TNRiley Apr 28, 2025
4da731c
Merge branch 'dev' of https://github.com/ESHackathon/CiteSource into dev
TNRiley Apr 28, 2025
ec92826
add record type as standard export field
TNRiley Apr 29, 2025
97a4bcd
update description and news for version to 0.1.1
TNRiley Apr 29, 2025
c741a3a
Updated documentation for shiny
TNRiley Apr 29, 2025
ecddf17
remove font-awesome icons
TNRiley Apr 29, 2025
25ee213
add user guide markdown file
TNRiley Apr 29, 2025
72f4612
fixed upload table bug
TNRiley Apr 29, 2025
d4bd82d
corrected the shiny app link to the main branch shiny instead of dev
TNRiley Apr 30, 2025
7fca229
updated table edit functionality for quicker bulk entry.
TNRiley Apr 30, 2025
620178e
testing for phase plot
TNRiley May 2, 2025
eb6bb4d
remove some comments
TNRiley May 2, 2025
fdcdb9d
hide 'unkown' source values as default in plots
TNRiley May 2, 2025
b8c727e
fix the detailed records table
TNRiley May 2, 2025
005242e
update plot export
TNRiley May 2, 2025
9d69b05
remove problematic legend count
TNRiley May 2, 2025
331ee25
set legend count to FALSE until fixed
TNRiley May 2, 2025
a0362f2
corrected OR statement
TNRiley May 2, 2025
004eb5f
remove left over script
TNRiley May 2, 2025
278d98c
removed unused upload number
TNRiley May 2, 2025
e024ebf
remove unused observe event
TNRiley May 2, 2025
58158cc
removed uncesary null initialization of n_unique reactive
TNRiley May 2, 2025
8a71848
Documentation
actions-user May 2, 2025
35f65a2
updated app - removed copy app for testing
TNRiley May 2, 2025
ab09852
Merge branch 'dev' of https://github.com/ESHackathon/CiteSource into dev
TNRiley May 2, 2025
f4066f3
add CS gif
TNRiley May 2, 2025
a71781f
fix - link open in new tab
TNRiley May 5, 2025
dc4649e
Better UX on dedup table, less columns, better order, and easier drop…
TNRiley May 5, 2025
349ba4b
added extra_merge_fields = "cite_string" back to correct manual dedup
TNRiley May 5, 2025
1a4b21b
initiate renv in order to test working local version on shinyapps.io …
TNRiley May 6, 2025
9fd0f1c
add debug script to text shinyapps.io version logs - this version wor…
TNRiley May 6, 2025
3896a17
remove previous debug script
TNRiley May 6, 2025
14ee21e
removed renv.lock as not needed. consider adding again once stable
TNRiley May 6, 2025
ff92358
large overhaul of Shiny to conform with latest R version
TNRiley May 7, 2025
421b715
enhanced count for edge cases where duplication exists in screened or…
TNRiley May 7, 2025
4a249ff
add ability to change number of records in table
TNRiley May 7, 2025
22e807c
add R/sysdata.rda file
TNRiley May 7, 2025
b679e16
fix html for citation display
TNRiley May 7, 2025
7f1d857
autofill labels with search
TNRiley May 7, 2025
c20c1f0
simplified view rows and export
TNRiley May 7, 2025
e10e3c5
removed initial record table duplicative with detailed record table
TNRiley May 7, 2025
1fa6d87
fix detailed record source contribution
TNRiley May 7, 2025
bc5d9fa
add flavicon
TNRiley May 9, 2025
022d8d6
Merge branch 'main' into dev
TNRiley May 9, 2025
612bdd4
add google analytics to dev app
TNRiley May 12, 2025
d079137
add google analytics to main
TNRiley May 12, 2025
a097301
add google analytics to app and deploy
TNRiley May 12, 2025
1e2335d
fix: Correct env var quoting in shinyapps deploy steps
TNRiley May 12, 2025
c7c7837
Attempt to fix deploy error by restructuring envVars
TNRiley May 12, 2025
2143779
attempt new GA integration
TNRiley May 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
^renv$
^renv\.lock$
^.*\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/document-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ jobs:
R -e "
remotes::install_github('ESHackathon/CiteSource', force = TRUE);
rsconnect::setAccountInfo(name=${{secrets.SHINY_LUKAS_ACCOUNT}}, token=${{secrets.SHINY_LUKAS_TOKEN}}, secret=${{secrets.SHINY_LUKAS_SECRET}});
rsconnect::deployApp(appName = 'CiteSource_latest', appDir = './inst/shiny-app/CiteSource', forceUpdate = TRUE)"
rsconnect::deployApp(
appName = 'CiteSource_latest',
appDir = './inst/shiny-app/CiteSource',
forceUpdate = TRUE)"

- name: Deploy stable version from main
if: github.ref == 'refs/heads/main'
Expand All @@ -63,7 +66,10 @@ jobs:
R -e "
remotes::install_github('ESHackathon/CiteSource', force = TRUE);
rsconnect::setAccountInfo(name=${{secrets.SHINY_LUKAS_ACCOUNT}}, token=${{secrets.SHINY_LUKAS_TOKEN}}, secret=${{secrets.SHINY_LUKAS_SECRET}});
rsconnect::deployApp(appName = 'CiteSource', appDir = './inst/shiny-app/CiteSource', forceUpdate = TRUE)"
rsconnect::deployApp(
appName = 'CiteSource',
appDir = './inst/shiny-app/CiteSource',
forceUpdate = TRUE)"

- name: Create pkgdown
env:
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: CiteSource
Title: Analyze the Utility of Information Sources and Retrieval Methodologies for Evidence Synthesis
Version: 0.0.1
Version: 0.1.1
Date: 2023-06-22
Authors@R: c(
person("Trevor", "Riley", , "trevor.riley@noaa.gov", role = c("aut", "cre"),
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@

- Integrated new dedup function into R shiny app

# CiteSource 0.1.1

- Added new functions which allow creation of tables and plots based on deduplicated (reimported) data.

- Updated shiny functionality, look and feel, and documentation

- Added new vignettes
5 changes: 3 additions & 2 deletions R/dedup.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ dedup_citations_add_manual <- function(unique_citations, additional_pairs) {
unique_citations$source = unique_citations$cite_source
unique_citations$label = unique_citations$cite_label

dedup_results <- ASySD::dedup_citations_add_manual(unique_citations, additional_pairs = additional_pairs
)
dedup_results <- ASySD::dedup_citations_add_manual(unique_citations,
additional_pairs = additional_pairs,
extra_merge_fields = "cite_string")

dedup_results$cite_source <- dedup_results$source
dedup_results$cite_label <- dedup_results$label
Expand Down
3 changes: 2 additions & 1 deletion R/export.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ export_ris <- function(citations, filename = "citations.ris", source_field = "DB
string_field, "cite_string", TRUE,
label_field, "cite_label", TRUE,
"C1", "duplicate_id", TRUE,
"C2", "record_ids", TRUE
"C2", "record_ids", TRUE,
"TY", "type", TRUE
),
synthesisr_code_lookup %>% dplyr::filter(.data$ris_synthesisr)
) %>% dplyr::distinct(.data$code, .keep_all = TRUE) # Remove fields from synthesisr specification used for CiteSource metadata
Expand Down
8 changes: 6 additions & 2 deletions R/new_count_and_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -315,15 +315,19 @@ calculate_phase_records <- function(unique_citations, n_unique, db_colname) {
total_distinct_records <- dplyr::n_distinct(unique_citations$duplicate_id)

# Split the cite_label column and count any occurrence of "screened" and "final"
# Updated for edge cases where a citation is duplicated within the screened set
total_screened <- unique_citations %>%
tidyr::separate_rows(cite_label, sep = ",\\s*") %>%
dplyr::filter(cite_label == "screened") %>%
nrow()
# Count the number of distinct duplicate_ids that remain
dplyr::n_distinct(duplicate_id)

# Updated for edge cases where a citation is duplicated within the screened set (should never happen)
total_final <- unique_citations %>%
tidyr::separate_rows(cite_label, sep = ",\\s*") %>%
dplyr::filter(cite_label == "final") %>%
nrow()
# Count the number of distinct duplicate_ids that remain
dplyr::n_distinct(duplicate_id)

# Step 2: Proceed with the regular calculation for distinct records by source
distinct_count <- unique_citations %>%
Expand Down
2 changes: 1 addition & 1 deletion R/plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ cite_source <- cite_label <- type <- NULL
#'
plot_contributions <- function(data, facets = cite_source, bars = cite_label, color = type,
center = FALSE, bar_order = "keep", facet_order = "keep",
color_order = "keep", totals_in_legend = TRUE) {
color_order = "keep", totals_in_legend = FALSE) {

bars <- rlang::enquo(bars)
color <- rlang::enquo(color)
Expand Down
44 changes: 25 additions & 19 deletions R/tables.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,32 @@
record_level_table <- function(citations, include = "sources", include_empty = TRUE, return = c("tibble", "DT"), indicator_presence = NULL, indicator_absence = NULL) {

if (!is.data.frame(citations) || nrow(citations) == 0) stop("Citations must be a tibble and cannot have 0 entries")

if (is.null(indicator_absence)) {
indicator_absence <- switch(return[1],
tibble = FALSE,
DT = "&#x2717;"
tibble = FALSE,
DT = "&#x2717;"
)
}
if (is.null(indicator_presence)) {
indicator_presence <- switch(return[1],
tibble = TRUE,
DT = "&#10004;"
tibble = TRUE,
DT = "&#10004;"
)
}

sources <- compare_sources(citations, comp_type = include)

if (nrow(sources) == 0) {
warning("Citations provided contain no information on ", include, ". NA will be displayed, but check whether you intended to do a different comparison")
sources <- tibble::tibble(duplicate_id = citations$duplicate_id)
sources[[paste0(stringr::str_sub(include, 1, -2), "__NA")]] <- TRUE
sources <- tibble::tibble(duplicate_id = citations$duplicate_id)
sources[[paste0(stringr::str_sub(include, 1, -2), "__NA")]] <- TRUE
}

if (!include_empty == TRUE) {
citations <- citations %>% dplyr::filter(.data$duplicate_id %in% sources$duplicate_id)
}

if (! "url" %in% colnames(citations)) {
citations$url <- NA_character_
}
Expand All @@ -65,17 +65,17 @@ record_level_table <- function(citations, include = "sources", include_empty = T
dplyr::arrange(stringr::str_extract(.data$author, "^.*?,"), .data$citation) %>%
dplyr::select("duplicate_id", "citation", "reference", "html_reference") %>%
dplyr::left_join(sources, by = "duplicate_id")

indicator_presence <- as.character(indicator_presence)
indicator_absence <- as.character(indicator_absence)

to_display <- citations %>%
dplyr::select(-(1:4)) %>%
dplyr::mutate(dplyr::across(dplyr::everything(), ~ ifelse(.x, indicator_presence, indicator_absence))) %>%
dplyr::rename_with(~ paste0(.x, " ")) # Add space to keep column names unique

citations <- dplyr::bind_cols(citations, to_display)

if (return[1] == "DT") {
if (!rlang::is_installed("DT")) {
warning('DT can only be returned when the DT package is installed. Please run install.packages("DT")')
Expand All @@ -88,7 +88,7 @@ record_level_table <- function(citations, include = "sources", include_empty = T
stringr::str_remove(glue::glue("^{type}__"))
list(type = type %>% stringr::str_to_title(), values = values)
}) %>% purrr::transpose()

sketch <- htmltools::tags$table(
class = "display",
htmltools::tags$thead(
Expand All @@ -105,24 +105,30 @@ record_level_table <- function(citations, include = "sources", include_empty = T
htmltools::tags$td(colspan = 4 + length(unlist(headings$values)), htmltools::HTML("Click on the &oplus; to view the full reference"))
)
)

citations %>%
dplyr::select(-"duplicate_id", -"reference") %>%
cbind(" " = "&oplus;", .) %>%
DT::datatable(
escape = FALSE,
extensions = "Buttons",
options = list(
pageLength = 10,
lengthMenu = list(c(10, 25, 50, 100, -1), c('10', '25', '50', '100', 'All')),
columnDefs = list(
list(visible = FALSE, targets = c(0, 3:(3 + ncol(to_display)))),
list(orderable = FALSE, className = "details-control", targets = 1)
),
dom = "Bfrtip",
dom = "lBfrtip",
buttons =
list("print", list(
extend = "csv", filename = "CiteSource_record_summary",
text = "Download csv",
exportOptions = list(columns = c(0, 2:(3 + ncol(to_display))))
exportOptions = list(
columns = c(0, 2:(3 + ncol(to_display))),
modifier = list(page = "all")
)

))
), container = sketch,
callback = DT::JS("
Expand Down Expand Up @@ -585,8 +591,8 @@ generate_apa_reference <- function(authors, year, title, source, volume, issue,
dplyr::rowwise() %>%
dplyr::mutate(
reference = glue::glue("
{glue::glue_collapse(initialed_names, ', ', last = ' & ')} ({year}). {nNA(title, '.')} {nNA(source, pre = '<i>', '</i>')}{nNA(volume, pre = '<i>, ', '</i>')}{nNA(issue, pre = '(', ')')}. {nNA(link, pre = '<a href = \"', '\">')}{nNA(link, '</a>')}
")
{glue::glue_collapse(initialed_names, ', ', last = ' & ')} ({year}). {nNA(title, '.')} {nNA(source, pre = '<i>', '</i>')}{nNA(volume, pre = '<i>, ', '</i>')}{nNA(issue, pre = '(', ')')}. {nNA(link, pre = '<a href=\"', '\" target=\"_blank\" rel=\"noopener noreferrer\">')}{nNA(link, '</a>')}
")
) %>%
dplyr::pull(.data$reference)
} else {
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ CiteSource was created under [the General Public License (>=v3)](https://www.gnu

**Shiny Web Application**

Whether you know R or not, we want you to be able to use CiteSource! Check out our [CiteSource Shiny App!](https://litrev.shinyapps.io/CiteSource_latest/)
Whether you know R or not, we want you to be able to use CiteSource! Check out our [CiteSource Shiny App!](https://litrev.shinyapps.io/CiteSource/)

## Features
**Customizable Metadata Tags**
Expand Down
Loading