Project

General

Profile

1
import {SafeResourceUrl} from "@angular/platform-browser";
2
export const ChartHelper={
3
  prefix : "((__",
4
  suffix : "__))"
5
};
6
export class Stakeholder {
7
  id: string;
8
  type: string;
9
  index_id;
10
  index_name: string;
11
  index_shortName:string;
12
  alias: string;
13
  isDefaultProfile: boolean;
14
  isActive: boolean;
15
  isPublic: boolean;
16
  creationDate: string;
17
  updateDate: string;
18
  managers: string[];
19
  topics:Topic[];
20
  constructor( id: string, type: string, index_id, index_name: string, index_shortName:string , isDefaultProfile: boolean, alias:string , isActive: boolean, isPublic: boolean){
21
    this.initializeFunder(id,type, index_id, index_name, index_shortName, isDefaultProfile, alias, isActive, isPublic);
22
    this.topics =[];
23
    this.managers =[];
24
  }
25
  initializeFunder( id: string, type: string, index_id, index_name: string, index_shortName:string , isDefaultProfile: boolean, alias:string , isActive: boolean, isPublic: boolean){
26
    this.id = id;
27
    this.type = type;
28
    this.index_id = index_id;
29
    this.index_name = index_name;
30
    this.index_shortName = index_shortName;
31
    this.isDefaultProfile = isDefaultProfile;
32
    this.alias = alias;
33
    this.isActive = isActive;
34
    this.isPublic = isPublic;
35
  }
36
  static createECStakeholder():Stakeholder{
37
    let ec:Stakeholder = new Stakeholder("ec","funder","ec__________::EC","European Commission","EC",false,"ec",true,true);
38
    //  new Stakeholder('wt','funder','wt__________::WT','Wellcome Trust','WT',false, 'wt',true,true);
39
    ec.topics.push(ec.createOSTopic(ec));
40
    ec.topics.push(ec.createImpactTopic());
41
    ec.topics.push(ec.createCollaborationTopic());
42
    return ec;
43
  }
44
  createOSTopic(stakeholder:Stakeholder):Topic{
45
    let topic = new Topic("OpenScience","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","open-science",true,true);
46

    
47
/*    let overview:Category =  new Category("Overview","","overview",true,true);
48
    topic.categories.push(overview);
49
    let overviewDefSub = new SubCategory(null, null,null,true, true);
50
    overview.subCategories.push(overviewDefSub);*/
51

    
52

    
53

    
54
    let pubCategory:Category =  new Category("Publications","","publications",true,true);
55
    topic.categories.push(pubCategory);
56
    let pubDefSub = new SubCategory(null, null,null,true, true);
57
    pubCategory.subCategories.push(pubDefSub);
58
/*    let pubOpenSub = new SubCategory("Openess","","openness",true,true);
59
    pubCategory.subCategories.push(pubOpenSub);
60
    let pubFundingSub = new SubCategory("Funding","","funding",true,true);
61
    pubCategory.subCategories.push(pubFundingSub);
62
    let pubDatasourceSub = new SubCategory("Content Providers","","content-providers",true,true);
63
    pubCategory.subCategories.push(pubDatasourceSub);
64
    let pubDocTypeSub = new SubCategory("Document Type","","doc-type",true,true);
65
    pubCategory.subCategories.push(pubDocTypeSub);
66
    let pubFindSub = new SubCategory("Findability","","dindability",true,true);
67
    pubCategory.subCategories.push(pubFindSub);*/
68

    
69

    
70
    let dataCategory:Category =  new Category("Research data","","data",true,true);
71
    topic.categories.push(dataCategory);
72
    let dataDefSub = new SubCategory(null, null,null,true, true);
73
    dataCategory.subCategories.push(dataDefSub);
74

    
75
    let softwareCategory:Category =  new Category("Software","","software",true,true);
76
    topic.categories.push(softwareCategory);
77
    let softDefSub = new SubCategory(null, null,null,true, true);
78
    softwareCategory.subCategories.push(softDefSub);
79

    
80
    let otherCategory:Category =  new Category("Other research products","","other",true,true);
81
    topic.categories.push(otherCategory);
82
    let otherDefSub = new SubCategory(null, null,null,true, true);
83
    otherCategory.subCategories.push(otherDefSub);
84

    
85
/*    let datasourceCategory:Category =  new Category("Content Providers","","content-providers",true,true);
86
    topic.categories.push(datasourceCategory);
87
    let datasourceDefSub = new SubCategory(null, null,null,true, true);
88
    datasourceCategory.subCategories.push(datasourceDefSub);*/
89

    
90
    let projectCategory:Category =  new Category("Projects","","projects",true,true);
91
    topic.categories.push(projectCategory);
92
    let projectDefSub = new SubCategory(null, null,null,true, true);
93
    projectCategory.subCategories.push(projectDefSub);
94

    
95
    //Numbers
96

    
97
    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"])]);
98
    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"])]);
99
    let n_total_projects = new Indicator("Projects",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null, ["statistics","total_projects"])]);
