From ca01a78a634b4b5d08f0cdaed9074ae4c7f50343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anne=20L=27H=C3=B4te?= Date: Mon, 20 Nov 2023 18:41:23 +0100 Subject: [PATCH] fix(api): Restore datasets extraction --- server/src/routes/works.routes.js | 7 +++---- server/src/utils.js | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/server/src/routes/works.routes.js b/server/src/routes/works.routes.js index 2b2c8819..b842fc37 100644 --- a/server/src/routes/works.routes.js +++ b/server/src/routes/works.routes.js @@ -17,15 +17,14 @@ router.route('/works') res.status(400).json({ message: 'You must provide at least one affiliation.' }); } else { const results = await Promise.all([ - getBsoWorks({ options, index: process.env.VITE_BSO_PUBLICATIONS_INDEX }), + getBsoWorks({ options, index: process.env.VITE_BSO_PUBLICATIONS_INDEX, filter: 'q=-genre_raw:dataset' }), getOpenAlexPublications(options), getBsoWorks({ options, index: process.env.VITE_BSO_DATASETS_INDEX, filter: 'q=genre:dataset' }), - // getBsoWorks({ options, index: process.env.VITE_BSO_PUBLICATIONS_INDEX, filter: 'q=genre_raw:dataset' }), + getBsoWorks({ options, index: process.env.VITE_BSO_PUBLICATIONS_INDEX, filter: 'q=genre_raw:dataset' }), ]); const data = {}; data.publications = [...results[0].results, ...results[1].results]; - // data.datasets = [...results[2].results, ...results[3].results]; - data.datasets = [...results[2].results]; + data.datasets = [...results[2].results, ...results[3].results]; // Deduplicate publications by DOI or by hal_id const deduplicatedPublications = {}; data.publications.forEach((publication) => { diff --git a/server/src/utils.js b/server/src/utils.js index 3b1a39ad..f9bcbc51 100644 --- a/server/src/utils.js +++ b/server/src/utils.js @@ -218,7 +218,7 @@ const getOpenAlexPublications = (options, page = '1', previousResponse = []) => status: 'tobedecided', title: result?.display_name ?? result.title, type: getTypeFromOpenAlex(result.type), - year: Number(result?.publication_year) ?? Number(result.year), + year: result?.publication_year ?? result.year, })), })); };