Skip to content

Commit bbdca4e

Browse files
authored
Merge pull request #866 from OpenKnowledgeMaps/dev
refactor: aquanavi data update and documents renaming
2 parents 2d4ac95 + a4ffabf commit bbdca4e

31 files changed

Lines changed: 50687 additions & 1398 deletions

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ local_dev/paper_preview
3838
# php files
3939
/server/classes/headstart/vendor
4040
/server/classes/headstart/var/*
41+
**.phpunit.cache
4142

4243
# R files
4344
server/preprocessing/other-scripts/.Rhistory
@@ -46,6 +47,9 @@ server/preprocessing/other-scripts/renv
4647
.Rprofile
4748
.Rproj*
4849
/*.Rproj
50+
*/**/*.Rproj
51+
*/**/*.RData
52+
server/workers/*/renv
4953
.Rproj.user
5054

5155
# python files
@@ -66,6 +70,9 @@ server/preprocessing/other-scripts/renv
6670
# temporal
6771
local_dev/config_local_headstart.ini
6872
local_dev/config_local_searchflow.ini
73+
local_dev/tools/**/*.csv
74+
local_dev/tools/**/*.json
75+
local_dev/tools/**/*.log
6976

7077
# mac os
7178
.DS_Store

examples/public/main_integration/base_sg.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<meta name="keywords" content="knowldege visualization, open knowledge, open science">
2121

2222
<meta name="description"
23-
content="Get an overview of digital education, find relevant papers, and identify important concepts.">
23+
content="Get an overview of digital education, find relevant research outputs, and identify important concepts.">
2424

2525
<!-- FAVICONS -->
2626
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=xQz6nej7eR">

examples/public/main_integration/openaire.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<meta name="keywords" content="knowldege visualization, open knowledge, open science">
2121

2222
<meta name="description"
23-
content="Get an overview of digital education, find relevant papers, and identify important concepts.">
23+
content="Get an overview of digital education, find relevant research outputs, and identify important concepts.">
2424

2525
<!-- FAVICONS -->
2626
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=xQz6nej7eR">

examples/templates/base.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<link rel="icon" type="image/png" sizes="16x16" href="./main_integration/img/favicon-16x16.png?v=xQz6nej7eR">
2323

2424
<meta name="description"
25-
content="Get an overview of digital education, find relevant papers, and identify important concepts.">
25+
content="Get an overview of digital education, find relevant research outputs, and identify important concepts.">
2626

2727
<!-- FAVICONS -->
2828
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=xQz6nej7eR">

examples/templates/pubmed.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<link rel="icon" type="image/png" sizes="16x16" href="./main_integration/img/favicon-16x16.png?v=xQz6nej7eR">
2323

2424
<meta name="description"
25-
content="Get an overview of &quot;climate change&quot;, find relevant papers, and identify important concepts.">
25+
content="Get an overview of &quot;climate change&quot;, find relevant research outputs, and identify important concepts.">
2626

2727
<link type="text/css" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
2828
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800' rel='stylesheet' type='text/css'>

examples/templates/triple.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<title>Overview of research on psychology</title>
88
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
99
<meta name="description"
10-
content="Get an overview of psychology, find relevant papers, and identify important concepts.">
10+
content="Get an overview of psychology, find relevant research outputs, and identify important concepts.">
1111

1212
<script type="text/javascript" src="./triple/data-config-km.js"></script>
1313
<script type="text/javascript" src="./triple/data-config-sg.js"></script>

local_dev/config_local_headstart.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ snapshot_php = "headstart/server/services/snapshot/headstart_snapshot.php"
3535
snapshot_local_protocol = "http://"
3636
# Size of thumbnail width
3737
snapshot_width = "1200px"
38+
# chrome executable path optional, only needed if puppeteer cannot find chrome automatically
39+
chrome_executable_path = "/path/to/chrome"
3840

3941
[connection]
4042
# PostgreSQL database

server/preprocessing/conf/config.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ storage_path = "/path/to/storage/"
3232
snapshot_php = "server/services/snapshot/headstart_snapshot.php"
3333
# snapshot_local_protocol fallback for non-server environments
3434
snapshot_local_protocol = "http://"
35-
# chrome executable path (optional, only needed if puppeteer cannot find chrome automatically)
35+
# chrome executable path optional, only needed if puppeteer cannot find chrome automatically
3636
chrome_executable_path = "/path/to/chrome"
3737

