[new-search-json | WIP | CHANGED]: Updated parsing according to new json schema.
1. open-aire-jsonld-converter.service.ts: On method "getLicense()", added statically schema: "dnet:access_modes" for bestaccessright. 2. searchResearchResults.service.ts: [BUG] Removed "/" after search service url (duplicate /) | Updated parsing of "measures" field | Updated parsing of "pid" field | Added parsing of orcid_pending. 3. searchProjects.service.ts: Updated parsing of "measures" field. 4. searchOrganizations.service.ts: Updated parsing of project links (relations). 5. searchDataproviders.service.ts: Updated parsing of "measures" field. 6. resultLanding.service.ts: Added parsing of orcid_pending | Added parsing of "externalreference" field and updated method "parseBioentitiesAndSoftware()" | Updated parsing of "measures" field | Added parsing of resultService links (relation). 7. project.service.ts: Updated parsing of "measures" field. 8. dataProvider.service.ts: Updated parsing of "measures" field | Updated parsing of "contentpolicies" field. 9. parsingFunctions.class.ts: Use identifierTypes array with ids/codes | Updated parsing of "accessRight" field | Updated parsing in method "parseDatasources()" | Updated parsing of "pid" field in method "parseIdentifiers()" | Updated parsing of "measures" field in method "parseMeasures()".
This commit is contained in:
parent
945a8b1c90
commit
6b0c581920
|
@ -200,7 +200,7 @@ export class DataProviderService {
|
|||
|
||||
// TODO: Add check for array
|
||||
if(datasource.contentpolicies) {
|
||||
this.dataProviderInfo.contentpolicy = datasource.contentpolicies.label;
|
||||
this.dataProviderInfo.contentpolicy = datasource.contentpolicies[0].label;
|
||||
}
|
||||
|
||||
if(datasource['datasourcetype']) {
|
||||
|
@ -352,10 +352,9 @@ export class DataProviderService {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Missing from json
|
||||
// if (data[0]?.measure) {
|
||||
// this.dataProviderInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
|
||||
// }
|
||||
if (data?.measure) {
|
||||
this.dataProviderInfo.measure = this.parsingFunctions.parseMeasures(data.measure);
|
||||
}
|
||||
|
||||
return this.dataProviderInfo;
|
||||
}
|
||||
|
|
|
@ -28,10 +28,10 @@ export class ParsingFunctions {
|
|||
public open = 'open_access';
|
||||
public closed = 'closed_access';
|
||||
public unknown = 'unknown_access';
|
||||
// public identifierTypes = ["doi", "pmc" , "handle", "pmid", "re3data", "swhid", "ROR", "ISNI", "Wikidata", "FundRef"];
|
||||
public identifierTypes = ["doi", "pmc" , "handle", "pmid", "re3data", "swhid", "ROR", "ISNI", "Wikidata", "FundRef"];
|
||||
//TODO what are the names of Identifiers types e.g doi = Digital Object Identifier
|
||||
public identifierTypes = ["Digital Object Identifier", "pmc", "Handle", "PubMed ID", "re3data", "swhid",
|
||||
"ROR", "International Standard Name Identifier", "Wikidata", "FundRef"];
|
||||
// public identifierTypes = ["Digital Object Identifier", "pmc", "Handle", "PubMed ID", "re3data", "swhid",
|
||||
// "ROR", "International Standard Name Identifier", "Wikidata", "FundRef"];
|
||||
private instanceWithDoiExists: boolean = false;
|
||||
|
||||
constructor() {
|
||||
|
@ -252,7 +252,7 @@ export class ParsingFunctions {
|
|||
if (url) {
|
||||
mapStructure.get(key)['accessMode'].push(instance['accessright'].label);
|
||||
}
|
||||
|
||||
|
||||
if (this.changeBestAccessMode(mapStructure.get(key)['bestAccessMode'], instance['accessright'])) {
|
||||
mapStructure.get(key)['bestAccessMode'] = instance['accessright'].label;
|
||||
}
|
||||
|
@ -339,11 +339,10 @@ export class ParsingFunctions {
|
|||
for (let i = 0; i < length; i++) {
|
||||
let accessRight = Array.isArray(instance['accessright']) ? instance['accessright'][i] : instance['accessright'];
|
||||
|
||||
//TODO: should be accessRight.label in the new version
|
||||
if (this.changeBestAccessMode(available.accessRight, accessRight)) {
|
||||
available.accessRight = accessRight.value;
|
||||
available.accessRight = accessRight.label;
|
||||
if (this.changeBestAccessMode(globalAccessRight, accessRight)) {
|
||||
globalAccessRight = accessRight.value;
|
||||
globalAccessRight = accessRight.label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -549,7 +548,7 @@ export class ParsingFunctions {
|
|||
openaireCompatibility: ""
|
||||
};
|
||||
|
||||
datasource['id'] = relation['to'].content;
|
||||
datasource['id'] = relation['header'].relatedIdentifier;
|
||||
if(relation["officialname"])
|
||||
datasource.name = relation.officialname;
|
||||
else {
|
||||
|
@ -557,10 +556,10 @@ export class ParsingFunctions {
|
|||
}
|
||||
|
||||
let percentageName: string;
|
||||
if (relation.trust) {
|
||||
if (relation['header'].trust) {
|
||||
percentageName = "trust";
|
||||
} else if (relation.similarity) {
|
||||
percentageName = "similarity";
|
||||
// } else if (relation.similarity) {
|
||||
// percentageName = "similarity";
|
||||
}
|
||||
if (percentageName) {
|
||||
datasource['percentage'] = Math.round(relation[percentageName] * 100);
|
||||
|
@ -568,13 +567,13 @@ export class ParsingFunctions {
|
|||
}
|
||||
|
||||
// type
|
||||
if(relation.hasOwnProperty('datasourcetype') && relation['datasourcetype'].hasOwnProperty("classname")) {
|
||||
datasource.class = relation['datasourcetype'].classname;
|
||||
if(relation['datasourcetype'] && relation['datasourcetype']["code"]) {
|
||||
datasource.class = relation['datasourcetype'].code;
|
||||
}
|
||||
|
||||
// compatibility
|
||||
if(relation.hasOwnProperty("openairecompatibility")) {
|
||||
datasource.openaireCompatibility = relation['openairecompatibility'].classname;
|
||||
if(relation["openairecompatibility"]) {
|
||||
datasource.openaireCompatibility = relation['openairecompatibility'].label;
|
||||
}
|
||||
|
||||
if(datasource.class !== "service" || properties.adminToolsPortalType == "eosc") {
|
||||
|
@ -599,20 +598,20 @@ export class ParsingFunctions {
|
|||
parseIdentifiers(pid: any): Map<string, string[]> {
|
||||
let identifiers = new Map<string, string[]>();
|
||||
|
||||
if (pid.hasOwnProperty("type") && pid['type'] != "") {
|
||||
if (this.identifierTypes.indexOf(pid.type) !=-1) {
|
||||
if (!identifiers.has(pid.type)) {
|
||||
identifiers.set(pid.type, new Array<string>());
|
||||
if (pid.hasOwnProperty("typeCode") && pid['typeCode'] != "") {
|
||||
if (this.identifierTypes.indexOf(pid.typeCode) !=-1) {
|
||||
if (!identifiers.has(pid.typeCode)) {
|
||||
identifiers.set(pid.typeCode, new Array<string>());
|
||||
}
|
||||
identifiers.get(pid.type).push(pid.value + "");
|
||||
identifiers.get(pid.typeCode).push(pid.value + "");
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < pid.length; i++) {
|
||||
if (this.identifierTypes.indexOf(pid[i].type) !=-1) {
|
||||
if (!identifiers.has(pid[i].type)) {
|
||||
identifiers.set(pid[i].type, new Array<string>());
|
||||
if (this.identifierTypes.indexOf(pid[i].typeCode) !=-1) {
|
||||
if (!identifiers.has(pid[i].typeCode)) {
|
||||
identifiers.set(pid[i].typeCode, new Array<string>());
|
||||
}
|
||||
identifiers.get(pid[i].type).push(pid[i].value + "");
|
||||
identifiers.get(pid[i].typeCode).push(pid[i].value + "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -695,7 +694,6 @@ export class ParsingFunctions {
|
|||
// setOfEoscSubjects = checkAndAddEoscSubjectResp["setOfEoscSubject"];
|
||||
// eoscSubjectsFound = checkAndAddEoscSubjectResp["eoscSubjectsFound"];
|
||||
// } else {
|
||||
// TODO: typeLabel now is just type
|
||||
if (!classifiedSubjects.has(subject.typeLabel)) {
|
||||
classifiedSubjects.set(subject.typeLabel, new Array<string>());
|
||||
}
|
||||
|
@ -976,82 +974,70 @@ export class ParsingFunctions {
|
|||
let downloads: number = 0;
|
||||
elements.forEach(element => {
|
||||
if (element.id == 'views') {
|
||||
views += element.count;
|
||||
let datasourceId = element.datasource;
|
||||
let viewsNum = parseInt(element.unit.label);
|
||||
views += viewsNum;
|
||||
let datasourceId = element.unit.code;
|
||||
if(datasourceId) {
|
||||
if(datasourcePosition.has(element.datasource)) {
|
||||
countsPerDatasource[datasourcePosition.get(element.datasource)].views = element.count;
|
||||
if(datasourcePosition.has(datasourceId)) {
|
||||
countsPerDatasource[datasourcePosition.get(datasourceId)].views = viewsNum;
|
||||
} else {
|
||||
datasourcePosition.set(element.datasource, countsPerDatasource.length);
|
||||
countsPerDatasource.push({"datasourceId": element.datasource.split("||")[0], "datasourceName": element.datasource.split("||")[1], "views": element.count, "downloads": 0})
|
||||
datasourcePosition.set(datasourceId, countsPerDatasource.length);
|
||||
countsPerDatasource.push({"datasourceId": datasourceId.split("||")[0], "datasourceName": datasourceId.split("||")[1], "views": viewsNum, "downloads": 0})
|
||||
}
|
||||
}
|
||||
// measure.views = element.count;
|
||||
}
|
||||
if (element.id == 'downloads') {
|
||||
downloads += element.count;
|
||||
let datasourceId = element.datasource;
|
||||
let downloadsNum = parseInt(element.unit.label);
|
||||
downloads += downloadsNum;
|
||||
let datasourceId = element.unit.code;
|
||||
if(datasourceId) {
|
||||
if(datasourcePosition.has(element.datasource)) {
|
||||
countsPerDatasource[datasourcePosition.get(element.datasource)].downloads = element.count;
|
||||
if(datasourcePosition.has(datasourceId)) {
|
||||
countsPerDatasource[datasourcePosition.get(datasourceId)].downloads = downloadsNum;
|
||||
} else {
|
||||
datasourcePosition.set(element.datasource, countsPerDatasource.length);
|
||||
countsPerDatasource.push({"datasourceId": element.datasource.split("||")[0], "datasourceName": element.datasource.split("||")[1], "views": 0, "downloads": element.count})
|
||||
datasourcePosition.set(datasourceId, countsPerDatasource.length);
|
||||
countsPerDatasource.push({"datasourceId": datasourceId.split("||")[0], "datasourceName": datasourceId.split("||")[1], "views": 0, "downloads": downloadsNum})
|
||||
}
|
||||
}
|
||||
// measure.downloads = element.count;
|
||||
}
|
||||
if (element.id == 'influence_alt' || element.id == 'citation_count') {
|
||||
bip.push({name: 'citations', icon: 'cite', value: element.score, order: 2});
|
||||
// measure.citations = element.score;
|
||||
}
|
||||
if (element.id == 'popularity') {
|
||||
let metric: Metric = {name: 'popularity', icon: 'fire', value: null, order: 3};
|
||||
if (element.class == 'C1') {
|
||||
metric.value = 'Top 0.01%';
|
||||
} else if (element.class == 'C2') {
|
||||
metric.value = 'Top 0.1%';
|
||||
} else if (element.class == 'C3') {
|
||||
metric.value = 'Top 1%';
|
||||
} else if (element.class == 'C4') {
|
||||
metric.value = 'Top 10%';
|
||||
} else {
|
||||
metric.value = 'Average';
|
||||
for(let unit of element.unit) {
|
||||
if(unit.code == "score") {
|
||||
bip.push({name: 'citations', icon: 'cite', value: parseInt(element.unit.label), order: 2});
|
||||
}
|
||||
}
|
||||
// measure.popularity = metric.value;
|
||||
bip.push(metric);
|
||||
}
|
||||
if (element.id == 'influence') {
|
||||
let metric: Metric = {name: 'influence', icon: 'landmark', value: null, order: 4};
|
||||
if (element.class == 'C1') {
|
||||
metric.value = 'Top 0.01%';
|
||||
} else if (element.class == 'C2') {
|
||||
metric.value = 'Top 0.1%';
|
||||
} else if (element.class == 'C3') {
|
||||
metric.value = 'Top 1%';
|
||||
} else if (element.class == 'C4') {
|
||||
metric.value = 'Top 10%';
|
||||
} else {
|
||||
metric.value = 'Average';
|
||||
if (element.id == 'popularity' || element.id == 'influence' || element.id == 'impulse') {
|
||||
let value = "";
|
||||
for(let unit of element.unit) {
|
||||
if (unit.code == "class") {
|
||||
if (unit.label == 'C1') {
|
||||
value = 'Top 0.01%';
|
||||
} else if (unit.label == 'C2') {
|
||||
value = 'Top 0.1%';
|
||||
} else if (unit.label == 'C3') {
|
||||
value = 'Top 1%';
|
||||
} else if (unit.label == 'C4') {
|
||||
value = 'Top 10%';
|
||||
} else {
|
||||
value = 'Average';
|
||||
}
|
||||
}
|
||||
}
|
||||
// measure.influence = metric.value;
|
||||
bip.push(metric);
|
||||
}
|
||||
if (element.id == 'impulse') {
|
||||
let metric: Metric = {name: 'impulse', icon: 'rocket', value: null, order: 5};
|
||||
if (element.class == 'C1') {
|
||||
metric.value = 'Top 0.01%';
|
||||
} else if (element.class == 'C2') {
|
||||
metric.value = 'Top 0.1%';
|
||||
} else if (element.class == 'C3') {
|
||||
metric.value = 'Top 1%';
|
||||
} else if (element.class == 'C4') {
|
||||
metric.value = 'Top 10%';
|
||||
} else {
|
||||
metric.value = 'Average';
|
||||
|
||||
if (element.id == 'popularity') {
|
||||
let metric: Metric = {name: 'popularity', icon: 'fire', value: value, order: 3};
|
||||
bip.push(metric);
|
||||
}
|
||||
if (element.id == 'influence') {
|
||||
let metric: Metric = {name: 'influence', icon: 'landmark', value: value, order: 4};
|
||||
bip.push(metric);
|
||||
}
|
||||
if (element.id == 'impulse') {
|
||||
let metric: Metric = {name: 'impulse', icon: 'rocket', value: value, order: 5};
|
||||
bip.push(metric);
|
||||
}
|
||||
// measure.impulse = metric.value;
|
||||
bip.push(metric);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -207,10 +207,9 @@ export class ProjectService {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Missing from json
|
||||
// if (data[0]?.measure) {
|
||||
// this.projectInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
|
||||
// }
|
||||
if (data.measures) {
|
||||
this.projectInfo.measure = this.parsingFunctions.parseMeasures(data.measures);
|
||||
}
|
||||
|
||||
return this.projectInfo;
|
||||
|
||||
|
|
|
@ -157,7 +157,7 @@ export class ResultLandingService {
|
|||
if (result.publiclyFunded) {
|
||||
this.resultLandingInfo.publiclyFunded = result.publiclyFunded;
|
||||
}
|
||||
//TODO check duplicates - are we going to keep one?
|
||||
|
||||
if (result["isGreen"] || result["openAccessColor"] || result["isInDiamondJournal"]) {
|
||||
this.resultLandingInfo.oaRoutes = {
|
||||
"green": result.isGreen,
|
||||
|
@ -311,20 +311,16 @@ export class ResultLandingService {
|
|||
let author = Array.isArray(authors) ? authors[i] : authors;
|
||||
if (author) {
|
||||
parsedAuthor.fullName = author.fullname;
|
||||
// TODO: pid.type has "Open Researcher and Contributor ID" value now
|
||||
let pids = author.pid?author.pid:[];
|
||||
for(let pid of pids) {
|
||||
if (pid.type == 'orcid') {
|
||||
if (pid.typeCode == 'orcid') {
|
||||
parsedAuthor.orcid = pid.value.toUpperCase();
|
||||
break;
|
||||
} else if (pid.typeCode == "orcid_pending") {
|
||||
parsedAuthor.orcid_pending = pid.value.toUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: missing from json
|
||||
// if (author.pid && author.pid.type == "orcid_pending") {
|
||||
// author.orcid_pending = author.orcid_pending.toUpperCase();
|
||||
// }
|
||||
|
||||
if (this.resultLandingInfo['authors'][author.rank] && this.resultLandingInfo['authors'][author.rank].fullName == author.fullname) {
|
||||
if (!parsedAuthor.orcid && this.resultLandingInfo['authors'][author.rank].orcid) {
|
||||
parsedAuthor.orcid = this.resultLandingInfo['authors'][author.rank].orcid;
|
||||
|
@ -345,11 +341,11 @@ export class ResultLandingService {
|
|||
});
|
||||
}
|
||||
|
||||
// TODO: Missing from response?
|
||||
// if (data[3].hasOwnProperty("externalreference")) {
|
||||
// let externalResults: Map<string, Map<string, string>> = this.parseBioentitiesAndSoftware(data[3]);
|
||||
// this.resultLandingInfo.bioentities = externalResults;
|
||||
// }
|
||||
// TODO: example?
|
||||
if (result["externalreference"]) {
|
||||
let externalResults: Map<string, Map<string, string>> = this.parseBioentitiesAndSoftware(result["externalreference"]);
|
||||
this.resultLandingInfo.bioentities = externalResults;
|
||||
}
|
||||
}
|
||||
|
||||
if(data["pid"]) {
|
||||
|
@ -375,30 +371,23 @@ export class ResultLandingService {
|
|||
}
|
||||
|
||||
let provenanceAction: string = relation.provenanceaction;
|
||||
// TODO NOW!!! do not add merges here!
|
||||
this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction, relationName);
|
||||
} else if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "hasauthorinstitution") {
|
||||
this.resultLandingInfo.organizations = this.parseRelatedOrganizations(this.resultLandingInfo.organizations, relation);
|
||||
}
|
||||
// TODO: No examples - mapping xml to json for datasourcetype?
|
||||
// else if (relation['header'].relationType == "dnet:result_datasource_relations" &&
|
||||
// (relation['datasourcetype']?.classname !== "service" || properties.adminToolsPortalType == "eosc")) {
|
||||
// let relationName: string = relation.header.relationClass;
|
||||
// if (!this.resultLandingInfo.relatedServicesClassFilters.has(relationName)) {
|
||||
// this.resultLandingInfo.relatedServicesClassFilters.add(relationName);
|
||||
// }
|
||||
//
|
||||
// let provenanceAction: string = relation.header.relationProvenance;
|
||||
//
|
||||
// // this.resultLandingInfo.relatedResults = this.parsingFunctions.parseResults(this.resultLandingInfo.relatedResults, relation, provenanceAction, relationName);
|
||||
// if (this.resultLandingInfo.relatedServices == undefined) {
|
||||
// this.resultLandingInfo.relatedServices = [];
|
||||
// }
|
||||
//check
|
||||
// this.resultLandingInfo.relatedServices = this.parsingFunctions.parseDatasources(this.resultLandingInfo.relatedServices, relation, provenanceAction, relationName);
|
||||
// }
|
||||
} else if (relation['header'].relationType == "resultService" &&
|
||||
(relation['datasourcetype']?.code !== "service" || properties.adminToolsPortalType == "eosc")) {
|
||||
let relationName: string = relation.header.relationClass;
|
||||
if (!this.resultLandingInfo.relatedServicesClassFilters.has(relationName)) {
|
||||
this.resultLandingInfo.relatedServicesClassFilters.add(relationName);
|
||||
}
|
||||
|
||||
else if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "merges" && relation['header'].relationType == "resultResult") {
|
||||
let provenanceAction: string = relation.header.relationProvenance;
|
||||
|
||||
if (this.resultLandingInfo.relatedServices == undefined) {
|
||||
this.resultLandingInfo.relatedServices = [];
|
||||
}
|
||||
this.resultLandingInfo.relatedServices = this.parsingFunctions.parseDatasources(this.resultLandingInfo.relatedServices, relation, provenanceAction, relationName);
|
||||
} else if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "merges" && relation['header'].relationType == "resultResult") {
|
||||
if(!this.resultLandingInfo.deletedByInferenceIds) {
|
||||
this.resultLandingInfo.deletedByInferenceIds = [];
|
||||
}
|
||||
|
@ -417,6 +406,10 @@ export class ResultLandingService {
|
|||
this.resultLandingInfo.contexts = this.parsingFunctions.parseContexts(data['context']);
|
||||
}
|
||||
|
||||
if (data.measures) {
|
||||
this.resultLandingInfo.measure = this.parsingFunctions.parseMeasures(data.measures);
|
||||
}
|
||||
|
||||
this.resultLandingInfo.hostedBy_collectedFrom = this.parsingFunctions.addPublisherToHostedBy_collectedFrom(
|
||||
this.resultLandingInfo.hostedBy_collectedFrom, this.resultLandingInfo.publisher,
|
||||
this.resultLandingInfo.journal?.journal, this.resultLandingInfo.identifiers);
|
||||
|
@ -434,11 +427,6 @@ export class ResultLandingService {
|
|||
// } else {
|
||||
// this.resultLandingInfo.underCurationMessage = false;
|
||||
// }
|
||||
//
|
||||
// // res['result']['metadata']['oaf:entity']['oaf:result']['measure']
|
||||
// if (data[0]?.measure) {
|
||||
// this.resultLandingInfo.measure = this.parsingFunctions.parseMeasures(data[0].measure);
|
||||
// }
|
||||
|
||||
return this.resultLandingInfo;
|
||||
}
|
||||
|
@ -476,14 +464,14 @@ export class ResultLandingService {
|
|||
parseBioentitiesAndSoftware(children: any): Map<string, Map<string, string>> {
|
||||
let bioentities: Map<string, Map<string, string>>;
|
||||
|
||||
let length = Array.isArray(children['externalreference']) ? children['externalreference'].length : 1;
|
||||
let length = Array.isArray(children) ? children.length : 1;
|
||||
|
||||
let externalreference;
|
||||
for (let i = 0; i < length; i++) {
|
||||
externalreference = Array.isArray(children['externalreference']) ? children['externalreference'][i] : children['externalreference'];
|
||||
externalreference = Array.isArray(children) ? children[i] : children;
|
||||
|
||||
if (externalreference.hasOwnProperty("qualifier")) {
|
||||
if (externalreference['qualifier'].classid == "accessionNumber") {
|
||||
if (externalreference["qualifier"]) {
|
||||
if (externalreference['qualifier'].code == "accessionNumber") {
|
||||
|
||||
if (bioentities == undefined) {
|
||||
bioentities = new Map<string, Map<string, string>>();
|
||||
|
|
|
@ -95,6 +95,7 @@ export class OrganizationService {
|
|||
for(let i=0; i<relLength; i++) {
|
||||
let relation = Array.isArray(links) ? links[i] : links;
|
||||
if (relation["header"]) {
|
||||
// TODO: Check if merges or isMergedIn
|
||||
if (relation['header'].relationClass && relation['header'].relationClass.toLowerCase() == "merges" && relation['header'].relatedRecordType == "organization") {
|
||||
if(!this.organizationInfo.deletedByInferenceIds) {
|
||||
this.organizationInfo.deletedByInferenceIds = [];
|
||||
|
|
|
@ -132,7 +132,6 @@ export class SearchDataprovidersService {
|
|||
|
||||
result['type'] = this.getDataproviderType(resData);
|
||||
if (resData['eosctype']) {
|
||||
// TODO: Check if field is available, .label is correct?
|
||||
result.entityType = resData['eosctype'].label == "Service" ? "service" : "dataprovider";
|
||||
}
|
||||
|
||||
|
@ -170,9 +169,8 @@ export class SearchDataprovidersService {
|
|||
|
||||
result['subjects'] = this.getDataproviderSubjects(resData);
|
||||
|
||||
// TODO: example?
|
||||
// Measure
|
||||
//result.measure = this.parsingFunctions.parseMeasures(resData['measure']);
|
||||
result.measure = this.parsingFunctions.parseMeasures(resData['measures']);
|
||||
}
|
||||
|
||||
if(resBody["links"]) {
|
||||
|
@ -181,7 +179,6 @@ export class SearchDataprovidersService {
|
|||
result['countries'] = res[0];
|
||||
}
|
||||
|
||||
// TODO: now pid.type & pid.value, but Claudio said that pid.type would be replaced by pid.typeCode and pid.typeLabel
|
||||
if(resBody['pid']) {
|
||||
result.identifiers = this.parsingFunctions.parseIdentifiers(resBody['pid']);
|
||||
}
|
||||
|
|
|
@ -155,11 +155,12 @@ export class SearchOrganizationsService {
|
|||
"code": ""
|
||||
}
|
||||
|
||||
if(relation.title != 'unidentified') {
|
||||
// TODO: Missing projectTitle and sometimes no acronym either.
|
||||
if(relation.projectTitle != 'unidentified') {
|
||||
result['projects'][countProjects]['id'] =
|
||||
/*OpenaireProperties.getsearchLinkToProject() + */relation['header'].relatedIdentifier;
|
||||
result['projects'][countProjects]['acronym'] = relation.acronym;
|
||||
result['projects'][countProjects]['title'] = relation.title; // TODO: Could not find any examples with this field
|
||||
result['projects'][countProjects]['title'] = relation.projectTitle;
|
||||
result['projects'][countProjects]['code'] = relation.code;
|
||||
} else {
|
||||
result['projects'][countProjects]['id'] = "";
|
||||
|
@ -185,7 +186,6 @@ export class SearchOrganizationsService {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: now pid.type & pid.value, but Claudio said that pid.type would be replaced by pid.typeCode and pid.typeLabel
|
||||
if(result['pid']) {
|
||||
result.identifiers = this.parsingFunctions.parseIdentifiers(result['pid']);
|
||||
}
|
||||
|
|
|
@ -221,7 +221,7 @@ export class SearchProjectsService {
|
|||
result.endYear = resData.enddate.split('-')[0];
|
||||
}
|
||||
// Measure
|
||||
result.measure = this.parsingFunctions.parseMeasures(resData['measure']);
|
||||
result.measure = this.parsingFunctions.parseMeasures(resData['measures']);
|
||||
}
|
||||
|
||||
if (resBody["links"]) {
|
||||
|
|
|
@ -149,7 +149,7 @@ export class SearchResearchResultsService {
|
|||
|
||||
//let url = link+"/resources2?format=json&query="+params+" sortBy resultdateofacceptance/sort.descending&type="+this.getEntityQueryName(resultType,true);
|
||||
|
||||
let url = link + "/" + this.getEntityQueryName(resultType, true);
|
||||
let url = link + this.getEntityQueryName(resultType, true);
|
||||
url += "?format=json";
|
||||
url += "&fq=" + params;
|
||||
url += "&sortBy=resultdateofacceptance,descending";
|
||||
|
@ -227,22 +227,19 @@ export class SearchResearchResultsService {
|
|||
}
|
||||
}
|
||||
result.hostedBy_collectedFrom.sort(this.parsingFunctions.compareHostedByCollectedFrom);
|
||||
//TODO measures when available
|
||||
// Measure
|
||||
result.measure = this.parsingFunctions.parseMeasures(resData['measure']);
|
||||
result.measure = this.parsingFunctions.parseMeasures(resData['measures']);
|
||||
/////////////////////////// Athena Code ///////////////////////////
|
||||
if (resData['pid']) {
|
||||
if (!Array.isArray(resData['pid'])) {
|
||||
//TODO change to "doi"
|
||||
if (resData['pid'].type && resData['pid'].type == 'Digital Object Identifier') {
|
||||
if (resData['pid'].typeCode && resData['pid'].typeCode == 'doi') {
|
||||
if (resData['pid'].value != '' && resData['pid'].value != null) {
|
||||
result.DOIs.push((resData['pid'].value + "").replace("https://doi.org/", ""));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (let i = 0; i < resData['pid'].length; i++) {
|
||||
//TODO change to "doi"
|
||||
if (resData['pid'][i].type == 'Digital Object Identifier') {
|
||||
if (resData['pid'][i].typeCode == 'doi') {
|
||||
if (resData['pid'][i].value != '' && resData['pid'][i].value != null && resData['pid'][i].value) {
|
||||
result.DOIs.push((resData['pid'][i].value + "").replace("https://doi.org/", ""));
|
||||
}
|
||||
|
@ -334,23 +331,19 @@ export class SearchResearchResultsService {
|
|||
if (author) {
|
||||
let pids = author.pid?author.pid:[];
|
||||
for(let pid of pids) {
|
||||
if (pid.type == 'orcid') {
|
||||
if (pid.typeCode == 'orcid') {
|
||||
author.orcid = pid.value.toUpperCase();
|
||||
break;
|
||||
} else if (pid.typeCode == "orcid_pending") {
|
||||
author.orcid_pending = pid.value.toUpperCase();
|
||||
}
|
||||
}
|
||||
//TODO as soon as it is included
|
||||
/* if (author.orcid_pending) {
|
||||
author.orcid_pending = author.orcid_pending.toUpperCase();
|
||||
}*/
|
||||
/* The same author with the same rank if it */
|
||||
if (result['authors'][author.rank] && result['authors'][author.rank].fullName == author.fullName) {
|
||||
if (!author.orcid && result['authors'][author.rank].orcid) {
|
||||
author.orcid = result['authors'][author.rank].orcid;
|
||||
|
||||
//TODO as soon as it is included
|
||||
// } else if (!author.orcid_pending && result['authors'][author.rank].orcid_pending) {
|
||||
// author.orcid_pending = result['authors'][author.rank].orcid_pending;
|
||||
} else if (!author.orcid_pending && result['authors'][author.rank].orcid_pending) {
|
||||
author.orcid_pending = result['authors'][author.rank].orcid_pending;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -358,7 +351,7 @@ export class SearchResearchResultsService {
|
|||
result['authors'][author.rank] = {
|
||||
"fullName": author.fullname,
|
||||
"orcid": author.orcid? author.orcid: "",
|
||||
"orcid_pending": ""/* TODO as soon as it is included author.orcid_pending*/
|
||||
"orcid_pending": author.orcid_pending ? author.orcid_pending : ""
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -428,7 +421,6 @@ export class SearchResearchResultsService {
|
|||
if (resData['result'].publiclyFunded) {
|
||||
result.publiclyFunded = resData['result'].publiclyFunded;
|
||||
}
|
||||
//TODO check duplicates - are we going to keep one?
|
||||
if (resData['result'].isGreen
|
||||
|| resData['result'].openAccessColor
|
||||
|| resData['result'].isInDiamondJournal) {
|
||||
|
@ -614,7 +606,7 @@ export class SearchResearchResultsService {
|
|||
.pipe(map(res => res['meta']['total']));
|
||||
}
|
||||
fetchByDOIs(DOIs:string[],query:string): any {
|
||||
let url = properties.searchAPIURLLAst + "/researchProducts/byDoi?type=publications" + (query?query:"");
|
||||
let url = properties.searchAPIURLLAst + "researchProducts/byDoi?type=publications" + (query?query:"");
|
||||
return this.http.post(url, {doiArray: DOIs})
|
||||
.pipe(map(res => [res['meta'].total, this.parseResults("result", res['results'], properties), RefineResultsUtils.parse(res['refineResults'], null, "publication")]));
|
||||
}
|
||||
|
|
|
@ -259,13 +259,14 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
|
|||
if (!item) return null;
|
||||
if (!_.has(item, "code")) return null;
|
||||
if (!_.has(item, "label")) return null;
|
||||
if (!_.has(item, "schemeid")) return null;
|
||||
// if (!_.has(item, "schemeid")) return null;
|
||||
|
||||
return [{
|
||||
title: [_.get(item, "label")],
|
||||
identifier: [{
|
||||
id: _.get(item, "code"),
|
||||
schema: _.get(item, "schemeid")
|
||||
schema: "dnet:access_modes"
|
||||
// schema: _.get(item, "schemeid")
|
||||
}]
|
||||
}];
|
||||
}
|
||||
|
@ -298,12 +299,10 @@ convertDatasource(datasource: any, URL, otherUrl): Organization {
|
|||
};
|
||||
}
|
||||
|
||||
// TODO: Update parsing - check if parsing is ok
|
||||
private getSameAs(result: any): String[] {
|
||||
const relations = _.get(result, "links", null);
|
||||
if (!relations) return null;
|
||||
const array = new Array<String>();
|
||||
console.log("relations");
|
||||
if(Array.isArray(relations) ) {
|
||||
|
||||
for (let i = 0; i < relations.length; i++) {
|
||||
|
@ -342,7 +341,6 @@ console.log("relations");
|
|||
return array;
|
||||
}
|
||||
|
||||
// TODO: Update parsing - classid missing?
|
||||
private getKeyword(result: any, classification:'FOS'|'SDG' |null = null): String[] {
|
||||
const subjects = _.get(result, "result.subject", null);
|
||||
if (!subjects) return null;
|
||||
|
|
Loading…
Reference in New Issue