Published
Edited
Sep 19, 2022
10 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
doiResponse = fetch(`https://doi.org/${doi}`, {
checkContentType: true,
method: 'GET',
headers: { Accept: 'application/vnd.citationstyles.csl+json' } // request in CSL-JSON format
}).then(res => {
if (res.status === 200) {
return res.json();
} else {
return { status: res.status, message: 'DOI service responded with non-OK status code.' };
}
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
doiResponse.title // note: sometimes you may want to combine with subtitle!
Insert cell
Insert cell
doiResponse['container-title']
Insert cell
Insert cell
doiResponse.published?.['date-parts'][0]
Insert cell
Insert cell
doiResponse.author
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function semanticScholarURL(id, params = {}, method = 'paper') {
const API_URL = 'https://api.semanticscholar.org/graph/v1/';

// Convert object of query parameters to a query string
const queryString = Object.entries(params)
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
.join('&');

// Combine API URL, method, and query string
return `${API_URL}${method}/${id}?${queryString}`;
}
Insert cell
params = ({
fields: ['externalIds', 'title', 'year', 'authors', 'venue', 'abstract', 'tldr', 'embedding']
})
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
ssResponse = fetch(semanticScholarURL(doi, params))
.then(res => res.json());
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
ssCitations = fetch(
semanticScholarURL(
`${doi}/citations`,
{ fields: ['title', 'year', 'authors', 'venue', 'citationCount'] }
)
).then(res => res.json());
Insert cell
Insert cell
Inputs.table(
ssCitations.data?.map(({ citingPaper: p }) => {
return {
title: p.title,
authors: p.authors.map(a => a.name).join(', '),
venue: p.venue,
citations: p.citationCount
};
})
)
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more