Merge branch 'feature/dfg-details' of nes.uni-due.de:lbs/smartguide into feature/keywords-analysis

This commit is contained in:
2026-06-29 23:07:35 +02:00
63 changed files with 5582 additions and 2168 deletions
+419 -431
View File
@@ -1,431 +1,419 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import {
HttpClient,
HttpHeaders,
HttpParams,
HttpResponse,
HttpEvent,
HttpParameterCodec,
HttpContext,
} from '@angular/common/http';
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { AllPatentsResponse } from '../model/allPatentsResponse';
// @ts-ignore
import { HTTPValidationError } from '../model/hTTPValidationError';
// @ts-ignore
import { PatentEntry } from '../model/patentEntry';
// @ts-ignore
import { PatentsByAuthorResponse } from '../model/patentsByAuthorResponse';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
@Injectable({
providedIn: 'root',
})
export class PatentsService extends BaseService {
constructor(
protected httpClient: HttpClient,
@Optional() @Inject(BASE_PATH) basePath: string | string[],
@Optional() configuration?: Configuration,
) {
super(basePath, configuration);
}
/**
* Get all patents with pagination and search.
* @endpoint get /api/inse-service/patents
* @param page
* @param size
* @param search
* @param source
* @param sortBy
* @param sortDirection
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getAllPatents(
page?: number,
size?: number,
search?: string,
source?: string,
sortBy?: string,
sortDirection?: string,
observe?: 'body',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<AllPatentsResponse>;
public getAllPatents(
page?: number,
size?: number,
search?: string,
source?: string,
sortBy?: string,
sortDirection?: string,
observe?: 'response',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpResponse<AllPatentsResponse>>;
public getAllPatents(
page?: number,
size?: number,
search?: string,
source?: string,
sortBy?: string,
sortDirection?: string,
observe?: 'events',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpEvent<AllPatentsResponse>>;
public getAllPatents(
page?: number,
size?: number,
search?: string,
source?: string,
sortBy?: string,
sortDirection?: string,
observe: any = 'body',
reportProgress: boolean = false,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<any> {
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>page,
'page',
);
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>size,
'size',
);
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>search,
'search',
);
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>source,
'source',
);
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>sortBy,
'sort_by',
);
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>sortDirection,
'sort_direction',
);
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set(
'Accept',
localVarHttpHeaderAcceptSelected,
);
}
const localVarHttpContext: HttpContext =
options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/inse-service/patents`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<AllPatentsResponse>(
'get',
`${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined
? { transferCache: localVarTransferCache }
: {}),
reportProgress: reportProgress,
},
);
}
/**
* Returns one publication by OpenAlex ID or DOI.
* @endpoint get /api/inse-service/patents/{identifier}
* @param identifier
* @param prefix Application Prefix (EP or US)
* @param title Do we want to fallback to title search if ID and DOI dont work?
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getPatentByIdOrTitle(
identifier: string,
prefix?: string,
title?: string,
observe?: 'body',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<PatentEntry>;
public getPatentByIdOrTitle(
identifier: string,
prefix?: string,
title?: string,
observe?: 'response',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpResponse<PatentEntry>>;
public getPatentByIdOrTitle(
identifier: string,
prefix?: string,
title?: string,
observe?: 'events',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpEvent<PatentEntry>>;
public getPatentByIdOrTitle(
identifier: string,
prefix?: string,
title?: string,
observe: any = 'body',
reportProgress: boolean = false,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<any> {
if (identifier === null || identifier === undefined) {
throw new Error(
'Required parameter identifier was null or undefined when calling getPatentByIdOrTitle.',
);
}
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>prefix,
'prefix',
);
localVarQueryParameters = this.addToHttpParams(
localVarQueryParameters,
<any>title,
'title',
);
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set(
'Accept',
localVarHttpHeaderAcceptSelected,
);
}
const localVarHttpContext: HttpContext =
options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/inse-service/patents/${this.configuration.encodeParam({ name: 'identifier', value: identifier, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<PatentEntry>(
'get',
`${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined
? { transferCache: localVarTransferCache }
: {}),
reportProgress: reportProgress,
},
);
}
/**
* Get patents matched to an author by name.
* @endpoint get /api/inse-service/authors/{author_id}/patents
* @param authorId
* @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body.
* @param reportProgress flag to report request and response progress.
*/
public getPatentsByAuthor(
authorId: string,
observe?: 'body',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<PatentsByAuthorResponse>;
public getPatentsByAuthor(
authorId: string,
observe?: 'response',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpResponse<PatentsByAuthorResponse>>;
public getPatentsByAuthor(
authorId: string,
observe?: 'events',
reportProgress?: boolean,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<HttpEvent<PatentsByAuthorResponse>>;
public getPatentsByAuthor(
authorId: string,
observe: any = 'body',
reportProgress: boolean = false,
options?: {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
},
): Observable<any> {
if (authorId === null || authorId === undefined) {
throw new Error(
'Required parameter authorId was null or undefined when calling getPatentsByAuthor.',
);
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set(
'Accept',
localVarHttpHeaderAcceptSelected,
);
}
const localVarHttpContext: HttpContext =
options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam({ name: 'authorId', value: authorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/patents`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<PatentsByAuthorResponse>(
'get',
`${basePath}${localVarPath}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined
? { transferCache: localVarTransferCache }
: {}),
reportProgress: reportProgress,
},
);
}
}
import { Inject, Injectable, Optional } from '@angular/core';
import {
HttpClient,
HttpHeaders,
HttpParams,
HttpResponse,
HttpEvent,
HttpContext,
} from '@angular/common/http';
import { Observable } from 'rxjs';
import { BASE_PATH } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
import { PatentEntry } from '../model/patentEntry';
import { PatentsByAuthorResponse } from '../model/patentsByAuthorResponse';
import { PatentsByInstitutionResponse } from '../model/patentsByInstitutionResponse';
import {
OrgPatentsResponse,
OrgPatentMatchTypeFilter,
} from '../model/orgPatentsResponse';
export interface AllPatentsResponse {
total: number;
page: number;
size: number;
patents: PatentEntry[];
}
type GetPatentsByAuthorOptions = {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
};
type GetPatentsByInstitutionOptions = {
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
};
type GetOrgPatentsByInstitutionOptions = {
matchType?: OrgPatentMatchTypeFilter;
page?: number;
size?: number;
source?: 'EPO' | 'USPTO';
httpHeaderAccept?: 'application/json';
context?: HttpContext;
transferCache?: boolean;
};
@Injectable({
providedIn: 'root',
})
export class PatentsService extends BaseService {
constructor(
protected httpClient: HttpClient,
@Optional() @Inject(BASE_PATH) basePath: string | string[],
@Optional() configuration?: Configuration,
) {
super(basePath, configuration);
}
public getPatentsByAuthor(
authorId: string,
observe?: 'body',
reportProgress?: boolean,
options?: GetPatentsByAuthorOptions,
): Observable<PatentsByAuthorResponse>;
public getPatentsByAuthor(
authorId: string,
observe?: 'response',
reportProgress?: boolean,
options?: GetPatentsByAuthorOptions,
): Observable<HttpResponse<PatentsByAuthorResponse>>;
public getPatentsByAuthor(
authorId: string,
observe?: 'events',
reportProgress?: boolean,
options?: GetPatentsByAuthorOptions,
): Observable<HttpEvent<PatentsByAuthorResponse>>;
public getPatentsByAuthor(
authorId: string,
observe: any = 'body',
reportProgress: boolean = false,
options?: GetPatentsByAuthorOptions,
): Observable<any> {
if (authorId === null || authorId === undefined) {
throw new Error(
'Required parameter authorId was null or undefined when calling getPatentsByAuthor.',
);
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set(
'Accept',
localVarHttpHeaderAcceptSelected,
);
}
const localVarHttpContext: HttpContext =
options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/inse-service/authors/${this.configuration.encodeParam(
{
name: 'authorId',
value: authorId,
in: 'path',
style: 'simple',
explode: false,
dataType: 'string',
dataFormat: undefined,
},
)}/patents`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<PatentsByAuthorResponse>(
'get',
`${basePath}${localVarPath}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined
? { transferCache: localVarTransferCache }
: {}),
reportProgress: reportProgress,
},
);
}
public getPatentsByInstitution(
institutionId: string,
observe?: 'body',
reportProgress?: boolean,
options?: GetPatentsByInstitutionOptions,
): Observable<PatentsByInstitutionResponse>;
public getPatentsByInstitution(
institutionId: string,
observe?: 'response',
reportProgress?: boolean,
options?: GetPatentsByInstitutionOptions,
): Observable<HttpResponse<PatentsByInstitutionResponse>>;
public getPatentsByInstitution(
institutionId: string,
observe?: 'events',
reportProgress?: boolean,
options?: GetPatentsByInstitutionOptions,
): Observable<HttpEvent<PatentsByInstitutionResponse>>;
public getPatentsByInstitution(
institutionId: string,
observe: any = 'body',
reportProgress: boolean = false,
options?: GetPatentsByInstitutionOptions,
): Observable<any> {
if (institutionId === null || institutionId === undefined) {
throw new Error(
'Required parameter institutionId was null or undefined when calling getPatentsByInstitution.',
);
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set(
'Accept',
localVarHttpHeaderAcceptSelected,
);
}
const localVarHttpContext: HttpContext =
options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam(
{
name: 'institutionId',
value: institutionId,
in: 'path',
style: 'simple',
explode: false,
dataType: 'string',
dataFormat: undefined,
},
)}/patents`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<PatentsByInstitutionResponse>(
'get',
`${basePath}${localVarPath}`,
{
context: localVarHttpContext,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined
? { transferCache: localVarTransferCache }
: {}),
reportProgress: reportProgress,
},
);
}
public getOrgPatentsByInstitution(
institutionId: string,
observe?: 'body',
reportProgress?: boolean,
options?: GetOrgPatentsByInstitutionOptions,
): Observable<OrgPatentsResponse>;
public getOrgPatentsByInstitution(
institutionId: string,
observe?: 'response',
reportProgress?: boolean,
options?: GetOrgPatentsByInstitutionOptions,
): Observable<HttpResponse<OrgPatentsResponse>>;
public getOrgPatentsByInstitution(
institutionId: string,
observe?: 'events',
reportProgress?: boolean,
options?: GetOrgPatentsByInstitutionOptions,
): Observable<HttpEvent<OrgPatentsResponse>>;
public getOrgPatentsByInstitution(
institutionId: string,
observe: any = 'body',
reportProgress: boolean = false,
options?: GetOrgPatentsByInstitutionOptions,
): Observable<any> {
if (institutionId === null || institutionId === undefined) {
throw new Error(
'Required parameter institutionId was null or undefined when calling getOrgPatentsByInstitution.',
);
}
let localVarQueryParameters = new HttpParams();
if (options?.matchType) {
localVarQueryParameters = localVarQueryParameters.set(
'match_type',
options.matchType,
);
}
if (options?.page !== undefined) {
localVarQueryParameters = localVarQueryParameters.set(
'page',
String(options.page),
);
}
if (options?.size !== undefined) {
localVarQueryParameters = localVarQueryParameters.set(
'size',
String(options.size),
);
}
if (options?.source) {
localVarQueryParameters = localVarQueryParameters.set(
'source',
options.source,
);
}
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined =
options?.httpHeaderAccept ??
this.configuration.selectHeaderAccept(['application/json']);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set(
'Accept',
localVarHttpHeaderAcceptSelected,
);
}
const localVarHttpContext: HttpContext =
options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (
this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)
) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/inse-service/institutions/${this.configuration.encodeParam(
{
name: 'institutionId',
value: institutionId,
in: 'path',
style: 'simple',
explode: false,
dataType: 'string',
dataFormat: undefined,
},
)}/org-patents`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<OrgPatentsResponse>(
'get',
`${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined
? { transferCache: localVarTransferCache }
: {}),
reportProgress: reportProgress,
},
);
}
public getAllPatents(
page: number = 0,
size: number = 10,
search?: string,
source?: string,
sortBy: string = 'date',
sortDirection: string = 'desc',
yearFrom?: number,
yearTo?: number,
): Observable<AllPatentsResponse> {
let params = new HttpParams()
.set('page', String(page))
.set('size', String(size))
.set('sort_by', sortBy)
.set('sort_direction', sortDirection);
if (search) params = params.set('search', search);
if (source) params = params.set('source', source);
if (yearFrom !== undefined)
params = params.set('year_from', String(yearFrom));
if (yearTo !== undefined) params = params.set('year_to', String(yearTo));
const localVarHeaders = this.defaultHeaders;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.get<AllPatentsResponse>(
`${basePath}/api/inse-service/patents`,
{
params,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
},
);
}
public getPatentById(
patentId: string,
title?: string,
prefix?: string,
fillingDate?: string,
): Observable<PatentEntry> {
const localVarHeaders = this.defaultHeaders;
const { basePath, withCredentials } = this.configuration;
let params = new HttpParams();
if (title) params = params.set('title', title);
if (prefix) params = params.set('prefix', prefix);
if (fillingDate) params = params.set('filling_date', fillingDate);
const localVarPath = `/api/inse-service/patents/${this.configuration.encodeParam(
{
name: 'patentId',
value: patentId,
in: 'path',
style: 'simple',
explode: false,
dataType: 'string',
dataFormat: undefined,
},
)}`;
return this.httpClient.get<PatentEntry>(`${basePath}${localVarPath}`, {
params,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
});
}
}
@@ -0,0 +1,4 @@
export interface MatchedAuthor {
openalex_author_id: string;
author_name: string;
}
+3
View File
@@ -103,6 +103,9 @@ export * from './newsArticle';
export * from './newsArticleDetail';
export * from './newsPage';
export * from './openAccess';
export * from './matchedAuthor';
export * from './orgPatentEntry';
export * from './orgPatentsResponse';
export * from './patentEntry';
export * from './patentsByAuthorResponse';
export * from './personBio';
@@ -0,0 +1,11 @@
import { PatentEntry } from './patentEntry';
import { MatchedAuthor } from './matchedAuthor';
export type OrgPatentMatchType = 'institution' | 'name' | 'both';
export interface OrgPatentEntry extends PatentEntry {
institution_id: string;
institution_name?: string | null;
match_type: OrgPatentMatchType;
matched_authors: MatchedAuthor[];
}
@@ -0,0 +1,12 @@
import { OrgPatentEntry } from './orgPatentEntry';
export type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both';
export interface OrgPatentsResponse {
institution_id: string;
institution_name?: string | null;
patent_count: number;
page: number;
size: number;
patents: Array<OrgPatentEntry>;
}
@@ -0,0 +1,8 @@
import { PatentEntry } from './patentEntry';
export interface PatentsByInstitutionResponse {
institution_id: string;
institution_name?: string | null;
patent_count: number;
patents: Array<PatentEntry>;
}
+15
View File
@@ -111,6 +111,14 @@ export const routes: Routes = [
publication: publicationResolver,
},
},
{
path: 'patent/:patentId',
canActivate: [userGuard],
loadComponent: () =>
import('./modules/patent-detail/patent-detail.component').then(
(mod) => mod.PatentDetailComponent,
),
},
{
path: 'projects/dfg/:id',
canActivate: [userGuard],
@@ -290,6 +298,13 @@ export const routes: Routes = [
);
},
},
{
path: 'patents',
loadComponent: () =>
import(
'./modules/institution-patents/institution-patents.component'
).then((mod) => mod.InstitutionPatentsComponent),
},
],
},
{
@@ -0,0 +1,193 @@
@if (loading) {
<p class="message">Lade Patente...</p>
} @else if (error) {
<p class="message">Fehler beim Laden der Patente.</p>
} @else if (patents.length === 0) {
<p class="message">Keine Patente in org_patents für diese Institution gefunden.</p>
<p class="message message-hint">
Der Index muss zuerst befüllt werden:
<code>python service/scripts/index_org_patents.py --institution-id {{ institutionId }}</code>
</p>
} @else {
<div class="patents-container">
<div class="patents-content">
<div class="patents-list">
<div class="patents-list-toolbar">
<label class="sort-control">
<span>Matching:</span>
<select [value]="activeMatchType" (change)="setMatchType($any($event.target).value)">
<option value="all">Alle</option>
<option value="institution">Institution</option>
<option value="name">Name</option>
<option value="both">Beides</option>
</select>
</label>
<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>
<label class="sort-control">
<span>Sortieren nach:</span>
<select [value]="sortMode" (change)="setSortMode($any($event.target).value)">
<option value="date">Datum</option>
<option value="title">Titel</option>
</select>
</label>
</div>
<table>
<thead>
<tr>
<th>Patent</th>
<th>Quelle</th>
<th>Jahr</th>
<th>Erfinder</th>
<th>Applicant/Assignee</th>
<th>Match-Typ</th>
<th>Personen</th>
</tr>
</thead>
<tbody>
@for (patent of getPagedPatents(); track trackPatent($index, patent)) {
<tr
[class.selected]="selectedPatent === patent"
(click)="selectPatent(patent)">
<td class="patent-title">{{ patent.title ?? patent.patent_id }}</td>
<td>
<span class="source-badge source-badge--{{ patent.source.toLowerCase() }}">
{{ patent.source }}
</span>
</td>
<td>{{ patent.publication_year ?? '-' }}</td>
<td class="cell-preview">{{ getInventorsPreview(patent) }}</td>
<td class="cell-preview">{{ getAssigneesPreview(patent) }}</td>
<td>
<span class="match-badge match-badge--{{ patent.match_type }}">
{{ getMatchTypeLabel(patent) }}
</span>
</td>
<td class="cell-authors">
@if (patent.matched_authors.length) {
@for (author of patent.matched_authors.slice(0, 2); track author.openalex_author_id) {
<a
class="author-link"
[routerLink]="['/person', author.openalex_author_id]"
(click)="$event.stopPropagation()">
{{ author.author_name }}
</a>
}
} @else {
<span>-</span>
}
</td>
</tr>
}
</tbody>
</table>
@if (hasPagination()) {
<div class="pagination">
<button [disabled]="selectedPage === 1" (click)="setPage(selectedPage - 1)">Zurück</button>
<span>Seite {{ selectedPage }} von {{ getPageCount() }}</span>
<button [disabled]="selectedPage === getPageCount()" (click)="setPage(selectedPage + 1)">Weiter</button>
</div>
}
</div>
@if (selectedPatent) {
<div class="patent-detail">
<h3>{{ selectedPatent.title ?? selectedPatent.patent_id }}</h3>
<div class="detail-stats">
<div class="stat">
<span class="stat-label">Quelle</span>
<span class="stat-value">
<span class="source-badge source-badge--{{ selectedPatent.source.toLowerCase() }}">
{{ selectedPatent.source }}
</span>
</span>
</div>
<div class="stat">
<span class="stat-label">Patent-Nr.</span>
<span class="stat-value">{{ selectedPatent.patent_id }}</span>
</div>
<div class="stat">
<span class="stat-label">Datum</span>
<span class="stat-value">{{ formatDate(selectedPatent.publication_date) }}</span>
</div>
<div class="stat">
<span class="stat-label">Match-Typ</span>
<span class="stat-value">{{ getMatchTypeLabel(selectedPatent) }}</span>
</div>
@if (getPublicationStageLabel(selectedPatent); as stageLabel) {
<div class="stat">
<span class="stat-label">Publikationsstufe</span>
<span class="stat-value">{{ stageLabel }}</span>
</div>
}
</div>
@if (selectedPatent.matched_authors.length) {
<div class="detail-section">
<h4>Verknüpfte Personen</h4>
<ul class="tag-list tag-list--compact">
@for (author of selectedPatent.matched_authors; track author.openalex_author_id) {
<li>
<a class="tag author-link" [routerLink]="['/person', author.openalex_author_id]">
{{ author.author_name }}
</a>
</li>
}
</ul>
</div>
}
@if (getAbstractPreview(selectedPatent.abstract); as abstractPreview) {
<p class="patent-detail-preview">{{ abstractPreview }}</p>
}
<button type="button" class="patent-detail-action" (click)="openDetail()">
<span class="patent-detail-action__label">Patentdetails anzeigen</span>
<span class="material-icons" aria-hidden="true">chevron_right</span>
</button>
<p class="patent-detail-hint">
Abstract, Erfinder, Anmelder und IPC/CPC-Klassifikation
</p>
</div>
} @else {
<div class="patent-detail overview">
<p class="overview-title">Patentübersicht</p>
<p class="overview-subtitle">
@if (institutionName) {
Alle Patente von {{ institutionName }} im Überblick.
} @else {
Alle Patente dieser Institution im Überblick.
}
</p>
<div class="overview-stats">
<div class="overview-stat">
<span class="overview-value">{{ totalPatents }}</span>
<span class="overview-label">Patente</span>
</div>
<div class="overview-stat">
<span class="overview-value">{{ getInstitutionMatchCount() }}</span>
<span class="overview-label">Institution</span>
</div>
<div class="overview-stat">
<span class="overview-value">{{ getNameMatchCount() }}</span>
<span class="overview-label">Name</span>
</div>
<div class="overview-stat">
<span class="overview-value">{{ getBothMatchCount() }}</span>
<span class="overview-label">Beides</span>
</div>
</div>
<p class="overview-hint">Wähle links ein Patent aus, um Kurzinfos und Details zu sehen.</p>
</div>
}
</div>
</div>
}
@@ -0,0 +1,633 @@
.message {
padding: 16px;
color: #666;
&.message-hint {
padding-top: 0;
font-size: 13px;
color: #888;
code {
display: inline-block;
margin-top: 6px;
padding: 4px 8px;
border-radius: 6px;
background: #f5f5f5;
color: #333;
font-size: 12px;
}
}
}
.patents-container {
padding: 16px;
display: flex;
flex-direction: column;
gap: 16px;
}
.sort-control {
display: inline-flex;
align-items: center;
gap: 6px;
width: fit-content;
padding: 10px 14px;
border-radius: 20px;
background: #f2f2f2;
color: #333;
font-size: 14px;
span {
color: #555;
}
select {
border: 0;
background: transparent;
color: #111827;
font: inherit;
cursor: pointer;
outline: none;
}
}
.patents-content {
display: flex;
gap: 24px;
align-items: flex-start;
}
.patents-list {
flex: 1;
&.hidden {
display: none;
}
.patents-list-toolbar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
margin-bottom: 18px;
flex-wrap: wrap;
}
table {
width: 100%;
border-collapse: collapse;
th {
text-align: left;
padding: 10px 12px;
border-bottom: 2px solid #e0e0e0;
font-weight: 600;
color: #333;
}
tr {
cursor: pointer;
&:hover {
background: #f5f5f5;
}
&.selected {
background: #f0f0f0;
}
}
td {
padding: 10px 12px;
border-bottom: 1px solid #f0f0f0;
}
.patent-title {
color: #333;
font-weight: 500;
max-width: 280px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.cell-preview {
max-width: 160px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
color: #555;
font-size: 13px;
}
.cell-authors {
display: flex;
flex-direction: column;
gap: 4px;
min-width: 120px;
}
}
}
.match-badge {
display: inline-flex;
align-items: center;
padding: 3px 10px;
border-radius: 999px;
font-size: 0.72rem;
font-weight: 700;
&--institution {
background: #f5f3ff;
color: #6d28d9;
border: 1px solid #ddd6fe;
}
&--name {
background: #fff7ed;
color: #c2410c;
border: 1px solid #fed7aa;
}
&--both {
background: #ecfdf5;
color: #047857;
border: 1px solid #a7f3d0;
}
}
.author-link {
color: #2563eb;
text-decoration: none;
font-size: 0.82rem;
&:hover {
text-decoration: underline;
}
}
.source-badge {
display: inline-flex;
align-items: center;
padding: 3px 10px;
border-radius: 999px;
font-size: 0.75rem;
font-weight: 700;
&--epo {
background: #effaf3;
color: #24834f;
border: 1px solid #bdebcf;
}
&--uspto {
background: #f0f6ff;
color: #0b63ce;
border: 1px solid #bdd4ff;
}
}
.patent-detail {
width: 440px;
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 20px;
background: #fafafa;
&.empty {
display: flex;
align-items: center;
justify-content: center;
color: #999;
min-height: 200px;
}
&.overview {
display: flex;
flex-direction: column;
gap: 12px;
.overview-title {
font-size: 15px;
font-weight: 600;
color: #333;
margin: 0;
}
.overview-subtitle {
font-size: 13px;
color: #888;
margin: 0;
}
.overview-stats {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
margin-top: 4px;
}
.overview-stat {
background: white;
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 12px 8px;
text-align: center;
.overview-value {
display: block;
font-size: 22px;
font-weight: 700;
color: #333;
}
.overview-label {
display: block;
font-size: 12px;
color: #888;
margin-top: 4px;
}
}
.overview-hint {
font-size: 12px;
color: #aaa;
margin: 0;
}
}
h3 {
margin: 0 0 16px 0;
font-size: 16px;
color: #333;
line-height: 1.4;
}
}
.detail-stats {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 10px;
.stat {
background: white;
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 10px;
text-align: center;
.stat-label {
display: block;
font-size: 11px;
color: #666;
margin-bottom: 4px;
text-transform: uppercase;
letter-spacing: 0.03em;
}
.stat-value {
display: block;
font-size: 15px;
font-weight: bold;
color: #333;
}
}
}
.patent-detail-preview {
margin: 14px 0 0;
font-size: 13px;
line-height: 1.55;
color: #555;
}
.patent-detail-action {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
width: 100%;
margin-top: 16px;
padding: 12px 14px;
border: 1px solid #bdd4ff;
border-radius: 10px;
background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
color: #0b63ce;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
&:hover {
border-color: #0b63ce;
background: #f0f6ff;
box-shadow: 0 2px 8px rgba(11, 99, 206, 0.12);
}
.material-icons {
font-size: 20px;
}
}
.patent-detail-hint {
margin: 8px 0 0;
font-size: 12px;
line-height: 1.4;
color: #888;
text-align: center;
}
.patent-full-detail {
flex: 1;
border: 1px solid #e0e0e0;
border-radius: 8px;
padding: 20px;
background: #fafafa;
h3 {
margin: 0 0 4px 0;
font-size: 16px;
color: #333;
line-height: 1.4;
}
h4 {
margin: 16px 0 8px 0;
font-size: 14px;
color: #555;
font-weight: 600;
}
p {
font-size: 13px;
color: #444;
line-height: 1.6;
margin: 0;
}
}
.back-btn {
display: inline-flex;
align-items: center;
gap: 0.4rem;
width: auto;
margin-bottom: 1rem;
padding: 0.5rem 0.85rem;
border: 1px solid #d6e3f8;
border-radius: 999px;
background: #f8fbff;
color: #2563eb;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
transition:
background-color 0.15s ease,
border-color 0.15s ease,
color 0.15s ease,
box-shadow 0.15s ease;
&:hover {
background: #eef5ff;
border-color: #bcd3f7;
color: #1d4ed8;
box-shadow: 0 1px 4px rgba(37, 99, 235, 0.12);
}
&:focus-visible {
outline: 2px solid #93c5fd;
outline-offset: 2px;
}
}
.detail-section {
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid #eee;
}
.patent-meta {
&--inline {
margin: 12px 0 20px;
}
&__list {
margin: 0;
border: 1px solid #e2e8f4;
border-radius: 12px;
background: linear-gradient(180deg, #fff 0%, #f8faff 100%);
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
overflow: hidden;
}
&__row {
display: grid;
grid-template-columns: minmax(130px, 38%) 1fr;
gap: 12px 16px;
align-items: center;
padding: 11px 16px;
border-top: 1px solid #eef2f8;
&:first-child {
border-top: 0;
}
dt {
margin: 0;
font-size: 12px;
font-weight: 500;
color: #64748b;
line-height: 1.35;
}
dd {
margin: 0;
font-size: 14px;
font-weight: 600;
color: #1e293b;
line-height: 1.35;
word-break: break-word;
}
}
}
.tag-list {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin: 0;
padding: 0;
list-style: none;
&--compact .tag {
font-size: 0.75rem;
padding: 3px 8px;
}
}
.tag {
padding: 4px 10px;
border-radius: 999px;
background: #f0f6ff;
border: 1px solid #dbeafe;
color: #1e40af;
font-size: 0.8rem;
line-height: 1.3;
}
.classification-section {
&--ipc .classification-card {
background: #f0f6ff;
border-color: #bfdbfe;
}
&--ipc .classification-badge--system {
background: #dbeafe;
color: #1d4ed8;
}
&--cpc .classification-card {
background: #f0fdf4;
border-color: #bbf7d0;
}
&--cpc .classification-badge--system {
background: #dcfce7;
color: #15803d;
}
}
.classification-cards {
display: flex;
flex-direction: column;
gap: 10px;
}
.classification-card {
padding: 12px 14px;
border-radius: 10px;
border: 1px solid #dbeafe;
}
.classification-card__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
flex-wrap: wrap;
}
.classification-card__codes {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.classification-card__badges {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.classification-code {
font-size: 0.9rem;
font-weight: 700;
color: #0f172a;
}
.classification-badge {
display: inline-flex;
align-items: center;
padding: 2px 8px;
border-radius: 999px;
font-size: 0.68rem;
font-weight: 700;
letter-spacing: 0.02em;
text-transform: uppercase;
}
.classification-badge--level {
background: #e2e8f0;
color: #475569;
}
.classification-summary {
margin: 10px 0 0;
font-size: 0.84rem;
line-height: 1.5;
color: #334155;
}
.classification-toggle {
margin-top: 6px;
padding: 0;
border: 0;
background: none;
color: #2563eb;
font-size: 0.78rem;
cursor: pointer;
&:hover {
text-decoration: underline;
}
}
.classification-hierarchy {
margin: 10px 0 0;
padding-top: 10px;
border-top: 1px solid rgba(15, 23, 42, 0.08);
}
.classification-hierarchy__row {
display: grid;
grid-template-columns: 88px 1fr;
gap: 8px;
margin-bottom: 6px;
dt {
margin: 0;
font-size: 0.72rem;
font-weight: 700;
color: #64748b;
text-transform: uppercase;
letter-spacing: 0.03em;
}
dd {
margin: 0;
font-size: 0.8rem;
line-height: 1.45;
color: #334155;
}
}
.pagination {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
margin-top: 12px;
button {
padding: 4px 10px;
border: 1px solid #d0d0d0;
border-radius: 6px;
background: white;
cursor: pointer;
font-size: 12px;
&:disabled {
opacity: 0.5;
cursor: default;
}
}
span {
font-size: 12px;
color: #666;
}
}
@@ -0,0 +1,275 @@
import { Component, OnInit, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { PatentsService } from '../../api/api/patents.service';
import { OrgPatentEntry } from '../../api/model/orgPatentEntry';
import { OrgPatentMatchTypeFilter } from '../../api/model/orgPatentsResponse';
import {
formatPatentDate,
getPublicationStageLabel,
} from '../patent-detail/patent-detail.utils';
type SortMode = 'date' | 'title';
type SourceFilter = 'all' | 'EPO' | 'USPTO';
@Component({
selector: 'app-institution-patents',
imports: [CommonModule, RouterLink],
templateUrl: './institution-patents.component.html',
styleUrl: './institution-patents.component.scss',
})
export class InstitutionPatentsComponent implements OnInit {
private route = inject(ActivatedRoute);
private router = inject(Router);
private patentsApi = inject(PatentsService);
patents: OrgPatentEntry[] = [];
filteredPatents: OrgPatentEntry[] = [];
institutionName: string | null = null;
institutionId: string | null = null;
selectedPatent: OrgPatentEntry | null = null;
loading = true;
error = false;
activeFilter: SourceFilter = 'all';
activeMatchType: OrgPatentMatchTypeFilter = 'all';
sortMode: SortMode = 'date';
selectedPage = 1;
readonly pageSize = 20;
totalPatents = 0;
ngOnInit(): void {
this.route.parent?.paramMap.subscribe((params) => {
const institutionId = params.get('institutionId') ?? '';
const filterFromUrl = this.route.snapshot.queryParamMap.get('filter');
const sortFromUrl = this.route.snapshot.queryParamMap.get('sortBy');
const matchTypeFromUrl = this.route.snapshot.queryParamMap.get('matchType');
if (this.isValidFilter(filterFromUrl)) {
this.activeFilter = filterFromUrl;
}
if (this.isValidSortMode(sortFromUrl)) {
this.sortMode = sortFromUrl;
}
if (this.isValidMatchType(matchTypeFromUrl)) {
this.activeMatchType = matchTypeFromUrl;
}
if (institutionId) {
this.institutionId = institutionId;
this.loadPatents(institutionId);
}
});
}
setFilter(filter: SourceFilter): void {
this.activeFilter = filter;
this.selectedPage = 1;
this.selectedPatent = null;
this.reloadPatents();
}
setMatchType(matchType: OrgPatentMatchTypeFilter): void {
if (this.activeMatchType === matchType) return;
this.activeMatchType = matchType;
this.selectedPage = 1;
this.selectedPatent = null;
this.reloadPatents();
}
setSortMode(sortMode: SortMode): void {
this.sortMode = sortMode;
this.filteredPatents = this.sortPatents(this.patents);
this.updateQueryParams();
}
selectPatent(patent: OrgPatentEntry): void {
this.selectedPatent = patent;
this.updateQueryParams();
}
openDetail(): void {
if (!this.selectedPatent) return;
this.router.navigate(['/patent', this.selectedPatent.patent_id]);
}
setPage(page: number): void {
this.selectedPage = Math.min(Math.max(page, 1), this.getPageCount());
this.selectedPatent = null;
this.reloadPatents();
}
getPagedPatents(): OrgPatentEntry[] {
return this.filteredPatents;
}
getPageCount(): number {
return Math.max(1, Math.ceil(this.totalPatents / this.pageSize));
}
hasPagination(): boolean {
return this.totalPatents > this.pageSize;
}
private reloadPatents(): void {
const institutionId = this.institutionId ??
this.route.parent?.snapshot.paramMap.get('institutionId') ?? '';
if (institutionId) {
this.loadPatents(institutionId);
}
}
private loadPatents(institutionId: string): void {
this.loading = true;
this.error = false;
this.patentsApi
.getOrgPatentsByInstitution(institutionId, 'body', false, {
matchType: this.activeMatchType,
page: this.selectedPage - 1,
size: this.pageSize,
source: this.activeFilter !== 'all' ? this.activeFilter : undefined,
})
.subscribe({
next: (result) => {
this.patents = result.patents ?? [];
this.totalPatents = result.patent_count ?? 0;
this.institutionName = result.institution_name ?? null;
this.filteredPatents = this.sortPatents(this.patents);
this.loading = false;
this.updateQueryParams();
},
error: () => {
this.error = true;
this.loading = false;
},
});
}
private sortPatents(patents: OrgPatentEntry[]): OrgPatentEntry[] {
if (this.sortMode === 'title') {
return [...patents].sort((a, b) =>
(a.title ?? '').localeCompare(b.title ?? '', 'de', { sensitivity: 'base' }),
);
}
return [...patents];
}
private updateQueryParams(): void {
this.router.navigate([], {
relativeTo: this.route,
queryParams: {
filter: this.activeFilter,
sortBy: this.sortMode,
matchType: this.activeMatchType,
page: this.selectedPage,
},
queryParamsHandling: 'merge',
replaceUrl: true,
});
}
private isValidFilter(value: string | null): value is SourceFilter {
return value === 'all' || value === 'EPO' || value === 'USPTO';
}
private isValidSortMode(value: string | null): value is SortMode {
return value === 'date' || value === 'title';
}
private isValidMatchType(value: string | null): value is OrgPatentMatchTypeFilter {
return value === 'all' || value === 'institution' || value === 'name' || value === 'both';
}
formatDate(date: string | null): string {
return formatPatentDate(date);
}
getEpoCount(): number {
return this.patents.filter((p) => p.source === 'EPO').length;
}
getUsptoCount(): number {
return this.patents.filter((p) => p.source === 'USPTO').length;
}
getInstitutionMatchCount(): number {
return this.patents.filter(
(p) => p.match_type === 'institution' || p.match_type === 'both',
).length;
}
getNameMatchCount(): number {
return this.patents.filter(
(p) => p.match_type === 'name' || p.match_type === 'both',
).length;
}
getBothMatchCount(): number {
return this.patents.filter((p) => p.match_type === 'both').length;
}
trackPatent(_index: number, patent: OrgPatentEntry): string {
return [
patent.source,
patent.patent_id,
patent.publication_date ?? '',
patent.kind ?? patent.application_type ?? '',
].join('|');
}
getAbstractPreview(abstract: string | null | undefined): string | null {
if (!abstract?.trim()) {
return null;
}
const text = abstract.trim();
if (text.length <= 160) {
return text;
}
return `${text.slice(0, 160).trimEnd()}…`;
}
getPublicationStageLabel(patent: OrgPatentEntry): string | null {
return getPublicationStageLabel(patent);
}
getMatchTypeLabel(patent: OrgPatentEntry): string {
switch (patent.match_type) {
case 'institution':
return 'Institution';
case 'name':
return 'Name';
case 'both':
return 'Beides';
default:
return patent.match_type;
}
}
getInventorsPreview(patent: OrgPatentEntry): string {
if (!patent.inventors?.length) {
return '-';
}
return patent.inventors.slice(0, 2).join(', ');
}
getAssigneesPreview(patent: OrgPatentEntry): string {
if (!patent.assignees?.length) {
return '-';
}
return patent.assignees.slice(0, 2).join(', ');
}
getMatchedAuthorsPreview(patent: OrgPatentEntry): string {
if (!patent.matched_authors?.length) {
return '-';
}
return patent.matched_authors
.slice(0, 2)
.map((author) => author.author_name)
.join(', ');
}
}
@@ -40,6 +40,7 @@ export class InstitutionComponent implements OnInit {
sort_direction: 'asc',
},
},
{ label: 'Patente', path: 'patents', disabled: false },
];
constructor(private readonly activatedRoute: ActivatedRoute) {}
@@ -78,6 +78,13 @@
<mat-icon>work</mat-icon>
Projekte
</a>
<a
mat-button
[routerLink]="['/institution', institutionId, 'patents']"
(click)="$event.stopPropagation()">
<mat-icon>verified</mat-icon>
Patente
</a>
</mat-card-actions>
</mat-card-footer>
</mat-card>
@@ -0,0 +1,319 @@
<div class="detail-page">
<button
type="button"
class="back-link"
(click)="navigateBack()"
aria-label="Zurück zu den Patenten">
<mat-icon>arrow_back</mat-icon>
Alle Patente
</button>
@if (loading) {
<div class="state">
<mat-spinner diameter="42"></mat-spinner>
<p>Patent wird geladen...</p>
</div>
} @else if (notFound || !patent) {
<div class="state error-state">
<mat-icon>search_off</mat-icon>
<h2>Patent nicht gefunden</h2>
<p>Das Patent konnte nicht geladen werden.</p>
<a mat-stroked-button routerLink="/patents"> Zur Patentübersicht </a>
</div>
} @else {
<header class="hero">
<div class="hero-copy">
<div class="eyebrow">
<span class="source-badge source-badge--{{ patent.source.toLowerCase() }}">
{{ patent.source }}
</span>
@if (patent.publication_year) {
<span>{{ patent.publication_year }}</span>
}
@if (stageLabel(); as stage) {
<span>{{ stage }}</span>
}
</div>
<h1>{{ patent.title || patent.patent_id || 'Ohne Titel' }}</h1>
<p class="meta-line">
<span>{{ patent.patent_id }}</span>
@if (patent.publication_date) {
<span>· {{ formatDate(patent.publication_date) }}</span>
}
</p>
<div class="hero-actions">
@for (link of externalLinks(); track link.url; let first = $first) {
<a
[class.primary-action]="first"
[attr.mat-flat-button]="first ? '' : null"
[attr.mat-stroked-button]="first ? null : ''"
[href]="link.url"
target="_blank"
rel="noopener">
{{ link.label }}
<mat-icon>open_in_new</mat-icon>
</a>
}
</div>
</div>
<div class="metrics" aria-label="Patentkennzahlen">
<div>
<mat-icon>groups</mat-icon>
<strong>{{ patent.inventors.length }}</strong>
<span>Erfinder</span>
</div>
<div>
<mat-icon>business</mat-icon>
<strong>{{ patent.assignees.length }}</strong>
<span>Anmelder</span>
</div>
<div>
<mat-icon>category</mat-icon>
<strong>{{ patent.ipc.length + patent.cpc.length }}</strong>
<span>Klassifikationen</span>
</div>
</div>
</header>
<div class="content-grid">
<main>
@if (patent.abstract) {
<section class="card abstract-card">
<div class="section-title">
<mat-icon>subject</mat-icon>
<h2>Abstract</h2>
</div>
<p>{{ patent.abstract }}</p>
</section>
}
<section class="card">
<div class="section-title">
<mat-icon>engineering</mat-icon>
<h2>Erfinder</h2>
<span>{{ patent.inventors.length }}</span>
</div>
<div class="tags">
@for (inventor of patent.inventors; track inventor) {
<span>{{ inventor }}</span>
} @empty {
<p class="empty">Keine Angaben vorhanden.</p>
}
</div>
</section>
@if (patent.assignees.length > 0) {
<section class="card">
<div class="section-title">
<mat-icon>account_balance</mat-icon>
<h2>Anmelder</h2>
<span>{{ patent.assignees.length }}</span>
</div>
<div class="compact-list">
@for (assignee of patent.assignees; track assignee) {
<div>
<strong>{{ assignee }}</strong>
</div>
}
</div>
</section>
}
@if (patent.ipc_descriptions.length > 0) {
<section class="card classification-card-section classification-card-section--ipc">
<div class="section-title">
<mat-icon>label</mat-icon>
<h2>Klassifikation (IPC)</h2>
</div>
<div class="classification-cards">
@for (
card of classificationCards(patent.ipc_descriptions, 'IPC');
track card.key
) {
<article class="classification-card">
<header class="classification-card__header">
<div class="classification-card__codes">
@for (symbol of card.symbols; track symbol) {
<span class="classification-code">{{ symbol }}</span>
}
</div>
<div class="classification-card__badges">
<span class="classification-badge classification-badge--system">
{{ card.system }}
</span>
<span class="classification-badge classification-badge--level">
{{ card.levelLabel }}
</span>
</div>
</header>
@if (card.primaryDescription) {
<p class="classification-summary">
{{
isClassificationExpanded(card.key)
? card.primaryDescription
: getDescriptionPreview(card.primaryDescription)
}}
</p>
@if (isLongDescription(card.primaryDescription)) {
<button
type="button"
class="classification-toggle"
(click)="toggleClassificationExpanded(card.key)">
{{
isClassificationExpanded(card.key)
? 'Weniger anzeigen'
: 'Mehr anzeigen'
}}
</button>
}
}
@if (card.hierarchy.length > 0) {
<dl class="classification-hierarchy">
@for (row of card.hierarchy; track row.label) {
<div class="classification-hierarchy__row">
<dt>{{ row.label }}</dt>
<dd>{{ row.value }}</dd>
</div>
}
</dl>
}
</article>
}
</div>
</section>
} @else if (patent.ipc.length > 0) {
<section class="card">
<div class="section-title">
<mat-icon>label</mat-icon>
<h2>Klassifikation (IPC)</h2>
</div>
<div class="tags">
@for (ipc of patent.ipc; track ipc) {
<span>{{ ipc }}</span>
}
</div>
</section>
}
@if (patent.cpc_descriptions.length > 0) {
<section class="card classification-card-section classification-card-section--cpc">
<div class="section-title">
<mat-icon>label</mat-icon>
<h2>Klassifikation (CPC)</h2>
</div>
<div class="classification-cards">
@for (
card of classificationCards(patent.cpc_descriptions, 'CPC');
track card.key
) {
<article class="classification-card">
<header class="classification-card__header">
<div class="classification-card__codes">
@for (symbol of card.symbols; track symbol) {
<span class="classification-code">{{ symbol }}</span>
}
</div>
<div class="classification-card__badges">
<span class="classification-badge classification-badge--system">
{{ card.system }}
</span>
<span class="classification-badge classification-badge--level">
{{ card.levelLabel }}
</span>
</div>
</header>
@if (card.primaryDescription) {
<p class="classification-summary">
{{
isClassificationExpanded(card.key)
? card.primaryDescription
: getDescriptionPreview(card.primaryDescription)
}}
</p>
@if (isLongDescription(card.primaryDescription)) {
<button
type="button"
class="classification-toggle"
(click)="toggleClassificationExpanded(card.key)">
{{
isClassificationExpanded(card.key)
? 'Weniger anzeigen'
: 'Mehr anzeigen'
}}
</button>
}
}
@if (card.hierarchy.length > 0) {
<dl class="classification-hierarchy">
@for (row of card.hierarchy; track row.label) {
<div class="classification-hierarchy__row">
<dt>{{ row.label }}</dt>
<dd>{{ row.value }}</dd>
</div>
}
</dl>
}
</article>
}
</div>
</section>
} @else if (patent.cpc.length > 0) {
<section class="card">
<div class="section-title">
<mat-icon>label</mat-icon>
<h2>Klassifikation (CPC)</h2>
</div>
<div class="tags">
@for (cpc of patent.cpc; track cpc) {
<span>{{ cpc }}</span>
}
</div>
</section>
}
</main>
<aside>
<section class="card facts-card">
<div class="section-title">
<mat-icon>info</mat-icon>
<h2>Patentdaten</h2>
</div>
<dl>
@for (row of metadataRows(); track row.label) {
<div>
<dt>{{ row.label }}</dt>
<dd>
@if (row.variant === 'source') {
<span class="source-badge source-badge--{{ row.value.toLowerCase() }}">
{{ row.value }}
</span>
} @else {
{{ row.value }}
}
</dd>
</div>
}
</dl>
</section>
@if (externalLinks().length) {
<section class="card">
<div class="section-title">
<mat-icon>link</mat-icon>
<h2>Externe Links</h2>
</div>
<div class="link-list">
@for (link of externalLinks(); track link.url) {
<a [href]="link.url" target="_blank" rel="noopener">
<span>{{ link.label }}</span>
<mat-icon>north_east</mat-icon>
</a>
}
</div>
</section>
}
</aside>
</div>
}
</div>
@@ -0,0 +1,462 @@
:host {
display: block;
background: var(--sg-background);
}
.detail-page {
max-width: 1500px;
margin: 0 auto;
padding: 26px 32px 56px;
}
.back-link {
display: inline-flex;
align-items: center;
gap: 7px;
margin-bottom: 22px;
padding: 0;
border: 0;
background: transparent;
color: var(--sg-text-muted);
font-size: 13px;
font-weight: 600;
text-decoration: none;
cursor: pointer;
}
.back-link mat-icon {
width: 18px;
height: 18px;
font-size: 18px;
}
.hero {
display: grid;
grid-template-columns: minmax(0, 1fr) 420px;
gap: 42px;
padding: 38px 42px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-lg);
background:
radial-gradient(
circle at 90% 10%,
rgba(200, 217, 255, 0.75),
transparent 35%
),
linear-gradient(140deg, #fff 0%, #f8faff 100%);
box-shadow: var(--sg-shadow-sm);
}
.eyebrow,
.tags,
.hero-actions {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.eyebrow span {
padding: 5px 10px;
border: 1px solid var(--sg-border);
border-radius: 999px;
background: rgba(255, 255, 255, 0.85);
color: var(--sg-text-muted);
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
}
h1 {
max-width: 920px;
margin: 20px 0 13px;
font-size: clamp(27px, 3vw, 42px);
line-height: 1.13;
}
.meta-line {
max-width: 900px;
margin: 0;
color: var(--sg-text-muted);
font-size: 14px;
line-height: 1.7;
}
.hero-actions {
margin-top: 26px;
}
.hero-actions a {
display: inline-flex;
align-items: center;
gap: 8px;
min-height: 42px;
padding: 9px 16px;
border: 1px solid var(--sg-border-strong);
border-radius: var(--sg-radius-sm);
background: #fff;
color: var(--sg-text);
font-weight: 700;
text-decoration: none;
}
.hero-actions a.primary-action {
border-color: var(--sg-primary);
background: var(--sg-primary);
color: #fff;
}
.hero-actions mat-icon {
width: 17px;
height: 17px;
font-size: 17px;
}
.metrics {
display: grid;
grid-template-columns: repeat(3, 1fr);
align-self: center;
overflow: hidden;
border: 1px solid rgba(199, 211, 232, 0.8);
border-radius: var(--sg-radius-md);
background: rgba(255, 255, 255, 0.8);
}
.metrics div {
display: flex;
align-items: center;
flex-direction: column;
gap: 5px;
padding: 22px 10px;
text-align: center;
}
.metrics div + div {
border-left: 1px solid var(--sg-border);
}
.metrics mat-icon {
color: var(--sg-text-soft);
}
.metrics strong {
color: var(--sg-text);
font-family: 'Montserrat', 'Open Sans', sans-serif;
font-size: 22px;
}
.metrics span {
color: var(--sg-text-muted);
font-size: 11px;
}
.content-grid {
display: grid;
grid-template-columns: minmax(0, 1fr) 380px;
gap: 24px;
margin-top: 24px;
}
main,
aside {
display: flex;
flex-direction: column;
gap: 24px;
}
.card {
padding: 26px 28px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-md);
background: var(--sg-surface);
box-shadow: var(--sg-shadow-sm);
}
.section-title {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 20px;
}
.section-title mat-icon {
color: var(--sg-text-muted);
}
.section-title h2 {
margin: 0;
font-size: 16px;
}
.section-title span {
margin-left: auto;
color: var(--sg-text-muted);
font-size: 12px;
}
.abstract-card p {
margin: 0;
color: var(--sg-text);
font-size: 14px;
line-height: 1.8;
}
.tags span {
padding: 7px 10px;
border: 1px solid var(--sg-border);
border-radius: 999px;
color: var(--sg-text-muted);
font-size: 11px;
}
.compact-list,
.link-list {
display: grid;
gap: 10px;
}
.compact-list div {
display: flex;
align-items: flex-start;
flex-direction: column;
gap: 3px;
padding: 13px 0;
border-bottom: 1px solid var(--sg-border);
}
.compact-list div:last-child {
border-bottom: 0;
}
.compact-list strong {
font-size: 12px;
}
dl {
margin: 0;
}
dl div {
display: grid;
grid-template-columns: 115px minmax(0, 1fr);
gap: 12px;
padding: 10px 0;
border-bottom: 1px solid var(--sg-border);
}
dl div:last-child {
border-bottom: 0;
}
dt {
color: var(--sg-text-muted);
font-size: 12px;
}
dd {
margin: 0;
overflow-wrap: anywhere;
color: var(--sg-text);
font-size: 12px;
font-weight: 600;
text-align: right;
}
.link-list a {
display: flex;
align-items: center;
justify-content: space-between;
padding: 10px 0;
border-bottom: 1px solid var(--sg-border);
color: var(--sg-text);
font-size: 12px;
font-weight: 700;
text-decoration: none;
}
.link-list a:last-child {
border-bottom: 0;
}
.link-list mat-icon {
width: 16px;
height: 16px;
color: var(--sg-text-muted);
font-size: 16px;
}
.state {
display: grid;
place-items: center;
min-height: 380px;
color: var(--sg-text-muted);
text-align: center;
}
.error-state mat-icon {
width: 46px;
height: 46px;
font-size: 46px;
}
.empty {
color: var(--sg-text-muted);
}
.source-badge {
display: inline-flex;
align-items: center;
padding: 4px 10px;
border-radius: 999px;
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
}
.source-badge--epo {
background: #e8f7ee;
color: #1f7a43;
}
.source-badge--uspto {
background: #eef3ff;
color: #1f4fbf;
}
.classification-cards {
display: grid;
gap: 12px;
}
.classification-card {
padding: 16px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
background: var(--sg-surface-muted);
}
.classification-card-section--ipc .classification-card {
background: #f4f8ff;
}
.classification-card-section--cpc .classification-card {
background: #f3fbf5;
}
.classification-card__header {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
margin-bottom: 10px;
}
.classification-card__codes {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.classification-code {
padding: 4px 8px;
border-radius: 6px;
background: #fff;
color: var(--sg-text);
font-size: 12px;
font-weight: 700;
}
.classification-card__badges {
display: flex;
flex-wrap: wrap;
gap: 6px;
}
.classification-badge {
padding: 3px 8px;
border-radius: 999px;
font-size: 10px;
font-weight: 700;
text-transform: uppercase;
}
.classification-badge--system {
background: #e8eef8;
color: #35507a;
}
.classification-badge--level {
background: #fff;
color: var(--sg-text-muted);
}
.classification-summary {
margin: 0 0 8px;
color: var(--sg-text);
font-size: 13px;
line-height: 1.6;
}
.classification-toggle {
padding: 0;
border: 0;
background: transparent;
color: var(--sg-primary);
font-size: 12px;
font-weight: 700;
cursor: pointer;
}
.classification-hierarchy {
margin: 12px 0 0;
}
.classification-hierarchy__row {
display: grid;
grid-template-columns: 90px minmax(0, 1fr);
gap: 10px;
padding: 6px 0;
border-top: 1px solid rgba(0, 0, 0, 0.06);
}
.classification-hierarchy__row dt {
color: var(--sg-text-muted);
font-size: 11px;
}
.classification-hierarchy__row dd {
margin: 0;
color: var(--sg-text);
font-size: 12px;
text-align: left;
}
@media (max-width: 1150px) {
.hero,
.content-grid {
grid-template-columns: 1fr;
}
.metrics {
width: 100%;
}
}
@media (max-width: 700px) {
.detail-page {
padding: 18px 16px 40px;
}
.hero,
.card {
padding: 22px 20px;
}
.metrics {
grid-template-columns: 1fr;
}
.metrics div + div {
border-top: 1px solid var(--sg-border);
border-left: 0;
}
}
@@ -0,0 +1,139 @@
import { Location } from '@angular/common';
import { Component, DestroyRef, OnInit, inject } from '@angular/core';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { ActivatedRoute, RouterLink } from '@angular/router';
import { finalize } from 'rxjs';
import { PatentsService } from '../../api/api/patents.service';
import { PatentEntry } from '../../api/model/patentEntry';
import {
ClassificationCard,
ClassificationSystem,
formatPatentDate,
getClassificationCards,
getDescriptionPreview,
getPatentMetadataRows,
getPublicationStageLabel,
isLongDescription,
patentExternalLinks,
} from './patent-detail.utils';
@Component({
selector: 'app-patent-detail',
imports: [
MatButtonModule,
MatIconModule,
MatProgressSpinnerModule,
RouterLink,
],
templateUrl: './patent-detail.component.html',
styleUrl: './patent-detail.component.scss',
})
export class PatentDetailComponent implements OnInit {
private readonly destroyRef = inject(DestroyRef);
private readonly route = inject(ActivatedRoute);
private readonly patentsService = inject(PatentsService);
private readonly location = inject(Location);
patent: PatentEntry | null = null;
loading = true;
notFound = false;
private expandedClassificationKeys = new Set<string>();
ngOnInit(): void {
this.route.paramMap
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((params) => {
const patentId = params.get('patentId');
if (!patentId) {
this.loading = false;
this.notFound = true;
return;
}
const title =
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);
});
}
navigateBack(): void {
this.location.back();
}
formatDate(date: string | null | undefined): string {
return formatPatentDate(date);
}
metadataRows() {
return this.patent ? getPatentMetadataRows(this.patent) : [];
}
stageLabel(): string | null {
return this.patent ? getPublicationStageLabel(this.patent) : null;
}
externalLinks() {
return this.patent ? patentExternalLinks(this.patent) : [];
}
classificationCards(
entries: PatentEntry['ipc_descriptions'],
system: ClassificationSystem,
): ClassificationCard[] {
return getClassificationCards(entries, system);
}
toggleClassificationExpanded(key: string): void {
if (this.expandedClassificationKeys.has(key)) {
this.expandedClassificationKeys.delete(key);
return;
}
this.expandedClassificationKeys.add(key);
}
isClassificationExpanded(key: string): boolean {
return this.expandedClassificationKeys.has(key);
}
isLongDescription(text: string | null): boolean {
return isLongDescription(text);
}
getDescriptionPreview(text: string | null): string {
return getDescriptionPreview(text);
}
private loadPatent(
patentId: string,
title?: string,
prefix?: string,
fillingDate?: string,
): void {
this.loading = true;
this.notFound = false;
this.patent = null;
this.expandedClassificationKeys.clear();
this.patentsService
.getPatentById(patentId, title, prefix, fillingDate)
.pipe(finalize(() => (this.loading = false)))
.subscribe({
next: (patent) => {
this.patent = patent;
},
error: () => {
this.notFound = true;
},
});
}
}
@@ -0,0 +1,205 @@
import { IpcClassification, PatentEntry } from '../../api/model/patentEntry';
export type ClassificationSystem = 'IPC' | 'CPC';
export interface ClassificationCard {
key: string;
symbols: string[];
system: ClassificationSystem;
levelLabel: string;
primaryDescription: string | null;
hierarchy: { label: string; value: string }[];
}
export interface PatentMetadataRow {
label: string;
value: string;
variant?: 'source';
}
const DESCRIPTION_PREVIEW_LENGTH = 140;
export function formatPatentDate(date: string | null | undefined): string {
if (!date) return '-';
const normalized = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3');
const parsed = new Date(normalized);
if (isNaN(parsed.getTime())) return date;
return new Intl.DateTimeFormat('de-DE').format(parsed);
}
export function formatMetadataLabel(value: string): string {
return value
.replace(/_/g, ' ')
.toLowerCase()
.replace(/\b\w/g, (char) => char.toUpperCase());
}
export function getPublicationStageLabel(patent: PatentEntry): string | null {
return patent.kind ?? patent.application_type ?? null;
}
export function getPatentMetadataRows(patent: PatentEntry): PatentMetadataRow[] {
const rows: PatentMetadataRow[] = [
{ label: 'Quelle', value: patent.source, variant: 'source' },
{ label: 'Patent-Nr.', value: patent.patent_id },
];
if (patent.publication_date) {
rows.push({
label: 'Veröffentlichungsdatum',
value: formatPatentDate(patent.publication_date),
});
}
if (patent.application_number) {
rows.push({ label: 'Anmeldungsnummer', value: patent.application_number });
}
if (patent.application_date) {
rows.push({
label: 'Anmeldedatum',
value: formatPatentDate(patent.application_date),
});
}
const stageLabel = getPublicationStageLabel(patent);
if (stageLabel) {
rows.push({
label: patent.kind ? 'Publikationsstufe' : 'Anmeldungstyp',
value: patent.kind ? stageLabel : formatMetadataLabel(stageLabel),
});
}
if (patent.number_of_claims != null) {
rows.push({ label: 'Ansprüche', value: String(patent.number_of_claims) });
}
if (patent.status) {
rows.push({ label: 'Status', value: formatMetadataLabel(patent.status) });
}
return rows;
}
export function getClassificationCards(
entries: IpcClassification[] | undefined,
system: ClassificationSystem,
): ClassificationCard[] {
if (!entries?.length) return [];
const merged = new Map<string, ClassificationCard>();
for (const entry of entries) {
const card = buildClassificationCard(entry, system);
const mergeKey =
card.primaryDescription?.toLocaleLowerCase('en') ??
card.symbols[0] ??
card.key;
const existing = merged.get(mergeKey);
if (existing) {
for (const symbol of card.symbols) {
if (!existing.symbols.includes(symbol)) {
existing.symbols.push(symbol);
}
}
continue;
}
merged.set(mergeKey, card);
}
return [...merged.values()];
}
export function isLongDescription(text: string | null): boolean {
return !!text && text.length > DESCRIPTION_PREVIEW_LENGTH;
}
export function getDescriptionPreview(text: string | null): string {
if (!text) return '';
if (text.length <= DESCRIPTION_PREVIEW_LENGTH) return text;
return `${text.slice(0, DESCRIPTION_PREVIEW_LENGTH).trimEnd()}…`;
}
export function patentExternalLinks(patent: PatentEntry): { label: string; url: string }[] {
const links: { label: string; url: string }[] = [];
const encodedId = encodeURIComponent(patent.patent_id);
if (patent.source === 'EPO') {
links.push({
label: 'Espacenet',
url: `https://worldwide.espacenet.com/patent/search?q=pn%3D${encodedId}`,
});
}
if (patent.source === 'USPTO') {
links.push({
label: 'Google Patents',
url: `https://patents.google.com/patent/${encodedId}`,
});
}
return links;
}
function buildClassificationCard(
entry: IpcClassification,
system: ClassificationSystem,
): ClassificationCard {
const level = getClassificationLevel(entry);
const primaryDescription = extractDescriptionText(entry[level.field]);
return {
key: `${system}-${entry.symbol}`,
symbols: [entry.symbol],
system,
levelLabel: level.label,
primaryDescription,
hierarchy: buildHierarchyRows(entry, primaryDescription),
};
}
function getClassificationLevel(entry: IpcClassification): {
label: string;
field: keyof IpcClassification;
} {
if (entry.subgroup) return { label: 'Untergruppe', field: 'subgroup' };
if (entry.main_group) return { label: 'Hauptgruppe', field: 'main_group' };
if (entry.subclass) return { label: 'Unterklasse', field: 'subclass' };
if (entry.section) return { label: 'Sektion', field: 'section' };
return { label: 'Code', field: 'symbol' };
}
function buildHierarchyRows(
entry: IpcClassification,
primaryDescription: string | null,
): { label: string; value: string }[] {
const rows: { label: string; value: string }[] = [];
const seen = new Set<string>();
const addRow = (label: string, raw: string | null) => {
const value = extractDescriptionText(raw);
if (!value) return;
const normalized = value.toLocaleLowerCase('en');
if (seen.has(normalized) || normalized === primaryDescription?.toLocaleLowerCase('en')) {
return;
}
seen.add(normalized);
rows.push({ label, value });
};
addRow('Sektion', entry.section);
addRow('Klasse', entry.class);
addRow('Unterklasse', entry.subclass);
return rows;
}
function extractDescriptionText(value: string | null | undefined): string | null {
if (!value?.trim()) return null;
const text = value.includes(' - ')
? value.split(' - ').slice(1).join(' - ').trim()
: value.trim();
if (!text) return null;
const firstSentence = text.split(/[;|]/)[0]?.trim() ?? text;
if (firstSentence !== firstSentence.toUpperCase()) return firstSentence;
return firstSentence.charAt(0) + firstSentence.slice(1).toLowerCase();
}
@@ -26,13 +26,52 @@
<mat-chip-option value="USPTO">USPTO</mat-chip-option>
</mat-chip-listbox>
<div class="sorting">
<select
(change)="setSortDirection($any($event.target).value)"
[value]="sortDirection">
<option value="desc">Absteigend</option>
<option value="asc">Aufsteigend</option>
</select>
<div class="year-filter">
<div class="year-filter-top">
<span class="year-filter-label">Zeitraum</span>
<button
type="button"
class="reset-range-button"
[disabled]="!canResetYearRange"
(click)="resetYearRange()">
Zurücksetzen
</button>
</div>
<div class="year-filter-values">
<span>{{ selectedStartYear }}</span>
<span>bis</span>
<span>{{ selectedEndYear }}</span>
</div>
<div
class="year-range-slider"
[style.--range-start]="rangeStartPercent"
[style.--range-end]="rangeEndPercent">
<div class="range-track"></div>
<input
class="range-input range-input-start"
type="range"
[min]="minYear"
[max]="maxYear"
[value]="selectedStartYear"
[style.z-index]="selectedStartYear >= selectedEndYear - 5 ? 4 : 2"
(input)="onStartYearInput($event)"
aria-label="Startjahr" />
<input
class="range-input range-input-end"
type="range"
[min]="minYear"
[max]="maxYear"
[value]="selectedEndYear"
(input)="onEndYearInput($event)"
aria-label="Endjahr" />
</div>
<div class="year-filter-bounds">
<span>{{ minYear }}</span>
<span>{{ maxYear }}</span>
</div>
</div>
</div>
</div>
@@ -46,172 +85,31 @@
</div>
} @else if (error) {
<p class="state-message error">Fehler beim Laden der Patente.</p>
} @else if (showDetail && selectedPatent) {
<div class="detail-view">
<button type="button" class="back-btn" (click)="closeDetail()">
← Zurück zu den Patenten
</button>
<h2>{{ selectedPatent.title ?? selectedPatent.patent_id }}</h2>
<div class="patent-meta__list">
@for (row of getPatentMetadataRows(selectedPatent); track row.label) {
<div class="patent-meta__row">
<dt>{{ row.label }}</dt>
<dd>
@if (row.variant === 'source') {
<span class="source-badge source-badge--{{ row.value.toLowerCase() }}">{{ row.value }}</span>
} @else {
{{ row.value }}
}
</dd>
</div>
}
</div>
@if (selectedPatent.abstract) {
<div class="detail-section">
<h4>Abstract</h4>
<p>{{ selectedPatent.abstract }}</p>
</div>
}
<div class="detail-section">
<h4>Erfinder</h4>
<ul class="tag-list">
@for (inv of selectedPatent.inventors; track inv) {
<li class="tag">{{ inv }}</li>
}
</ul>
</div>
@if (selectedPatent.assignees.length > 0) {
<div class="detail-section">
<h4>Anmelder</h4>
<ul class="tag-list">
@for (a of selectedPatent.assignees; track a) {
<li class="tag">{{ a }}</li>
}
</ul>
</div>
}
@if (selectedPatent.ipc_descriptions.length > 0) {
<div class="detail-section classification-section classification-section--ipc">
<h4>Klassifikation (IPC)</h4>
<div class="classification-cards">
@for (card of getClassificationCards(selectedPatent.ipc_descriptions, 'IPC'); track card.key) {
<article class="classification-card">
<header class="classification-card__header">
<div class="classification-card__codes">
@for (sym of card.symbols; track sym) {
<span class="classification-code">{{ sym }}</span>
}
</div>
<div class="classification-card__badges">
<span class="classification-badge classification-badge--system">{{ card.system }}</span>
<span class="classification-badge classification-badge--level">{{ card.levelLabel }}</span>
</div>
</header>
@if (card.primaryDescription) {
<p class="classification-summary">
{{ isClassificationExpanded(card.key) ? card.primaryDescription : getDescriptionPreview(card.primaryDescription) }}
</p>
@if (isLongDescription(card.primaryDescription)) {
<button type="button" class="classification-toggle" (click)="toggleClassificationExpanded(card.key)">
{{ isClassificationExpanded(card.key) ? 'Weniger anzeigen' : 'Mehr anzeigen' }}
</button>
}
}
@if (card.hierarchy.length > 0) {
<dl class="classification-hierarchy">
@for (row of card.hierarchy; track row.label) {
<div class="classification-hierarchy__row">
<dt>{{ row.label }}</dt>
<dd>{{ row.value }}</dd>
</div>
}
</dl>
}
</article>
}
</div>
</div>
} @else if (selectedPatent.ipc.length > 0) {
<div class="detail-section">
<h4>Klassifikation (IPC)</h4>
<ul class="tag-list tag-list--compact">
@for (ipc of selectedPatent.ipc; track ipc) {
<li class="tag">{{ ipc }}</li>
}
</ul>
</div>
}
@if (selectedPatent.cpc_descriptions.length > 0) {
<div class="detail-section classification-section classification-section--cpc">
<h4>Klassifikation (CPC)</h4>
<div class="classification-cards">
@for (card of getClassificationCards(selectedPatent.cpc_descriptions, 'CPC'); track card.key) {
<article class="classification-card">
<header class="classification-card__header">
<div class="classification-card__codes">
@for (sym of card.symbols; track sym) {
<span class="classification-code">{{ sym }}</span>
}
</div>
<div class="classification-card__badges">
<span class="classification-badge classification-badge--system">{{ card.system }}</span>
<span class="classification-badge classification-badge--level">{{ card.levelLabel }}</span>
</div>
</header>
@if (card.primaryDescription) {
<p class="classification-summary">
{{ isClassificationExpanded(card.key) ? card.primaryDescription : getDescriptionPreview(card.primaryDescription) }}
</p>
@if (isLongDescription(card.primaryDescription)) {
<button type="button" class="classification-toggle" (click)="toggleClassificationExpanded(card.key)">
{{ isClassificationExpanded(card.key) ? 'Weniger anzeigen' : 'Mehr anzeigen' }}
</button>
}
}
@if (card.hierarchy.length > 0) {
<dl class="classification-hierarchy">
@for (row of card.hierarchy; track row.label) {
<div class="classification-hierarchy__row">
<dt>{{ row.label }}</dt>
<dd>{{ row.value }}</dd>
</div>
}
</dl>
}
</article>
}
</div>
</div>
} @else if (selectedPatent.cpc.length > 0) {
<div class="detail-section">
<h4>Klassifikation (CPC)</h4>
<ul class="tag-list tag-list--compact">
@for (cpc of selectedPatent.cpc; track cpc) {
<li class="tag">{{ cpc }}</li>
}
</ul>
</div>
}
</div>
} @else if (patents.length === 0) {
<div class="no-results">
<p>Keine Patente gefunden.</p>
</div>
} @else {
<div class="cards">
@for (patent of patents; track patent.patent_id + (patent.publication_date ?? '')) {
<mat-card class="card" appearance="outlined" (click)="selectPatent(patent)">
@for (
patent of patents;
track patent.patent_id + (patent.publication_date ?? '')
) {
<mat-card
class="card"
appearance="outlined"
(click)="openPatent(patent)">
<mat-card-header>
<mat-card-title>{{ patent.title ?? patent.patent_id }}</mat-card-title>
<mat-card-title>{{
patent.title ?? patent.patent_id
}}</mat-card-title>
<mat-card-subtitle>
<span class="source-badge source-badge--{{ patent.source.toLowerCase() }}">{{ patent.source }}</span>
<span
class="source-badge source-badge--{{
patent.source.toLowerCase()
}}"
>{{ patent.source }}</span
>
</mat-card-subtitle>
</mat-card-header>
<mat-card-content class="card-content">
@@ -224,7 +122,9 @@
</mat-card-content>
<mat-card-footer>
<mat-card-actions>
<button mat-button (click)="selectPatent(patent); $event.stopPropagation()">
<button
mat-button
(click)="openPatent(patent); $event.stopPropagation()">
<mat-icon>info</mat-icon>
Übersicht
</button>
@@ -237,12 +137,10 @@
<mat-divider />
@if (!showDetail) {
<mat-paginator
<mat-paginator
[length]="total"
[pageSize]="pageSize"
[pageIndex]="page"
[pageSizeOptions]="[10, 25, 50]"
(page)="handlePageChange($event)" />
}
</div>
@@ -12,20 +12,6 @@ h1 {
padding: 1rem 0 0;
}
.sorting {
display: flex;
justify-content: flex-end;
gap: 0.5rem;
select {
padding: 0.75rem;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
font-size: 1rem;
cursor: pointer;
}
}
.search-and-filter {
padding: 0 1rem;
display: flex;
@@ -37,8 +23,140 @@ h1 {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 1rem;
}
.year-filter {
width: min(285px, 100%);
padding: 8px 10px;
border: 1px solid #dbe5f6;
border-radius: 10px;
background: #fbfdff;
box-sizing: border-box;
}
.year-filter-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 10px;
margin-bottom: 4px;
}
.year-filter-label {
color: #07163d;
font-size: 12px;
font-weight: 700;
}
.reset-range-button {
border: 0;
background: transparent;
color: #0057ff;
font-size: 11px;
cursor: pointer;
padding: 0;
font-family: inherit;
&:disabled {
color: #9aa5bc;
cursor: default;
}
}
.year-filter-values {
display: flex;
align-items: center;
justify-content: center;
gap: 7px;
margin-bottom: 5px;
color: #40506f;
font-size: 12px;
font-weight: 600;
}
.year-filter-bounds {
display: flex;
justify-content: space-between;
margin-top: 1px;
color: #7c88a3;
font-size: 10px;
}
.year-range-slider {
--range-start: 0%;
--range-end: 100%;
--accent: #0057ff;
position: relative;
height: 22px;
}
.range-track {
position: absolute;
top: 50%;
left: 0;
right: 0;
height: 5px;
transform: translateY(-50%);
border-radius: 999px;
background: linear-gradient(
to right,
#d8e2f4 0%,
#d8e2f4 var(--range-start),
var(--accent) var(--range-start),
var(--accent) var(--range-end),
#d8e2f4 var(--range-end),
#d8e2f4 100%
);
}
.range-input {
position: absolute;
inset: 0;
width: 100%;
height: 22px;
margin: 0;
appearance: none;
background: transparent;
pointer-events: none;
&::-webkit-slider-runnable-track,
&::-moz-range-track {
height: 5px;
background: transparent;
border: none;
}
&::-webkit-slider-thumb {
appearance: none;
width: 15px;
height: 15px;
margin-top: -5px;
border: 2px solid #ffffff;
border-radius: 50%;
background: #0057ff;
box-shadow: 0 0 0 1px #9ab7ff, 0 2px 6px rgba(0, 87, 255, 0.22);
cursor: pointer;
pointer-events: auto;
}
&::-moz-range-thumb {
width: 15px;
height: 15px;
border: 2px solid #ffffff;
border-radius: 50%;
background: #0057ff;
box-shadow: 0 0 0 1px #9ab7ff, 0 2px 6px rgba(0, 87, 255, 0.22);
cursor: pointer;
pointer-events: auto;
}
}
.range-input-start { z-index: 2; }
.range-input-end { z-index: 3; }
.state-message {
display: flex;
align-items: center;
@@ -58,15 +176,11 @@ h1 {
}
@media (max-width: 900px) {
.cards {
grid-template-columns: repeat(2, 1fr);
}
.cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
.cards {
grid-template-columns: 1fr;
}
.cards { grid-template-columns: 1fr; }
}
mat-paginator {
@@ -13,21 +13,11 @@ import { MatDividerModule } from '@angular/material/divider';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { debounceTime, distinctUntilChanged, Subject } from 'rxjs';
import { PatentsService } from '../../api/api/patents.service';
import { PatentEntry, IpcClassification } from '../../api/model/patentEntry';
import { PatentEntry } from '../../api/model/patentEntry';
type SourceFilter = 'all' | 'EPO' | 'USPTO';
type ClassificationSystem = 'IPC' | 'CPC';
interface ClassificationCard {
key: string;
symbols: string[];
system: ClassificationSystem;
levelLabel: string;
primaryDescription: string | null;
hierarchy: { label: string; value: string }[];
}
const DESCRIPTION_PREVIEW_LENGTH = 140;
const MIN_YEAR = 1978;
@Component({
selector: 'app-patents',
@@ -62,11 +52,13 @@ export class PatentsComponent implements OnInit {
searchTerm = '';
activeFilter: SourceFilter = 'all';
sortDirection: string = 'desc';
sortDirection: string = 'asc';
selectedPatent: PatentEntry | null = null;
showDetail = false;
private expandedClassificationKeys = new Set<string>();
// Jahr-Slider
readonly minYear = MIN_YEAR;
readonly maxYear = new Date().getFullYear();
selectedStartYear = MIN_YEAR;
selectedEndYear = new Date().getFullYear();
private searchSubject = new Subject<string>();
@@ -76,8 +68,6 @@ export class PatentsComponent implements OnInit {
.subscribe((term) => {
this.searchTerm = term;
this.page = 0;
this.selectedPatent = null;
this.showDetail = false;
this.loadPatents();
this.updateQueryParams();
});
@@ -92,17 +82,68 @@ export class PatentsComponent implements OnInit {
if (f === 'EPO' || f === 'USPTO') this.activeFilter = f;
const d = qp.get('sort_direction');
if (d === 'asc' || d === 'desc') this.sortDirection = d;
const sy = parseInt(qp.get('year_from') ?? '', 10);
const ey = parseInt(qp.get('year_to') ?? '', 10);
if (!isNaN(sy)) this.selectedStartYear = sy;
if (!isNaN(ey)) this.selectedEndYear = ey;
this.loadPatents();
}
get rangeStartPercent(): string {
const total = this.maxYear - this.minYear;
return `${((this.selectedStartYear - this.minYear) / total) * 100}%`;
}
get rangeEndPercent(): string {
const total = this.maxYear - this.minYear;
return `${((this.selectedEndYear - this.minYear) / total) * 100}%`;
}
get canResetYearRange(): boolean {
return this.selectedStartYear !== this.minYear || this.selectedEndYear !== this.maxYear;
}
onStartYearInput(event: Event): void {
const val = parseInt((event.target as HTMLInputElement).value, 10);
this.selectedStartYear = Math.min(val, this.selectedEndYear);
this.page = 0;
this.loadPatents();
this.updateQueryParams();
}
onEndYearInput(event: Event): void {
const val = parseInt((event.target as HTMLInputElement).value, 10);
this.selectedEndYear = Math.max(val, this.selectedStartYear);
this.page = 0;
this.loadPatents();
this.updateQueryParams();
}
resetYearRange(): void {
this.selectedStartYear = this.minYear;
this.selectedEndYear = this.maxYear;
this.page = 0;
this.loadPatents();
this.updateQueryParams();
}
private loadPatents(): void {
this.loading = true;
this.error = false;
const source = this.activeFilter === 'all' ? undefined : this.activeFilter;
this.patentsApi
.getAllPatents(this.page, this.pageSize, this.searchTerm || undefined, source, 'date', this.sortDirection)
.getAllPatents(
this.page,
this.pageSize,
this.searchTerm || undefined,
source,
'date',
this.sortDirection,
this.selectedStartYear,
this.selectedEndYear,
)
.subscribe({
next: (res) => {
this.patents = res.patents;
@@ -123,8 +164,6 @@ export class PatentsComponent implements OnInit {
clearSearch(): void {
this.searchTerm = '';
this.page = 0;
this.selectedPatent = null;
this.showDetail = false;
this.loadPatents();
this.updateQueryParams();
}
@@ -133,8 +172,6 @@ export class PatentsComponent implements OnInit {
const val = event.value;
this.activeFilter = val === 'EPO' || val === 'USPTO' ? val : 'all';
this.page = 0;
this.selectedPatent = null;
this.showDetail = false;
this.loadPatents();
this.updateQueryParams();
}
@@ -148,22 +185,12 @@ export class PatentsComponent implements OnInit {
handlePageChange(event: PageEvent): void {
this.page = event.pageIndex;
this.pageSize = event.pageSize;
this.selectedPatent = null;
this.showDetail = false;
this.loadPatents();
this.updateQueryParams();
}
selectPatent(patent: PatentEntry): void {
this.selectedPatent = patent;
this.showDetail = true;
this.expandedClassificationKeys.clear();
}
closeDetail(): void {
this.showDetail = false;
this.selectedPatent = null;
this.expandedClassificationKeys.clear();
openPatent(patent: PatentEntry): void {
this.router.navigate(['/patent', patent.patent_id]);
}
private updateQueryParams(): void {
@@ -175,6 +202,8 @@ export class PatentsComponent implements OnInit {
size: this.pageSize,
source: this.activeFilter === 'all' ? null : this.activeFilter,
sort_direction: this.sortDirection,
year_from: this.selectedStartYear !== this.minYear ? this.selectedStartYear : null,
year_to: this.selectedEndYear !== this.maxYear ? this.selectedEndYear : null,
},
queryParamsHandling: 'merge',
replaceUrl: true,
@@ -188,120 +217,4 @@ export class PatentsComponent implements OnInit {
if (isNaN(parsed.getTime())) return date;
return new Intl.DateTimeFormat('de-DE').format(parsed);
}
getPublicationStageLabel(patent: PatentEntry): string | null {
return patent.kind ?? patent.application_type ?? null;
}
getPatentMetadataRows(patent: PatentEntry) {
const rows: { label: string; value: string; variant?: 'source' }[] = [];
rows.push({ label: 'Quelle', value: patent.source, variant: 'source' });
rows.push({ label: 'Patent-Nr.', value: patent.patent_id });
if (patent.publication_date)
rows.push({ label: 'Veröffentlichungsdatum', value: this.formatDate(patent.publication_date) });
if (patent.application_number)
rows.push({ label: 'Anmeldungsnummer', value: patent.application_number });
if (patent.application_date)
rows.push({ label: 'Anmeldedatum', value: this.formatDate(patent.application_date) });
const stage = this.getPublicationStageLabel(patent);
if (stage)
rows.push({ label: patent.kind ? 'Publikationsstufe' : 'Anmeldungstyp', value: this.formatMetadataLabel(stage) });
if (patent.number_of_claims != null)
rows.push({ label: 'Ansprüche', value: String(patent.number_of_claims) });
if (patent.status)
rows.push({ label: 'Status', value: this.formatMetadataLabel(patent.status) });
return rows;
}
private formatMetadataLabel(value: string): string {
return value.replace(/_/g, ' ').toLowerCase().replace(/\b\w/g, (c) => c.toUpperCase());
}
getClassificationCards(
entries: IpcClassification[] | undefined,
system: ClassificationSystem,
): ClassificationCard[] {
if (!entries?.length) return [];
const merged = new Map<string, ClassificationCard>();
for (const entry of entries) {
const card = this.buildClassificationCard(entry, system);
const mergeKey = card.primaryDescription?.toLocaleLowerCase('en') ?? card.symbols[0] ?? card.key;
const existing = merged.get(mergeKey);
if (existing) {
for (const s of card.symbols) {
if (!existing.symbols.includes(s)) existing.symbols.push(s);
}
continue;
}
merged.set(mergeKey, card);
}
return [...merged.values()];
}
toggleClassificationExpanded(key: string): void {
this.expandedClassificationKeys.has(key)
? this.expandedClassificationKeys.delete(key)
: this.expandedClassificationKeys.add(key);
}
isClassificationExpanded(key: string): boolean {
return this.expandedClassificationKeys.has(key);
}
isLongDescription(text: string | null): boolean {
return !!text && text.length > DESCRIPTION_PREVIEW_LENGTH;
}
getDescriptionPreview(text: string | null): string {
if (!text) return '';
return text.length <= DESCRIPTION_PREVIEW_LENGTH
? text
: `${text.slice(0, DESCRIPTION_PREVIEW_LENGTH).trimEnd()}…`;
}
private buildClassificationCard(entry: IpcClassification, system: ClassificationSystem): ClassificationCard {
const level = this.getClassificationLevel(entry);
const primaryDescription = this.extractDescriptionText(entry[level.field]);
return {
key: `${system}-${entry.symbol}`,
symbols: [entry.symbol],
system,
levelLabel: level.label,
primaryDescription,
hierarchy: this.buildHierarchyRows(entry, primaryDescription),
};
}
private getClassificationLevel(entry: IpcClassification): { label: string; field: keyof IpcClassification } {
if (entry.subgroup) return { label: 'Untergruppe', field: 'subgroup' };
if (entry.main_group) return { label: 'Hauptgruppe', field: 'main_group' };
if (entry.subclass) return { label: 'Unterklasse', field: 'subclass' };
if (entry.section) return { label: 'Sektion', field: 'section' };
return { label: 'Code', field: 'symbol' };
}
private buildHierarchyRows(entry: IpcClassification, primaryDescription: string | null) {
const rows: { label: string; value: string }[] = [];
const seen = new Set<string>();
const addRow = (label: string, raw: string | null) => {
const value = this.extractDescriptionText(raw);
if (!value) return;
const norm = value.toLocaleLowerCase('en');
if (seen.has(norm) || norm === primaryDescription?.toLocaleLowerCase('en')) return;
seen.add(norm);
rows.push({ label, value });
};
addRow('Sektion', entry.section);
addRow('Klasse', entry.class);
addRow('Unterklasse', entry.subclass);
return rows;
}
private extractDescriptionText(value: string | null | undefined): string | null {
if (!value?.trim()) return null;
const text = value.includes(' - ') ? value.split(' - ').slice(1).join(' - ').trim() : value.trim();
if (!text) return null;
const first = text.split(/[;|]/)[0]?.trim() ?? text;
return first === first.toUpperCase() ? first.charAt(0) + first.slice(1).toLowerCase() : first;
}
}
@@ -6,173 +6,8 @@
<p class="message">Keine Patente gefunden.</p>
} @else {
<div class="patents-container">
<div class="patents-content">
@if (showDetail && selectedPatent) {
<div class="patent-full-detail">
<button type="button" class="back-btn" (click)="closeDetail()">
← Zurück zu den Patenten
</button>
<h3>{{ selectedPatent.title ?? selectedPatent.patent_id }}</h3>
@if (hasPatentMetadata(selectedPatent)) {
<div class="patent-meta patent-meta--inline">
<dl class="patent-meta__list">
@for (row of getPatentMetadataRows(selectedPatent); track row.label) {
<div class="patent-meta__row">
<dt>{{ row.label }}</dt>
<dd>
@if (row.variant === 'source') {
<span class="source-badge source-badge--{{ row.value.toLowerCase() }}">
{{ row.value }}
</span>
} @else {
{{ row.value }}
}
</dd>
</div>
}
</dl>
</div>
}
@if (selectedPatent.abstract) {
<div class="detail-section">
<h4>Abstract</h4>
<p>{{ selectedPatent.abstract }}</p>
</div>
}
<div class="detail-section">
<h4>Erfinder</h4>
<ul class="tag-list">
@for (inventor of selectedPatent.inventors; track inventor) {
<li class="tag">{{ inventor }}</li>
}
</ul>
</div>
@if (selectedPatent.assignees && selectedPatent.assignees.length > 0) {
<div class="detail-section">
<h4>Anmelder</h4>
<ul class="tag-list">
@for (assignee of selectedPatent.assignees; track assignee) {
<li class="tag">{{ assignee }}</li>
}
</ul>
</div>
}
@if (selectedPatent.ipc_descriptions && selectedPatent.ipc_descriptions.length > 0) {
<div class="detail-section classification-section classification-section--ipc">
<h4>Klassifikation (IPC)</h4>
<div class="classification-cards">
@for (card of getClassificationCards(selectedPatent.ipc_descriptions, 'IPC'); track card.key) {
<article class="classification-card">
<header class="classification-card__header">
<div class="classification-card__codes">
@for (symbol of card.symbols; track symbol) {
<span class="classification-code">{{ symbol }}</span>
}
</div>
<div class="classification-card__badges">
<span class="classification-badge classification-badge--system">{{ card.system }}</span>
<span class="classification-badge classification-badge--level">{{ card.levelLabel }}</span>
</div>
</header>
@if (card.primaryDescription) {
<p class="classification-summary">
{{ isClassificationExpanded(card.key) ? card.primaryDescription : getDescriptionPreview(card.primaryDescription) }}
</p>
@if (isLongDescription(card.primaryDescription)) {
<button
type="button"
class="classification-toggle"
(click)="toggleClassificationExpanded(card.key)">
{{ isClassificationExpanded(card.key) ? 'Weniger anzeigen' : 'Mehr anzeigen' }}
</button>
}
}
@if (card.hierarchy.length > 0) {
<dl class="classification-hierarchy">
@for (row of card.hierarchy; track row.label) {
<div class="classification-hierarchy__row">
<dt>{{ row.label }}</dt>
<dd>{{ row.value }}</dd>
</div>
}
</dl>
}
</article>
}
</div>
</div>
} @else if (selectedPatent.ipc && selectedPatent.ipc.length > 0) {
<div class="detail-section">
<h4>Klassifikation (IPC)</h4>
<ul class="tag-list tag-list--compact">
@for (ipc of selectedPatent.ipc; track ipc) {
<li class="tag">{{ ipc }}</li>
}
</ul>
</div>
}
@if (selectedPatent.cpc_descriptions && selectedPatent.cpc_descriptions.length > 0) {
<div class="detail-section classification-section classification-section--cpc">
<h4>Klassifikation (CPC)</h4>
<div class="classification-cards">
@for (card of getClassificationCards(selectedPatent.cpc_descriptions, 'CPC'); track card.key) {
<article class="classification-card">
<header class="classification-card__header">
<div class="classification-card__codes">
@for (symbol of card.symbols; track symbol) {
<span class="classification-code">{{ symbol }}</span>
}
</div>
<div class="classification-card__badges">
<span class="classification-badge classification-badge--system">{{ card.system }}</span>
<span class="classification-badge classification-badge--level">{{ card.levelLabel }}</span>
</div>
</header>
@if (card.primaryDescription) {
<p class="classification-summary">
{{ isClassificationExpanded(card.key) ? card.primaryDescription : getDescriptionPreview(card.primaryDescription) }}
</p>
@if (isLongDescription(card.primaryDescription)) {
<button
type="button"
class="classification-toggle"
(click)="toggleClassificationExpanded(card.key)">
{{ isClassificationExpanded(card.key) ? 'Weniger anzeigen' : 'Mehr anzeigen' }}
</button>
}
}
@if (card.hierarchy.length > 0) {
<dl class="classification-hierarchy">
@for (row of card.hierarchy; track row.label) {
<div class="classification-hierarchy__row">
<dt>{{ row.label }}</dt>
<dd>{{ row.value }}</dd>
</div>
}
</dl>
}
</article>
}
</div>
</div>
}
</div>
}
<div class="patents-list" [class.hidden]="showDetail">
<div class="patents-list">
<div class="patents-list-toolbar">
<label class="sort-control">
<span>Filter nach Quelle:</span>
@@ -225,7 +60,7 @@
}
</div>
@if (selectedPatent && !showDetail) {
@if (selectedPatent) {
<div class="patent-detail">
<h3>{{ selectedPatent.title ?? selectedPatent.patent_id }}</h3>
<div class="detail-stats">
@@ -2,28 +2,14 @@ import { Component, OnInit, inject } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ActivatedRoute, Router } from '@angular/router';
import { PatentsService } from '../../api/api/patents.service';
import { PatentEntry, IpcClassification } from '../../api/model/patentEntry';
import { PatentEntry } from '../../api/model/patentEntry';
import {
formatPatentDate,
getPublicationStageLabel,
} from '../patent-detail/patent-detail.utils';
type SortMode = 'date' | 'title';
type SourceFilter = 'all' | 'EPO' | 'USPTO';
type ClassificationSystem = 'IPC' | 'CPC';
interface ClassificationCard {
key: string;
symbols: string[];
system: ClassificationSystem;
levelLabel: string;
primaryDescription: string | null;
hierarchy: { label: string; value: string }[];
}
interface PatentMetadataRow {
label: string;
value: string;
variant?: 'source';
}
const DESCRIPTION_PREVIEW_LENGTH = 140;
@Component({
selector: 'app-person-patents',
@@ -40,7 +26,6 @@ export class PersonPatentsComponent implements OnInit {
filteredPatents: PatentEntry[] = [];
authorName: string | null = null;
selectedPatent: PatentEntry | null = null;
showDetail = false;
loading = true;
error = false;
@@ -50,7 +35,6 @@ export class PersonPatentsComponent implements OnInit {
selectedPage = 1;
readonly pageSize = 10;
private expandedClassificationKeys = new Set<string>();
ngOnInit(): void {
this.route.parent?.paramMap.subscribe((params) => {
@@ -87,7 +71,6 @@ export class PersonPatentsComponent implements OnInit {
this.activeFilter = filter;
this.selectedPage = 1;
this.selectedPatent = null;
this.showDetail = false;
this.applyFilter();
this.updateQueryParams();
}
@@ -100,19 +83,12 @@ export class PersonPatentsComponent implements OnInit {
selectPatent(patent: PatentEntry): void {
this.selectedPatent = patent;
this.showDetail = false;
this.expandedClassificationKeys.clear();
this.updateQueryParams();
}
openDetail(): void {
this.showDetail = true;
this.expandedClassificationKeys.clear();
}
closeDetail(): void {
this.showDetail = false;
this.expandedClassificationKeys.clear();
if (!this.selectedPatent) return;
this.router.navigate(['/patent', this.selectedPatent.patent_id]);
}
private applyFilter(): void {
@@ -173,9 +149,7 @@ export class PersonPatentsComponent implements OnInit {
}
formatDate(date: string | null | undefined): string {
if (!date) return '-';
const d = date.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3');
return new Intl.DateTimeFormat('de-DE').format(new Date(d));
return formatPatentDate(date);
}
getEpoCount(): number {
@@ -207,206 +181,6 @@ export class PersonPatentsComponent implements OnInit {
}
getPublicationStageLabel(patent: PatentEntry): string | null {
if (patent.kind) {
return patent.kind;
}
if (patent.application_type) {
return patent.application_type;
}
return null;
}
hasPatentMetadata(_patent: PatentEntry): boolean {
return true;
}
getPatentMetadataRows(patent: PatentEntry): PatentMetadataRow[] {
const rows: PatentMetadataRow[] = [];
rows.push({ label: 'Quelle', value: patent.source, variant: 'source' });
rows.push({ label: 'Patent-Nr.', value: patent.patent_id });
if (patent.publication_date) {
rows.push({
label: 'Veröffentlichungsdatum',
value: this.formatDate(patent.publication_date),
});
}
if (patent.application_number) {
rows.push({ label: 'Anmeldungsnummer', value: patent.application_number });
}
if (patent.application_date) {
rows.push({ label: 'Anmeldedatum', value: this.formatDate(patent.application_date) });
}
const stageLabel = this.getPublicationStageLabel(patent);
if (stageLabel) {
rows.push({
label: patent.kind ? 'Publikationsstufe' : 'Anmeldungstyp',
value: patent.kind ? stageLabel : this.formatMetadataLabel(stageLabel),
});
}
if (patent.number_of_claims != null) {
rows.push({ label: 'Ansprüche', value: String(patent.number_of_claims) });
}
if (patent.status) {
rows.push({ label: 'Status', value: this.formatMetadataLabel(patent.status) });
}
return rows;
}
private formatMetadataLabel(value: string): string {
return value
.replace(/_/g, ' ')
.toLowerCase()
.replace(/\b\w/g, (char) => char.toUpperCase());
}
getClassificationCards(
entries: IpcClassification[] | undefined,
system: ClassificationSystem,
): ClassificationCard[] {
if (!entries?.length) {
return [];
}
const merged = new Map<string, ClassificationCard>();
for (const entry of entries) {
const card = this.buildClassificationCard(entry, system);
const mergeKey =
card.primaryDescription?.toLocaleLowerCase('en') ?? card.symbols[0] ?? card.key;
const existing = merged.get(mergeKey);
if (existing) {
for (const symbol of card.symbols) {
if (!existing.symbols.includes(symbol)) {
existing.symbols.push(symbol);
}
}
continue;
}
merged.set(mergeKey, card);
}
return [...merged.values()];
}
toggleClassificationExpanded(key: string): void {
if (this.expandedClassificationKeys.has(key)) {
this.expandedClassificationKeys.delete(key);
return;
}
this.expandedClassificationKeys.add(key);
}
isClassificationExpanded(key: string): boolean {
return this.expandedClassificationKeys.has(key);
}
isLongDescription(text: string | null): boolean {
return !!text && text.length > DESCRIPTION_PREVIEW_LENGTH;
}
getDescriptionPreview(text: string | null): string {
if (!text) {
return '';
}
if (text.length <= DESCRIPTION_PREVIEW_LENGTH) {
return text;
}
return `${text.slice(0, DESCRIPTION_PREVIEW_LENGTH).trimEnd()}…`;
}
private buildClassificationCard(
entry: IpcClassification,
system: ClassificationSystem,
): ClassificationCard {
const level = this.getClassificationLevel(entry);
const primaryDescription = this.extractDescriptionText(entry[level.field]);
return {
key: `${system}-${entry.symbol}`,
symbols: [entry.symbol],
system,
levelLabel: level.label,
primaryDescription,
hierarchy: this.buildHierarchyRows(entry, primaryDescription),
};
}
private getClassificationLevel(entry: IpcClassification): {
label: string;
field: keyof IpcClassification;
} {
if (entry.subgroup) {
return { label: 'Untergruppe', field: 'subgroup' };
}
if (entry.main_group) {
return { label: 'Hauptgruppe', field: 'main_group' };
}
if (entry.subclass) {
return { label: 'Unterklasse', field: 'subclass' };
}
if (entry.section) {
return { label: 'Sektion', field: 'section' };
}
return { label: 'Code', field: 'symbol' };
}
private buildHierarchyRows(
entry: IpcClassification,
primaryDescription: string | null,
): { label: string; value: string }[] {
const rows: { label: string; value: string }[] = [];
const seen = new Set<string>();
const addRow = (label: string, raw: string | null) => {
const value = this.extractDescriptionText(raw);
if (!value) {
return;
}
const normalized = value.toLocaleLowerCase('en');
if (seen.has(normalized) || normalized === primaryDescription?.toLocaleLowerCase('en')) {
return;
}
seen.add(normalized);
rows.push({ label, value });
};
if (entry.section){
addRow('Sektion', entry.section);
}
if (entry.class){
addRow('Klasse', entry.class);
}
if (entry.subclass){
addRow('Unterklasse', entry.subclass);
}
return rows;
}
private extractDescriptionText(value: string | null | undefined): string | null {
if (!value?.trim()) {
return null;
}
const text = value.includes(' - ') ? value.split(' - ').slice(1).join(' - ').trim() : value.trim();
if (!text) {
return null;
}
const firstSentence = text.split(/[;|]/)[0]?.trim() ?? text;
return this.normalizeDescriptionCase(firstSentence);
}
private normalizeDescriptionCase(text: string): string {
if (text !== text.toUpperCase()) {
return text;
}
return text.charAt(0) + text.slice(1).toLowerCase();
return getPublicationStageLabel(patent);
}
}
@@ -5,7 +5,7 @@
<h2>Intellectual Property Rights ({{ patents.length }})</h2>
</div>
<div class="patents-list">
@for (ipr of patents; track ipr.title) {
@for (ipr of patents; track ipr.applicationIdentifier) {
<div class="ipr-item" (click)="searchForPatent(ipr)">
<div class="ipr-icon">
@if (ipr.type === 'PATENT') {
@@ -16,9 +16,11 @@ export class PatentsCardsComponent {
@Input() headerTitle: string = 'IPRs';
private router = inject(Router);
searchForPatent(patent: Fp7ProjectIPR): void {
this.router.navigate(['/patents'], {
this.router.navigate([`/patent/${patent.applicationIdentifier}`], {
queryParams: {
search: patent.title,
prefix: patent.applicationPrefix,
title: patent.title,
fillingDate: patent.applicationDate,
},
});
}