Skip to content

Commit 9e1df53

Browse files
authored
Merge pull request #879 from OpenKnowledgeMaps/dev
Crossref rate limit
2 parents 4d0c4eb + 12bbb1c commit 9e1df53

52 files changed

Lines changed: 5785 additions & 663 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dist/
1111
.cache
1212
coverage/
1313
.vscode/
14+
.phpunit.result.cache
1415

1516
# local deployment files
1617
/deploy.sh
@@ -74,5 +75,11 @@ local_dev/tools/**/*.csv
7475
local_dev/tools/**/*.json
7576
local_dev/tools/**/*.log
7677

78+
# Playwright
79+
/test-results/
80+
/playwright-report/
81+
/blob-report/
82+
/playwright/.cache/
83+
7784
# mac os
7885
.DS_Store

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@ services:
247247
PYTHONIOENCODING: "utf-8"
248248
R_ALTMETRIC_APIKEY: "${R_ALTMETRIC_APIKEY}"
249249
R_CROSSREF_APIMAIL: "${R_CROSSREF_APIMAIL}"
250+
R_CROSSREF_PLUS_TOKEN: "${R_CROSSREF_PLUS_TOKEN}"
251+
R_CROSSREF_BATCH_SIZE: "${R_CROSSREF_BATCH_SIZE}"
250252
restart: unless-stopped
251253
volumes:
252254
- ./local_dev/renv/cache:/renv/cache

e2e/basicTests/AQUANAVI.spec.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { test, expect } from "@playwright/test";
2+
import { prepareVisualisation } from "../../vis/js/utils/e2eVisualisationLoader";
3+
4+
test.describe("Basic tests for AQUANAVI integration (Geomap visualisation type)", () => {
5+
test.describe("Using direct dynamic URL / PSVS link", () => {
6+
test("Loads default Geomap visualisation", async ({ page }) => {
7+
const VISUALISATION_DYNAMIC_URL =
8+
"/search?type=get&vis_type=geomap&q=mesocosms&service=aquanavi&custom_title=aquatic+mesocosm+facilities&min_descsize=0";
9+
10+
await prepareVisualisation(page, VISUALISATION_DYNAMIC_URL);
11+
12+
await expect(page.locator("#search-term-unique")).toContainText(
13+
"aquatic mesocosm facilities",
14+
);
15+
await expect(page.locator("#source")).toContainText(
16+
"Data source: AQUANAVI",
17+
);
18+
await page.getByTestId("context").getByText("More information").click();
19+
await expect(page.locator("#info-body")).toContainText(
20+
"This geo map presents you with an overview of aquatic mesocosm facilities.",
21+
);
22+
await expect(page.locator("#info-body")).toContainText(
23+
"This visualization has a custom title and was created using the following query: mesocosms",
24+
);
25+
});
26+
});
27+
});

e2e/basicTests/ORCID.spec.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import { test, expect } from "@playwright/test";
2+
import { prepareVisualisation } from "../../vis/js/utils/e2eVisualisationLoader";
3+
import { waitForVisualisationCreation } from "../../vis/js/utils/e2eWaitForVisualisationCreation";
4+
5+
test.describe("Basic tests for ORCID integration (Knowledge Map visualisation type)", () => {
6+
test.describe("Using direct dynamic URL / PSVS link", () => {
7+
test("Loads default Knowledge Map visualisation", async ({ page }) => {
8+
const VISUALISATION_DYNAMIC_URL =
9+
"/search?type=get&vis_type=overview&orcid=0000-0001-6011-4382&service=orcid&embed=true";
10+
11+
await prepareVisualisation(page, VISUALISATION_DYNAMIC_URL);
12+
13+
await expect(page.locator("#search-term-unique")).toContainText(
14+
"Sebastian Dennerlein (0000-0001-6011-4382)",
15+
);
16+
17+
await page.getByText("About the map").click();
18+
await expect(page.locator("#info-body")).toContainText(
19+
"This knowledge map presents you with a topical overview of the most recent works of Sebastian Dennerlein (0000-0001-6011-4382).",
20+
);
21+
});
22+
});
23+
24+
test.describe("Using search embedded search box", () => {
25+
test("Loads default Knowledge Map visualisation", async ({ page }) => {
26+
const VISUALISATION_DYNAMIC_URL =
27+
"/embedded_searchbox?service=orcid&embed=true";
28+
29+
await page.goto(VISUALISATION_DYNAMIC_URL);
30+
await page
31+
.getByRole("textbox", { name: "Enter ORCID (e.g. 0000-0002-" })
32+
.click();
33+
await page
34+
.getByRole("textbox", { name: "Enter ORCID (e.g. 0000-0002-" })
35+
.fill("0000-0001-6011-4382");
36+
await page.getByRole("button", { name: "Create Overview" }).click();
37+
38+
await waitForVisualisationCreation(page);
39+
40+
await expect(page.locator("#search-term-unique")).toContainText(
41+
"Sebastian Dennerlein (0000-0001-6011-4382)",
42+
);
43+
44+
await page.getByText("About the map").click();
45+
await expect(page.locator("#info-body")).toContainText(
46+
"This knowledge map presents you with a topical overview of the most recent works of Sebastian Dennerlein (0000-0001-6011-4382).",
47+
);
48+
});
49+
});
50+
});

