1
|
import {SafeResourceUrl} from "@angular/platform-browser";
|
2
|
import {IndicatorUtils} from "../indicator-utils";
|
3
|
|
4
|
export const ChartHelper = {
|
5
|
prefix: "((__",
|
6
|
suffix: "__))"
|
7
|
};
|
8
|
|
9
|
export class Stakeholder {
|
10
|
_id: string;
|
11
|
type: string;
|
12
|
index_id;
|
13
|
index_name: string;
|
14
|
index_shortName: string;
|
15
|
alias: string;
|
16
|
isDefaultProfile: boolean;
|
17
|
isActive: boolean;
|
18
|
isPublic: boolean;
|
19
|
creationDate: string;
|
20
|
updateDate: string;
|
21
|
managers: string[];
|
22
|
topics: Topic[];
|
23
|
|
24
|
constructor(id: string, type: string, index_id, index_name: string, index_shortName: string, isDefaultProfile: boolean, alias: string, isActive: boolean, isPublic: boolean) {
|
25
|
this.initializeFunder(id, type, index_id, index_name, index_shortName, isDefaultProfile, alias, isActive, isPublic);
|
26
|
this.topics = [];
|
27
|
this.managers = [];
|
28
|
}
|
29
|
|
30
|
initializeFunder(id: string, type: string, index_id, index_name: string, index_shortName: string, isDefaultProfile: boolean, alias: string, isActive: boolean, isPublic: boolean) {
|
31
|
this._id = id;
|
32
|
this.type = type;
|
33
|
this.index_id = index_id;
|
34
|
this.index_name = index_name;
|
35
|
this.index_shortName = index_shortName;
|
36
|
this.isDefaultProfile = isDefaultProfile;
|
37
|
this.alias = alias;
|
38
|
this.isActive = isActive;
|
39
|
this.isPublic = isPublic;
|
40
|
}
|
41
|
|
42
|
static createECStakeholder(): Stakeholder {
|
43
|
let ec: Stakeholder = new Stakeholder("ec", "funder", "ec__________::EC", "European Commission", "EC", false, "ec", true, true);
|
44
|
// new Stakeholder('wt','funder','wt__________::WT','Wellcome Trust','WT',false, 'wt',true,true);
|
45
|
ec.topics.push(ec.createOSTopic(ec));
|
46
|
ec.topics.push(ec.createImpactTopic());
|
47
|
ec.topics.push(ec.createCollaborationTopic());
|
48
|
return ec;
|
49
|
}
|
50
|
|
51
|
createOSTopic(stakeholder: Stakeholder): Topic {
|
52
|
let topic = new Topic("OpenScience", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...", "open-science", true, true);
|
53
|
|
54
|
/* let overview:Category = new Category("Overview","","overview",true,true);
|
55
|
topic.categories.push(overview);
|
56
|
let overviewDefSub = new SubCategory(null, null,null,true, true);
|
57
|
overview.subCategories.push(overviewDefSub);*/
|
58
|
|
59
|
|
60
|
let pubCategory: Category = new Category("Publications", "", "publications", true, true);
|
61
|
topic.categories.push(pubCategory);
|
62
|
let pubDefSub = new SubCategory(null, null, null, true, true);
|
63
|
pubCategory.subCategories.push(pubDefSub);
|
64
|
/* let pubOpenSub = new SubCategory("Openess","","openness",true,true);
|
65
|
pubCategory.subCategories.push(pubOpenSub);
|
66
|
let pubFundingSub = new SubCategory("Funding","","funding",true,true);
|
67
|
pubCategory.subCategories.push(pubFundingSub);
|
68
|
let pubDatasourceSub = new SubCategory("Content Providers","","content-providers",true,true);
|
69
|
pubCategory.subCategories.push(pubDatasourceSub);
|
70
|
let pubDocTypeSub = new SubCategory("Document Type","","doc-type",true,true);
|
71
|
pubCategory.subCategories.push(pubDocTypeSub);
|
72
|
let pubFindSub = new SubCategory("Findability","","dindability",true,true);
|
73
|
pubCategory.subCategories.push(pubFindSub);*/
|
74
|
|
75
|
|
76
|
let dataCategory: Category = new Category("Research data", "", "data", true, true);
|
77
|
topic.categories.push(dataCategory);
|
78
|
let dataDefSub = new SubCategory(null, null, null, true, true);
|
79
|
dataCategory.subCategories.push(dataDefSub);
|
80
|
|
81
|
let softwareCategory: Category = new Category("Software", "", "software", true, true);
|
82
|
topic.categories.push(softwareCategory);
|
83
|
let softDefSub = new SubCategory(null, null, null, true, true);
|
84
|
softwareCategory.subCategories.push(softDefSub);
|
85
|
|
86
|
let otherCategory: Category = new Category("Other research products", "", "other", true, true);
|
87
|
topic.categories.push(otherCategory);
|
88
|
let otherDefSub = new SubCategory(null, null, null, true, true);
|
89
|
otherCategory.subCategories.push(otherDefSub);
|
90
|
|
91
|
/* let datasourceCategory:Category = new Category("Content Providers","","content-providers",true,true);
|
92
|
topic.categories.push(datasourceCategory);
|
93
|
let datasourceDefSub = new SubCategory(null, null,null,true, true);
|
94
|
datasourceCategory.subCategories.push(datasourceDefSub);*/
|
95
|
|
96
|
let projectCategory: Category = new Category("Projects", "", "projects", true, true);
|
97
|
topic.categories.push(projectCategory);
|
98
|
let projectDefSub = new SubCategory(null, null, null, true, true);
|
99
|
projectCategory.subCategories.push(projectDefSub);
|
100
|
|
101
|
//Numbers
|
102
|
|
103
|
let n_total_pubs = new Indicator("Publications", 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "number", "small", true, true, [new IndicatorPath(null, "statistics", "/funders/" + stakeholder._id, null, ["statistics", "publications"])]);
|
104
|
let n_open_pubs = new Indicator("OA Publications", 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "number", "small", true, true, [new IndicatorPath(null, "statistics", "/funders/" + stakeholder._id, null, ["statistics", "open_access"])]);
|
105
|
let n_total_projects = new Indicator("Projects", null, "number", "small", true, true, [new IndicatorPath(null, "statistics", "/funders/" + stakeholder._id, null, ["statistics", "total_projects"])]);
|
106
|
let n_total_data = new Indicator("Reserach data", null, "number", "small", true, true, [new IndicatorPath(null, "search",
|
107
|
"/datasets/count?fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&format=json", null, ["total"])]);
|
108
|
let n_total_soft = new Indicator("Software", null, "number", "small", true, true, [new IndicatorPath(null, "search",
|
109
|
"/software/count?fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&format=json", null, ["total"])]);
|
110
|
let n_total_other = new Indicator("Other research products", null, "number", "small", true, true, [new IndicatorPath(null, "search",
|
111
|
"/other/count?fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&format=json", null, ["total"])]);
|
112
|
|
113
|
/*overviewDefSub.numbers.push(n_total_pubs);
|
114
|
overviewDefSub.numbers.push(n_open_pubs);
|
115
|
overviewDefSub.numbers.push(n_total_projects);
|
116
|
overviewDefSub.numbers.push(n_total_data);
|
117
|
overviewDefSub.numbers.push(n_total_soft);
|
118
|
overviewDefSub.numbers.push(n_total_other);*/
|
119
|
|
120
|
pubDefSub.numbers.push(n_total_pubs);
|
121
|
pubDefSub.numbers.push(n_open_pubs);
|
122
|
softDefSub.numbers.push(n_total_soft);
|
123
|
dataDefSub.numbers.push(n_total_data);
|
124
|
otherDefSub.numbers.push(n_total_other);
|
125
|
|
126
|
projectDefSub.numbers.push(n_total_projects);
|
127
|
|
128
|
//Charts
|
129
|
|
130
|
let c_pubs_per_project = new Indicator("Which are the top " + stakeholder.index_shortName + " projects?", 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...', "chart", "large", true, true, [
|
131
|
new IndicatorPath("bar", "old", "chart.php?com=query&data=", '{"table":"result","fields":[{"fld":"number","agg":"count","type":"' + ChartHelper.prefix + 'type' + ChartHelper.suffix + '","yaxis":1,"c":false}],"xaxis":{"name":"result_projects-project-acronym","agg":"avg"},"group":"","color":"","type":"chart","size":30,"sort":"count-number","yaxisheaders":[""],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"result_projects-project-funder","values":["' + ChartHelper.prefix + 'funder_name' + ChartHelper.suffix + '"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"}],"having":[],"xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"title":"' + ChartHelper.prefix + 'title' + ChartHelper.suffix + '","subtitle":"","xaxistitle":"project","order":"d"}', null)]);
|
132
|
c_pubs_per_project.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name, "Publications per project (top 30)", "bar");
|
133
|
pubDefSub.charts.push(c_pubs_per_project);
|
134
|
|
135
|
//TO check
|
136
|
/* let c_pubs_per_datasource = new Indicator("Which are the top repositories containing "+stakeholder.index_shortName+" research outputs?",null, "chart","small",false,
|
137
|
true, [new IndicatorPath("column", "old", "chart.php?com=query&data="+encodeURIComponent('{"table":"result","fields":[{"fld":"number","agg":"count","type":"column","yaxis":1,"c":false}],"xaxis":{"name":"result_datasources-datasource-name","agg":"avg"},"group":"","color":"","type":"chart","size":"20","sort":"count-number","yaxisheaders":[""],"fieldsheaders":["publications"],"in":[],"filters":[{"name":"type","values":["publication"],"to":"-1"},{"name":"result_projects-project-funder","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"],"to":"-1"},{"name":"result_datasources-datasource-type","exvalues":["Publication Catalogue"]}],"having":[],"xStyle":{"r":-90,"s":"-","l":"-","ft":10,"wt":"-"},"title":"Publications by content provider (top 20)","subtitle":"","xaxistitle":"content providers","order":"d"}'), null)]);
|
138
|
pubDefSub.charts.push(c_pubs_per_datasource);
|
139
|
|
140
|
let c_pubs_per_doc_type = new Indicator("In what type of documents do your researchers used to publish?",null, "chart","small",true, true,
|
141
|
[new IndicatorPath("bar", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"colors":["#42a5f5","#26a69a","#90ed7d","#607d8b","#00838f","#689f38","#e4d354","#2b908f","#546e7a","#01579"],"queries":[{"name":"Data","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.classification","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},{"field":"result.type","type":"=","values":["publication"]}],"op":"AND"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"publications"},"subtitle":{"text":"per document type"},"yAxis":{"title":{"text":"Publications"}},"xAxis":{"title":{"text":"Document Type"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":false,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
|
142
|
pubDefSub.charts.push(c_pubs_per_doc_type);
|
143
|
|
144
|
let c_pubs_funding_scheme = new Indicator("What is the percentage publications by funding scheme / programme?",null, "chart","small",true,
|
145
|
true, [new IndicatorPath("bar", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"colors":["#42a5f5","#26a69a","#90ed7d","#607d8b","#00838f","#689f38","#e4d354","#2b908f","#546e7a","#01579"],"queries":[{"name":"Open Access","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},{"field":"result.project.funding level 0","type":"=","values":["H2020"]},{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}},{"name":"Total","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},{"field":"result.type","type":"=","values":["publication"]}],"op":"AND"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Publications"},"subtitle":{"text":"by funding scheme"},"yAxis":{"title":{"text":"Publications"}},"xAxis":{"title":{"text":"Funding scheme"}},"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
|
pubDefSub.charts.push(c_pubs_funding_scheme);
|
147
|
*/
|
148
|
/* //TODO check why doesn't load
|
149
|
let c_pubs_gg_funding_scheme = new Indicator("What is the percentage of green and gold publications by funding scheme / programme?",null, "chart","medium",true,
|
150
|
true, [new IndicatorPath("bar", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"colors":["#42a5f5","#26a69a","#90ed7d","#607d8b","#00838f","#689f38","#e4d354","#2b908f","#546e7a","#01579"],"queries":[{"name":"Gold","color":"#f8b500","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},,{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"result.datasource.type","type":"=","values":["Journal"]},{"field":"result.datasource.type","type":"=","values":["Journal Aggregator/Publisher"]}],"op":"OR"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}},{"name":"Green","color":"#239d60","type":"bar","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.project.funding level 1","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},{"field":"result.project.funding level 0","type":"=","values":["H2020"]},{"field":"result.type","type":"=","values":["publication"]},{"field":"result.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"result.datasource.type","type":"=","values":["Institutional Repository"]},{"field":"result.datasource.type","type":"=","values":["Thematic Repository"]}],"op":"OR"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"H2020 green and gold publications"},"subtitle":{"text":"by funding scheme"},"yAxis":{"title":{"text":"Publications"}},"xAxis":{"title":{"text":"Funding scheme"}},"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)]);
|
151
|
//pubDefSub.charts.push(c_pubs_gg_funding_scheme);
|
152
|
*/
|
153
|
|
154
|
/* let c_pubs_open = new Indicator("Open Access publications timeline",null, "chart","small",true, true,
|
155
|
[new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"OA publications","type":"column","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"publication.year","type":">=","values":["2000"]},{"field":"publication.year","type":"<=","values":["2019"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Open Access Publications"},"subtitle":{},"yAxis":{"title":{"text":"publications"}},"xAxis":{"title":{"text":"year"}},"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)]);
|
156
|
pubDefSub.charts.push(c_pubs_open);
|
157
|
|
158
|
let c_pubs_access_modes = new Indicator("How your Open Access publications are shaped over the years?",null, "chart","medium",true, true,
|
159
|
[new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"OA publications","type":"column","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null},{"field":"publication.access mode","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.year","type":">=","values":["2000"]},{"field":"publication.year","type":"<=","values":["2019"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"2000"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Publications by Access Mode"},"subtitle":{},"yAxis":{"title":{"text":"publications"}},"xAxis":{"title":{"text":"year"}},"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)]);
|
160
|
pubDefSub.charts.push(c_pubs_access_modes);
|
161
|
|
162
|
// let c_pubs_av_embargo = new Indicator("Average period of embargoed publications",null, "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)]);
|
163
|
// pubDefSub.charts.push(c_pubs_av_embargo);
|
164
|
|
165
|
let c_pubs_OA_journals = new Indicator("Publications in OA Journals over time",null, "chart","medium",true, true,
|
166
|
[new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"OA publications","type":"column","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.year","type":">=","values":["2000"]},{"field":"publication.year","type":"<=","values":["2019"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]}],"op":"AND"},{"groupFilters":[{"field":"publication.datasource.id","type":"starts_with","values":["doaj"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"2000"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Publications by OA Journals"},"subtitle":{},"yAxis":{"title":{"text":"publications"}},"xAxis":{"title":{"text":"year"}},"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)]);
|
167
|
pubDefSub.charts.push(c_pubs_OA_journals);
|
168
|
|
169
|
//from monitor
|
170
|
let c_pubs_repo = new Indicator("OA publications in repositories by year",null, "chart","medium",true, true,
|
171
|
[new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"OA publications","type":"column","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]}],"op":"AND"},{"groupFilters":[{"field":"publication.datasource.type","type":"contains","values":["repo"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"2000"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"Publications by OA Journals"},"subtitle":{},"yAxis":{"title":{"text":"publications"}},"xAxis":{"title":{"text":"year"}},"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)]);
|
172
|
pubDefSub.charts.push(c_pubs_repo);
|
173
|
//
|
174
|
// let c_pubs_repo = new Indicator("OA publications in repositories by year",null, "chart","medium",true, true,
|
175
|
// [new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('), null)]);
|
176
|
// pubDefSub.charts.push(c_pubs_repo);
|
177
|
|
178
|
// let c_pubs_green_year = new Indicator("How many OA publications have been submitted to repos per year?",null, "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)]);
|
179
|
// pubDefSub.charts.push(c_pubs_green_year);
|
180
|
|
181
|
let c_pubs_datasource_country = new Indicator("What is the percentage of OA pubs by repositories over the years?",null, "chart","medium",true, true,
|
182
|
[new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Gold OA","type":"column","color":"#b8c91fff","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.datasource.id","type":"starts_with","values":["doaj"]}],"op":"AND"},{"groupFilters":[{"field":"publication.year","type":">","values":["2010"]},{"field":"publication.year","type":"<","values":["2020"]}],"op":"AND"},{"groupFilters":[{"field":"publication.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"30"}},{"name":"Green OA","type":"column","color":"#0d9637ff","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.year","type":">","values":["2010"]},{"field":"publication.year","type":"<","values":["2020"]}],"op":"AND"},{"groupFilters":[{"field":"publication.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"publication.datasource.type","type":"starts_with","values":["Institu"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false},"stacking":"percent"}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
|
183
|
pubDefSub.charts.push(c_pubs_datasource_country);
|
184
|
|
185
|
let c_pubs_funding_country = new Indicator("What is the percentage of OA pubs by projects over the years?",null, "chart","medium",true, true,
|
186
|
[new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('{"library":"HighCharts","chartDescription":{"queries":[{"name":"Gold OA","type":"column","color":"#b8c91fff","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.datasource.id","type":"starts_with","values":["doaj"]}],"op":"AND"},{"groupFilters":[{"field":"publication.year","type":">","values":["2010"]},{"field":"publication.year","type":"<","values":["2020"]}],"op":"AND"},{"groupFilters":[{"field":"publication.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"30"}},{"name":"Green OA","type":"column","color":"#0d9637ff","query":{"select":[{"field":"publication","aggregate":"count"},{"field":"publication.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"publication.year","type":">","values":["2010"]},{"field":"publication.year","type":"<","values":["2020"]}],"op":"AND"},{"groupFilters":[{"field":"publication.access mode","type":"=","values":["Open Access"]}],"op":"AND"},{"groupFilters":[{"field":"publication.datasource.type","type":"starts_with","values":["Institu"]}],"op":"AND"},{"groupFilters":[{"field":"publication.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]}],"op":"AND"}],"entity":"publication","profile":"OpenAIRE All-inclusive","limit":"30"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{},"subtitle":{},"yAxis":{"title":{}},"xAxis":{"title":{}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":false},"plotOptions":{"series":{"dataLabels":{"enabled":false},"stacking":"percent"}},"legend":{"enabled":true,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
|
187
|
pubDefSub.charts.push(c_pubs_funding_country);
|
188
|
|
189
|
let c_data_year = new Indicator("How your Open research data are shaped over the years?",null, "chart","medium",true, true,
|
190
|
[new IndicatorPath("column", "stats-tool",'/chart?json='+
|
191
|
encodeURIComponent('{"library":"HighCharts","chartDescription":{"colors":["#42a5f5","#26a69a","#90ed7d","#607d8b","#00838f","#689f38","#e4d354","#2b908f","#546e7a","#01579"],"queries":[{"name":"Data","type":"column","query":{"select":[{"field":"result","aggregate":"count"},{"field":"result.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"result.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]},{"field":"result.type","type":"=","values":["dataset"]},{"field":"result.year","type":">=","values":["2014"]},{"field":"result.year","type":"<=","values":["2019"]}],"op":"AND"}],"entity":"result","profile":"OpenAIRE original","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+stakeholder.index_shortName+' research data over time"},"subtitle":{},"yAxis":{"title":{"text":"Research data"}},"xAxis":{"title":{"text":"Year"}},"lang":{"noData":"No Data available for the Query"},"exporting":{"enabled":true},"plotOptions":{"series":{"dataLabels":{"enabled":false}}},"legend":{"enabled":false,"align":"center","verticalAlign":"bottom","layout":"horizontal"},"credits":{"href":null,"enabled":true,"text":"Created by OpenAIRE via HighCharts"}}}'), null)]);
|
192
|
dataDefSub.charts.push(c_data_year);*/
|
193
|
|
194
|
// let c_other_year = new Indicator("How your Open research data are shaped over the years?",null, "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)]);
|
195
|
// otherDefSub.charts.push(c_other_year);
|
196
|
//
|
197
|
// let c_datasources_access_modes = new Indicator("What is the number of research data repositories by access mode?",null, "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)]);
|
198
|
// pubDefSub.charts.push(c_datasources_access_modes);
|
199
|
//
|
200
|
// let c_pub_nometa_year = new Indicator("How many publications lack of abstract per year?",null, "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)]);
|
201
|
// pubDefSub.charts.push(c_pub_nometa_year);
|
202
|
//
|
203
|
// let c_pub_meta_linked_year = new Indicator("??",null, "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)]);
|
204
|
// pubDefSub.charts.push(c_pub_meta_linked_year);
|
205
|
//
|
206
|
// let c_pub_colocated_year = new Indicator("How many publications are submitted to more than one repos per year?",null, "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)]);
|
207
|
// pubDefSub.charts.push(c_pub_colocated_year);
|
208
|
|
209
|
// let c_pub_pids = new Indicator("What is the most common PIDs by year?",null, "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)]);
|
210
|
// pubDefSub.charts.push(c_pub_pids);
|
211
|
//
|
212
|
// let c_oai_pmh_datasources = new Indicator("What is the most common PIDs by year?",null, "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)]);
|
213
|
// pubDefSub.charts.push(c_oai_pmh_datasources);
|
214
|
|
215
|
return topic;
|
216
|
}
|
217
|
|
218
|
createImpactTopic(): Topic {
|
219
|
let topic = new Topic("Impact/Correlation", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...", "impact", true, true);
|
220
|
|
221
|
let pubCategory: Category = new Category("Publications", "", "publications", true, true);
|
222
|
topic.categories.push(pubCategory);
|
223
|
let pubDefSub = new SubCategory(null, null, null, true, true);
|
224
|
pubCategory.subCategories.push(pubDefSub);
|
225
|
|
226
|
let dataCategory: Category = new Category("Research data", "", "data", true, true);
|
227
|
topic.categories.push(dataCategory);
|
228
|
let dataDefSub = new SubCategory(null, null, null, true, true);
|
229
|
dataCategory.subCategories.push(dataDefSub);
|
230
|
|
231
|
let softwareCategory: Category = new Category("Software", "", "software", true, true);
|
232
|
topic.categories.push(softwareCategory);
|
233
|
let softDefSub = new SubCategory(null, null, null, true, true);
|
234
|
softwareCategory.subCategories.push(softDefSub);
|
235
|
|
236
|
/* let otherCategory:Category = new Category("Other research products","","other",true,true);
|
237
|
topic.categories.push(otherCategory);
|
238
|
let otherDefSub = new SubCategory(null, null,null,true, true);
|
239
|
otherCategory.subCategories.push(otherDefSub);*/
|
240
|
|
241
|
|
242
|
return topic;
|
243
|
}
|
244
|
|
245
|
createCollaborationTopic(): Topic {
|
246
|
let topic = new Topic("Demo Topic", "This is a demo topic", "demo-topic", true, true);
|
247
|
|
248
|
let category1: Category = new Category("Category 1", "This is ", "cat-1", true, true);
|
249
|
topic.categories.push(category1);
|
250
|
|
251
|
|
252
|
let subCat1 = new SubCategory("Sub-category 1", "", "sub-cat-1", true, true);
|
253
|
category1.subCategories.push(subCat1);
|
254
|
|
255
|
|
256
|
let subCat2 = new SubCategory("Sub-category 2", "", "sub-cat-2", true, true);
|
257
|
category1.subCategories.push(subCat2);
|
258
|
|
259
|
|
260
|
let category2: Category = new Category("Category 2 - no subcategories", "", "cat-2", true, true);
|
261
|
topic.categories.push(category2);
|
262
|
let defSub = new SubCategory(null, null, null, true, true);
|
263
|
category2.subCategories.push(defSub);
|
264
|
|
265
|
let chart1 = new Indicator(
|
266
|
"Chart title goes here", "Chart description goes here", "chart", "medium", true, true,
|
267
|
[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)]);
|
268
|
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)]);
|
269
|
subCat1.charts.push(chart1);
|
270
|
subCat2.charts.push(chart2);
|
271
|
|
272
|
defSub.charts.push(chart1);
|
273
|
defSub.charts.push(chart2);
|
274
|
let utils = new IndicatorUtils();
|
275
|
let url = "https://beta.openaire.eu/stats/chart.php?com=query&data={%22table%22:%22result%22,%22fields%22:[{%22fld%22:%22number%22,%22agg%22:%22count%22,%22type%22:%22bar%22,%22yaxis%22:1,%22c%22:false}],%22xaxis%22:{%22name%22:%22result_datasources-datasource-name%22,%22agg%22:%22avg%22},%22group%22:%22%22,%22color%22:%22%22,%22type%22:%22chart%22,%22size%22:%2220%22,%22sort%22:%22count-number%22,%22yaxisheaders%22:[%22%22],%22fieldsheaders%22:[%22publications%22],%22in%22:[],%22filters%22:[{%22name%22:%22result_projects-project-funding_lvl0%22,%22values%22:[%22H2020%22],%22to%22:%22-1%22},{%22name%22:%22type%22,%22values%22:[%22publication%22],%22to%22:%22-1%22},{%22name%22:%22result_datasources-datasource-type%22,%22exvalues%22:[%22Publication%20Catalogue%22]}],%22having%22:[],%22xStyle%22:{%22r%22:%22-%22,%22s%22:%22-%22,%22l%22:%22-%22,%22ft%22:%22-%22,%22wt%22:%22-%22},%22title%22:%22H2020%20Publications%20by%20datasource%20%28top%2020%29%22,%22subtitle%22:%22%22,%22xaxistitle%22:%22datasource%22,%22order%22:%22d%22}&w=90%";
|
276
|
defSub.charts.push(new Indicator("Old tool graph", "", "chart", "large", true, true, [utils.generateIndicatorByChartUrl("old", url, "bar")]))
|
277
|
url = "http://88.197.53.71:8080/stats-api/chart?json=%7B%22library%22%3A%22HighCharts%22%2C%22chartDescription%22%3A%7B%22queries%22%3A%5B%7B%22name%22%3A%22Research%20data%22%2C%22type%22%3A%22column%22%2C%22query%22%3A%7B%22select%22%3A%5B%7B%22field%22%3A%22dataset%22%2C%22aggregate%22%3A%22count%22%7D%2C%7B%22field%22%3A%22dataset.year%22%2C%22aggregate%22%3Anull%7D%5D%2C%22filters%22%3A%5B%7B%22groupFilters%22%3A%5B%7B%22field%22%3A%22dataset.project.funder%22%2C%22type%22%3A%22%3D%22%2C%22values%22%3A%5B%22European%20Commission%22%5D%7D%5D%2C%22op%22%3A%22AND%22%7D%2C%7B%22groupFilters%22%3A%5B%7B%22field%22%3A%22dataset.year%22%2C%22type%22%3A%22%3E%3D%22%2C%22values%22%3A%5B%222008%22%5D%7D%2C%7B%22field%22%3A%22dataset.year%22%2C%22type%22%3A%22%3C%3D%22%2C%22values%22%3A%5B%222020%22%5D%7D%5D%2C%22op%22%3A%22AND%22%7D%5D%2C%22entity%22%3A%22dataset%22%2C%22profile%22%3A%22OpenAIRE%20All-inclusive%22%2C%22limit%22%3A%220%22%7D%7D%5D%2C%22chart%22%3A%7B%22backgroundColor%22%3A%22%23FFFFFFFF%22%2C%22borderColor%22%3A%22%23335cadff%22%2C%22borderRadius%22%3A0%2C%22borderWidth%22%3A0%2C%22plotBorderColor%22%3A%22%23ccccccff%22%2C%22plotBorderWidth%22%3A0%7D%2C%22title%22%3A%7B%22text%22%3A%22Research%20data%20timeline%22%7D%2C%22subtitle%22%3A%7B%7D%2C%22yAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Research%20data%22%7D%7D%2C%22xAxis%22%3A%7B%22title%22%3A%7B%22text%22%3A%22Year%22%7D%7D%2C%22lang%22%3A%7B%22noData%22%3A%22No%20Data%20available%20for%20the%20Query%22%7D%2C%22exporting%22%3A%7B%22enabled%22%3Atrue%7D%2C%22plotOptions%22%3A%7B%22series%22%3A%7B%22dataLabels%22%3A%7B%22enabled%22%3Afalse%7D%7D%7D%2C%22legend%22%3A%7B%22enabled%22%3Atrue%2C%22align%22%3A%22center%22%2C%22verticalAlign%22%3A%22bottom%22%2C%22layout%22%3A%22horizontal%22%7D%2C%22credits%22%3A%7B%22href%22%3Anull%2C%22enabled%22%3Atrue%2C%22text%22%3A%22Created%20by%20OpenAIRE%20via%20HighCharts%22%7D%7D%7D";
|
278
|
defSub.charts.push(new Indicator("", "", "chart", "large", true, true, [utils.generateIndicatorByChartUrl("stats-tool", url, "bar")]))
|
279
|
return topic;
|
280
|
}
|
281
|
}
|
282
|
|
283
|
export class Topic {
|
284
|
_id: string;
|
285
|
name: string;
|
286
|
alias: string;
|
287
|
description: string;
|
288
|
isActive: boolean;
|
289
|
isPublic: boolean;
|
290
|
isDefault: boolean;
|
291
|
categories: Category[];
|
292
|
|
293
|
constructor(name: string, description: string, alias: string, isActive: boolean, isPublic: boolean) {
|
294
|
this._id = null;
|
295
|
this.name = name;
|
296
|
this.description = description;
|
297
|
this.alias = alias;
|
298
|
this.isActive = isActive;
|
299
|
this.isPublic = isPublic;
|
300
|
this.categories = [];
|
301
|
}
|
302
|
}
|
303
|
|
304
|
export class Category {
|
305
|
_id: string;
|
306
|
name: string;
|
307
|
alias: string;
|
308
|
description: string;
|
309
|
isActive: boolean;
|
310
|
isPublic: boolean;
|
311
|
isOverview: boolean;
|
312
|
isDefault: boolean;
|
313
|
subCategories: SubCategory[];
|
314
|
|
315
|
constructor(name: string, description: string, alias: string, isActive: boolean, isPublic: boolean) {
|
316
|
this._id = null;
|
317
|
this.name = name;
|
318
|
this.description = description;
|
319
|
this.alias = alias;
|
320
|
this.isActive = isActive;
|
321
|
this.isPublic = isPublic;
|
322
|
this.subCategories = [];
|
323
|
}
|
324
|
}
|
325
|
|
326
|
export class SubCategory {
|
327
|
_id: string;
|
328
|
name: string;
|
329
|
alias: string;
|
330
|
description: string;
|
331
|
isActive: boolean;
|
332
|
isPublic: boolean;
|
333
|
isDefault: boolean;
|
334
|
charts: Indicator[];
|
335
|
numbers: Indicator[];
|
336
|
|
337
|
constructor(name: string, description: string, alias: string, isActive: boolean, isPublic: boolean) {
|
338
|
this._id = null;
|
339
|
this.name = name;
|
340
|
this.description = description;
|
341
|
this.alias = alias;
|
342
|
this.isActive = isActive;
|
343
|
this.isPublic = isPublic;
|
344
|
this.charts = [];
|
345
|
this.numbers = [];
|
346
|
}
|
347
|
|
348
|
}
|
349
|
|
350
|
export class Indicator {
|
351
|
_id: string;
|
352
|
name: string;
|
353
|
description: string;
|
354
|
type: string; //number,chart
|
355
|
width: string; //small,medium,large
|
356
|
tags: string[];
|
357
|
isActive: boolean;
|
358
|
isPublic: boolean;
|
359
|
isDefault: boolean;
|
360
|
indicatorPaths: IndicatorPath[];
|
361
|
|
362
|
constructor(name: string, description: string, type: string, width: string, isActive: boolean, isPublic: boolean, indicatorPaths: IndicatorPath[]) {
|
363
|
this._id = null;
|
364
|
this.name = name;
|
365
|
this.description = description;
|
366
|
this.type = type;
|
367
|
this.width = width;
|
368
|
this.isActive = isActive;
|
369
|
this.isPublic = isPublic;
|
370
|
this.indicatorPaths = indicatorPaths;
|
371
|
}
|
372
|
|
373
|
}
|
374
|
|
375
|
export class IndicatorPath {
|
376
|
type: string; // for charts is type of chart {table, bar, column, etc}
|
377
|
source: string;// for numbers is the service {statistics, search, metrics} for charts is the tool {stats-tool,old,metrics, fake}
|
378
|
url: string;
|
379
|
safeResourceUrl: SafeResourceUrl; // initialize on front end
|
380
|
jsonPath: string[];
|
381
|
chartObject: string;
|
382
|
parameters: any;
|
383
|
filters: any;
|
384
|
|
385
|
constructor(type: string, source: string, url: string, chartObject: string, jsonPath: string[]) {
|
386
|
this.type = type;
|
387
|
this.url = url;
|
388
|
this.source = source;
|
389
|
this.jsonPath = jsonPath;
|
390
|
this.chartObject = chartObject;
|
391
|
this.parameters = {};
|
392
|
this.filters = {};
|
393
|
}
|
394
|
|
395
|
static createParameters(funderName: string = null, title: string = null, chartType: string = null): any {
|
396
|
return {
|
397
|
funder_name: funderName,
|
398
|
title: title,
|
399
|
type: chartType
|
400
|
};
|
401
|
}
|
402
|
|
403
|
static createResultFilters(dbType: string = null): any {
|
404
|
return {
|
405
|
fundingL0: '{"groupFilters":[{"field":"' + dbType + '.project.funding level 0","type":"=","values":["' + ChartHelper.prefix + 'fundingL0' + ChartHelper.suffix + '"]}],"op":"AND"}',
|
406
|
start_year: '{"groupFilters":[{"field":"' + dbType + '.year","type":">=","values":["' + ChartHelper.prefix + 'start_year' + ChartHelper.suffix + '"]}],"op":"AND"}',
|
407
|
end_year: '{"groupFilters":[{"field":"' + dbType + '.year","type":"<=","values":["' + ChartHelper.prefix + 'end_year' + ChartHelper.suffix + '"]}],"op":"AND"}'
|
408
|
};
|
409
|
}
|
410
|
}
|