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
|
Object.keys(indicatorPath.parameters).forEach(key => {
|
25
|
if (indicatorPath.parameters[key].indexOf("_funder_name_")!=-1) {
|
26
|
indicatorPath.parameters[key].replace("_funder_name_", funder.index_name);
|
27
|
} else if (indicatorPath.parameters[key].indexOf("_fsn_")!=-1) {
|
28
|
indicatorPath.parameters[key].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
|
n_total.indicatorPaths[0].filters["fundingL0"] = "&fq=relfundinglevel0_name exact "+ChartHelper.prefix+'fundingL0'+ChartHelper.suffix;
|
91
|
|
92
|
pubDefSub.numbers.push(n_total);
|
93
|
if( dbType != "publication") {
|
94
|
let n_linkedPubs = this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Publications","publication");
|
95
|
|
96
|
// new Indicator("Linked with Publications", null, "number", "small", true, true, [new IndicatorPath(null, "search",
|
97
|
// "/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"])]);
|
98
|
pubDefSub.numbers.push(n_linkedPubs);
|
99
|
}
|
100
|
|
101
|
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)]);
|
102
|
res_timeline.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typePlural+" timeline","column");
|
103
|
res_timeline.indicatorPaths[0].parameters["start_year"] = "2008";
|
104
|
res_timeline.indicatorPaths[0].parameters["end_year"] = "2020";
|
105
|
res_timeline.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType);
|
106
|
pubDefSub.charts.push(res_timeline);
|
107
|
|
108
|
|
109
|
if(dbType == "publication" || dbType == "dataset") {
|
110
|
|
111
|
let res_types = new Indicator("", null, "chart", "small", true, true,
|
112
|
[new IndicatorPath("column", "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 + '.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)]);
|
114
|
res_types.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " types", "bar");
|
115
|
res_types.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType);
|
116
|
pubDefSub.charts.push(res_types);
|
117
|
}
|
118
|
let res_access_mode = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("pie", "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+'.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)]);
|
120
|
res_access_mode.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typeSingl+" acccess mode","pie");
|
121
|
res_access_mode.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType);
|
122
|
pubDefSub.charts.push(res_access_mode);
|
123
|
|
124
|
if( dbType != "publication") {
|
125
|
let res_sci_area = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
|
126
|
'{"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)]);
|
127
|
res_sci_area.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " scientific area", "bar");
|
128
|
res_sci_area.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType);
|
129
|
pubDefSub.charts.push(res_sci_area);
|
130
|
|
131
|
let res_programmes = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
|
132
|
'{"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)]);
|
133
|
res_programmes.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " programmes", "bar");
|
134
|
res_programmes.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType);
|
135
|
pubDefSub.charts.push(res_programmes);
|
136
|
}
|
137
|
//{"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"}}}
|
138
|
let datasource = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("bar", "stats-tool", "chart?json=",
|
139
|
'{"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)]);
|
140
|
datasource.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typeSingl+" content provider","bar");
|
141
|
datasource.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
|
142
|
pubDefSub.charts.push(datasource);
|
143
|
if(dbType == "publication") {
|
144
|
let journal = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
|
145
|
'{"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)]);
|
146
|
journal.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " journal", "bar");
|
147
|
journal.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
|
148
|
pubDefSub.charts.push(journal);
|
149
|
|
150
|
let repo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
|
151
|
'{"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)]);
|
152
|
repo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " repositories", "bar");
|
153
|
repo.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
|
154
|
pubDefSub.charts.push(repo);
|
155
|
}
|
156
|
if(dbType == "dataset") {
|
157
|
let repo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
|
158
|
'{"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)]);
|
159
|
repo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " repositories", "bar");
|
160
|
repo.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
|
161
|
pubDefSub.charts.push(repo);
|
162
|
|
163
|
let irepo = new Indicator("", null, "chart", "small", true, true, [new IndicatorPath("bar", "stats-tool", "chart?json=",
|
164
|
'{"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)]);
|
165
|
irepo.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, typeSingl + " institutional repositories", "bar");
|
166
|
irepo.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
|
167
|
pubDefSub.charts.push(irepo);
|
168
|
}
|
169
|
|
170
|
|
171
|
let pid = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("pie", "stats-tool", "chart?json=",
|
172
|
'{"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)]);
|
173
|
pid.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typeSingl+" PIDs","pie");
|
174
|
pid.indicatorPaths[0].parameters["id"] = stakeholder.index_shortName.toLowerCase();
|
175
|
pid.indicatorPaths[0].filters = IndicatorPath.createResultFilters(dbType);
|
176
|
pubDefSub.charts.push(pid);
|
177
|
return pubDefSub;
|
178
|
}
|
179
|
static createOASub(){
|
180
|
let subCategories:SubCategory[] = [];
|
181
|
let overviewSub = new SubCategory("Overview", null,"overview",true, true);
|
182
|
subCategories.push(overviewSub);
|
183
|
let byScientificAreaSub = new SubCategory("By Scientific Area", null,"scientific-area",true, true);
|
184
|
subCategories.push(byScientificAreaSub);
|
185
|
let byProgramSub = new SubCategory("By Programme", null,"programme",true, true);
|
186
|
subCategories.push(byProgramSub);
|
187
|
return subCategories;
|
188
|
|
189
|
|
190
|
}
|
191
|
static createOpenAccessTopic(stakeholder:Stakeholder):Topic {
|
192
|
let topic = new Topic("Open Access", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...", "open-access", true, true);
|
193
|
|
194
|
let pubCategory:Category = new Category("Publications","","publications",true,true);
|
195
|
topic.categories.push(pubCategory);
|
196
|
pubCategory.subCategories = StakeholderCreator.createOASub();
|
197
|
|
198
|
let dataCategory:Category = new Category("Research data","","data",true,true);
|
199
|
topic.categories.push(dataCategory);
|
200
|
dataCategory.subCategories = StakeholderCreator.createOASub();
|
201
|
|
202
|
let softwareCategory:Category = new Category("Software","","software",true,true);
|
203
|
topic.categories.push(softwareCategory);
|
204
|
softwareCategory.subCategories = StakeholderCreator.createOASub();
|
205
|
|
206
|
let otherCategory:Category = new Category("Other research products","","other",true,true);
|
207
|
topic.categories.push(otherCategory);
|
208
|
|
209
|
otherCategory.subCategories = StakeholderCreator.createOASub();
|
210
|
|
211
|
return topic;
|
212
|
|
213
|
}
|
214
|
static createOSTopic(stakeholder:Stakeholder):Topic{
|
215
|
let topic = new Topic("Open Science","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","open-science",true,true);
|
216
|
|
217
|
let overview:Category = new Category("Overview","","overview",true,true);
|
218
|
topic.categories.push(overview);
|
219
|
overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Publications","Publication","publication","publications"));
|
220
|
overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Research data","Research data","dataset","datasets"));
|
221
|
overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Software","Software","software","software"));
|
222
|
overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Other research products","Other research product","other","other"));
|
223
|
|
224
|
return topic;
|
225
|
|
226
|
}
|
227
|
static createOSOverviewPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory {
|
228
|
|
229
|
let pubDefSub = new SubCategory(typePlural, null, dbTypePlural, true, true);
|
230
|
|
231
|
if( dbType != "publication") {
|
232
|
pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Publications","publication"));
|
233
|
}
|
234
|
if( dbType != "dataset") {
|
235
|
pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Research data","dataset"));
|
236
|
}
|
237
|
if( dbType != "software") {
|
238
|
pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Software","software"));
|
239
|
}
|
240
|
if( dbType != "other") {
|
241
|
pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Other Research products","other"));
|
242
|
}
|
243
|
return pubDefSub;
|
244
|
}
|
245
|
|
246
|
static createLinkToIndicator(stakeholder:Stakeholder,typePlural, typeSingl, dbType, linkedToName,linkedToType ):Indicator {
|
247
|
let n_linkedPubs = new Indicator(typePlural+" linked to "+linkedToName, null, "number", "small", true, true, [new IndicatorPath(null, "search",
|
248
|
"/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"])]);
|
249
|
n_linkedPubs.indicatorPaths[0].filters["fundingL0"] = "&fq=relfundinglevel0_name exact "+ChartHelper.prefix+'fundingL0'+ChartHelper.suffix;
|
250
|
/*
|
251
|
filters.set("start_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":">=","values":["'+ChartHelper.prefix+'start_year'+ChartHelper.suffix+'"]}],"op":"AND"}');
|
252
|
filters.set("end_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":"<=","values":["'+ChartHelper.prefix+'end_year'+ChartHelper.suffix+'"]}],"op":"AND"}');
|
253
|
*/
|
254
|
return n_linkedPubs;
|
255
|
}
|
256
|
static createFundingImpactTopic():Topic{
|
257
|
let topic = new Topic("Impact/Correlation","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","impact",true,true);
|
258
|
|
259
|
let pubCategory:Category = new Category("Publications","","publications",true,true);
|
260
|
topic.categories.push(pubCategory);
|
261
|
let pubDefSub = new SubCategory(null, null,null,true, true);
|
262
|
pubCategory.subCategories.push(pubDefSub);
|
263
|
|
264
|
let dataCategory:Category = new Category("Research data","","data",true,true);
|
265
|
topic.categories.push(dataCategory);
|
266
|
let dataDefSub = new SubCategory(null, null,null,true, true);
|
267
|
dataCategory.subCategories.push(dataDefSub);
|
268
|
|
269
|
let softwareCategory:Category = new Category("Software","","software",true,true);
|
270
|
topic.categories.push(softwareCategory);
|
271
|
let softDefSub = new SubCategory(null, null,null,true, true);
|
272
|
softwareCategory.subCategories.push(softDefSub);
|
273
|
|
274
|
/* let otherCategory:Category = new Category("Other research products","","other",true,true);
|
275
|
topic.categories.push(otherCategory);
|
276
|
let otherDefSub = new SubCategory(null, null,null,true, true);
|
277
|
otherCategory.subCategories.push(otherDefSub);*/
|
278
|
|
279
|
|
280
|
return topic;
|
281
|
}
|
282
|
createCollaborationTopic():Topic{
|
283
|
let topic = new Topic("Demo Topic","This is a demo topic","demo-topic",true,true);
|
284
|
|
285
|
let category1:Category = new Category("Category 1","This is ","cat-1",true,true);
|
286
|
topic.categories.push(category1);
|
287
|
|
288
|
|
289
|
let subCat1 = new SubCategory("Sub-category 1","","sub-cat-1",true,true);
|
290
|
category1.subCategories.push(subCat1);
|
291
|
|
292
|
|
293
|
let subCat2 = new SubCategory("Sub-category 2","","sub-cat-2",true,true);
|
294
|
category1.subCategories.push(subCat2);
|
295
|
|
296
|
|
297
|
|
298
|
let category2:Category = new Category("Category 2 - no subcategories","","cat-2",true,true);
|
299
|
topic.categories.push(category2);
|
300
|
let defSub = new SubCategory(null, null,null,true, true);
|
301
|
category2.subCategories.push(defSub);
|
302
|
|
303
|
let chart1 = new Indicator(
|
304
|
"Chart title goes here","Chart description goes here", "chart","medium",true, true,
|
305
|
[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)]);
|
306
|
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)]);
|
307
|
subCat1.charts.push(chart1);
|
308
|
subCat2.charts.push(chart2);
|
309
|
|
310
|
defSub.charts.push(chart1);
|
311
|
defSub.charts.push(chart2);
|
312
|
return topic;
|
313
|
}
|
314
|
}
|
315
|
|
316
|
|
317
|
|
318
|
|
319
|
|
320
|
|