diff --git a/service/src/main/inse/persons/logic.py b/service/src/main/inse/persons/logic.py index 99ce3d54..a75ae61a 100644 --- a/service/src/main/inse/persons/logic.py +++ b/service/src/main/inse/persons/logic.py @@ -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]) diff --git a/service/src/main/inse/works/logic.py b/service/src/main/inse/works/logic.py index 11355c84..5af75313 100644 --- a/service/src/main/inse/works/logic.py +++ b/service/src/main/inse/works/logic.py @@ -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: diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.html b/webapp/src/app/modules/institution-patents/institution-patents.component.html index 68d414a6..25480058 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.html +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.html @@ -36,19 +36,9 @@ Beides - - - - Filter nach Quelle - Alle - EPO - USPTO - - + diff --git a/webapp/src/app/modules/institution-patents/institution-patents.component.ts b/webapp/src/app/modules/institution-patents/institution-patents.component.ts index 58fbf82b..4586f7f9 100644 --- a/webapp/src/app/modules/institution-patents/institution-patents.component.ts +++ b/webapp/src/app/modules/institution-patents/institution-patents.component.ts @@ -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', diff --git a/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.html b/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.html index 3bce037a..2899e79a 100644 --- a/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.html +++ b/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.html @@ -13,19 +13,9 @@
- - - - Filter nach Quelle - Alle - EPO - USPTO - - + diff --git a/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.ts b/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.ts index 0844a2a7..ebb5b168 100644 --- a/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.ts +++ b/webapp/src/app/modules/keywords-search/keywords-patents/keywords-patents.component.ts @@ -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', diff --git a/webapp/src/app/modules/patents/patents.component.html b/webapp/src/app/modules/patents/patents.component.html index d03b5edb..cf10d3de 100644 --- a/webapp/src/app/modules/patents/patents.component.html +++ b/webapp/src/app/modules/patents/patents.component.html @@ -3,13 +3,7 @@ - @if (loading) { - - } @else if (error) { + @if (error) {

