[Library|Trunk]

Impact Factors:
	Search results: keep an array of DOIs for each result.
	Get impact factors for all DOIs of a result (the first may have not impact factors)
	In the external link use the DOI assigned to the displayed impact factors



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58759 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2020-05-25 12:24:48 +00:00
parent cd5d412b81
commit 895a28162d
4 changed files with 20 additions and 9 deletions

View File

@ -32,15 +32,26 @@ export class SearchResultComponent implements OnInit, OnChanges {
}
/////////////////////// ATHENA CODE ///////////////////////
// console.log(data[1]);
let dois = encodeURIComponent(this.results.map((result) => result.DOI).join(","));
let dois = encodeURIComponent(this.results.map((result) => result.DOIs).join(","));
// console.log(dois);
if(dois.length > 0 && this.showImpactFactors && this.properties.environment != "production" && (this.properties.impactFactorsAPIURL && this.properties.impactFactorsAPIURL.length > 0) ) {
let url = this.properties.impactFactorsAPIURL + dois;
this.http.get((this.properties.useCache?(this.properties.cacheUrl+(encodeURIComponent(url))):url)).subscribe((data_received) => {
this.http.get((this.properties.useCache?(this.properties.cacheUrl+(encodeURIComponent(url))):url)).subscribe((data_received:any[]) => {
let impact =[];
data_received.forEach(function (result) {
if(result.doi && result.doi.length > 0 && result.pop_class!=null && result.inf_class!=null)
impact[result.doi]=result;
});
this.previewResults.forEach(function (result) {
result.identifiers.get("doi").forEach(function (doi) {
if(impact[doi]) {
result.DOI = doi;
}
})});
for (let i = 0; i < this.previewResults.length; i++) {
if (this.previewResults[i].DOI != '' && this.previewResults[i].DOI != null && data_received[i].pop_class!=null && data_received[i].inf_class!=null) {
if (this.previewResults[i].DOI) {
this.previewResults[i].pop_inf = new Array<string>();
this.previewResults[i].pop_inf.push(data_received[i].pop_class, data_received[i].inf_class);
this.previewResults[i].pop_inf.push(impact[this.previewResults[i].DOI].pop_class, impact[this.previewResults[i].DOI].inf_class);
if(this.previewResults[i].pop_inf[0]=="A"){
// this.previewResults[i].pop_inf.push("High");
this.previewResults[i].pop_inf.push("Exceptional");

View File

@ -173,8 +173,7 @@ export class SearchResearchResultsService {
for(let i=0; i<resData['pid'].length; i++){
if(resData['pid'][i].classid == 'doi'){
if(resData['pid'][i].content != '' && resData['pid'][i].content != null){
result.DOI = resData['pid'][i].content.replace("https://doi.org/","");
break;
result.DOIs.push(resData['pid'][i].content.replace("https://doi.org/",""));
}
}
}

View File

@ -3,7 +3,7 @@ import {Author, Organization, Project, ResultTitle} from "../result-preview/resu
export class SearchResult {
title: ResultTitle;
id: string;
DOI: string;
DOIs: string[]=[];
//publications & datasets & orp & software & projects & dataproviders:
description: string;

View File

@ -77,7 +77,7 @@ export class ResultPreview {
//Impact factor
DOI:string;
pop_inf
pop_inf;
//publications & datasets & orp & software & organizations:
projects: Project[];
@ -175,7 +175,8 @@ export class ResultPreview {
resultPreview.subjects = result.subjects;
resultPreview.resultType = type;
//impact factor;
resultPreview.DOI=result.DOI;
resultPreview.identifiers = new Map();
resultPreview.identifiers.set("doi", result.DOIs);
return resultPreview;
}