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.id = id;
22
    this.type = type;
23
    this.index_id = index_id;
24
    this.index_name = index_name;
25
    this.index_shortName = index_shortName;
26
    this.isDefaultProfile = isDefaultProfile;
27
    this.alias = alias;
28
    this.isActive = isActive;
29
    this.isPublic = isPublic;
30
    this.topics =[];
31
    this.managers =[];
32
  }
33
  static createECStakeholder():Stakeholder{
34
    let ec:Stakeholder = new Stakeholder("ec","funder","ec__________::EC","European Commission","EC",false,"ec",true,true);
35
    //  new Stakeholder('wt','funder','wt__________::WT','Wellcome Trust','WT',false, 'wt',true,true);
36
    ec.topics.push(ec.createOSTopic(ec));
37
    ec.topics.push(ec.createImpactTopic());
38
    ec.topics.push(ec.createCollaborationTopic());
39
    return ec;
40
  }
41
  createOSTopic(stakeholder:Stakeholder):Topic{
42
    let topic = new Topic("OpenScience","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","open-science",true,true);
43

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

    
49

    
50

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

    
66

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

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

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

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

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

    
92
    //Numbers
93

    
94
    let n_total_pubs = new Indicator("Publications",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null, ["statistics","publications"])]);
95
    let n_open_pubs = new Indicator("OA Publications",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null,["statistics","open_access"])]);
96
    let n_total_projects = new Indicator("Projects",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null, ["statistics","total_projects"])]);
97
    let n_total_data = new Indicator("Reserach data",null, "number","small",true, true, [new IndicatorPath(null, "search",
98
      "/datasets/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null, ["total"])]);
99
    let n_total_soft = new Indicator("Software",null, "number","small",true, true, [new IndicatorPath(null, "search",
100
      "/software/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]);
101
    let n_total_other = new Indicator("Other research products",null, "number","small",true, true, [new IndicatorPath(null, "search",
102
      "/other/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]);
103

    
104
    /*overviewDefSub.numbers.push(n_total_pubs);
105
    overviewDefSub.numbers.push(n_open_pubs);
106
    overviewDefSub.numbers.push(n_total_projects);
107
    overviewDefSub.numbers.push(n_total_data);
108
    overviewDefSub.numbers.push(n_total_soft);
109
    overviewDefSub.numbers.push(n_total_other);*/
110

    
111
    pubDefSub.numbers.push(n_total_pubs);
112
    pubDefSub.numbers.push(n_open_pubs);
113
    softDefSub.numbers.push(n_total_soft);
114
    dataDefSub.numbers.push(n_total_data);
115
    otherDefSub.numbers.push(n_total_other);
116

    
117
    projectDefSub.numbers.push(n_total_projects);
118

    
119
    //Charts
120

    
121
    let c_pubs_per_project = new Indicator("Which are the top "+stakeholder.index_shortName+" projects?",null, "chart","large",true, true, [
122
      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 )]);
123
    c_pubs_per_project.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,"Publications per project (top 30)","bar");
124
    pubDefSub.charts.push(c_pubs_per_project);
125

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

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

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

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

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

    
153
     // 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)]);
154
     // pubDefSub.charts.push(c_pubs_av_embargo);
155

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

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

    
169
     // 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)]);
170
     // pubDefSub.charts.push(c_pubs_green_year);
171

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

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

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

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

    
200
    // 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)]);
201
    // pubDefSub.charts.push(c_pub_pids);
202
    //
203
    // 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)]);
204
    // pubDefSub.charts.push(c_oai_pmh_datasources);
205

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

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

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

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

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

    
231

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

    
237
    let category1:Category =  new Category("Category 1","This is ","cat-1",true,true);
238
    topic.categories.push(category1);
239

    
240

    
241
    let subCat1 = new SubCategory("Sub-category 1","","sub-cat-1",true,true);
242
    category1.subCategories.push(subCat1);
243

    
244

    
245
    let subCat2 = new SubCategory("Sub-category 2","","sub-cat-2",true,true);
246
    category1.subCategories.push(subCat2);
247

    
248

    
249

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

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

    
262
    defSub.charts.push(chart1);
263
    defSub.charts.push(chart2);
264
    return topic;
265
  }
266
}
267

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

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

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

    
341
}
342

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

    
372
    return this.url + encodeURIComponent(replacedUrl);
373
  }
374

    
375
}
(2-2/2)