diff --git a/services/searchResearchResults.service.ts b/services/searchResearchResults.service.ts index 4609e22c..9bdf803d 100644 --- a/services/searchResearchResults.service.ts +++ b/services/searchResearchResults.service.ts @@ -205,7 +205,17 @@ export class SearchResearchResultsService { 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') { + if (resData['measure'][i].class == 'C1') { + result.measure[3] = 'Top 0.01% in'; + } else if (resData['measure'][i].class == 'C2') { + result.measure[3] = 'Top 0.1% in'; + } else if (resData['measure'][i].class == 'C3') { + result.measure[3] = 'Top 1% in'; + } else if (resData['measure'][i].class == 'C4') { + result.measure[3] = 'Top 10% in'; + } else if (resData['measure'][i].class == 'C5') { + result.measure[3] = 'Average/low'; + } else if (resData['measure'][i].class == 'A') { result.measure[3] = 'Exceptional'; } else if (resData['measure'][i].class == 'B') { result.measure[3] = 'Substantial'; @@ -215,7 +225,17 @@ export class SearchResearchResultsService { } if (resData['measure'][i].id == 'popularity') { result.measure[0] = resData['measure'][i].class; - if (resData['measure'][i].class == 'A') { + if (resData['measure'][i].class == 'C1') { + result.measure[2] = 'Top 0.01% in'; + } else if (resData['measure'][i].class == 'C2') { + result.measure[2] = 'Top 0.1% in'; + } else if (resData['measure'][i].class == 'C3') { + result.measure[2] = 'Top 1% in'; + } else if (resData['measure'][i].class == 'C4') { + result.measure[2] = 'Top 10% in'; + } else if (resData['measure'][i].class == 'C5') { + result.measure[2] = 'Average/low'; + } else if (resData['measure'][i].class == 'A') { result.measure[2] = 'Exceptional'; } else if (resData['measure'][i].class == 'B') { result.measure[2] = 'Substantial'; diff --git a/sharedComponents/numbers/numbers.component.ts b/sharedComponents/numbers/numbers.component.ts index c80d116a..cb163c7d 100644 --- a/sharedComponents/numbers/numbers.component.ts +++ b/sharedComponents/numbers/numbers.component.ts @@ -7,8 +7,8 @@ import {properties} from '../../../../environments/environment'; import {NumberSize, NumberUtils} from '../../utils/number-utils.class'; import {BehaviorSubject, Observable, Subscription, zip} from 'rxjs'; import {RouterHelper} from "../../utils/routerHelper.class"; -import {HelperFunctions} from "../../utils/HelperFunctions.class"; import {OpenaireEntities} from "../../utils/properties/searchFields"; +import {SearchOrganizationsService} from '../../services/searchOrganizations.service'; export interface Numbers { publicationsSize?: NumberSize; @@ -23,152 +23,57 @@ export interface Numbers { organizationsSize?: NumberSize; } -type Entity = 'publication' | 'dataset' | 'software' | 'other' | 'project' | 'datasource' | 'organization'; - -interface Link { - link: string, - params?: any -} - @Component({ selector: 'numbers', template: ` -
-
- -
-
-
-
-
- -
-
- -
-
- -
-
- -
-
-
-
-
-
- -
+
+
+ A comprehensive and open dataset of research information covering + {{numbers.publicationsSize.number|number}}{{numbers.publicationsSize.size}} {{openaireEntities.PUBLICATIONS.toLowerCase()}} + , + {{numbers.datasetsSize.number|number}}{{numbers.datasetsSize.size}} {{openaireEntities.DATASETS.toLowerCase()}} + , + {{numbers.softwareSize.number|number}}{{numbers.softwareSize.size}} {{openaireEntities.SOFTWARE.toLowerCase()}} items + , + from + {{numbers.datasourcesSize.number|number}}{{numbers.datasourcesSize.size}} {{openaireEntities.DATASOURCES.toLowerCase()}} + , linked to + {{numbers.projectsSize.number|number}}{{numbers.projectsSize.size}} grants + and + {{numbers.organizationsSize.number|number}}{{numbers.organizationsSize.size}} {{openaireEntities.ORGANIZATIONS.toLowerCase()}}. +
+
All linked together through citations and semantics.
+
`, }) export class NumbersComponent implements OnInit, OnDestroy { - @Input() colorClass = 'uk-text-primary'; - @Input() backgroundClass = null; /** Add a value if you want to apply refine query*/ @Input() refineValue = null; /** True: Default initialization * False: Call init method to initialize numbers */ @Input() defaultInit = true; - /** Add an external link for numbers link */ - @Input() externalLink; /** When numbers have been initialized this emitter will emitted */ - @Output() results: EventEmitter = new EventEmitter(); + @Output() results: EventEmitter = new EventEmitter(); + + showPublications: boolean = true; + showDatasets: boolean = true; + showSoftware: boolean = true; + showOrp: boolean = true; + showOrganizations: boolean = true; + showProjects: boolean = true; + showDataProviders: boolean = true; + numbersLimit: number = 100; public properties: EnvProperties = properties; public openaireEntities = OpenaireEntities; public routerHelper: RouterHelper = new RouterHelper(); public numbers: Numbers = {}; - public loading: boolean = true; - public links: Map = new Map(); - private params: Map = new Map(); private emptySubject: BehaviorSubject = new BehaviorSubject(0); private subs: any[] = []; constructor(private searchResearchResultsService: SearchResearchResultsService, private searchDataprovidersService: SearchDataprovidersService, - private refineFieldResultsService: RefineFieldResultsService) { - this.links = new Map(); - this.params = new Map(); + private refineFieldResultsService: RefineFieldResultsService, + private _searchOrganizationsService: SearchOrganizationsService) { this.emptySubject = new BehaviorSubject(0); } @@ -176,81 +81,10 @@ export class NumbersComponent implements OnInit, OnDestroy { if (this.defaultInit) { this.init(); } - this.setLinks(); - } - - setParams() { - this.params.set('publication', {type: 'publications'}); - this.params.set('dataset', {type: 'datasets'}); - this.params.set('software', {type: 'software'}); - this.params.set('other', {type: 'other'}); - this.params.set('project', {}); - this.params.set('datasource', {}); - if (this.refineValue) { - this.params.forEach((value) => { - value['fq'] = this.refineValue; - }); - } - } - - setLinks() { - this.setParams(); - if (this.externalLink) { - this.links.set('publication', { - link: this.externalLink + properties.searchLinkToResults + - this.routerHelper.createQueryParamsString(Object.keys(this.params.get('publication')), HelperFunctions.getValues(this.params.get('publication'))) - }); - this.links.set('dataset', { - link: this.externalLink + properties.searchLinkToResults + - this.routerHelper.createQueryParamsString(Object.keys(this.params.get('dataset')), HelperFunctions.getValues(this.params.get('dataset'))) - }); - this.links.set('software', { - link: this.externalLink + properties.searchLinkToResults + - this.routerHelper.createQueryParamsString(Object.keys(this.params.get('software')), HelperFunctions.getValues(this.params.get('software'))) - }); - this.links.set('other', { - link: this.externalLink + properties.searchLinkToResults + - this.routerHelper.createQueryParamsString(Object.keys(this.params.get('other')), HelperFunctions.getValues(this.params.get('other'))) - }); - this.links.set('project', { - link: this.externalLink + properties.searchLinkToProjects + - this.routerHelper.createQueryParamsString(Object.keys(this.params.get('project')), HelperFunctions.getValues(this.params.get('project'))) - }); - this.links.set('datasource', { - link: this.externalLink + properties.searchLinkToDataProviders + - this.routerHelper.createQueryParamsString(Object.keys(this.params.get('datasource')), HelperFunctions.getValues(this.params.get('datasource'))) - }); - } else { - this.links.set('publication', { - link: properties.searchLinkToResults, - params: this.routerHelper.createQueryParams(Object.keys(this.params.get('publication')), HelperFunctions.getValues(this.params.get('publication'))) - }); - this.links.set('dataset', { - link: properties.searchLinkToResults, - params: this.routerHelper.createQueryParams(Object.keys(this.params.get('dataset')), HelperFunctions.getValues(this.params.get('dataset'))) - }); - this.links.set('software', { - link: properties.searchLinkToResults, - params: this.routerHelper.createQueryParams(Object.keys(this.params.get('software')), HelperFunctions.getValues(this.params.get('software'))) - }); - this.links.set('other', { - link: properties.searchLinkToResults, - params: this.routerHelper.createQueryParams(Object.keys(this.params.get('other')), HelperFunctions.getValues(this.params.get('other'))) - }); - this.links.set('project', { - link: properties.searchLinkToProjects, - params: this.routerHelper.createQueryParams(Object.keys(this.params.get('project')), HelperFunctions.getValues(this.params.get('project'))) - }); - this.links.set('datasource', { - link: properties.searchLinkToDataProviders, - params: this.routerHelper.createQueryParams(Object.keys(this.params.get('datasource')), HelperFunctions.getValues(this.params.get('datasource'))) - }); - } } init(getDatasetsLinked = false, getSoftwareLinked = false, getPublications = true, getDatasets = true, - getSoftware = true, getOther = true, getProjects = true, getDataProviders = true, refineValue: string = null) { - this.loading = true; + getSoftware = true, getOther = true, getProjects = true, getDataProviders = true, getOrganizations = true, refineValue: string = null) { if (refineValue) { this.refineValue = refineValue; } @@ -263,7 +97,8 @@ export class NumbersComponent implements OnInit, OnDestroy { (getSoftwareLinked) ? this.searchResearchResultsService.numOfSearchResultsLinkedToPub("software", this.properties) : this.empty, (getOther) ? this.searchResearchResultsService.numOfSearchResults('other', '', this.properties, refineParams) : this.empty, (getProjects) ? this.refineFieldResultsService.getRefineFieldsResultsByEntityName(['funder'], 'project', this.properties, refineParams) : this.empty, - (getDataProviders) ? this.searchDataprovidersService.numOfSearchDataproviders('', this.properties, refineParams) : this.empty + (getDataProviders) ? this.searchDataprovidersService.numOfSearchDataproviders('', this.properties, refineParams) : this.empty, + (getOrganizations) ? this._searchOrganizationsService.numOfSearchOrganizations2('', this.properties, refineParams) : this.empty ).subscribe((data: any[]) => { if (data[0] && data[0] > 0) { this.numbers.publicationsSize = NumberUtils.roundNumber(data[0]); @@ -292,11 +127,12 @@ export class NumbersComponent implements OnInit, OnDestroy { if (data[7] && data[7] > 0) { this.numbers.datasourcesSize = NumberUtils.roundNumber(data[7]); } - this.results.emit(this.numbers); - this.loading = false; + if (data[8] && data[8] > 0) { + this.numbers.organizationsSize = NumberUtils.roundNumber(data[8]); + } + this.results.emit(this.numbers); }, err => { this.handleError('Error getting numbers', err); - this.loading = false; })); } @@ -314,5 +150,35 @@ export class NumbersComponent implements OnInit, OnDestroy { private handleError(message: string, error) { console.error('Numbers: ' + message, error); + } + + public get showContentWithNumbers() { + if (this.numbers && (this.hasPublications || this.hasDatasets || this.hasSoftware || this.hasDatasources || this.hasProjects || this.hasOrganizations)) { + return true; + } + } + + public get hasPublications() { + return this.showPublications && this.numbers.publicationsSize && this.numbers.publicationsSize.count >= this.numbersLimit; + } + + public get hasDatasets() { + return this.showDatasets && this.numbers.datasetsSize && this.numbers.datasetsSize.count >= this.numbersLimit; + } + + public get hasSoftware() { + return this.showSoftware && this.numbers.softwareSize && this.numbers.softwareSize.count >= this.numbersLimit; + } + + public get hasDatasources() { + return this.showDataProviders && this.numbers.datasourcesSize && this.numbers.datasourcesSize.count >= this.numbersLimit; + } + + public get hasProjects() { + return this.showProjects && this.numbers.projectsSize && this.numbers.projectsSize.count >= this.numbersLimit; + } + + public get hasOrganizations() { + return this.showOrganizations && this.numbers.organizationsSize && this.numbers.organizationsSize.count >= this.numbersLimit; } } diff --git a/utils/result-preview/result-preview.component.less b/utils/result-preview/result-preview.component.less index 93da8f46..ee271cfc 100644 --- a/utils/result-preview/result-preview.component.less +++ b/utils/result-preview/result-preview.component.less @@ -1,10 +1,10 @@ // Impact Factors -.popularity-A svg .a, .influence-A svg .a { +.popularity-A svg .a, .popularity-C1 svg .a, .popularity-C2 svg .a, .influence-A svg .a, .influence-C1 svg .a, .influence-C2 svg .a { fill:#d51717; } -.popularity-B svg .a, .influence-B svg .a { +.popularity-B svg .a, .popularity-C3 svg .a, .popularity-C4 svg .a, .influence-B svg .a, .influence-C3 svg .a, .influence-C4 svg .a { fill: #e1920a; } -.popularity-C svg .a, .influence-C svg .a { +.popularity-C svg .a, .popularity-C5 svg .a, .influence-C svg .a, .influence-C5 svg .a { fill: #444; } \ No newline at end of file