e2e/basicTests/OpenAIRE.spec.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { test, expect } from "@playwright/test";
2+
import { prepareVisualisation } from "../../vis/js/utils/e2eVisualisationLoader";
3+
4+
test.describe("Basic tests for OpenAIRE integration (Knowledge Map visualisation type)", () => {
5+
test.describe("Using direct dynamic URL / PSVS link", () => {
6+
test("Loads default Knowledge Map visualisation", async ({ page }) => {
7+
const VISUALISATION_DYNAMIC_URL =
8+
"/search?type=get&vis_type=&q=&service=openaire&project_id=710722&funder=EC";
9+
10+
await prepareVisualisation(page, VISUALISATION_DYNAMIC_URL);
11+
12+
await expect(page.locator(".truncated-project-title")).toContainText(
13+
"OpenUP - OPENing UP new methods, indicators",
14+
);
15+
await expect(page.locator("#source")).toContainText(
16+
"Data source: OpenAIRE",
17+
);
18+
await page.getByTestId("context").getByText("More information").click();
19+
await expect(page.locator("#info-body")).toContainText(
20+
"This knowledge map presents you with a topical overview of research conducted in the following project:Project DetailsTitleOPENing UP new methods, indicators and tools for peer review, impact measurement and dissemination of research resultsAcronymOpenUPFunderECFunding programCSAH2020CallH2020-GARRI-2015-1Contract (GA) number710722Start Date2016-06-01End Date2018-11-30Open Access mandatetrueOrganizationsUGOE, UvA, PUBLIC POLICY AND MANAGEMENT INSTITUTE, FRONTIERS MEDIA SA, UoA, DZHW, AIT, Know Center, CNROpenAire LinkLinkWe use text similarity to create a knowledge map. The algorithm groups those resources together that have many words in common. Area titles are created from subject keywords of resources that have been assigned to the same area. We select those keywords and phrases that appear frequently in one area, and seldom in other areas.Knowledge maps provide an instant overview of a topic by showing the main areas at a glance, and resources related to them. This makes it possible to easily identify useful, pertinent information.Please read our FAQs to find out more about knowledge maps.Data sourceThe data is taken from OpenAIRE. OpenAIRE is a key infrastructure that enables the European transition to open science. It provides access to 3 million research projects and more than 70 million research outputs from more than 100,000 data sources.Open source softwareThe visualization is created with the award winning open source software Head Start provided by Open Knowledge Maps. Open Knowledge Maps is a non-profit organisation run by a group of dedicated team members and volunteers. In order to improve our free and open service, we need your support. Please send us your feedback to info@openknowledgemaps.org.If you want to support us financially, you can:Make a donationBecome an organisational memberBecome a funder of our roadmapSign-up for our newsletter to receive occasional updates.",
21+
);
22+
});
23+
});
24+
});

