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) { Object.keys(indicatorPath.parameters).forEach(key => { if (indicatorPath.parameters[key].indexOf("_funder_name_")!=-1) { indicatorPath.parameters[key].replace("_funder_name_", funder.index_name); } else if (indicatorPath.parameters[key].indexOf("_fsn_")!=-1) { indicatorPath.parameters[key].toString().replace("_fsn_", funder.index_shortName.toLowerCase()); } }); } } } for (let indicator of subCategory.numbers) { for (let indicatorPath of indicator.indicatorPaths) { indicatorPath.url = indicatorPath.url.replace("_funder_id_", funder.index_id); // 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 n_total = new Indicator("Total "+typePlural,null, "number","small",true, true, [new IndicatorPath(null, "search", "/"+dbTypePlural+"/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]); n_total.indicatorPaths[0].filters["fundingL0"] = "&fq=relfundinglevel0_name exact "+ChartHelper.prefix+'fundingL0'+ChartHelper.suffix; pubDefSub.numbers.push(n_total); if( dbType != "publication") { let n_linkedPubs = this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Publications","publication"); // new Indicator("Linked with Publications", null, "number", "small", true, true, [new IndicatorPath(null, "search", // "/resources?query="+encodeURIComponent(" ( (oaftype exact result) and (resulttypeid exact " + dbTypePlural + ") and (relresulttype=publication) )")+"&fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&page=0&size=0&format=json", null, ["meta","total"])]); pubDefSub.numbers.push(n_linkedPubs); } 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":["'+ChartHelper.prefix+'start_year'+ChartHelper.suffix+'"]},{"field":"'+dbType+'.year","type":"<=","values":["'+ChartHelper.prefix+'end_year'+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_timeline.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typePlural+" timeline","column"); res_timeline.indicatorPaths[0].parameters["start_year"] = "2008"; res_timeline.indicatorPaths[0].parameters["end_year"] = "2020"; res_timeline.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType); 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"); res_types.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType); 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"); res_access_mode.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType); 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"); res_sci_area.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType); 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"); res_programmes.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType); 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["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["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["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["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["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["id"] = stakeholder.index_shortName.toLowerCase(); pid.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType); 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); overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Publications","Publication","publication","publications")); overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Research data","Research data","dataset","datasets")); overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Software","Software","software","software")); overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Other research products","Other research product","other","other")); return topic; } static createOSOverviewPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory { let pubDefSub = new SubCategory(typePlural, null, dbTypePlural, true, true); if( dbType != "publication") { pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Publications","publication")); } if( dbType != "dataset") { pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Research data","dataset")); } if( dbType != "software") { pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Software","software")); } if( dbType != "other") { pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Other Research products","other")); } return pubDefSub; } static createLinkToIndicator(stakeholder:Stakeholder,typePlural, typeSingl, dbType, linkedToName,linkedToType ):Indicator { let n_linkedPubs = new Indicator(typePlural+" linked to "+linkedToName, null, "number", "small", true, true, [new IndicatorPath(null, "search", "/resources?query=" + encodeURIComponent(" ( (oaftype exact result) and (resulttypeid exact " + dbType + ") and (relresulttype="+linkedToType+") )") + "&fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&page=0&size=0&format=json", null, ["meta", "total"])]); n_linkedPubs.indicatorPaths[0].filters["fundingL0"] = "&fq=relfundinglevel0_name exact "+ChartHelper.prefix+'fundingL0'+ChartHelper.suffix; /* filters.set("start_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":">=","values":["'+ChartHelper.prefix+'start_year'+ChartHelper.suffix+'"]}],"op":"AND"}'); filters.set("end_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":"<=","values":["'+ChartHelper.prefix+'end_year'+ChartHelper.suffix+'"]}],"op":"AND"}'); */ return n_linkedPubs; } 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; } }