Skip to content

Commit ff8e2ca

Browse files
committed
Merge commit 'd661791d164a999fb95526acc5706e7b5450059c'
2 parents 468fcb1 + d661791 commit ff8e2ca

File tree

7 files changed

+11286
-16
lines changed

7 files changed

+11286
-16
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: document-and-deploy
2+
3+
on:
4+
push:
5+
pull_request:
6+
release:
7+
8+
jobs:
9+
document-and-deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- uses: r-lib/actions/setup-pandoc@v2
17+
18+
- name: Set up R version
19+
uses: r-lib/actions/setup-r@v2
20+
with:
21+
r-version: "oldrel" # As shinyapps.io needs some time to catch up after releases
22+
use-public-rspm: true
23+
24+
- name: Set up R Dependencies
25+
uses: r-lib/actions/setup-r-dependencies@v2
26+
with:
27+
extra-packages: devtools, plogr, roxygen2, remotes, rsconnect, pkgdown
28+
29+
- name: Create documentation
30+
run: |
31+
R -e "
32+
file.remove('NAMESPACE');
33+
descr <- readLines('DESCRIPTION');
34+
descr <- stringr::str_replace(descr, '^Date.*$', paste('Date:', Sys.Date()));
35+
writeLines(descr, 'DESCRIPTION');
36+
roxygen2::roxygenise();
37+
try(devtools::build_manual())
38+
"
39+
40+
- name: commit
41+
run: |
42+
git config --local user.email "actions@github.com"
43+
git config --local user.name "GitHub Actions"
44+
git add -f man/\* NAMESPACE
45+
git commit -m 'Documentation' || echo "No changes to commit"
46+
git push origin || echo "No changes to commit"
47+
48+
- name: Deploy latest from dev
49+
if: github.ref == 'refs/heads/dev'
50+
env:
51+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
52+
run: |
53+
R -e "
54+
remotes::install_github('ESHackathon/CiteSource', force = TRUE);
55+
rsconnect::setAccountInfo(name=${{secrets.SHINY_LUKAS_ACCOUNT}}, token=${{secrets.SHINY_LUKAS_TOKEN}}, secret=${{secrets.SHINY_LUKAS_SECRET}});
56+
rsconnect::deployApp(appName = 'CiteSource_latest', appDir = './inst/shiny-app/CiteSource', forceUpdate = TRUE)"
57+
58+
- name: Deploy stable version from main
59+
if: github.ref == 'refs/heads/main'
60+
env:
61+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
62+
run: |
63+
R -e "
64+
remotes::install_github('ESHackathon/CiteSource', force = TRUE);
65+
rsconnect::setAccountInfo(name=${{secrets.SHINY_LUKAS_ACCOUNT}}, token=${{secrets.SHINY_LUKAS_TOKEN}}, secret=${{secrets.SHINY_LUKAS_SECRET}});
66+
rsconnect::deployApp(appName = 'CiteSource', appDir = './inst/shiny-app/CiteSource', forceUpdate = TRUE)"
67+
68+
- name: Create pkgdown
69+
env:
70+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
71+
run: |
72+
R -e "
73+
if (!require(CiteSource)) remotes::install_github('ESHackathon/CiteSource', force = TRUE);
74+
pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)"
75+
76+
- name: Deploy to GitHub pages 🚀
77+
if: ${{ github.ref_name }} == 'main'
78+
uses: JamesIves/github-pages-deploy-action@v4
79+
with:
80+
clean: true
81+
branch: gh-pages
82+
folder: docs

