Project

General

Profile

« Previous | Next » 

Revision 57673

[Monitor Dashboard]: Complete indicator save and reorder.

View differences:

stakeholder.ts
1 1
import {SafeResourceUrl} from "@angular/platform-browser";
2 2
import {IndicatorUtils} from "../indicator-utils";
3
export const ChartHelper={
4
  prefix : "((__",
5
  suffix : "__))"
3

  
4
export const ChartHelper = {
5
  prefix: "((__",
6
  suffix: "__))"
6 7
};
8

  
7 9
export class Stakeholder {
8
  id: string;
10
  _id: string;
9 11
  type: string;
10 12
  index_id;
11 13
  index_name: string;
12
  index_shortName:string;
14
  index_shortName: string;
13 15
  alias: string;
14 16
  isDefaultProfile: boolean;
15 17
  isActive: boolean;
......
17 19
  creationDate: string;
18 20
  updateDate: string;
19 21
  managers: string[];
20
  topics:Topic[];
21
  constructor( id: string, type: string, index_id, index_name: string, index_shortName:string , isDefaultProfile: boolean, alias:string , isActive: boolean, isPublic: boolean){
22
    this.initializeFunder(id,type, index_id, index_name, index_shortName, isDefaultProfile, alias, isActive, isPublic);
23
    this.topics =[];
24
    this.managers =[];
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 = [];
25 28
  }
26
  initializeFunder( id: string, type: string, index_id, index_name: string, index_shortName:string , isDefaultProfile: boolean, alias:string , isActive: boolean, isPublic: boolean){
27
    this.id = id;
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;
28 32
    this.type = type;
29 33
    this.index_id = index_id;
30 34
    this.index_name = index_name;
......
34 38
    this.isActive = isActive;
35 39
    this.isPublic = isPublic;
36 40
  }
37
  static createECStakeholder():Stakeholder{
38
    let ec:Stakeholder = new Stakeholder("ec","funder","ec__________::EC","European Commission","EC",false,"ec",true,true);
41

  
42
  static createECStakeholder(): Stakeholder {
43
    let ec: Stakeholder = new Stakeholder("ec", "funder", "ec__________::EC", "European Commission", "EC", false, "ec", true, true);
39 44
    //  new Stakeholder('wt','funder','wt__________::WT','Wellcome Trust','WT',false, 'wt',true,true);
40 45
    ec.topics.push(ec.createOSTopic(ec));
41 46
    ec.topics.push(ec.createImpactTopic());
42 47
    ec.topics.push(ec.createCollaborationTopic());
43 48
    return ec;
44 49
  }
45
  createOSTopic(stakeholder:Stakeholder):Topic{
46
    let topic = new Topic("OpenScience","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","open-science",true,true);
47 50

  
48
/*    let overview:Category =  new Category("Overview","","overview",true,true);
49
    topic.categories.push(overview);
50
    let overviewDefSub = new SubCategory(null, null,null,true, true);
51
    overview.subCategories.push(overviewDefSub);*/
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);
52 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);*/
53 58

  
54 59

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

  
70 75

  
71
    let dataCategory:Category =  new Category("Research data","","data",true,true);
76
    let dataCategory: Category = new Category("Research data", "", "data", true, true);
72 77
    topic.categories.push(dataCategory);
73
    let dataDefSub = new SubCategory(null, null,null,true, true);
78
    let dataDefSub = new SubCategory(null, null, null, true, true);
74 79
    dataCategory.subCategories.push(dataDefSub);
75 80

  
76
    let softwareCategory:Category =  new Category("Software","","software",true,true);
81
    let softwareCategory: Category = new Category("Software", "", "software", true, true);
77 82
    topic.categories.push(softwareCategory);
78
    let softDefSub = new SubCategory(null, null,null,true, true);
83
    let softDefSub = new SubCategory(null, null, null, true, true);
79 84
    softwareCategory.subCategories.push(softDefSub);
80 85

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

  
86
/*    let datasourceCategory:Category =  new Category("Content Providers","","content-providers",true,true);
87
    topic.categories.push(datasourceCategory);
88
    let datasourceDefSub = new SubCategory(null, null,null,true, true);
89
    datasourceCategory.subCategories.push(datasourceDefSub);*/
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);*/
90 95

  
91
    let projectCategory:Category =  new Category("Projects","","projects",true,true);
96
    let projectCategory: Category = new Category("Projects", "", "projects", true, true);
92 97
    topic.categories.push(projectCategory);
93
    let projectDefSub = new SubCategory(null, null,null,true, true);
98
    let projectDefSub = new SubCategory(null, null, null, true, true);
94 99
    projectCategory.subCategories.push(projectDefSub);
95 100

  
96 101
    //Numbers
97 102

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

  
108 113
    /*overviewDefSub.numbers.push(n_total_pubs);
109 114
    overviewDefSub.numbers.push(n_open_pubs);
......
122 127

  
123 128
    //Charts
124 129

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

  
130 135
//TO check
......
140 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)]);
141 146
     pubDefSub.charts.push(c_pubs_funding_scheme);
142 147
*/
143
 /*    //TODO check why doesn't load
144
       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,
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":"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)]);
146
     //pubDefSub.charts.push(c_pubs_gg_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
    */
148 153

  
149 154
    /* let c_pubs_open = new Indicator("Open Access publications timeline",null, "chart","small",true, true,
150 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)]);
......
209 214

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

  
215
    let pubCategory:Category =  new Category("Publications","","publications",true,true);
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);
216 222
    topic.categories.push(pubCategory);
217
    let pubDefSub = new SubCategory(null, null,null,true, true);
223
    let pubDefSub = new SubCategory(null, null, null, true, true);
218 224
    pubCategory.subCategories.push(pubDefSub);
219 225

  
220
    let dataCategory:Category =  new Category("Research data","","data",true,true);
226
    let dataCategory: Category = new Category("Research data", "", "data", true, true);
221 227
    topic.categories.push(dataCategory);
222
    let dataDefSub = new SubCategory(null, null,null,true, true);
228
    let dataDefSub = new SubCategory(null, null, null, true, true);
223 229
    dataCategory.subCategories.push(dataDefSub);
224 230

  
225
    let softwareCategory:Category =  new Category("Software","","software",true,true);
231
    let softwareCategory: Category = new Category("Software", "", "software", true, true);
226 232
    topic.categories.push(softwareCategory);
227
    let softDefSub = new SubCategory(null, null,null,true, true);
233
    let softDefSub = new SubCategory(null, null, null, true, true);
228 234
    softwareCategory.subCategories.push(softDefSub);
229 235

  
230
  /*  let otherCategory:Category =  new Category("Other research products","","other",true,true);
231
    topic.categories.push(otherCategory);
232
    let otherDefSub = new SubCategory(null, null,null,true, true);
233
    otherCategory.subCategories.push(otherDefSub);*/
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);*/
234 240

  
235 241

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

  
241
    let category1:Category =  new Category("Category 1","This is ","cat-1",true,true);
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);
242 249
    topic.categories.push(category1);
