Skip to content

Commit d9c0b6e

Browse files
authored
Merge pull request #754 from OpenKnowledgeMaps/bugfixes-2024-02
Bugfixes 2024 02
2 parents 3aeecc0 + 3150780 commit d9c0b6e

13 files changed

Lines changed: 46 additions & 62 deletions

File tree

local_dev/config_local_headstart.ini

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ preprocessing_dir = "/var/www/html/dev/server/preprocessing/"
77
# Full path to the images directory for the client. Needs to be in the public_html/www directory. Make sure that your webserver has write access to this directory.
88
images_path = "/var/www/html/dev/server/paper_preview/"
99
# Host of the client visualization
10-
host = "localhost/"
10+
host = "dev-searchflow-1/"
1111
# Relative path to the client visualization. Needs to be in the public_html/www directory.
1212
vis_path = "headstart"
1313
# Relative path to the client REST services. Needs to be in the public_html/www directory.
@@ -20,19 +20,21 @@ api_flavor = "dev"
2020

2121
[snapshot]
2222
# Set to 1 to enable snapshot feature, 0 to disable
23-
snapshot_enabled = 0
23+
snapshot_enabled = 1
2424
# Absolute path to node binary
25-
node_path = "/path/to/node"
25+
node_path = "/usr/local/nvm/versions/node/v10.17.0/bin/node"
2626
# Absolute paths to node_modules folder, where puppeteer is installed
27-
nodemodules_path = "/path/to/node_modules"
27+
nodemodules_path = "/usr/local/nvm/versions/node/v10.17.0/lib/node_modules/"
2828
# Absolute path to getChartSVG.js
29-
getsvg_path = "/path/to/getChartSVG.js"
29+
getsvg_path = "/var/www/html/headstart/server/services/getChartSVG.js"
3030
# Absolute path to the directory, where the snapshots are stored. Webserver must have write access to this directory
31-
storage_path = "/path/to/storage/"
31+
storage_path = "/var/www/html/snapshots/"
3232
# PHP File responsible for rendering the bubble in a way to be snapshotted. Relative path to general host
33-
snapshot_php = "server/services/snapshot/headstart_snapshot.php"
33+
snapshot_php = "headstart/server/services/snapshot/headstart_snapshot.php"
3434
# snapshot_local_protocol fallback for non-server environments
3535
snapshot_local_protocol = "http://"
36+
# Size of thumbnail width
37+
snapshot_width = "1200px"
3638

3739
[connection]
3840
# PostgreSQL database

local_dev/searchflow-container/Dockerfile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,19 @@ MAINTAINER Chris Kittel "christopher.kittel@openknowledgemaps.org"
55
RUN a2enmod rewrite
66
RUN apt-get update && apt-get install -y curl libsqlite3-dev php7.4-sqlite libonig-dev libxml2-dev
77
RUN docker-php-ext-install pdo pdo_sqlite mbstring xml fileinfo
8+
# for puppeteer
9+
RUN apt-get install -y gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
10+
ENV NVM_DIR /usr/local/nvm
11+
ENV NODE_VERSION 10.17.0
12+
RUN curl https://raw.githubusercontent.com/creationix/nvm/v0.24.1/install.sh | bash \
13+
&& . $NVM_DIR/nvm.sh \
14+
&& nvm install $NODE_VERSION \
15+
&& nvm alias default $NODE_VERSION \
16+
&& nvm use default
817

9-
RUN sed -i 's#AllowOverride [Nn]one#AllowOverride All#' /etc/apache2/apache2.conf
10-
RUN mkdir /var/www/localstorage
11-
COPY test.sqlite /var/www/localstorage/local.sqlite
12-
RUN chown -R www-data:www-data /var/www/localstorage
18+
ENV NODE_PATH $NVM_DIR/versions/node/v$NODE_VERSION/lib/node_modules
19+
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
20+
ENV NPM_PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin/npm
21+
RUN $NPM_PATH install -g puppeteer@^2.0.0 --unsafe-perm=true --allow-root
22+
23+
RUN sed -i 's#AllowOverride [Nn]one#AllowOverride All#' /etc/apache2/apache2.conf

