Merge dev into fix-analyses-dashboard
LocationBasedServices/smartguide/pipeline/head This commit looks good

This commit is contained in:
2026-07-21 19:12:29 +02:00
610 changed files with 249115 additions and 20792 deletions
@@ -1,5 +1,9 @@
@if (loading) {
<p class="message">Lade Patente...</p>
<app-loading
text="Patentdaten werden geladen..."
icon="workspace_premium"
[size]="150"
[diameter]="150" />
} @else if (error) {
<p class="message">Fehler beim Laden der Patente.</p>
} @else if (patents.length === 0) {
@@ -7,6 +7,7 @@ import {
formatPatentDate,
getPublicationStageLabel,
} from '../patent-detail/patent-detail.utils';
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
type SortMode = 'date' | 'title';
type SourceFilter = 'all' | 'EPO' | 'USPTO';
@@ -14,7 +15,7 @@ type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both';
@Component({
selector: 'app-institution-patents',
imports: [CommonModule, RouterLink],
imports: [CommonModule, RouterLink, LoadingComponent],
templateUrl: './institution-patents.component.html',
styleUrl: './institution-patents.component.scss',
})
@@ -1 +1,46 @@
<p>institution-publications works!</p>
<div class="content">
<div>
<h6>Publikationen</h6>
<p>Übersicht der wissenschaftlichen Veröffentlichungen.</p>
</div>
@if (canViewClassificationChart()) {
<mat-accordion multi>
<mat-expansion-panel class="mat-elevation-z1">
<mat-expansion-panel-header>
<mat-panel-title>Forschungszwecke</mat-panel-title>
</mat-expansion-panel-header>
<app-primary-category-year-aggregation-chart
[page]="primaryCategoryYearAggregationPage()" />
</mat-expansion-panel>
<mat-expansion-panel class="mat-elevation-z1" [expanded]="true">
<mat-expansion-panel-header>
<mat-panel-title>Publikationsliste</mat-panel-title>
<mat-panel-description
>{{ total() >= 10000 ? 'mehr als' : '' }}
{{ total() }} Publikationen</mat-panel-description
>
</mat-expansion-panel-header>
<ng-container *ngTemplateOutlet="filterTableAndPaginator" />
</mat-expansion-panel>
</mat-accordion>
} @else {
<ng-container *ngTemplateOutlet="filterTableAndPaginator" />
}
</div>
<ng-template #filterTableAndPaginator>
<app-publication-filter
[selectedAuthorsPage]="selectedAuthorsPage()"
[selectedTopicsPage]="selectedTopicsPage()"
[showInstitutionFilter]="false" />
<app-publication-table
[page]="institutionWorkPage()"
[authorFilterEnabled]="true" />
<app-query-param-paginator
[total]="total()"
queryParamPageKey="page"
queryParamSizeKey="size" />
</ng-template>
@@ -0,0 +1,28 @@
.content {
display: flex;
flex-direction: column;
gap: 1rem;
padding: 2rem;
}
mat-expansion-panel {
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
background: var(--sg-none);
box-shadow: none;
}
mat-expansion-panel-header {
padding: 0 16px;
min-height: 48px;
}
mat-panel-title {
font-size: 16px;
font-weight: 700;
}
mat-panel-description {
font-size: 14px;
color: var(--sg-text-muted);
}
@@ -1,9 +1,41 @@
import { Component } from '@angular/core';
import { Component, computed, input } from '@angular/core';
import { PublicationTableComponent } from '../../shared/ui/publication-table/publication-table.component';
import {
AuthorPage,
PrimaryCategoryYearAggregationPage,
TopicPageV2,
WorkPageV2,
} from '../../api';
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
import { PublicationFilterComponent } from '../../shared/ui/publication-filters/publication-filters.component';
import { PrimaryCategoryYearAggregationChartComponent } from '../../shared/ui/primary-category-year-aggregation-chart/primary-category-year-aggregation-chart.component';
import { MatExpansionModule } from '@angular/material/expansion';
import { CommonModule } from '@angular/common';
@Component({
selector: 'app-institution-publications',
imports: [],
imports: [
PublicationTableComponent,
QueryParamPaginatorComponent,
PublicationFilterComponent,
PrimaryCategoryYearAggregationChartComponent,
MatExpansionModule,
CommonModule,
],
templateUrl: './institution-publications.component.html',
styleUrl: './institution-publications.component.scss',
})
export class InstitutionPublicationsComponent {}
export class InstitutionPublicationsComponent {
institutionWorkPage = input.required<WorkPageV2>();
selectedAuthorsPage = input.required<AuthorPage>();
selectedTopicsPage = input.required<TopicPageV2>();
primaryCategoryYearAggregationPage =
input.required<PrimaryCategoryYearAggregationPage>();
total = computed(() => this.institutionWorkPage().total ?? 0);
canViewClassificationChart = computed(() => {
const page = this.primaryCategoryYearAggregationPage();
return (page?.elements?.length ?? 0) > 0;
});
}
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, inject } from '@angular/core';
import {
ActivatedRoute,
RouterLink,
@@ -6,9 +6,12 @@ import {
RouterLinkActive,
} from '@angular/router';
import { Institution } from '../../api';
import { PatentsService } from '../../api/api/patents.service';
import { MatCardModule } from '@angular/material/card';
import { MatTabsModule } from '@angular/material/tabs';
const PATENTS_LINK = { label: 'Patente', path: 'patents', disabled: false };
@Component({
selector: 'app-institution',
imports: [
@@ -22,6 +25,8 @@ import { MatTabsModule } from '@angular/material/tabs';
styleUrl: './institution.component.scss',
})
export class InstitutionComponent implements OnInit {
private readonly patentsApi = inject(PatentsService);
institution!: Institution;
links = [
@@ -40,7 +45,6 @@ export class InstitutionComponent implements OnInit {
sort_direction: 'asc',
},
},
{ label: 'Patente', path: 'patents', disabled: false },
];
constructor(private readonly activatedRoute: ActivatedRoute) {}
@@ -49,5 +53,19 @@ export class InstitutionComponent implements OnInit {
this.activatedRoute.data.subscribe(({ institution }) => {
this.institution = institution;
});
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];
}
},
});
}
}
@@ -7,6 +7,7 @@
[page]="page()"
[cardMinWidth]="300"
[cardTmp]="cardTmp"
[observers]="observers"
[cardMinWidth]="550"
searchLabel="Suche nach Namen"
[sortingOptions]="sortingOptions"
@@ -74,17 +75,19 @@
<mat-icon>work</mat-icon>
Projekte
</a>
<a
mat-button
[routerLink]="[
'/institution',
extractInstitutionId(institution),
'patents',
]"
(click)="$event.stopPropagation()">
<mat-icon>verified</mat-icon>
Patente
</a>
@if (hasPatents(institution)) {
<a
mat-button
[routerLink]="[
'/institution',
extractInstitutionId(institution),
'patents',
]"
(click)="$event.stopPropagation()">
<mat-icon>verified</mat-icon>
Patente
</a>
}
</mat-card-actions>
</mat-card-footer>
</mat-card>
@@ -1,5 +1,6 @@
import { Component, computed, input } from '@angular/core';
import { Component, computed, effect, inject, input } from '@angular/core';
import { Institution, InstitutionPage } from '../../api';
import { PatentsService } from '../../api/api/patents.service';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { RouterModule } from '@angular/router';
@@ -11,6 +12,7 @@ import {
Page,
CardSearchComponent,
} from '../../shared/ui/card-search/card-search.component';
import { FilterObserver } from '../../shared/ui/selected-filters/selected-filters.component';
@Component({
selector: 'app-institutions',
@@ -26,8 +28,18 @@ import {
styleUrl: './institutions.component.scss',
})
export class InstitutionsComponent {
private readonly patentsApi = inject(PatentsService);
institutionPage = input.required<InstitutionPage>();
observers: FilterObserver[] = [
{
id: 'name',
queryParamKey: 'search',
icon: 'search',
},
];
page = computed<Page>(() => ({
page: this.institutionPage().page || 0,
size: this.institutionPage().size || 10,
@@ -35,6 +47,31 @@ export class InstitutionsComponent {
elements: this.institutionPage().elements || [],
}));
// The "Patente" action only makes sense once org_patents has been indexed
// for that institution (currently a manual, per-institution process), so
// it's hidden by default and only shown once a cheap count check confirms
// there is actually data behind it.
private readonly patentsAvailable = new Map<string, boolean>();
constructor() {
effect(() => {
for (const institution of this.page().elements) {
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);
},
});
}
});
}
hasPatents(institution: Institution): boolean {
return this.patentsAvailable.get(this.extractInstitutionId(institution)) ?? false;
}
sortingOptions: SelectorOption[] = [
{ value: 'relevance', display_name: 'Relevanz' },
{ value: 'name', display_name: 'Name' },
@@ -1,44 +1,37 @@
@if (loading()) {
<p class="message">Lade passende Patente...</p>
<div class="patents-container">
<ng-container *ngTemplateOutlet="patentsHeader" />
<app-loading
text="Patentdaten werden geladen..."
icon="workspace_premium"
[size]="150"
[diameter]="150" />
</div>
} @else if (error()) {
<p class="message">Fehler beim Laden der Patente.</p>
<div class="patents-container">
<ng-container *ngTemplateOutlet="patentsHeader" />
<p class="message">Fehler beim Laden der Patente.</p>
</div>
} @else if (matches().length === 0) {
<p class="message">Keine passenden Patente gefunden.</p>
<div class="patents-container">
<ng-container *ngTemplateOutlet="patentsHeader" />
<p class="message">{{ emptyMessage() }}</p>
</div>
} @else {
<div class="patents-container">
<h2 class="section-title">Passende Patente</h2>
<ng-container *ngTemplateOutlet="patentsHeader" />
<div class="patents-content">
<div class="patents-list">
<div class="patents-list-toolbar">
<label class="sort-control">
<span>Filter nach Quelle:</span>
<select
[value]="activeFilter()"
(change)="setFilter($any($event.target).value)">
<option value="all">Alle</option>
<option value="EPO">EPO</option>
<option value="USPTO">USPTO</option>
</select>
</label>
</div>
<table>
<thead>
<tr>
<th>Patent</th>
<th>Score</th>
<th>Quelle</th>
<th>Jahr</th>
</tr>
</thead>
<tbody>
@for (item of pagedMatches(); track trackMatch($index, item)) {
<tr
@@ -47,9 +40,7 @@
<td class="patent-title">
{{ item.patent.title ?? item.patent.patent_id }}
</td>
<td class="match-score">{{ formatScore(item.match_score) }}</td>
<td>
<span
class="source-badge source-badge--{{
@@ -58,7 +49,6 @@
{{ item.patent.source }}
</span>
</td>
<td>{{ item.patent.publication_year ?? '-' }}</td>
</tr>
}
@@ -72,9 +62,7 @@
(click)="setPage(selectedPage() - 1)">
Zurück
</button>
<span>Seite {{ selectedPage() }} von {{ pageCount() }}</span>
<button
[disabled]="selectedPage() === pageCount()"
(click)="setPage(selectedPage() + 1)">
@@ -87,35 +75,27 @@
@if (selectedMatch(); as match) {
<div class="patent-detail">
<h3>{{ match.patent.title ?? match.patent.patent_id }}</h3>
<div class="detail-stats">
<div class="stat">
<span class="stat-label">Match-Score</span>
<span class="stat-value">{{
formatScore(match.match_score)
}}</span>
</div>
<div class="stat">
<span class="stat-label">Gematchte Keywords</span>
<span class="stat-value">{{
formatMatchList(match.matched_keywords)
}}</span>
</div>
<div class="stat">
<span class="stat-label">Gematchte IPC/CPC</span>
<span class="stat-value">{{
formatMatchList(match.matched_ipc_symbols)
}}</span>
</div>
<div class="stat">
<span class="stat-label">Quelle</span>
<span class="stat-value">
<span
class="source-badge source-badge--{{
@@ -125,25 +105,19 @@
</span>
</span>
</div>
<div class="stat">
<span class="stat-label">Patent-Nr.</span>
<span class="stat-value">{{ match.patent.patent_id }}</span>
</div>
<div class="stat">
<span class="stat-label">Datum</span>
<span class="stat-value">{{
formatDate(match.patent.publication_date)
}}</span>
</div>
@if (getPublicationStageLabel(match.patent); as stageLabel) {
<div class="stat">
<span class="stat-label">Publikationsstufe</span>
<span class="stat-value">{{ stageLabel }}</span>
</div>
}
@@ -156,7 +130,6 @@
<span class="patent-detail-action__label"
>Patentdetails anzeigen</span
>
<span class="material-icons" aria-hidden="true">chevron_right</span>
</button>
</div>
@@ -164,3 +137,35 @@
</div>
</div>
}
<ng-template #patentsHeader>
<div class="patents-header">
<h2 class="section-title">Passende Patente</h2>
<div class="patents-header-actions">
@if (matches().length > 0) {
<label class="sort-control">
<span>Filter nach Quelle:</span>
<select
[value]="activeFilter()"
(change)="setFilter($any($event.target).value)">
<option value="all">Alle</option>
<option value="EPO">EPO</option>
<option value="USPTO">USPTO</option>
</select>
</label>
}
@if (showReload()) {
<button
mat-stroked-button
type="button"
class="reload-btn"
[disabled]="reloadDisabled()"
(click)="onReload()">
<mat-icon>refresh</mat-icon>
Neu laden
</button>
}
</div>
</div>
</ng-template>
@@ -3,19 +3,51 @@
color: #666;
}
.fallback-notice {
margin: 0 0 12px;
padding: 10px 12px;
border-radius: 8px;
background: #f4f7fb;
color: #3d4f63;
font-size: 0.9rem;
}
.section-title {
margin: 0 0 16px;
margin: 0;
font-size: 1.25rem;
}
.patents-container {
margin-top: 1.5rem;
margin-top: 0;
padding: 16px;
border-radius: 12px;
background: #fff;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.patents-header {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 16px;
}
.patents-header-actions {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-end;
gap: 10px;
margin-left: auto;
}
.reload-btn {
min-height: 40px;
white-space: nowrap;
}
.sort-control {
display: inline-flex;
align-items: center;
@@ -145,6 +177,16 @@
}
@media (max-width: 900px) {
.patents-header {
flex-direction: column;
align-items: stretch;
}
.patents-header-actions {
margin-left: 0;
justify-content: space-between;
}
.patents-content {
flex-direction: column;
}
@@ -1,56 +1,61 @@
import { Component, input, signal } from '@angular/core';
import { NgTemplateOutlet } from '@angular/common';
import { Component, input, output, signal } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { Router } from '@angular/router';
import { PatentEntry } from '../../../api/model/patentEntry';
import { KeywordPatentMatch } from '../../../api/model/keywordPatentMatch';
import { LoadingComponent } from '../../../shared/ui/loading/loading.component';
import {
formatPatentDate,
getPublicationStageLabel,
} from '../../patent-detail/patent-detail.utils';
import { KeywordPatentMatch } from '../../../api';
import { KeywordPatentMappingStatus } from '../../../api';
type SourceFilter = 'all' | 'EPO' | 'USPTO';
@Component({
selector: 'app-keywords-patents',
imports: [NgTemplateOutlet, MatButtonModule, MatIconModule, LoadingComponent],
templateUrl: './keywords-patents.component.html',
styleUrl: './keywords-patents.component.scss',
})
export class KeywordsPatentsComponent {
readonly matches = input<KeywordPatentMatch[]>([]);
readonly mappingStatus = input<KeywordPatentMappingStatus | null>(null);
readonly loading = input(false);
readonly error = input(false);
readonly showReload = input(false);
readonly reloadDisabled = input(false);
readonly reload = output<void>();
activeFilter = signal<SourceFilter>('all');
selectedMatch = signal<KeywordPatentMatch | null>(null);
selectedPage = signal(1);
readonly pageSize = 10;
constructor(private readonly router: Router) {}
emptyMessage(): string {
switch (this.mappingStatus()) {
case 'search_error':
return 'Die Patentrecherche ist technisch fehlgeschlagen. Bitte später erneut versuchen.';
default:
return 'Keine passenden Patente gefunden';
}
}
filteredMatches(): KeywordPatentMatch[] {
const filter = this.activeFilter();
const items = this.matches();
if (filter === 'all') {
return items;
}
return items.filter((item) => item.patent.source === filter);
}
pagedMatches(): KeywordPatentMatch[] {
const start = (this.selectedPage() - 1) * this.pageSize;
return this.filteredMatches().slice(start, start + this.pageSize);
}
@@ -67,9 +72,7 @@ export class KeywordsPatentsComponent {
setFilter(filter: SourceFilter): void {
this.activeFilter.set(filter);
this.selectedPage.set(1);
this.selectedMatch.set(null);
}
@@ -83,12 +86,14 @@ export class KeywordsPatentsComponent {
openDetail(): void {
const match = this.selectedMatch();
if (!match) return;
void this.router.navigate(['/patent', match.patent.patent_id]);
}
onReload(): void {
this.reload.emit();
}
formatDate(date: string | null | undefined): string {
return formatPatentDate(date);
}
@@ -101,7 +106,6 @@ export class KeywordsPatentsComponent {
if (score == null || Number.isNaN(score)) {
return '-';
}
return score.toFixed(2);
}
@@ -109,22 +113,16 @@ export class KeywordsPatentsComponent {
if (!values || values.length === 0) {
return '-';
}
return values.join(', ');
}
trackMatch(_index: number, item: KeywordPatentMatch): string {
const patent = item.patent;
return [
patent.source,
patent.patent_id,
patent.publication_date ?? '',
patent.kind ?? patent.application_type ?? '',
item.match_score,
].join('|');
}
@@ -159,7 +159,6 @@
</mat-button-toggle>
</mat-button-toggle-group>
</div>
<div class="toolbar-divider"></div>
</div>
<div class="spacer toolbar-controls manual-input-controls">
@@ -435,23 +434,6 @@
<mat-icon>show_chart</mat-icon>
Visualisierung
</button>
<button
mat-flat-button
class="patents-btn"
[disabled]="isSearchDisabled()"
(click)="loadPatentsForSelection()">
<mat-icon>description</mat-icon>
Patente
</button>
</div>
</div>
@if (showPatents()) {
<app-keywords-patents
[matches]="patentMatches()"
[loading]="loadingPatents()"
[error]="patentsError()">
</app-keywords-patents>
}
}
@@ -461,19 +461,13 @@ mat-button-toggle-group {
}
.search-btn,
.visualize-btn,
.patents-btn {
.visualize-btn {
min-width: 220px;
min-height: $touch-target;
align-self: center;
white-space: nowrap;
}
.patents-btn {
background: #0f766e !important;
color: #fff !important;
}
/* Tablet */
@media (max-width: $tablet) {
.search-container {
@@ -485,8 +479,7 @@ mat-button-toggle-group {
}
.search-btn,
.visualize-btn,
.patents-btn {
.visualize-btn {
width: 100%;
}
}
@@ -509,8 +502,7 @@ mat-button-toggle-group {
}
.search-btn,
.visualize-btn,
.patents-btn {
.visualize-btn {
width: 100%;
}
}
@@ -52,15 +52,9 @@ import {
} from '../../resolvers/utils/topic-legend';
import { MatTooltipModule } from '@angular/material/tooltip';
import { A11yModule } from '@angular/cdk/a11y';
import { PatentsService } from '../../api/api/patents.service';
import { KeywordsPatentsComponent } from './keywords-patents/keywords-patents.component';
import { DomSanitizer } from '@angular/platform-browser';
import { SearchResultsPayload } from './search-results/search-results-state.service';
import {
KeywordPatentMatch,
KeywordPatentSearchItem,
KeywordsService,
} from '../../api';
import { clearPatentsCache } from './patent-search.utils';
type InputMode = 'url' | 'text' | 'file';
type KeywordCategory = 'broad' | 'coarse' | 'fine' | 'manual';
type KeywordView = 'llm' | 'topic';
@@ -86,7 +80,6 @@ type KeywordPatentLevel = 'broad' | 'coarse' | 'fine' | 'custom';
MatTooltipModule,
A11yModule,
NgTemplateOutlet,
KeywordsPatentsComponent,
LoadingComponent,
MatSlideToggleModule,
MatSliderModule,
@@ -105,7 +98,6 @@ export class KeywordsSearchComponent {
private readonly websocketService = inject(KeywordWebSocketService);
private readonly topicsService = inject(TopicsService);
private readonly breakpointObserver = inject(BreakpointObserver);
private readonly keywordsService = inject(KeywordsService);
readonly form = this.formBuilder.nonNullable.group({
selectedInputType: 'url' as InputMode,
@@ -141,11 +133,6 @@ export class KeywordsSearchComponent {
readonly extractionSource = signal<InputMode | null>(null);
readonly topicMappingSearch = signal<boolean>(false);
readonly showVisualization = signal<boolean>(false);
readonly showPatents = signal(false);
readonly patentMatches = signal<KeywordPatentMatch[]>([]);
readonly loadingPatents = signal(false);
readonly patentsError = signal(false);
readonly patentsLoaded = signal(false);
readonly uploadedFiles = signal<FileUploadItem[]>([]);
readonly keywordsExist = computed(
@@ -338,10 +325,7 @@ export class KeywordsSearchComponent {
this.broadKeywordEntries.set([]);
this.coarseKeywordEntries.set([]);
this.fineKeywordEntries.set([]);
this.patentMatches.set([]);
this.patentsLoaded.set(false);
this.patentsError.set(false);
this.showPatents.set(false);
clearPatentsCache();
this.websocketService.close();
this.isExtracting.set(false);
this.loadingNewKeyword.set(false);
@@ -592,12 +576,7 @@ export class KeywordsSearchComponent {
this.manualKeywordEntries.set([]);
this.sourceContent.set('');
this.sourceUrl.set(null);
this.patentMatches.set([]);
this.patentsLoaded.set(false);
this.patentsError.set(false);
this.showPatents.set(false);
// Keep only selected keywords that are in the manual list
clearPatentsCache();
const manualSet = new Set(this.getKeywordLabels(this.manualKeywords()));
this.selectedKeywords.set(
this.selectedKeywords().filter((k) => manualSet.has(k)),
@@ -762,12 +741,11 @@ export class KeywordsSearchComponent {
search(): void {
this.showVisualization.set(false);
this.showPatents.set(false);
const fuzzySearch =
this.route.snapshot.queryParamMap.get('fuzzy') === 'true';
const fuzzySearch = this.topicMappingSearch();
const payload: SearchResultsPayload = {
extractedKeywords: this.getSelectedExtractedKeywordEntries(),
manualKeywords: this.getSelectedManualKeywordEntries(),
patentKeywordEntries: this.getSelectedPatentKeywordEntries(),
keywords: this.selectedKeywords(),
options: {
fuzzy: fuzzySearch,
@@ -795,16 +773,9 @@ export class KeywordsSearchComponent {
}
visualize(): void {
this.showPatents.set(false);
this.showVisualization.set(true);
}
loadPatentsForSelection(): void {
this.showVisualization.set(false);
this.showPatents.set(true);
this.loadMatchingPatents();
}
// --- Helpers --------------------------------------------------------------
private applyExtractedKeywords(keywords: ExtractedKeywords): void {
@@ -993,6 +964,7 @@ export class KeywordsSearchComponent {
const view = queryParams.get('view') ?? 'llm';
const legend = queryParams.get('legend') ?? 'on';
const legendExpanded = queryParams.get('legendExpanded') ?? 'off';
const fuzzy = queryParams.get('fuzzy') === 'true';
this.isRestoringState = true;
this.form.patchValue(
{
@@ -1006,6 +978,7 @@ export class KeywordsSearchComponent {
this.subfieldLegendVisible.set(legend === 'on');
this.subfieldLegendExpanded.set(legendExpanded === 'on');
this.extractionSource.set(source as InputMode);
this.topicMappingSearch.set(fuzzy);
this.restoreStateFromSession();
const merged = this.uniqueKeywordEntries([
@@ -1229,35 +1202,6 @@ export class KeywordsSearchComponent {
}
}
private loadMatchingPatents(): void {
const keywords = this.buildPatentSearchItems(
this.getSelectedPatentKeywordEntries(),
);
if (keywords.length === 0) {
this.patentMatches.set([]);
this.patentsLoaded.set(true);
return;
}
this.loadingPatents.set(true);
this.patentsError.set(false);
this.keywordsService.getPatentsByKeywords({ keywords }).subscribe({
next: (response) => {
this.patentMatches.set(response.patents ?? []);
this.patentsLoaded.set(true);
this.loadingPatents.set(false);
},
error: (error) => {
console.error('Patent search failed:', error);
this.patentMatches.set([]);
this.patentsLoaded.set(true);
this.patentsError.set(true);
this.loadingPatents.set(false);
},
});
}
private getSelectedPatentKeywordEntries(): Array<{
entry: KeywordEntryWithTopic;
level: KeywordPatentLevel;
@@ -1283,21 +1227,4 @@ export class KeywordsSearchComponent {
.map((entry) => ({ entry, level: 'custom' as const })),
];
}
private buildPatentSearchItems(
items: Array<{ entry: KeywordEntryWithTopic; level: KeywordPatentLevel }>,
): KeywordPatentSearchItem[] {
return items
.map(({ entry, level }) => ({
keyword: entry.llm_keyword.keyword,
keyword_level: level,
topic_id: entry.topic_mapping?.topic?.id ?? null,
topic_display_name: entry.topic_mapping?.topic?.display_name ?? null,
subfield_name:
entry.topic_mapping?.topic?.subfield?.display_name ?? null,
field_name: entry.topic_mapping?.topic?.field?.display_name ?? null,
relevance_score: entry.llm_keyword.relevance_score ?? 1,
}))
.filter((item) => item.keyword.trim().length > 0);
}
}
@@ -0,0 +1,188 @@
import { KeywordPatentMappingStatus } from '../../api';
import { KeywordEntryWithTopic } from '../../api/model/keywordEntryWithTopic';
import { KeywordPatentMatch } from '../../api/model/keywordPatentMatch';
import { KeywordPatentSearchItem } from '../../api/model/keywordPatentSearchItem';
import {
PatentKeywordEntry,
SearchResultsPayload,
} from './search-results/search-results-state.service';
export const PATENTS_CACHE_KEY = 'keywords-patents-cache';
export interface PatentsCache {
keywords: string[];
matches: KeywordPatentMatch[];
mappingStatus?: KeywordPatentMappingStatus | null;
}
export interface PatentsCacheResult {
matches: KeywordPatentMatch[];
mappingStatus: KeywordPatentMappingStatus | null;
}
export function buildPatentSearchItems(
items: PatentKeywordEntry[],
): KeywordPatentSearchItem[] {
return items
.map(({ entry, level }) => ({
keyword: entry.llm_keyword.keyword,
keyword_level: level,
topic_id: entry.topic_mapping?.topic?.id ?? null,
topic_display_name: entry.topic_mapping?.topic?.display_name ?? null,
subfield_name: entry.topic_mapping?.topic?.subfield?.display_name ?? null,
field_name: entry.topic_mapping?.topic?.field?.display_name ?? null,
relevance_score: entry.llm_keyword.relevance_score ?? 1,
}))
.filter((item) => item.keyword.trim().length > 0);
}
export function buildPatentSearchItemsFromPayload(
payload: SearchResultsPayload | null,
): KeywordPatentSearchItem[] {
if (!payload) return [];
if (payload.patentKeywordEntries?.length) {
return buildPatentSearchItems(payload.patentKeywordEntries);
}
const selected = new Set(
payload.keywords.map((keyword) => normalizeKeyword(keyword)),
);
const isSelected = (entry: KeywordEntryWithTopic) =>
selected.has(normalizeKeyword(entry.llm_keyword.keyword));
const fallbackEntries: PatentKeywordEntry[] = [
...payload.extractedKeywords
.filter(isSelected)
.map((entry) => ({ entry, level: 'coarse' as const })),
...payload.manualKeywords
.filter(isSelected)
.map((entry) => ({ entry, level: 'custom' as const })),
];
return buildPatentSearchItems(fallbackEntries);
}
export function readPatentsCache(
keywords: string[],
): PatentsCacheResult | null {
const raw = sessionStorage.getItem(PATENTS_CACHE_KEY);
if (!raw) return null;
try {
const cache = JSON.parse(raw) as PatentsCache;
if (!sameKeywordSet(cache.keywords, keywords)) return null;
return {
matches: cache.matches ?? [],
mappingStatus: cache.mappingStatus ?? null,
};
} catch {
sessionStorage.removeItem(PATENTS_CACHE_KEY);
return null;
}
}
export function writePatentsCache(
keywords: string[],
matches: KeywordPatentMatch[],
mappingStatus: KeywordPatentMappingStatus | null = null,
): void {
try {
const cache: PatentsCache = { keywords, matches, mappingStatus };
sessionStorage.setItem(PATENTS_CACHE_KEY, JSON.stringify(cache));
} catch (error) {
console.error('Failed to cache patent results:', error);
}
}
export function clearPatentsCache(): void {
sessionStorage.removeItem(PATENTS_CACHE_KEY);
}
function normalizeKeyword(value: string): string {
return value.trim().toLowerCase();
}
function sameKeywordSet(a: string[], b: string[]): boolean {
if (a.length !== b.length) return false;
const setA = new Set(a.map((keyword) => normalizeKeyword(keyword)));
return b.every((keyword) => setA.has(normalizeKeyword(keyword)));
}
export interface PatentScoreWeights {
ipc: number;
topic: number;
text: number;
}
export const DEFAULT_PATENT_SCORE_WEIGHTS: PatentScoreWeights = {
ipc: 0.6,
topic: 0.25,
text: 0.15,
};
export function normalizePatentScoreWeights(
raw: Record<string, number>,
): PatentScoreWeights {
const ipc = raw['ipc'] ?? DEFAULT_PATENT_SCORE_WEIGHTS.ipc;
const topic = raw['topic'] ?? DEFAULT_PATENT_SCORE_WEIGHTS.topic;
const text = raw['text'] ?? DEFAULT_PATENT_SCORE_WEIGHTS.text;
const sum = ipc + topic + text;
if (sum <= 0) {
return { ...DEFAULT_PATENT_SCORE_WEIGHTS };
}
return { ipc: ipc / sum, topic: topic / sum, text: text / sum };
}
export function computePatentMatchScore(
match: Pick<KeywordPatentMatch, 'ipc_score' | 'topic_score' | 'text_score'>,
weights: PatentScoreWeights,
): number {
return (
Math.round(
(weights.ipc * match.ipc_score +
weights.topic * match.topic_score +
weights.text * match.text_score) *
10000,
) / 10000
);
}
export function applyPatentScoreWeights(
matches: KeywordPatentMatch[],
weights: PatentScoreWeights,
): KeywordPatentMatch[] {
return [...matches]
.map((match) => ({
...match,
match_score: computePatentMatchScore(match, weights),
}))
.sort((a, b) => {
const scoreDiff = b.match_score - a.match_score;
if (scoreDiff !== 0) {
return scoreDiff;
}
const dateA = a.patent.publication_date ?? '';
const dateB = b.patent.publication_date ?? '';
if (dateA !== dateB) {
return dateB.localeCompare(dateA);
}
return a.patent.patent_id.localeCompare(b.patent.patent_id);
});
}
function hasPatentComponentScores(match: KeywordPatentMatch): boolean {
return (
typeof match.ipc_score === 'number' &&
typeof match.topic_score === 'number' &&
typeof match.text_score === 'number'
);
}
export function canReweightPatentMatches(
matches: KeywordPatentMatch[],
): boolean {
return matches.length > 0 && matches.every(hasPatentComponentScores);
}
@@ -1,22 +1,12 @@
<div class="result-layout">
<mat-card class="results-card">
<mat-card-content class="results-placeholder">
<mat-icon>groups</mat-icon>
<h2>Patentenliste</h2>
<p>
Die aktuelle Gewichtung ist unter <code>normalized</code> verfügbar.
</p>
</mat-card-content>
</mat-card>
<mat-card class="weights-card">
<mat-card-content>
<app-weights-sliders
[options]="weightOptions"
[initialWeights]="defaultWeights"
title="Patenten-Gewichtung"
description="Werte zwischen 0 und 1. Summe wird normalisiert zu 1."
resetLabel="Ausgewogen"
description="Steuert die Gewichtung von IPC/CPC-Match, OpenAlex-Topic und Text-Match für den Gesamt-Score."
resetLabel="Standard"
applyLabel="Neu gewichten"
normalizedTitle="Normalisiert"
queryParamPrefix="patentW_"
@@ -28,4 +18,15 @@
(applyWeights)="onApplyWeights($event)" />
</mat-card-content>
</mat-card>
<div class="results-card">
<app-keywords-patents
[matches]="patentMatches()"
[mappingStatus]="mappingStatus()"
[loading]="loadingPatents()"
[error]="patentsError()"
[showReload]="state.hasValidSearch()"
[reloadDisabled]="loadingPatents() || !state.hasValidSearch()"
(reload)="reloadPatents()" />
</div>
</div>
@@ -3,22 +3,22 @@
============================================================ */
.result-layout {
display: grid;
grid-template-columns: minmax(300px, 420px) 1fr;
grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
grid-template-areas: 'summary results';
gap: 0.75rem;
align-items: start;
}
.search-summary-card {
.weights-card {
grid-area: summary;
}
.results-card {
grid-area: results;
min-width: 0;
}
.search-summary-card,
.results-card {
.weights-card {
background: var(--sg-surface, #ffffff);
border: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.12));
box-shadow: none;
@@ -27,3 +27,12 @@
padding: 0.75rem;
}
}
@media (max-width: 960px) {
.result-layout {
grid-template-columns: 1fr;
grid-template-areas:
'summary'
'results';
}
}
@@ -1,112 +1,174 @@
import { Component, inject, signal } from '@angular/core';
import { Component, inject, OnInit, signal } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
import { KeywordsService } from '../../../../api/api/keywords.service';
import { KeywordPatentMatch } from '../../../../api/model/keywordPatentMatch';
import { PatentsByKeywordsResponse } from '../../../../api/model/patentsByKeywordsResponse';
import {
WeightMap,
WeightSliderOption,
WeightsSlidersComponent,
WeightsSlidersValue,
} from '../../../../shared/ui/weights-sliders/weights-sliders.component';
import { KeywordsPatentsComponent } from '../../keywords-patents/keywords-patents.component';
import {
applyPatentScoreWeights,
buildPatentSearchItemsFromPayload,
canReweightPatentMatches,
clearPatentsCache,
DEFAULT_PATENT_SCORE_WEIGHTS,
normalizePatentScoreWeights,
readPatentsCache,
writePatentsCache,
} from '../../patent-search.utils';
import { SearchResultsStateService } from '../search-results-state.service';
import { KeywordPatentMappingStatus } from '../../../../api';
@Component({
selector: 'app-patents-results',
imports: [MatCardModule, MatIconModule, WeightsSlidersComponent],
imports: [
MatCardModule,
MatIconModule,
MatButtonModule,
WeightsSlidersComponent,
KeywordsPatentsComponent,
],
templateUrl: './patents-results.component.html',
styleUrl: './patents-results.component.scss',
})
export class KeywordsToPatentsResultsComponent {
// injects the state set by the parent route — no duplicate parsing here
private readonly state = inject(SearchResultsStateService);
export class KeywordsToPatentsResultsComponent implements OnInit {
protected readonly state = inject(SearchResultsStateService);
private readonly keywordsService = inject(KeywordsService);
readonly defaultWeights: WeightMap = {
param1: 0.33,
param2: 0.33,
param3: 0.34,
};
readonly defaultWeights: WeightMap = { ...DEFAULT_PATENT_SCORE_WEIGHTS };
readonly weightOptions: WeightSliderOption[] = [
{
key: 'param1',
label: 'Parameter 1',
icon: 'workspace_premium',
description: 'Gewichtet Parameter 1.',
defaultValue: 0.5,
queryParamName: 'wParam1',
key: 'ipc',
label: 'IPC/CPC-Match',
icon: 'category',
description:
'Gewichtet die Übereinstimmung der Patent-Klassifikation (IPC/CPC) mit den Keywords.',
defaultValue: DEFAULT_PATENT_SCORE_WEIGHTS.ipc,
queryParamName: 'wIpc',
},
{
key: 'param2',
label: 'Parameter 2',
icon: 'workspace_premium',
description: 'Gewichtet Parameter 2.',
defaultValue: 0.5,
queryParamName: 'wParam2',
key: 'topic',
label: 'OpenAlex-Topic',
icon: 'hub',
description:
'Gewichtet die thematische Übereinstimmung über OpenAlex-Topics und Fachgebiete.',
defaultValue: DEFAULT_PATENT_SCORE_WEIGHTS.topic,
queryParamName: 'wTopic',
},
{
key: 'param3',
label: 'Parameter 3',
icon: 'workspace_premium',
description: 'Gewichtet Parameter 3.',
defaultValue: 0.5,
queryParamName: 'wParam3',
key: 'text',
label: 'Text-Match',
icon: 'article',
description:
'Gewichtet Treffer der Keywords im Patenttitel und in der Zusammenfassung.',
defaultValue: DEFAULT_PATENT_SCORE_WEIGHTS.text,
queryParamName: 'wText',
},
];
readonly currentWeights = signal<WeightsSlidersValue>({
raw: this.defaultWeights,
normalized: {
param1: 0.33,
param2: 0.33,
param3: 0.34,
},
rawSum: 2.5,
normalized: { ...DEFAULT_PATENT_SCORE_WEIGHTS },
rawSum: 1,
normalizedSum: 1,
valid: true,
});
readonly projects = signal<unknown[]>([]); // placeholder until the results service lands
readonly patentMatches = signal<KeywordPatentMatch[]>([]);
readonly mappingStatus = signal<KeywordPatentMappingStatus | null>(null);
readonly loadingPatents = signal(false);
readonly patentsError = signal(false);
private hasLoadedInitial = false;
private readonly patentMatchesBase = signal<KeywordPatentMatch[]>([]);
ngOnInit(): void {
const cached = readPatentsCache(this.state.keywords());
if (cached) {
this.setPatentMatches(cached.matches, cached.mappingStatus);
return;
}
this.loadMatchingPatents();
}
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.loadprojects();
}
}
onApplyWeights(value: WeightsSlidersValue): void {
this.currentWeights.set(value);
this.loadprojects();
if (!canReweightPatentMatches(this.patentMatchesBase())) {
this.reloadPatents();
return;
}
this.updateDisplayedMatches();
}
private loadprojects(): void {
const weights = this.currentWeights();
reloadPatents(): void {
clearPatentsCache();
this.loadMatchingPatents();
}
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,
private loadMatchingPatents(): void {
const keywords = buildPatentSearchItemsFromPayload(this.state.payload());
if (keywords.length === 0) {
this.setPatentMatches([], 'no_mapping');
return;
}
this.loadingPatents.set(true);
this.patentsError.set(false);
this.keywordsService.getPatentsByKeywords({ keywords }).subscribe({
next: (response: PatentsByKeywordsResponse) => {
this.setPatentMatches(
response.patents ?? [],
response.mapping_status ?? null,
);
this.loadingPatents.set(false);
},
};
error: (error: unknown) => {
console.error('Patent search failed:', error);
this.setPatentMatches([], null);
this.patentsError.set(true);
this.loadingPatents.set(false);
},
});
}
console.log(requestPayload);
private setPatentMatches(
matches: KeywordPatentMatch[],
mappingStatus: KeywordPatentMappingStatus | null = null,
): void {
this.patentMatchesBase.set(matches);
this.mappingStatus.set(mappingStatus);
this.updateDisplayedMatches();
writePatentsCache(
this.state.keywords(),
this.patentMatchesBase(),
mappingStatus,
);
}
/**
* TODO:
* this.projectsService.searchprojects(requestPayload).subscribe({
* next: results => this.projects.set(results),
* error: error => console.error(error),
* });
*/
private updateDisplayedMatches(): void {
const base = this.patentMatchesBase();
if (!canReweightPatentMatches(base)) {
this.patentMatches.set(base);
return;
}
const weights = normalizePatentScoreWeights(
this.currentWeights().normalized,
);
this.patentMatches.set(applyPatentScoreWeights(base, weights));
}
}
@@ -1,31 +1,36 @@
<div class="result-layout">
<mat-card class="results-card">
<mat-card-content class="results-placeholder">
<mat-icon>groups</mat-icon>
<h2>Projectsliste</h2>
<p>
Die aktuelle Gewichtung ist unter <code>normalized</code> verfügbar.
</p>
</mat-card-content>
</mat-card>
<mat-card class="weights-card">
<div class="person-projects">
<div class="description-container">
<h5 style="font-weight: bold">Projekte</h5>
<p>Übersicht der durchgeführten Projekte.</p>
</div>
<mat-card appearance="outlined">
<mat-card-content>
<app-weights-sliders
[options]="weightOptions"
[initialWeights]="defaultWeights"
title="Projects-Gewichtung"
description="Werte zwischen 0 und 1. Summe wird normalisiert zu 1."
resetLabel="Ausgewogen"
applyLabel="Neu gewichten"
normalizedTitle="Normalisiert"
queryParamPrefix="projectW_"
[persistInQueryParams]="true"
[showApplyButton]="true"
[showResetButton]="true"
[showNormalizedPreview]="true"
(weightsChange)="onWeightsChange($event)"
(applyWeights)="onApplyWeights($event)" />
<mat-tab-group
[selectedIndex]="selectedTabIndex()"
(selectedIndexChange)="onTabChange($event)">
<mat-tab label="DFG">
<app-project-filters
[selectedInstitutionsPage]="selectedDfgInstitutionsPage()"
[selectedAuthorsPage]="selectedDfgAuthorsPage()"
[selectedTopicsPage]="selectedTopicsPage()"
[showFundingStartFilter]="true"
[showTopicFilter]="fuzzySearch()"
[showFundingEndFilter]="true"
[showAuthorFilter]="true"
[showInstitutionFilter]="true" />
<app-dfg-project-table
[page]="dfgProjectPage()"
[authorFilterEnabled]="true"
[topicFilterEnabled]="fuzzySearch()"
[institutionFilterEnabled]="true" />
</mat-tab>
<mat-tab label="EU">
<!-- <app-project-filters
[selectedInstitutionsPage]="selectedEuInstitutionsPage()"
[selectedAuthorsPage]="selectedEuAuthorsPage()" /> -->
<app-eu-project-table [page]="personCordisEuProjectPage()" />
</mat-tab>
</mat-tab-group>
</mat-card-content>
</mat-card>
</div>
@@ -1,29 +1,13 @@
/* ============================================================
RESULT LAYOUT
============================================================ */
.result-layout {
display: grid;
grid-template-columns: minmax(300px, 420px) 1fr;
grid-template-areas: 'summary results';
gap: 0.75rem;
align-items: start;
.person-projects {
padding: 2rem;
}
.search-summary-card {
grid-area: summary;
.description-container {
display: flex;
flex-direction: column;
}
.results-card {
grid-area: results;
}
.search-summary-card,
.results-card {
background: var(--sg-surface, #ffffff);
border: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.12));
box-shadow: none;
.mat-mdc-card-content {
padding: 0.75rem;
}
mat-card,
mat-paginator {
background-color: var(--sg-background);
}
@@ -1,111 +1,73 @@
import { Component, inject, signal } from '@angular/core';
import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
import { Component, computed, input, signal } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { toSignal } from '@angular/core/rxjs-interop';
import { DfgInstitutionSummaryPage } from '../../../../api/model/dfgInstitutionSummaryPage';
import {
WeightMap,
WeightSliderOption,
WeightsSlidersComponent,
WeightsSlidersValue,
} from '../../../../shared/ui/weights-sliders/weights-sliders.component';
CordisEuProjectPage,
DfgProjectPage,
AuthorPage,
InstitutionPageV2,
DfgPersonSummaryPage,
TopicPageV2,
} from '../../../../api';
import { MatCardModule } from '@angular/material/card';
import { MatTabsModule } from '@angular/material/tabs';
import { ProjectFilterComponent } from '../../../../shared/ui/project-filters/project-filters.component';
import { DfgProjectTableComponent } from '../../../../shared/ui/dfg-project-table/dfg-project-table.component';
import { EuProjectTableComponent } from '../../../../shared/ui/eu-project-table/eu-project-table.component';
import { projectQueryParamKeys } from '../../../../resolvers/dfg-projects.resolver';
import { euProjectQueryParamKeys } from '../../../../resolvers/person-cordis-eu-project-page.resolver';
const PROJECT_TAB_QUERY_PARAM_KEY = 'project_type';
import { SearchResultsStateService } from '../search-results-state.service';
@Component({
selector: 'app-projects-results',
imports: [MatCardModule, MatIconModule, WeightsSlidersComponent],
imports: [
MatCardModule,
MatTabsModule,
ProjectFilterComponent,
DfgProjectTableComponent,
EuProjectTableComponent,
],
templateUrl: './projects-results.component.html',
styleUrl: './projects-results.component.scss',
})
export class KeywordsToProjectsResultsComponent {
// injects the state set by the parent route — no duplicate parsing here
private readonly state = inject(SearchResultsStateService);
dfgProjectPage = input.required<DfgProjectPage>();
personCordisEuProjectPage = input.required<CordisEuProjectPage>();
readonly defaultWeights: WeightMap = {
param1: 0.33,
param2: 0.33,
param3: 0.34,
};
selectedDfgInstitutionsPage = input.required<DfgInstitutionSummaryPage>();
selectedDfgAuthorsPage = input.required<DfgPersonSummaryPage>();
selectedTopicsPage = input.required<TopicPageV2>();
readonly weightOptions: WeightSliderOption[] = [
{
key: 'param1',
label: 'Parameter 1',
icon: 'workspace_premium',
description: 'Gewichtet Parameter 1.',
defaultValue: 0.5,
queryParamName: 'wParam1',
},
{
key: 'param2',
label: 'Parameter 2',
icon: 'workspace_premium',
description: 'Gewichtet Parameter 2.',
defaultValue: 0.5,
queryParamName: 'wParam2',
},
{
key: 'param3',
label: 'Parameter 3',
icon: 'workspace_premium',
description: 'Gewichtet Parameter 3.',
defaultValue: 0.5,
queryParamName: 'wParam3',
},
];
selectedEuInstitutionsPage = input.required<InstitutionPageV2>();
selectedEuAuthorsPage = input.required<AuthorPage>();
readonly currentWeights = signal<WeightsSlidersValue>({
raw: this.defaultWeights,
normalized: {
param1: 0.33,
param2: 0.33,
param3: 0.34,
},
rawSum: 2.5,
normalizedSum: 1,
valid: true,
readonly dfgQueryParamKeys = projectQueryParamKeys;
readonly euQueryParamKeys = euProjectQueryParamKeys;
constructor(
private readonly router: Router,
private readonly activatedRoute: ActivatedRoute,
) {}
loading = signal<boolean>(false);
queryParamMap = toSignal(this.activatedRoute.queryParamMap, {
initialValue: this.activatedRoute.snapshot.queryParamMap,
});
readonly fuzzySearch = computed(
() => this.queryParamMap().get('fuzzy') === 'true',
);
selectedTabIndex = computed(() => {
const type = this.queryParamMap().get(PROJECT_TAB_QUERY_PARAM_KEY);
return type === 'eu' ? 1 : 0;
});
readonly projects = signal<unknown[]>([]); // placeholder until the results service lands
private hasLoadedInitial = false;
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.loadprojects();
}
}
onApplyWeights(value: WeightsSlidersValue): void {
this.currentWeights.set(value);
this.loadprojects();
}
private loadprojects(): 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,
},
};
console.log(requestPayload);
/**
* TODO:
* this.projectsService.searchprojects(requestPayload).subscribe({
* next: results => this.projects.set(results),
* error: error => console.error(error),
* });
*/
onTabChange(index: number): void {
const type = index === 1 ? 'eu' : 'dfg';
this.router.navigate([], {
queryParams: { [PROJECT_TAB_QUERY_PARAM_KEY]: type },
queryParamsHandling: 'merge',
});
}
}
@@ -1,10 +1,19 @@
import { Injectable, computed, signal } from '@angular/core';
import { KeywordEntryWithTopic } from '../../../api/model/keywordEntryWithTopic';
import { Topic } from '../../../api';
export type KeywordPatentLevel = 'broad' | 'coarse' | 'fine' | 'custom';
export interface PatentKeywordEntry {
entry: KeywordEntryWithTopic;
level: KeywordPatentLevel;
}
export interface SearchResultsPayload {
extractedKeywords: KeywordEntryWithTopic[];
manualKeywords: KeywordEntryWithTopic[];
keywords: string[];
patentKeywordEntries?: PatentKeywordEntry[];
options: {
fuzzy: boolean;
};
@@ -28,6 +37,32 @@ export class SearchResultsStateService {
});
readonly keywords = computed(() => this._payload()?.keywords ?? []);
readonly topics = computed(() => {
const entries = this.selectedKeywordEntries();
const seen = new Set<string>();
const topics: Topic[] = [];
for (const entry of entries) {
const topic = entry.topic_mapping?.topic;
if (topic?.id && !seen.has(topic.id)) {
seen.add(topic.id);
topics.push(topic);
}
}
return topics;
});
readonly topicIds = computed(() => {
const entries = this.selectedKeywordEntries();
const ids = new Set<string>();
for (const entry of entries) {
const topicId = entry.topic_mapping?.topic?.id;
if (topicId) {
ids.add(topicId);
}
}
return Array.from(ids);
});
readonly fuzzySearch = computed(
() => this._payload()?.options.fuzzy ?? false,
);
@@ -38,21 +73,26 @@ export class SearchResultsStateService {
() => this._payload()?.manualKeywords ?? [],
);
// Compute unified list of KeywordEntryWithTopic matching selected keywords
// Compute unified list of KeywordEntryWithTopic matching selected keywords.
// Manual keywords intentionally take precedence over extracted ones when
// both normalize to the same keyword.
readonly selectedKeywordEntries = computed(() => {
const payload = this._payload();
if (!payload) return [];
const allEntries = [
...(payload.extractedKeywords ?? []),
...(payload.manualKeywords ?? []),
];
const entryByKeyword = new Map<string, KeywordEntryWithTopic>();
for (const entry of allEntries) {
const kw = entry.llm_keyword?.keyword;
for (const entry of payload.extractedKeywords ?? []) {
const kw = entry.llm_keyword?.keyword?.trim().toLowerCase();
if (kw && !entryByKeyword.has(kw)) {
entryByKeyword.set(kw, entry);
}
}
for (const entry of payload.manualKeywords ?? []) {
const kw = entry.llm_keyword?.keyword?.trim().toLowerCase();
if (kw) {
entryByKeyword.set(kw.trim().toLowerCase(), entry);
entryByKeyword.set(kw, entry);
}
}
@@ -70,7 +110,7 @@ export class SearchResultsStateService {
return result;
});
// Keywords that did not resolve to a mapped topic entry
// Keywords that did not resolve to a mapped topic entry.
readonly missingKeywordLabels = computed(() => {
const payload = this._payload();
if (!payload) return [];
@@ -78,7 +118,7 @@ export class SearchResultsStateService {
const entryKeywordSet = new Set(
this.selectedKeywordEntries()
.map((entry) => entry.llm_keyword?.keyword?.trim().toLowerCase())
.filter(Boolean),
.filter((kw): kw is string => !!kw),
);
return payload.keywords.filter(
@@ -86,10 +126,13 @@ export class SearchResultsStateService {
);
});
// Compute parallel keywords and topic names for trend dashboard strategies
readonly keywordsList = computed(() => this.keywords());
readonly keywordsList = this.keywords;
// Parallel topic-name list for trend dashboard strategies. Entries
// without a resolvable keyword are skipped when building the lookup map
// so they can never collide on an `undefined` key and shadow a real one.
readonly topicsList = computed(() => {
return this.keywords().map((kw) => {
const list = this.keywords().map((kw) => {
const entry = this.selectedKeywordEntries().find(
(e) =>
e.llm_keyword?.keyword?.trim().toLowerCase() ===
@@ -97,6 +140,7 @@ export class SearchResultsStateService {
);
return entry?.topic_mapping?.topic?.display_name ?? kw;
});
return Array.from(new Set(list));
});
setPayload(payload: SearchResultsPayload): void {
@@ -23,7 +23,7 @@
<mat-slide-toggle
labelPosition="before"
(change)="onToggleFuzzySearch($event)"
[checked]="fuzzySearch()"
[checked]="state.fuzzySearch()"
matTooltip="Wenn aktiviert, werden die extrahierten Keywords auf bekannte Themenbereiche abgebildet, was die Suchergebnisse vermehrt">
Fuzzy Search
</mat-slide-toggle>
@@ -68,6 +68,7 @@
[queryParams]="{
keywords: state.payload()?.keywords?.join(','),
fuzzy: state.payload()?.options?.fuzzy,
topics: state.payload()?.options?.fuzzy ? state.topicIds() : null,
}">
<mat-icon>{{ route.icon }}</mat-icon>
{{ route.label }}
@@ -63,56 +63,19 @@ export class KeywordsSearchResultsComponent {
];
readonly selectedKeywordCount = computed(() => this.state.keywords().length);
readonly fuzzySearch = signal<boolean>(false);
readonly selectedKeywordEntries = computed(() => {
const payload = this.state.payload();
if (!payload) return [];
const allEntries = [
...(payload.extractedKeywords ?? []),
...(payload.manualKeywords ?? []),
];
const entryByKeyword = new Map<string, KeywordEntryWithTopic>();
for (const entry of allEntries) {
entryByKeyword.set(
this.normalizeKeyword(this.getKeywordLabel(entry)),
entry,
);
}
const result: KeywordEntryWithTopic[] = [];
readonly allKeywordEntries = computed(() => {
const seen = new Set<string>();
for (const keyword of payload.keywords) {
const normalized = this.normalizeKeyword(keyword);
const entry = entryByKeyword.get(normalized);
if (!entry || seen.has(normalized)) continue;
seen.add(normalized);
result.push(entry);
}
return result;
const all = [
...this.state.extractedKeywords(),
...this.state.manualKeywords(),
];
return all.filter((entry) => {
const kw = entry.llm_keyword?.keyword?.trim().toLowerCase();
if (!kw || seen.has(kw)) return false;
seen.add(kw);
return true;
});
});
readonly missingKeywordLabels = computed(() => {
const payload = this.state.payload();
if (!payload) return [];
const entryKeywordSet = new Set(
this.selectedKeywordEntries().map((entry) =>
this.normalizeKeyword(this.getKeywordLabel(entry)),
),
);
return payload.keywords.filter(
(keyword) => !entryKeywordSet.has(this.normalizeKeyword(keyword)),
);
});
constructor() {
// Query params are authoritative (URL survives reload, deep links,
// browser back/forward). sessionStorage is a best-effort cache for the
@@ -132,12 +95,12 @@ export class KeywordsSearchResultsComponent {
options: { fuzzy: fuzzySearch },
extractedKeywords: cacheMatches ? cached!.extractedKeywords : [],
manualKeywords: cacheMatches ? cached!.manualKeywords : [],
patentKeywordEntries: cacheMatches
? cached!.patentKeywordEntries
: undefined,
});
this.fuzzySearch.set(fuzzySearch);
});
}
goBackToSearch(): void {
void this.router.navigate(['/keywords'], {
queryParamsHandling: 'merge',
@@ -145,7 +108,7 @@ export class KeywordsSearchResultsComponent {
}
getChipLabel(keyword: KeywordEntryWithTopic): string {
if (!this.fuzzySearch()) {
if (!this.state.fuzzySearch()) {
return keyword.llm_keyword?.keyword ?? '';
}
return (
@@ -215,6 +178,7 @@ export class KeywordsSearchResultsComponent {
extractedKeywords: maybePayload.extractedKeywords ?? [],
manualKeywords: maybePayload.manualKeywords ?? [],
keywords: maybePayload.keywords ?? [],
patentKeywordEntries: maybePayload.patentKeywordEntries,
options: {
fuzzy: maybePayload.options?.fuzzy ?? false,
},
@@ -222,9 +186,9 @@ export class KeywordsSearchResultsComponent {
}
private sameKeywordSet(a: string[], b: string[]): boolean {
if (a.length !== b.length) return false;
const setA = new Set(a.map((k) => this.normalizeKeyword(k)));
return b.every((k) => setA.has(this.normalizeKeyword(k)));
const setA = new Set(a.map(this.normalizeKeyword.bind(this)));
const setB = new Set(b.map(this.normalizeKeyword.bind(this)));
return setA.size === setB.size && [...setA].every((k) => setB.has(k));
}
private parseKeywordList(raw: string | null): string[] {
@@ -247,12 +211,17 @@ export class KeywordsSearchResultsComponent {
return value.trim().toLowerCase();
}
onToggleFuzzySearch(event: any): void {
this.fuzzySearch.set(event.checked);
this.updateQueryParams(event.checked);
}
updateQueryParams(fuzzy: boolean): void {
const queryParams = {
fuzzy: fuzzy,
topics: fuzzy ? this.state.topicIds() : null,
};
this.router.navigate([], {
relativeTo: this.route,
queryParams: {
fuzzy: this.fuzzySearch(),
},
queryParams,
queryParamsHandling: 'merge',
replaceUrl: true,
});
@@ -1,31 +1,18 @@
<div class="result-layout">
<mat-card class="results-card">
<mat-card-content class="results-placeholder">
<mat-icon>groups</mat-icon>
<h2>Publikationsliste</h2>
<p>
Die aktuelle Gewichtung ist unter <code>normalized</code> verfügbar.
</p>
</mat-card-content>
</mat-card>
<div class="content">
<app-publication-filter
[selectedTopicsPage]="selectedTopicsPage()"
[selectedInstitutionsPage]="selectedInstitutionsPage()"
[selectedAuthorsPage]="selectedAuthorsPage()"
[showTopicFilter]="fuzzySearch()" />
<mat-card class="weights-card">
<mat-card-content>
<app-weights-sliders
[options]="weightOptions"
[initialWeights]="defaultWeights"
title="Publikations-Gewichtung"
description="Werte zwischen 0 und 1. Summe wird normalisiert zu 1."
resetLabel="Ausgewogen"
applyLabel="Neu gewichten"
normalizedTitle="Normalisiert"
queryParamPrefix="workW_"
[persistInQueryParams]="true"
[showApplyButton]="true"
[showResetButton]="true"
[showNormalizedPreview]="true"
(weightsChange)="onWeightsChange($event)"
(applyWeights)="onApplyWeights($event)" />
</mat-card-content>
</mat-card>
<app-publication-table
[page]="workPage()"
[authorFilterEnabled]="true"
[institutionFilterEnabled]="true"
[topicFilterEnabled]="fuzzySearch()" />
<app-query-param-paginator
[total]="total()"
queryParamPageKey="page"
queryParamSizeKey="size" />
</div>
@@ -1,29 +1,84 @@
/* ============================================================
RESULT LAYOUT
============================================================ */
.result-layout {
display: grid;
grid-template-columns: minmax(300px, 420px) 1fr;
grid-template-areas: 'summary results';
.page {
display: flex;
flex-direction: column;
gap: 1rem;
}
.publication-filter-stack {
width: 100%;
}
.publication-filters {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.75rem;
align-items: start;
mat-form-field {
min-width: 180px;
}
.institution-filter {
min-width: 260px;
flex: 1 1 260px;
}
}
.search-summary-card {
grid-area: summary;
.filter-prefix-icon {
margin-right: 0.25rem;
color: rgba(0, 0, 0, 0.54);
}
.results-card {
grid-area: results;
.select-search {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 0.75rem;
border-bottom: 1px solid rgba(0, 0, 0, 0.12);
&__icon {
color: rgba(0, 0, 0, 0.54);
}
&__input {
flex: 1;
border: none;
outline: none;
font: inherit;
background: transparent;
}
&__empty {
padding: 0.5rem 0.75rem;
color: rgba(0, 0, 0, 0.54);
font-size: 0.875rem;
}
}
.reset-filter-btn {
display: flex;
align-items: center;
gap: 0.25rem;
height: 40px;
}
.result-layout {
display: flex;
flex-direction: column;
gap: 1rem;
}
.search-summary-card,
.results-card {
background: var(--sg-surface, #ffffff);
border: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.12));
box-shadow: none;
.mat-mdc-card-content {
padding: 0.75rem;
}
width: 100%;
}
.results-placeholder {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
}
@@ -1,111 +1,82 @@
import { Component, inject, signal } from '@angular/core';
import { Component, OnInit, inject, computed, input } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { toSignal } from '@angular/core/rxjs-interop';
import { MatCardModule } from '@angular/material/card';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { workQueryParamKeys } from '../../../../resolvers/work-page.resolver';
import { PublicationFilterComponent } from '../../../../shared/ui/publication-filters/publication-filters.component';
import {
WeightMap,
WeightSliderOption,
WeightsSlidersComponent,
WeightsSlidersValue,
} from '../../../../shared/ui/weights-sliders/weights-sliders.component';
import { PublicationTableComponent } from '../../../../shared/ui/publication-table/publication-table.component';
import { WorkPageV2 } from '../../../../api/model/workPageV2';
import { PaginationService } from '../../../../shared/services/pagination.service';
import { QueryParamPaginatorComponent } from '../../../../shared/ui/query-param-paginator/query-param-paginator.component';
import { AuthorPage, InstitutionPageV2, TopicPageV2 } from '../../../../api';
import { SearchResultsStateService } from '../search-results-state.service';
@Component({
selector: 'app-works-results',
imports: [MatCardModule, MatIconModule, WeightsSlidersComponent],
imports: [
MatCardModule,
MatIconModule,
MatButtonModule,
PublicationTableComponent,
PublicationFilterComponent,
QueryParamPaginatorComponent,
],
templateUrl: './works-results.component.html',
styleUrl: './works-results.component.scss',
})
export class KeywordsToWorksResultsComponent {
// injects the state set by the parent route — no duplicate parsing here
export class KeywordsToWorksResultsComponent implements OnInit {
private readonly state = inject(SearchResultsStateService);
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
public readonly paginationService = inject(PaginationService);
readonly defaultWeights: WeightMap = {
param1: 0.33,
param2: 0.33,
param3: 0.34,
};
private readonly institutionParamKey = workQueryParamKeys.institutionId;
private readonly authorParamKey = workQueryParamKeys.authorId;
private readonly topicParamKey = workQueryParamKeys.topicId;
readonly weightOptions: WeightSliderOption[] = [
{
key: 'param1',
label: 'Parameter 1',
icon: 'workspace_premium',
description: 'Gewichtet Parameter 1.',
defaultValue: 0.5,
queryParamName: 'wParam1',
},
{
key: 'param2',
label: 'Parameter 2',
icon: 'workspace_premium',
description: 'Gewichtet Parameter 2.',
defaultValue: 0.5,
queryParamName: 'wParam2',
},
{
key: 'param3',
label: 'Parameter 3',
icon: 'workspace_premium',
description: 'Gewichtet Parameter 3.',
defaultValue: 0.5,
queryParamName: 'wParam3',
},
];
readonly currentWeights = signal<WeightsSlidersValue>({
raw: this.defaultWeights,
normalized: {
param1: 0.33,
param2: 0.33,
param3: 0.34,
},
rawSum: 2.5,
normalizedSum: 1,
valid: true,
queryParamMap = toSignal(this.route.queryParamMap, {
initialValue: this.route.snapshot.queryParamMap,
});
readonly works = signal<unknown[]>([]); // placeholder until the results service lands
selectedInstitutionIdsQueryParams = computed(() =>
this.queryParamMap().getAll(this.institutionParamKey),
);
selectedAuthorIdsQueryParams = computed(() =>
this.queryParamMap().getAll(this.authorParamKey),
);
private hasLoadedInitial = false;
selectedTopicIdsQueryParams = computed(() =>
this.queryParamMap().getAll(this.topicParamKey),
);
onWeightsChange(value: WeightsSlidersValue): void {
this.currentWeights.set(value);
workPage = input.required<WorkPageV2>();
// fires once with the query-param-aware initial state — use it to load
if (!this.hasLoadedInitial) {
this.hasLoadedInitial = true;
this.loadworks();
}
}
selectedInstitutionsPage = input.required<InstitutionPageV2>();
selectedTopicsPage = input.required<TopicPageV2>();
selectedAuthorsPage = input.required<AuthorPage>();
onApplyWeights(value: WeightsSlidersValue): void {
this.currentWeights.set(value);
this.loadworks();
}
total = computed(() => this.workPage().total ?? 0);
totalElements = computed(() => this.workPage().total ?? 0);
elements = computed(() => this.workPage().elements ?? []);
private loadworks(): void {
const weights = this.currentWeights();
fuzzySearch = computed(() => this.queryParamMap().get('fuzzy') === 'true');
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,
ngOnInit(): void {}
clearFilters(): void {
this.router.navigate([], {
queryParams: {
keywords: this.state.keywordsList().join(','),
topicId: this.state.topicIds(),
fuzzy: this.state.fuzzySearch(),
page: 0,
size: 10,
sort_by: 'publication_year',
sort_direction: 'desc',
},
};
console.log(requestPayload);
/**
* TODO:
* this.worksService.searchworks(requestPayload).subscribe({
* next: results => this.works.set(results),
* error: error => console.error(error),
* });
*/
});
}
}
@@ -11,7 +11,10 @@ import { PatentsService } from '../../api/api/patents.service';
import { PatentEntry } from '../../api/model/patentEntry';
import { OpenAlexTopicTag } from '../../api/model/openAlexTopicTag';
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
import {
classificationSectionColor,
topicHierarchyColor,
} from '../../resolvers/utils/topic-colors';
import {
ClassificationCard,
ClassificationSystem,
@@ -63,10 +66,8 @@ export class PatentDetailComponent implements OnInit {
this.route.snapshot.queryParamMap.get('title') ?? undefined;
const prefix =
this.route.snapshot.queryParamMap.get('prefix') ?? undefined;
const fillingDate =
this.route.snapshot.queryParamMap.get('fillingDate') ?? undefined;
this.loadPatent(patentId, title, prefix, fillingDate);
this.loadPatent(patentId, title, prefix);
});
}
@@ -107,7 +108,7 @@ export class PatentDetailComponent implements OnInit {
}
sectionColor(card: ClassificationCard): string {
return topicHierarchyColor({ field_name: card.sectionName });
return classificationSectionColor(card.sectionName ?? card.symbols[0]);
}
toggleClassificationExpanded(key: string): void {
@@ -130,19 +131,14 @@ export class PatentDetailComponent implements OnInit {
return getDescriptionPreview(text);
}
private loadPatent(
patentId: string,
title?: string,
prefix?: string,
fillingDate?: string,
): void {
private loadPatent(patentId: string, title?: string, prefix?: string): void {
this.loading = true;
this.notFound = false;
this.patent = null;
this.expandedClassificationKeys.clear();
this.patentsService
.getPatentByIdOrTitle(patentId, prefix, title, fillingDate)
.getPatentByIdOrTitle(patentId, prefix, title)
.pipe(finalize(() => (this.loading = false)))
.subscribe({
next: (patent: PatentEntry) => {
@@ -81,10 +81,11 @@
<mat-divider />
@if (loading) {
<div class="state-message">
<mat-progress-spinner diameter="36" mode="indeterminate" />
<span>Lade Patente...</span>
</div>
<app-loading
text="Patentdaten werden geladen..."
icon="workspace_premium"
[size]="150"
[diameter]="150" />
} @else if (error) {
<p class="state-message error">Fehler beim Laden der Patente.</p>
} @else if (showDetail && selectedPatent) {
@@ -7,7 +7,6 @@ import { MatCardModule } from '@angular/material/card';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatChipsModule } from '@angular/material/chips';
import { MatDividerModule } from '@angular/material/divider';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
@@ -17,7 +16,11 @@ import { PatentEntry } from '../../api/model/patentEntry';
import { IpcClassification } from '../../api';
import { OpenAlexTopicTag } from '../../api/model/openAlexTopicTag';
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
import {
classificationSectionColor,
topicHierarchyColor,
} from '../../resolvers/utils/topic-colors';
type SourceFilter = 'all' | 'EPO' | 'USPTO';
@@ -47,10 +50,10 @@ const MIN_YEAR = 1978;
MatFormFieldModule,
MatInputModule,
MatPaginatorModule,
MatProgressSpinnerModule,
MatChipsModule,
MatDividerModule,
TopicChipComponent,
LoadingComponent,
],
templateUrl: './patents.component.html',
styleUrl: './patents.component.scss',
@@ -404,7 +407,7 @@ export class PatentsComponent implements OnInit {
}
sectionColor(card: ClassificationCard): string {
return topicHierarchyColor({ field_name: card.sectionName });
return classificationSectionColor(card.sectionName ?? card.symbols[0]);
}
private getClassificationLevel(entry: IpcClassification): {
@@ -307,37 +307,17 @@
<!-- Linke Seite: Tabelle -->
<div class="funding-list">
<div class="funding-list-toolbar">
<div class="filter-bar">
<label class="sort-control">
<span>Filter nach Position:</span>
<button
type="button"
[class.active]="activeFilter === 'all'"
[attr.aria-pressed]="activeFilter === 'all'"
(click)="setFilter('all')">
Alle
</button>
<button
type="button"
[class.active]="activeFilter === 'first'"
[attr.aria-pressed]="activeFilter === 'first'"
(click)="setFilter('first')">
Erstautor
</button>
<button
type="button"
[class.active]="activeFilter === 'middle'"
[attr.aria-pressed]="activeFilter === 'middle'"
(click)="setFilter('middle')">
Mitautor
</button>
<button
type="button"
[class.active]="activeFilter === 'last'"
[attr.aria-pressed]="activeFilter === 'last'"
(click)="setFilter('last')">
Letztautor
</button>
</div>
<select
[value]="activeFilter"
(change)="setFilter($any($event.target).value)">
<option value="all">Alle</option>
<option value="first">Erstautor</option>
<option value="middle">Mitautor</option>
<option value="last">Letztautor</option>
</select>
</label>
<label class="sort-control">
<span>Sortieren nach:</span>
<select
@@ -10,74 +10,6 @@
gap: 16px;
}
.filter-bar {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: wrap;
span {
font-weight: 500;
color: #555;
}
button {
padding: 6px 14px;
border: 1px solid transparent;
border-radius: 20px;
background: #fff;
cursor: pointer;
font-size: 14px;
font-weight: 500;
&.active {
font-weight: 600;
border-width: 2px;
padding: 5px 13px;
}
}
button:nth-child(2) {
color: #3b82c4;
border-color: #c7dcfa;
&.active {
color: #0b4f9e;
background: #e8f2ff;
border-color: #3b82c4;
}
}
button:nth-child(3) {
color: #3d9a66;
border-color: #b8e6cb;
&.active {
color: #1a6b3f;
background: #e8f7ee;
border-color: #3d9a66;
}
}
button:nth-child(4) {
color: #7c65d9;
border-color: #d5c8f8;
&.active {
color: #5b3fc9;
background: #f0ebff;
border-color: #7c65d9;
}
}
button:nth-child(5) {
color: #d1435f;
border-color: #f8c4ce;
&.active {
color: #a61e3a;
background: #ffe8ec;
border-color: #d1435f;
}
}
}
.sort-control {
display: inline-flex;
align-items: center;
@@ -121,10 +53,6 @@
flex-wrap: wrap;
}
.sort-control {
margin-left: auto;
}
table {
width: 100%;
border-collapse: collapse;
@@ -1,5 +1,9 @@
@if (loading) {
<p class="message">Lade Patente...</p>
<app-loading
text="Patentdaten werden geladen..."
icon="workspace_premium"
[size]="150"
[diameter]="150" />
} @else if (error) {
<p class="message">Fehler beim Laden der Patente.</p>
} @else if (patents.length === 0) {
@@ -9,13 +9,14 @@ import {
formatPatentDate,
getPublicationStageLabel,
} from '../patent-detail/patent-detail.utils';
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
type SortMode = 'date' | 'title';
type SourceFilter = 'all' | 'EPO' | 'USPTO';
@Component({
selector: 'app-person-patents',
imports: [CommonModule],
imports: [CommonModule, LoadingComponent],
templateUrl: './person-patents.component.html',
styleUrl: './person-patents.component.scss',
})
@@ -5,78 +5,32 @@
</div>
<mat-card appearance="outlined">
<mat-card-content>
<app-query-param-input label="Suche nach Titel" queryParamKey="search" />
<mat-tab-group>
<mat-tab-group
[selectedIndex]="selectedTabIndex()"
(selectedIndexChange)="onTabChange($event)">
<mat-tab label="DFG">
<app-data-table
[columns]="dfgProjectColumns"
[data]="dfgProjectData"
[detailTemplate]="dfgProjectDetailRowTmp"
queryParamSortKey="sort_by"
queryParamSortDirectionKey="sort_direction" />
<app-project-filters
[selectedInstitutionsPage]="selectedDfgInstitutionsPage()"
[selectedAuthorsPage]="selectedDfgAuthorsPage()"
[selectedTopicsPage]="selectedTopicsPage()"
[showFundingStartFilter]="true"
[showTopicFilter]="true"
[showFundingEndFilter]="true"
[showAuthorFilter]="true"
[showInstitutionFilter]="true" />
<app-dfg-project-table
[page]="dfgProjectPage()"
[authorFilterEnabled]="true"
[topicFilterEnabled]="true"
[institutionFilterEnabled]="true" />
</mat-tab>
<mat-tab label="EU">
<app-data-table
[columns]="personCordisEuProjectColumns"
[data]="personCordisEuProjectData"
queryParamSortKey="sort_by"
queryParamSortDirectionKey="sort_direction" />
<!-- <app-project-filters
[selectedInstitutionsPage]="selectedEuInstitutionsPage()"
[selectedAuthorsPage]="selectedEuAuthorsPage()" /> -->
<app-eu-project-table [page]="personCordisEuProjectPage()" />
</mat-tab>
</mat-tab-group>
<app-query-param-paginator
[total]="this.pageTotal()"
[pageSizeOptions]="[10]" />
</mat-card-content>
</mat-card>
</div>
<ng-template #dfgProjectActionsTmp let-element>
<a
[routerLink]="['/projects/dfg', element.id]"
target="_blank"
mat-icon-button
color="primary">
<mat-icon>open_in_new</mat-icon>
</a>
</ng-template>
<ng-template #dfgProjectFundingEndTmp let-element>
{{ element.funding_end == '2999' ? 'laufend' : element.funding_end }}
</ng-template>
<ng-template #dfgProjectDetailRowTmp let-element>
<div class="detail-row">
<ul>
@for (
name of element.names.sort((a, b) => a.localeCompare(b));
track $index
) {
<li>
{{ name }}
</li>
}
</ul>
</div>
</ng-template>
<ng-template #euProjectsFundingStartTmp let-element>
{{ element.startDate | date: 'dd.MM.yyyy' }}
</ng-template>
<ng-template #euProjectsFundingEndTmp let-element>
{{ element.endDate | date: 'dd.MM.yyyy' }}
</ng-template>
<ng-template #euProjectsFundingAmountTmp let-element>
{{ element.ecMaxContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de' }}
</ng-template>
<ng-template #euProjectsActionsTmp let-element>
<a
[routerLink]="['/projects/eu', element.id]"
target="_blank"
mat-icon-button
color="primary">
<mat-icon>open_in_new</mat-icon>
</a>
</ng-template>
@@ -1,160 +1,69 @@
import { Component, computed, input } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { toSignal } from '@angular/core/rxjs-interop';
import { DfgInstitutionSummaryPage } from '../../api/model/dfgInstitutionSummaryPage';
import {
Component,
computed,
effect,
input,
OnInit,
TemplateRef,
viewChild,
} from '@angular/core';
import {
CordisEuProject,
CordisEuProjectPage,
DfgProjectPage,
DfgProjectSummary,
AuthorPage,
InstitutionPageV2,
TopicPageV2,
DfgPersonSummaryPage,
} from '../../api';
import {
DataTableComponent,
GenericColumn,
} from '../../shared/ui/data-table/data-table.component';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatTabsModule } from '@angular/material/tabs';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { Router, RouterModule } from '@angular/router';
import { CurrencyPipe, DatePipe } from '@angular/common';
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component';
import { ProjectFilterComponent } from '../../shared/ui/project-filters/project-filters.component';
import { DfgProjectTableComponent } from '../../shared/ui/dfg-project-table/dfg-project-table.component';
import { EuProjectTableComponent } from '../../shared/ui/eu-project-table/eu-project-table.component';
import { projectQueryParamKeys } from '../../resolvers/dfg-projects.resolver';
import { euProjectQueryParamKeys } from '../../resolvers/person-cordis-eu-project-page.resolver';
const PROJECT_TAB_QUERY_PARAM_KEY = 'project_type';
@Component({
selector: 'app-person-projects',
imports: [
DataTableComponent,
MatIconModule,
MatButtonModule,
MatCardModule,
MatTabsModule,
MatFormFieldModule,
MatInputModule,
RouterModule,
DatePipe,
CurrencyPipe,
QueryParamPaginatorComponent,
QueryParamInputComponent,
ProjectFilterComponent,
DfgProjectTableComponent,
EuProjectTableComponent,
],
templateUrl: './person-projects.component.html',
styleUrl: './person-projects.component.scss',
})
export class PersonProjectsComponent implements OnInit {
export class PersonProjectsComponent {
dfgProjectPage = input.required<DfgProjectPage>();
dfgProjectColumns: GenericColumn<DfgProjectSummary>[] = [];
dfgProjectData: DfgProjectSummary[] = [];
dfgProjectFundingEndTmp = viewChild.required<TemplateRef<any>>(
'dfgProjectFundingEndTmp',
);
dfgProjectActionsTmp = viewChild.required<TemplateRef<any>>(
'dfgProjectActionsTmp',
);
dfgProjectDetailRowTmp = viewChild.required<TemplateRef<any>>(
'dfgProjectDetailRowTmp',
);
personCordisEuProjectPage = input.required<CordisEuProjectPage>();
personCordisEuProjectColumns: GenericColumn<CordisEuProject>[] = [];
personCordisEuProjectData: CordisEuProject[] = [];
euProjectsFundingStartTmp = viewChild.required<TemplateRef<any>>(
'euProjectsFundingStartTmp',
);
euProjectsFundingEndTmp = viewChild.required<TemplateRef<any>>(
'euProjectsFundingEndTmp',
);
euProjectsFundingAmountTmp = viewChild.required<TemplateRef<any>>(
'euProjectsFundingAmountTmp',
);
euProjectsActionsTmp = viewChild.required<TemplateRef<any>>(
'euProjectsActionsTmp',
);
selectedDfgInstitutionsPage = input.required<DfgInstitutionSummaryPage>();
selectedDfgAuthorsPage = input.required<DfgPersonSummaryPage>();
selectedEuInstitutionsPage = input.required<InstitutionPageV2>();
selectedEuAuthorsPage = input.required<AuthorPage>();
selectedTopicsPage = input.required<TopicPageV2>();
readonly pageTotal = computed(() => {
return this.dfgProjectPage()?.total ?? 0;
readonly dfgQueryParamKeys = projectQueryParamKeys;
readonly euQueryParamKeys = euProjectQueryParamKeys;
constructor(
private readonly router: Router,
private readonly activatedRoute: ActivatedRoute,
) {}
queryParamMap = toSignal(this.activatedRoute.queryParamMap, {
initialValue: this.activatedRoute.snapshot.queryParamMap,
});
constructor(private readonly router: Router) {
effect(() => {
this.dfgProjectData = this.dfgProjectPage().elements || [];
selectedTabIndex = computed(() => {
const type = this.queryParamMap().get(PROJECT_TAB_QUERY_PARAM_KEY);
return type === 'eu' ? 1 : 0;
});
onTabChange(index: number): void {
const type = index === 1 ? 'eu' : 'dfg';
this.router.navigate([], {
queryParams: { [PROJECT_TAB_QUERY_PARAM_KEY]: type },
queryParamsHandling: 'merge',
});
effect(() => {
this.personCordisEuProjectData =
this.personCordisEuProjectPage().elements || [];
});
}
ngOnInit(): void {
this.dfgProjectColumns = [
{ id: 'title', header: 'Titel', type: 'accessor', accessorKey: 'title' },
{
id: 'funding_start',
header: 'Förderbeginn',
type: 'accessor',
accessorKey: 'funding_start',
},
{
id: 'funding_end',
header: 'Förderende',
type: 'accessor',
accessorKey: 'funding_end',
cellTemplate: this.dfgProjectFundingEndTmp(),
},
{
id: 'professional_classification',
header: 'Fachliche Zuordnung',
type: 'accessor',
accessorKey: 'professional_classification',
},
{
id: 'actions',
header: '',
type: 'display',
cellTemplate: this.dfgProjectActionsTmp(),
},
];
this.personCordisEuProjectColumns = [
{
id: 'title',
header: 'Titel',
type: 'accessor',
accessorKey: 'title',
},
{
id: 'startDate',
header: 'Startdatum',
type: 'display',
cellTemplate: this.euProjectsFundingStartTmp(),
},
{
id: 'endDate',
header: 'Enddatum',
type: 'display',
cellTemplate: this.euProjectsFundingEndTmp(),
},
{
id: 'ecMaxContribution',
header: 'Förderbetrag (EU)',
type: 'display',
cellTemplate: this.euProjectsFundingAmountTmp(),
},
{
id: 'actions',
header: '',
type: 'display',
cellTemplate: this.euProjectsActionsTmp(),
},
];
}
}
@@ -3,536 +3,45 @@
<h6>Publikationen</h6>
<p>Übersicht der wissenschaftlichen Veröffentlichungen.</p>
</div>
<mat-accordion [multi]="true" app>
<mat-expansion-panel class="mat-elevation-z1">
<mat-expansion-panel-header>
<mat-panel-title>Forschungszwecke</mat-panel-title>
</mat-expansion-panel-header>
@if (this.authorWorkPurposes().purposes?.length === 0) {
<div class="no-results">
Keine klassifizierten Publikationen gefunden.
</div>
} @else {
<div
echarts
[options]="chartOption"
style="height: 300px; width: 100%"></div>
}
<div
style="
width: 100%;
display: flex;
gap: 1rem;
flex-wrap: wrap;
margin-top: 1rem;
">
<app-info-card
[value]="this.basicResearchAmount() + ''"
description="Grundlagenforschung" />
<app-info-card
[value]="this.appliedResearchAmount() + ''"
description="Anwendungsbasierte Forschung" />
<app-info-card
[value]="this.nonResearchAmount() + ''"
description="Nicht-forschende Tätigkeit" />
<app-info-card
[value]="this.experimentalDevelopmentAmount() + ''"
description="Experimentelle Entwicklung" />
</div>
</mat-expansion-panel>
<mat-expansion-panel class="mat-elevation-z1" [expanded]="true">
<mat-expansion-panel-header>
<mat-panel-title>Publikationsliste</mat-panel-title>
<mat-panel-description
>{{ totalElements() }} Publikationen</mat-panel-description
>
</mat-expansion-panel-header>
<div class="publication-filter-stack">
<form class="publication-filters">
<mat-form-field>
<mat-icon matPrefix class="filter-prefix-icon"
>calendar_today</mat-icon
>
<mat-select
placeholder="Jahr"
multiple
[panelWidth]="null"
(selectionChange)="handleYearSelectionChange($event)"
(opened)="focusSelectSearch(yearSearchInput)"
[value]="this.selectedYearsQueryParams()">
<mat-select-trigger>{{
yearSelectionSummary()
}}</mat-select-trigger>
<div class="select-search" (click)="$event.stopPropagation()">
<mat-icon class="select-search__icon">search</mat-icon>
<input
#yearSearchInput
type="text"
class="select-search__input"
placeholder="Jahr suchen…"
(keydown)="$event.stopPropagation()" />
</div>
@for (year of filteredYearOptions(); track year) {
<mat-option [value]="year">{{ year }}</mat-option>
} @empty {
<div class="select-search__empty">Keine Treffer</div>
}
</mat-select>
</mat-form-field>
@if (canViewClassificationChart()) {
<mat-accordion multi>
<mat-expansion-panel class="mat-elevation-z1">
<mat-expansion-panel-header>
<mat-panel-title>Forschungszwecke</mat-panel-title>
</mat-expansion-panel-header>
<app-primary-category-year-aggregation-chart
[page]="primaryCategoryYearAggregationPage()" />
</mat-expansion-panel>
<mat-form-field>
<mat-icon matPrefix class="filter-prefix-icon">category</mat-icon>
<mat-select
placeholder="Typ"
multiple
[panelWidth]="null"
(selectionChange)="handleTypeSelectionChange($event)"
(opened)="focusSelectSearch(typeSearchInput)"
[value]="this.selectedTypesQueryParams()">
<mat-select-trigger>{{
typeSelectionSummary()
}}</mat-select-trigger>
<div class="select-search" (click)="$event.stopPropagation()">
<mat-icon class="select-search__icon">search</mat-icon>
<input
#typeSearchInput
type="text"
class="select-search__input"
[formControl]="typeSearchControl"
placeholder="Typ suchen…"
(keydown)="$event.stopPropagation()" />
</div>
@for (type of filteredTypeOptions(); track type.value) {
<mat-option [value]="type.value">{{ type.label }}</mat-option>
} @empty {
<div class="select-search__empty">Keine Treffer</div>
}
</mat-select>
</mat-form-field>
<mat-form-field>
<mat-icon matPrefix class="filter-prefix-icon">translate</mat-icon>
<mat-select
placeholder="Sprache"
multiple
[panelWidth]="null"
(selectionChange)="handleLanguageSelectionChange($event)"
(opened)="focusSelectSearch(languageSearchInput)"
[value]="this.selectedLanguagesQueryParams()">
<mat-select-trigger>{{
languageSelectionSummary()
}}</mat-select-trigger>
<div class="select-search" (click)="$event.stopPropagation()">
<mat-icon class="select-search__icon">search</mat-icon>
<input
#languageSearchInput
type="text"
class="select-search__input"
[formControl]="languageSearchControl"
placeholder="Sprache suchen…"
(keydown)="$event.stopPropagation()" />
</div>
@for (
language of filteredLanguageOptions();
track language.value
) {
<mat-option [value]="language.value">{{
language.label
}}</mat-option>
} @empty {
<div class="select-search__empty">Keine Treffer</div>
}
</mat-select>
</mat-form-field>
<mat-form-field class="institution-filter">
<mat-icon matPrefix class="filter-prefix-icon">apartment</mat-icon>
<input
type="text"
matInput
[formControl]="institutionSearchControl"
[matAutocomplete]="institutionAutocomplete"
placeholder="Institution suchen" />
<mat-autocomplete
#institutionAutocomplete="matAutocomplete"
[displayWith]="displayInstitution"
(optionSelected)="selectInstitution($event)">
@for (institution of institutionOptions; track institution.id) {
<mat-option [value]="institution">
<span>{{ institution.display_name }}</span>
@if (institution.hint) {
<small>{{ institution.hint }}</small>
}
</mat-option>
}
@if (
!institutionLookupLoading &&
institutionOptions.length === 0 &&
institutionSearchControl.value
) {
<mat-option disabled>Keine Institution gefunden</mat-option>
}
</mat-autocomplete>
</mat-form-field>
<mat-form-field class="topic-filter">
<mat-icon matPrefix class="filter-prefix-icon">label</mat-icon>
<input
type="text"
matInput
[formControl]="topicSearchControl"
[matAutocomplete]="topicAutocomplete"
placeholder="Thema suchen" />
<mat-autocomplete
#topicAutocomplete="matAutocomplete"
[displayWith]="displayTopic"
(optionSelected)="selectTopic($event)">
@for (topic of topicOptions; track topic.id) {
<mat-option [value]="topic">
<span>{{ topic.display_name }}</span>
@if (topic.hint) {
<small>{{ topic.hint }}</small>
}
</mat-option>
}
@if (
!topicLookupLoading &&
topicOptions.length === 0 &&
topicSearchControl.value
) {
<mat-option disabled>Kein Thema gefunden</mat-option>
}
</mat-autocomplete>
</mat-form-field>
<button
class="reset-filter-btn"
mat-stroked-button
type="button"
(click)="clearFilters()"
aria-label="Filter zurücksetzen">
<mat-icon>filter_alt_off</mat-icon>
<span>Zurücksetzen</span>
</button>
</form>
@if (
selectedInstitutionIdsQueryParams().length ||
selectedTopicIdsQueryParams().length ||
selectedYearsQueryParams().length ||
selectedTypesQueryParams().length ||
selectedLanguagesQueryParams().length
) {
<div class="active-filters-row" aria-label="Aktive Filter">
<span class="active-filters-label">Aktive Filter:</span>
<div class="chips-container">
@for (year of selectedYearsQueryParams(); track year) {
<span class="active-meta-filter">
<span class="filter-meta-chip">
<mat-icon class="filter-meta-chip__icon"
>calendar_today</mat-icon
>
<span class="filter-meta-chip__label">{{ year }}</span>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="toggleYearFilter(year)"
[attr.aria-label]="'Jahresfilter ' + year + ' entfernen'">
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (type of selectedTypesQueryParams(); track type) {
<span class="active-meta-filter">
<span class="filter-meta-chip">
<mat-icon class="filter-meta-chip__icon">category</mat-icon>
<span class="filter-meta-chip__label">{{ type }}</span>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="toggleTypeFilter(type)"
[attr.aria-label]="'Typfilter ' + type + ' entfernen'">
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (
language of selectedLanguagesQueryParams();
track language
) {
<span class="active-meta-filter">
<span class="filter-meta-chip">
<mat-icon class="filter-meta-chip__icon"
>translate</mat-icon
>
<span class="filter-meta-chip__label">{{
language | languageCode
}}</span>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="toggleLanguageFilter(language)"
[attr.aria-label]="
'Sprachfilter ' + (language | languageCode) + ' entfernen'
">
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (topic of selectedTopics(); track topic.id) {
<span class="active-meta-filter">
<span
class="filter-topic-chip"
[style.--topic-color]="getWorkTopicColor(topic)"
[matTooltip]="getSelectedWorkTopicTooltip(topic)"
matTooltipClass="topic-chip-tooltip"
[matTooltipDisabled]="!getSelectedWorkTopicTooltip(topic)">
<mat-icon class="filter-topic-chip__icon">label</mat-icon>
<span class="filter-topic-chip__label">{{
topic.display_name
}}</span>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="removeTopic(topic)"
[attr.aria-label]="
'Themenfilter ' + topic.display_name + ' entfernen'
">
<mat-icon>close</mat-icon>
</button>
</span>
}
@for (
institution of selectedInstitutions();
track institution.id
) {
@let instCountry = selectedInstitutionCountry(institution);
<span class="active-institution-filter">
<span class="filter-institution-chip">
<mat-icon class="institution-icon">apartment</mat-icon>
<span class="institution-name">{{
institution.display_name
}}</span>
@if (instCountry) {
<img
alt=""
class="flag-img"
[src]="
'https://flagcdn.io/' +
instCountry.toLowerCase() +
'.svg'
"
height="10" />
<span class="country-code">{{
instCountry.toUpperCase()
}}</span>
}
<mat-icon
class="institution-open-icon"
[routerLink]="[
'/institution',
extractRawId(institution.id),
]"
aria-label="Institutionsseite öffnen"
>open_in_new</mat-icon
>
</span>
<button
type="button"
class="remove-chip-btn"
(click)="removeInstitution(institution)"
aria-label="Institutionsfilter entfernen">
<mat-icon>close</mat-icon>
</button>
</span>
}
</div>
</div>
}
</div>
<app-data-table
[columns]="workColumns"
[data]="elements()"
queryParamSortKey="sort_by"
queryParamSortDirectionKey="sort_direction" />
<app-query-param-paginator
[total]="totalElements()"
queryParamPageKey="page"
queryParamSizeKey="size"
[pageSizeOptions]="paginationService.options" />
</mat-expansion-panel>
</mat-accordion>
<mat-expansion-panel class="mat-elevation-z1" [expanded]="true">
<mat-expansion-panel-header>
<mat-panel-title>Publikationsliste</mat-panel-title>
<mat-panel-description
>{{ total() >= 10000 ? 'mehr als' : '' }}
{{ total() }} Publikationen</mat-panel-description
>
</mat-expansion-panel-header>
<ng-container *ngTemplateOutlet="filterTableAndPaginator" />
</mat-expansion-panel>
</mat-accordion>
} @else {
<ng-container *ngTemplateOutlet="filterTableAndPaginator" />
}
</div>
<ng-template #titleTmp let-work>
<span>{{ work.title }}</span>
</ng-template>
<ng-template #filterTableAndPaginator>
<app-publication-filter
[selectedTopicsPage]="selectedTopicsPage()"
[selectedInstitutionsPage]="selectedInstitutionsPage()"
[showAuthorFilter]="false" />
<ng-template #typeTmp let-work>
@if (work.type) {
<button
type="button"
class="type-filter-btn"
[class.active]="isTypeActive(work.type)"
matTooltip="Nach Typ filtern"
matTooltipPosition="above"
(click)="toggleTypeFilter(work.type)">
<app-chip [color]="typeColor(work.type)">
{{ work.type | workType }}
</app-chip>
</button>
} @else {
<span class="empty-text">-</span>
}
</ng-template>
<app-publication-table
[page]="authorWorkPage()"
[institutionFilterEnabled]="true" />
<ng-template #yearTmp let-work>
@if (work.publication_year) {
<button
type="button"
class="cell-filter-pill"
[class.active]="isYearActive(work.publication_year)"
matTooltip="Nach Jahr filtern"
matTooltipPosition="above"
(click)="toggleYearFilter(work.publication_year)">
{{ work.publication_year }}
</button>
} @else {
<span class="empty-text">-</span>
}
</ng-template>
<ng-template #languageTmp let-work>
@if (work.language) {
<button
type="button"
class="cell-filter-pill"
[class.active]="isLanguageActive(work.language_code)"
matTooltip="Nach Sprache filtern"
matTooltipPosition="above"
(click)="toggleLanguageFilter(work.language_code)">
{{ work.language_code | languageCode }}
</button>
} @else {
<span class="empty-text">-</span>
}
</ng-template>
<ng-template #institutionsTmp let-work>
@let publicationInstitutions = work.institutions ?? [];
@let institutionsExpanded = true;
@let visibleInstitutions =
institutionsExpanded
? publicationInstitutions
: publicationInstitutions.slice(0, 3);
<div
class="institution-tags"
aria-label="Institutionen"
style="padding: 0.5rem 0">
@for (
institution of visibleInstitutions;
track institution.institution_id
) {
<button
type="button"
class="publication-institution-tag"
[class.active]="isInstitutionActive(institution.institution_id!)"
[matTooltip]="institution.institution_name"
matTooltipPosition="above"
[attr.aria-label]="
'Nach Institution ' + institution.institution_name + ' filtern'
"
(click)="
filterByInstitution({
id: institution.institution_id!,
name: institution.institution_name || '',
})
">
<mat-icon class="institution-icon">apartment</mat-icon>
<span class="institution-name">{{ institution.institution_name }}</span>
@if (institution.institution_country_code) {
<img
alt=""
class="flag-img"
[src]="
'https://flagcdn.io/' +
institution.institution_country_code.toLowerCase() +
'.svg'
"
height="10" />
<span class="country-code">{{
institution.institution_country_code.toUpperCase()
}}</span>
}
</button>
} @empty {
<span class="empty-text">-</span>
}
@if (publicationInstitutions.length > 3) {
<button
type="button"
class="publication-institution-more"
[attr.aria-expanded]="institutionsExpanded"
(click)="toggleInstitutions(work)">
{{
institutionsExpanded
? 'weniger'
: '+' + (publicationInstitutions.length - 3)
}}
</button>
}
</div>
</ng-template>
<ng-template #topicsTmp let-work>
@let publicationTopics = work.topics ?? [];
@let topicsExpanded = isTopicsExpanded(work);
@let visibleTopics =
topicsExpanded ? publicationTopics : publicationTopics.slice(0, 3);
<div class="topic-chips" aria-label="Themen" style="padding: 0.5rem 0">
@for (topic of visibleTopics; track topic.id) {
<app-topic-chip
size="mini"
[label]="topic.display_name || ''"
[description]="topic.description"
[subfieldName]="topic.subfield?.display_name"
[fieldName]="topic.field?.display_name"
[domainName]="topic.domain?.display_name"
[color]="getWorkTopicColor(topic)"
[disabled]="!topic.id"
[active]="isTopicActive(topic)"
(chipClick)="filterByTopic(topic)">
</app-topic-chip>
} @empty {
<span class="empty-text">-</span>
}
@if (publicationTopics.length > 3) {
<button
type="button"
class="publication-topic-more"
[attr.aria-expanded]="topicsExpanded"
(click)="toggleTopics(work)">
{{ topicsExpanded ? 'weniger' : '+' + (publicationTopics.length - 3) }}
</button>
}
</div>
</ng-template>
<ng-template #citationsTmp let-work>
{{ work.cited_by_count ?? 0 }}
</ng-template>
<ng-template #actionsTmp let-work>
<a
mat-icon-button
color="primary"
[routerLink]="['/publication', extractRawId(work.id)]"
matTooltip="Details anzeigen">
<mat-icon>open_in_new</mat-icon>
</a>
<app-query-param-paginator
[total]="total()"
queryParamPageKey="page"
queryParamSizeKey="size"
[pageSizeOptions]="[10, 25, 50]" />
</ng-template>
@@ -1,565 +1,5 @@
.page {
padding: 28px 32px 42px;
max-width: 100%;
margin: 0 auto;
}
.publication-filter-stack {
display: flex;
align-items: flex-start;
flex-direction: column;
gap: 8px;
padding-top: 10px;
padding-bottom: 25px;
}
.publication-filters {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
align-items: center;
gap: 10px;
}
.publication-filters mat-form-field {
width: 175px;
}
.publication-filters .institution-filter,
.publication-filters .topic-filter {
flex: 1 1 200px;
width: auto;
min-width: 180px;
max-width: 320px;
}
.publication-filters .sort-field {
width: 235px;
}
.publication-filters .reset-filter-btn {
min-width: 132px;
height: 42px;
padding: 0 14px;
border-color: #d9e2f0;
border-radius: var(--sg-radius-sm);
color: var(--sg-text);
background: #fff;
}
.publication-filters .reset-filter-btn mat-icon {
margin-right: 6px;
width: 20px;
height: 20px;
font-size: 20px;
}
::ng-deep .publication-filters .mat-mdc-form-field-subscript-wrapper {
display: none;
}
::ng-deep .publication-filters .mat-mdc-text-field-wrapper {
height: 42px;
background: var(--sg-surface-soft);
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
transition:
border-color 0.15s,
box-shadow 0.15s;
}
::ng-deep .publication-filters .mat-focused .mat-mdc-text-field-wrapper {
border-color: var(--sg-primary);
box-shadow: 0 0 0 2px var(--sg-primary-soft);
}
::ng-deep .publication-filters .mat-mdc-form-field-flex {
height: 100%;
align-items: center;
}
::ng-deep .publication-filters .mat-mdc-form-field-infix {
min-height: 0;
padding-top: 0;
padding-bottom: 0;
}
::ng-deep .publication-filters .mdc-notched-outline__leading,
::ng-deep .publication-filters .mdc-notched-outline__notch,
::ng-deep .publication-filters .mdc-notched-outline__trailing {
border: none;
}
.filter-prefix-icon {
width: 18px;
height: 18px;
font-size: 18px;
color: var(--sg-text-soft);
}
::ng-deep .publication-filters .mat-mdc-form-field-icon-prefix {
padding: 0 4px 0 10px;
color: var(--sg-text-soft);
}
::ng-deep .publication-filters .mat-mdc-select-value,
::ng-deep .publication-filters input.mat-mdc-input-element {
color: var(--sg-text);
font-size: 14px;
}
::ng-deep .publication-filters .mat-mdc-select-placeholder,
::ng-deep .publication-filters input.mat-mdc-input-element::placeholder {
color: var(--sg-text-muted);
opacity: 1;
font-size: 14px;
}
::ng-deep .publication-filters .mat-mdc-form-field-icon-suffix,
::ng-deep .publication-filters .mat-mdc-select-arrow-wrapper {
transform: none;
}
.active-filters-row {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 10px;
padding: 8px 16px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
background: var(--sg-surface);
font-size: 13px;
}
.active-filters-label {
font-weight: 600;
color: var(--sg-text-muted);
}
.chips-container {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 6px;
}
.filter-meta-chip {
display: inline-flex;
align-items: center;
padding: 2px 8px;
border: 1px solid var(--sg-border-strong);
border-radius: 4px;
background: var(--sg-surface-soft);
color: var(--sg-text);
font-size: 11px;
font-weight: 600;
}
.filter-topic-chip {
display: inline-flex;
align-items: center;
gap: 4px;
max-width: min(320px, 46vw);
padding: 3px 8px;
border-radius: 7px;
background: color-mix(in srgb, var(--topic-color) 22%, #ffffff);
color: color-mix(in srgb, var(--topic-color) 45%, #07163d);
font-size: 11px;
font-weight: 700;
box-shadow: inset 0 0 0 1px
color-mix(in srgb, var(--topic-color) 45%, transparent);
}
.filter-topic-chip__icon {
flex: 0 0 auto;
width: 14px;
height: 14px;
font-size: 14px;
}
.active-institution-filter,
.active-meta-filter {
display: inline-flex;
align-items: center;
gap: 4px;
max-width: 100%;
}
.filter-institution-chip,
.publication-institution-tag {
display: inline-flex;
align-items: center;
padding: 2px 6px;
border: 1px solid var(--sg-primary-border, var(--sg-border));
border-radius: 4px;
background: var(--sg-primary-soft);
color: var(--sg-primary);
font-size: 10px;
font-weight: 600;
line-height: normal;
}
.filter-institution-chip {
max-width: 340px;
}
.publication-institution-tag {
max-width: 100%;
margin: 0;
font-family: inherit;
cursor: pointer;
transition: all 0.2s ease;
&:hover,
&:focus-visible {
background: var(--sg-primary);
color: #fff;
border-color: var(--sg-primary);
outline: none;
box-shadow:
0 0 0 2px var(--sg-background),
0 0 0 4px var(--sg-primary);
}
&.active {
border-color: var(--sg-primary);
box-shadow:
0 0 0 1px #ffffff,
0 0 0 3px var(--sg-primary);
}
&.active:hover,
&.active:focus-visible {
background: var(--sg-primary);
color: #fff;
}
}
.filter-institution-chip .institution-icon,
.publication-institution-tag .institution-icon,
.filter-meta-chip__icon {
flex-shrink: 0;
width: 12px;
height: 12px;
margin-right: 4px;
font-size: 12px;
}
.filter-meta-chip__icon {
color: var(--sg-text-soft);
}
.filter-institution-chip .institution-name,
.publication-institution-tag .institution-name {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
min-width: 0;
white-space: normal;
overflow-wrap: anywhere;
}
.filter-institution-chip .flag-img,
.publication-institution-tag .flag-img {
flex-shrink: 0;
margin-left: 6px;
border: 1px solid;
}
.filter-institution-chip .country-code,
.publication-institution-tag .country-code {
flex-shrink: 0;
margin-left: 2px;
font-size: 9px;
}
.filter-institution-chip .institution-open-icon,
.publication-institution-tag .institution-open-icon {
flex-shrink: 0;
width: 12px;
height: 12px;
margin-left: 5px;
font-size: 12px;
line-height: 1;
cursor: pointer;
opacity: 0;
transition: opacity 0.15s ease;
}
.filter-institution-chip:hover .institution-open-icon,
.publication-institution-tag:hover .institution-open-icon {
opacity: 0.7;
}
.filter-institution-chip .institution-open-icon:hover,
.publication-institution-tag .institution-open-icon:hover {
opacity: 1;
}
.filter-meta-chip__label,
.filter-topic-chip__label {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
}
.active-institution-filter button,
.active-meta-filter button {
display: flex;
padding: 0;
border: 0;
background: transparent;
color: var(--sg-text-soft);
cursor: pointer;
&:hover {
color: var(--sg-text);
}
}
.active-institution-filter button mat-icon,
.active-meta-filter button mat-icon {
width: 12px;
height: 12px;
font-size: 12px;
}
.table-wrap {
position: relative;
overflow-x: auto;
}
table {
width: 100%;
min-width: 1120px;
border-collapse: separate;
border-spacing: 0 10px;
box-shadow: none;
background: transparent;
}
.title {
display: inline-block;
max-width: 520px;
line-height: 1.35;
color: var(--sg-text);
font-size: 14px;
font-weight: 700;
text-decoration: none;
}
a.title:hover {
color: var(--sg-text);
text-decoration: underline;
}
table.is-hidden {
display: none;
}
.table-status {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
min-height: 240px;
padding: 32px;
color: var(--sg-text-muted);
font-size: 14px;
text-align: center;
}
.empty-text {
color: rgba(0, 0, 0, 0.54);
}
.cell-filter-pill {
display: inline-flex;
align-items: center;
margin: 0;
padding: 3px 10px;
border: 1px solid var(--sg-border);
border-radius: 999px;
background: #fff;
color: var(--sg-text);
font-family: inherit;
font-size: 12px;
line-height: 1.2;
cursor: pointer;
transition: all 0.2s ease;
&:hover,
&:focus-visible {
border-color: var(--sg-primary);
background: var(--sg-surface-soft);
outline: none;
}
&.active {
border-color: var(--sg-primary);
color: var(--sg-primary);
font-weight: 600;
box-shadow:
0 0 0 1px #ffffff,
0 0 0 3px var(--sg-primary);
}
}
.type-filter-btn {
display: inline-flex;
margin: 0;
padding: 0;
border: 0;
border-radius: 7px;
background: transparent;
cursor: pointer;
transition: box-shadow 0.2s ease;
&:hover,
&:focus-visible {
outline: none;
box-shadow: 0 0 0 1px var(--sg-primary);
}
&.active {
box-shadow:
0 0 0 1px #ffffff,
0 0 0 3px var(--sg-primary);
}
}
.topic-chips,
.institution-tags {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.topic-chips {
max-width: 320px;
}
.institution-tags {
align-items: flex-start;
max-width: 280px;
}
.publication-institution-more,
.publication-topic-more {
display: inline-flex;
align-items: center;
min-height: 24px;
padding: 3px 8px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
background: #fff;
color: var(--sg-text-muted);
font-family: inherit;
font-size: 11px;
line-height: 1.2;
cursor: pointer;
transition: all 0.2s ease;
&:hover,
&:focus-visible {
border-color: var(--sg-primary);
color: var(--sg-primary);
background: var(--sg-surface-soft);
outline: none;
}
}
.publication-topic-more {
max-width: 180px;
}
::ng-deep .mat-mdc-header-cell {
color: var(--sg-text-muted);
font-size: 12px;
font-weight: 700;
}
::ng-deep .mat-mdc-row {
height: 86px;
}
::ng-deep .mat-mdc-cell {
color: var(--sg-text);
border-bottom-color: var(--sg-border);
font-size: 13px;
}
.table-wrap ::ng-deep {
.mat-column-type,
.mat-column-year,
.mat-column-language,
.mat-column-citations,
.mat-mdc-header-cell {
text-align: center;
}
.mat-mdc-cell:not(:last-child),
.mat-mdc-header-cell:not(:last-child) {
border-right: 1px solid var(--sg-border);
}
.mat-column-institutions,
.mat-column-topics {
overflow: visible;
}
}
mat-paginator {
background: transparent;
}
.table-footer {
display: flex;
align-items: center;
justify-content: space-between;
min-height: 66px;
padding: 0 22px 0 28px;
border: 0;
color: var(--sg-text-muted);
font-size: 13px;
}
@media (max-width: 600px) {
.page {
padding: 16px;
}
.table-footer {
align-items: stretch;
flex-direction: column;
}
.publication-filter-stack {
align-items: stretch;
}
.publication-filters {
justify-content: stretch;
max-width: none;
}
.publication-filters mat-form-field,
.publication-filters button {
width: 100%;
}
.publication-filters .institution-filter,
.publication-filters .topic-filter {
width: 100%;
}
.active-filters-row {
align-self: stretch;
}
padding: 2rem;
}
mat-expansion-panel {
@@ -583,3 +23,37 @@ mat-panel-description {
font-size: 14px;
color: var(--sg-text-muted);
}
.purpose-info-cards {
width: 100%;
display: flex;
gap: 1rem;
flex-wrap: wrap;
margin-top: 1rem;
}
.publication-list {
display: flex;
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;
}
File diff suppressed because it is too large Load Diff
@@ -18,12 +18,13 @@ import {
RouterModule,
RouterOutlet,
} from '@angular/router';
import { of, switchMap, finalize, map, catchError } from 'rxjs';
import { of, switchMap, finalize, map, catchError, combineLatest } from 'rxjs';
import { PersonInterestingComponent } from '../person-interesting/person-interesting.component';
import { WorksService } from '../../api';
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
import { PersonBioResolved } from '../../resolvers/person-bio.resolver';
import { PersonDataResolved } from '../../resolvers/person.resolver';
import { BookmarkService } from '../../shared/services/bookmark.service';
@Component({
@@ -101,8 +102,17 @@ export class PersonComponent {
readonly person = toSignal(
this.activatedRoute.data.pipe(
map(({ personData }) => {
return personData?.results[0] ?? null;
switchMap((data) => {
const resolved = data['personData'] as PersonDataResolved | undefined;
if (!resolved) {
this.isPersonLoading.set(false);
return of(null);
}
this.isPersonLoading.set(true);
return resolved.personData$.pipe(
map((response) => response?.results?.[0] ?? null),
finalize(() => this.isPersonLoading.set(false)),
);
}),
),
{ initialValue: null },
@@ -118,8 +128,12 @@ export class PersonComponent {
}
readonly personBio = toSignal(
this.activatedRoute.data.pipe(
switchMap((data) => {
combineLatest([this.activatedRoute.data, toObservable(this.person)]).pipe(
switchMap(([data, person]) => {
if (!person) {
this.isBioLoading.set(false);
return of(null);
}
const resolved = data['personBio'] as PersonBioResolved | undefined;
if (!resolved) {
this.isBioLoading.set(false);
@@ -216,9 +230,13 @@ export class PersonComponent {
readonly isTopicsLoading = signal(false);
readonly primaryTopicCounts = toSignal(
toObservable(this.authorId).pipe(
switchMap((id) => {
if (!id) return of([]);
toObservable(this.person).pipe(
switchMap((person) => {
const id = this.authorId();
if (!person || !id) {
this.isTopicsLoading.set(false);
return of([]);
}
this.isTopicsLoading.set(true);
return this.worksApi.getPrimaryTopicCountsByAuthor(id).pipe(
catchError((err) => {
@@ -265,11 +283,8 @@ export class PersonComponent {
void this.router.navigate(['publications'], {
relativeTo: this.activatedRoute,
queryParams: {
publicationPage: 1,
page: 0,
publicationTopicId: selection.id,
publicationTopicName: selection.name,
publicationTopicField: selection.fieldName ?? null,
publicationTopicDomain: selection.domainName ?? null,
},
});
}
@@ -11,7 +11,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
import { Subscription } from 'rxjs';
import { EuProjectData } from '../../../api/model/euProjectData';
import { TopicChipComponent } from '../../../shared/ui/topic-chip/topic-chip.component';
import { OrganizationsTableComponent } from './organizations-table/organizations-table/organizations-table.component';
import { OrganizationsTableComponent } from './organizations-table/organizations-table.component';
import { PublicationsTableComponent } from './publications-table/publications-table.component';
import { PatentsCardsComponent } from './patents-cards/patents-cards.component';
import { DeliverablesCardsComponent } from './deliverables-cards/deliverables-cards.component';
@@ -0,0 +1,109 @@
<div class="organizations-tab">
<mat-card appearance="outlined">
@if (showHeader) {
<div class="section-header">
<mat-icon>business</mat-icon>
<h2>{{ headerTitle }} ({{ getOrgsCount() }})</h2>
</div>
}
<div class="organizations-table-wrapper">
<app-data-table [data]="orgsToDisplay()" [columns]="columns()">
<ng-template #nameTemplate let-org>
<div
class="org-name-cell"
(click)="searchForInstitutionName(org.name || org.shortName || '')">
<span class="org-name-text">
{{ org.name || org.shortName || 'Unbekannte Organisation' }}
</span>
</div>
</ng-template>
<ng-template #roleTemplate let-org>
@if (org.role) {
<span class="role-chip">{{ org.role }}</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #cityTemplate let-org>
@if (org.city) {
<span class="country-chip">
{{ org.city }}
@if (org.country) {
<img
alt=""
class="country-flag"
[src]="
'https://flagcdn.io/' +
getSvgByCountryCode(org.country) +
'.svg'
"
height="10" />
}
</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #ecContributionTemplate let-org>
@if (
org.ecContribution !== undefined && org.ecContribution !== null
) {
<span class="currency-value">
{{
org.ecContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
}}
</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #activityTypeTemplate let-org>
@if (org.activityType) {
<span class="activity-chip">{{ org.activityType }}</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #smeTemplate let-org>
@if (org.sme) {
<span class="sme-badge">SME</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #organizationUrlTemplate let-org>
<div class="links-container">
@if (org.organizationURL) {
<a
[href]="org.organizationURL"
target="_blank"
rel="noopener noreferrer"
class="link-button"
matTooltip="Website öffnen"
(click)="$event.stopPropagation()">
<mat-icon class="link-icon">open_in_new</mat-icon>
<span class="link-label">Web</span>
</a>
} @else {
<span class="empty-value">—</span>
}
</div>
</ng-template>
</app-data-table>
<mat-paginator
[length]="orgs.length"
[pageSize]="pageSize()"
(page)="onPageChange($event)"
[pageSizeOptions]="paginationService.options">
</mat-paginator>
</div>
</mat-card>
</div>
@@ -1,10 +1,5 @@
// Organizations
.organizations-tab {
.card {
margin-bottom: 24px;
}
.section-header {
display: flex;
align-items: center;
@@ -0,0 +1,148 @@
import {
Component,
computed,
inject,
Input,
signal,
TemplateRef,
viewChild,
} from '@angular/core';
import { CurrencyPipe } from '@angular/common';
import { Router } from '@angular/router';
import { MatIcon } from '@angular/material/icon';
import { MatCard } from '@angular/material/card';
import { MatTooltipModule } from '@angular/material/tooltip';
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
import { PaginationService } from '../../../../shared/services/pagination.service';
import { HEUOrganization } from '../../../../api';
import {
DataTableComponent,
GenericColumn,
} from '../../../../shared/ui/data-table/data-table.component';
@Component({
selector: 'app-organizations-table',
imports: [
MatIcon,
MatCard,
MatTooltipModule,
CurrencyPipe,
DataTableComponent,
MatPaginatorModule,
],
templateUrl: './organizations-table.component.html',
styleUrl: './organizations-table.component.scss',
})
export class OrganizationsTableComponent {
private readonly router = inject(Router);
public paginationService = inject(PaginationService);
@Input() orgs: HEUOrganization[] = [];
@Input() showHeader: boolean = true;
@Input() headerTitle: string = 'Organisationen';
pageIndex = signal(0);
pageSize = signal(10);
orgsToDisplay = computed(() => {
const startIndex = this.pageIndex() * this.pageSize();
return this.orgs.slice(startIndex, startIndex + this.pageSize());
});
nameTemplate = viewChild<TemplateRef<any>>('nameTemplate');
roleTemplate = viewChild<TemplateRef<any>>('roleTemplate');
cityTemplate = viewChild<TemplateRef<any>>('cityTemplate');
ecContributionTemplate = viewChild<TemplateRef<any>>(
'ecContributionTemplate',
);
activityTypeTemplate = viewChild<TemplateRef<any>>('activityTypeTemplate');
smeTemplate = viewChild<TemplateRef<any>>('smeTemplate');
organizationUrlTemplate = viewChild<TemplateRef<any>>(
'organizationUrlTemplate',
);
columns = computed<GenericColumn<HEUOrganization>[]>(() => [
{
id: 'name',
header: 'Name',
type: 'accessor',
accessorKey: 'name',
cellTemplate: this.nameTemplate(),
},
{
id: 'role',
header: 'Rolle',
type: 'accessor',
accessorKey: 'role',
cellTemplate: this.roleTemplate(),
},
{
id: 'city',
header: 'Stadt',
type: 'accessor',
accessorKey: 'city',
cellTemplate: this.cityTemplate(),
},
{
id: 'ecContribution',
header: 'EU-Beitrag',
type: 'accessor',
accessorKey: 'ecContribution',
cellTemplate: this.ecContributionTemplate(),
},
{
id: 'activityType',
header: 'Aktivitätstyp',
type: 'accessor',
accessorKey: 'activityType',
cellTemplate: this.activityTypeTemplate(),
},
{
id: 'sme',
header: 'SME',
type: 'accessor',
accessorKey: 'SME',
cellTemplate: this.smeTemplate(),
},
{
id: 'organizationURL',
header: 'URL',
type: 'accessor',
accessorKey: 'organizationURL',
cellTemplate: this.organizationUrlTemplate(),
},
]);
searchForInstitutionName(institutionName: string): void {
if (!institutionName) {
return;
}
this.router.navigate(['/institutions'], {
queryParams: {
search: institutionName,
},
});
}
onPageChange(event: PageEvent): void {
this.pageIndex.set(event.pageIndex);
this.pageSize.set(event.pageSize);
}
getSvgByCountryCode(code: string | undefined | null): string {
if (!code) {
return '';
}
const codeLower = code.toLowerCase();
if (codeLower === 'uk') {
return 'gb';
}
return codeLower;
}
getOrgsCount(): number {
return this.orgs?.length || 0;
}
}
@@ -1,121 +0,0 @@
<div class="organizations-tab">
<mat-card appearance="outlined">
<div class="section-header">
<mat-icon>business</mat-icon>
<h2>Organisationen ({{ orgs.length || 0 }})</h2>
</div>
<div class="organizations-table-wrapper">
<table mat-table [dataSource]="orgs" class="mat-elevation-z2">
<!-- Name Column -->
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef>Name</th>
<td mat-cell *matCellDef="let org">
<div
class="org-name-cell"
(click)="searchForInstitutionName(org.name || '')">
<span class="org-name-text">{{
org.name || org.shortName || 'Unbekannte Organisation'
}}</span>
</div>
</td>
</ng-container>
<!-- Role Column -->
<ng-container matColumnDef="role">
<th mat-header-cell *matHeaderCellDef>Rolle</th>
<td mat-cell *matCellDef="let org">
@if (org.role) {
<span class="role-chip">{{ org.role }}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Country Column -->
<ng-container matColumnDef="country">
<th mat-header-cell *matHeaderCellDef>Stadt</th>
<td mat-cell *matCellDef="let org">
@if (org.city) {
<span class="country-chip">
{{ org.city }}
<img
alt=""
class="country-flag"
[src]="`https://flagcdn.io/${getSvgByCountryCode(org.country)}.svg`"
height="10" />
</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- EU Contribution Column -->
<ng-container matColumnDef="ecContribution">
<th mat-header-cell *matHeaderCellDef>EU-Beitrag</th>
<td mat-cell *matCellDef="let org">
@if (org.ecContribution) {
<span class="currency-value">{{
org.ecContribution | currency: 'EUR' : 'symbol' : '1.0-0' : 'de'
}}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Activity Type Column -->
<ng-container matColumnDef="activityType">
<th mat-header-cell *matHeaderCellDef>Aktivitätstyp</th>
<td mat-cell *matCellDef="let org">
@if (org.activityType) {
<span class="activity-chip">{{ org.activityType }}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- SME Badge Column -->
<ng-container matColumnDef="sme">
<th mat-header-cell *matHeaderCellDef>SME</th>
<td mat-cell *matCellDef="let org">
@if (org.sme) {
<span class="sme-badge">SME</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- URL Badge Column -->
<ng-container matColumnDef="organizationURL">
<th mat-header-cell *matHeaderCellDef>URL</th>
<td mat-cell *matCellDef="let org">
<div class="links-container">
@if (org.organizationURL) {
<a
[href]="org.organizationURL"
target="_blank"
class="link-button"
matTooltip="Website öffnen">
<mat-icon class="link-icon">open_in_new</mat-icon>
<span class="link-label">Web</span>
</a>
} @else {
<span class="empty-value">—</span>
}
</div>
</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="organizationDisplayedColumns"></tr>
<tr
mat-row
*matRowDef="let row; columns: organizationDisplayedColumns"></tr>
</table>
</div>
</mat-card>
</div>
@@ -1,49 +0,0 @@
import { Component, inject, Input } from '@angular/core';
import { MatTableModule } from '@angular/material/table';
import { Router } from '@angular/router';
import { MatIcon } from '@angular/material/icon';
import { MatCard } from '@angular/material/card';
import { HEUOrganization } from '../../../../../api';
import { CurrencyPipe } from '@angular/common';
@Component({
selector: 'app-organizations-table',
imports: [MatTableModule, MatIcon, MatCard, CurrencyPipe],
templateUrl: './organizations-table.component.html',
styleUrl: './organizations-table.component.scss',
})
export class OrganizationsTableComponent {
private readonly router = inject(Router);
@Input() orgs!: HEUOrganization[];
@Input() showHeader: boolean = true;
@Input() headerTitle: string = 'Organizationen';
// Displayed columns for the organizations table
organizationDisplayedColumns: string[] = [
'name',
'role',
'country',
'ecContribution',
'activityType',
'sme',
'organizationURL',
];
searchForInstitutionName(institutionName: string): void {
this.router.navigate(['/institutions'], {
queryParams: {
search: institutionName,
},
});
}
getSvgByCountryCode(code: string) {
const codeLower = code.toLowerCase();
if (codeLower === 'uk') {
return 'gb';
}
return codeLower;
}
getOrgsCount(): number {
return this.orgs?.length || 0;
}
}
@@ -6,138 +6,121 @@
<h2>{{ headerTitle }} ({{ getPublicationCount() }})</h2>
</div>
}
<div>
<table mat-table [dataSource]="publications" class="mat-elevation-z2">
<!-- Title Column -->
<ng-container matColumnDef="title">
<th mat-header-cell *matHeaderCellDef>Titel</th>
<td mat-cell *matCellDef="let pub">
<div class="pub-title-cell" (click)="searchForPublication(pub)">
<span class="pub-title-text">
{{ pub.title || 'Kein Titel' }}
</span>
</div>
</td>
</ng-container>
<!-- Authors Column -->
<ng-container matColumnDef="authors">
<th mat-header-cell *matHeaderCellDef>Autoren</th>
<td mat-cell *matCellDef="let pub">
@if (pub.authors) {
@let authorList = parseAuthors(pub.authors);
@if (authorList.length > 0) {
<div class="authors-container">
@for (author of authorList; track author; let last = $last) {
<span class="author-wrapper">
<span
class="author-name"
(click)="
searchForPersonName(author); $event.stopPropagation()
">
{{ author }}
</span>
@if (!last) {
<span class="author-separator">, </span>
}
</span>
<app-data-table [data]="publicationsToDisplay()" [columns]="columns()">
<ng-template #titleTemplate let-pub>
<div class="pub-title-cell" (click)="searchForPublication(pub)">
<span class="pub-title-text">
{{ pub.title || 'Kein Titel' }}
</span>
</div>
</ng-template>
<ng-template #authorsTemplate let-pub>
@if (pub.authors) {
@let authorList = parseAuthors(pub.authors);
@if (authorList.length > 0) {
<div class="authors-container">
@for (author of authorList; track author; let last = $last) {
<span class="author-wrapper">
<span
class="author-name"
(click)="
searchForPersonName(author); $event.stopPropagation()
">
{{ author }}
</span>
@if (!last) {
<span class="author-separator">, </span>
}
</div>
} @else {
<span class="empty-value">—</span>
}
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Journal Column -->
<ng-container matColumnDef="journal">
<th mat-header-cell *matHeaderCellDef>Zeitschrift</th>
<td mat-cell *matCellDef="let pub">
@if (pub.journalNumber) {
<span class="journal-chip" [matTooltip]="pub.journalNumber">{{
pub.journalNumber
}}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Year Column -->
<ng-container matColumnDef="year">
<th mat-header-cell *matHeaderCellDef>Jahr</th>
<td mat-cell *matCellDef="let pub">
@if (pub.publishedYear) {
<span class="year-value">{{ pub.publishedYear }}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Publisher Column -->
<ng-container matColumnDef="publisher">
<th mat-header-cell *matHeaderCellDef>Verlag</th>
<td mat-cell *matCellDef="let pub">
@if (pub.publisher) {
<span class="publisher-text">{{ pub.publisher }}</span>
} @else {
<span class="empty-value">—</span>
}
</td>
</ng-container>
<!-- Links Column -->
<ng-container matColumnDef="links">
<th mat-header-cell *matHeaderCellDef>Links</th>
<td mat-cell *matCellDef="let pub">
<div class="links-container">
@if (pub.doi) {
<a
[href]="'https://doi.org/' + pub.doi"
target="_blank"
class="link-button"
matTooltip="DOI öffnen">
<mat-icon class="link-icon">open_in_new</mat-icon>
<span class="link-label">DOI</span>
</a>
}
@if (pub.repositoryUrl) {
<a
[href]="pub.repositoryUrl"
target="_blank"
class="link-button"
matTooltip="Repository öffnen">
<mat-icon class="link-icon">folder_open</mat-icon>
<span class="link-label">Repo</span>
</a>
}
@if (pub.publicationUrl) {
<a
[href]="pub.publicationUrl"
target="_blank"
class="link-button"
matTooltip="Publikation öffnen">
<mat-icon class="link-icon">article</mat-icon>
<span class="link-label">Link</span>
</a>
}
@if (!pub.doi && !pub.repositoryUrl && !pub.publicationUrl) {
<span class="empty-value">—</span>
</span>
}
</div>
</td>
</ng-container>
} @else {
<span class="empty-value">—</span>
}
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<tr mat-header-row *matHeaderRowDef="publicationDisplayedColumns"></tr>
<tr
mat-row
*matRowDef="let row; columns: publicationDisplayedColumns"
class="publication-row"></tr>
</table>
</div>
<ng-template #journalTemplate let-pub>
@if (pub.journalNumber) {
<span class="journal-chip" [matTooltip]="pub.journalNumber">
{{ pub.journalNumber }}
</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #yearTemplate let-pub>
@if (pub.publishedYear) {
<span class="year-value">{{ pub.publishedYear }}</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #publisherTemplate let-pub>
@if (pub.publisher) {
<span class="publisher-text">{{ pub.publisher }}</span>
} @else {
<span class="empty-value">—</span>
}
</ng-template>
<ng-template #linksTemplate let-pub>
<div class="links-container">
@if (pub.doi) {
<a
[href]="'https://doi.org/' + pub.doi"
target="_blank"
class="link-button doi-link"
matTooltip="DOI öffnen"
(click)="$event.stopPropagation()">
<mat-icon class="link-icon">link</mat-icon>
<span class="link-label">DOI</span>
</a>
}
@if (pub.repositoryUrl) {
<a
[href]="pub.repositoryUrl"
target="_blank"
class="link-button"
matTooltip="Repository öffnen"
(click)="$event.stopPropagation()">
<mat-icon class="link-icon">folder_open</mat-icon>
<span class="link-label">Repo</span>
</a>
}
@if (pub.publicationUrl) {
<a
[href]="pub.publicationUrl"
target="_blank"
class="link-button"
matTooltip="Publikation öffnen"
(click)="$event.stopPropagation()">
<mat-icon class="link-icon">article</mat-icon>
<span class="link-label">Link</span>
</a>
}
@if (!pub.doi && !pub.repositoryUrl && !pub.publicationUrl) {
<span class="empty-value">—</span>
}
</div>
</ng-template>
</app-data-table>
<mat-paginator
[length]="publications.length"
[pageSize]="pageSize()"
(page)="onPageChange($event)"
[pageSizeOptions]="paginationService.options">
</mat-paginator>
</mat-card>
</div>
@@ -77,12 +77,6 @@
text-decoration: underline;
}
.authors-text {
color: #4a5a6a;
font-size: 13px;
color: #1a1a1a;
line-height: 1.4;
}
.author-name:hover {
color: #005a9c;
text-decoration: underline;
@@ -172,13 +166,6 @@
font-size: 12px;
}
.publicationDisplayedColumns {
// Hide less important columns on mobile
.mat-column-publisher {
display: none;
}
}
.journal-chip {
max-width: 120px;
font-size: 11px;
@@ -212,15 +199,6 @@
font-size: 11px;
}
.authors-text {
font-size: 11px;
max-width: 100px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: inline-block;
}
.links-container {
gap: 4px;
}
@@ -231,6 +209,3 @@
}
}
}
.deliverable-item {
flex-wrap: wrap;
}
@@ -1,36 +1,112 @@
import { Component, computed, inject, Input } from '@angular/core';
import { MatTableModule } from '@angular/material/table';
import { Router } from '@angular/router';
import {
Component,
computed,
inject,
Input,
viewChild,
signal,
} from '@angular/core';
import { MatIcon } from '@angular/material/icon';
import { MatCard } from '@angular/material/card';
import { MatTooltipModule } from '@angular/material/tooltip';
import { CommonModule } from '@angular/common';
import { HEUPublication } from '../../../../api';
import { Router } from '@angular/router';
import { TemplateRef } from '@angular/core';
import { PaginationService } from '../../../../shared/services/pagination.service';
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
import {
DataTableComponent,
GenericColumn,
} from '../../../../shared/ui/data-table/data-table.component';
@Component({
selector: 'app-publications-table',
imports: [CommonModule, MatTableModule, MatIcon, MatCard, MatTooltipModule],
imports: [
CommonModule,
MatIcon,
MatCard,
MatTooltipModule,
DataTableComponent,
MatPaginatorModule,
],
templateUrl: './publications-table.component.html',
styleUrl: './publications-table.component.scss',
})
export class PublicationsTableComponent {
private router = inject(Router);
public paginationService = inject(PaginationService);
@Input() publications: HEUPublication[] = [];
@Input() showHeader: boolean = true;
@Input() headerTitle: string = 'Publikationen';
pageIndex = signal(0);
pageSize = signal(10);
publicationsToDisplay = computed(() => {
const startIndex = this.pageIndex() * this.pageSize();
return this.publications.slice(startIndex, startIndex + this.pageSize());
});
// Templates for custom cell rendering
titleTemplate = viewChild<TemplateRef<any>>('titleTemplate');
authorsTemplate = viewChild<TemplateRef<any>>('authorsTemplate');
journalTemplate = viewChild<TemplateRef<any>>('journalTemplate');
yearTemplate = viewChild<TemplateRef<any>>('yearTemplate');
publisherTemplate = viewChild<TemplateRef<any>>('publisherTemplate');
linksTemplate = viewChild<TemplateRef<any>>('linksTemplate');
// Displayed columns for the publications table
publicationDisplayedColumns: string[] = [
'title',
'authors',
'journal',
'year',
'publisher',
'links',
];
author_names = computed(() => 'keka');
columns = computed<GenericColumn<HEUPublication>[]>(() => [
{
id: 'title',
header: 'Titel',
type: 'accessor',
accessorKey: 'title',
cellTemplate: this.titleTemplate(),
},
{
id: 'authors',
header: 'Autoren',
type: 'display',
cellTemplate: this.authorsTemplate(),
},
{
id: 'journalNumber',
header: 'Zeitschrift',
type: 'accessor',
accessorKey: 'journalNumber',
cellTemplate: this.journalTemplate(),
},
{
id: 'publishedYear',
header: 'Jahr',
type: 'accessor',
accessorKey: 'publishedYear',
cellTemplate: this.yearTemplate(),
},
{
id: 'publisher',
header: 'Verlag',
type: 'accessor',
accessorKey: 'publisher',
cellTemplate: this.publisherTemplate(),
},
{
id: 'links',
header: 'Links',
type: 'display',
cellTemplate: this.linksTemplate(),
},
]);
onPageChange(event: PageEvent): void {
this.pageIndex.set(event.pageIndex);
this.pageSize.set(event.pageSize);
}
/**
* Navigate to publication details
*/
searchForPublication(pub: HEUPublication): void {
@@ -9,6 +9,7 @@
[cardMinWidth]="380"
[sortingOptions]="sortingOptions"
[sortingDirectionOptions]="sortingDirectionOptions"
[observers]="observers"
searchLabel="Suche nach Namen" />
</div>
@@ -14,6 +14,7 @@ import {
CardSearchComponent,
Page,
} from '../../shared/ui/card-search/card-search.component';
import { FilterObserver } from '../../shared/ui/selected-filters/selected-filters.component';
@Component({
selector: 'app-projects',
@@ -43,6 +44,14 @@ export class ProjectsComponent {
urlChips = signal<ProjectType[]>(['eu', 'bund', 'dfg']);
observers: FilterObserver[] = [
{
id: 'name',
queryParamKey: 'search',
icon: 'search',
},
];
sortingOptions: SelectorOption[] = [{ value: 'title', display_name: 'Name' }];
sortingDirectionOptions: SelectorOption[] = [
{ value: 'asc', display_name: 'Aufsteigend' },
@@ -33,6 +33,12 @@
@if (publication.language) {
<span>{{ publication.language | languageCode }}</span>
}
@if (workClassification()?.classification?.primary_category) {
<span>{{
workClassification()?.classification?.primary_category
| workPrimaryCategory
}}</span>
}
</div>
<h1>
{{ publication.title || publication.display_name || 'Ohne Titel' }}
@@ -1,6 +1,6 @@
import { DatePipe, DecimalPipe, Location } from '@angular/common';
import { Component, DestroyRef, OnInit, inject } from '@angular/core';
import { Component, DestroyRef, OnInit, inject, input } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { HttpClient } from '@angular/common/http';
import { MatButtonModule } from '@angular/material/button';
@@ -14,11 +14,13 @@ import {
Work,
WorksService,
WorkTopic,
WorkClassification,
} from '../../api';
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
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';
interface DetailLink {
label: string;
@@ -45,6 +47,7 @@ interface InstitutionDetail {
TopicChipComponent,
WorkTypePipe,
LanguageCodePipe,
WorkPrimaryCategoryPipe
],
templateUrl: './publication-detail.component.html',
styleUrl: './publication-detail.component.scss',
@@ -57,6 +60,8 @@ export class PublicationDetailComponent implements OnInit {
private readonly router = inject(Router);
private readonly worksService = inject(WorksService);
workClassification = input.required<WorkClassification | null>();
publication: Work | null = null;
loading = true;
notFound = false;
@@ -1,3 +1,9 @@
<div class="pie-chart-holder">
@if (loading()) {
<div class="pie-loader-overlay">
<mat-spinner diameter="35"></mat-spinner>
<span class="pie-loader-text">Lade Daten...</span>
</div>
}
<div echarts [options]="chartOptions()" class="pie-chart-container"></div>
</div>
@@ -9,9 +9,32 @@
box-sizing: border-box;
width: 100%;
height: 380px;
position: relative;
}
.pie-chart-container {
width: 100%;
height: 100%;
}
.pie-loader-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.85);
border-radius: 16px;
z-index: 10;
gap: 0.75rem;
.pie-loader-text {
font-size: 12px;
color: #6b7280;
font-weight: 500;
}
}
@@ -10,11 +10,13 @@ import { NgxEchartsDirective } from 'ngx-echarts';
import { TrendResponse } from '../../../api';
import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
import { MatProgressSpinner } from '@angular/material/progress-spinner';
@Component({
selector: 'app-uni-pie-chart',
templateUrl: './uni-pie-chart.component.html',
styleUrl: './uni-pie-chart.component.scss',
imports: [NgxEchartsDirective, CommonModule],
imports: [NgxEchartsDirective, CommonModule, MatProgressSpinner],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class UniPieChartComponent {
@@ -23,6 +23,12 @@
</button>
<button
[class.active]="selectedSearchType() === 'news'"
[disabled]="!isUde()"
[title]="
!isUde()
? 'News-Trends sind nur für die Universität Duisburg-Essen verfügbar'
: ''
"
(click)="setSearchType('news')">
<mat-icon>campaign</mat-icon> News
</button>
@@ -79,128 +85,149 @@
<!-- Rechtes Haupt-Panel: Toggles & Diagramm -->
<main class="trend-main">
<div class="trend-toggles-bar">
<span class="toggle-label">Visualisierungsskala:</span>
<div class="toggle-buttons">
<button
[class.active]="chartMode() === 'normalized'"
(click)="setChartMode('normalized')"
title="Normiert das Publikationsvolumen auf [0,1], um die Form von Wachstumstrends zu vergleichen.">
<mat-icon>trending_down</mat-icon> Normierte Skala
</button>
<button
[class.active]="chartMode() === 'total'"
(click)="setChartMode('total')"
title="Zeigt die absolute Anzahl der Publikationen.">
<mat-icon>bar_chart</mat-icon> Gesamtvolumen
</button>
<button
[class.active]="chartMode() === 'cumulative'"
(click)="setChartMode('cumulative')"
title="Zeigt das normierte kumulierte Publikationswachstum (S-Kurve).">
<mat-icon>trending_up</mat-icon> S-Kurve (Normiert)
</button>
@if (isTrendLoading() && !rawTrendResponse()) {
<app-loading
text="Trenddaten werden initialisiert..."
icon="trending_up"
[size]="200"
[diameter]="200"></app-loading>
} @else if (rawTrendResponse()) {
<div class="trend-toggles-bar">
<span class="toggle-label">Visualisierungsskala:</span>
<div class="toggle-buttons">
<button
[class.active]="chartMode() === 'normalized'"
(click)="setChartMode('normalized')"
title="Normiert das Publikationsvolumen auf [0,1], um die Form von Wachstumstrends zu vergleichen.">
<mat-icon>trending_down</mat-icon> Normierte Skala
</button>
<button
[class.active]="chartMode() === 'total'"
(click)="setChartMode('total')"
title="Zeigt die absolute Anzahl der Publikationen.">
<mat-icon>bar_chart</mat-icon> Gesamtvolumen
</button>
<button
[class.active]="chartMode() === 'cumulative'"
(click)="setChartMode('cumulative')"
title="Zeigt das normierte kumulierte Publikationswachstum (S-Kurve).">
<mat-icon>trending_up</mat-icon> S-Kurve (Normiert)
</button>
</div>
</div>
</div>
<div class="chart-holder-card">
@if (isTrendLoading()) {
<div class="loader-overlay">
<div class="spinner"></div>
<p>Trenddaten werden abgerufen...</p>
</div>
}
@if (
selectedTrendTopics().length > 1 && selectedSearchType() !== 'news'
) {
<div class="chart-topic-tabs">
@for (topic of selectedTrendTopics(); track topic) {
<app-topic-chip
[label]="topic"
[active]="activeChartTopic() === topic"
[color]="getTopicColor(topic)"
(chipClick)="updateActiveChartTopic(topic)">
</app-topic-chip>
}
</div>
}
<app-uni-trend-chart
[data]="trendResponse()"
[mode]="chartMode()"
[activeTopic]="activeChartTopic()"
[startYear]="startYear()"
[endYear]="endYear()"
[getEntityColor]="boundGetEntityColor"></app-uni-trend-chart>
</div>
<!-- Pie Charts Row -->
@if (
selectedPieEntity() &&
selectedSearchType() !== 'news' &&
selectedSearchType() !== 'all'
) {
<div class="pie-charts-row" style="margin-bottom: 24px">
<app-uni-pie-chart
<div class="chart-holder-card">
@if (isTrendLoading()) {
<div class="loader-overlay">
<div class="spinner"></div>
<p>Trenddaten werden abgerufen...</p>
</div>
}
@if (
selectedTrendTopics().length > 1 && selectedSearchType() !== 'news'
) {
<div class="chart-topic-tabs">
@for (topic of selectedTrendTopics(); track topic) {
<app-topic-chip
[label]="topic"
[active]="activeChartTopic() === topic"
[color]="getTopicColor(topic)"
(chipClick)="updateActiveChartTopic(topic)">
</app-topic-chip>
}
</div>
}
<app-uni-trend-chart
[data]="trendResponse()"
[entityId]="selectedPieEntity()!.id"
[entityName]="selectedPieEntity()!.name"
[mode]="chartMode()"
[activeTopic]="activeChartTopic()"
[startYear]="startYear()"
[endYear]="endYear()"
[getTopicColor]="boundGetTopicColor">
</app-uni-pie-chart>
<app-uni-pie-chart
[titleText]="'Top 10 Themen (Gesamt): ' + selectedPieEntity()!.name"
[pieData]="topTopicsData()"
[loading]="isTopTopicsLoading()"
[error]="topTopicsError()"
[startYear]="startYear()"
[endYear]="endYear()"
[getTopicColor]="boundGetTopicColor">
</app-uni-pie-chart>
[getEntityColor]="boundGetEntityColor"></app-uni-trend-chart>
</div>
}
<!-- Unified Institution Search, Compare, & Recommendations -->
@if (activeConfig().showInstitutionSelector) {
<app-institution-selector
[comparisonInstitutions]="comparisonInstitutions()"
[primaryInstitution]="primaryInstitution()"
[primaryInstitutionName]="primaryInstitutionName()"
[topSuggestions]="topSuggestions()"
[isSuggestionsLoading]="isSuggestionsLoading()"
[activeChartTopic]="activeChartTopic()"
[searchQuery]="searchQuery()"
[searchResults]="searchResults()"
[getEntityColor]="boundGetEntityColor"
[isVisible]="boundIsVisible"
[selectedPieEntityId]="selectedPieEntity()?.id ?? null"
(addInstitution)="addInstitution($event.id, $event.name)"
(removeInstitution)="removeInstitution($event)"
(searchChange)="onSearchChange($event)"
(toggleVisibility)="toggleVisibility($event)"
(selectPie)="onSelectPieEntity($event)">
</app-institution-selector>
}
<!-- Pie Charts Row -->
@if (
selectedPieEntity() &&
selectedSearchType() !== 'news' &&
selectedSearchType() !== 'all'
) {
<div class="pie-charts-row" style="margin-bottom: 24px">
<app-uni-pie-chart
[data]="trendResponse()"
[loading]="isTrendLoading()"
[entityId]="selectedPieEntity()!.id"
[entityName]="selectedPieEntity()!.name"
[startYear]="startYear()"
[endYear]="endYear()"
[getTopicColor]="boundGetTopicColor">
</app-uni-pie-chart>
<!-- Reusable Author Selection UI (Main Panel below chart) -->
@if (activeConfig().showAuthorSelector) {
<app-author-selector
[comparisonAuthors]="comparisonAuthors()"
[topSuggestions]="recommendedAuthors()"
[isSuggestionsLoading]="isSuggestionsLoading()"
[activeChartTopic]="activeChartTopic()"
[searchQuery]="authorSearchQuery()"
[searchResults]="authorSearchResults()"
[getEntityColor]="boundGetEntityColor"
[isVisible]="boundIsVisible"
[selectedPieEntityId]="selectedPieEntity()?.id ?? null"
(addAuthor)="addAuthor($event.id, $event.name)"
(removeAuthor)="removeAuthor($event)"
(searchChange)="onAuthorSearchChange($event)"
(toggleVisibility)="toggleVisibility($event)"
(selectPie)="onSelectPieEntity($event)">
</app-author-selector>
<app-uni-pie-chart
[titleText]="
'Top ' +
topTopicsSize() +
' Themen (Gesamt): ' +
selectedPieEntity()!.name
"
[pieData]="topTopicsData()"
[loading]="isTopTopicsLoading() || isTrendLoading()"
[error]="topTopicsError()"
[startYear]="startYear()"
[endYear]="endYear()"
[getTopicColor]="boundGetTopicColor">
</app-uni-pie-chart>
</div>
}
<!-- Unified Institution Search, Compare, & Recommendations -->
@if (activeConfig().showInstitutionSelector) {
<app-institution-selector
[activeTab]="selectedSearchType()"
[comparisonInstitutions]="comparisonInstitutions()"
[primaryInstitution]="primaryInstitution()"
[primaryInstitutionName]="primaryInstitutionName()"
[topSuggestions]="topSuggestions()"
[isSuggestionsLoading]="isSuggestionsLoading()"
[activeChartTopic]="activeChartTopic()"
[searchQuery]="searchQuery()"
[searchResults]="searchResults()"
[getEntityColor]="boundGetEntityColor"
[isVisible]="boundIsVisible"
[selectedPieEntityId]="selectedPieEntity()?.id ?? null"
(addInstitution)="addInstitution($event.id, $event.name)"
(removeInstitution)="removeInstitution($event)"
(searchChange)="onSearchChange($event)"
(toggleVisibility)="toggleVisibility($event)"
(selectPie)="onSelectPieEntity($event)">
</app-institution-selector>
}
<!-- Reusable Author Selection UI (Main Panel below chart) -->
@if (activeConfig().showAuthorSelector) {
<app-author-selector
[activeTab]="selectedSearchType()"
[comparisonAuthors]="comparisonAuthors()"
[topSuggestions]="recommendedAuthors()"
[isSuggestionsLoading]="isSuggestionsLoading()"
[activeChartTopic]="activeChartTopic()"
[searchQuery]="authorSearchQuery()"
[searchResults]="authorSearchResults()"
[getEntityColor]="boundGetEntityColor"
[isVisible]="boundIsVisible"
[selectedPieEntityId]="selectedPieEntity()?.id ?? null"
(addAuthor)="addAuthor($event.id, $event.name)"
(removeAuthor)="removeAuthor($event)"
(searchChange)="onAuthorSearchChange($event)"
(toggleVisibility)="toggleVisibility($event)"
(selectPie)="onSelectPieEntity($event)">
</app-author-selector>
}
} @else {
<div class="no-data-fallback">
<mat-icon>trending_up</mat-icon>
<p>Bitte wählen Sie Themen aus, um die Trends zu laden.</p>
</div>
}
</main>
</div>
@@ -1,6 +1,6 @@
.trend-layout {
display: grid;
grid-template-columns: 300px 1fr;
grid-template-columns: 300px minmax(0, 1fr);
gap: 1.5rem;
margin-top: 1.5rem;
font-family: 'Inter', sans-serif;
@@ -212,10 +212,14 @@
height: 16px;
}
&:hover:not(.active) {
&:hover:not(.active):not([disabled]) {
color: #0f172a;
background: #f1f5f9;
}
&[disabled] {
opacity: 0.4;
cursor: not-allowed;
}
&.active {
background: white;
color: #3b82f6;
@@ -237,3 +241,22 @@
grid-template-columns: 1fr;
}
}
.no-data-fallback {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 400px;
background: white;
border-radius: 10px;
border: 1px solid #e5e7eb;
color: #9ca3af;
gap: 0.5rem;
mat-icon {
font-size: 48px;
width: 48px;
height: 48px;
}
}
@@ -34,7 +34,9 @@ import {
UniversityRankingsService,
InstitutionsService,
PersonsService,
OrganizationService,
} from '../../../api';
import { CredentialService } from '../../../shared/services/credential.service';
import { TopicChipComponent } from '../../../shared/ui/topic-chip/topic-chip.component';
import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
import { YearRangeSliderComponent } from '../../../shared/ui/year-range-slider/year-range-slider.component';
@@ -43,6 +45,7 @@ import { InstitutionSelectorComponent } from '../../../shared/ui/institution-sel
import { AuthorSelectorComponent } from '../../../shared/ui/author-selector/author-selector.component';
import { AuthorInstitutionSelectorComponent } from '../../../shared/ui/author-institution-selector/author-institution-selector.component';
import { SearchResultsStateService } from '../../keywords-search/search-results/search-results-state.service';
import { LoadingComponent } from '../../../shared/ui/loading/loading.component';
export interface CompareItem {
id: string;
@@ -81,7 +84,7 @@ export const TREND_CONFIGS: Record<string, TrendStrategyConfig> = {
},
projects: {
showInstitutionSelector: true,
showLocationSelector: false,
showLocationSelector: true,
showAuthorSelector: false,
yAxisLabel: 'Projektförderung (Anz)',
chartTitle: 'Drittmittelförderung-Trends',
@@ -120,6 +123,7 @@ export const TREND_CONFIGS: Record<string, TrendStrategyConfig> = {
InstitutionSelectorComponent,
AuthorSelectorComponent,
AuthorInstitutionSelectorComponent,
LoadingComponent,
],
templateUrl: './uni-trend-parent.component.html',
styleUrl: './uni-trend-parent.component.scss',
@@ -129,6 +133,12 @@ export class UniTrendParentComponent implements OnInit {
private readonly apiService = inject(UniversityRankingsService);
private readonly institutionsApiService = inject(InstitutionsService);
private readonly personsApiService = inject(PersonsService);
private readonly organizationService = inject(OrganizationService, {
optional: true,
});
private readonly credentialService = inject(CredentialService, {
optional: true,
});
private readonly route = inject(ActivatedRoute);
private readonly router = inject(Router);
@@ -137,6 +147,8 @@ export class UniTrendParentComponent implements OnInit {
optional: true,
});
readonly topTopicsSize = signal<number>(20);
// Input containing extracted/selected keywords from parent
readonly keywordsInput = input<string[]>([], { alias: 'keywords' });
@@ -154,10 +166,15 @@ export class UniTrendParentComponent implements OnInit {
'publications' | 'authors' | 'patents' | 'projects' | 'news' | 'all'
>('publications');
readonly selectedTrendTopics = signal<string[]>([]);
readonly primaryInstitution = signal<string | null>(null);
readonly primaryInstitution = signal<string | null>('I62318514');
readonly primaryInstitutionName = signal<string>(
'Universität Duisburg-Essen',
);
readonly isUde = computed(() => {
const p = this.primaryInstitution() || 'I62318514';
return p.includes('I62318514') || p === 'I62318514';
});
readonly comparisonInstitutions = signal<CompareItem[]>([]);
readonly comparisonCountries = signal<CompareItem[]>([
{ id: 'DE', name: 'Deutschland' },
@@ -350,16 +367,25 @@ export class UniTrendParentComponent implements OnInit {
}
// Default: publications, patents, projects
// Resilient ID normalization helper
const cleanId = (id: string | null | undefined): string => {
if (!id) return '';
const lower = id.toLowerCase().trim();
return lower.includes('/') ? lower.split('/').pop()! : lower;
};
const currentInstIds = new Set(
this.comparisonInstitutions().map((i: CompareItem) => i.id.toLowerCase()),
this.comparisonInstitutions().map((i: CompareItem) => cleanId(i.id)),
);
const currentCountryIds = new Set(
this.comparisonCountries().map((c: CompareItem) => c.id.toLowerCase()),
this.comparisonCountries().map((c: CompareItem) => cleanId(c.id)),
);
const currentRegionIds = new Set(
this.comparisonRegions().map((r: CompareItem) => r.id.toLowerCase()),
this.comparisonRegions().map((r: CompareItem) => cleanId(r.id)),
);
const primaryInstCleanId = cleanId(
this.primaryInstitution() || 'I62318514',
);
const defaultInstId = 'https://openalex.org/I62318514'.toLowerCase();
const primaryInstSeries: TrendSeries[] = [];
const compInstSeries: TrendSeries[] = [];
@@ -367,19 +393,19 @@ export class UniTrendParentComponent implements OnInit {
const regionSeries: TrendSeries[] = [];
raw.series.forEach((s: TrendSeries) => {
const id = s.entity_id.toLowerCase();
const cId = cleanId(s.entity_id);
if (s.entity_type === 'institution') {
if (id === defaultInstId) {
if (cId === primaryInstCleanId) {
primaryInstSeries.push(s);
} else if (currentInstIds.has(id)) {
} else if (currentInstIds.has(cId)) {
compInstSeries.push(s);
}
} else if (s.entity_type === 'country') {
if (currentCountryIds.has(id)) {
if (currentCountryIds.has(cId)) {
countrySeries.push(s);
}
} else if (s.entity_type === 'region') {
if (currentRegionIds.has(id)) {
if (currentRegionIds.has(cId)) {
regionSeries.push(s);
}
}
@@ -537,18 +563,23 @@ export class UniTrendParentComponent implements OnInit {
// Handle initialization and synchronization of URL state
this.route.queryParams.subscribe((params) => {
let hasInstsFromUrl = false;
if (params['search_type']) {
this.selectedSearchType.set(params['search_type'] as any);
}
// Parse institutions serialized as id|name
if (params['institutions']) {
hasInstsFromUrl = true;
const insts = Array.isArray(params['institutions'])
? params['institutions']
: [params['institutions']];
const parsed = insts.map((i: string) => {
const parts = i.split('|');
return { id: parts[0], name: parts[1] || parts[0] };
const cleanId = parts[0].includes('/')
? parts[0].split('/').pop() || parts[0]
: parts[0];
return { id: cleanId, name: parts[1] || parts[0] };
});
const currentIds = this.comparisonInstitutions()
@@ -562,10 +593,11 @@ export class UniTrendParentComponent implements OnInit {
if (currentIds !== parsedIds) {
this.comparisonInstitutions.set(parsed);
}
} else {
if (this.comparisonInstitutions().length > 0) {
this.comparisonInstitutions.set([]);
}
}
// If URL didn't specify institutions and list is currently empty, initialize defaults
if (!hasInstsFromUrl && this.comparisonInstitutions().length === 0) {
this.initializeDefaultInstitutions();
}
// Parse countries
@@ -744,18 +776,48 @@ export class UniTrendParentComponent implements OnInit {
}
ngOnInit() {
if (this.credentialService) {
const profile = this.credentialService.accountProfile();
if (profile?.organization_name) {
this.primaryInstitutionName.set(profile.organization_name);
}
const orgId = this.credentialService.effectiveOrganizationId();
if (orgId && this.organizationService) {
this.organizationService.getOrganisations().subscribe({
next: (res) => {
const matchingOrg = res.items?.find((o) => o.id === orgId);
const openAlexId =
matchingOrg?.other_inst_id ||
(matchingOrg as any)?.openalex_institution_id;
if (matchingOrg && openAlexId) {
this.primaryInstitution.set(openAlexId);
if (matchingOrg.name) {
this.primaryInstitutionName.set(matchingOrg.name);
}
}
},
error: () => {},
});
}
}
this.initializeDefaultInstitutions();
}
// Dynamically load top institutions to initialize comparisons using the top-institutions service
initializeDefaultInstitutions() {
const primaryId = this.primaryInstitution() || 'I62318514';
const primaryName =
this.primaryInstitutionName() || 'Universität Duisburg-Essen';
const kws = this.keywords();
if (kws.length === 0) return;
if (kws.length === 0) {
this.comparisonInstitutions.set([{ id: primaryId, name: primaryName }]);
return;
}
// Use mapped topic names if softSearch is false
const topics = this.state?.topicsList() ?? kws;
const topic = topics[0] || kws[0] || 'Artificial Intelligence';
this.isSuggestionsLoading.set(true);
forkJoin({
deInsts:
@@ -781,6 +843,7 @@ export class UniTrendParentComponent implements OnInit {
overallInsts: Array<TopInstitutionItem>;
}) => {
const uniqueInsts = new Map<string, string>();
uniqueInsts.set(primaryId, primaryName);
deInsts.forEach((inst: TopInstitutionItem) => {
if (inst.id)
@@ -797,7 +860,6 @@ export class UniTrendParentComponent implements OnInit {
name,
}));
this.comparisonInstitutions.set(list);
this.isSuggestionsLoading.set(false);
if (!this.rawTrendResponse()) {
this.fetchTrendData();
@@ -805,7 +867,6 @@ export class UniTrendParentComponent implements OnInit {
},
error: (err: any) => {
console.error('Failed to load default institutions dynamically:', err);
this.isSuggestionsLoading.set(false);
},
});
}
@@ -817,7 +878,6 @@ export class UniTrendParentComponent implements OnInit {
const topics = this.state?.topicsList() ?? kws;
const topic = topics[0] || kws[0] || 'Artificial Intelligence';
this.isSuggestionsLoading.set(true);
this.personsApiService
.searchPersonsList(
@@ -837,7 +897,6 @@ export class UniTrendParentComponent implements OnInit {
name: author.display_name || 'Unbekannt',
}));
this.comparisonAuthors.set(list);
this.isSuggestionsLoading.set(false);
if (!this.rawTrendResponse()) {
this.fetchTrendData();
@@ -845,7 +904,6 @@ export class UniTrendParentComponent implements OnInit {
},
error: (err) => {
console.error('Failed to load default authors:', err);
this.isSuggestionsLoading.set(false);
},
});
}
@@ -1070,6 +1128,9 @@ export class UniTrendParentComponent implements OnInit {
setSearchType(
type: 'publications' | 'authors' | 'patents' | 'projects' | 'news' | 'all',
) {
if (type === 'news' && !this.isUde()) {
return;
}
this.selectedSearchType.set(type);
// Auto-initialize default lists if empty for the target type
@@ -1092,12 +1153,17 @@ export class UniTrendParentComponent implements OnInit {
// Add comparison institution
addInstitution(id: string, name: string) {
const cleanId = id.includes('/') ? id.split('/').pop() || id : id;
const current = this.comparisonInstitutions();
if (
!current.some((i: CompareItem) => i.id === id) &&
id !== this.primaryInstitution()
) {
this.comparisonInstitutions.set([...current, { id, name }]);
const exists = current.some((i: CompareItem) => {
const itemClean = i.id.includes('/')
? i.id.split('/').pop() || i.id
: i.id;
return itemClean.toLowerCase() === cleanId.toLowerCase();
});
if (!exists) {
this.comparisonInstitutions.set([...current, { id: cleanId, name }]);
this.updateUrlParams();
}
this.searchQuery.set('');
this.searchResults.set([]);
@@ -1108,6 +1174,7 @@ export class UniTrendParentComponent implements OnInit {
this.comparisonInstitutions.set(
current.filter((i: CompareItem) => i.id !== id),
);
this.updateUrlParams();
}
// Add country or region
@@ -1132,6 +1199,7 @@ export class UniTrendParentComponent implements OnInit {
this.locationQuery.set('');
this.locationSearchResults.set([]);
this.loadTrendSuggestions();
this.updateUrlParams();
}
removeLocation(id: string, type: 'country' | 'continent') {
@@ -1147,6 +1215,7 @@ export class UniTrendParentComponent implements OnInit {
);
}
this.loadTrendSuggestions();
this.updateUrlParams();
}
// Add Top 3 Authors for a selected institution from institutions autocomplete
@@ -1187,6 +1256,7 @@ export class UniTrendParentComponent implements OnInit {
});
this.comparisonAuthors.set(updated);
this.isSuggestionsLoading.set(false);
this.updateUrlParams();
},
error: (err) => {
console.error('Failed to load top authors for institution:', err);
@@ -1203,12 +1273,14 @@ export class UniTrendParentComponent implements OnInit {
const current = this.comparisonAuthors();
if (!current.some((a) => a.id === shortId)) {
this.comparisonAuthors.set([...current, { id: shortId, name }]);
this.updateUrlParams();
}
}
removeAuthor(id: string) {
const current = this.comparisonAuthors();
this.comparisonAuthors.set(current.filter((a: CompareItem) => a.id !== id));
this.updateUrlParams();
}
// Scaling mode toggle (data reuses instantly)