Skip to content

Commit

Permalink
fix(api): Restore datasets extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
annelhote committed Nov 20, 2023
1 parent 1e9d5c9 commit ca01a78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions server/src/routes/works.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion server/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})),
}));
};
Expand Down

0 comments on commit ca01a78

Please sign in to comment.