243 250

  
244 251

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

  
248 255

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

  
252 259

  
253

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

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

  
......
267 273
    defSub.charts.push(chart2);
268 274
    let utils = new IndicatorUtils();
269 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%";
270
    defSub.charts.push(new Indicator("Old tool graph","","chart","large",true,true,[utils.generateIndicatorByChartUrl("old",url,"bar")]))
276
    defSub.charts.push(new Indicator("Old tool graph", "", "chart", "large", true, true, [utils.generateIndicatorByChartUrl("old", url, "bar")]))
271 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";
272
    defSub.charts.push(new Indicator("","","chart","large",true,true,[utils.generateIndicatorByChartUrl("stats-tool",url,"bar")]))
278
    defSub.charts.push(new Indicator("", "", "chart", "large", true, true, [utils.generateIndicatorByChartUrl("stats-tool", url, "bar")]))
273 279
    return topic;
274 280
  }
275 281
}
276 282

  
277 283
export class Topic {
278
  id:string;
284
  _id: string;
279 285
  name: string;
280 286
  alias: string;
281 287
  description: string;
......
283 289
  isPublic: boolean;
284 290
  isDefault: boolean;
285 291
  categories: Category[];
286
  constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean) {
287
    this.id = null;
288
    this.name =  name;
292

  
293
  constructor(name: string, description: string, alias: string, isActive: boolean, isPublic: boolean) {
294
    this._id = null;
295
    this.name = name;
289 296
    this.description = description;
290 297
    this.alias = alias;
291 298
    this.isActive = isActive;
......
293 300
    this.categories = [];
294 301
  }
295 302
}
303

  
296 304
export class Category {
297
  id:string;
305
  _id: string;
298 306
  name: string;
299 307
  alias: string;
300 308
  description: string;
......
303 311
  isOverview: boolean;
304 312
  isDefault: boolean;
305 313
  subCategories: SubCategory[];
306
  constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean) {
307
    this.id = null;
308
    this.name =  name;
314

  
315
  constructor(name: string, description: string, alias: string, isActive: boolean, isPublic: boolean) {
316
    this._id = null;
317
    this.name = name;
309 318
    this.description = description;
310 319
    this.alias = alias;
311 320
    this.isActive = isActive;
......
315 324
}
316 325

  
317 326
export class SubCategory {
318
  id:string;
327
  _id: string;
319 328
  name: string;
320 329
  alias: string;
321 330
  description: string;
......
324 333
  isDefault: boolean;
325 334
  charts: Indicator[];
326 335
  numbers: Indicator[];
327
  constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean) {
328
    this.id = null;
329
    this.name =  name;
336

  
337
  constructor(name: string, description: string, alias: string, isActive: boolean, isPublic: boolean) {
338
    this._id = null;
339
    this.name = name;
330 340
    this.description = description;
331 341
    this.alias = alias;
332 342
    this.isActive = isActive;
......
336 346
  }
337 347

  
338 348
}
349

  
339 350
export class Indicator {
340
  id:string;
351
  _id: string;
341 352
  name: string;
342 353
  description: string;
343
  type:string; //number,chart
344
  width:string; //small,medium,large
345
  tags:string[];
354
  type: string; //number,chart
355
  width: string; //small,medium,large
356
  tags: string[];
346 357
  isActive: boolean;
347 358
  isPublic: boolean;
348 359
  isDefault: boolean;
349
  indicatorPaths:IndicatorPath[];
350
  constructor(name: string, description: string, type:string , width:string,  isActive: boolean, isPublic: boolean, indicatorPaths:IndicatorPath[]){
351
    this.id = null;
352
    this.name =  name;
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;
353 365
    this.description = description;
354
    this.type =  type;
366
    this.type = type;
355 367
    this.width = width;
356 368
    this.isActive = isActive;
357 369
    this.isPublic = isPublic;
......
362 374

  
363 375
export class IndicatorPath {
364 376
  type: string;  // for charts is type of chart {table, bar, column, etc}
365
  source:string;// for numbers is the service {statistics, search, metrics} for charts is the tool {stats-tool,old,metrics, fake}
377
  source: string;// for numbers is the service {statistics, search, metrics} for charts is the tool {stats-tool,old,metrics, fake}
366 378
  url: string;
367 379
  safeResourceUrl: SafeResourceUrl; // initialize on front end
368
  jsonPath:string[];
369
  chartObject:string;
370
  parameters:Map<string,string>;
371
  filters:Map<string, string>;
372
  constructor(type: string,  source:string, url: string, chartObject:string, jsonPath:string[]){
373
    this.type =  type;
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;
374 387
    this.url = url;
375 388
    this.source = source;
376 389
    this.jsonPath = jsonPath;
377
    this.chartObject =chartObject;
378
    this.parameters = new Map<string, string>();
379
    this.filters = new Map<string, string>();
390
    this.chartObject = chartObject;
391
    this.parameters = {};
392
    this.filters = {};
380 393
  }
381 394

  
382
  static createParameters(funderName:string=null, title:string=null, chartType:string=null):Map<string, string>{
383
    let parameters = new Map<string, string>();
384
    parameters.set("funder_name",funderName);
385
    parameters.set("title",title);
386
    parameters.set("type",chartType);
387
    return parameters;
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
    };
388 401
  }
389
  static createResultFilters(dbType:string=null):Map<string, string>{
390
    let filters = new Map<string, string>();
391
    filters.set("fundingL0",'{"groupFilters":[{"field":"'+dbType+'.project.funding level 0","type":"=","values":["'+ChartHelper.prefix+'fundingL0'+ChartHelper.suffix+'"]}],"op":"AND"}');
392
    filters.set("start_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":">=","values":["'+ChartHelper.prefix+'start_year'+ChartHelper.suffix+'"]}],"op":"AND"}');
393
    filters.set("end_year",'{"groupFilters":[{"field":"'+dbType+'.year","type":"<=","values":["'+ChartHelper.prefix+'end_year'+ChartHelper.suffix+'"]}],"op":"AND"}');
394
    return filters;
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
    };
395 409
  }
396 410
}

Also available in: Unified diff