diff --git a/src/app/utils/entities/stakeholder.ts b/src/app/utils/entities/stakeholder.ts index 9a00efb..9e7d0f4 100644 --- a/src/app/utils/entities/stakeholder.ts +++ b/src/app/utils/entities/stakeholder.ts @@ -12,6 +12,189 @@ export class Stakeholder { updateDate: string; managers: string[]; topics:Topic[]; + constructor( id: string, type: string, index_id, index_name: string, index_shortName:string , isDefaultProfile: boolean, alias:string , isActive: boolean, isPublic: boolean){ + this.id = id; + this.type = type; + this.index_id = index_id; + this.index_name = index_name; + this.index_shortName = index_shortName; + this.isDefaultProfile = isDefaultProfile; + this.alias = alias; + this.isActive = isActive; + this.isPublic = isPublic; + this.topics =[]; + this.managers =[]; + } + static createECStakeholder():Stakeholder{ + let ec:Stakeholder = new Stakeholder("ec","funder","ec__________::EC","European Comission","EC", + false,"ec",true,true); + ec.topics.push(ec.createOSTopic(ec)); + ec.topics.push(ec.createImpactTopic()); + return ec; + } + createOSTopic(stakeholder:Stakeholder):Topic{ + let topic = new Topic("OpenScience","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","open-science",true,true); + +/* let overview:Category = new Category("Overview","","overview",true,true); + topic.categories.push(overview); + let overviewDefSub = new SubCategory(null, null,null,true, true); + overview.subCategories.push(overviewDefSub);*/ + + + + let pubCategory:Category = new Category("Publications","","publications",true,true); + topic.categories.push(pubCategory); + let pubDefSub = new SubCategory(null, null,null,true, true); + pubCategory.subCategories.push(pubDefSub); +/* let pubOpenSub = new SubCategory("Openess","","openness",true,true); + pubCategory.subCategories.push(pubOpenSub); + let pubFundingSub = new SubCategory("Funding","","funding",true,true); + pubCategory.subCategories.push(pubFundingSub); + let pubDatasourceSub = new SubCategory("Content Providers","","content-providers",true,true); + pubCategory.subCategories.push(pubDatasourceSub); + let pubDocTypeSub = new SubCategory("Document Type","","doc-type",true,true); + pubCategory.subCategories.push(pubDocTypeSub); + let pubFindSub = new SubCategory("Findability","","dindability",true,true); + pubCategory.subCategories.push(pubFindSub);*/ + + + let dataCategory:Category = new Category("Research data","","data",true,true); + topic.categories.push(dataCategory); + let dataDefSub = new SubCategory(null, null,null,true, true); + dataCategory.subCategories.push(dataDefSub); + + let softwareCategory:Category = new Category("Software","","software",true,true); + topic.categories.push(softwareCategory); + let softDefSub = new SubCategory(null, null,null,true, true); + softwareCategory.subCategories.push(softDefSub); + + let otherCategory:Category = new Category("Other research products","","other",true,true); + topic.categories.push(otherCategory); + let otherDefSub = new SubCategory(null, null,null,true, true); + otherCategory.subCategories.push(otherDefSub); + + let datasourceCategory:Category = new Category("Content Providers","","content-providers",true,true); + topic.categories.push(datasourceCategory); + let datasourceDefSub = new SubCategory(null, null,null,true, true); + datasourceCategory.subCategories.push(datasourceDefSub); + + //Numbers + + let n_total_pubs = new Indicator("Publications",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, ["statistics","publications"])]); + let n_open_pubs = new Indicator("OA Publications",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, ["statistics","open_access"])]); + let n_total_projects = new Indicator("Projects",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, ["statistics","total_projects"])]); + let n_total_data = new Indicator("Reserach data",null, "number","small",true, true, [new IndicatorPath(null, "search", + "/datasets/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", ["total"])]); + let n_total_soft = new Indicator("Software",null, "number","small",true, true, [new IndicatorPath(null, "search", + "/software/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", ["total"])]); + let n_total_other = new Indicator("Other research products",null, "number","small",true, true, [new IndicatorPath(null, "search", + "/other/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", ["total"])]); + + /*overviewDefSub.numbers.push(n_total_pubs); + overviewDefSub.numbers.push(n_open_pubs); + overviewDefSub.numbers.push(n_total_projects); + overviewDefSub.numbers.push(n_total_data); + overviewDefSub.numbers.push(n_total_soft); + overviewDefSub.numbers.push(n_total_other);*/ + + pubDefSub.numbers.push(n_total_pubs); + pubDefSub.numbers.push(n_open_pubs); + softDefSub.numbers.push(n_total_soft); + dataDefSub.numbers.push(n_total_data); + otherDefSub.numbers.push(n_total_other); + + //Charts + + let c_pubs_per_project = new Indicator("Which are the top "+stakeholder.index_shortName+" projects?",null, "chart","medium",true, true, [ + new IndicatorPath("bar", "old","chart.php?com=query&data="+encodeURI('{"table":"result","fields":[{"fld":"number","agg":"count","type":"bar","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":["'+stakeholder.index_name+'"],"to":"-1"},{"name":"type","values":["publication"],"to":"-1"}],"having":[],"xStyle":{"r":"-","s":"-","l":"-","ft":"-","wt":"-"},"title":"'+stakeholder.index_shortName+' Publications per project (top 30)","subtitle":"","xaxistitle":"project","order":"d"}'), null)]); + pubDefSub.charts.push(c_pubs_per_project); + + let c_pubs_per_datasource = new Indicator("Which are the top repositories containing "+stakeholder.index_shortName+" research outputs?",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)]); + pubDefSub.charts.push(c_pubs_per_datasource); + + + let c_pubs_per_doc_type = new Indicator("In what type of documents do your researchers used to publish?",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)]); + pubDefSub.charts.push(c_pubs_per_doc_type); + + let c_pubs_funding_scheme = new Indicator("What is the percentage of green and gold publications by funding scheme / programme?",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)]); + pubDefSub.charts.push(c_pubs_funding_scheme); + + let c_pubs_open = new Indicator("Open Access publications timeline",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)]); + pubDefSub.charts.push(c_pubs_open); + + let c_pubs_access_modes = new Indicator("How your Open Access publications 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)]); + pubDefSub.charts.push(c_pubs_access_modes); + + 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)]); + pubDefSub.charts.push(c_pubs_av_embargo); + + let c_pubs_OA_journals = new Indicator("Publications in OA Journals over time",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)]); + pubDefSub.charts.push(c_pubs_OA_journals); + + 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)]); + pubDefSub.charts.push(c_pubs_green_year); + + let c_pubs_datasource_country = new Indicator("What is the percentage of OA pubs by repositories 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)]); + pubDefSub.charts.push(c_pubs_datasource_country); + + let c_pubs_funding_country = new Indicator("What is the percentage of OA pubs by projects 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)]); + pubDefSub.charts.push(c_pubs_funding_country); + + let c_data_year = new Indicator("How your Open research data are shaped over the years?",null, "chart","medium",true, true, + [new IndicatorPath("column", "new",'/chart?json='+ + encodeURI('{"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":["'+stakeholder.index_name+'"]},{"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)]); + dataDefSub.charts.push(c_data_year); + + 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)]); + otherDefSub.charts.push(c_other_year); + + 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)]); + pubDefSub.charts.push(c_datasources_access_modes); + + 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)]); + pubDefSub.charts.push(c_pub_nometa_year); + + 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)]); + pubDefSub.charts.push(c_pub_meta_linked_year); + + 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)]); + pubDefSub.charts.push(c_pub_colocated_year); + + 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)]); + pubDefSub.charts.push(c_pub_pids); + + 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)]); + pubDefSub.charts.push(c_oai_pmh_datasources); + + return topic; + } + createImpactTopic():Topic{ + let topic = new Topic("Impact","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","impact",true,true); + + let pubCategory:Category = new Category("Publications","","publications",true,true); + topic.categories.push(pubCategory); + let pubDefSub = new SubCategory(null, null,null,true, true); + pubCategory.subCategories.push(pubDefSub); + + let dataCategory:Category = new Category("Research data","","data",true,true); + topic.categories.push(dataCategory); + let dataDefSub = new SubCategory(null, null,null,true, true); + dataCategory.subCategories.push(dataDefSub); + + let softwareCategory:Category = new Category("Software","","software",true,true); + topic.categories.push(softwareCategory); + let softDefSub = new SubCategory(null, null,null,true, true); + softwareCategory.subCategories.push(softDefSub); + + let otherCategory:Category = new Category("Other research products","","other",true,true); + topic.categories.push(otherCategory); + let otherDefSub = new SubCategory(null, null,null,true, true); + otherCategory.subCategories.push(otherDefSub); + + + return topic; + } } export class Topic { name: string; @@ -20,6 +203,14 @@ export class Topic { isActive: boolean; isPublic: boolean; categories: Category[]; + constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean){ + this.name = name; + this.description = description; + this.alias = alias; + this.isActive = isActive; + this.isPublic = isPublic; + this.categories = []; + } } export class Category { name: string; @@ -29,6 +220,14 @@ export class Category { isPublic: boolean; isOverview: boolean; subCategories: SubCategory[]; + constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean){ + this.name = name; + this.description = description; + this.alias = alias; + this.isActive = isActive; + this.isPublic = isPublic; + this.subCategories = []; + } } export class SubCategory { @@ -39,9 +238,19 @@ export class SubCategory { isPublic: boolean; charts: Indicator[]; numbers: Indicator[]; + constructor(name: string, description: string, alias:string , isActive: boolean, isPublic: boolean){ + this.name = name; + this.description = description; + this.alias = alias; + this.isActive = isActive; + this.isPublic = isPublic; + this.charts = []; + this.numbers = []; + } } export class Indicator { + id:string; name: string; description: string; type:string; //number,chart @@ -50,10 +259,28 @@ export class Indicator { isActive: boolean; isPublic: boolean; indicatorPaths:IndicatorPath[]; + constructor(name: string, description: string, type:string , width:string, isActive: boolean, isPublic: boolean, indicatorPaths:IndicatorPath[]){ + this.name = name; + this.description = description; + this.type = type; + this.width = width; + this.isActive = isActive; + this.isPublic = isPublic; + this.indicatorPaths = indicatorPaths; + } + } export class IndicatorPath { - type: string; + type: string; // for charts is type of chart {table, bar, column, etc} + source:string;// for numbers is the service {statistics, search, metrics} for charts is the tool {new,old,metrics, fake} url: string; jsonPath:string[]; + constructor(type: string, source:string, url: string, jsonPath:string[]){ + this.type = type; + this.url = url; + this.source = source; + this.jsonPath = jsonPath; + } + }