R/dedup.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ dedup_citations_add_manual <- function(unique_citations, additional_pairs) {
9595
unique_citations$source = unique_citations$cite_source
9696
unique_citations$label = unique_citations$cite_label
9797

98-
dedup_results <- ASySD::dedup_citations_add_manual(unique_citations, additional_pairs = additional_pairs,
99-
extra_merge_fields = "cite_string")
98+
dedup_results <- ASySD::dedup_citations_add_manual(unique_citations, additional_pairs = additional_pairs
99+
)
100100

101101
dedup_results$cite_source <- dedup_results$source
102102
dedup_results$cite_label <- dedup_results$label

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ The CiteSource deduplication process is better described as a record merging pro
3737

3838
Once records are deduplicated, users are able to easily create plots and tables to answer specific questions or to simply explore the data in an effort to develop new hypotheses. Examples of analysis may include how many unique records a specific source contributed or how traditional methods of searching fare against a new AI discovery tool in finding relevant articles. Users may want to understand the overlap in records between two different search strings or evaluate the impact of including Google Scholar in a review. Before searching, a user may even develop a targeted search to better understand the topical coverage across databases that they intend to search, and once the search has been developed, how a particular source, string, or method performed in discovering benchmarking articles.
3939

40+
**Exporting and Re-importing Data**
41+
42+
Once records have been processed, users are able to export data in .csv, .ris, and .bib formats. Furthermore, users are able to reimport .csv and .ris files in order to recreate plots and tables.
43+
4044
## Getting Started
4145
**Installation**
4246

inst/shiny-app/CiteSource/app.R

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,12 @@ ui <- shiny::navbarPage("CiteSource",
7979
multiple = TRUE,
8080
accept = c(".ris", ".txt", ".bib")
8181
),
82+
shiny::p(
83+
HTML("NOTE: OVID citations may be incompatible.<br>
84+
Import and export them using citation software<br>
85+
before uploading for accurate metadata mapping."),
86+
style = "font-size: 85%; color: darkgrey;"
87+
),
8288
shiny::hr(),
8389
shiny::h5("OR: Re-upload an .ris or .csv exported from CiteSource"),
8490
shiny::fileInput("file_reimport", "",
@@ -462,18 +468,44 @@ server <- function(input, output, session) {
462468
shiny::observe({
463469
if (nrow(rv$latest_unique) > 0) {
464470

465-
sources <- unique(rv$latest_unique$cite_source) %>% stringr::str_split(", ") %>% unlist() %>% unique() %>% sort()
466-
labels <- unique(rv$latest_unique$cite_label) %>% stringr::str_split(", ") %>% unlist() %>% unique() %>% sort()
467-
strings <- unique(rv$latest_unique$cite_string) %>% stringr::str_split(", ") %>% unlist() %>% unique() %>% sort()
471+
# Handle cite_source
472+
sources <- rv$latest_unique$cite_source
473+
if (all(is.na(sources) | sources == "")) {
474+
sources <- NULL # Leave it as NULL or NA
475+
} else {
476+
sources <- unique(sources[!is.na(sources) & sources != ""]) %>%
477+
stringr::str_split(", ") %>%
478+
unlist() %>%
479+
unique() %>%
480+
sort()
481+
}
468482

469-
sources <- sources[sources != "unknown"]
470-
labels <- labels[labels != "unknown"]
471-
strings <- strings[strings != "unknown"]
483+
# Handle cite_label
484+
labels <- rv$latest_unique$cite_label
485+
if (all(is.na(labels) | labels == "")) {
486+
labels <- NULL # Leave it as NULL or NA
487+
} else {
488+
labels <- unique(labels[!is.na(labels) & labels != ""]) %>%
489+
stringr::str_split(", ") %>%
490+
unlist() %>%
491+
unique() %>%
492+
sort()
493+
494+
}
472495

473-
if (any(rv$latest_unique$cite_source == "unknown")) sources <- c(sources, "_blank_")
474-
if (any(rv$latest_unique$cite_label == "unknown")) labels <- c(labels, "_blank_")
475-
if (any(rv$latest_unique$cite_string == "unknown")) strings <- c(strings, "_blank_")
496+
# Handle cite_string
497+
strings <- rv$latest_unique$cite_string
498+
if (all(is.na(strings) | strings == "")) {
499+
strings <- NULL # Leave it as NULL or NA
500+
} else {
501+
strings <- unique(strings[!is.na(strings) & strings != ""]) %>%
502+
stringr::str_split(", ") %>%
503+
unlist() %>%
504+
unique() %>%
505+
sort()
506+
}
476507

508+
# Update select inputs
477509
shiny::updateSelectInput(inputId = "sources_visual", choices = sources, selected = sources)
478510
shiny::updateSelectInput(inputId = "labels_visual", choices = labels, selected = labels)
479511
shiny::updateSelectInput(inputId = "strings_visual", choices = strings, selected = strings)
@@ -540,18 +572,23 @@ server <- function(input, output, session) {
540572

541573
# Generate a summary message based on deduplication results
542574
n_citations <- nrow(rv$upload_df)
543-
n_unique_records <- nrow(rv$n_unique) # Changed variable name to avoid conflict
575+
n_distinct_records <- nrow(rv$n_unique)
576+
n_unique_records <- nrow(dedup_results$unique)
544577
n_pairs_manual <- nrow(rv$pairs_to_check)
545578

546579
message <- if (n_pairs_manual > 0) {
547580
paste(
548-
"From a total of", n_citations, "citations added, there are", n_unique_records,
549-
"unique citations. Head to the manual deduplication tab to check", n_pairs_manual, "potential duplicates."
581+
"From the", n_citations, "records, that were uploaded, there were", n_distinct_records,
582+
"distinct records identified after internal source deduplication.
583+
Of these distinct records, there were", n_unique_records, "unique records.
584+
Head to the manual deduplication tab to check", n_pairs_manual, "potential duplicates."
550585
)
551586
} else {
552587
paste(
553-
"From a total of", n_citations, "citations added, there are", n_unique_records,
554-
"unique citations. There are no potential duplicates for manual review. You can proceed to the visualization tab."
588+
"From the", n_citations, "records, that were uploaded, there were", n_distinct_records,
589+
"distinct records identified after internal source deduplication.
590+
There were no potential duplicates identifid for manual review.
591+
You can proceed to the visualization tab."
555592
)
556593
}
557594

0 commit comments

Comments
 (0)