Fehler beim Laden der Patente.

} @else if (showDetail && selectedPatent) {
@@ -261,6 +255,7 @@
} @else {
- - - - Filter nach Quelle - Alle - EPO - USPTO - - + diff --git a/webapp/src/app/modules/person-patents/person-patents.component.ts b/webapp/src/app/modules/person-patents/person-patents.component.ts index f8b31e19..62de6234 100644 --- a/webapp/src/app/modules/person-patents/person-patents.component.ts +++ b/webapp/src/app/modules/person-patents/person-patents.component.ts @@ -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', diff --git a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html index 81d7f7bd..90ae4ac3 100644 --- a/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html +++ b/webapp/src/app/modules/university-ranking/uni-trend-parent/uni-trend-parent.component.html @@ -198,11 +198,11 @@
@for (topic of selectedTrendTopics(); track $index) { } diff --git a/webapp/src/app/shared/ui/app-author-chip/app-author-chip.component.ts b/webapp/src/app/shared/ui/app-author-chip/app-author-chip.component.ts index 10ff376d..65c3b66a 100644 --- a/webapp/src/app/shared/ui/app-author-chip/app-author-chip.component.ts +++ b/webapp/src/app/shared/ui/app-author-chip/app-author-chip.component.ts @@ -44,10 +44,10 @@ export class AppAuthorChipComponent { icon = input('person'); author = input(undefined); - rawOaAuthorId = computed(() => { - return this.stripOpenAlexId(this.author()?.id); - }); authorId = input(undefined); + rawOaAuthorId = computed(() => { + return this.authorId() ?? this.stripOpenAlexId(this.author()?.id); + }); _author = signal(undefined); diff --git a/webapp/src/app/shared/ui/app-institution-card/app-institution-card.component.html b/webapp/src/app/shared/ui/app-institution-card/app-institution-card.component.html index 7abfe32c..0de24d21 100644 --- a/webapp/src/app/shared/ui/app-institution-card/app-institution-card.component.html +++ b/webapp/src/app/shared/ui/app-institution-card/app-institution-card.component.html @@ -84,7 +84,7 @@ ]" matButton="outlined" (click)="$event.stopPropagation()"> - verified + workspace_premium Patente } diff --git a/webapp/src/app/shared/ui/patent-table/patent-table.component.html b/webapp/src/app/shared/ui/patent-table/patent-table.component.html index b9478e5e..cd86abe3 100644 --- a/webapp/src/app/shared/ui/patent-table/patent-table.component.html +++ b/webapp/src/app/shared/ui/patent-table/patent-table.component.html @@ -39,23 +39,25 @@ @let visibleInventors = expanded ? patent.inventors : (patent.inventors ?? []).slice(0, 3);
- @for (inventor of visibleInventors; track inventor) { - - person - {{ inventor }} + @for (inventor of visibleInventors; track inventor; let last = $last) { + + + person + {{ inventor }} + + @if (last && (patent.inventors ?? []).length > 3) { + + } } @empty { - } - @if ((patent.inventors ?? []).length > 3) { - - }
@@ -64,25 +66,27 @@ @let visibleAssignees = expanded ? patent.assignees : (patent.assignees ?? []).slice(0, 3);
- @for (assignee of visibleAssignees; track assignee) { - - {{ - isAssigneeLikelyPerson(assignee, patent) ? 'person' : 'apartment' - }} - {{ assignee }} + @for (assignee of visibleAssignees; track assignee; let last = $last) { + + + {{ + isAssigneeLikelyPerson(assignee, patent) ? 'person' : 'apartment' + }} + {{ assignee }} + + @if (last && (patent.assignees ?? []).length > 3) { + + } } @empty { - } - @if ((patent.assignees ?? []).length > 3) { - - }
@@ -99,15 +103,12 @@ author of patent.matched_authors.slice(0, 3); track author.openalex_author_id ) { - - {{ author.author_name }} - + } } @else { - diff --git a/webapp/src/app/shared/ui/patent-table/patent-table.component.scss b/webapp/src/app/shared/ui/patent-table/patent-table.component.scss index 76b50023..e711719a 100644 --- a/webapp/src/app/shared/ui/patent-table/patent-table.component.scss +++ b/webapp/src/app/shared/ui/patent-table/patent-table.component.scss @@ -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; } diff --git a/webapp/src/app/shared/ui/patent-table/patent-table.component.ts b/webapp/src/app/shared/ui/patent-table/patent-table.component.ts index 51ad5f35..7e4d449a 100644 --- a/webapp/src/app/shared/ui/patent-table/patent-table.component.ts +++ b/webapp/src/app/shared/ui/patent-table/patent-table.component.ts @@ -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(); selectedPatent = input(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': diff --git a/webapp/src/app/shared/ui/source-filter/source-filter.component.html b/webapp/src/app/shared/ui/source-filter/source-filter.component.html new file mode 100644 index 00000000..aa07533c --- /dev/null +++ b/webapp/src/app/shared/ui/source-filter/source-filter.component.html @@ -0,0 +1,11 @@ + + + + Filter nach Quelle + Alle + EPO + USPTO + + diff --git a/webapp/src/app/shared/ui/source-filter/source-filter.component.scss b/webapp/src/app/shared/ui/source-filter/source-filter.component.scss new file mode 100644 index 00000000..212797e5 --- /dev/null +++ b/webapp/src/app/shared/ui/source-filter/source-filter.component.scss @@ -0,0 +1,4 @@ +.source-filter-field { + width: fit-content; + min-width: 180px; +} diff --git a/webapp/src/app/shared/ui/source-filter/source-filter.component.ts b/webapp/src/app/shared/ui/source-filter/source-filter.component.ts new file mode 100644 index 00000000..32dd4ec1 --- /dev/null +++ b/webapp/src/app/shared/ui/source-filter/source-filter.component.ts @@ -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(); + valueChange = output(); +} diff --git a/webapp/src/app/shared/ui/topic-chip/topic-chip.component.html b/webapp/src/app/shared/ui/topic-chip/topic-chip.component.html index 8e669d33..16abd91a 100644 --- a/webapp/src/app/shared/ui/topic-chip/topic-chip.component.html +++ b/webapp/src/app/shared/ui/topic-chip/topic-chip.component.html @@ -6,6 +6,7 @@ [attr.aria-pressed]="active() ? 'true' : null" [appComponentTooltip]="AppTopicTooltipComponent" [tooltipInputs]="tooltipInputs()" + [tooltipDisabled]="tooltipDisabled() || disabled()" [tooltipMaxWidth]="'500px'" (click)="handleClick()"> diff --git a/webapp/src/app/shared/ui/topic-chip/topic-chip.component.ts b/webapp/src/app/shared/ui/topic-chip/topic-chip.component.ts index 90cc0ecb..627017c3 100644 --- a/webapp/src/app/shared/ui/topic-chip/topic-chip.component.ts +++ b/webapp/src/app/shared/ui/topic-chip/topic-chip.component.ts @@ -99,6 +99,7 @@ export class TopicChipComponent { color = input('purple'); size = input('normal'); disabled = input(false); + tooltipDisabled = input(false); active = input(false); descriptionTooltipTarget = input('label'); topicId = input(undefined);