Merge branch 'dev' of nes.uni-due.de:lbs/smartguide into feature/keywords-analysis
This commit is contained in:
@@ -0,0 +1,179 @@
|
||||
<div class="compare-layout">
|
||||
<header class="compare-header">
|
||||
<h1>Autoren-Vergleich</h1>
|
||||
|
||||
<div class="compare-meta">
|
||||
@if (keywords().length > 0) {
|
||||
<span class="meta-chip">
|
||||
<mat-icon>topic</mat-icon>
|
||||
{{ keywords().join(', ') }}
|
||||
</span>
|
||||
}
|
||||
@if (timespan(); as span) {
|
||||
<span class="meta-chip">
|
||||
<mat-icon>date_range</mat-icon>
|
||||
{{ span.from }}–{{ span.to }}
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
@if (hasData()) {
|
||||
<ul class="author-legend">
|
||||
@for (author of summary(); track author.authorId) {
|
||||
<li class="legend-item">
|
||||
<span
|
||||
class="legend-swatch"
|
||||
[style.background]="author.color"></span>
|
||||
<span class="legend-name">{{ author.name }}</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
</header>
|
||||
|
||||
@if (loading()) {
|
||||
<p class="compare-hint">Lädt…</p>
|
||||
} @else if (!hasData()) {
|
||||
<p class="compare-hint">Keine Daten für die ausgewählten Autoren.</p>
|
||||
} @else {
|
||||
<!-- section 1: stats over the topic-filtered works -->
|
||||
<section class="card">
|
||||
<h2 class="card-title">Kennzahlen zu den Keywords</h2>
|
||||
<p class="card-sub">
|
||||
Bester Wert je Zeile ist hervorgehoben. „–“ bedeutet, dass der Wert für
|
||||
diese:n Autor:in nicht vorliegt.
|
||||
</p>
|
||||
<ng-container
|
||||
[ngTemplateOutlet]="statsTable"
|
||||
[ngTemplateOutletContext]="{ rows: topicRows() }" />
|
||||
</section>
|
||||
|
||||
<!-- section 2: author-level stats, independent of the keywords and time -->
|
||||
<section class="card">
|
||||
<h2 class="card-title">Kennzahlen zur Person</h2>
|
||||
<p class="card-sub">Unabhängig von den Keywords und Zeitraum.</p>
|
||||
<ng-container
|
||||
[ngTemplateOutlet]="statsTable"
|
||||
[ngTemplateOutletContext]="{ rows: staticRows() }" />
|
||||
</section>
|
||||
|
||||
<!-- section 3: topic profile over ALL works of each author -->
|
||||
<section class="card">
|
||||
<h2 class="card-title">Themenprofil</h2>
|
||||
<p class="card-sub">"Topic-Analyse"</p>
|
||||
|
||||
@if (profileLoading()) {
|
||||
<p class="compare-hint">Lädt…</p>
|
||||
} @else if (orderedProfiles().length > 0) {
|
||||
<h3 class="chart-title">Themenverteilung nach Subfield</h3>
|
||||
<p class="chart-hint">
|
||||
Von allen Arbeiten der Autor:innen im Zeitraum: der Anteil je
|
||||
Subfield, bestimmt über das Primärthema jeder Arbeit. (Top 5)
|
||||
</p>
|
||||
<div
|
||||
echarts
|
||||
[options]="subfieldChart()"
|
||||
class="profile-chart profile-chart-wide"></div>
|
||||
|
||||
<div class="chart-grid">
|
||||
<div class="chart-box">
|
||||
<h3 class="chart-title">Themen-Fokus</h3>
|
||||
<p class="chart-hint">
|
||||
Anzahl der Werke zum Suchthema im Verhältnis zum Gesamtwerk – und
|
||||
wie viele davon das Suchthema als Primärthema tragen.
|
||||
</p>
|
||||
<div echarts [options]="focusChart()" class="profile-chart"></div>
|
||||
</div>
|
||||
<div class="chart-box">
|
||||
<h3 class="chart-title">Themenbreite</h3>
|
||||
<p class="chart-hint">
|
||||
Einzigartige Primärthemen, Subfields und Fields im Gesamtwerk
|
||||
(Primary Topic)
|
||||
</p>
|
||||
<div echarts [options]="breadthChart()" class="profile-chart"></div>
|
||||
</div>
|
||||
</div>
|
||||
} @else {
|
||||
<p class="compare-hint">Keine Daten für das Themenprofil.</p>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
</div>
|
||||
|
||||
<ng-template #statsTable let-rows="rows">
|
||||
<div class="table-scroll">
|
||||
<table class="compare-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="metric-col">Kennzahl</th>
|
||||
@for (author of summary(); track author.authorId) {
|
||||
<th class="author-col">
|
||||
<span class="th-name">
|
||||
<span
|
||||
class="legend-swatch"
|
||||
[style.background]="author.color"></span>
|
||||
{{ author.name }}
|
||||
</span>
|
||||
</th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@for (row of rows; track row.label) {
|
||||
<tr>
|
||||
<th scope="row" class="metric-col">
|
||||
<span class="metric-label">{{ row.label }}</span>
|
||||
<span class="metric-hint">{{ row.hint }}</span>
|
||||
@if (row.kind === 'group') {
|
||||
<span class="position-legend">
|
||||
@for (seg of row.segments; track $index; let i = $index) {
|
||||
@if (i > 0) {
|
||||
<span class="pos-sep">|</span>
|
||||
}
|
||||
<span class="pos {{ seg.colorClass }}">{{
|
||||
seg.label
|
||||
}}</span>
|
||||
}
|
||||
</span>
|
||||
}
|
||||
</th>
|
||||
@if (row.kind === 'group') {
|
||||
@for (gc of row.groupCells; track $index) {
|
||||
<td class="value-cell position-cell">
|
||||
@for (v of gc.values; track $index; let i = $index) {
|
||||
@if (i > 0) {
|
||||
<span class="pos-sep">|</span>
|
||||
}
|
||||
<span class="pos {{ row.segments[i].colorClass }}">
|
||||
{{
|
||||
v === null
|
||||
? '–'
|
||||
: row.segments[i].plain
|
||||
? v
|
||||
: row.segments[i].decimals
|
||||
? (v | number: '1.2-2')
|
||||
: (v | number)
|
||||
}}
|
||||
</span>
|
||||
}
|
||||
</td>
|
||||
}
|
||||
} @else {
|
||||
@for (cell of row.cells; track $index) {
|
||||
<td class="value-cell" [class.best]="cell.best">
|
||||
@if (cell.raw === null) {
|
||||
<span class="value-empty">–</span>
|
||||
} @else if (row.decimals) {
|
||||
{{ cell.raw | number: '1.2-2' }}
|
||||
} @else {
|
||||
{{ cell.raw | number }}
|
||||
}
|
||||
</td>
|
||||
}
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</ng-template>
|
||||
@@ -0,0 +1,279 @@
|
||||
.compare-layout {
|
||||
padding: 28px 32px 42px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
max-width: 1280px;
|
||||
margin: 0 auto;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* ---- header ---- */
|
||||
.compare-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
font-weight: 700;
|
||||
color: var(--sg-text, #101a3d);
|
||||
}
|
||||
}
|
||||
|
||||
.compare-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.meta-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 4px 12px;
|
||||
border-radius: 999px;
|
||||
background: var(--sg-surface-muted, #f7f9ff);
|
||||
border: 1px solid var(--sg-border, #dde5f2);
|
||||
color: var(--sg-text-muted, #64708f);
|
||||
font-size: 13px;
|
||||
|
||||
mat-icon {
|
||||
font-size: 16px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
color: var(--sg-text-soft, #8a95b3);
|
||||
}
|
||||
}
|
||||
|
||||
.author-legend {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px 18px;
|
||||
}
|
||||
|
||||
.legend-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--sg-text, #101a3d);
|
||||
}
|
||||
|
||||
.legend-swatch {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 3px;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
/* ---- cards ---- */
|
||||
.card {
|
||||
background: #fff;
|
||||
border: 1px solid #d7e4ff;
|
||||
border-radius: 16px;
|
||||
box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
|
||||
padding: 20px 22px;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
color: var(--sg-text, #101a3d);
|
||||
}
|
||||
|
||||
.card-sub {
|
||||
margin: 4px 0 0;
|
||||
font-size: 13px;
|
||||
color: var(--sg-text-muted, #64708f);
|
||||
}
|
||||
|
||||
.compare-hint {
|
||||
padding: 24px;
|
||||
text-align: center;
|
||||
color: var(--sg-text-muted, #64708f);
|
||||
}
|
||||
|
||||
/* ---- comparison table ---- */
|
||||
.table-scroll {
|
||||
margin-top: 14px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.compare-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 14px;
|
||||
|
||||
thead th {
|
||||
text-align: left;
|
||||
padding: 0 16px 10px;
|
||||
border-bottom: 2px solid var(--sg-border, #dde5f2);
|
||||
vertical-align: bottom;
|
||||
}
|
||||
|
||||
.author-col {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.th-name {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-weight: 700;
|
||||
color: var(--sg-text, #101a3d);
|
||||
}
|
||||
|
||||
tbody tr + tr th,
|
||||
tbody tr + tr td {
|
||||
border-top: 1px solid var(--sg-border, #dde5f2);
|
||||
}
|
||||
|
||||
tbody th,
|
||||
tbody td {
|
||||
padding: 12px 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.metric-col {
|
||||
min-width: 220px;
|
||||
}
|
||||
|
||||
.metric-label {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
color: var(--sg-text, #101a3d);
|
||||
}
|
||||
|
||||
.metric-hint {
|
||||
display: block;
|
||||
margin-top: 2px;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: var(--sg-text-soft, #8a95b3);
|
||||
}
|
||||
|
||||
.value-cell {
|
||||
text-align: right;
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: var(--sg-text, #101a3d);
|
||||
white-space: nowrap;
|
||||
|
||||
&.best {
|
||||
font-weight: 700;
|
||||
color: var(--sg-primary, #0b1020);
|
||||
background: var(--sg-surface-soft, #f3f6fd);
|
||||
}
|
||||
}
|
||||
|
||||
.value-empty {
|
||||
color: var(--sg-text-soft, #8a95b3);
|
||||
}
|
||||
|
||||
/* author-position row: first / middle / last shown together, colour-coded */
|
||||
.position-cell {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.pos {
|
||||
font-weight: 700;
|
||||
font-variant-numeric: tabular-nums;
|
||||
|
||||
&.pos-first {
|
||||
color: #16a34a;
|
||||
}
|
||||
&.pos-middle {
|
||||
color: #d97706;
|
||||
}
|
||||
&.pos-last {
|
||||
color: #2563eb;
|
||||
}
|
||||
&.rel-count {
|
||||
color: #7c3aed;
|
||||
}
|
||||
&.rel-avg {
|
||||
color: #0891b2;
|
||||
}
|
||||
&.cit-total {
|
||||
color: #b91c1c;
|
||||
}
|
||||
&.cit-avg {
|
||||
color: #ea580c;
|
||||
}
|
||||
&.fwci-count {
|
||||
color: #4d7c0f;
|
||||
}
|
||||
&.fwci-avg {
|
||||
color: #0d9488;
|
||||
}
|
||||
&.year-from {
|
||||
color: #6d28d9;
|
||||
}
|
||||
&.year-to {
|
||||
color: #be185d;
|
||||
}
|
||||
&.ind-count {
|
||||
color: #92400e;
|
||||
}
|
||||
&.ind-share {
|
||||
color: #1d4ed8;
|
||||
}
|
||||
}
|
||||
|
||||
.pos-sep {
|
||||
margin: 0 4px;
|
||||
color: var(--sg-text-soft, #b6bed6);
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.position-legend {
|
||||
display: block;
|
||||
margin-top: 4px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
/* ---- section 3: topic profile charts ---- */
|
||||
.chart-title {
|
||||
margin: 18px 0 0;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: var(--sg-text, #101a3d);
|
||||
}
|
||||
|
||||
.chart-hint {
|
||||
margin: 2px 0 8px;
|
||||
font-size: 12px;
|
||||
color: var(--sg-text-muted, #64708f);
|
||||
}
|
||||
|
||||
.profile-chart {
|
||||
width: 100%;
|
||||
height: 260px;
|
||||
}
|
||||
|
||||
.profile-chart-wide {
|
||||
height: 320px;
|
||||
}
|
||||
|
||||
.chart-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 8px 24px;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.compare-layout {
|
||||
padding: 20px 16px 32px;
|
||||
}
|
||||
|
||||
.chart-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,701 @@
|
||||
import { Component, OnInit, computed, inject, signal } from '@angular/core';
|
||||
import { DecimalPipe, NgTemplateOutlet } from '@angular/common';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { EChartsOption } from 'echarts';
|
||||
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||
|
||||
import {
|
||||
AuthorStaticStats,
|
||||
AuthorTopicProfile,
|
||||
AuthorTopicStats,
|
||||
RankingService,
|
||||
} from '../../api';
|
||||
|
||||
const AUTHOR_COLORS = ['#1565c0', '#e6550d', '#2ca02c', '#9467bd'];
|
||||
const SUBFIELD_COLORS = [
|
||||
'#2563eb',
|
||||
'#16a34a',
|
||||
'#d97706',
|
||||
'#7c3aed',
|
||||
'#0891b2',
|
||||
'#db2777',
|
||||
'#65a30d',
|
||||
'#b45309',
|
||||
];
|
||||
const OTHER_COLOR = '#9ca3af';
|
||||
const SUBFIELD_LIMIT = 5;
|
||||
|
||||
interface AuthorSummary {
|
||||
authorId: string;
|
||||
name: string;
|
||||
color: string;
|
||||
// section 1
|
||||
// topic stats
|
||||
totalWorks: number | null;
|
||||
corresponding: number | null;
|
||||
avgPercentile: number | null;
|
||||
top10: number | null;
|
||||
top1: number | null;
|
||||
fwciAboveOne: number | null;
|
||||
avgFwci: number | null;
|
||||
// citations over the topic works
|
||||
citationsTotal: number | null;
|
||||
avgCitations: number | null;
|
||||
maxCitations: number | null;
|
||||
hIndex: number | null;
|
||||
// industry collaboration (works with a company co-author institution)
|
||||
industryWorks: number | null;
|
||||
industryShare: number | null;
|
||||
// active years within the topic
|
||||
firstYear: number | null;
|
||||
lastYear: number | null;
|
||||
// topic-relevance (matched keyword score)
|
||||
relevanceAbove80: number | null;
|
||||
avgRelevance: number | null;
|
||||
// author-position split (first / middle / last)
|
||||
firstAuthor: number | null;
|
||||
middleAuthor: number | null;
|
||||
lastAuthor: number | null;
|
||||
// section 2: author-level stats (keyword-independent)
|
||||
companies: number | null;
|
||||
news: number | null;
|
||||
patents: number | null;
|
||||
}
|
||||
|
||||
interface MetricCell {
|
||||
raw: number | null;
|
||||
best: boolean;
|
||||
}
|
||||
|
||||
interface GroupSegment {
|
||||
label: string;
|
||||
colorClass: string;
|
||||
decimals: boolean;
|
||||
// render the value as-is, without the number pipe (e.g. years)
|
||||
plain: boolean;
|
||||
}
|
||||
|
||||
interface GroupCell {
|
||||
values: (number | null)[];
|
||||
}
|
||||
|
||||
interface MetricRow {
|
||||
label: string;
|
||||
hint: string;
|
||||
decimals: boolean;
|
||||
kind: 'scalar' | 'group';
|
||||
cells: MetricCell[];
|
||||
segments: GroupSegment[];
|
||||
groupCells: GroupCell[];
|
||||
}
|
||||
|
||||
interface RowDef {
|
||||
label: string;
|
||||
hint: string;
|
||||
select: (a: AuthorSummary) => number | null;
|
||||
decimals?: boolean;
|
||||
}
|
||||
|
||||
interface SegmentDef {
|
||||
label: string;
|
||||
colorClass: string;
|
||||
select: (a: AuthorSummary) => number | null;
|
||||
decimals?: boolean;
|
||||
plain?: boolean;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-compare-authors',
|
||||
standalone: true,
|
||||
imports: [DecimalPipe, NgTemplateOutlet, MatIconModule, NgxEchartsDirective],
|
||||
templateUrl: './compare-authors.component.html',
|
||||
styleUrl: './compare-authors.component.scss',
|
||||
})
|
||||
export class CompareAuthorsComponent implements OnInit {
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly rankingService = inject(RankingService);
|
||||
|
||||
readonly keywords = signal<string[]>([]);
|
||||
readonly timespan = signal<{ from: number; to: number } | null>(null);
|
||||
// full OpenAlex ids in the requested order — the source of truth for colour + order
|
||||
readonly authorIds = signal<string[]>([]);
|
||||
|
||||
// section 1: combined topic stats, one entry per author
|
||||
readonly topic = signal<AuthorTopicStats[]>([]);
|
||||
// section 2: keyword-independent author-level stats
|
||||
readonly staticStats = signal<AuthorStaticStats[]>([]);
|
||||
// section 3: topic profile over ALL works of each author
|
||||
readonly profile = signal<AuthorTopicProfile[]>([]);
|
||||
readonly profileLoading = signal(false);
|
||||
readonly loading = signal(false);
|
||||
|
||||
// maps both sections onto one row per author, in the requested order
|
||||
readonly summary = computed<AuthorSummary[]>(() => {
|
||||
const topicById = new Map(this.topic().map((a) => [a.author_id, a]));
|
||||
const staticById = new Map(this.staticStats().map((a) => [a.author_id, a]));
|
||||
|
||||
return this.authorIds().map((id, index) => {
|
||||
const t = topicById.get(id);
|
||||
const m = staticById.get(id);
|
||||
const name =
|
||||
t?.display_name ?? m?.display_name ?? id.split('/').pop() ?? id;
|
||||
|
||||
return {
|
||||
authorId: id,
|
||||
name,
|
||||
color: AUTHOR_COLORS[index % AUTHOR_COLORS.length],
|
||||
totalWorks: t ? t.works_total : null,
|
||||
corresponding: t ? t.corresponding_count : null,
|
||||
avgPercentile: t ? t.avg_percentile : null,
|
||||
top10: t ? t.top10_count : null,
|
||||
top1: t ? t.top1_count : null,
|
||||
fwciAboveOne: t ? t.fwci_above_one_count : null,
|
||||
avgFwci: t ? t.avg_fwci : null,
|
||||
citationsTotal: t ? t.citations_total : null,
|
||||
avgCitations: t ? t.avg_citations : null,
|
||||
maxCitations: t ? t.max_citations : null,
|
||||
hIndex: t ? t.h_index : null,
|
||||
industryWorks: t ? t.industry_works_count : null,
|
||||
industryShare:
|
||||
t && t.works_total > 0
|
||||
? t.industry_works_count / t.works_total
|
||||
: null,
|
||||
firstYear: t ? t.first_year : null,
|
||||
lastYear: t ? t.last_year : null,
|
||||
relevanceAbove80: t ? t.relevance_above_80_count : null,
|
||||
avgRelevance: t ? t.avg_relevance : null,
|
||||
firstAuthor: t ? t.first_author_count : null,
|
||||
middleAuthor: t ? t.middle_author_count : null,
|
||||
lastAuthor: t ? t.last_author_count : null,
|
||||
companies: m ? m.companies_count : null,
|
||||
news: m ? m.news_count : null,
|
||||
patents: m ? m.patents_count : null,
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
readonly hasData = computed(() => this.summary().length > 0);
|
||||
|
||||
// section 1 table: stats over the topic-filtered works
|
||||
readonly topicRows = computed<MetricRow[]>(() => [
|
||||
...this.buildRows([
|
||||
{
|
||||
label: 'Werke gesamt',
|
||||
hint: 'Publikationen zum Thema im Zeitraum',
|
||||
select: (a) => a.totalWorks,
|
||||
},
|
||||
{
|
||||
label: 'Corresponding-Author-Werke',
|
||||
hint: 'Werke, in denen die Person korrespondierende:r Autor:in ist',
|
||||
select: (a) => a.corresponding,
|
||||
},
|
||||
]),
|
||||
this.buildGroupRow(
|
||||
'Zitationen',
|
||||
'Zitationen der Themen-Werke: gesamt | Ø pro Werk',
|
||||
[
|
||||
{
|
||||
label: 'gesamt',
|
||||
colorClass: 'cit-total',
|
||||
select: (a) => a.citationsTotal,
|
||||
},
|
||||
{
|
||||
label: 'Ø',
|
||||
colorClass: 'cit-avg',
|
||||
decimals: true,
|
||||
select: (a) => a.avgCitations,
|
||||
},
|
||||
],
|
||||
),
|
||||
...this.buildRows([
|
||||
{
|
||||
label: 'Ø Impact-Perzentil',
|
||||
hint: 'Feld-normalisiertes Zitations-Perzentil (0–1)',
|
||||
select: (a) => a.avgPercentile,
|
||||
decimals: true,
|
||||
},
|
||||
{
|
||||
label: 'h-Index',
|
||||
hint: 'h-Index über die Werke zum Thema',
|
||||
select: (a) => a.hIndex,
|
||||
},
|
||||
{
|
||||
label: 'Meistzitiertes Werk',
|
||||
hint: 'Zitationen des meistzitierten Werks zum Thema',
|
||||
select: (a) => a.maxCitations,
|
||||
},
|
||||
{
|
||||
label: 'Top-10%-Werke',
|
||||
hint: 'Werke unter den 10% meistzitierten',
|
||||
select: (a) => a.top10,
|
||||
},
|
||||
{
|
||||
label: 'Top-1%-Werke',
|
||||
hint: 'Werke unter den 1% meistzitierten',
|
||||
select: (a) => a.top1,
|
||||
},
|
||||
]),
|
||||
this.buildGroupRow(
|
||||
'FWCI',
|
||||
'Field-Weighted Citation Impact: Werke über Feld-Durchschnitt | Ø über alle',
|
||||
[
|
||||
{
|
||||
label: '> 1',
|
||||
colorClass: 'fwci-count',
|
||||
select: (a) => a.fwciAboveOne,
|
||||
},
|
||||
{
|
||||
label: 'Ø',
|
||||
colorClass: 'fwci-avg',
|
||||
decimals: true,
|
||||
select: (a) => a.avgFwci,
|
||||
},
|
||||
],
|
||||
),
|
||||
this.buildGroupRow(
|
||||
'Themen-Relevanz',
|
||||
'Match-Score der Keywords: Werke > 80% | Ø über alle',
|
||||
[
|
||||
{
|
||||
label: '> 80%',
|
||||
colorClass: 'rel-count',
|
||||
select: (a) => a.relevanceAbove80,
|
||||
},
|
||||
{
|
||||
label: 'Ø',
|
||||
colorClass: 'rel-avg',
|
||||
decimals: true,
|
||||
select: (a) => a.avgRelevance,
|
||||
},
|
||||
],
|
||||
),
|
||||
this.buildGroupRow(
|
||||
'Autor-Position',
|
||||
'Werke nach Position (Erst | Mittel | Letzt)',
|
||||
[
|
||||
{
|
||||
label: 'Erst',
|
||||
colorClass: 'pos-first',
|
||||
select: (a) => a.firstAuthor,
|
||||
},
|
||||
{
|
||||
label: 'Mittel',
|
||||
colorClass: 'pos-middle',
|
||||
select: (a) => a.middleAuthor,
|
||||
},
|
||||
{ label: 'Letzt', colorClass: 'pos-last', select: (a) => a.lastAuthor },
|
||||
],
|
||||
),
|
||||
this.buildGroupRow(
|
||||
'Industrie-Kollaboration',
|
||||
'Werke mit Co-Autor:in aus einem Unternehmen: Anzahl | Anteil',
|
||||
[
|
||||
{
|
||||
label: 'Anzahl',
|
||||
colorClass: 'ind-count',
|
||||
select: (a) => a.industryWorks,
|
||||
},
|
||||
{
|
||||
label: 'Anteil',
|
||||
colorClass: 'ind-share',
|
||||
decimals: true,
|
||||
select: (a) => a.industryShare,
|
||||
},
|
||||
],
|
||||
),
|
||||
this.buildGroupRow(
|
||||
'Aktiv im Thema',
|
||||
'Erstes und letztes Publikationsjahr zum Thema',
|
||||
[
|
||||
{
|
||||
label: 'von',
|
||||
colorClass: 'year-from',
|
||||
plain: true,
|
||||
select: (a) => a.firstYear,
|
||||
},
|
||||
{
|
||||
label: 'bis',
|
||||
colorClass: 'year-to',
|
||||
plain: true,
|
||||
select: (a) => a.lastYear,
|
||||
},
|
||||
],
|
||||
),
|
||||
]);
|
||||
|
||||
// section 2 table: author-level stats, independent of the keywords
|
||||
readonly staticRows = computed<MetricRow[]>(() =>
|
||||
this.buildRows([
|
||||
{
|
||||
label: 'Unternehmensgründungen',
|
||||
hint: 'Handelsregister-Verbindungen über den Namen',
|
||||
select: (a) => a.companies,
|
||||
},
|
||||
{
|
||||
label: 'News-Artikel',
|
||||
hint: 'Nachrichtenartikel, die die Person namentlich nennen',
|
||||
select: (a) => a.news,
|
||||
},
|
||||
{
|
||||
label: 'Patente',
|
||||
hint: 'Der Person zugeordnete Patente',
|
||||
select: (a) => a.patents,
|
||||
},
|
||||
]),
|
||||
);
|
||||
|
||||
// section 3: profiles in the requested author order (drives all charts)
|
||||
readonly orderedProfiles = computed<AuthorTopicProfile[]>(() => {
|
||||
const byId = new Map(this.profile().map((p) => [p.author_id, p]));
|
||||
return this.authorIds()
|
||||
.map((id) => byId.get(id))
|
||||
.filter((p): p is AuthorTopicProfile => p !== undefined);
|
||||
});
|
||||
|
||||
// colours the author names on the chart axes like the legend chips
|
||||
private authorAxisLabel(profiles: AuthorTopicProfile[]) {
|
||||
const rich: Record<string, { color: string; fontWeight: number }> = {};
|
||||
profiles.forEach((_, i) => {
|
||||
rich[`a${i}`] = {
|
||||
color: AUTHOR_COLORS[i % AUTHOR_COLORS.length],
|
||||
fontWeight: 600,
|
||||
};
|
||||
});
|
||||
return {
|
||||
formatter: (value: string) => {
|
||||
const index = profiles.findIndex((p) => p.display_name === value);
|
||||
return index >= 0 ? `{a${index}|${value}}` : value;
|
||||
},
|
||||
rich,
|
||||
// rich-text labels are measured slightly too narrow — leave some slack
|
||||
margin: 12,
|
||||
};
|
||||
}
|
||||
|
||||
// chart 1: how each author's complete body of work distributes over subfields
|
||||
readonly subfieldChart = computed<EChartsOption>(() => {
|
||||
const profiles = this.orderedProfiles();
|
||||
if (profiles.length === 0) return {};
|
||||
|
||||
// union of the biggest subfields across all authors, one colour each
|
||||
const totals = new Map<string, number>();
|
||||
for (const p of profiles) {
|
||||
for (const s of p.subfields) {
|
||||
totals.set(s.name, (totals.get(s.name) ?? 0) + s.count);
|
||||
}
|
||||
}
|
||||
const topSubfields = [...totals.entries()]
|
||||
.sort((a, b) => b[1] - a[1])
|
||||
.slice(0, SUBFIELD_LIMIT)
|
||||
.map(([name]) => name);
|
||||
|
||||
const shownCounts = profiles.map((p) =>
|
||||
topSubfields.map(
|
||||
(name) => p.subfields.find((s) => s.name === name)?.count ?? 0,
|
||||
),
|
||||
);
|
||||
|
||||
const series: any[] = topSubfields.map((name, si) => ({
|
||||
name,
|
||||
type: 'bar',
|
||||
stack: 'profil',
|
||||
barWidth: 22,
|
||||
emphasis: { focus: 'series' },
|
||||
itemStyle: { color: SUBFIELD_COLORS[si % SUBFIELD_COLORS.length] },
|
||||
data: profiles.map((p, ai) => {
|
||||
const count = shownCounts[ai][si];
|
||||
return {
|
||||
value:
|
||||
p.works_total > 0
|
||||
? Math.round((count / p.works_total) * 1000) / 10
|
||||
: 0,
|
||||
count,
|
||||
};
|
||||
}),
|
||||
}));
|
||||
|
||||
// everything outside the shown subfields (incl. works without primary topic)
|
||||
series.push({
|
||||
name: 'Sonstige',
|
||||
type: 'bar',
|
||||
stack: 'profil',
|
||||
barWidth: 22,
|
||||
emphasis: { focus: 'series' },
|
||||
itemStyle: { color: OTHER_COLOR },
|
||||
data: profiles.map((p, ai) => {
|
||||
const rest =
|
||||
p.works_total - shownCounts[ai].reduce((sum, c) => sum + c, 0);
|
||||
return {
|
||||
value:
|
||||
p.works_total > 0
|
||||
? Math.round((rest / p.works_total) * 1000) / 10
|
||||
: 0,
|
||||
count: rest,
|
||||
};
|
||||
}),
|
||||
});
|
||||
|
||||
return {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { type: 'shadow' },
|
||||
formatter: (params: any) => {
|
||||
const lines = params
|
||||
.filter((p: any) => p.data.count > 0)
|
||||
.map(
|
||||
(p: any) =>
|
||||
`${p.marker} ${p.seriesName}: <b>${p.data.value} %</b> (${p.data.count} Werke)`,
|
||||
);
|
||||
return `<b>${params[0]?.name ?? ''}</b><br/>${lines.join('<br/>')}`;
|
||||
},
|
||||
},
|
||||
legend: { type: 'scroll', top: 0 },
|
||||
grid: { left: 16, right: 24, top: 56, bottom: 8, containLabel: true },
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
max: 100,
|
||||
axisLabel: { formatter: '{value} %' },
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
inverse: true,
|
||||
data: profiles.map((p) => p.display_name),
|
||||
axisLabel: this.authorAxisLabel(profiles),
|
||||
},
|
||||
series,
|
||||
} as EChartsOption;
|
||||
});
|
||||
|
||||
// chart 2: topic focus — how much of the complete body of work is on the searched topic
|
||||
readonly focusChart = computed<EChartsOption>(() => {
|
||||
const profiles = this.orderedProfiles();
|
||||
if (profiles.length === 0) return {};
|
||||
|
||||
const pct = (part: number, whole: number) =>
|
||||
whole > 0 ? Math.round((part / whole) * 1000) / 10 : 0;
|
||||
|
||||
return {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: { type: 'shadow' },
|
||||
formatter: (params: any) => {
|
||||
const lines = params.map(
|
||||
(p: any) =>
|
||||
`${p.marker} ${p.seriesName}: <b>${p.data.value} %</b> (${p.data.part} von ${p.data.whole} Werken)`,
|
||||
);
|
||||
return `<b>${params[0]?.name ?? ''}</b><br/>${lines.join('<br/>')}`;
|
||||
},
|
||||
},
|
||||
legend: { top: 0 },
|
||||
grid: { left: 16, right: 40, top: 32, bottom: 8, containLabel: true },
|
||||
xAxis: {
|
||||
type: 'value',
|
||||
max: 100,
|
||||
axisLabel: { formatter: '{value} %' },
|
||||
},
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
inverse: true,
|
||||
data: profiles.map((p) => p.display_name),
|
||||
axisLabel: this.authorAxisLabel(profiles),
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: 'Anteil am Gesamtwerk',
|
||||
type: 'bar',
|
||||
itemStyle: { color: '#2563eb' },
|
||||
label: { show: true, position: 'right', formatter: '{c} %' },
|
||||
data: profiles.map((p) => ({
|
||||
value: pct(p.matched_works, p.works_total),
|
||||
part: p.matched_works,
|
||||
whole: p.works_total,
|
||||
})),
|
||||
},
|
||||
{
|
||||
name: 'davon Primärthema',
|
||||
type: 'bar',
|
||||
itemStyle: { color: '#7c3aed' },
|
||||
label: { show: true, position: 'right', formatter: '{c} %' },
|
||||
data: profiles.map((p) => ({
|
||||
value: pct(p.primary_topic_matches, p.matched_works),
|
||||
part: p.primary_topic_matches,
|
||||
whole: p.matched_works,
|
||||
})),
|
||||
},
|
||||
],
|
||||
} as EChartsOption;
|
||||
});
|
||||
|
||||
// chart 3: topic breadth — how many distinct (sub)fields the author publishes in
|
||||
readonly breadthChart = computed<EChartsOption>(() => {
|
||||
const profiles = this.orderedProfiles();
|
||||
if (profiles.length === 0) return {};
|
||||
|
||||
return {
|
||||
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
|
||||
legend: { top: 0 },
|
||||
grid: { left: 16, right: 40, top: 32, bottom: 8, containLabel: true },
|
||||
xAxis: { type: 'value' },
|
||||
yAxis: {
|
||||
type: 'category',
|
||||
inverse: true,
|
||||
data: profiles.map((p) => p.display_name),
|
||||
axisLabel: this.authorAxisLabel(profiles),
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: 'Themen',
|
||||
type: 'bar',
|
||||
itemStyle: { color: '#0891b2' },
|
||||
label: { show: true, position: 'right' },
|
||||
data: profiles.map((p) => p.distinct_topics),
|
||||
},
|
||||
{
|
||||
name: 'Subfields',
|
||||
type: 'bar',
|
||||
itemStyle: { color: '#d97706' },
|
||||
label: { show: true, position: 'right' },
|
||||
data: profiles.map((p) => p.distinct_subfields),
|
||||
},
|
||||
{
|
||||
name: 'Fields',
|
||||
type: 'bar',
|
||||
itemStyle: { color: '#16a34a' },
|
||||
label: { show: true, position: 'right' },
|
||||
data: profiles.map((p) => p.distinct_fields),
|
||||
},
|
||||
],
|
||||
} as EChartsOption;
|
||||
});
|
||||
|
||||
// turns row definitions into table rows, marking the best value per row
|
||||
private buildRows(defs: RowDef[]): MetricRow[] {
|
||||
const authors = this.summary();
|
||||
return defs.map((def) => {
|
||||
const values = authors.map(def.select);
|
||||
const present = values.filter((v): v is number => v !== null);
|
||||
const max = present.length ? Math.max(...present) : null;
|
||||
return {
|
||||
label: def.label,
|
||||
hint: def.hint,
|
||||
decimals: def.decimals ?? false,
|
||||
kind: 'scalar' as const,
|
||||
cells: values.map((raw) => ({
|
||||
raw,
|
||||
best: raw !== null && max !== null && raw === max && max > 0,
|
||||
})),
|
||||
segments: [],
|
||||
groupCells: [],
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private buildGroupRow(
|
||||
label: string,
|
||||
hint: string,
|
||||
segs: SegmentDef[],
|
||||
): MetricRow {
|
||||
return {
|
||||
label,
|
||||
hint,
|
||||
decimals: false,
|
||||
kind: 'group' as const,
|
||||
cells: [],
|
||||
segments: segs.map((s) => ({
|
||||
label: s.label,
|
||||
colorClass: s.colorClass,
|
||||
decimals: s.decimals ?? false,
|
||||
plain: s.plain ?? false,
|
||||
})),
|
||||
groupCells: this.summary().map((a) => ({
|
||||
values: segs.map((s) => s.select(a)),
|
||||
})),
|
||||
};
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
// everything is read from the URL so a shared link lands on the same view
|
||||
const rawAuthors = this.route.snapshot.queryParamMap.get('authors') ?? '';
|
||||
const rawKeywords = this.route.snapshot.queryParamMap.get('keywords') ?? '';
|
||||
const rawOperator = this.route.snapshot.queryParamMap.get('operator');
|
||||
const rawPubType = this.route.snapshot.queryParamMap.get('pubType');
|
||||
const rawTFrom = this.route.snapshot.queryParamMap.get('tFrom');
|
||||
const rawTTo = this.route.snapshot.queryParamMap.get('tTo');
|
||||
|
||||
const authorIds = this.parseList(rawAuthors);
|
||||
const keywords = this.parseList(rawKeywords);
|
||||
this.keywords.set(keywords);
|
||||
|
||||
if (authorIds.length === 0 || keywords.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const operator = rawOperator === 'and' ? 'and' : 'or';
|
||||
const publication_types = rawPubType
|
||||
? this.parseList(rawPubType)
|
||||
: undefined;
|
||||
const timespan =
|
||||
rawTFrom && rawTTo ? { from: +rawTFrom, to: +rawTTo } : undefined;
|
||||
this.timespan.set(timespan ?? null);
|
||||
|
||||
// ids in the url are bare (A5036...); the endpoint expects full OpenAlex urls
|
||||
const fullIds = authorIds.map((id) => `https://openalex.org/${id}`);
|
||||
this.authorIds.set(fullIds);
|
||||
|
||||
const request = {
|
||||
author_ids: fullIds,
|
||||
keywords: keywords,
|
||||
operator: operator,
|
||||
filter_type: 'topic',
|
||||
publication_types: publication_types,
|
||||
timespan: timespan,
|
||||
};
|
||||
|
||||
// section 1: topic-filtered works stats
|
||||
this.loading.set(true);
|
||||
this.rankingService.topicStats(request).subscribe({
|
||||
next: (results) => {
|
||||
this.topic.set(results);
|
||||
this.loading.set(false);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(error);
|
||||
this.topic.set([]);
|
||||
this.loading.set(false);
|
||||
},
|
||||
});
|
||||
|
||||
// section 3: topic profile over ALL works (same filter, own endpoint)
|
||||
this.profileLoading.set(true);
|
||||
this.rankingService.topicProfile(request).subscribe({
|
||||
next: (results) => {
|
||||
this.profile.set(results);
|
||||
this.profileLoading.set(false);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(error);
|
||||
this.profile.set([]);
|
||||
this.profileLoading.set(false);
|
||||
},
|
||||
});
|
||||
|
||||
// section 2: keyword-independent author-level stats
|
||||
this.rankingService.staticStats({ author_ids: fullIds }).subscribe({
|
||||
next: (results) => {
|
||||
this.staticStats.set(results);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(error);
|
||||
this.staticStats.set([]);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private parseList(raw: string): string[] {
|
||||
return raw
|
||||
.split(',')
|
||||
.map((value) => value.trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
}
|
||||
@@ -54,18 +54,21 @@ export class InstitutionComponent implements OnInit {
|
||||
this.institution = institution;
|
||||
});
|
||||
|
||||
const institutionId = this.activatedRoute.snapshot.paramMap.get('institutionId');
|
||||
const institutionId =
|
||||
this.activatedRoute.snapshot.paramMap.get('institutionId');
|
||||
if (!institutionId) return;
|
||||
|
||||
// The "Patente" tab only makes sense once org_patents has been indexed for
|
||||
// this institution (currently a manual, ~30-40 min-per-institution process),
|
||||
// so only show it once we know there is actually data behind it.
|
||||
this.patentsApi.getOrgPatentsByInstitution(institutionId, undefined, 0, 0).subscribe({
|
||||
next: (result) => {
|
||||
if ((result.patent_count ?? 0) > 0) {
|
||||
this.links = [...this.links, PATENTS_LINK];
|
||||
}
|
||||
},
|
||||
});
|
||||
this.patentsApi
|
||||
.getOrgPatentsByInstitution(institutionId, undefined, 0, 0)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
if ((result.patent_count ?? 0) > 0) {
|
||||
this.links = [...this.links, PATENTS_LINK];
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,17 +59,21 @@ export class InstitutionsComponent {
|
||||
const id = this.extractInstitutionId(institution);
|
||||
if (!id || this.patentsAvailable.has(id)) continue;
|
||||
this.patentsAvailable.set(id, false);
|
||||
this.patentsApi.getOrgPatentsByInstitution(id, undefined, 0, 0).subscribe({
|
||||
next: (result) => {
|
||||
this.patentsAvailable.set(id, (result.patent_count ?? 0) > 0);
|
||||
},
|
||||
});
|
||||
this.patentsApi
|
||||
.getOrgPatentsByInstitution(id, undefined, 0, 0)
|
||||
.subscribe({
|
||||
next: (result) => {
|
||||
this.patentsAvailable.set(id, (result.patent_count ?? 0) > 0);
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
hasPatents(institution: Institution): boolean {
|
||||
return this.patentsAvailable.get(this.extractInstitutionId(institution)) ?? false;
|
||||
return (
|
||||
this.patentsAvailable.get(this.extractInstitutionId(institution)) ?? false
|
||||
);
|
||||
}
|
||||
|
||||
sortingOptions: SelectorOption[] = [
|
||||
|
||||
+199
-25
@@ -1,31 +1,205 @@
|
||||
<div class="result-layout">
|
||||
<mat-card class="results-card">
|
||||
<mat-card-content class="results-placeholder">
|
||||
<mat-icon>groups</mat-icon>
|
||||
<h2>Personenliste</h2>
|
||||
<p>
|
||||
Die aktuelle Gewichtung ist unter <code>normalized</code> verfügbar.
|
||||
</p>
|
||||
<mat-card-content>
|
||||
@if (loading()) {
|
||||
<p class="results-hint">Lädt…</p>
|
||||
} @else if (authors().length === 0) {
|
||||
<div class="results-placeholder">
|
||||
<mat-icon>groups</mat-icon>
|
||||
<h2>Keine Autoren gefunden</h2>
|
||||
<p>Passe die Keywords oder die Gewichtung an.</p>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="results-toolbar">
|
||||
<span class="selected-hint">
|
||||
{{ selectedIds().length }} / {{ MAX_SELECTED }} ausgewählt
|
||||
</span>
|
||||
<button
|
||||
mat-flat-button
|
||||
color="primary"
|
||||
[disabled]="!canCompare()"
|
||||
(click)="compare()">
|
||||
<mat-icon>insights</mat-icon>
|
||||
Vergleichen
|
||||
</button>
|
||||
</div>
|
||||
<ul class="author-list">
|
||||
@for (author of paginatedAuthors(); track author.author_id) {
|
||||
<li class="author-item">
|
||||
<mat-checkbox
|
||||
class="author-select"
|
||||
[checked]="isSelected(author)"
|
||||
(change)="toggleSelect(author)" />
|
||||
<a
|
||||
class="author-name"
|
||||
[routerLink]="['/person', authorProfileId(author), 'overview']">
|
||||
{{ author.display_name }}
|
||||
</a>
|
||||
<span class="author-score">
|
||||
Score: {{ author.score | number: '1.3-3' }}
|
||||
</span>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
|
||||
<app-query-param-paginator [total]="authors().length" />
|
||||
}
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
<mat-card class="weights-card">
|
||||
<mat-card-content>
|
||||
<app-weights-sliders
|
||||
[options]="weightOptions"
|
||||
[initialWeights]="defaultWeights"
|
||||
title="Personen-Gewichtung"
|
||||
description="Werte zwischen 0 und 1. Summe wird normalisiert zu 1."
|
||||
resetLabel="Ausgewogen"
|
||||
applyLabel="Neu gewichten"
|
||||
normalizedTitle="Normalisiert"
|
||||
queryParamPrefix="personW_"
|
||||
[persistInQueryParams]="true"
|
||||
[showApplyButton]="true"
|
||||
[showResetButton]="true"
|
||||
[showNormalizedPreview]="true"
|
||||
(weightsChange)="onWeightsChange($event)"
|
||||
(applyWeights)="onApplyWeights($event)" />
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
<div class="controls-column">
|
||||
<app-weights-sliders
|
||||
[options]="weightOptions"
|
||||
[initialWeights]="defaultWeights"
|
||||
title="Personen-Gewichtung"
|
||||
description="Bestimme die Relevanz der einzelnen Faktoren."
|
||||
resetLabel="Ausgewogen"
|
||||
applyLabel="Neu gewichten"
|
||||
normalizedTitle="Normalisiert"
|
||||
queryParamPrefix="personW_"
|
||||
[persistInQueryParams]="true"
|
||||
[showApplyButton]="true"
|
||||
[showResetButton]="true"
|
||||
[showNormalizedPreview]="true"
|
||||
(weightsChange)="onWeightsChange($event)"
|
||||
(applyWeights)="onApplyWeights($event)">
|
||||
<section class="filter-section">
|
||||
<div class="filter-section-header">
|
||||
<h3>Filter</h3>
|
||||
<button mat-stroked-button color="primary" (click)="resetFilters()">
|
||||
<mat-icon>restart_alt</mat-icon>
|
||||
Zurücksetzen
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="weight-row filter-row pub-type-row" style="display: block">
|
||||
<mat-form-field
|
||||
appearance="outline"
|
||||
style="width: 100%; margin-bottom: -1.25em">
|
||||
<mat-label>Art der Work</mat-label>
|
||||
<mat-select
|
||||
multiple
|
||||
[ngModel]="selectedPubTypes()"
|
||||
(ngModelChange)="onPubTypesChange($event)">
|
||||
<div class="pub-type-search">
|
||||
<mat-icon
|
||||
class="search-icon"
|
||||
style="
|
||||
margin-left: 16px;
|
||||
margin-right: 8px;
|
||||
color: rgba(0, 0, 0, 0.54);
|
||||
"
|
||||
>search</mat-icon
|
||||
>
|
||||
<input
|
||||
matInput
|
||||
placeholder="Suchen..."
|
||||
style="flex: 1; outline: none; border: none; padding: 12px 0"
|
||||
[ngModel]="pubTypeSearchTerm()"
|
||||
(ngModelChange)="pubTypeSearchTerm.set($event)"
|
||||
(keydown)="onPubTypeKeydown($event)"
|
||||
autocomplete="off" />
|
||||
@if (pubTypeSearchTerm()) {
|
||||
<button
|
||||
mat-icon-button
|
||||
(click)="
|
||||
pubTypeSearchTerm.set(''); $event.stopPropagation()
|
||||
"
|
||||
style="margin-right: 8px; transform: scale(0.8)">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
|
||||
@for (pt of filteredPubTypes(); track pt) {
|
||||
<mat-option [value]="pt">{{ pt }}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="weight-row filter-row keyword-operator-row"
|
||||
style="display: block">
|
||||
<mat-form-field appearance="outline" style="width: 100%">
|
||||
<mat-label>Keyword-Verknüpfung</mat-label>
|
||||
<mat-select
|
||||
[ngModel]="keywordOperator()"
|
||||
(ngModelChange)="onKeywordOperatorChange($event)">
|
||||
@for (option of KEYWORD_OPERATOR_OPTIONS; track option.value) {
|
||||
<mat-option [value]="option.value">{{
|
||||
option.label
|
||||
}}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="weight-row filter-row career-stage-row"
|
||||
style="display: block">
|
||||
<mat-form-field appearance="outline" style="width: 100%">
|
||||
<mat-label>Karrierestufe</mat-label>
|
||||
<mat-select
|
||||
multiple
|
||||
[ngModel]="careerStages()"
|
||||
(ngModelChange)="onCareerStagesChange($event)">
|
||||
@for (option of CAREER_STAGE_OPTIONS; track option.value) {
|
||||
<mat-option [value]="option.value">{{
|
||||
option.label
|
||||
}}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="weight-row filter-row company-filter-row"
|
||||
style="display: block">
|
||||
<mat-form-field appearance="outline" style="width: 100%">
|
||||
<mat-label>Unternehmen</mat-label>
|
||||
<mat-select
|
||||
[ngModel]="companyStatus()"
|
||||
(ngModelChange)="onCompanyStatusChange($event)">
|
||||
@for (option of COMPANY_STATUS_OPTIONS; track option.value) {
|
||||
<mat-option [value]="option.value">{{
|
||||
option.label
|
||||
}}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
|
||||
<div class="weight-row filter-row timespan-row">
|
||||
<div class="weight-label">
|
||||
<mat-icon class="icon-small">date_range</mat-icon>
|
||||
<span>Zeitraum</span>
|
||||
</div>
|
||||
|
||||
<div class="slider-container">
|
||||
<div class="slider-labels timespan-range-label">
|
||||
<span>{{ timespanFrom() }} – {{ timespanTo() }}</span>
|
||||
</div>
|
||||
<mat-slider
|
||||
class="timespan-slider"
|
||||
[min]="minYear"
|
||||
[max]="maxYear"
|
||||
[step]="1"
|
||||
discrete>
|
||||
<input
|
||||
matSliderStartThumb
|
||||
[value]="timespanFrom()"
|
||||
(valueChange)="timespanFrom.set($event)"
|
||||
(dragEnd)="onTimespanChange()" />
|
||||
<input
|
||||
matSliderEndThumb
|
||||
[value]="timespanTo()"
|
||||
(valueChange)="timespanTo.set($event)"
|
||||
(dragEnd)="onTimespanChange()" />
|
||||
</mat-slider>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</app-weights-sliders>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+130
-1
@@ -7,12 +7,21 @@
|
||||
grid-template-areas: 'summary results';
|
||||
gap: 0.75rem;
|
||||
align-items: start;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.search-summary-card {
|
||||
.search-summary-card,
|
||||
.controls-column {
|
||||
grid-area: summary;
|
||||
}
|
||||
|
||||
.controls-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.results-card {
|
||||
grid-area: results;
|
||||
}
|
||||
@@ -27,3 +36,123 @@
|
||||
padding: 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
AUTHOR LIST
|
||||
============================================================ */
|
||||
.author-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.results-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 0.75rem;
|
||||
padding: 0.25rem;
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
|
||||
.selected-hint {
|
||||
color: var(--sg-text-secondary, rgba(0, 0, 0, 0.6));
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.author-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
padding: 0.5rem 0.25rem;
|
||||
border-bottom: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08));
|
||||
}
|
||||
|
||||
.author-name {
|
||||
flex: 1;
|
||||
font-weight: 500;
|
||||
text-decoration: none;
|
||||
color: var(--sg-primary, #1565c0);
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
}
|
||||
|
||||
.author-score {
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: var(--sg-text-secondary, rgba(0, 0, 0, 0.6));
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.results-hint {
|
||||
padding: 0.5rem 0.25rem;
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
FILTER SECTION (closed, bordered block below the sliders)
|
||||
============================================================ */
|
||||
::ng-deep .filter-section {
|
||||
margin-top: 0.75rem;
|
||||
padding: 0.5rem 0.6rem 0.6rem;
|
||||
border: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.12));
|
||||
border-radius: 6px;
|
||||
background: var(--sg-surface-variant, rgba(0, 0, 0, 0.015));
|
||||
}
|
||||
|
||||
.filter-section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 0.4rem;
|
||||
margin-bottom: 0.4rem;
|
||||
|
||||
h3 {
|
||||
margin: 0;
|
||||
font-size: 0.8rem;
|
||||
font-weight: 650;
|
||||
color: var(--sg-text-primary);
|
||||
}
|
||||
|
||||
button {
|
||||
min-height: 44px;
|
||||
padding: 0.2rem 0.4rem;
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.2;
|
||||
}
|
||||
}
|
||||
|
||||
/* divider between filter rows — not before the first one */
|
||||
::ng-deep .filter-section .filter-row + .filter-row {
|
||||
margin-top: 0.5rem;
|
||||
padding-top: 0.5rem;
|
||||
border-top: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.08));
|
||||
}
|
||||
|
||||
::ng-deep .company-filter-row {
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
/* ============================================================
|
||||
TIMESPAN
|
||||
============================================================ */
|
||||
::ng-deep .timespan-range-label {
|
||||
justify-content: center !important;
|
||||
font-weight: 500;
|
||||
color: var(--sg-text-primary) !important;
|
||||
}
|
||||
|
||||
::ng-deep .timespan-slider {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
::ng-deep .pub-type-search {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 10;
|
||||
background: white;
|
||||
border-bottom: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.12));
|
||||
}
|
||||
|
||||
+390
-48
@@ -1,7 +1,18 @@
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { Component, OnInit, computed, inject, signal } from '@angular/core';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
|
||||
import { DecimalPipe } from '@angular/common';
|
||||
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatSliderModule } from '@angular/material/slider';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
|
||||
import {
|
||||
WeightMap,
|
||||
@@ -9,37 +20,86 @@ import {
|
||||
WeightsSlidersComponent,
|
||||
WeightsSlidersValue,
|
||||
} from '../../../../shared/ui/weights-sliders/weights-sliders.component';
|
||||
import { QueryParamPaginatorComponent } from '../../../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
|
||||
import {
|
||||
KeywordToAuthorRequest,
|
||||
RankedAuthor,
|
||||
RankingService,
|
||||
} from '../../../../api';
|
||||
|
||||
import { SearchResultsStateService } from '../search-results-state.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-persons-results',
|
||||
standalone: true,
|
||||
imports: [MatCardModule, MatIconModule, WeightsSlidersComponent],
|
||||
imports: [
|
||||
DecimalPipe,
|
||||
RouterLink,
|
||||
MatButtonModule,
|
||||
MatCardModule,
|
||||
MatCheckboxModule,
|
||||
MatIconModule,
|
||||
MatSliderModule,
|
||||
FormsModule,
|
||||
MatSelectModule,
|
||||
MatInputModule,
|
||||
MatFormFieldModule,
|
||||
QueryParamPaginatorComponent,
|
||||
WeightsSlidersComponent,
|
||||
],
|
||||
templateUrl: './persons-results.component.html',
|
||||
styleUrl: './persons-results.component.scss',
|
||||
})
|
||||
export class KeywordsToPersonsResultsComponent {
|
||||
export class KeywordsToPersonsResultsComponent implements OnInit {
|
||||
// injects the state set by the parent route — no duplicate parsing here
|
||||
private readonly state = inject(SearchResultsStateService);
|
||||
private readonly rankingService = inject(RankingService);
|
||||
private readonly route = inject(ActivatedRoute);
|
||||
private readonly router = inject(Router);
|
||||
private readonly snackBar = inject(MatSnackBar);
|
||||
|
||||
private readonly queryParams = toSignal(this.route.queryParams);
|
||||
|
||||
readonly pageIndex = computed(() => {
|
||||
const p = this.queryParams();
|
||||
return p && p['page'] ? +p['page'] || 0 : 0;
|
||||
});
|
||||
|
||||
readonly pageSize = computed(() => {
|
||||
const p = this.queryParams();
|
||||
return p && p['size'] ? +p['size'] || 10 : 10;
|
||||
});
|
||||
|
||||
readonly paginatedAuthors = computed(() => {
|
||||
const all = this.authors();
|
||||
const start = this.pageIndex() * this.pageSize();
|
||||
return all.slice(start, start + this.pageSize());
|
||||
});
|
||||
|
||||
// author selection for the compare view (max 4)
|
||||
readonly MAX_SELECTED = 4;
|
||||
readonly selectedIds = signal<string[]>([]);
|
||||
readonly canCompare = computed(() => this.selectedIds().length >= 1);
|
||||
|
||||
// works, citations and company foundations are used as metrics/weights
|
||||
readonly defaultWeights: WeightMap = {
|
||||
publications: 0.5,
|
||||
works: 0.5,
|
||||
citations: 0.5,
|
||||
companies: 0.5,
|
||||
news: 0.5,
|
||||
patents: 0.5,
|
||||
projects: 0.5,
|
||||
mediaVisibility: 0.5,
|
||||
};
|
||||
|
||||
readonly weightOptions: WeightSliderOption[] = [
|
||||
{
|
||||
key: 'publications',
|
||||
label: 'Publikationen',
|
||||
key: 'works',
|
||||
label: 'Works',
|
||||
icon: 'article',
|
||||
description:
|
||||
'Gewichtet die Anzahl und Relevanz wissenschaftlicher Arbeiten.',
|
||||
defaultValue: 0.5,
|
||||
queryParamName: 'wPublications',
|
||||
queryParamName: 'wWorks',
|
||||
},
|
||||
{
|
||||
key: 'citations',
|
||||
@@ -49,87 +109,369 @@ export class KeywordsToPersonsResultsComponent {
|
||||
defaultValue: 0.5,
|
||||
queryParamName: 'wCitations',
|
||||
},
|
||||
{
|
||||
key: 'companies',
|
||||
label: 'Unternehmensgründungen',
|
||||
icon: 'business',
|
||||
description:
|
||||
'Gewichtet die Anzahl der Unternehmensgründungen (Handelsregister-Verbindungen).',
|
||||
defaultValue: 0.5,
|
||||
queryParamName: 'wCompanies',
|
||||
},
|
||||
{
|
||||
key: 'news',
|
||||
label: 'Medien-Sichtbarkeit',
|
||||
icon: 'visibility',
|
||||
description:
|
||||
'Gewichtet die öffentliche Sichtbarkeit über Nennungen in Nachrichtenartikeln.',
|
||||
defaultValue: 0.5,
|
||||
queryParamName: 'wNews',
|
||||
},
|
||||
{
|
||||
key: 'patents',
|
||||
label: 'Patente',
|
||||
icon: 'workspace_premium',
|
||||
description: 'Gewichtet Innovations- und Transferleistung.',
|
||||
description: 'Gewichtet Innovations- und Transferleistung über Patente.',
|
||||
defaultValue: 0.5,
|
||||
queryParamName: 'wPatents',
|
||||
},
|
||||
{
|
||||
/*{
|
||||
key: 'projects',
|
||||
label: 'Projekte',
|
||||
icon: 'account_tree',
|
||||
description: 'Gewichtet Beteiligung an relevanten Forschungsprojekten.',
|
||||
defaultValue: 0.5,
|
||||
queryParamName: 'wProjects',
|
||||
},
|
||||
{
|
||||
key: 'mediaVisibility',
|
||||
label: 'Medien-Sichtbarkeit',
|
||||
icon: 'visibility',
|
||||
description: 'Gewichtet öffentliche und mediale Sichtbarkeit.',
|
||||
defaultValue: 0.5,
|
||||
queryParamName: 'wMedia',
|
||||
},
|
||||
}, */
|
||||
];
|
||||
|
||||
readonly currentWeights = signal<WeightsSlidersValue>({
|
||||
raw: this.defaultWeights,
|
||||
normalized: {
|
||||
publications: 0.2,
|
||||
citations: 0.2,
|
||||
patents: 0.2,
|
||||
projects: 0.2,
|
||||
mediaVisibility: 0.2,
|
||||
works: 1 / 5,
|
||||
citations: 1 / 5,
|
||||
companies: 1 / 5,
|
||||
news: 1 / 5,
|
||||
patents: 1 / 5,
|
||||
},
|
||||
rawSum: 2.5,
|
||||
normalizedSum: 1,
|
||||
valid: true,
|
||||
});
|
||||
|
||||
readonly persons = signal<unknown[]>([]); // placeholder until the results service lands
|
||||
// publication-year timespan filter (range slider)
|
||||
readonly minYear = 1900;
|
||||
readonly maxYear = 2026;
|
||||
readonly timespanFrom = signal(this.minYear);
|
||||
readonly timespanTo = signal(this.maxYear);
|
||||
|
||||
// which companies to count for the company-foundations metric
|
||||
readonly COMPANY_STATUS_OPTIONS = [
|
||||
{ value: 'all', label: 'Alle Unternehmen' },
|
||||
{ value: 'active', label: 'Nur aktive Unternehmen' },
|
||||
{ value: 'deleted', label: 'Nur gelöschte Unternehmen' },
|
||||
];
|
||||
readonly companyStatus = signal<'all' | 'active' | 'deleted'>('all');
|
||||
|
||||
// publication types
|
||||
readonly ALL_PUBLICATION_TYPES = [
|
||||
'article',
|
||||
'other',
|
||||
'dataset',
|
||||
'book-chapter',
|
||||
'book',
|
||||
'dissertation',
|
||||
'preprint',
|
||||
'paratext',
|
||||
'libguides',
|
||||
'review',
|
||||
'letter',
|
||||
'reference-entry',
|
||||
'editorial',
|
||||
'peer-review',
|
||||
'report',
|
||||
'standard',
|
||||
'erratum',
|
||||
'retraction',
|
||||
'supplementary-materials',
|
||||
'book-section',
|
||||
'database',
|
||||
'software',
|
||||
'report-component',
|
||||
'grant',
|
||||
];
|
||||
|
||||
readonly pubTypeSearchTerm = signal('');
|
||||
|
||||
readonly selectedPubTypes = computed(() => {
|
||||
const p = this.queryParams();
|
||||
const val = p?.['pubType'];
|
||||
if (!val) return [];
|
||||
return Array.isArray(val) ? val : val.split(',');
|
||||
});
|
||||
|
||||
readonly filteredPubTypes = computed(() => {
|
||||
const term = this.pubTypeSearchTerm().toLowerCase();
|
||||
if (!term) return this.ALL_PUBLICATION_TYPES;
|
||||
return this.ALL_PUBLICATION_TYPES.filter((pt) =>
|
||||
pt.toLowerCase().includes(term),
|
||||
);
|
||||
});
|
||||
|
||||
onPubTypesChange(selected: string[]) {
|
||||
const val = selected.length > 0 ? selected.join(',') : null;
|
||||
this.router.navigate([], {
|
||||
relativeTo: this.route,
|
||||
queryParams: { pubType: val, page: null },
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
|
||||
onPubTypeKeydown(event: KeyboardEvent) {
|
||||
if (event.key === ' ') {
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
|
||||
readonly KEYWORD_OPERATOR_OPTIONS = [
|
||||
{ value: 'and', label: 'UND' },
|
||||
{ value: 'or', label: 'ODER' },
|
||||
];
|
||||
|
||||
readonly keywordOperator = signal<'and' | 'or'>('or');
|
||||
|
||||
onKeywordOperatorChange(operator: 'and' | 'or'): void {
|
||||
this.keywordOperator.set(operator);
|
||||
this.router.navigate([], {
|
||||
relativeTo: this.route,
|
||||
queryParams: {
|
||||
operator: operator,
|
||||
page: null,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
replaceUrl: true,
|
||||
});
|
||||
this.loadAuthors();
|
||||
}
|
||||
|
||||
readonly CAREER_STAGE_OPTIONS = [
|
||||
{ value: 'Early', label: 'Early' },
|
||||
{ value: 'Emerging', label: 'Emerging' },
|
||||
{ value: 'Established', label: 'Established' },
|
||||
{ value: 'Senior', label: 'Senior' },
|
||||
];
|
||||
|
||||
readonly careerStages = signal<string[]>([]);
|
||||
|
||||
onCareerStagesChange(selected: string[]) {
|
||||
this.careerStages.set(selected);
|
||||
const val = selected.length > 0 ? selected.join(',') : null;
|
||||
this.router.navigate([], {
|
||||
relativeTo: this.route,
|
||||
queryParams: { careerStage: val, page: null },
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
|
||||
readonly authors = signal<RankedAuthor[]>([]);
|
||||
readonly loading = signal(false);
|
||||
|
||||
private hasLoadedInitial = false;
|
||||
|
||||
ngOnInit(): void {
|
||||
// restore the timespan from the URL so the range is shareable/bookmarkable
|
||||
this.timespanFrom.set(this.readYearParam('tFrom', this.minYear));
|
||||
this.timespanTo.set(this.readYearParam('tTo', this.maxYear));
|
||||
const status = this.route.snapshot.queryParamMap.get('companyStatus');
|
||||
if (status === 'active' || status === 'deleted') {
|
||||
this.companyStatus.set(status);
|
||||
}
|
||||
const careerStage = this.route.snapshot.queryParamMap.get('careerStage');
|
||||
if (careerStage) {
|
||||
this.careerStages.set(careerStage.split(','));
|
||||
}
|
||||
const operator = this.route.snapshot.queryParamMap.get('operator');
|
||||
if (operator === 'and' || operator === 'or') {
|
||||
this.keywordOperator.set(operator);
|
||||
}
|
||||
}
|
||||
|
||||
// reads a year query param, clamped to the valid range; falls back on invalid input
|
||||
private readYearParam(name: string, fallback: number): number {
|
||||
const rawValue = this.route.snapshot.queryParamMap.get(name);
|
||||
if (rawValue === null) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
const year = Number(rawValue);
|
||||
if (!Number.isFinite(year)) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
return Math.min(this.maxYear, Math.max(this.minYear, Math.round(year)));
|
||||
}
|
||||
|
||||
private writeTimespanToUrl(): void {
|
||||
this.router.navigate([], {
|
||||
relativeTo: this.route,
|
||||
queryParams: { tFrom: this.timespanFrom(), tTo: this.timespanTo() },
|
||||
queryParamsHandling: 'merge',
|
||||
replaceUrl: true,
|
||||
});
|
||||
}
|
||||
|
||||
onWeightsChange(value: WeightsSlidersValue): void {
|
||||
this.currentWeights.set(value);
|
||||
|
||||
// fires once with the query-param-aware initial state — use it to load
|
||||
if (!this.hasLoadedInitial) {
|
||||
this.hasLoadedInitial = true;
|
||||
this.loadPersons();
|
||||
this.loadAuthors();
|
||||
}
|
||||
}
|
||||
|
||||
onApplyWeights(value: WeightsSlidersValue): void {
|
||||
this.currentWeights.set(value);
|
||||
this.loadPersons();
|
||||
this.loadAuthors();
|
||||
}
|
||||
|
||||
private loadPersons(): void {
|
||||
const weights = this.currentWeights();
|
||||
|
||||
const requestPayload = {
|
||||
manualKeywords: this.state.manualKeywords(),
|
||||
extractedKeywords: this.state.extractedKeywords(),
|
||||
keywords: this.state.keywords(),
|
||||
fuzzy: this.state.fuzzySearch(),
|
||||
weights: {
|
||||
raw: weights.raw,
|
||||
normalized: weights.normalized,
|
||||
// change the company-status filter — persist to the URL and reload
|
||||
onCompanyStatusChange(status: 'all' | 'active' | 'deleted'): void {
|
||||
this.companyStatus.set(status);
|
||||
this.router.navigate([], {
|
||||
relativeTo: this.route,
|
||||
queryParams: {
|
||||
companyStatus: status === 'all' ? null : status,
|
||||
page: null,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
replaceUrl: true,
|
||||
});
|
||||
this.loadAuthors();
|
||||
}
|
||||
|
||||
resetFilters(): void {
|
||||
this.timespanFrom.set(this.minYear);
|
||||
this.timespanTo.set(this.maxYear);
|
||||
this.companyStatus.set('all');
|
||||
this.careerStages.set([]);
|
||||
this.keywordOperator.set('and');
|
||||
this.pubTypeSearchTerm.set('');
|
||||
this.router.navigate([], {
|
||||
relativeTo: this.route,
|
||||
queryParams: {
|
||||
pubType: null,
|
||||
careerStage: null,
|
||||
tFrom: null,
|
||||
tTo: null,
|
||||
companyStatus: null,
|
||||
operator: null,
|
||||
page: null,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
replaceUrl: true,
|
||||
});
|
||||
}
|
||||
|
||||
// called when a timespan thumb is released — persist to the URL and reload
|
||||
onTimespanChange(): void {
|
||||
if (this.timespanFrom() > this.timespanTo()) {
|
||||
return;
|
||||
}
|
||||
this.writeTimespanToUrl();
|
||||
this.loadAuthors();
|
||||
}
|
||||
|
||||
// the backend returns the full OpenAlex url; the profile route needs only the id
|
||||
authorProfileId(author: RankedAuthor): string {
|
||||
const parts = author.author_id.split('/');
|
||||
return parts[parts.length - 1];
|
||||
}
|
||||
|
||||
isSelected(author: RankedAuthor): boolean {
|
||||
return this.selectedIds().includes(this.authorProfileId(author));
|
||||
}
|
||||
|
||||
toggleSelect(author: RankedAuthor): void {
|
||||
const id = this.authorProfileId(author);
|
||||
const current = this.selectedIds();
|
||||
|
||||
if (current.includes(id)) {
|
||||
this.selectedIds.set(current.filter((existing) => existing !== id));
|
||||
return;
|
||||
}
|
||||
|
||||
if (current.length >= this.MAX_SELECTED) {
|
||||
this.snackBar.open(
|
||||
`Es können maximal ${this.MAX_SELECTED} Autoren verglichen werden.`,
|
||||
'OK',
|
||||
{ duration: 3000 },
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
this.selectedIds.set([...current, id]);
|
||||
}
|
||||
|
||||
// opens the compare page; everything needed is encoded in the URL so the link is shareable
|
||||
compare(): void {
|
||||
if (!this.canCompare()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.router.navigate(['/compare'], {
|
||||
queryParams: {
|
||||
authors: this.selectedIds().join(','),
|
||||
keywords: this.state.topicsList().join(','),
|
||||
operator: this.keywordOperator(),
|
||||
pubType:
|
||||
this.selectedPubTypes().length > 0
|
||||
? this.selectedPubTypes().join(',')
|
||||
: null,
|
||||
tFrom: this.timespanFrom(),
|
||||
tTo: this.timespanTo(),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private loadAuthors(): void {
|
||||
const rawWeights = this.currentWeights().raw;
|
||||
|
||||
const request: KeywordToAuthorRequest = {
|
||||
keywords: this.state.topicsList(),
|
||||
operator: this.keywordOperator(),
|
||||
filter_type: 'topic',
|
||||
publication_types:
|
||||
this.selectedPubTypes().length > 0
|
||||
? this.selectedPubTypes()
|
||||
: undefined,
|
||||
career_stages:
|
||||
this.careerStages().length > 0 ? this.careerStages() : undefined,
|
||||
weights: {
|
||||
works: rawWeights['works'],
|
||||
citation: rawWeights['citations'],
|
||||
companies: rawWeights['companies'],
|
||||
news: rawWeights['news'],
|
||||
patents: rawWeights['patents'],
|
||||
},
|
||||
timespan: {
|
||||
from: this.timespanFrom(),
|
||||
to: this.timespanTo(),
|
||||
},
|
||||
company_status: this.companyStatus(),
|
||||
};
|
||||
|
||||
console.log(requestPayload);
|
||||
|
||||
/**
|
||||
* TODO:
|
||||
* this.personsService.searchPersons(requestPayload).subscribe({
|
||||
* next: results => this.persons.set(results),
|
||||
* error: error => console.error(error),
|
||||
* });
|
||||
*/
|
||||
this.loading.set(true);
|
||||
this.rankingService.rankAuthor(request).subscribe({
|
||||
next: (results) => {
|
||||
this.authors.set(results);
|
||||
this.loading.set(false);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error(error);
|
||||
this.authors.set([]);
|
||||
this.loading.set(false);
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,6 +218,8 @@
|
||||
}
|
||||
</section>
|
||||
|
||||
<app-research-profile [workClassification]="workClassification()" />
|
||||
|
||||
@if (publication.topics?.length) {
|
||||
<section class="card">
|
||||
<div class="section-title">
|
||||
|
||||
@@ -21,6 +21,7 @@ import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
import { WorkTypePipe } from '../../shared/pipes/work-type.pipe';
|
||||
import { LanguageCodePipe } from '../../shared/pipes/language-code.pipe';
|
||||
import { WorkPrimaryCategoryPipe } from '../../shared/pipes/work-primary-category.pipe';
|
||||
import { ResearchProfileComponent } from './research-profile/research-profile.component';
|
||||
|
||||
interface DetailLink {
|
||||
label: string;
|
||||
@@ -47,7 +48,8 @@ interface InstitutionDetail {
|
||||
TopicChipComponent,
|
||||
WorkTypePipe,
|
||||
LanguageCodePipe,
|
||||
WorkPrimaryCategoryPipe
|
||||
WorkPrimaryCategoryPipe,
|
||||
ResearchProfileComponent,
|
||||
],
|
||||
templateUrl: './publication-detail.component.html',
|
||||
styleUrl: './publication-detail.component.scss',
|
||||
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
@if (details(); as profile) {
|
||||
<mat-card appearance="outlined" class="research-profile-card">
|
||||
<mat-card-header class="profile-header">
|
||||
<mat-icon class="profile-icon">science</mat-icon>
|
||||
<div class="profile-heading">
|
||||
<mat-card-title>Forschungsprofil</mat-card-title>
|
||||
<mat-card-subtitle>
|
||||
Einordnung der Forschungsorientierung dieser Publikation
|
||||
</mat-card-subtitle>
|
||||
</div>
|
||||
</mat-card-header>
|
||||
|
||||
<mat-card-content>
|
||||
<div class="visualizations">
|
||||
<section aria-labelledby="pasteur-title">
|
||||
<h3 id="pasteur-title" class="visualization-title">
|
||||
Pasteur-Quadrant
|
||||
</h3>
|
||||
<div class="quadrant-chart-frame">
|
||||
<div
|
||||
echarts
|
||||
class="quadrant-chart"
|
||||
[options]="quadrantOptions()"
|
||||
(chartInit)="onQuadrantChartInit($event)"></div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<mat-divider vertical></mat-divider>
|
||||
|
||||
<section aria-labelledby="score-title" class="score-section">
|
||||
<h3 id="score-title" class="visualization-title">
|
||||
Orientierungsscore
|
||||
</h3>
|
||||
<div class="score-content">
|
||||
<div echarts class="score-chart" [options]="scoreOptions()"></div>
|
||||
<div class="score-labels" aria-hidden="true">
|
||||
<span>Grundlagenorientiert</span>
|
||||
<span>Anwendungsorientiert</span>
|
||||
</div>
|
||||
@if (profile.primary_category; as category) {
|
||||
<app-topic-chip
|
||||
[label]="category | workPrimaryCategory"
|
||||
[color]="primaryCategoryChipColor()"
|
||||
[disabled]="true" />
|
||||
}
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
@if (
|
||||
profile.confidence === 'medium' ||
|
||||
profile.confidence === 'low' ||
|
||||
profile.insufficient_context
|
||||
) {
|
||||
<mat-divider class="notices-divider"></mat-divider>
|
||||
<div class="notices" aria-label="Hinweise zur Klassifikation">
|
||||
@if (
|
||||
profile.confidence === 'medium' || profile.confidence === 'low'
|
||||
) {
|
||||
<mat-card
|
||||
appearance="outlined"
|
||||
class="warning-note"
|
||||
[style.--warning-border]="
|
||||
confidenceWarningTokens(profile.confidence).border
|
||||
"
|
||||
[style.--warning-background]="
|
||||
confidenceWarningTokens(profile.confidence).background
|
||||
"
|
||||
[style.--warning-text]="
|
||||
confidenceWarningTokens(profile.confidence).color
|
||||
">
|
||||
<span>{{ confidenceLabel(profile.confidence) }}</span>
|
||||
<mat-icon
|
||||
class="info-icon"
|
||||
[matTooltip]="confidenceTooltip(profile.confidence)"
|
||||
matTooltipPosition="above"
|
||||
(click)="$event.stopPropagation()"
|
||||
aria-label="Erläuterung zur Konfidenz">
|
||||
info_outline
|
||||
</mat-icon>
|
||||
</mat-card>
|
||||
}
|
||||
|
||||
@if (profile.insufficient_context) {
|
||||
<mat-card
|
||||
appearance="outlined"
|
||||
class="warning-note"
|
||||
[style.--warning-border]="warningTokens.border"
|
||||
[style.--warning-background]="warningTokens.background"
|
||||
[style.--warning-text]="warningTokens.color">
|
||||
<span>Begrenzte Informationsgrundlage</span>
|
||||
<mat-icon
|
||||
class="info-icon"
|
||||
matTooltip="Für diese Einordnung standen nicht genügend inhaltliche Angaben zur Verfügung."
|
||||
matTooltipPosition="above"
|
||||
(click)="$event.stopPropagation()"
|
||||
aria-label="Erläuterung zur Informationsgrundlage">
|
||||
info_outline
|
||||
</mat-icon>
|
||||
</mat-card>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
}
|
||||
+185
@@ -0,0 +1,185 @@
|
||||
:host {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.research-profile-card {
|
||||
border-color: var(--sg-border);
|
||||
border-radius: var(--sg-radius-md);
|
||||
background: var(--sg-surface);
|
||||
box-shadow: var(--sg-shadow-sm);
|
||||
}
|
||||
|
||||
.profile-header {
|
||||
align-items: flex-start;
|
||||
padding: 22px 24px 12px;
|
||||
}
|
||||
|
||||
.profile-icon {
|
||||
flex: 0 0 24px;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin: 1px 12px 0 0;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 24px;
|
||||
line-height: 24px;
|
||||
}
|
||||
|
||||
.profile-heading {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
mat-card-title {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
mat-card-subtitle {
|
||||
margin-top: 3px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
mat-card-content {
|
||||
padding: 8px 24px 24px;
|
||||
}
|
||||
|
||||
.visualizations {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) 1px minmax(240px, 300px);
|
||||
gap: 20px;
|
||||
align-items: stretch;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.visualizations section {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.visualizations .visualization-title {
|
||||
margin: 8px 0 4px;
|
||||
color: var(--sg-text);
|
||||
font:
|
||||
700 16px/1.3 'Open Sans',
|
||||
Arial,
|
||||
sans-serif !important;
|
||||
}
|
||||
|
||||
.quadrant-chart-frame {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 320px;
|
||||
}
|
||||
|
||||
.quadrant-chart {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.score-section {
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.score-section .visualization-title {
|
||||
align-self: flex-start;
|
||||
}
|
||||
|
||||
.score-content {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
padding-bottom: 22px;
|
||||
}
|
||||
|
||||
.score-chart {
|
||||
width: 100%;
|
||||
max-width: 280px;
|
||||
height: 180px;
|
||||
}
|
||||
|
||||
.score-labels {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
width: min(100%, 280px);
|
||||
margin-top: -36px;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.score-content app-topic-chip {
|
||||
margin-top: 24px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.notices-divider {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
.notices {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
padding-top: 14px;
|
||||
}
|
||||
|
||||
.warning-note {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-height: 42px;
|
||||
padding: 9px 12px;
|
||||
border-color: var(--warning-border);
|
||||
border-radius: 12px;
|
||||
background: var(--warning-background);
|
||||
color: var(--warning-text);
|
||||
box-shadow: none;
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.warning-note .info-icon {
|
||||
flex: 0 0 auto;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
color: inherit;
|
||||
font-size: 16px;
|
||||
line-height: 16px;
|
||||
opacity: 0.7;
|
||||
cursor: default;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.visualizations {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.visualizations > mat-divider {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 560px) {
|
||||
.profile-header {
|
||||
padding-inline: 16px;
|
||||
}
|
||||
|
||||
mat-card-content {
|
||||
padding-inline: 16px;
|
||||
}
|
||||
|
||||
.quadrant-chart-frame {
|
||||
height: 350px;
|
||||
}
|
||||
}
|
||||
+422
@@ -0,0 +1,422 @@
|
||||
import {
|
||||
Component,
|
||||
DestroyRef,
|
||||
computed,
|
||||
inject,
|
||||
input,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { EChartsOption, EChartsType } from 'echarts';
|
||||
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||
import {
|
||||
WorkClassification,
|
||||
WorkClassificationDetails,
|
||||
WorkPrimaryCategory,
|
||||
} from '../../../api';
|
||||
import { WorkPrimaryCategoryPipe } from '../../../shared/pipes/work-primary-category.pipe';
|
||||
import {
|
||||
TopicChipComponent,
|
||||
TopicChipPaletteColor,
|
||||
topicChipColorTokens,
|
||||
} from '../../../shared/ui/topic-chip/topic-chip.component';
|
||||
|
||||
type PasteurQuadrant =
|
||||
| 'pure_basic'
|
||||
| 'use_inspired_basic'
|
||||
| 'pure_applied'
|
||||
| 'not_applicable';
|
||||
|
||||
interface QuadrantDefinition {
|
||||
key: PasteurQuadrant;
|
||||
coordinate: [string, string];
|
||||
title: string;
|
||||
description: string;
|
||||
color?: 'blue' | 'purple' | 'green';
|
||||
}
|
||||
|
||||
const QUADRANTS: readonly QuadrantDefinition[] = [
|
||||
{
|
||||
key: 'pure_basic',
|
||||
coordinate: ['Niedrig', 'Hoch'],
|
||||
title: 'Bohr',
|
||||
description: 'Reine\nGrundlagenforschung',
|
||||
color: 'blue',
|
||||
},
|
||||
{
|
||||
key: 'use_inspired_basic',
|
||||
coordinate: ['Hoch', 'Hoch'],
|
||||
title: 'Pasteur',
|
||||
description: 'Vom Nutzen inspirierte\nGrundlagenforschung',
|
||||
color: 'purple',
|
||||
},
|
||||
{
|
||||
key: 'not_applicable',
|
||||
coordinate: ['Niedrig', 'Niedrig'],
|
||||
title: 'Weder noch',
|
||||
description: 'Keine eindeutige\nForschungsorientierung',
|
||||
},
|
||||
{
|
||||
key: 'pure_applied',
|
||||
coordinate: ['Hoch', 'Niedrig'],
|
||||
title: 'Edison',
|
||||
description: 'Angewandte Forschung\nund Entwicklung',
|
||||
color: 'green',
|
||||
},
|
||||
];
|
||||
|
||||
const BLUE_TOKENS = topicChipColorTokens('blue');
|
||||
const WARNING_TOKENS = topicChipColorTokens('orange');
|
||||
const LOW_CONFIDENCE_TOKENS = topicChipColorTokens('pink');
|
||||
|
||||
@Component({
|
||||
selector: 'app-research-profile',
|
||||
standalone: true,
|
||||
imports: [
|
||||
MatCardModule,
|
||||
MatDividerModule,
|
||||
MatIconModule,
|
||||
MatTooltipModule,
|
||||
NgxEchartsDirective,
|
||||
TopicChipComponent,
|
||||
WorkPrimaryCategoryPipe,
|
||||
],
|
||||
templateUrl: './research-profile.component.html',
|
||||
styleUrl: './research-profile.component.scss',
|
||||
})
|
||||
export class ResearchProfileComponent {
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
private readonly quadrantChartSize = signal({ width: 640, height: 320 });
|
||||
private quadrantResizeObserver?: ResizeObserver;
|
||||
|
||||
workClassification = input.required<WorkClassification | null>();
|
||||
readonly warningTokens = WARNING_TOKENS;
|
||||
|
||||
details = computed<WorkClassificationDetails | null>(() => {
|
||||
const details = this.workClassification()?.classification;
|
||||
if (
|
||||
!details ||
|
||||
details.primary_category === WorkPrimaryCategory.NonResearch
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
return details;
|
||||
});
|
||||
|
||||
quadrantOptions = computed<EChartsOption>(() =>
|
||||
this.buildQuadrantOptions(this.details()?.pasteur_quadrant),
|
||||
);
|
||||
|
||||
scoreOptions = computed<EChartsOption>(() =>
|
||||
this.buildScoreOptions(this.details()?.applied_orientation_score ?? 0),
|
||||
);
|
||||
|
||||
primaryCategoryChipColor = computed<TopicChipPaletteColor>(() => {
|
||||
switch (this.details()?.primary_category) {
|
||||
case WorkPrimaryCategory.BasicResearch:
|
||||
return 'green';
|
||||
case WorkPrimaryCategory.AppliedResearch:
|
||||
return 'pink';
|
||||
case WorkPrimaryCategory.ExperimentalDevelopment:
|
||||
return 'purple';
|
||||
default:
|
||||
return 'orange';
|
||||
}
|
||||
});
|
||||
|
||||
confidenceLabel(confidence: string | null | undefined): string {
|
||||
return confidence === 'low' ? 'Geringe Konfidenz' : 'Mittlere Konfidenz';
|
||||
}
|
||||
|
||||
confidenceTooltip(confidence: string | null | undefined): string {
|
||||
return confidence === 'low'
|
||||
? 'Das Klassifikationsergebnis wurde mit geringer Konfidenz bestimmt.'
|
||||
: 'Das Klassifikationsergebnis wurde mit mittlerer Konfidenz bestimmt.';
|
||||
}
|
||||
|
||||
confidenceWarningTokens(confidence: string | null | undefined) {
|
||||
return confidence === 'low' ? LOW_CONFIDENCE_TOKENS : WARNING_TOKENS;
|
||||
}
|
||||
|
||||
onQuadrantChartInit(chart: EChartsType): void {
|
||||
const updateSize = (width: number, height: number) => {
|
||||
const current = this.quadrantChartSize();
|
||||
if (current.width !== width || current.height !== height) {
|
||||
this.quadrantChartSize.set({ width, height });
|
||||
}
|
||||
};
|
||||
|
||||
updateSize(chart.getWidth(), chart.getHeight());
|
||||
if (typeof ResizeObserver !== 'function') {
|
||||
return;
|
||||
}
|
||||
|
||||
this.quadrantResizeObserver?.disconnect();
|
||||
this.quadrantResizeObserver = new ResizeObserver(([entry]) => {
|
||||
if (entry) {
|
||||
updateSize(entry.contentRect.width, entry.contentRect.height);
|
||||
}
|
||||
});
|
||||
this.quadrantResizeObserver.observe(chart.getDom());
|
||||
this.destroyRef.onDestroy(() => this.quadrantResizeObserver?.disconnect());
|
||||
}
|
||||
|
||||
private buildQuadrantOptions(
|
||||
activeQuadrant: string | null | undefined,
|
||||
): EChartsOption {
|
||||
const textColor = this.cssColor('--sg-text-muted', BLUE_TOKENS.color);
|
||||
const inactiveColor = this.cssColor(
|
||||
'--sg-surface-muted',
|
||||
BLUE_TOKENS.background,
|
||||
);
|
||||
const neutralActiveColor = this.cssColor('--sg-border', BLUE_TOKENS.border);
|
||||
const surfaceColor = this.cssColor('--sg-surface', 'white');
|
||||
const axisColor = this.cssColor('--sg-text', BLUE_TOKENS.color);
|
||||
const { width: chartWidth, height: chartHeight } = this.quadrantChartSize();
|
||||
const axisLeft = 59;
|
||||
const axisTop = 12;
|
||||
const axisRight = 12;
|
||||
const axisBottom = 39;
|
||||
const horizontalY = chartHeight - axisBottom;
|
||||
const horizontalTipX = chartWidth - axisRight;
|
||||
return {
|
||||
animation: false,
|
||||
tooltip: { show: false },
|
||||
visualMap: {
|
||||
type: 'piecewise',
|
||||
show: false,
|
||||
dimension: 2,
|
||||
pieces: [
|
||||
{ value: 0, color: inactiveColor },
|
||||
{ value: 1, color: topicChipColorTokens('blue').activeBackground },
|
||||
{
|
||||
value: 2,
|
||||
color: topicChipColorTokens('purple').activeBackground,
|
||||
},
|
||||
{ value: 3, color: topicChipColorTokens('green').activeBackground },
|
||||
{ value: 4, color: neutralActiveColor },
|
||||
],
|
||||
},
|
||||
matrix: {
|
||||
left: 68,
|
||||
right: 12,
|
||||
top: 12,
|
||||
bottom: 48,
|
||||
x: {
|
||||
show: false,
|
||||
data: ['Niedrig', 'Hoch'],
|
||||
dividerLineStyle: { width: 0, opacity: 0 },
|
||||
itemStyle: { borderWidth: 0, opacity: 0 },
|
||||
},
|
||||
y: {
|
||||
show: false,
|
||||
data: ['Hoch', 'Niedrig'],
|
||||
dividerLineStyle: { width: 0, opacity: 0 },
|
||||
itemStyle: { borderWidth: 0, opacity: 0 },
|
||||
},
|
||||
body: {
|
||||
itemStyle: { borderWidth: 0, opacity: 0 },
|
||||
label: { show: false },
|
||||
},
|
||||
corner: {
|
||||
itemStyle: { borderWidth: 0, opacity: 0 },
|
||||
label: { show: false },
|
||||
},
|
||||
backgroundStyle: { borderWidth: 0, opacity: 0 },
|
||||
},
|
||||
graphic: [
|
||||
{
|
||||
type: 'line',
|
||||
silent: true,
|
||||
shape: {
|
||||
x1: axisLeft,
|
||||
y1: horizontalY,
|
||||
x2: horizontalTipX - 10,
|
||||
y2: horizontalY,
|
||||
},
|
||||
style: { stroke: axisColor, lineWidth: 2 },
|
||||
},
|
||||
{
|
||||
type: 'polygon',
|
||||
silent: true,
|
||||
shape: {
|
||||
points: [
|
||||
[horizontalTipX, horizontalY],
|
||||
[horizontalTipX - 10, horizontalY - 6],
|
||||
[horizontalTipX - 10, horizontalY + 6],
|
||||
],
|
||||
},
|
||||
style: { fill: axisColor },
|
||||
},
|
||||
{
|
||||
type: 'line',
|
||||
silent: true,
|
||||
shape: {
|
||||
x1: axisLeft,
|
||||
y1: horizontalY,
|
||||
x2: axisLeft,
|
||||
y2: axisTop + 10,
|
||||
},
|
||||
style: { stroke: axisColor, lineWidth: 2 },
|
||||
},
|
||||
{
|
||||
type: 'polygon',
|
||||
silent: true,
|
||||
shape: {
|
||||
points: [
|
||||
[axisLeft, axisTop],
|
||||
[axisLeft - 6, axisTop + 10],
|
||||
[axisLeft + 6, axisTop + 10],
|
||||
],
|
||||
},
|
||||
style: { fill: axisColor },
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
x: axisLeft + (horizontalTipX - axisLeft) / 2,
|
||||
y: chartHeight - 17,
|
||||
style: {
|
||||
text: 'Anwendungsorientierung',
|
||||
fill: textColor,
|
||||
fontSize: 12,
|
||||
fontWeight: 600,
|
||||
align: 'center',
|
||||
verticalAlign: 'bottom',
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
left: 38,
|
||||
top: 'middle',
|
||||
rotation: Math.PI / 2,
|
||||
style: {
|
||||
text: 'Erkenntnisorientierung',
|
||||
fill: textColor,
|
||||
fontSize: 12,
|
||||
fontWeight: 600,
|
||||
},
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
type: 'heatmap',
|
||||
coordinateSystem: 'matrix',
|
||||
silent: true,
|
||||
emphasis: { disabled: true },
|
||||
data: QUADRANTS.map((quadrant) => {
|
||||
const active = quadrant.key === activeQuadrant;
|
||||
const activeTokens = quadrant.color
|
||||
? topicChipColorTokens(quadrant.color)
|
||||
: BLUE_TOKENS;
|
||||
const activeColorValue = quadrant.color
|
||||
? ({ blue: 1, purple: 2, green: 3 } as const)[quadrant.color]
|
||||
: 4;
|
||||
return {
|
||||
value: [...quadrant.coordinate, active ? activeColorValue : 0],
|
||||
itemStyle: {
|
||||
borderColor: surfaceColor,
|
||||
borderWidth: 4,
|
||||
borderRadius: 10,
|
||||
},
|
||||
label: {
|
||||
show: true,
|
||||
color: active ? activeTokens.color : textColor,
|
||||
fontSize: 11,
|
||||
lineHeight: 16,
|
||||
fontWeight: 400,
|
||||
formatter: [
|
||||
`{title|${quadrant.title}}`,
|
||||
`{description|${quadrant.description}}`,
|
||||
...(active ? ['{active|✓ Diese Publikation}'] : []),
|
||||
].join('\n'),
|
||||
rich: {
|
||||
title: {
|
||||
color: active ? activeTokens.color : textColor,
|
||||
fontSize: 13,
|
||||
fontWeight: 700,
|
||||
lineHeight: 19,
|
||||
},
|
||||
description: {
|
||||
color: active ? activeTokens.color : textColor,
|
||||
fontSize: 11,
|
||||
fontWeight: 400,
|
||||
lineHeight: 16,
|
||||
},
|
||||
active: {
|
||||
color: activeTokens.color,
|
||||
backgroundColor: surfaceColor,
|
||||
borderColor: activeTokens.color,
|
||||
borderWidth: 1,
|
||||
borderRadius: 11,
|
||||
padding: [5, 10, 2, 10],
|
||||
fontSize: 10,
|
||||
fontWeight: 700,
|
||||
lineHeight: 18,
|
||||
align: 'center',
|
||||
verticalAlign: 'middle',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}),
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
private buildScoreOptions(score: number): EChartsOption {
|
||||
const boundedScore = Math.max(0, Math.min(100, score));
|
||||
const textColor = this.cssColor('--sg-text', BLUE_TOKENS.color);
|
||||
return {
|
||||
animation: false,
|
||||
series: [
|
||||
{
|
||||
type: 'gauge',
|
||||
min: 0,
|
||||
max: 100,
|
||||
startAngle: 180,
|
||||
endAngle: 0,
|
||||
center: ['50%', '70%'],
|
||||
radius: '92%',
|
||||
progress: {
|
||||
show: true,
|
||||
width: 13,
|
||||
itemStyle: { color: BLUE_TOKENS.color },
|
||||
},
|
||||
axisLine: {
|
||||
lineStyle: { width: 13, color: [[1, BLUE_TOKENS.background]] },
|
||||
},
|
||||
pointer: { show: false },
|
||||
axisTick: { show: false },
|
||||
splitLine: { show: false },
|
||||
axisLabel: { show: false },
|
||||
anchor: { show: false },
|
||||
title: { show: false },
|
||||
detail: {
|
||||
valueAnimation: false,
|
||||
offsetCenter: [0, '-8%'],
|
||||
color: textColor,
|
||||
fontSize: 25,
|
||||
fontWeight: 700,
|
||||
formatter: '{value}',
|
||||
},
|
||||
data: [{ value: boundedScore }],
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
private cssColor(variable: string, fallback: string): string {
|
||||
if (typeof getComputedStyle !== 'function') {
|
||||
return fallback;
|
||||
}
|
||||
return (
|
||||
getComputedStyle(document.documentElement)
|
||||
.getPropertyValue(variable)
|
||||
.trim() || fallback
|
||||
);
|
||||
}
|
||||
}
|
||||
+1
@@ -132,6 +132,7 @@
|
||||
[label]="topic"
|
||||
[active]="activeChartTopic() === topic"
|
||||
[color]="getTopicColor(topic)"
|
||||
[disabled]="isTopicEmpty(topic)"
|
||||
(chipClick)="updateActiveChartTopic(topic)">
|
||||
</app-topic-chip>
|
||||
}
|
||||
|
||||
+69
-18
@@ -76,7 +76,7 @@ export const TREND_CONFIGS: Record<string, TrendStrategyConfig> = {
|
||||
chartTitle: 'Autorentrends',
|
||||
},
|
||||
patents: {
|
||||
showInstitutionSelector: true,
|
||||
showInstitutionSelector: false,
|
||||
showLocationSelector: false,
|
||||
showAuthorSelector: false,
|
||||
yAxisLabel: 'Patentanmeldungen',
|
||||
@@ -231,12 +231,23 @@ export class UniTrendParentComponent implements OnInit {
|
||||
|
||||
getTopicColor(topic: string): string {
|
||||
const mapped = this.getMappedTopic(topic);
|
||||
const entries = this.state?.selectedKeywordEntries() ?? [];
|
||||
const ext = this.state?.extractedKeywords() ?? [];
|
||||
const man = this.state?.manualKeywords() ?? [];
|
||||
const all = [...ext, ...man];
|
||||
const all = [...entries, ...ext, ...man];
|
||||
|
||||
const targetLower = topic.toLowerCase().trim();
|
||||
const mappedLower = mapped.toLowerCase().trim();
|
||||
|
||||
const match = all.find(
|
||||
(e) => e.topic_mapping?.topic?.display_name === mapped,
|
||||
(e) =>
|
||||
e.topic_mapping?.topic?.display_name?.toLowerCase().trim() ===
|
||||
mappedLower ||
|
||||
e.topic_mapping?.topic?.display_name?.toLowerCase().trim() ===
|
||||
targetLower ||
|
||||
e.llm_keyword?.keyword?.toLowerCase().trim() === targetLower,
|
||||
);
|
||||
|
||||
if (match && match.topic_mapping?.topic) {
|
||||
return topicHierarchyColor({
|
||||
name: match.topic_mapping.topic.display_name,
|
||||
@@ -340,7 +351,7 @@ export class UniTrendParentComponent implements OnInit {
|
||||
if (!raw) return null;
|
||||
|
||||
const type = this.selectedSearchType();
|
||||
if (type === 'news' || type === 'all') {
|
||||
if (type === 'news' || type === 'all' || type === 'patents') {
|
||||
return {
|
||||
...raw,
|
||||
series: raw.series.map((s) => ({
|
||||
@@ -444,12 +455,23 @@ export class UniTrendParentComponent implements OnInit {
|
||||
const searchType = this.selectedSearchType();
|
||||
|
||||
if (topics.length > 0) {
|
||||
// Find existing selections that are still in topics, or default to all
|
||||
const validSelections = currentSelections.filter((t: string) =>
|
||||
topics.includes(t),
|
||||
);
|
||||
if (validSelections.length > 0) {
|
||||
this.selectedTrendTopics.set(validSelections);
|
||||
const altTopics = fuzzy ? kws : (this.state?.topicsList() ?? kws);
|
||||
const mappedSelections: string[] = [];
|
||||
|
||||
currentSelections.forEach((item) => {
|
||||
if (topics.includes(item)) {
|
||||
mappedSelections.push(item);
|
||||
} else {
|
||||
const idx = altTopics.indexOf(item);
|
||||
if (idx !== -1 && idx < topics.length && topics[idx]) {
|
||||
mappedSelections.push(topics[idx]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const finalSelections = Array.from(new Set(mappedSelections));
|
||||
if (finalSelections.length > 0) {
|
||||
this.selectedTrendTopics.set(finalSelections);
|
||||
} else {
|
||||
this.selectedTrendTopics.set(topics);
|
||||
}
|
||||
@@ -883,8 +905,8 @@ export class UniTrendParentComponent implements OnInit {
|
||||
.searchPersonsList(
|
||||
undefined, // query
|
||||
'University of Duisburg-Essen', // primary institution
|
||||
undefined, // sortBy
|
||||
undefined, // sortOrder
|
||||
'cited_by_count', // sortBy
|
||||
'desc', // sortOrder
|
||||
[topic], // topic
|
||||
1, // page
|
||||
3, // pageSize
|
||||
@@ -972,8 +994,8 @@ export class UniTrendParentComponent implements OnInit {
|
||||
.searchPersonsList(
|
||||
undefined, // query
|
||||
'University of Duisburg-Essen', // UDE
|
||||
undefined, // sortBy
|
||||
undefined, // sortOrder
|
||||
'cited_by_count', // sortBy
|
||||
'desc', // sortOrder
|
||||
[topic], // topic
|
||||
1, // page
|
||||
6, // pageSize
|
||||
@@ -990,8 +1012,8 @@ export class UniTrendParentComponent implements OnInit {
|
||||
.searchPersonsList(
|
||||
undefined,
|
||||
undefined, // global!
|
||||
undefined,
|
||||
undefined,
|
||||
'cited_by_count',
|
||||
'desc',
|
||||
[topic],
|
||||
1,
|
||||
6,
|
||||
@@ -1231,8 +1253,8 @@ export class UniTrendParentComponent implements OnInit {
|
||||
.searchPersonsList(
|
||||
undefined, // query
|
||||
name, // institutionName
|
||||
undefined, // sortBy
|
||||
undefined, // sortOrder
|
||||
'cited_by_count', // sortBy
|
||||
'desc', // sortOrder
|
||||
[topic], // topic
|
||||
1, // page
|
||||
3, // pageSize
|
||||
@@ -1289,8 +1311,37 @@ export class UniTrendParentComponent implements OnInit {
|
||||
this.updateUrlParams();
|
||||
}
|
||||
|
||||
isTopicEmpty(topic: string): boolean {
|
||||
const data = this.trendResponse();
|
||||
if (!data || !data.series || data.series.length === 0) {
|
||||
return false;
|
||||
}
|
||||
const mapped = this.getMappedTopic(topic);
|
||||
const startYr = this.startYear();
|
||||
const endYr = this.endYear();
|
||||
|
||||
let totalRaw = 0;
|
||||
data.series.forEach((s) => {
|
||||
if (s.visible !== false && s.topic_data) {
|
||||
const items = s.topic_data[topic] || s.topic_data[mapped];
|
||||
if (items) {
|
||||
items.forEach((y) => {
|
||||
if (y.year >= startYr && y.year <= endYr) {
|
||||
totalRaw += y.raw || 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return totalRaw === 0;
|
||||
}
|
||||
|
||||
// Topic tab toggle (data reuses instantly)
|
||||
updateActiveChartTopic(topic: string) {
|
||||
if (this.isTopicEmpty(topic)) {
|
||||
return;
|
||||
}
|
||||
this.activeChartTopic.set(topic);
|
||||
this.updateUrlParams();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user