Merge branch 'dev' of nes.uni-due.de:lbs/smartguide into feature/keywords-analysis
LocationBasedServices/smartguide/pipeline/head This commit looks good
LocationBasedServices/smartguide/pipeline/head This commit looks good
This commit is contained in:
@@ -528,6 +528,9 @@ async def get_person_by_id(
|
||||
career_metrics=career_metrics,
|
||||
)
|
||||
|
||||
if custom_author.topics:
|
||||
await enrich_topic_descriptions(custom_author.topics)
|
||||
|
||||
return CustomAuthorsListResponse(results=[custom_author])
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,10 @@ from inse.models.openalex.topics_by_time import TopicsByTime
|
||||
from inse.models.openalex.topics_by_year import TopicsByYear
|
||||
from inse.models.openalex.work import Work
|
||||
from inse.models.openalex.work_page import WorkPage
|
||||
from inse.models.openalex.work_topic import WorkTopic
|
||||
from inse.models.openalex.work_topic_domain import WorkTopicDomain
|
||||
from inse.models.openalex.work_topic_field import WorkTopicField
|
||||
from inse.models.openalex.work_topic_subfield import WorkTopicSubfield
|
||||
from inse.models.openalex.works_list_response import WorksListResponse
|
||||
|
||||
from .search_client import OpenAlexWorksSearchClient
|
||||
@@ -235,26 +239,39 @@ async def get_work(
|
||||
return elements[0]
|
||||
|
||||
|
||||
async def enrich_topic_descriptions(topics: list) -> None:
|
||||
"""Batch-fill missing descriptions on dehydrated topics.
|
||||
async def enrich_topic_descriptions(topics: list[WorkTopic]) -> None:
|
||||
"""Batch-fill missing hierarchy metadata and descriptions on dehydrated topics.
|
||||
|
||||
OpenAlex work and author documents carry dehydrated topics without a
|
||||
description, so we batch-load the details from the openalex-topics index.
|
||||
description, subfield, field, or domain, so we batch-load the details from
|
||||
the openalex-topics index.
|
||||
"""
|
||||
pending = [topic for topic in topics if topic.id and not topic.description]
|
||||
pending = [
|
||||
topic
|
||||
for topic in topics
|
||||
if topic.id and (not topic.description or not topic.var_field or not topic.domain)
|
||||
]
|
||||
|
||||
if not pending:
|
||||
return
|
||||
|
||||
details = await _get_topic_details(list({topic.id for topic in pending}))
|
||||
|
||||
if not details:
|
||||
return
|
||||
|
||||
for topic in pending:
|
||||
info = details.get(topic.id)
|
||||
if info:
|
||||
if not info:
|
||||
continue
|
||||
|
||||
if not topic.description:
|
||||
topic.description = info.get("description")
|
||||
if not topic.subfield and info.get("subfield"):
|
||||
topic.subfield = WorkTopicSubfield.from_dict(info["subfield"])
|
||||
if not topic.var_field and info.get("field"):
|
||||
topic.var_field = WorkTopicField.from_dict(info["field"])
|
||||
if not topic.domain and info.get("domain"):
|
||||
topic.domain = WorkTopicDomain.from_dict(info["domain"])
|
||||
|
||||
|
||||
async def _enrich_work_topic_descriptions(works: list[Work]) -> None:
|
||||
|
||||
@@ -36,19 +36,9 @@
|
||||
<mat-option value="both">Beides</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<mat-form-field
|
||||
class="patents-toolbar-field"
|
||||
subscriptSizing="dynamic">
|
||||
<mat-icon matPrefix fontIcon="filter_alt"></mat-icon>
|
||||
<mat-select
|
||||
[value]="activeFilter"
|
||||
(selectionChange)="setFilter($event.value)">
|
||||
<mat-select-trigger>Filter nach Quelle</mat-select-trigger>
|
||||
<mat-option value="all">Alle</mat-option>
|
||||
<mat-option value="EPO">EPO</mat-option>
|
||||
<mat-option value="USPTO">USPTO</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<app-source-filter
|
||||
[value]="activeFilter"
|
||||
(valueChange)="setFilter($event)" />
|
||||
<mat-form-field
|
||||
class="patents-toolbar-field"
|
||||
subscriptSizing="dynamic">
|
||||
|
||||
@@ -17,6 +17,7 @@ import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-pagina
|
||||
import { ComponentTooltipDirective } from '../../directives/component-tooltip.directive';
|
||||
import { AppAuthorTooltipComponent } from '../../shared/ui/app-author-tooltip/app-author-tooltip.component';
|
||||
import { PatentTableComponent } from '../../shared/ui/patent-table/patent-table.component';
|
||||
import { SourceFilterComponent } from '../../shared/ui/source-filter/source-filter.component';
|
||||
|
||||
type SortColumn = 'title' | 'publication_year' | 'source' | 'match_type';
|
||||
type SortDirection = 'asc' | 'desc';
|
||||
@@ -35,6 +36,7 @@ type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both';
|
||||
QueryParamPaginatorComponent,
|
||||
ComponentTooltipDirective,
|
||||
PatentTableComponent,
|
||||
SourceFilterComponent,
|
||||
],
|
||||
templateUrl: './institution-patents.component.html',
|
||||
styleUrl: './institution-patents.component.scss',
|
||||
|
||||
+3
-13
@@ -13,19 +13,9 @@
|
||||
<div class="patents-content">
|
||||
<div class="patents-list">
|
||||
<div class="patents-list-toolbar">
|
||||
<mat-form-field
|
||||
class="patents-toolbar-field"
|
||||
subscriptSizing="dynamic">
|
||||
<mat-icon matPrefix fontIcon="filter_alt"></mat-icon>
|
||||
<mat-select
|
||||
[value]="activeFilter()"
|
||||
(selectionChange)="setFilter($event.value)">
|
||||
<mat-select-trigger>Filter nach Quelle</mat-select-trigger>
|
||||
<mat-option value="all">Alle</mat-option>
|
||||
<mat-option value="EPO">EPO</mat-option>
|
||||
<mat-option value="USPTO">USPTO</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<app-source-filter
|
||||
[value]="activeFilter()"
|
||||
(valueChange)="setFilter($event)" />
|
||||
<mat-form-field
|
||||
class="patents-toolbar-field"
|
||||
subscriptSizing="dynamic">
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
} from '../../patent-detail/patent-detail.utils';
|
||||
import { KeywordPatentMappingStatus } from '../../../api';
|
||||
import { PatentTableComponent } from '../../../shared/ui/patent-table/patent-table.component';
|
||||
import { SourceFilterComponent } from '../../../shared/ui/source-filter/source-filter.component';
|
||||
|
||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
type SortColumn = 'title' | 'publication_year' | 'source';
|
||||
@@ -43,6 +44,7 @@ function isValidSortColumn(value: string | null): value is SortColumn {
|
||||
LoadingComponent,
|
||||
QueryParamPaginatorComponent,
|
||||
PatentTableComponent,
|
||||
SourceFilterComponent,
|
||||
],
|
||||
templateUrl: './keywords-patents.component.html',
|
||||
styleUrl: './keywords-patents.component.scss',
|
||||
|
||||
@@ -3,13 +3,7 @@
|
||||
|
||||
<mat-divider />
|
||||
|
||||
@if (loading) {
|
||||
<app-loading
|
||||
text="Patentdaten werden geladen..."
|
||||
icon="workspace_premium"
|
||||
[size]="150"
|
||||
[diameter]="150" />
|
||||
} @else if (error) {
|
||||
@if (error) {
|
||||
<p class="state-message error">Fehler beim Laden der Patente.</p>
|
||||
} @else if (showDetail && selectedPatent) {
|
||||
<div class="detail-view">
|
||||
@@ -261,6 +255,7 @@
|
||||
</div>
|
||||
} @else {
|
||||
<app-card-search
|
||||
[loading]="loading"
|
||||
[page]="cardSearchPage()"
|
||||
[cardTmp]="cardTmp"
|
||||
[additionalFiltersTmp]="filtersTmp"
|
||||
|
||||
@@ -12,7 +12,6 @@ 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 { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||
import { YearRangeSliderComponent } from '../../shared/ui/year-range-slider/year-range-slider.component';
|
||||
import {
|
||||
classificationSectionColor,
|
||||
@@ -52,7 +51,6 @@ const MIN_YEAR = 1978;
|
||||
MatChipsModule,
|
||||
MatDividerModule,
|
||||
TopicChipComponent,
|
||||
LoadingComponent,
|
||||
YearRangeSliderComponent,
|
||||
CardSearchComponent,
|
||||
FilterCardComponent,
|
||||
|
||||
@@ -13,19 +13,9 @@
|
||||
<div class="patents-content">
|
||||
<div class="patents-list">
|
||||
<div class="patents-list-toolbar">
|
||||
<mat-form-field
|
||||
class="patents-toolbar-field"
|
||||
subscriptSizing="dynamic">
|
||||
<mat-icon matPrefix fontIcon="filter_alt"></mat-icon>
|
||||
<mat-select
|
||||
[value]="activeFilter"
|
||||
(selectionChange)="setFilter($event.value)">
|
||||
<mat-select-trigger>Filter nach Quelle</mat-select-trigger>
|
||||
<mat-option value="all">Alle</mat-option>
|
||||
<mat-option value="EPO">EPO</mat-option>
|
||||
<mat-option value="USPTO">USPTO</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<app-source-filter
|
||||
[value]="activeFilter"
|
||||
(valueChange)="setFilter($event)" />
|
||||
<mat-form-field
|
||||
class="patents-toolbar-field"
|
||||
subscriptSizing="dynamic">
|
||||
|
||||
@@ -17,6 +17,7 @@ import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||
import { PageEvent } from '@angular/material/paginator';
|
||||
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
import { PatentTableComponent } from '../../shared/ui/patent-table/patent-table.component';
|
||||
import { SourceFilterComponent } from '../../shared/ui/source-filter/source-filter.component';
|
||||
|
||||
type SortColumn = 'title' | 'publication_year' | 'source';
|
||||
type SortDirection = 'asc' | 'desc';
|
||||
@@ -32,6 +33,7 @@ type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
MatIconModule,
|
||||
QueryParamPaginatorComponent,
|
||||
PatentTableComponent,
|
||||
SourceFilterComponent,
|
||||
],
|
||||
templateUrl: './person-patents.component.html',
|
||||
styleUrl: './person-patents.component.scss',
|
||||
|
||||
+1
-1
@@ -198,11 +198,11 @@
|
||||
<div class="chart-topic-tabs">
|
||||
@for (topic of selectedTrendTopics(); track $index) {
|
||||
<app-topic-chip
|
||||
[topicId]="topic"
|
||||
[label]="getMappedTopic(topic)"
|
||||
[active]="activeChartTopic() === topic"
|
||||
[color]="getTopicColor(topic)"
|
||||
[disabled]="isTopicEmpty(topic)"
|
||||
[tooltipDisabled]="true"
|
||||
(chipClick)="updateActiveChartTopic(topic)">
|
||||
</app-topic-chip>
|
||||
}
|
||||
|
||||
@@ -44,10 +44,10 @@ export class AppAuthorChipComponent {
|
||||
icon = input<string>('person');
|
||||
|
||||
author = input<Author | undefined>(undefined);
|
||||
rawOaAuthorId = computed(() => {
|
||||
return this.stripOpenAlexId(this.author()?.id);
|
||||
});
|
||||
authorId = input<string | undefined>(undefined);
|
||||
rawOaAuthorId = computed(() => {
|
||||
return this.authorId() ?? this.stripOpenAlexId(this.author()?.id);
|
||||
});
|
||||
|
||||
_author = signal<Author | undefined>(undefined);
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
]"
|
||||
matButton="outlined"
|
||||
(click)="$event.stopPropagation()">
|
||||
<mat-icon>verified</mat-icon>
|
||||
<mat-icon>workspace_premium</mat-icon>
|
||||
Patente
|
||||
</a>
|
||||
}
|
||||
|
||||
@@ -39,23 +39,25 @@
|
||||
@let visibleInventors =
|
||||
expanded ? patent.inventors : (patent.inventors ?? []).slice(0, 3);
|
||||
<div class="person-chips">
|
||||
@for (inventor of visibleInventors; track inventor) {
|
||||
<span class="person-chip">
|
||||
<mat-icon>person</mat-icon>
|
||||
{{ inventor }}
|
||||
@for (inventor of visibleInventors; track inventor; let last = $last) {
|
||||
<span class="person-chip-row">
|
||||
<span class="person-chip">
|
||||
<mat-icon>person</mat-icon>
|
||||
{{ inventor }}
|
||||
</span>
|
||||
@if (last && (patent.inventors ?? []).length > 3) {
|
||||
<button
|
||||
type="button"
|
||||
class="patent-chip-more"
|
||||
[attr.aria-expanded]="expanded"
|
||||
(click)="toggleInventorsExpansion(patent)">
|
||||
{{ expanded ? 'weniger' : '+' + (patent.inventors!.length - 3) }}
|
||||
</button>
|
||||
}
|
||||
</span>
|
||||
} @empty {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
@if ((patent.inventors ?? []).length > 3) {
|
||||
<button
|
||||
type="button"
|
||||
class="patent-chip-more"
|
||||
[attr.aria-expanded]="expanded"
|
||||
(click)="toggleInventorsExpansion(patent)">
|
||||
{{ expanded ? 'weniger' : '+' + (patent.inventors!.length - 3) }}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
@@ -64,25 +66,27 @@
|
||||
@let visibleAssignees =
|
||||
expanded ? patent.assignees : (patent.assignees ?? []).slice(0, 3);
|
||||
<div class="person-chips">
|
||||
@for (assignee of visibleAssignees; track assignee) {
|
||||
<span class="person-chip">
|
||||
<mat-icon>{{
|
||||
isAssigneeLikelyPerson(assignee, patent) ? 'person' : 'apartment'
|
||||
}}</mat-icon>
|
||||
{{ assignee }}
|
||||
@for (assignee of visibleAssignees; track assignee; let last = $last) {
|
||||
<span class="person-chip-row">
|
||||
<span class="person-chip">
|
||||
<mat-icon>{{
|
||||
isAssigneeLikelyPerson(assignee, patent) ? 'person' : 'apartment'
|
||||
}}</mat-icon>
|
||||
{{ assignee }}
|
||||
</span>
|
||||
@if (last && (patent.assignees ?? []).length > 3) {
|
||||
<button
|
||||
type="button"
|
||||
class="patent-chip-more"
|
||||
[attr.aria-expanded]="expanded"
|
||||
(click)="toggleAssigneesExpansion(patent)">
|
||||
{{ expanded ? 'weniger' : '+' + (patent.assignees!.length - 3) }}
|
||||
</button>
|
||||
}
|
||||
</span>
|
||||
} @empty {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
@if ((patent.assignees ?? []).length > 3) {
|
||||
<button
|
||||
type="button"
|
||||
class="patent-chip-more"
|
||||
[attr.aria-expanded]="expanded"
|
||||
(click)="toggleAssigneesExpansion(patent)">
|
||||
{{ expanded ? 'weniger' : '+' + (patent.assignees!.length - 3) }}
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
@@ -99,15 +103,12 @@
|
||||
author of patent.matched_authors.slice(0, 3);
|
||||
track author.openalex_author_id
|
||||
) {
|
||||
<a
|
||||
class="author-link"
|
||||
[routerLink]="['/person', author.openalex_author_id]"
|
||||
[appComponentTooltip]="AuthorTooltipComponent"
|
||||
[tooltipInputs]="{ authorId: author.openalex_author_id }"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(click)="$event.stopPropagation()">
|
||||
{{ author.author_name }}
|
||||
</a>
|
||||
<app-author-chip
|
||||
size="mini"
|
||||
[showIcon]="true"
|
||||
[isClickable]="true"
|
||||
[authorId]="author.openalex_author_id"
|
||||
(handleChipClick)="navigateToPerson(author.openalex_author_id)" />
|
||||
}
|
||||
} @else {
|
||||
<span class="empty-text">-</span>
|
||||
|
||||
@@ -58,15 +58,18 @@
|
||||
max-width: 240px;
|
||||
}
|
||||
|
||||
.person-chip-row {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.person-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
padding: 2px 8px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: var(--sg-surface-soft);
|
||||
color: var(--sg-text);
|
||||
font-size: 0.75rem;
|
||||
line-height: 1.4;
|
||||
@@ -133,17 +136,9 @@
|
||||
|
||||
.cell-authors {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.25rem;
|
||||
align-items: flex-start;
|
||||
min-width: 120px;
|
||||
}
|
||||
|
||||
.author-link {
|
||||
color: var(--sg-blue-highlight);
|
||||
text-decoration: none;
|
||||
font-size: 0.82rem;
|
||||
|
||||
&:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
max-width: 260px;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import {
|
||||
Component,
|
||||
TemplateRef,
|
||||
inject,
|
||||
input,
|
||||
output,
|
||||
signal,
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
import { Router, RouterModule } from '@angular/router';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
@@ -18,8 +19,7 @@ import {
|
||||
GenericColumn,
|
||||
} from '../data-table/data-table.component';
|
||||
import { ChipComponent } from '../chip/chip.component';
|
||||
import { ComponentTooltipDirective } from '../../../directives/component-tooltip.directive';
|
||||
import { AppAuthorTooltipComponent } from '../app-author-tooltip/app-author-tooltip.component';
|
||||
import { AppAuthorChipComponent } from '../app-author-chip/app-author-chip.component';
|
||||
import { isAssigneeLikelyPerson } from '../../../modules/patent-detail/patent-detail.utils';
|
||||
|
||||
export interface PatentTableEntry extends PatentEntry {
|
||||
@@ -36,7 +36,7 @@ export interface PatentTableEntry extends PatentEntry {
|
||||
MatTooltipModule,
|
||||
DataTableComponent,
|
||||
ChipComponent,
|
||||
ComponentTooltipDirective,
|
||||
AppAuthorChipComponent,
|
||||
],
|
||||
templateUrl: './patent-table.component.html',
|
||||
styleUrl: './patent-table.component.scss',
|
||||
@@ -44,7 +44,7 @@ export interface PatentTableEntry extends PatentEntry {
|
||||
export class PatentTableComponent<
|
||||
T extends PatentTableEntry = PatentTableEntry,
|
||||
> {
|
||||
readonly AuthorTooltipComponent = AppAuthorTooltipComponent;
|
||||
private readonly router = inject(Router);
|
||||
|
||||
patents = input.required<T[]>();
|
||||
selectedPatent = input<T | null>(null);
|
||||
@@ -156,6 +156,10 @@ export class PatentTableComponent<
|
||||
return isAssigneeLikelyPerson(assignee, patent.inventors);
|
||||
}
|
||||
|
||||
navigateToPerson(authorId: string): void {
|
||||
this.router.navigate(['/person', authorId]);
|
||||
}
|
||||
|
||||
getMatchTypeLabel(matchType: string | undefined): string {
|
||||
switch (matchType) {
|
||||
case 'institution':
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<mat-form-field class="source-filter-field" subscriptSizing="dynamic">
|
||||
<mat-icon matPrefix fontIcon="filter_alt"></mat-icon>
|
||||
<mat-select
|
||||
[value]="value()"
|
||||
(selectionChange)="valueChange.emit($event.value)">
|
||||
<mat-select-trigger>Filter nach Quelle</mat-select-trigger>
|
||||
<mat-option value="all">Alle</mat-option>
|
||||
<mat-option value="EPO">EPO</mat-option>
|
||||
<mat-option value="USPTO">USPTO</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
@@ -0,0 +1,4 @@
|
||||
.source-filter-field {
|
||||
width: fit-content;
|
||||
min-width: 180px;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { Component, input, output } from '@angular/core';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
export type SourceFilterValue = 'all' | 'EPO' | 'USPTO';
|
||||
|
||||
@Component({
|
||||
selector: 'app-source-filter',
|
||||
imports: [MatFormFieldModule, MatSelectModule, MatIconModule],
|
||||
templateUrl: './source-filter.component.html',
|
||||
styleUrl: './source-filter.component.scss',
|
||||
})
|
||||
export class SourceFilterComponent {
|
||||
value = input.required<SourceFilterValue>();
|
||||
valueChange = output<SourceFilterValue>();
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
[attr.aria-pressed]="active() ? 'true' : null"
|
||||
[appComponentTooltip]="AppTopicTooltipComponent"
|
||||
[tooltipInputs]="tooltipInputs()"
|
||||
[tooltipDisabled]="tooltipDisabled() || disabled()"
|
||||
[tooltipMaxWidth]="'500px'"
|
||||
(click)="handleClick()">
|
||||
<span class="topic-chip__label">
|
||||
|
||||
@@ -99,6 +99,7 @@ export class TopicChipComponent {
|
||||
color = input<TopicChipColor>('purple');
|
||||
size = input<TopicChipSize>('normal');
|
||||
disabled = input<boolean>(false);
|
||||
tooltipDisabled = input<boolean>(false);
|
||||
active = input<boolean>(false);
|
||||
descriptionTooltipTarget = input<TopicChipTooltipTarget>('label');
|
||||
topicId = input<string | null | undefined>(undefined);
|
||||
|
||||
Reference in New Issue
Block a user