[Monitor_Dashboard|Trunk]

update default profile with more number indicators
	monitor.component: get stakeholder from subject



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@57550 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
Argiro Kokogiannaki 2019-11-08 13:05:25 +00:00
parent 8553dade4a
commit 1c80a95291
3 changed files with 62 additions and 77 deletions

View File

@ -44,8 +44,8 @@ export class AppComponent {
if(!this.stakeholderService.stakeholder ||
this.stakeholderService.stakeholder.alias !== params['stakeholder']) {
this.stakeholderService.getStakeholder(this.properties.monitorServiceAPIURL, params['stakeholder']).subscribe(stakeholder => {
// let stakeHolder:Stakeholder = Stakeholder.createECStakeholder();
// let stakeHolder:Stakeholder = StakeholderCreator.createFunderFromDefaultProfile("ec","funder","ec__________::EC","European Commission","EC",false,"ec",true,true);
// stakeholder = Stakeholder.createECStakeholder();
// stakeholder = StakeholderCreator.createFunderFromDefaultProfile("ec","funder","ec__________::EC","European Commission","EC",false,"ec",true,true);
this.stakeholderService.setStakeholder(stakeholder);
});
}

View File

@ -65,7 +65,7 @@ export class MonitorComponent implements OnInit, OnDestroy {
this.status = this.errorCodes.LOADING;
this.numberResults = new Map<number, number>();
this.chartsActiveType = new Map<number, IndicatorPath>();
this.stakeholderService.getStakeholder(this.properties.monitorServiceAPIURL, params['stakeholder']).subscribe(stakeholder => {
this.stakeholderService.getStakeholderAsObservable().subscribe(stakeholder => {
this.stakeholder = stakeholder;
this.seoService.createLinkForCanonicalURL(url, false);
this._meta.updateTag({content: url}, "property='og:url'");

View File

@ -31,6 +31,21 @@ export class StakeholderCreator {
}
}
}
for (let indicator of subCategory.numbers) {
for (let indicatorPath of indicator.indicatorPaths) {
indicatorPath.url = indicatorPath.url.replace("_funder_id_", funder.index_id);
// if(indicatorPath.parameters) {
// indicatorPath.parameters.forEach((value: string, key: string) => {
// if (value.indexOf("_funder_name_")!=-1) {
// indicatorPath.parameters.set(key,value.toString().replace("_funder_name_", funder.index_name));
// }else if (value.indexOf("_fsn_")!=-1) {
// indicatorPath.parameters.set(key,value.toString().replace("_fsn_", funder.index_shortName.toLowerCase()));
// }
// });
// }
}
}
}
}
@ -67,7 +82,20 @@ export class StakeholderCreator {
}
static createResearchProductionPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory{
let pubDefSub = new SubCategory(typePlural, null,null,true, true);
let n_total = new Indicator("Total "+typePlural,null, "number","small",true, true, [new IndicatorPath(null, "search",
"/"+dbTypePlural+"/count?fq="+(encodeURIComponent("relfunderid exact "+stakeholder.index_id))+"&format=json", null,["total"])]);
pubDefSub.numbers.push(n_total);
if( dbType != "publication") {
let n_linkedPubs = this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Publications","publication");
// new Indicator("Linked with Publications", null, "number", "small", true, true, [new IndicatorPath(null, "search",
// "/resources?query="+encodeURIComponent(" ( (oaftype exact result) and (resulttypeid exact " + dbTypePlural + ") and (relresulttype=publication) )")+"&fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&page=0&size=0&format=json", null, ["meta","total"])]);
pubDefSub.numbers.push(n_linkedPubs);
}
let res_timeline = new Indicator("",null, "chart","small",true, true,[new IndicatorPath("column", "stats-tool", "chart?json=", '{"library":"HighCharts","chartDescription":{"queries":[{"name":"'+typePlural+'","type":"'+ChartHelper.prefix+'type'+ChartHelper.suffix+'","query":{"select":[{"field":"'+dbType+'","aggregate":"count"},{"field":"'+dbType+'.year","aggregate":null}],"filters":[{"groupFilters":[{"field":"'+dbType+'.project.funder","type":"=","values":["'+ChartHelper.prefix+'funder_name'+ChartHelper.suffix+'"]}],"op":"AND"},{"groupFilters":[{"field":"'+dbType+'.year","type":">=","values":["2008"]},{"field":"'+dbType+'.year","type":"<=","values":["2020"]}],"op":"AND"}],"entity":"'+dbType+'","profile":"OpenAIRE All-inclusive","limit":"0"}}],"chart":{"backgroundColor":"#FFFFFFFF","borderColor":"#335cadff","borderRadius":0,"borderWidth":0,"plotBorderColor":"#ccccccff","plotBorderWidth":0},"title":{"text":"'+ChartHelper.prefix+'title'+ChartHelper.suffix+'"},"subtitle":{},"yAxis":{"title":{"text":"'+typePlural+'"}},"xAxis":{"title":{"text":"Year"}},"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)]);
res_timeline.indicatorPaths[0].parameters = IndicatorPath.createParameters(stakeholder.index_name,typePlural+" timeline","column");
pubDefSub.charts.push(res_timeline);
@ -176,83 +204,40 @@ export class StakeholderCreator {
static createOSTopic(stakeholder:Stakeholder):Topic{
let topic = new Topic("Open Science","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","open-science",true,true);
/* let overview:Category = new Category("Overview","","overview",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","","'+dbType+'s",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);*/
let projectCategory:Category = new Category("Projects","","projects",true,true);
topic.categories.push(projectCategory);
let projectDefSub = new SubCategory(null, null,null,true, true);
projectCategory.subCategories.push(projectDefSub);
//Numbers
let n_total_pubs = new Indicator("Publications",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null, ["statistics","publications"])]);
let n_open_pubs = new Indicator("OA Publications",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null,["statistics","open_access"])]);
let n_total_projects = new Indicator("Projects",null, "number","small",true, true, [new IndicatorPath(null, "statistics","/funders/"+stakeholder.id, null, ["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", null, ["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", null,["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", null,["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);
projectDefSub.numbers.push(n_total_projects);
overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Publications","Publication","publication","publications"));
overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Research data","Research data","dataset","datasets"));
overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Software","Software","software","software"));
overview.subCategories.push(this.createOSOverviewPerType(stakeholder,"Other research products","Other research product","other","other"));
return topic;
}
static createOSOverviewPerType(stakeholder:Stakeholder,typePlural, typeSingl, dbType, dbTypePlural ):SubCategory {
let pubDefSub = new SubCategory(typePlural, null, dbTypePlural, true, true);
if( dbType != "publication") {
pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Publications","publication"));
}
if( dbType != "dataset") {
pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Research data","dataset"));
}
if( dbType != "software") {
pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Software","software"));
}
if( dbType != "other") {
pubDefSub.numbers.push(this.createLinkToIndicator(stakeholder,typePlural,typeSingl, dbType,"Other Research products","other"));
}
return pubDefSub;
}
static createLinkToIndicator(stakeholder:Stakeholder,typePlural, typeSingl, dbType, linkedToName,linkedToType ):Indicator {
let n_linkedPubs = new Indicator(typePlural+" linked to "+linkedToName, null, "number", "small", true, true, [new IndicatorPath(null, "search",
"/resources?query=" + encodeURIComponent(" ( (oaftype exact result) and (resulttypeid exact " + dbType + ") and (relresulttype="+linkedToType+") )") + "&fq=" + (encodeURIComponent("relfunderid exact " + stakeholder.index_id)) + "&page=0&size=0&format=json", null, ["meta", "total"])]);
return n_linkedPubs;
}
static createFundingImpactTopic():Topic{
let topic = new Topic("Impact/Correlation","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do...","impact",true,true);