Merge branch 'dev' of nes.uni-due.de:lbs/smartguide into feature/keywords-analysis
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>Forschungszwecke</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
@if (this.authorWorkPurposes().purposes?.length === 0) {
|
||||
@if (this.authorWorkClassifications().length === 0) {
|
||||
<div class="no-results">
|
||||
Keine klassifizierten Publikationen gefunden.
|
||||
</div>
|
||||
@@ -21,19 +21,32 @@
|
||||
<div class="purpose-info-cards">
|
||||
<app-info-card
|
||||
[value]="this.basicResearchAmount() + ''"
|
||||
description="Grundlagenforschung" />
|
||||
[description]="this.basicResearchLabel" />
|
||||
<app-info-card
|
||||
[value]="this.appliedResearchAmount() + ''"
|
||||
description="Anwendungsbasierte Forschung" />
|
||||
[description]="this.appliedResearchLabel" />
|
||||
<app-info-card
|
||||
[value]="this.nonResearchAmount() + ''"
|
||||
description="Nicht-forschende Tätigkeit" />
|
||||
[description]="this.nonResearchLabel" />
|
||||
<app-info-card
|
||||
[value]="this.experimentalDevelopmentAmount() + ''"
|
||||
description="Experimentelle Entwicklung" />
|
||||
[description]="this.experimentalDevelopmentLabel" />
|
||||
<app-info-card
|
||||
[value]="this.notClassifiedAmmount() + ''"
|
||||
description="Nicht klassifiziert" />
|
||||
[description]="this.notClassifiedLabel" />
|
||||
<div>
|
||||
<div class="classification-disclaimer">
|
||||
<button
|
||||
mat-icon-button
|
||||
matTooltip="Die Klassifizierung der Publikationen erfolgt nur für eine ausgewählte Anzahl von Institutionen. Wenn eine Publikation nicht zu einer dieser Institutionen gehört, wird sie nicht klassifiziert.">
|
||||
<mat-icon>info_outline</mat-icon>
|
||||
</button>
|
||||
<span
|
||||
>Im Diagramm sind ausschließlich klassifizierte Publikationen
|
||||
enthalten.</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel class="mat-elevation-z1" [expanded]="true">
|
||||
|
||||
@@ -37,3 +37,23 @@ mat-panel-description {
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.classification-disclaimer {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.classification-disclaimer button {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.classification-disclaimer mat-icon {
|
||||
font-size: 18px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
line-height: 18px;
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Component, computed, effect, input } from '@angular/core';
|
||||
|
||||
import {
|
||||
AuthorWorkPurposes,
|
||||
InseWorksV2ModelWorkPage,
|
||||
Author,
|
||||
SpecificWorkPurpose,
|
||||
WorkPurpose,
|
||||
WorkTopic,
|
||||
WorkClassificationPage,
|
||||
WorkClassification,
|
||||
WorkPrimaryCategory,
|
||||
} from '../../api';
|
||||
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||
import * as echarts from 'echarts/core';
|
||||
@@ -22,6 +22,10 @@ import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-pagina
|
||||
import { AppInfoCardComponent } from '../../shared/ui/app-info-card/app-info-card.component';
|
||||
import { PublicationTableComponent } from '../../shared/ui/publication-table/publication-table.component';
|
||||
import { PublicationFilterComponent } from '../../shared/ui/publication-filters/publication-filters.component';
|
||||
import { transformWorkPrimaryCategory } from '../../shared/pipes/work-primary-category.pipe';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
echarts.use([
|
||||
GridComponent,
|
||||
CanvasRenderer,
|
||||
@@ -39,24 +43,13 @@ interface YearlyPurposeCounts {
|
||||
notClassified: number;
|
||||
}
|
||||
|
||||
const PURPOSE_LABELS: Record<
|
||||
| 'BASIC_RESEARCH'
|
||||
| 'APPLIED_RESEARCH'
|
||||
| 'NON_RESEARCH'
|
||||
| 'EXPERIMENTAL_DEVELOPMENT'
|
||||
| 'NOT_CLASSIFIED',
|
||||
string
|
||||
> = {
|
||||
BASIC_RESEARCH: 'Grundlagenforschung',
|
||||
APPLIED_RESEARCH: 'anwendungsbasierte Forschung',
|
||||
NON_RESEARCH: 'nicht-forschende Tätigkeit',
|
||||
EXPERIMENTAL_DEVELOPMENT: 'experimentelle Entwicklung',
|
||||
NOT_CLASSIFIED: 'nicht klassifiziert',
|
||||
};
|
||||
@Component({
|
||||
selector: 'app-person-publications',
|
||||
imports: [
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
MatExpansionModule,
|
||||
MatTooltipModule,
|
||||
NgxEchartsDirective,
|
||||
AppInfoCardComponent,
|
||||
PublicationTableComponent,
|
||||
@@ -74,49 +67,74 @@ export class PersonPublicationsComponent {
|
||||
selectedInstitutions = input.required<Array<Author>>();
|
||||
selectedTopics = input.required<Array<WorkTopic>>();
|
||||
|
||||
authorWorkPurposes = input.required<AuthorWorkPurposes>();
|
||||
authorWorkClassificationPage = input.required<WorkClassificationPage>();
|
||||
authorWorkClassifications = computed(
|
||||
() => this.authorWorkClassificationPage().elements ?? [],
|
||||
);
|
||||
|
||||
specificWorkPurposesByYear = computed(() => {
|
||||
const authorWorkPurposes = this.authorWorkPurposes();
|
||||
return this.getAuthorSpecificWorkPurposesByYear(authorWorkPurposes);
|
||||
const authorWorkClassifications = this.authorWorkClassifications();
|
||||
return this.getAuthorWorkClassificationByYear(authorWorkClassifications);
|
||||
});
|
||||
basicResearchAmount = computed(() => {
|
||||
return this.countPurpose(
|
||||
this.authorWorkPurposes().purposes || [],
|
||||
WorkPurpose.BasicResearch,
|
||||
this.authorWorkClassifications(),
|
||||
WorkPrimaryCategory.BasicResearch,
|
||||
);
|
||||
});
|
||||
basicResearchLabel = transformWorkPrimaryCategory(
|
||||
WorkPrimaryCategory.BasicResearch,
|
||||
);
|
||||
|
||||
appliedResearchAmount = computed(() => {
|
||||
return this.countPurpose(
|
||||
this.authorWorkPurposes().purposes || [],
|
||||
WorkPurpose.AppliedResearch,
|
||||
this.authorWorkClassifications(),
|
||||
WorkPrimaryCategory.AppliedResearch,
|
||||
);
|
||||
});
|
||||
appliedResearchLabel = transformWorkPrimaryCategory(
|
||||
WorkPrimaryCategory.AppliedResearch,
|
||||
);
|
||||
|
||||
nonResearchAmount = computed(() => {
|
||||
return this.countPurpose(
|
||||
this.authorWorkPurposes().purposes || [],
|
||||
WorkPurpose.NonResearch,
|
||||
this.authorWorkClassifications(),
|
||||
WorkPrimaryCategory.NonResearch,
|
||||
);
|
||||
});
|
||||
nonResearchLabel = transformWorkPrimaryCategory(
|
||||
WorkPrimaryCategory.NonResearch,
|
||||
);
|
||||
|
||||
experimentalDevelopmentAmount = computed(() => {
|
||||
return this.countPurpose(
|
||||
this.authorWorkPurposes().purposes || [],
|
||||
WorkPurpose.ExperimentalDevelopment,
|
||||
this.authorWorkClassifications(),
|
||||
WorkPrimaryCategory.ExperimentalDevelopment,
|
||||
);
|
||||
});
|
||||
experimentalDevelopmentLabel = transformWorkPrimaryCategory(
|
||||
WorkPrimaryCategory.ExperimentalDevelopment,
|
||||
);
|
||||
|
||||
notClassifiedAmmount = computed(() => {
|
||||
return this.countPurpose(
|
||||
this.authorWorkPurposes().purposes || [],
|
||||
WorkPurpose.NotClassified,
|
||||
this.authorWorkClassifications(),
|
||||
WorkPrimaryCategory.NotClassified,
|
||||
);
|
||||
});
|
||||
notClassifiedLabel = transformWorkPrimaryCategory(
|
||||
WorkPrimaryCategory.NotClassified,
|
||||
);
|
||||
|
||||
countPurpose = (
|
||||
specificWorkPurposes: SpecificWorkPurpose[],
|
||||
purpose: WorkPurpose,
|
||||
workClassifications: WorkClassification[],
|
||||
primaryCategory: WorkPrimaryCategory,
|
||||
) => {
|
||||
let count = 0;
|
||||
for (const specificWorkPurpose of specificWorkPurposes) {
|
||||
if (specificWorkPurpose.purpose == purpose) {
|
||||
for (const workClassification of workClassifications) {
|
||||
if (
|
||||
workClassification.classification?.primary_category == primaryCategory
|
||||
) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -134,28 +152,31 @@ export class PersonPublicationsComponent {
|
||||
});
|
||||
}
|
||||
|
||||
getAuthorSpecificWorkPurposesByYear(
|
||||
authorWorkPurposes: AuthorWorkPurposes,
|
||||
): Record<number, Array<SpecificWorkPurpose>> {
|
||||
const purposesByYear: Record<number, Array<SpecificWorkPurpose>> = {};
|
||||
for (const purpose of authorWorkPurposes.purposes ?? []) {
|
||||
const year = purpose.publication_year;
|
||||
getAuthorWorkClassificationByYear(
|
||||
authorWorkClassifications: WorkClassification[],
|
||||
): Record<number, Array<WorkClassification>> {
|
||||
const workClassificationsByYear: Record<
|
||||
number,
|
||||
Array<WorkClassification>
|
||||
> = {};
|
||||
for (const classification of authorWorkClassifications) {
|
||||
const year = classification.publication_year;
|
||||
if (!year) continue;
|
||||
|
||||
if (!purposesByYear[year]) {
|
||||
purposesByYear[year] = [];
|
||||
if (!workClassificationsByYear[year]) {
|
||||
workClassificationsByYear[year] = [];
|
||||
}
|
||||
|
||||
purposesByYear[year].push(purpose);
|
||||
workClassificationsByYear[year].push(classification);
|
||||
}
|
||||
return purposesByYear;
|
||||
return workClassificationsByYear;
|
||||
}
|
||||
|
||||
buildYearlyCounts(
|
||||
purposesByYear: Record<number, Array<SpecificWorkPurpose>>,
|
||||
workClassificationsByYear: Record<number, Array<WorkClassification>>,
|
||||
): YearlyPurposeCounts[] {
|
||||
return Object.entries(purposesByYear)
|
||||
.map(([year, purposes]) => {
|
||||
return Object.entries(workClassificationsByYear)
|
||||
.map(([year, classificiations]) => {
|
||||
const counts: YearlyPurposeCounts = {
|
||||
year: Number(year),
|
||||
basicResearch: 0,
|
||||
@@ -164,16 +185,22 @@ export class PersonPublicationsComponent {
|
||||
experimentalDevelopment: 0,
|
||||
notClassified: 0,
|
||||
};
|
||||
for (const purpose of purposes) {
|
||||
if (purpose.purpose == WorkPurpose.BasicResearch) {
|
||||
for (const classification of classificiations) {
|
||||
const primaryCategory =
|
||||
classification.classification?.primary_category;
|
||||
if (!primaryCategory) continue;
|
||||
|
||||
if (primaryCategory == WorkPrimaryCategory.BasicResearch) {
|
||||
counts.basicResearch++;
|
||||
} else if (purpose.purpose == WorkPurpose.AppliedResearch) {
|
||||
} else if (primaryCategory == WorkPrimaryCategory.AppliedResearch) {
|
||||
counts.appliedResearch++;
|
||||
} else if (purpose.purpose == WorkPurpose.NonResearch) {
|
||||
} else if (primaryCategory == WorkPrimaryCategory.NonResearch) {
|
||||
counts.nonResearch++;
|
||||
} else if (purpose.purpose == WorkPurpose.ExperimentalDevelopment) {
|
||||
} else if (
|
||||
primaryCategory == WorkPrimaryCategory.ExperimentalDevelopment
|
||||
) {
|
||||
counts.experimentalDevelopment++;
|
||||
} else if (purpose.purpose == WorkPurpose.NotClassified) {
|
||||
} else if (primaryCategory == WorkPrimaryCategory.NotClassified) {
|
||||
counts.notClassified++;
|
||||
}
|
||||
}
|
||||
@@ -187,11 +214,11 @@ export class PersonPublicationsComponent {
|
||||
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
|
||||
legend: {
|
||||
data: [
|
||||
PURPOSE_LABELS.BASIC_RESEARCH,
|
||||
PURPOSE_LABELS.APPLIED_RESEARCH,
|
||||
PURPOSE_LABELS.NON_RESEARCH,
|
||||
PURPOSE_LABELS.EXPERIMENTAL_DEVELOPMENT,
|
||||
PURPOSE_LABELS.NOT_CLASSIFIED,
|
||||
this.basicResearchLabel,
|
||||
this.appliedResearchLabel,
|
||||
this.nonResearchLabel,
|
||||
this.experimentalDevelopmentLabel,
|
||||
this.notClassifiedLabel,
|
||||
],
|
||||
bottom: 0,
|
||||
itemGap: 40,
|
||||
@@ -210,35 +237,35 @@ export class PersonPublicationsComponent {
|
||||
yAxis: { type: 'value' },
|
||||
series: [
|
||||
{
|
||||
name: PURPOSE_LABELS.BASIC_RESEARCH,
|
||||
name: this.basicResearchLabel,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map((d) => d.basicResearch),
|
||||
},
|
||||
{
|
||||
name: PURPOSE_LABELS.APPLIED_RESEARCH,
|
||||
name: this.appliedResearchLabel,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map((d) => d.appliedResearch),
|
||||
},
|
||||
{
|
||||
name: PURPOSE_LABELS.NON_RESEARCH,
|
||||
name: this.nonResearchLabel,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map((d) => d.nonResearch),
|
||||
},
|
||||
{
|
||||
name: PURPOSE_LABELS.EXPERIMENTAL_DEVELOPMENT,
|
||||
name: this.experimentalDevelopmentLabel,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map((d) => d.experimentalDevelopment),
|
||||
},
|
||||
{
|
||||
name: PURPOSE_LABELS.NOT_CLASSIFIED,
|
||||
name: this.notClassifiedLabel,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
|
||||
Reference in New Issue
Block a user