100
    let n_total_data = new Indicator("Reserach data",null, "number","small",true, true, [new IndicatorPath(null, "search",
101
      "/datasets/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null, ["total"])]);
102
    let n_total_soft = new Indicator("Software",null, "number","small",true, true, [new IndicatorPath(null, "search",
103
      "/software/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]);
104
    let n_total_other = new Indicator("Other research products",null, "number","small",true, true, [new IndicatorPath(null, "search",
105
      "/other/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]);
106

    
107
    /*overviewDefSub.numbers.push(n_total_pubs);
108
    overviewDefSub.numbers.push(n_open_pubs);
109
    overviewDefSub.numbers.push(n_total_projects);
110
    overviewDefSub.numbers.push(n_total_data);
111
    overviewDefSub.numbers.push(n_total_soft);
112
    overviewDefSub.numbers.push(n_total_other);*/
113

    
114
    pubDefSub.numbers.push(n_total_pubs);
115
    pubDefSub.numbers.push(n_open_pubs);
116
    softDefSub.numbers.push(n_total_soft);
117
    dataDefSub.numbers.push(n_total_data);
118
    otherDefSub.numbers.push(n_total_other);
119

    
120
    projectDefSub.numbers.push(n_total_projects);
121

    
122
    //Charts
123

    
124
    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, [
125
      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 )]);
126
    c_pubs_per_project.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,"Publications per project (top 30)","bar");
127
    pubDefSub.charts.push(c_pubs_per_project);
128

    
129
//TO check
130
    /* let c_pubs_per_datasource = new Indicator("Which are the top repositories containing "+stakeholder.index_shortName+" research outputs?",null, "chart","small",false,
131
       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)]);
132
     pubDefSub.charts.push(c_pubs_per_datasource);
133

    
134
     let c_pubs_per_doc_type = new Indicator("In what type of documents do your researchers used to publish?",null, "chart","small",true, true,
135
       [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)]);
136
     pubDefSub.charts.push(c_pubs_per_doc_type);
137

    
138
     let c_pubs_funding_scheme = new Indicator("What is the percentage publications by funding scheme / programme?",null, "chart","small",true,
139
       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)]);
140
     pubDefSub.charts.push(c_pubs_funding_scheme);
141
*/
142
 /*    //TODO check why doesn't load
143
       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,
144
       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)]);
145
     //pubDefSub.charts.push(c_pubs_gg_funding_scheme);
146
 */
147

    
148
    /* let c_pubs_open = new Indicator("Open Access publications timeline",null, "chart","small",true, true,
149
       [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)]);
150
     pubDefSub.charts.push(c_pubs_open);
151

    
152
     let c_pubs_access_modes = new Indicator("How your Open Access publications are shaped over the years?",null, "chart","medium",true, true,
153
       [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)]);
154
     pubDefSub.charts.push(c_pubs_access_modes);
155

    
156
     // 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)]);
157
     // pubDefSub.charts.push(c_pubs_av_embargo);
158

    
159
     let c_pubs_OA_journals = new Indicator("Publications in OA Journals over time",null, "chart","medium",true, true,
160
       [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)]);
161
     pubDefSub.charts.push(c_pubs_OA_journals);
162

    
163
     //from monitor
164
     let c_pubs_repo = new Indicator("OA publications in repositories by year",null, "chart","medium",true, true,
165
       [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)]);
166
     pubDefSub.charts.push(c_pubs_repo);
167
     //
168
     // let c_pubs_repo = new Indicator("OA publications in repositories by year",null, "chart","medium",true, true,
169
     //   [new IndicatorPath("column", "stats-tool", "chart?json="+encodeURIComponent('), null)]);
170
     // pubDefSub.charts.push(c_pubs_repo);
171

    
172
     // 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)]);
173
     // pubDefSub.charts.push(c_pubs_green_year);
174

    
175
     let c_pubs_datasource_country = new Indicator("What is the percentage of OA pubs by repositories over the years?",null, "chart","medium",true, true,
176
       [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)]);
177
     pubDefSub.charts.push(c_pubs_datasource_country);
178

    
179
     let c_pubs_funding_country = new Indicator("What is the percentage of OA pubs by projects over the years?",null, "chart","medium",true, true,
180
       [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)]);
181
     pubDefSub.charts.push(c_pubs_funding_country);
182

    
183
     let c_data_year = new Indicator("How your Open research data are shaped over the years?",null, "chart","medium",true, true,
184
       [new IndicatorPath("column", "stats-tool",'/chart?json='+
185
         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)]);
186
     dataDefSub.charts.push(c_data_year);*/
187

    
188
    // 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)]);
189
    // otherDefSub.charts.push(c_other_year);
190
    //
191
    // 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)]);
192
    // pubDefSub.charts.push(c_datasources_access_modes);
193
    //
194
    // 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)]);
195
    // pubDefSub.charts.push(c_pub_nometa_year);
196
    //
197
    // 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)]);
198
    // pubDefSub.charts.push(c_pub_meta_linked_year);
199
    //
200
    // 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)]);
201
    // pubDefSub.charts.push(c_pub_colocated_year);
202

    
203
    // 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)]);
204
    // pubDefSub.charts.push(c_pub_pids);
205
    //
206
    // 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)]);
207
    // pubDefSub.charts.push(c_oai_pmh_datasources);
208

    
209
    return topic;
210
  }
211
  createImpactTopic():Topic{
212
    let topic = new Topic("Impact/Correlation","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","impact",true,true);
213

    
214
    let pubCategory:Category =  new Category("Publications","","publications",true,true);
215
    topic.categories.push(pubCategory);
216
    let pubDefSub = new SubCategory(null, null,null,true, true);
217
    pubCategory.subCategories.push(pubDefSub);
218

    
219
    let dataCategory:Category =  new Category("Research data","","data",true,true);
220
    topic.categories.push(dataCategory);
221
    let dataDefSub = new SubCategory(null, null,null,true, true);
222
    dataCategory.subCategories.push(dataDefSub);
223

    
224
    let softwareCategory:Category =  new Category("Software","","software",true,true);
225
    topic.categories.push(softwareCategory);
226
    let softDefSub = new SubCategory(null, null,null,true, true);
227
    softwareCategory.subCategories.push(softDefSub);
228

    
229
  /*  let otherCategory:Category =  new Category("Other research products","","other",true,true);
230
    topic.categories.push(otherCategory);
231
    let otherDefSub = new SubCategory(null, null,null,true, true);
232
    otherCategory.subCategories.push(otherDefSub);*/
233

    
234

    
235
    return topic;
236
  }
237
  createCollaborationTopic():Topic{
238
    let topic = new Topic("Demo Topic","This is a demo topic","demo-topic",true,true);
239

    
240
    let category1:Category =  new Category("Category 1","This is ","cat-1",true,true);
241
    topic.categories.push(category1);
242

    
243

    
244
    let subCat1 = new SubCategory("Sub-category 1","","sub-cat-1",true,true);
245
    category1.subCategories.push(subCat1);
246

    
247

    
248
    let subCat2 = new SubCategory("Sub-category 2","","sub-cat-2",true,true);
249
    category1.subCategories.push(subCat2);
250

    
251

    
252

    
253
    let category2:Category =  new Category("Category 2 - no subcategories","","cat-2",true,true);
254
    topic.categories.push(category2);
255
    let defSub = new SubCategory(null, null,null,true, true);
256
    category2.subCategories.push(defSub);
257

    
258
    let chart1 = new Indicator(
259
      "Chart title goes here","Chart description goes here", "chart","medium",true, true,
260
      [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)]);
261
    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)]);
262
    subCat1.charts.push(chart1);
263
    subCat2.charts.push(chart2);
264

    
265
    defSub.charts.push(chart1);
266
    defSub.charts.push(chart2);
267
    return topic;
268
  }
269
}
270

    
271
export class Topic {
272
  name: string;
273
  alias: string;
274
  description: string;
275
  isActive: boolean;
276
  isPublic: boolean;
277
  categories: Category[];
278
  constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean){
279
    this.name =  name;
280
    this.description = description;
281
    this.alias = alias;
282
    this.isActive = isActive;
283
    this.isPublic = isPublic;
284
    this.categories = [];
285
  }
