1
|
import {Stakeholder,Topic,Category,SubCategory,Indicator, IndicatorPath, ChartHelper} from "./stakeholder";
|
2
|
|
3
|
export class StakeholderCreator {
|
4
|
|
5
|
static createFunderDefaultProfile():Stakeholder{
|
6
|
let funder:Stakeholder = new Stakeholder(null,"funder","_funder_id_","_funder_name_","_FSN_",true,"deafult_funder",true,true);
|
7
|
funder.topics.push(StakeholderCreator.createResearchProductionTopic(funder));
|
8
|
funder.topics.push(StakeholderCreator.createOpenAccessTopic(funder));
|
9
|
|
10
|
funder.topics.push(StakeholderCreator.createOSTopic(funder));
|
11
|
funder.topics.push(funder.createImpactTopic());
|
12
|
funder.topics.push(funder.createCollaborationTopic());
|
13
|
return funder;
|
14
|
}
|
15
|
static createFunderFromDefaultProfile(id: string, type: string, index_id, index_name: string, index_shortName:string , isDefaultProfile: boolean, alias:string , isActive: boolean, isPublic: boolean):Stakeholder{
|
16
|
let funder:Stakeholder = StakeholderCreator.createFunderDefaultProfile();
|
17
|
funder.initializeFunder(id,type, index_id, index_name, index_shortName, isDefaultProfile, alias, isActive, isPublic);
|
18
|
for (let topic of funder.topics) {
|
19
|
for (let category of topic.categories) {
|
20
|
for (let subCategory of category.subCategories) {
|
21
|
for (let indicator of subCategory.charts) {
|
22
|
for (let indicatorPath of indicator.indicatorPaths) {
|
23
|
if(indicatorPath.parameters) {
|
24
|
indicatorPath.parameters.forEach((value: string, key: string) => {
|
25
|
if (value.indexOf("_funder_name_")!=-1) {
|
26
|
indicatorPath.parameters.set(key,value.toString().replace("_funder_name_", funder.index_name));
|
27
|
}else if (value.indexOf("_fsn_")!=-1) {
|
28
|
indicatorPath.parameters.set(key,value.toString().replace("_fsn_", funder.index_shortName.toLowerCase()));
|
29
|
}
|
30
|
});
|
31
|
}
|
32
|
}
|
33
|
}
|
34
|
for (let indicator of subCategory.numbers) {
|
35
|
for (let indicatorPath of indicator.indicatorPaths) {
|
36
|
indicatorPath.url = indicatorPath.url.replace("_funder_id_", funder.index_id);
|
37
|
// if(indicatorPath.parameters) {
|
38
|
// indicatorPath.parameters.forEach((value: string, key: string) => {
|
39
|
// if (value.indexOf("_funder_name_")!=-1) {
|
40
|
// indicatorPath.parameters.set(key,value.toString().replace("_funder_name_", funder.index_name));
|
41
|
// }else if (value.indexOf("_fsn_")!=-1) {
|
42
|
// indicatorPath.parameters.set(key,value.toString().replace("_fsn_", funder.index_shortName.toLowerCase()));
|
43
|
// }
|
44
|
// });
|
45
|
// }
|
46
|
}
|
47
|
}
|
48
|
|
49
|
}
|
50
|
|
51
|
}
|
52
|
|
53
|
}
|
54
|
return funder;
|
55
|
}
|
56
|
|
57
|
static createResearchProductionTopic(stakeholder:Stakeholder):Topic {
|
58
|
let topic = new Topic("Research production", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...", "research-production", true, true);
|
59
|
|
60
|
let pubCategory:Category = new Category("Publications","","publications",true,true);
|
61
|
topic.categories.push(pubCategory);
|
62
|
let pubDefSub = StakeholderCreator.createResearchProductionPerType(stakeholder,"Publications", "Publication","publication", "publications");
|
63
|
pubCategory.subCategories.push(pubDefSub);
|
64
|
|
65
|
let dataCategory:Category = new Category("Research data","","data",true,true);
|
66
|
topic.categories.push(dataCategory);
|
67
|
let dataDefSub = StakeholderCreator.createResearchProductionPerType(stakeholder,"Research data", "Research data","dataset", "datasets");
|
68
|
dataCategory.subCategories.push(dataDefSub);
|
69
|
|
70
|
let softwareCategory:Category = new Category("Software","","software",true,true);
|
71
|
topic.categories.push(softwareCategory);
|
72
|
let softDefSub = StakeholderCreator.createResearchProductionPerType(stakeholder,"Software", "Software","software", "datasets");
|
73
|
softwareCategory.subCategories.push(softDefSub);
|
74
|
|
75
|
let otherCategory:Category = new Category("Other research products","","other",true,true);
|
76
|
topic.categories.push(otherCategory);
|
77
|
let otherDefSub = StakeholderCreator.createResearchProductionPerType(stakeholder,"Other research products", "Other research product","other", "other");
|
78
|
otherCategory.subCategories.push(otherDefSub);
|
79
|
|
80
|
|
81
|
return topic;
|
82
|
|
83
|
}
|
84
|
static createResearchProductionPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory{
|
85
|
|
86
|
let pubDefSub = new SubCategory(typePlural, null,null,true, true);
|
87
|
|
88
|
let n_total = new Indicator("Total "+typePlural,null, "number","small",true, true, [new IndicatorPath(null, "search",
|
89
|
"/"+dbTypePlural+"/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]);
|
90
|
pubDefSub.numbers.push(n_total);
|
91
|
if( dbType != "publication") {
|
92
|
let n_linkedPubs = this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Publications","publication");
|
93
|
|
94
|
// new Indicator("Linked with Publications", null, "number", "small", true, true, [new IndicatorPath(null, "search",
|
95
|
// "/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"])]);
|
96
|
pubDefSub.numbers.push(n_linkedPubs);
|
97
|
}
|
98
|
|
99
|
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)]);
|
100
|
res_timeline.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typePlural+" timeline","column");
|
101
|
pubDefSub.charts.push(res_timeline);
|
102
|
|
103
|
|
104
|
if(dbType == "publication" || dbType == "dataset") {
|
105
|
|
106
|
let res_types = new Indicator("", null, "chart", "small", true, true,
|
107
|
[new IndicatorPath("column", "stats-tool", "chart?json=",
|
108
|
'{"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)]);
|
109
|
res_types.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " types", "bar");
|
110
|
pubDefSub.charts.push(res_types);
|
111
|
}
|
112
|
let res_access_mode = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("pie", "stats-tool", "chart?json=",
|
113
|
'{"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)]);
|
114
|
res_access_mode.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typeSingl+" acccess mode","pie");
|
115
|
pubDefSub.charts.push(res_access_mode);
|
116
|
|
117
|
if( dbType != "publication") {
|
118
|
let res_sci_area = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
|
119
|
'{"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)]);
|
120
|
res_sci_area.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " scientific area", "bar");
|
121
|
pubDefSub.charts.push(res_sci_area);
|
122
|
|
123
|
let res_programmes = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
|
124
|
'{"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)]);
|
125
|
res_programmes.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " programmes", "bar");
|
126
|
pubDefSub.charts.push(res_programmes);
|
127
|
}
|
128
|
//{"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"}}}
|
129
|
let datasource = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("bar", "stats-tool", "chart?json=",
|
130
|
'{"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)]);
|
131
|
datasource.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typeSingl+" content provider","bar");
|
132
|
datasource.indicatorPaths[0].parameters.set("id",stakeholder.index_shortName.toLowerCase());
|
133
|
pubDefSub.charts.push(datasource);
|
134
|
if(dbType == "publication") {
|
135
|
let journal = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
|
136
|
'{"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)]);
|
137
|
journal.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " journal", "bar");
|
138
|
journal.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase());
|
139
|
pubDefSub.charts.push(journal);
|
140
|
|
141
|
let repo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
|
142
|
'{"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)]);
|
143
|
repo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " repositories", "bar");
|
144
|
repo.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase());
|
145
|
pubDefSub.charts.push(repo);
|
146
|
}
|
147
|
if(dbType == "dataset") {
|
148
|
let repo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
|
149
|
'{"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)]);
|
150
|
repo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " repositories", "bar");
|
151
|
repo.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase());
|
152
|
pubDefSub.charts.push(repo);
|
153
|
|
154
|
let irepo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
|
155
|
'{"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)]);
|
156
|
irepo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " institutional repositories", "bar");
|
157
|
irepo.indicatorPaths[0].parameters.set("id", stakeholder.index_shortName.toLowerCase());
|
158
|
pubDefSub.charts.push(irepo);
|
159
|
}
|
160
|
|
161
|
|
162
|
let pid = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("pie", "stats-tool", "chart?json=",
|
163
|
'{"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)]);
|
164
|
pid.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typeSingl+" PIDs","pie");
|
165
|
pid.indicatorPaths[0].parameters.set("id",stakeholder.index_shortName.toLowerCase());
|
166
|
pubDefSub.charts.push(pid);
|
167
|
return pubDefSub;
|
168
|
}
|
169
|
static createOASub(){
|
170
|
let subCategories:SubCategory[] = [];
|
171
|
let overviewSub = new SubCategory("Overview", null,"overview",true, true);
|
172
|
subCategories.push(overviewSub);
|
173
|
let byScientificAreaSub = new SubCategory("By Scientific Area", null,"scientific-area",true, true);
|
174
|
subCategories.push(byScientificAreaSub);
|
175
|
let byProgramSub = new SubCategory("By Programme", null,"programme",true, true);
|
176
|
subCategories.push(byProgramSub);
|
177
|
return subCategories;
|
178
|
|
179
|
|
180
|
}
|
181
|
static createOpenAccessTopic(stakeholder:Stakeholder):Topic {
|
182
|
let topic = new Topic("Open Access", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...", "open-access", true, true);
|
183
|
|
184
|
let pubCategory:Category = new Category("Publications","","publications",true,true);
|
185
|
topic.categories.push(pubCategory);
|
186
|
pubCategory.subCategories = StakeholderCreator.createOASub();
|
187
|
|
188
|
let dataCategory:Category = new Category("Research data","","data",true,true);
|
189
|
topic.categories.push(dataCategory);
|
190
|
dataCategory.subCategories = StakeholderCreator.createOASub();
|
191
|
|
192
|
let softwareCategory:Category = new Category("Software","","software",true,true);
|
193
|
topic.categories.push(softwareCategory);
|
194
|
softwareCategory.subCategories = StakeholderCreator.createOASub();
|
195
|
|
196
|
let otherCategory:Category = new Category("Other research products","","other",true,true);
|
197
|
topic.categories.push(otherCategory);
|
198
|
|
199
|
otherCategory.subCategories = StakeholderCreator.createOASub();
|
200
|
|
201
|
return topic;
|
202
|
|
203
|
}
|
204
|
static createOSTopic(stakeholder:Stakeholder):Topic{
|
205
|
let topic = new Topic("Open Science","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","open-science",true,true);
|
206
|
|
207
|
let overview:Category = new Category("Overview","","overview",true,true);
|
208
|
topic.categories.push(overview);
|
209
|
overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Publications","Publication","publication","publications"));
|
210
|
overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Research data","Research data","dataset","datasets"));
|
211
|
overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Software","Software","software","software"));
|
212
|
overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Other research products","Other research product","other","other"));
|
213
|
|
214
|
return topic;
|
215
|
|
216
|
}
|
217
|
static createOSOverviewPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory {
|
218
|
|
219
|
let pubDefSub = new SubCategory(typePlural, null, dbTypePlural, true, true);
|
220
|
|
221
|
if( dbType != "publication") {
|
222
|
pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Publications","publication"));
|
223
|
}
|
224
|
if( dbType != "dataset") {
|
225
|
pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Research data","dataset"));
|
226
|
}
|
227
|
if( dbType != "software") {
|
228
|
pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Software","software"));
|
229
|
}
|
230
|
if( dbType != "other") {
|
231
|
pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Other Research products","other"));
|
232
|
}
|
233
|
return pubDefSub;
|
234
|
}
|
235
|
|
236
|
static createLinkToIndicator(stakeholder:Stakeholder,typePlural, typeSingl, dbType, linkedToName,linkedToType ):Indicator {
|
237
|
let n_linkedPubs = new Indicator(typePlural+" linked to "+linkedToName, null, "number", "small", true, true, [new IndicatorPath(null, "search",
|
238
|
"/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"])]);
|
239
|
|
240
|
return n_linkedPubs;
|
241
|
}
|
242
|
static createFundingImpactTopic():Topic{
|
243
|
let topic = new Topic("Impact/Correlation","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","impact",true,true);
|
244
|
|
245
|
let pubCategory:Category = new Category("Publications","","publications",true,true);
|
246
|
topic.categories.push(pubCategory);
|
247
|
let pubDefSub = new SubCategory(null, null,null,true, true);
|
248
|
pubCategory.subCategories.push(pubDefSub);
|
249
|
|
250
|
let dataCategory:Category = new Category("Research data","","data",true,true);
|
251
|
topic.categories.push(dataCategory);
|
252
|
let dataDefSub = new SubCategory(null, null,null,true, true);
|
253
|
dataCategory.subCategories.push(dataDefSub);
|
254
|
|
255
|
let softwareCategory:Category = new Category("Software","","software",true,true);
|
256
|
topic.categories.push(softwareCategory);
|
257
|
let softDefSub = new SubCategory(null, null,null,true, true);
|
258
|
softwareCategory.subCategories.push(softDefSub);
|
259
|
|
260
|
/* let otherCategory:Category = new Category("Other research products","","other",true,true);
|
261
|
topic.categories.push(otherCategory);
|
262
|
let otherDefSub = new SubCategory(null, null,null,true, true);
|
263
|
otherCategory.subCategories.push(otherDefSub);*/
|
264
|
|
265
|
|
266
|
return topic;
|
267
|
}
|
268
|
createCollaborationTopic():Topic{
|
269
|
let topic = new Topic("Demo Topic","This is a demo topic","demo-topic",true,true);
|
270
|
|
271
|
let category1:Category = new Category("Category 1","This is ","cat-1",true,true);
|
272
|
topic.categories.push(category1);
|
273
|
|
274
|
|
275
|
let subCat1 = new SubCategory("Sub-category 1","","sub-cat-1",true,true);
|
276
|
category1.subCategories.push(subCat1);
|
277
|
|
278
|
|
279
|
let subCat2 = new SubCategory("Sub-category 2","","sub-cat-2",true,true);
|
280
|
category1.subCategories.push(subCat2);
|
281
|
|
282
|
|
283
|
|
284
|
let category2:Category = new Category("Category 2 - no subcategories","","cat-2",true,true);
|
285
|
topic.categories.push(category2);
|
286
|
let defSub = new SubCategory(null, null,null,true, true);
|
287
|
category2.subCategories.push(defSub);
|
288
|
|
289
|
let chart1 = new Indicator(
|
290
|
"Chart title goes here","Chart description goes here", "chart","medium",true, true,
|
291
|
[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)]);
|
292
|
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)]);
|
293
|
subCat1.charts.push(chart1);
|
294
|
subCat2.charts.push(chart2);
|
295
|
|
296
|
defSub.charts.push(chart1);
|
297
|
defSub.charts.push(chart2);
|
298
|
return topic;
|
299
|
}
|
300
|
}
|
301
|
|
302
|
|
303
|
|
304
|
|
305
|
|
306
|
|