3838

server/preprocessing/other-scripts/openaire.R

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ get_papers <- function(query, params) {
5252
funder = funder,
5353
format = 'xml')
5454
pubs_metadata <- parse_response(response)
55-
# FYI: The deactivation of the fill_dois() function is a hotfix
56-
# to enable creation of OpenAIRE project maps
57-
# TODO: root cause analysis of failure mode
58-
# TODO: refactor/replace/remove the function, decision pending
59-
#pubs_metadata <- fill_dois(pubs_metadata)
6055
},
6156
error = function(err){
6257
olog$warn(paste0("vis_id:", .GlobalEnv$VIS_ID, "publications: ", err))
@@ -193,34 +188,6 @@ parse_response <- function(response) {
193188
}
194189
}
195190

196-
fill_dois <- function(df) {
197-
missing_doi_indices <- which(is.na(df$doi))
198-
titles <- df[missing_doi_indices,]$title
199-
if (exists("DEBUG") && DEBUG) {
200-
olog$debug(paste("Missing DOIs:", length(titles)))
201-
olog$debug("Time for filling missing DOIs")
202-
olog$debug(system.time(cr_works(query=queries(titles), async=TRUE)))
203-
}
204-
tryCatch({
205-
if (length(titles) > 1) {
206-
response <- cr_works(query=queries(titles))
207-
candidates <- lapply(response, get_doi_candidates)
208-
dois <- mapply(check_distance, titles, candidates, USE.NAMES=FALSE)
209-
} else if (length(titles) == 1) {
210-
response <- cr_works(flq=c('query.title'=titles))$data
211-
candidate_response = response[1,]
212-
dois <- check_distance(titles, candidate_response)
213-
} else {
214-
dois <- ""
215-
}
216-
df$doi[c(missing_doi_indices)] <- dois
217-
}, error=function(err){
218-
olog$error(paste("vis_id:", .GlobalEnv$VIS_ID, "DOI enrichment failed:", paste(err)))
219-
}
220-
)
221-
return (df)
222-
}
223-
224191
get_doi_candidates <- function(response){
225192
if (nrow(response) >= 1) {
226193
candidate = response[1,c('doi', 'title')]
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
rm(list = ls())
2+
3+
args <- commandArgs(TRUE)
4+
wd <- args[1]
5+
setwd(wd)
6+
7+
renv::activate()
8+
renv::restore(lockfile = '../renv.lock')
9+
Sys.setlocale(category = "LC_ALL", locale = "en_US.UTF-8")
10+
11+
library(jsonlite)
12+
library(rbace)
13+
library(logging)
14+
15+
source('utils.R')
16+
if (Sys.getenv("LOGLEVEL") == "DEBUG") {
17+
DEBUG <- FALSE
18+
} else {
19+
DEBUG <- TRUE
20+
}
21+
22+
if (DEBUG == TRUE) {
23+
setup_logging('DEBUG')
24+
} else {
25+
setup_logging('INFO')
26+
}
27+
28+
log <- getLogger('update_contentproviders')
29+
30+
output_path <- if (length(args) >= 2) args[2] else {
31+
file.path(wd, "../../workers/common/common/contentproviders.json")
32+
}
33+
output_path <- normalizePath(output_path, mustWork = FALSE)
34+
35+
tryCatch({
36+
contentproviders <- bs_repositories("")
37+
if (is.null(contentproviders) || nrow(contentproviders) == 0) {
38+
stop("No content providers retrieved.")
39+
}
40+
triple <- list(name = "GoTriple", internal_name = "fttriple")
41+
contentproviders <- rbind(contentproviders, triple)
42+
43+
write(toJSON(contentproviders, pretty = TRUE), file = output_path)
44+
log$info(paste("contentproviders.json updated:", output_path,
45+
"", nrow(contentproviders), "entries"))
46+
}, error = function(err) {
47+
log$error(paste("Content provider update failed", "base",
48+
"update_contentproviders", "", err, sep = "||"))
49+
quit(status = 1)
50+
})

0 commit comments

Comments
 (0)