pid-parser-service/parsers/Handle.js

33 lines
804 B
JavaScript

const Entity = require("../model/Entity");
class Handle {
parse(pid, item) {
let entity = new Entity(pid);
entity.result.source = "handle";
entity.DOI = pid;
entity.id = item.id;
entity.title = item.title;
entity.result.url = item.doi_url;
entity.type = 'publication';
entity.result.date = item.metadata.publication_date.split("-")[0];
entity.result.accessRights = "OPEN";
entity.result.journal = null;
entity.result.description = item.metadata.description;
if (item.metadata.creators) {
entity.result.authors = [];
for (let j = 0; j < item.metadata.creators.length; j++) {
let author = item.metadata.creators[j].name;
entity.result.authors.push(author);
}
}
return entity;
}
}
module.exports = Zenodo;