feat: improve patent matching with disambiguation pipeline and caching
LocationBasedServices/smartguide/pipeline/head There was a failure building this commit
LocationBasedServices/smartguide/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -20,6 +20,21 @@
|
||||
<span class="summary-value">{{ getUsptoCount() }}</span>
|
||||
<span class="summary-label"> USPTO</span>
|
||||
</p>
|
||||
@if (fromCache) {
|
||||
<p class="summary-line summary-line--meta">
|
||||
<span class="summary-label">Aus Cache</span>
|
||||
@if (lastBuiltAt) {
|
||||
<span class="summary-label"> · {{ formatDate(lastBuiltAt) }}</span>
|
||||
}
|
||||
</p>
|
||||
}
|
||||
<button
|
||||
class="rebuild-button"
|
||||
type="button"
|
||||
[disabled]="rebuilding"
|
||||
(click)="rebuildPatents()">
|
||||
{{ rebuilding ? 'Aktualisiere...' : 'Neu zuordnen' }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="patents-content">
|
||||
@@ -101,6 +116,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (selectedPatent.match_signals?.length) {
|
||||
<div class="detail-section">
|
||||
<h4>Zuordnungs-Signale</h4>
|
||||
<ul class="tag-list tag-list--compact">
|
||||
@for (signal of selectedPatent.match_signals; track signal) {
|
||||
<li class="tag tag--signal">{{ formatSignal(signal) }}</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (selectedPatent.abstract) {
|
||||
<div class="detail-section">
|
||||
<h4>Abstract</h4>
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
margin-bottom: 8px;
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.summary-line {
|
||||
margin: 0;
|
||||
@@ -21,6 +23,27 @@
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.summary-line--meta {
|
||||
color: #666;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.rebuild-button {
|
||||
margin-left: auto;
|
||||
padding: 8px 14px;
|
||||
border: 1px solid #bdd4ff;
|
||||
border-radius: 20px;
|
||||
background: #f0f6ff;
|
||||
color: #0b63ce;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
|
||||
&:disabled {
|
||||
opacity: 0.6;
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
.summary-label {
|
||||
color: #333;
|
||||
}
|
||||
@@ -263,6 +286,12 @@
|
||||
color: #1e40af;
|
||||
font-size: 0.8rem;
|
||||
line-height: 1.3;
|
||||
|
||||
&--signal {
|
||||
background: #eef7ee;
|
||||
border-color: #cfe6cf;
|
||||
color: #2f6b2f;
|
||||
}
|
||||
}
|
||||
|
||||
.pagination {
|
||||
|
||||
@@ -1,11 +1,27 @@
|
||||
import { Component, OnInit, inject } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { PatentsService, PatentEntry } from '../../api/api/patents.service';
|
||||
import {
|
||||
PatentsService,
|
||||
PatentEntry,
|
||||
PatentSearchMeta,
|
||||
} from '../../api/api/patents.service';
|
||||
|
||||
type SortMode = 'score' | 'date' | 'title';
|
||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
|
||||
const SIGNAL_LABELS: Record<string, string> = {
|
||||
full_name_match: 'Vollständiger Name',
|
||||
last_name_match: 'Nachname',
|
||||
first_name_match: 'Vorname',
|
||||
institution_match: 'Institution',
|
||||
orcid_match: 'ORCID',
|
||||
topic_match: 'Forschungsthema',
|
||||
coauthor_match: 'Ko-Autor',
|
||||
publication_topic_match: 'Publikations-Thema',
|
||||
manual_include: 'Manuell hinzugefügt',
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-person-patents',
|
||||
imports: [CommonModule],
|
||||
@@ -21,9 +37,14 @@ export class PersonPatentsComponent implements OnInit {
|
||||
filteredPatents: PatentEntry[] = [];
|
||||
authorName: string | null = null;
|
||||
selectedPatent: PatentEntry | null = null;
|
||||
searchMeta: PatentSearchMeta | null = null;
|
||||
fromCache = false;
|
||||
lastBuiltAt: string | null = null;
|
||||
|
||||
loading = true;
|
||||
rebuilding = false;
|
||||
error = false;
|
||||
authorId = '';
|
||||
|
||||
activeFilter: SourceFilter = 'all';
|
||||
sortMode: SortMode = 'score';
|
||||
@@ -33,7 +54,7 @@ export class PersonPatentsComponent implements OnInit {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.route.parent?.paramMap.subscribe((params) => {
|
||||
const authorId = params.get('id') ?? '';
|
||||
this.authorId = params.get('id') ?? '';
|
||||
|
||||
const filterFromUrl = this.route.snapshot.queryParamMap.get('filter');
|
||||
const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
|
||||
@@ -45,23 +66,51 @@ export class PersonPatentsComponent implements OnInit {
|
||||
this.sortMode = sortFromUrl;
|
||||
}
|
||||
|
||||
if (authorId) {
|
||||
this.patentsApi.getPatentsByAuthor(authorId, 'body').subscribe({
|
||||
next: (result) => {
|
||||
this.patents = result.patents ?? [];
|
||||
this.authorName = result.author_name ?? null;
|
||||
this.applyFilter();
|
||||
this.loading = false;
|
||||
},
|
||||
error: () => {
|
||||
this.error = true;
|
||||
this.loading = false;
|
||||
},
|
||||
});
|
||||
if (this.authorId) {
|
||||
this.loadPatents();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
loadPatents(refresh = false): void {
|
||||
this.loading = true;
|
||||
this.error = false;
|
||||
|
||||
this.patentsApi
|
||||
.getPatentsByAuthor(this.authorId, 'body', false, {
|
||||
refresh,
|
||||
transferCache: false,
|
||||
})
|
||||
.subscribe({
|
||||
next: (result) => this.applyResult(result),
|
||||
error: () => {
|
||||
this.error = true;
|
||||
this.loading = false;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
rebuildPatents(): void {
|
||||
if (!this.authorId || this.rebuilding) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.rebuilding = true;
|
||||
this.error = false;
|
||||
|
||||
this.patentsApi.rebuildPatentsByAuthor(this.authorId).subscribe({
|
||||
next: (result) => {
|
||||
this.applyResult(result);
|
||||
this.rebuilding = false;
|
||||
},
|
||||
error: () => {
|
||||
this.error = true;
|
||||
this.rebuilding = false;
|
||||
this.loading = false;
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
setFilter(filter: SourceFilter): void {
|
||||
this.activeFilter = filter;
|
||||
this.selectedPage = 1;
|
||||
@@ -81,6 +130,26 @@ export class PersonPatentsComponent implements OnInit {
|
||||
this.updateQueryParams();
|
||||
}
|
||||
|
||||
formatSignal(signal: string): string {
|
||||
return SIGNAL_LABELS[signal] ?? signal;
|
||||
}
|
||||
|
||||
private applyResult(result: {
|
||||
patents?: PatentEntry[];
|
||||
author_name?: string | null;
|
||||
from_cache?: boolean;
|
||||
last_built_at?: string | null;
|
||||
search_meta?: PatentSearchMeta | null;
|
||||
}): void {
|
||||
this.patents = result.patents ?? [];
|
||||
this.authorName = result.author_name ?? null;
|
||||
this.fromCache = result.from_cache ?? false;
|
||||
this.lastBuiltAt = result.last_built_at ?? null;
|
||||
this.searchMeta = result.search_meta ?? null;
|
||||
this.applyFilter();
|
||||
this.loading = false;
|
||||
}
|
||||
|
||||
private applyFilter(): void {
|
||||
let patents = this.patents;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user