Published
Edited
Importers
Insert cell
Insert cell
Insert cell
function normalizeScopusData(sd) {
let res = {
pub: { Source: { SourceSerial:{} } },
org: Object.assign({}, sd)
}

res.pub.Source.SourceSerial.Title = res.org.publicationMetadata["prism:publicationName"] ?
res.org.publicationMetadata["prism:publicationName"] : undefined
res.sourceId = res.org.publicationMetadata["source-id"] ?
res.org.publicationMetadata["source-id"].trim() : undefined
res.issn = res.org.publicationMetadata["prism:issn"] ?
res.org.publicationMetadata["prism:issn"].replace(/-/g,"").trim().toLowerCase() : undefined
res.eIssn = res.org.publicationMetadata["prism:eIssn"] ?
res.org.publicationMetadata["prism:eIssn"].replace(/-/g,"").trim().toLowerCase() : undefined
res.pub.Year = res.org.normalizedMetadata.pubyear ?
res.org.normalizedMetadata.pubyear.trim() : undefined
res.pub.Source.Volume = res.org.publicationMetadata["prism:volume"] ?
res.org.publicationMetadata["prism:volume"].trim() : undefined
res.pub.Source.Issue = res.org.publicationMetadata["prism:issueIdentifier"] ?
res.org.publicationMetadata["prism:issueIdentifier"].trim() : undefined
res.pub.Source.ArticleNo = res.org.publicationMetadata["article-number"] ?
res.org.publicationMetadata["article-number"].trim() : undefined

let pageRange = res.org.publicationMetadata["prism:pageRange"]
if (pageRange && pageRange.trim()) {
let pageRangeParts = pageRange.trim().split(/[-–]/g).map(v => v.trim())
if (pageRangeParts.length === 2) {
res.pub.Source.PageStart = pageRangeParts[0]
res.pub.Source.PageEnd = pageRangeParts[1]
} else {
res.pub.Source.PageStart = pageRange
res.pub.Source.PageEnd = pageRange
}
}
return res
}
Insert cell
Insert cell
function normalizeResearchData(rd) {
let res = {
pub: { Source: { SourceSerial: {} } },
org: Object.assign({}, rd)
}

// Scopus identifier - strip away "2-s2.0-"
res.pub.IdentifierScopusId = res.org.IdentifierScopusId.map(id => id.replace("2-s2.0-", ""))

if (res.org.Source && res.org.Source.SourceSerial) {
// Scopus source ID
let researchScopusSourceIds = res.org.Source.SourceSerial.Identifiers
.filter(ssId => ssId.Type.Value === "SCOPUS_SOURCE_ID")
if (researchScopusSourceIds.length > 1) {
throw new Error(`${res.org.Id} got multiple Scopus Source IDs from Research.`)
}
res.scopusSourceId = researchScopusSourceIds.length === 1 ?
researchScopusSourceIds[0].Value.replace(/-/g,"").trim() : undefined
// ISSN
let researchIssns = res.org.Source.SourceSerial.Identifiers
.filter(ssId => ssId.Type.Value === "ISSN")
if (researchIssns.length > 1) {
throw new Error(`${res.org.Id} got multiple ISSN from Research.`)
}
res.issn = researchIssns.length === 1 ?
researchIssns[0].Value.replace(/-/g,"").trim().toLowerCase() : undefined
// eISSN
let researchEissns = res.org.Source.SourceSerial.Identifiers
.filter(ssId => ssId.Type.Value === "EISSN")
if (researchEissns.length > 1) {
throw new Error(`${res.org.Id} got multiple EISSN from Research.`)
}
res.eIssn = researchEissns.length === 1 ?
researchEissns[0].Value.replace(/-/g,"").trim().toLowerCase() : undefined
}

// Other
res.pub.Id = res.org.Id
res.pub.Year = res.org.Year
res.pub.Source.SourceSerial.Title = res.org.Source && res.org.Source.SourceSerial ?
res.org.Source.SourceSerial.Title : undefined
res.pub.Source.Volume = res.org.Source && res.org.Source.Volume ? res.org.Source.Volume.trim() : undefined
res.pub.Source.Issue = res.org.Source && res.org.Source.Issue ? res.org.Source.Issue.trim() : undefined
res.pub.Source.ArticleNo = res.org.Source && res.org.Source.ArticleNo ?
res.org.Source.ArticleNo.trim() : undefined
res.pub.Source.PageStart = res.org.Source && res.org.Source.PageStart ?
res.org.Source.PageStart.trim() : undefined
res.pub.Source.PageEnd = res.org.Source && res.org.Source.PageEnd ? res.org.Source.PageEnd.trim() : undefined

return res
}
Insert cell
Insert cell
function createSourceSerialCompareFilterMethod(r) {
return s => {
// ISSN and eISSN match
let issnAndEissnMatch = !!r.issn && !!r.eIssn &&
((s.issn === r.issn && s.eIssn === r.eIssn) ||
(s.eIssn === r.issn && s.issn === r.eIssn))

// ISSN match and no eISSN in either Research or Scopus
let issnMatchAndNoEissn = !!r.issn &&
((s.issn === r.issn || s.eIssn === r.issn) && (!r.eIssn || !s.eIssn))

// eISSN match and no ISSN in either Research or Scopus
let eIssnMatchAndNoIssn = !!r.eIssn &&
((s.issn === r.eIssn || s.eIssn === r.eIssn) && (!r.issn || !s.issn))

// Scopus Source ID match
let scopusSourceIdMatch = !!r.scopusSourceId && s.sourceId === r.scopusSourceId

return issnAndEissnMatch || issnMatchAndNoEissn || eIssnMatchAndNoIssn || scopusSourceIdMatch
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
function createSourceSerialStrictCompareFilterMethod(r) {
return s => {
// ISSN and eISSN match
let issnAndEissnMatch = !!r.issn && !!r.eIssn &&
((s.issn === r.issn && s.eIssn === r.eIssn) ||
(s.eIssn === r.issn && s.issn === r.eIssn))

// ISSN match and no eISSN in either Research or Scopus
let issnMatchAndNoEissn = !!r.issn &&
((s.issn === r.issn || s.eIssn === r.issn) && (!r.eIssn || !s.eIssn))

// eISSN match and no ISSN in either Research or Scopus
let eIssnMatchAndNoIssn = !!r.eIssn &&
((s.issn === r.eIssn || s.eIssn === r.eIssn) && (!r.issn || !s.issn))

// Scopus Source ID match
let scopusSourceIdMatch = !!r.scopusSourceId && s.sourceId === r.scopusSourceId

return (issnAndEissnMatch || issnMatchAndNoEissn || eIssnMatchAndNoIssn) && scopusSourceIdMatch
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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