From 8553dade4a8752bd09b69fa8512cb73feeaefaf2 Mon Sep 17 00:00:00 2001 From: Argiro Kokogiannaki Date: Thu, 7 Nov 2019 16:53:06 +0000 Subject: [PATCH] [Monitor_dashBoard|Trunk] add class StakeholderCreator create default profile based on spreadsheet create profile as a copy of the default git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57543 d315682c-612b-4755-9ff5-7f18f6832af3 --- src/app/app.component.ts | 4 + src/app/utils/entities/stakeholder.ts | 7 +- src/app/utils/entities/stakeholderCreator.ts | 321 +++++++++++++++++++ 3 files changed, 330 insertions(+), 2 deletions(-) create mode 100644 src/app/utils/entities/stakeholderCreator.ts diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 9918756..141fbcd 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -7,6 +7,8 @@ import {User} from './openaireLibrary/login/utils/helper.class'; import {UserManagementService} from "./openaireLibrary/services/user-management.service"; import {SideBarService} from "./library/sharedComponents/sidebar/sideBar.service"; import {StakeholderService} from "./services/stakeholder.service"; +import {Stakeholder} from "./utils/entities/stakeholder"; +import {StakeholderCreator} from "./utils/entities/stakeholderCreator"; @Component({ selector: 'app-root', @@ -42,6 +44,8 @@ export class AppComponent { if(!this.stakeholderService.stakeholder || this.stakeholderService.stakeholder.alias !== params['stakeholder']) { this.stakeholderService.getStakeholder(this.properties.monitorServiceAPIURL, params['stakeholder']).subscribe(stakeholder => { + // let stakeHolder:Stakeholder = Stakeholder.createECStakeholder(); + // let stakeHolder:Stakeholder = StakeholderCreator.createFunderFromDefaultProfile("ec","funder","ec__________::EC","European Commission","EC",false,"ec",true,true); this.stakeholderService.setStakeholder(stakeholder); }); } diff --git a/src/app/utils/entities/stakeholder.ts b/src/app/utils/entities/stakeholder.ts index d4ef938..41517ea 100644 --- a/src/app/utils/entities/stakeholder.ts +++ b/src/app/utils/entities/stakeholder.ts @@ -18,6 +18,11 @@ export class Stakeholder { managers: string[]; topics:Topic[]; constructor( id: string, type: string, index_id, index_name: string, index_shortName:string , isDefaultProfile: boolean, alias:string , isActive: boolean, isPublic: boolean){ + this.initializeFunder(id,type, index_id, index_name, index_shortName, isDefaultProfile, alias, isActive, isPublic); + this.topics =[]; + this.managers =[]; + } + initializeFunder( id: string, type: string, index_id, index_name: string, index_shortName:string , isDefaultProfile: boolean, alias:string , isActive: boolean, isPublic: boolean){ this.id = id; this.type = type; this.index_id = index_id; @@ -27,8 +32,6 @@ export class Stakeholder { this.alias = alias; this.isActive = isActive; this.isPublic = isPublic; - this.topics =[]; - this.managers =[]; } static createECStakeholder():Stakeholder{ let ec:Stakeholder = new Stakeholder("ec","funder","ec__________::EC","European Commission","EC",false,"ec",true,true); diff --git a/src/app/utils/entities/stakeholderCreator.ts b/src/app/utils/entities/stakeholderCreator.ts new file mode 100644 index 0000000..b9642a7 --- /dev/null +++ b/src/app/utils/entities/stakeholderCreator.ts @@ -0,0 +1,321 @@ +import {Stakeholder,Topic,Category,SubCategory,Indicator, IndicatorPath, ChartHelper} from "./stakeholder"; + +export class StakeholderCreator { + + static createFunderDefaultProfile():Stakeholder{ + let funder:Stakeholder = new Stakeholder(null,"funder","_funder_id_","_funder_name_","_FSN_",true,"deafult_funder",true,true); + funder.topics.push(StakeholderCreator.createResearchProductionTopic(funder)); + funder.topics.push(StakeholderCreator.createOpenAccessTopic(funder)); + + funder.topics.push(StakeholderCreator.createOSTopic(funder)); + funder.topics.push(funder.createImpactTopic()); + funder.topics.push(funder.createCollaborationTopic()); + return funder; + } + static createFunderFromDefaultProfile(id: string, type: string, index_id, index_name: string, index_shortName:string , isDefaultProfile: boolean, alias:string , isActive: boolean, isPublic: boolean):Stakeholder{ + let funder:Stakeholder = StakeholderCreator.createFunderDefaultProfile(); + funder.initializeFunder(id,type, index_id, index_name, index_shortName, isDefaultProfile, alias, isActive, isPublic); + for (let topic of funder.topics) { + for (let category of topic.categories) { + for (let subCategory of category.subCategories) { + for (let indicator of subCategory.charts) { + for (let indicatorPath of indicator.indicatorPaths) { + if(indicatorPath.parameters) { + indicatorPath.parameters.forEach((value: string, key: string) => { + if (value.indexOf("_funder_name_")!=-1) { + indicatorPath.parameters.set(key,value.toString().replace("_funder_name_", funder.index_name)); + }else if (value.indexOf("_fsn_")!=-1) { + indicatorPath.parameters.set(key,value.toString().replace("_fsn_", funder.index_shortName.toLowerCase())); + } + }); + } + } + } + } + + } + + } + return funder; + } + + static createResearchProductionTopic(stakeholder:Stakeholder):Topic { + let topic = new Topic("Research production", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...", "research-production", true, true); + + let pubCategory:Category = new Category("Publications","","publications",true,true); + topic.categories.push(pubCategory); + let pubDefSub = StakeholderCreator.createResearchProductionPerType(stakeholder,"Publications", "Publication","publication", "publications"); + pubCategory.subCategories.push(pubDefSub); + + let dataCategory:Category = new Category("Research data","","data",true,true); + topic.categories.push(dataCategory); + let dataDefSub = StakeholderCreator.createResearchProductionPerType(stakeholder,"Research data", "Research data","dataset", "datasets"); + dataCategory.subCategories.push(dataDefSub); + + let softwareCategory:Category = new Category("Software","","software",true,true); + topic.categories.push(softwareCategory); + let softDefSub = StakeholderCreator.createResearchProductionPerType(stakeholder,"Software", "Software","software", "datasets"); + softwareCategory.subCategories.push(softDefSub); + + let otherCategory:Category = new Category("Other research products","","other",true,true); + topic.categories.push(otherCategory); + let otherDefSub = StakeholderCreator.createResearchProductionPerType(stakeholder,"Other research products", "Other research product","other", "other"); + otherCategory.subCategories.push(otherDefSub); + + + return topic; + + } + static createResearchProductionPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory{ + let pubDefSub = new SubCategory(typePlural, null,null,true, true); + let res_timeline = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("column", "stats-tool", "chart?json=", '{"library":"HighCharts","chartDescription":{"queries":[{"name":"'+typePlural+'","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","query":{"select":[{"field":"'+dbType+'","aggregate":"count"},{"field":"'+dbType+'.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"'+dbType+'.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]}],"op":"AND"},{"groupFilters":[{"field":"'+dbType+'.year","type":">=","values":["2008"]},{"field":"'+dbType+'.year","type":"<=","values":["2020"]}],"op":"AND"}],"entity":"'+dbType+'","profile":"OpenAIRE All-inclusive","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+ChartHelper.prefix+'title'+ChartHelper.suffix+'"},"subtitle":{},"yAxis":{"title":{"text":"'+typePlural+'"}},"xAxis":{"title":{"text":"Year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]); + res_timeline.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typePlural+" timeline","column"); + pubDefSub.charts.push(res_timeline); + + + if(dbType == "publication" || dbType == "dataset") { + + let res_types = new Indicator("", null, "chart", "small", true, true, + [new IndicatorPath("column", "stats-tool", "chart?json=", + '{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.classification","aggregate":null}],"filters":[{"groupFilters":[{"field":"' + dbType + '.project.funder","type":"=","values":["' + ChartHelper.prefix + 'funder_name' + ChartHelper.suffix + '"]}],"op":"AND"}],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Type"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]); + res_types.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " types", "bar"); + pubDefSub.charts.push(res_types); + } + let res_access_mode = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("pie", "stats-tool", "chart?json=", + '{"library":"HighCharts","chartDescription":{"queries":[{"name":"'+typePlural+'","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","query":{"select":[{"field":"'+dbType+'","aggregate":"count"},{"field":"'+dbType+'.access mode","aggregate":null}],"filters":[{"groupFilters":[{"field":"'+dbType+'.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]}],"op":"AND"}],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+ChartHelper.prefix+'title'+ChartHelper.suffix+'"},"subtitle":{},"yAxis":{"title":{"text":"'+typePlural+'"}},"xAxis":{"title":{"text":"Year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]); + res_access_mode.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typeSingl+" acccess mode","pie"); + pubDefSub.charts.push(res_access_mode); + + if( dbType != "publication") { + let res_sci_area = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=", + '{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"' + dbType + '.project.funder","type":"=","values":["' + ChartHelper.prefix + 'funder_name' + ChartHelper.suffix + '"]}],"op":"AND"}],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Scientific area"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]); + res_sci_area.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " scientific area", "bar"); + pubDefSub.charts.push(res_sci_area); + + let res_programmes = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=", + '{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"select":[{"field":"' + dbType + '","aggregate":"count"},{"field":"' + dbType + '.project.funding level 2","aggregate":null}],"filters":[{"groupFilters":[{"field":"' + dbType + '.project.funder","type":"=","values":["' + ChartHelper.prefix + 'funder_name' + ChartHelper.suffix + '"]}],"op":"AND"},{"groupFilters":[{"field":"' + dbType + '.project.funding level 2","type":"!=","values":[" "]}],"op":"AND"}],"entity":"' + dbType + '","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Programmes"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]); + res_programmes.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " programmes", "bar"); + pubDefSub.charts.push(res_programmes); + } + //{"library":"HighCharts","chartDescription":{"queries":[{"name":"Research Data","type":"bar","query":{"select":[{"field":"dataset","aggregate":"count"},{"field":"dataset.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"dataset.project.funder","type":"=","values":["European Commission"]}],"op":"AND"}],"entity":"dataset","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Scientific Area"},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}} + let datasource = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("bar", "stats-tool", "chart?json=", + '{"library":"HighCharts","chartDescription":{"queries":[{"name":"'+typePlural+'","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","query":{"name":"monitor.'+ChartHelper.prefix+'id'+ChartHelper.suffix+'.'+dbTypePlural+'.datasources"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+ChartHelper.prefix+'title'+ChartHelper.suffix+'"},"subtitle":{},"yAxis":{"title":{"text":"'+typePlural+'"}},"xAxis":{"title":{"text":"Content provider"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]); + datasource.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typeSingl+" content provider","bar"); + datasource.indicatorPaths[0].parameters.set("id",stakeholder.index_shortName.toLowerCase()); + pubDefSub.charts.push(datasource); + if(dbType == "publication") { + let journal = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=", + '{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + '.' + dbTypePlural + '.journals"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Journal"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]); + journal.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " journal", "bar"); + journal.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase()); + pubDefSub.charts.push(journal); + + let repo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=", + '{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + '.' + dbTypePlural + '.repositories"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Repositories"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]); + repo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " repositories", "bar"); + repo.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase()); + pubDefSub.charts.push(repo); + } + if(dbType == "dataset") { + let repo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=", + '{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + '.' + dbTypePlural + '.drepositories"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Data Repositories"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]); + repo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " repositories", "bar"); + repo.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase()); + pubDefSub.charts.push(repo); + + let irepo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=", + '{"library":"HighCharts","chartDescription":{"queries":[{"name":"' + typePlural + '","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","query":{"name":"monitor.' + ChartHelper.prefix + 'id' + ChartHelper.suffix + '.' + dbTypePlural + '.irepositories"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '"},"subtitle":{},"yAxis":{"title":{"text":"' + typePlural + '"}},"xAxis":{"title":{"text":"Institutional repositories"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]); + irepo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " institutional repositories", "bar"); + irepo.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase()); + pubDefSub.charts.push(irepo); + } + + + let pid = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("pie", "stats-tool", "chart?json=", + '{"library":"HighCharts","chartDescription":{"queries":[{"name":"'+typePlural+'","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","query":{"name":"monitor.'+ChartHelper.prefix+'id'+ChartHelper.suffix+'.'+dbTypePlural+'.pidtypes"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+ChartHelper.prefix+'title'+ChartHelper.suffix+'"},"subtitle":{},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}', null)]); + pid.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typeSingl+" PIDs","pie"); + pid.indicatorPaths[0].parameters.set("id",stakeholder.index_shortName.toLowerCase()); + pubDefSub.charts.push(pid); + return pubDefSub; + } + static createOASub(){ + let subCategories:SubCategory[] = []; + let overviewSub = new SubCategory("Overview", null,"overview",true, true); + subCategories.push(overviewSub); + let byScientificAreaSub = new SubCategory("By Scientific Area", null,"scientific-area",true, true); + subCategories.push(byScientificAreaSub); + let byProgramSub = new SubCategory("By Programme", null,"programme",true, true); + subCategories.push(byProgramSub); + return subCategories; + + + } + static createOpenAccessTopic(stakeholder:Stakeholder):Topic { + let topic = new Topic("Open Access", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...", "open-access", true, true); + + let pubCategory:Category = new Category("Publications","","publications",true,true); + topic.categories.push(pubCategory); + pubCategory.subCategories = StakeholderCreator.createOASub(); + + let dataCategory:Category = new Category("Research data","","data",true,true); + topic.categories.push(dataCategory); + dataCategory.subCategories = StakeholderCreator.createOASub(); + + let softwareCategory:Category = new Category("Software","","software",true,true); + topic.categories.push(softwareCategory); + softwareCategory.subCategories = StakeholderCreator.createOASub(); + + let otherCategory:Category = new Category("Other research products","","other",true,true); + topic.categories.push(otherCategory); + + otherCategory.subCategories = StakeholderCreator.createOASub(); + + return topic; + + } + static createOSTopic(stakeholder:Stakeholder):Topic{ + let topic = new Topic("Open Science","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","open-science",true,true); + +/* let overview:Category = new Category("Overview","","overview",true,true); + topic.categories.push(overview); + let overviewDefSub = new SubCategory(null, null,null,true, true); + overview.subCategories.push(overviewDefSub);*/ + + + + let pubCategory:Category = new Category("Publications","","'+dbType+'s",true,true); + topic.categories.push(pubCategory); + let pubDefSub = new SubCategory(null, null,null,true, true); + pubCategory.subCategories.push(pubDefSub); +/* let pubOpenSub = new SubCategory("Openess","","openness",true,true); + pubCategory.subCategories.push(pubOpenSub); + let pubFundingSub = new SubCategory("Funding","","funding",true,true); + pubCategory.subCategories.push(pubFundingSub); + let pubDatasourceSub = new SubCategory("Content Providers","","content-providers",true,true); + pubCategory.subCategories.push(pubDatasourceSub); + let pubDocTypeSub = new SubCategory("Document Type","","doc-type",true,true); + pubCategory.subCategories.push(pubDocTypeSub); + let pubFindSub = new SubCategory("Findability","","dindability",true,true); + pubCategory.subCategories.push(pubFindSub);*/ + + + let dataCategory:Category = new Category("Research data","","data",true,true); + topic.categories.push(dataCategory); + let dataDefSub = new SubCategory(null, null,null,true, true); + dataCategory.subCategories.push(dataDefSub); + + let softwareCategory:Category = new Category("Software","","software",true,true); + topic.categories.push(softwareCategory); + let softDefSub = new SubCategory(null, null,null,true, true); + softwareCategory.subCategories.push(softDefSub); + + let otherCategory:Category = new Category("Other research products","","other",true,true); + topic.categories.push(otherCategory); + let otherDefSub = new SubCategory(null, null,null,true, true); + otherCategory.subCategories.push(otherDefSub); + +/* let datasourceCategory:Category = new Category("Content Providers","","content-providers",true,true); + topic.categories.push(datasourceCategory); + let datasourceDefSub = new SubCategory(null, null,null,true, true); + datasourceCategory.subCategories.push(datasourceDefSub);*/ + + let projectCategory:Category = new Category("Projects","","projects",true,true); + topic.categories.push(projectCategory); + let projectDefSub = new SubCategory(null, null,null,true, true); + projectCategory.subCategories.push(projectDefSub); + + //Numbers + + let n_total_pubs = new Indicator("Publications",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null, ["statistics","publications"])]); + let n_open_pubs = new Indicator("OA Publications",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null,["statistics","open_access"])]); + let n_total_projects = new Indicator("Projects",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null, ["statistics","total_projects"])]); + let n_total_data = new Indicator("Reserach data",null, "number","small",true, true, [new IndicatorPath(null, "search", + "/datasets/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null, ["total"])]); + let n_total_soft = new Indicator("Software",null, "number","small",true, true, [new IndicatorPath(null, "search", + "/software/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]); + let n_total_other = new Indicator("Other research products",null, "number","small",true, true, [new IndicatorPath(null, "search", + "/other/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]); + + /*overviewDefSub.numbers.push(n_total_pubs); + overviewDefSub.numbers.push(n_open_pubs); + overviewDefSub.numbers.push(n_total_projects); + overviewDefSub.numbers.push(n_total_data); + overviewDefSub.numbers.push(n_total_soft); + overviewDefSub.numbers.push(n_total_other);*/ + + pubDefSub.numbers.push(n_total_pubs); + pubDefSub.numbers.push(n_open_pubs); + softDefSub.numbers.push(n_total_soft); + dataDefSub.numbers.push(n_total_data); + otherDefSub.numbers.push(n_total_other); + + projectDefSub.numbers.push(n_total_projects); + + + return topic; + } + static createFundingImpactTopic():Topic{ + let topic = new Topic("Impact/Correlation","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","impact",true,true); + + let pubCategory:Category = new Category("Publications","","publications",true,true); + topic.categories.push(pubCategory); + let pubDefSub = new SubCategory(null, null,null,true, true); + pubCategory.subCategories.push(pubDefSub); + + let dataCategory:Category = new Category("Research data","","data",true,true); + topic.categories.push(dataCategory); + let dataDefSub = new SubCategory(null, null,null,true, true); + dataCategory.subCategories.push(dataDefSub); + + let softwareCategory:Category = new Category("Software","","software",true,true); + topic.categories.push(softwareCategory); + let softDefSub = new SubCategory(null, null,null,true, true); + softwareCategory.subCategories.push(softDefSub); + + /* let otherCategory:Category = new Category("Other research products","","other",true,true); + topic.categories.push(otherCategory); + let otherDefSub = new SubCategory(null, null,null,true, true); + otherCategory.subCategories.push(otherDefSub);*/ + + + return topic; + } + createCollaborationTopic():Topic{ + let topic = new Topic("Demo Topic","This is a demo topic","demo-topic",true,true); + + let category1:Category = new Category("Category 1","This is ","cat-1",true,true); + topic.categories.push(category1); + + + let subCat1 = new SubCategory("Sub-category 1","","sub-cat-1",true,true); + category1.subCategories.push(subCat1); + + + let subCat2 = new SubCategory("Sub-category 2","","sub-cat-2",true,true); + category1.subCategories.push(subCat2); + + + + let category2:Category = new Category("Category 2 - no subcategories","","cat-2",true,true); + topic.categories.push(category2); + let defSub = new SubCategory(null, null,null,true, true); + category2.subCategories.push(defSub); + + let chart1 = new Indicator( + "Chart title goes here","Chart description goes here", "chart","medium",true, true, + [new IndicatorPath("?", "fake","https://visme.co/blog/wp-content/uploads/2017/03/Dogs-vs-Cats-How-much-they-miss-you-relative-to-the-time-you-are-gone.png", null, null)]); + let chart2 = new Indicator("Chart title goes here","Chart description goes here", "chart","medium",true, true, [new IndicatorPath("?", "fake","https://static.boredpanda.com/blog/wp-content/uuuploads/funny-graphs-2/funny-graphs-legs.jpg", null, null)]); + subCat1.charts.push(chart1); + subCat2.charts.push(chart2); + + defSub.charts.push(chart1); + defSub.charts.push(chart2); + return topic; + } +} + + + + + +