Skip to content

Commit 66e49e6

Browse files
committed
highlight almost exact matches in manual dedup checks and add links via doi
1 parent 09e1d75 commit 66e49e6

File tree

1 file changed

+66
-30
lines changed
  • inst/shiny-app/CiteSource

1 file changed

+66
-30
lines changed

inst/shiny-app/CiteSource/app.R

Lines changed: 66 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -894,41 +894,74 @@ server <- function(input, output, session) {
894894

895895
})
896896
output$manual_dedup_dt <- DT::renderDataTable({
897-
897+
898898
data <- manual_dedup_data()
899+
data[is.na(data)] <- ""
900+
data <- soles::format_doi(data)
901+
902+
data <- data %>%
903+
mutate(
904+
doi1 = ifelse(
905+
is.na(doi1) | doi1 == "",
906+
doi1,
907+
paste0("<a href='https://doi.org/", doi1, "' target='_blank'>", doi1, "</a>")
908+
),
909+
doi2 = ifelse(
910+
is.na(doi2) | doi2 == "",
911+
doi2,
912+
paste0("<a href='https://doi.org/", doi2, "' target='_blank'>", doi2, "</a>")
913+
914+
)
915+
)
899916

900-
format_cols <- c(
901-
"title1", "author1", "doi1", "volume1",
902-
"pages1", "number1", "year1", "abstract1", "journal1", "isbn1",
903-
"title2", "author2", "doi2", "volume2",
904-
"pages2", "number2", "year2", "abstract2", "journal2", "isbn2"
905-
)
906917

907-
format_cols <- intersect(format_cols, colnames(data))
908-
shinyjs::useShinyjs()
909-
910-
datatable(data,
911-
options = list(
912-
pageLength = 100,
913-
info = FALSE,
914-
lengthMenu = list(c(100, -1), c("100", "All")),
915-
columnDefs =
916-
list(
917-
list(visible = FALSE,
918-
targets = columns2hide),
919-
list(
920-
targets = "_all",
921-
render = JS(
922-
"function(data, type, row, meta) {",
923-
"return type === 'display' && data != null && data.length > 25 ?",
924-
"'<span title=\"' + data + '\">' + data.substr(0, 25) + '...</span>' : data;",
925-
"}"
918+
fields <- c("title", "author", "doi", "volume", "pages", "number", "year", "abstract", "journal", "isbn")
919+
920+
# Hide similarity score columns (fields without suffix)
921+
columns2hide <- which(names(data) %in% fields) - 1
922+
923+
dt <- datatable(data,
924+
selection = "multiple",
925+
rownames = FALSE,
926+
escape=FALSE,
927+
options = list(
928+
pageLength = 100,
929+
lengthMenu = list(c(100, -1), c("100", "All")),
930+
columnDefs = list(
931+
list(visible = FALSE, targets = columns2hide),
932+
list(
933+
targets = c(0:10,13:18),
934+
render = JS(
935+
"function(data, type, row, meta) {",
936+
" if(type === 'display' && data != null && data.length > 45) {",
937+
" return '<span title=\"' + data + '\">' + data.substr(0, 25) + '...</span>';",
938+
" } else {",
939+
" return data;",
940+
" }",
941+
"}"
942+
)
943+
)
926944
)
927-
)
928-
)
929-
))
945+
))
946+
947+
948+
brks <- c(0.999)
949+
cls <- c('black', '#008080')
950+
weights <- c('normal', 'bold')
951+
952+
for(field in fields){
953+
dt <- dt %>% formatStyle(
954+
c(paste0(field, "1"), paste0(field, "2")),
955+
field,
956+
color = styleInterval(brks, cls),
957+
fontWeight = styleInterval(brks, weights)
958+
)
959+
}
960+
961+
dt
930962
})
931963

964+
932965

933966
# ASySD manual dedup pre text
934967
output$Manual_pretext <- shiny::renderText({
@@ -1176,7 +1209,10 @@ server <- function(input, output, session) {
11761209
data_vis <- unique_filtered_visual()
11771210
shiny::req(nrow(data_vis) > 0)
11781211
source_comparison <- compare_sources(data_vis, comp_type = input$comp_type)
1179-
plot_source_overlap_upset(source_comparison, groups = stringr::str_sub(input$comp_type, end = -2), decreasing = c(TRUE, TRUE))
1212+
plot_source_overlap_upset(source_comparison, groups = stringr::str_sub(input$comp_type, end = -2), decreasing = c(TRUE, TRUE),
1213+
main.bar.color = "#3A3A3A",
1214+
sets.bar.color = "#3A3A3A",
1215+
matrix.color = "#008080")
11801216
})
11811217

11821218
output$plotgraph2 <- shiny::renderPlot({

0 commit comments

Comments
 (0)