change the way we get the impact factors for search results

This commit is contained in:
Alex Martzios 2022-08-02 12:43:39 +03:00
parent 39ddba0eba
commit 05ca7c7eea
9 changed files with 58 additions and 80 deletions

View File

@ -300,9 +300,7 @@
[results]="results"
[status]=searchUtils.status
[type]="entityType"
[showLoading]="true" [properties]=properties [showImpactFactors]="(customFilter &&
customFilter.queryFieldName == 'communityId' && (customFilter.valueId ==
'elixir-gr' || customFilter.valueId == 'inspired-ris'))">
[showLoading]="true" [properties]=properties>
</search-result>
<deposit-result *ngIf="usedBy == 'deposit'"
[results]="results"

View File

@ -21,7 +21,6 @@ export class SearchResultComponent implements OnInit, OnChanges {
@Input() showOrganizations: boolean = true;
@Input() custom_class: string = "";
@Input() properties: EnvProperties;
@Input() showImpactFactors: boolean = false;
@Input() showEnermaps: boolean;
constructor( private http: HttpClient/*ATHENA CODE*/
@ -67,63 +66,6 @@ export class SearchResultComponent implements OnInit, OnChanges {
}
);
}
/////////////////////// ATHENA CODE ///////////////////////
// console.log(data[1]);
let dois = encodeURIComponent(this.results.map((result) => result.DOIs).join(","));
// console.log(dois);
if(dois.length > 0 && this.showImpactFactors && (this.properties.impactFactorsAPIURL && this.properties.impactFactorsAPIURL.length > 0) ) {
let url = this.properties.impactFactorsAPIURL + dois;
this.sub = 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) {
if(result.identifiers && result.identifiers.get("doi")) {
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].pop_inf = new Array<string>();
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");
}else if(this.previewResults[i].pop_inf[0]=="B"){
// this.previewResults[i].pop_inf.push("Average");
this.previewResults[i].pop_inf.push("Substantial");
}else{
// this.previewResults[i].pop_inf.push("low");
this.previewResults[i].pop_inf.push("Average");
}
if(this.previewResults[i].pop_inf[1]=="A"){
// this.previewResults[i].pop_inf.push("Strong");
this.previewResults[i].pop_inf.push("Exceptional");
}else if(this.previewResults[i].pop_inf[1]=="B"){
// this.previewResults[i].pop_inf.push("Average");
this.previewResults[i].pop_inf.push("Substantial");
}else{
// this.previewResults[i].pop_inf.push("Weak");
this.previewResults[i].pop_inf.push("Average");
}
}
}
}, error1 => {
console.error("Failed to get Impact factors for elixir-gr")
});
// console.log(researchResults[1]);
}
/////////////////////// ATHENA CODE ///////////////////////
}
ngOnChanges(changes: SimpleChanges): void {

View File

@ -199,6 +199,32 @@ export class SearchResearchResultsService {
instance = Array.isArray(resData['children']['instance']) ? resData['children']['instance'][i] : resData['children']['instance'];
this.parsingFunctions.parseTypes(result.types, types, instance);
}
// Measure
result.measure = new Array<string>();
if (resData['measure'] && Array.isArray(resData['measure'])) {
for (let i = 0; i < resData['measure'].length; i++) {
if (resData['measure'][i].id == 'influence') {
result.measure[1] = resData['measure'][i].class;
if (resData['measure'][i].class == 'A') {
result.measure[3] = 'Exceptional';
} else if (resData['measure'][i].class == 'B') {
result.measure[3] = 'Substantial';
} else {
result.measure[3] = 'Average';
}
}
if (resData['measure'][i].id == 'popularity') {
result.measure[0] = resData['measure'][i].class;
if (resData['measure'][i].class == 'A') {
result.measure[2] = 'Exceptional';
} else if (resData['measure'][i].class == 'B') {
result.measure[2] = 'Substantial';
} else {
result.measure[2] = 'Average';
}
}
}
}
/////////////////////////// Athena Code ///////////////////////////
if (resData['pid']) {
if (!Array.isArray(resData['pid'])) {
@ -370,7 +396,6 @@ export class SearchResearchResultsService {
}
results.push(result);
}
return results;
}

View File

@ -6,6 +6,7 @@ export class SearchResult {
relcanId: string;
DOIs: string[]=[];
identifiers: Map<string, string[]>;
measure: Array<string>;
//publications & datasets & orp & software & projects & dataproviders:
description: string;

View File

@ -309,29 +309,29 @@
</div>
</div>
<!--&& loggedIn (card footer)-->
<div *ngIf="(result.pop_inf && result.DOI) ||
<div *ngIf="result.measure?.length ||
((properties.adminToolsPortalType == 'explore' || properties.adminToolsPortalType == 'community') &&
((showOrcid && result.identifiers && result.identifiers.size > 0 && isResultType) || result.orcidCreationDates?.length > 0))"
class="uk-text-small"
[ngClass]="{'uk-card-footer': isCard}">
<!-- Impact Factors-->
<span class="uk-flex uk-flex-top uk-flex-wrap" style="grid-gap: 10px;">
<ng-container *ngIf="result.pop_inf && result.DOI">
<ng-container *ngIf="result.measure?.length">
<!--Popularity -->
<a title="Popularity" class="popularity-{{result.pop_inf[0]}} uk-margin-right uk-flex uk-flex-middle uk-width-auto@s uk-width-1-1">
<a title="Popularity" class="popularity-{{result.measure[0]}} uk-margin-right uk-flex uk-flex-middle uk-width-auto@s uk-width-1-1">
<svg xmlns="http://www.w3.org/2000/svg" width="10.749" height="14.33" viewBox="0 0 10.749 14.33"><defs><!--<style>.a{fill:#d51717;}</style>--></defs><path
class="a"
d="M10.382.67a14.44,14.44,0,0,1,.5,3.225A2.331,2.331,0,0,1,8.589,6.4,2.445,2.445,0,0,1,6.15,3.895l.02-.242A9.25,9.25,0,0,0,4,9.625a5.375,5.375,0,0,0,10.749,0A11.5,11.5,0,0,0,10.382.67ZM9.18,12.985a2.134,2.134,0,0,1-2.163-2.11A2.1,2.1,0,0,1,8.9,8.779a5.181,5.181,0,0,0,3.1-1.733,9.374,9.374,0,0,1,.4,2.714A3.226,3.226,0,0,1,9.18,12.985Z"
transform="translate(-4 -0.67)"/>
</svg>
<span class="uk-margin-small-left">
{{" " + result.pop_inf[2] + " popularity" }}
{{" " + result.measure[2] + " popularity" }}
</span>
</a>
<div class="default-dropdown uk-margin-remove-top uk-padding-small"
uk-dropdown="pos: bottom-left; mode:click" style="min-width: 70px !important;">
<span class="uk-flex uk-flex-middle">
<span class="popularity-{{result.pop_inf[0]}}">
<span class="popularity-{{result.measure[0]}}">
<svg xmlns="http://www.w3.org/2000/svg" width="20.234" height="26.974"
viewBox="0 0 20.234 26.974"><defs> </defs><path class="a"
d="M16.014.67a27.181,27.181,0,0,1,.936,6.07c0,2.605-1.707,4.717-4.312,4.717A4.6,4.6,0,0,1,8.047,6.74l.038-.455A17.411,17.411,0,0,0,4,17.527a10.117,10.117,0,0,0,20.234,0A21.643,21.643,0,0,0,16.014.67ZM13.75,23.85A4.016,4.016,0,0,1,9.678,19.88c0-2.049,1.328-3.49,3.554-3.946a9.753,9.753,0,0,0,5.843-3.263,17.645,17.645,0,0,1,.746,5.109,6.072,6.072,0,0,1-6.07,6.07Z"
@ -339,23 +339,23 @@
</svg>
</span>
<span class="uk-margin-small-left">
{{" " + result.pop_inf[2] + " popularity" }}
{{" " + result.measure[2] + " popularity" }}
</span>
<span class="uk-margin-small-left">
{{" " + (result.pop_inf[0] == 'A' ? 'In top 0.01%' : '') + (result.pop_inf[0] == 'B' ? 'In top 1%' : '') + (result.pop_inf[0] == 'C' ? 'In bottom 99%' : '')}}
{{" " + (result.measure[0] == 'A' ? 'In top 0.01%' : '') + (result.measure[0] == 'B' ? 'In top 1%' : '') + (result.measure[0] == 'C' ? 'In bottom 99%' : '')}}
</span>
</span>
<div class="uk-text-meta uk-margin">
Popularity: Citation-based measure reflecting the current impact.
</div>
<div>
<a title="Link to Bip!Finder" class="uk-float-right" target="_blank" href="https://bip.imis.athena-innovation.gr/site/details?id={{result.DOI}}">
<a title="Link to Bip!Finder" class="uk-float-right" target="_blank" href="https://bip.imis.athena-innovation.gr/site/details?id={{result.id}}">
View more details
</a>
</div>
</div>
<!--Influence -->
<a title="Influence" class="influence-{{result.pop_inf[1]}} uk-margin-right uk-flex uk-flex-middle uk-width-auto@s uk-width-1-1">
<a title="Influence" class="influence-{{result.measure[1]}} uk-margin-right uk-flex uk-flex-middle uk-width-auto@s uk-width-1-1">
<svg xmlns="http://www.w3.org/2000/svg" width="12.667" height="14" viewBox="0 0 12.667 14">
<defs><!--<style>.a{fill:#e1920a;}</style>--></defs>
<path class="a"
@ -363,13 +363,13 @@
transform="translate(-2 -1)"/>
</svg>
<span class="uk-margin-small-left">
{{" " + result.pop_inf[3] + " influence" }}
{{" " + result.measure[3] + " influence" }}
</span>
</a>
<div class="default-dropdown uk-margin-remove-top uk-padding-small"
uk-dropdown="pos: bottom-left; mode:click" style="min-width: 70px !important;">
<span class="uk-flex uk-flex-middle">
<span class="influence-{{result.pop_inf[1]}}">
<span class="influence-{{result.measure[1]}}">
<svg xmlns="http://www.w3.org/2000/svg" width="24.299" height="26.857" viewBox="0 0 24.299 26.857"><defs><style>.a {
fill: #464646;
}</style></defs><path class="a"
@ -378,17 +378,17 @@
</svg>
</span>
<span class=" uk-margin-small-left">
{{result.pop_inf[3] + " influence" }}
{{result.measure[3] + " influence" }}
</span>
<span class="uk-margin-small-left">
{{" " + (result.pop_inf[1] == 'A' ? 'In top 0.01%' : '') + (result.pop_inf[1] == 'B' ? 'In top 1%' : '') + (result.pop_inf[1] == 'C' ? 'In bottom 99%' : '')}}
{{" " + (result.measure[1] == 'A' ? 'In top 0.01%' : '') + (result.measure[1] == 'B' ? 'In top 1%' : '') + (result.measure[1] == 'C' ? 'In bottom 99%' : '')}}
</span>
</span>
<div class="uk-text-meta uk-margin">
Influence: Citation-based measure reflecting the total impact.
</div>
<div>
<a title="Link to Bip!Finder" class=" uk-float-right" target="_blank" href="https://bip.imis.athena-innovation.gr/site/details?id={{result.DOI}}">
<a title="Link to Bip!Finder" class=" uk-float-right" target="_blank" href="https://bip.imis.athena-innovation.gr/site/details?id={{result.id}}">
View more details
</a>
</div>

View File

@ -0,0 +1,10 @@
// Impact Factors
.popularity-A svg .a, .influence-A svg .a {
fill:#d51717;
}
.popularity-B svg .a, .influence-B svg .a {
fill: #e1920a;
}
.popularity-C svg .a, .influence-C svg .a {
fill: #444;
}

View File

@ -10,7 +10,8 @@ import {OpenaireEntities} from "../properties/searchFields";
@Component({
selector: 'result-preview',
templateUrl: 'result-preview.component.html'
templateUrl: 'result-preview.component.html',
styleUrls: ['result-preview.component.less']
})
export class ResultPreviewComponent implements OnInit, OnChanges {
@Input() result: ResultPreview;

View File

@ -81,7 +81,8 @@ export class ResultPreview {
//Impact factor
DOI:string;
pop_inf;
measure: Array<string>;
//publications & datasets & orp & software & organizations:
projects: Project[];
@ -194,6 +195,7 @@ export class ResultPreview {
// }
resultPreview.identifiers = result.identifiers;
resultPreview.enermapsId = result.enermapsId;
resultPreview.measure = result.measure;
return resultPreview;
}

View File

@ -39,7 +39,7 @@ import {StringUtils} from "../../string-utils.class";
<search-result [properties]="properties"
[results]="results"
[status]="fetch.searchUtils.status"
[type]="resultType" [showImpactFactors]="showImpactFactors" [showEnermaps]="showEnermaps">
[type]="resultType" [showEnermaps]="showEnermaps">
</search-result>
<!-- <div *ngIf="searchLinkToAdvancedPage && fetch.results?.length > 0" class="uk-text-right">-->
@ -59,7 +59,6 @@ export class SearchTabComponent {
@Input() public searchNumber: number = 5;
@Input() public searchLinkToAdvancedPage: string;
@Input() properties: EnvProperties;
@Input() showImpactFactors;
@Input() customTitle;
@Input() showEnermaps: boolean;
@Input() currentPage: number = null;