server/classes/headstart/preprocessing/Snapshot.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,9 @@ public function __construct($ini_array, $query, $id, $service, $service_name, $v
1010
"query" => $query,
1111
"file" => $id,
1212
"service_name" => $service_name,
13-
"service" => $service
13+
"service" => $service,
14+
"vis_type" => $vis_type
1415
);
15-
if ($service_name == "LinkedCat") {
16-
$post_data["vis_type"] = $vis_type;
17-
$post_data["service_name"] = "linkedcat";
18-
}
19-
if ($service == "linkedcat_authorview") {
20-
$post_data["vis_mode"] = "authors";
21-
$post_data["service"] = "linkedcat";
22-
$post_data["service_name"] = "linkedcat";
23-
}
24-
if ($service == "linkedcat_browseview") {
25-
$post_data["vis_mode"] = "browse";
26-
$post_data["service"] = "linkedcat";
27-
$post_data["service_name"] = "linkedcat";
28-
}
2916
$url_postfix = http_build_query($post_data);
3017

3118
$node_path = $ini_array["snapshot"]["node_path"];

server/preprocessing/other-scripts/base.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ etl <- function(res, repo, non_public) {
199199
metadata$relation = check_metadata(res$dcrelation)
200200
metadata$identifier = check_metadata(res$dcidentifier)
201201
metadata$title = check_metadata(res$dctitle)
202-
metadata$title = str_replace(metadata$title, " ...$", "")
202+
metadata$title = gsub(" \\.\\.\\.$", "", metadata$title)
203203
metadata$paper_abstract = check_metadata(res$dcdescription)
204204
metadata$published_in = check_metadata(res$dcsource)
205205
metadata$year = check_metadata(res$dcdate)

server/preprocessing/other-scripts/openaire.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ preprocess_data <- function(all_artifacts){
144144
else {
145145
return (x)}
146146
})) # removes ;dk;atira;pure;researchoutput;pubmedpublicationtype;D013486
147+
# remove greater / smaller than signs
148+
all_artifacts$subject <- unlist(lapply(all_artifacts$subject, function(x) {gsub("&gt|&lt", "", x)}))
147149
all_artifacts$paper_abstract <- unlist(lapply(all_artifacts$paper_abstract, function(x){gsub("\\n", " ", x)}))
148150
all_artifacts$doi <- unlist(lapply(all_artifacts$doi, function(x) {str_replace_all(x, "[\r\n\t]" , "")}))
149151
return (all_artifacts)

server/preprocessing/other-scripts/test/params_base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
"min_descsize": 300,
88
"limit": 120,
99
"list_size": 100,
10-
"custom_clustering": "mesh"
10+
"repo": "ftunivbern"
1111
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{"funder":"EC",
2-
"project_id":"267439",
2+
"project_id":"643410",
33
"list_size": -1,
44
"vis_id": "TEST_ID"}

server/preprocessing/other-scripts/test/test_base.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ options(warn=1)
77
wd <- dirname(dirname(rstudioapi::getActiveDocumentContext()$path))
88
setwd(wd) #Don't forget to set your working directory
99

10-
query <- "species" #args[2]
10+
query <- "parzival" #args[2]
1111
service <- "base"
1212
params <- NULL
1313
params_file <- "test/params_base.json"

server/preprocessing/other-scripts/test/test_openaire.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ setwd(wd) #Don't forget to set your working directory
99

1010
# query: project acryonm
1111
# params: grant_id and funding_stream
12-
query <- "GRINDOOR" #args[2]
12+
query <- "openaire2020" #args[2]
1313
service <- "openaire"
1414
params <- NULL
1515
params_file <- "test/params_openaire.json"
@@ -71,4 +71,5 @@ if (!exists('output_json')) {
7171
output_json <- enrich_output_json(output_json)
7272
}
7373

74-
print(output_json)
74+
#print(output_json)
75+
output <- fromJSON(output_json)

server/services/getChartSVG.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function timeout(ms) {
1010
const page = await browser.newPage();
1111
await page.setViewport({width: 1920, height: 1080})
1212
await page.goto(process.argv[2], {waitUntil: 'networkidle2'});
13-
await timeout(2000)
13+
await timeout(3000)
1414
await page.screenshot({path: process.argv[3], clip: { x: 0, y: 0, width: 1150, height: 1080 }});
1515
browser.close();
1616

0 commit comments

Comments
 (0)