286
}
287
export class Category {
288
  name: string;
289
  alias: string;
290
  description: string;
291
  isActive: boolean;
292
  isPublic: boolean;
293
  isOverview: boolean;
294
  subCategories: SubCategory[];
295
  constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean){
296
    this.name =  name;
297
    this.description = description;
298
    this.alias = alias;
299
    this.isActive = isActive;
300
    this.isPublic = isPublic;
301
    this.subCategories = [];
302
  }
303
}
304

    
305
export class SubCategory {
306
  name: string;
307
  alias: string;
308
  description: string;
309
  isActive: boolean;
310
  isPublic: boolean;
311
  charts: Indicator[];
312
  numbers: Indicator[];
313
  constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean){
314
    this.name =  name;
315
    this.description = description;
316
    this.alias = alias;
317
    this.isActive = isActive;
318
    this.isPublic = isPublic;
319
    this.charts = [];
320
    this.numbers = [];
321
  }
322

    
323
}
324
export class Indicator {
325
  id:string;
326
  name: string;
327
  description: string;
328
  type:string; //number,chart
329
  width:string; //small,medium,large
330
  tags:string[];
331
  isActive: boolean;
332
  isPublic: boolean;
333
  indicatorPaths:IndicatorPath[];
334
  constructor(name: string, description: string, type:string , width:string,  isActive: boolean, isPublic: boolean, indicatorPaths:IndicatorPath[]){
335
    this.name =  name;
336
    this.description = description;
337
    this.type =  type;
338
    this.width = width;
339
    this.isActive = isActive;
340
    this.isPublic = isPublic;
341
    this.indicatorPaths = indicatorPaths;
342
  }
343

    
344
}
345

    
346
export class IndicatorPath {
347
  type: string;  // for charts is type of chart {table, bar, column, etc}
348
  source:string;// for numbers is the service {statistics, search, metrics} for charts is the tool {stats-tool,old,metrics, fake}
349
  url: string;
350
  safeResourceUrl: SafeResourceUrl; // initialize on front end
351
  jsonPath:string[];
352
  chartObject:string;
353
  parameters:Map<string,string>;
354
  filters:Map<string,Map<string,string>>;
355
  constructor(type: string,  source:string, url: string, chartObject:string, jsonPath:string[]){
356
    this.type =  type;
357
    this.url = url;
358
    this.source = source;
359
    this.jsonPath = jsonPath;
360
    this.chartObject =chartObject;
361
  }
362
  static createParameters(funderName:string=null, title:string=null, chartType:string=null):Map<string, string>{
363
    let parameters = new Map<string, string>();
364
    parameters.set("funder_name",funderName);
365
    parameters.set("title",title);
366
    parameters.set("type",chartType);
367
    return parameters;
368
  }
369
  getFullUrl():string{
370
    let replacedUrl = this.chartObject;
371
    this.parameters.forEach((value: string, key: string) => {
372
      replacedUrl = replacedUrl.replace(ChartHelper.prefix+key+ChartHelper.suffix,value);
373
    });
374

    
375
    return this.url + encodeURIComponent(replacedUrl);
376
  }
377

    
378
}
(2-2/3)