From 85b2f76db6c2aa8705bb61cfd126073197300dac Mon Sep 17 00:00:00 2001 From: "stefania.martziou" Date: Tue, 16 Jun 2020 21:52:16 +0000 Subject: [PATCH] Created the indicator tables for the open science tab of the europe page --- src/app/domain/overview-map-data.ts | 4 + .../continent-overview.component.html | 254 ++++++++++++++++-- .../continent-overview.component.ts | 121 ++++++++- .../countrypage/country-page.component.html | 36 +-- .../pages/home/countries-table.component.html | 95 ++++++- .../pages/home/countries-table.component.ts | 19 +- src/app/pages/home/data-view.component.html | 4 +- src/app/services/data-handler.service.ts | 147 ++++++++++ src/app/services/data.service.ts | 14 +- 9 files changed, 642 insertions(+), 52 deletions(-) diff --git a/src/app/domain/overview-map-data.ts b/src/app/domain/overview-map-data.ts index 328ebbd1d..49fcdaa05 100644 --- a/src/app/domain/overview-map-data.ts +++ b/src/app/domain/overview-map-data.ts @@ -61,6 +61,10 @@ export class CountryTableData { repositories: number = null; journals: number = null; policies: number = null; + pid: Indicator; + licence: Indicator; + gold: Indicator; + green: Indicator; } export class CountryPageOverviewData { diff --git a/src/app/pages/continentoverview/continent-overview.component.html b/src/app/pages/continentoverview/continent-overview.component.html index 7f4667626..b6a7dff77 100644 --- a/src/app/pages/continentoverview/continent-overview.component.html +++ b/src/app/pages/continentoverview/continent-overview.component.html @@ -129,7 +129,7 @@
-
+
@@ -543,7 +543,7 @@
-

PID

+

PID

@@ -590,8 +590,8 @@
-
-

Licence

+
+

Licence

@@ -638,8 +638,8 @@
-
-

Gold

+
+

Gold

@@ -686,8 +686,8 @@
-
-

Green

+
+

Green

@@ -734,8 +734,8 @@
-
-

Green vs. Gold

+
+

Green vs. Gold

@@ -749,6 +749,60 @@
+
+ +

More details for publications

+ +
+ + + +
+ +
+
+
+
+ + + +
    +
  • + + +
  • + +
+ +
+
+ +
+ +
+ + +
+
@@ -757,7 +811,7 @@
-

PID

+

PID

@@ -804,8 +858,8 @@
-
-

Licence

+
+

Licence

@@ -852,6 +906,60 @@
+
+ +

More details for datasets

+ +
+ + + +
+ +
+
+
+
+ + + +
    +
  • + + +
  • + +
+ +
+
+ +
+ +
+ + +
+
@@ -860,7 +968,7 @@
-

PID

+

PID

@@ -907,8 +1015,8 @@
-
-

Licence

+
+

Licence

@@ -955,6 +1063,60 @@
+
+ +

More details for software

+ +
+ + + +
+ +
+
+
+
+ + + +
    +
  • + + +
  • + +
+ +
+
+ +
+ +
+ + +
+
@@ -963,7 +1125,7 @@
-

PID

+

PID

@@ -1010,8 +1172,8 @@
-
-

Licence

+
+

Licence

@@ -1058,6 +1220,60 @@
+
+ +

More details for other research products

+ +
+ + + +
+ +
+
+
+
+ + + +
    +
  • + + +
  • + +
+ +
+
+ +
+ +
+ + +
+
diff --git a/src/app/pages/continentoverview/continent-overview.component.ts b/src/app/pages/continentoverview/continent-overview.component.ts index c35a980ab..4ad188faf 100644 --- a/src/app/pages/continentoverview/continent-overview.component.ts +++ b/src/app/pages/continentoverview/continent-overview.component.ts @@ -3,9 +3,10 @@ import { ActivatedRoute } from '@angular/router'; import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'; import { DataService } from '../../services/data.service'; import { DataHandlerService } from '../../services/data-handler.service'; -import { EuropeData } from '../../domain/overview-map-data'; +import {CountryTableData, EuropeData} from '../../domain/overview-map-data'; import { environment } from '../../../environments/environment'; import { TreemapHighchartsData } from '../../domain/treemap-highcharts-data'; +import {Observable} from 'rxjs'; @Component({ selector: 'app-continent-overview', @@ -82,6 +83,12 @@ export class ContinentOverviewComponent implements OnInit { greenVsGoldPublicationsChartURL: SafeResourceUrl; + loadingPublicationsAbsoluteTable: boolean = true; + loadingPublicationsPercentageTable: boolean = true; + publicationsTableContentSelection: string = 'affiliated'; + publicationsAbsoluteTableData: CountryTableData[]; + publicationsPercentageTableData: CountryTableData[]; + // Open Science Tab // datasets subtab openScienceDatasetsTabIsInitialised: boolean = false; @@ -101,6 +108,12 @@ export class ContinentOverviewComponent implements OnInit { datasetsWithPIDByFunderData: TreemapHighchartsData[]; datasetsWithLicenceByFunderData: TreemapHighchartsData[]; + loadingDatasetsAbsoluteTable: boolean = true; + loadingDatasetsPercentageTable: boolean = true; + datasetsTableContentSelection: string = 'affiliated'; + datasetsAbsoluteTableData: CountryTableData[]; + datasetsPercentageTableData: CountryTableData[]; + // Open Science Tab // software subtab openScienceSoftwareTabIsInitialised: boolean = false; @@ -120,6 +133,12 @@ export class ContinentOverviewComponent implements OnInit { softwareWithPIDByFunderData: TreemapHighchartsData[]; softwareWithLicenceByFunderData: TreemapHighchartsData[]; + loadingSoftwareAbsoluteTable: boolean = true; + loadingSoftwarePercentageTable: boolean = true; + softwareTableContentSelection: string = 'affiliated'; + softwareAbsoluteTableData: CountryTableData[]; + softwarePercentageTableData: CountryTableData[]; + // Open Science Tab // other research products subtab openScienceOtherTabIsInitialised: boolean = false; @@ -139,6 +158,12 @@ export class ContinentOverviewComponent implements OnInit { otherWithPIDByFunderData: TreemapHighchartsData[]; otherWithLicenceByFunderData: TreemapHighchartsData[]; + loadingOtherAbsoluteTable: boolean = true; + loadingOtherPercentageTable: boolean = true; + otherTableContentSelection: string = 'affiliated'; + otherAbsoluteTableData: CountryTableData[]; + otherPercentageTableData: CountryTableData[]; + constructor(private dataService: DataService, private dataHandlerService: DataHandlerService, private route: ActivatedRoute, @@ -368,6 +393,8 @@ export class ContinentOverviewComponent implements OnInit { } ); + this.getPublicationsTableData(this.publicationsTableContentSelection); + this.openSciencePubsTabIsInitialised = true; } } @@ -404,6 +431,8 @@ export class ContinentOverviewComponent implements OnInit { } ); + this.getDatasetsTableData(this.datasetsTableContentSelection); + this.openSciencePubsTabIsInitialised = true; } } @@ -440,6 +469,8 @@ export class ContinentOverviewComponent implements OnInit { } ); + this.getSoftwareTableData(this.softwareTableContentSelection); + this.openScienceSoftwareTabIsInitialised = true; } } @@ -476,7 +507,95 @@ export class ContinentOverviewComponent implements OnInit { } ); + this.getOtherTableData(this.otherTableContentSelection); + this.openScienceOtherTabIsInitialised = true; } } + + getContent(type: string, contentSelection: string): void { + + if (type === 'publication') { + this.publicationsTableContentSelection = contentSelection; + this.getPublicationsTableData(this.publicationsTableContentSelection); + } else if (type === 'dataset') { + this.datasetsTableContentSelection = contentSelection; + this.getDatasetsTableData(this.datasetsTableContentSelection); + } else if (type === 'software') { + this.softwareTableContentSelection = contentSelection; + this.getSoftwareTableData(this.softwareTableContentSelection); + } else if (type === 'other') { + this.otherTableContentSelection = contentSelection; + this.getOtherTableData(this.otherTableContentSelection); + } + } + + getPublicationsTableData(contentSelection: string) { + this.loadingPublicationsAbsoluteTable = true; + this.loadingPublicationsPercentageTable = true; + this.dataService.getIndicatorsTableData('publication', contentSelection).subscribe( + rawData => { + this.publicationsAbsoluteTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData); + this.publicationsPercentageTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData); + this.loadingPublicationsAbsoluteTable = false; + this.loadingPublicationsPercentageTable = false; + }, error => { + console.log(error); + this.loadingPublicationsAbsoluteTable = false; + this.loadingPublicationsPercentageTable = false; + } + ); + } + + getDatasetsTableData(contentSelection: string) { + this.loadingDatasetsAbsoluteTable = true; + this.loadingDatasetsPercentageTable = true; + this.dataService.getIndicatorsTableData('dataset', contentSelection).subscribe( + rawData => { + this.datasetsAbsoluteTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData); + this.datasetsPercentageTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData); + this.loadingDatasetsAbsoluteTable = false; + this.loadingDatasetsPercentageTable = false; + }, error => { + console.log(error); + this.loadingDatasetsAbsoluteTable = false; + this.loadingDatasetsPercentageTable = false; + } + ); + } + + getSoftwareTableData(contentSelection: string) { + this.loadingSoftwareAbsoluteTable = true; + this.loadingSoftwarePercentageTable = true; + this.dataService.getIndicatorsTableData('software', contentSelection).subscribe( + rawData => { + this.softwareAbsoluteTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData); + this.softwarePercentageTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData); + this.loadingSoftwareAbsoluteTable = false; + this.loadingSoftwarePercentageTable = false; + }, error => { + console.log(error); + this.loadingSoftwareAbsoluteTable = false; + this.loadingSoftwarePercentageTable = false; + } + ); + } + + getOtherTableData(contentSelection: string) { + this.loadingOtherAbsoluteTable = true; + this.loadingOtherPercentageTable = true; + this.dataService.getIndicatorsTableData('other', contentSelection).subscribe( + rawData => { + this.otherAbsoluteTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData); + this.otherPercentageTableData = this.dataHandlerService.convertRawDataToIndicatorsTableData(rawData); + this.loadingOtherAbsoluteTable = false; + this.loadingOtherPercentageTable = false; + }, error => { + console.log(error); + this.loadingOtherAbsoluteTable = false; + this.loadingOtherPercentageTable = false; + } + ); + } + } diff --git a/src/app/pages/countrypage/country-page.component.html b/src/app/pages/countrypage/country-page.component.html index 99c3b6a02..ec99d3580 100644 --- a/src/app/pages/countrypage/country-page.component.html +++ b/src/app/pages/countrypage/country-page.component.html @@ -759,7 +759,7 @@
-

PID

+

PID

@@ -798,8 +798,8 @@
-
-

Licence

+
+

Licence

@@ -838,8 +838,8 @@
-
-

Gold

+
+

Gold

@@ -878,8 +878,8 @@
-
-

Green

+
+

Green

@@ -918,8 +918,8 @@
-
-

Green vs. Gold

+
+

Green vs. Gold

@@ -941,7 +941,7 @@
-

PID

+

PID

@@ -980,8 +980,8 @@
-
-

Licence

+
+

Licence

@@ -1028,7 +1028,7 @@
-

PID

+

PID

@@ -1067,8 +1067,8 @@
-
-

Licence

+
+

Licence

@@ -1115,7 +1115,7 @@
-

PID

+

PID

@@ -1154,8 +1154,8 @@
-
-

Licence

+
+

Licence

diff --git a/src/app/pages/home/countries-table.component.html b/src/app/pages/home/countries-table.component.html index 6a7776614..13e38014a 100644 --- a/src/app/pages/home/countries-table.component.html +++ b/src/app/pages/home/countries-table.component.html @@ -1,5 +1,6 @@ - - + +
+ - - - - + + + + - - + + - -
@@ -20,10 +21,10 @@ OA journals @@ -50,8 +51,8 @@ OA other
{{countryOverview.name}} @@ -109,5 +110,79 @@
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + Country + + + + + PID + + + + + Licence + + + + + Gold + + + + + Green +
{{countryOverview.name}} + -- + + {{countryOverview.pid.percentage | number :'1.0-1'}}% + {{countryOverview.pid.oa | number}} + + + -- + + {{countryOverview.licence.percentage | number :'1.0-1'}}% + {{countryOverview.licence.oa | number}} + + + -- + + {{countryOverview.gold.percentage | number :'1.0-1'}}% + {{countryOverview.gold.oa | number}} + + + -- + + {{countryOverview.green.percentage | number :'1.0-1'}}% + {{countryOverview.green.oa | number}} + +
+
+ diff --git a/src/app/pages/home/countries-table.component.ts b/src/app/pages/home/countries-table.component.ts index dbffdafaf..5be77a540 100644 --- a/src/app/pages/home/countries-table.component.ts +++ b/src/app/pages/home/countries-table.component.ts @@ -11,6 +11,9 @@ export class CountriesTableComponent implements OnChanges { @Input() isPercentage: boolean; @Input() countries: CountryTableData[]; + @Input() view: string; + @Input() entity: string; + isSortedBy: string; isDescending: boolean = true; @@ -30,7 +33,21 @@ export class CountriesTableComponent implements OnChanges { this.isSortedBy = field; - if (field !== 'country') { + if (field === 'pid' || field === 'licence' || field === 'gold' || field === 'green') { + if (this.isDescending) { + if (this.isPercentage) { + this.countries.sort((a, b) => b[field].percentage - a[field].percentage); + } else { + this.countries.sort((a, b) => b[field].oa - a[field].oa); + } + } else { + if (this.isPercentage) { + this.countries.sort((a, b) => a[field].percentage - b[field].percentage); + } else { + this.countries.sort((a, b) => a[field].oa - b[field].oa); + } + } + } else if (field !== 'country') { if (this.isDescending) { this.countries.sort((a, b) => b[field] - a[field]); } else { diff --git a/src/app/pages/home/data-view.component.html b/src/app/pages/home/data-view.component.html index 389dfb8e0..80518f1d1 100644 --- a/src/app/pages/home/data-view.component.html +++ b/src/app/pages/home/data-view.component.html @@ -36,7 +36,7 @@
- +
- +