e2e/basicTests/PubMed.spec.ts

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
import { test, expect } from "@playwright/test";
2+
import { prepareVisualisation } from "../../vis/js/utils/e2eVisualisationLoader";
3+
import { waitForVisualisationCreation } from "../../vis/js/utils/e2eWaitForVisualisationCreation";
4+
5+
test.describe("Basic tests for PubMed integration (Knowledge Map visualisation type)", () => {
6+
test.describe("Using direct dynamic URL / PSVS link", () => {
7+
test("Loads default Knowledge Map visualisation", async ({ page }) => {
8+
const VISUALISATION_DYNAMIC_URL =
9+
"/search?type=get&vis_type=overview&q=infection&service=pubmed&sorting=most-relevant";
10+
11+
await prepareVisualisation(page, VISUALISATION_DYNAMIC_URL);
12+
13+
await expect(page.locator("#search-term-unique")).toContainText(
14+
"infection",
15+
);
16+
await expect(page.locator("#source")).toContainText(
17+
"Data source: PubMed",
18+
);
19+
await page.getByTestId("context").getByText("More information").click();
20+
await expect(page.locator("#info-body")).toContainText(
21+
"This knowledge map presents you with a topical overview of research on infection based on the 100 most relevant resources matching your search query.",
22+
);
23+
});
24+
});
25+
26+
test.describe("Using search embedded search box", () => {
27+
test("Loads default Knowledge Map visualisation", async ({ page }) => {
28+
const VISUALISATION_DYNAMIC_URL = "/embedded_searchbox?service=pubmed";
29+
30+
await page.goto(VISUALISATION_DYNAMIC_URL);
31+
await page
32+
.getByRole("textbox", { name: "Enter search query (e.g." })
33+
.click();
34+
await page
35+
.getByRole("textbox", { name: "Enter search query (e.g." })
36+
.fill("infection");
37+
await page.getByRole("button", { name: "Create Overview" }).click();
38+
await waitForVisualisationCreation(page);
39+
40+
await expect(page.locator("#search-term-unique")).toContainText(
41+
"infection",
42+
);
43+
await expect(page.locator("#source")).toContainText(
44+
"Data source: PubMed",
45+
);
46+
await page.getByTestId("context").getByText("More information").click();
47+
await expect(page.locator("#info-body")).toContainText(
48+
"This knowledge map presents you with a topical overview of research on infection based on the 100 most relevant resources matching your search query.",
49+
);
50+
});
51+
});
52+
53+
test.describe("Using old search box", () => {
54+
const MAIN_PAGE = "";
55+
56+
test("Loads default Knowledge Map visualisation using the 'covid-19' try out link", async ({
57+
page,
58+
}) => {
59+
await page.goto(MAIN_PAGE);
60+
61+
await page.getByRole("radio", { name: "PubMed (life sciences)" }).check();
62+
63+
const visualisationPagePromise = page.waitForEvent("popup");
64+
await page.getByRole("link", { name: "covid-" }).click();
65+
const visualisationPage = await visualisationPagePromise;
66+
67+
await waitForVisualisationCreation(visualisationPage);
68+
69+
await expect(
70+
visualisationPage.locator("#search-term-unique"),
71+
).toContainText("covid-19");
72+
await expect(visualisationPage.locator("#source")).toContainText(
73+
"Data source: PubMed",
74+
);
75+
await visualisationPage
76+
.getByTestId("context")
77+
.getByText("More information")
78+
.click();
79+
await expect(visualisationPage.locator("#info-body")).toContainText(
80+
"This knowledge map presents you with a topical overview of research on covid-19 based on the 100 most relevant resources matching your search query.We use text similarity to create a knowledge map. The algorithm groups those resources together that have many words in common. Area titles are created from subject keywords of resources that have been assigned to the same area. We select those keywords and phrases that appear frequently in one area, and seldom in other areas.Knowledge maps provide an instant overview of a topic by showing the main areas at a glance, and resources related to them. This makes it possible to easily identify useful, pertinent information.Please read our FAQs to find out more about knowledge maps.Data sourceThe data is taken from PubMed. PubMed comprises more than 38 million citations for biomedical literature from MEDLINE, life science journals, and online books. For more information please visit the PubMed website.Citations are available for resources with a DOI and based on citation data provided by Crossref. Results may be impacted by accuracy and completeness of this data.Open source softwareThe visualization is created with the award winning open source software Head Start provided by Open Knowledge Maps. Open Knowledge Maps is a non-profit organisation run by a group of dedicated team members and volunteers. In order to improve our free and open service, we need your support. Please send us your feedback to info@openknowledgemaps.org.If you want to support us financially, you can:Make a donationBecome an organisational memberBecome a funder of our roadmapSign-up for our newsletter to receive occasional updates.",
81+
);
82+
});
83+
84+
test('Loads default Knowledge Map visualisation using the "climate change" try out link', async ({
85+
page,
86+
}) => {
87+
await page.goto(MAIN_PAGE);
88+
89+
await page.getByRole("radio", { name: "PubMed (life sciences)" }).check();
90+
91+
const visualisationPagePromise = page.waitForEvent("popup");
92+
await page.getByRole("link", { name: '"climate change"' }).click();
93+
const visualisationPage = await visualisationPagePromise;
94+
95+
await waitForVisualisationCreation(visualisationPage);
96+
97+
await expect(
98+
visualisationPage.locator("#search-term-unique"),
99+
).toContainText('"climate change"');
100+
await expect(visualisationPage.locator("#source")).toContainText(
101+
"Data source: PubMed",
102+
);
103+
await visualisationPage
104+
.getByTestId("context")
105+
.getByText("More information")
106+
.click();
107+
await expect(visualisationPage.locator("#info-body")).toContainText(
108+
'This knowledge map presents you with a topical overview of research on "climate change" based on the 100 most relevant resources matching your search query.',
109+
);
110+
});
111+
});
112+
});

0 commit comments

Comments
 (0)