Skip to content

Commit 2d4ac95

Browse files
authored
Merge pull request #855 from OpenKnowledgeMaps/dev
refactor: metadata clean up indexes
2 parents dbb2dd5 + 677fd03 commit 2d4ac95

11 files changed

Lines changed: 57 additions & 5 deletions

File tree

server/classes/headstart/preprocessing/Snapshot.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ public function __construct($ini_array, $query, $id, $service, $service_name, $v
2828
$snap_php = $ini_array["snapshot"]["snapshot_php"];
2929
$storage = $ini_array["snapshot"]["storage_path"];
3030
$nodemodules = $ini_array["snapshot"]["nodemodules_path"];
31+
$chrome_executable_path = $ini_array["snapshot"]["chrome_executable_path"];
3132

3233
$url = "{$host}{$snap_php}?{$url_postfix}";
33-
$this->cmd = "{$node_path} {$getsvg} \"{$url}\" {$storage}{$post_data['file']}.png {$nodemodules}";
34+
$this->cmd = "{$node_path} {$getsvg} \"{$url}\" {$storage}{$post_data['file']}.png {$nodemodules} {$chrome_executable_path}";
3435
}
3536

3637
public function takeSnapshot() {

server/preprocessing/conf/config.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ 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)
36+
chrome_executable_path = "/path/to/chrome"
3537

3638

3739
[connection]

server/preprocessing/other-scripts/base.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ etl <- function(res, repo, non_public) {
248248
subject_cleaned = gsub("(wikidata)?\\.org/entity/[qQ]([\\d]+)?", "", subject_cleaned) # remove wikidata classification
249249
subject_cleaned = gsub("</keyword><keyword>", "", subject_cleaned) # remove </keyword><keyword>
250250
subject_cleaned = gsub("\\[No keyword\\]", "", subject_cleaned)
251+
subject_cleaned = gsub("\\[[^]]*\\]", "", subject_cleaned) # remove any text inside square brackets
251252
subject_cleaned = gsub("\\[[^\\[]+\\][^\\;]+(;|$)?", "", subject_cleaned) # remove classification
252253
subject_cleaned = gsub("[0-9]{2,} [A-Z]+[^;]*(;|$)?", "", subject_cleaned) #remove classification
253254
subject_cleaned = gsub(" -- ", "; ", subject_cleaned) #replace inconsistent keyword separation

server/services/getChartSVG.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ function timeout(ms) {
77

88
(async() => {
99
try {
10-
const browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox', '--disable-setuid-sandbox'] });
10+
const browser = await puppeteer.launch({
11+
headless: true,
12+
args: ['--no-sandbox', '--disable-setuid-sandbox'],
13+
executablePath: process.argv[5]
14+
});
1115
await timeout(1000)
1216
const page = await browser.newPage();
1317
await timeout(1000)

server/services/search.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ function search(
221221
} else {
222222
$vis_type = "overview";
223223
}
224+
if (isset($post_params["vis_type"]) && $post_params["vis_type"] == "geomap") {
225+
$vis_type = "geomap";
226+
}
224227
$snapshot = new \headstart\preprocessing\Snapshot($ini_array, $query, $unique_id, $service, $repo2snapshot[$service], $vis_type);
225228
$snapshot->takeSnapshot();
226229
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
var data_config = {
2+
tag: "visualization",
3+
mode: "search_repos",
4+
5+
service: "base",
6+
7+
title: "",
8+
base_unit: "citations",
9+
use_area_uri: true,
10+
show_multiples: false,
11+
show_dropdown: false,
12+
preview_type: "pdf",
13+
sort_options: ["relevance", "title", "authors", "year"],
14+
is_force_areas: true,
15+
language: "eng_pubmed",
16+
area_force_alpha: 0.015,
17+
show_list: true,
18+
content_based: true,
19+
url_prefix: "https://www.base-search.net/Record/",
20+
21+
show_context: true,
22+
create_title_from_context: true,
23+
context_most_relevant_tooltip: true,
24+
25+
doi_outlink: true,
26+
filter_menu_dropdown: true,
27+
sort_menu_dropdown: true,
28+
filter_options: ["all", "open_access"],
29+
//show number of open access documents in context
30+
show_context_oa_number: false,
31+
32+
visualization_type: "geomap", // Used in the reducer named "chartType" to determine the visualization type: overview, timeline, geomap
33+
};

server/services/snapshot/data-config_base.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ var data_config = {
2828
filter_options: ["all", "open_access"],
2929
//show number of open access documents in context
3030
show_context_oa_number: false,
31+
32+
visualization_type: "overview", // Used in the reducer named "chartType" to determine the visualization type: overview, timeline, geomap
3133
};

server/services/snapshot/data-config_openaire.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ var data_config = {
6464
cited_by_tweeters_count: 'tweets',
6565
'readers.mendeley': 'readers'
6666
},
67-
67+
visualization_type: "overview", // Used in the reducer named "chartType" to determine the visualization type: overview, timeline, geomap
6868
};

server/services/snapshot/data-config_orcid.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ var data_config = {
2828
filter_options: ["all", "open_access"],
2929
//show number of open access documents in context
3030
show_context_oa_number: false,
31+
visualization_type: "overview", // Used in the reducer named "chartType" to determine the visualization type: overview, timeline, geomap
3132
};

server/services/snapshot/data-config_pubmed.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ var data_config = {
3434
filter_menu_dropdown: true,
3535
sort_menu_dropdown: true,
3636
filter_options: ["all", "open_access"],
37+
visualization_type: "overview", // Used in the reducer named "chartType" to determine the visualization type: overview, timeline, geomap
3738
};

0 commit comments

Comments
 (0)