Merge branch 'dev' into feat/ranking
This commit is contained in:
@@ -39,7 +39,6 @@ model/authorNetworkNode.ts
|
||||
model/authorParsedLongestName.ts
|
||||
model/authorPositionCount.ts
|
||||
model/authorSummaryStats.ts
|
||||
model/authorWorkPurposes.ts
|
||||
model/authorsFilterProperties.ts
|
||||
model/authorsListResponse.ts
|
||||
model/authorship.ts
|
||||
@@ -185,7 +184,6 @@ model/rankingResponse.ts
|
||||
model/rebuildResponse.ts
|
||||
model/score.ts
|
||||
model/sortDirection.ts
|
||||
model/specificWorkPurpose.ts
|
||||
model/tokenType.ts
|
||||
model/topAuthor.ts
|
||||
model/topAuthorStatistics.ts
|
||||
@@ -221,13 +219,22 @@ model/work.ts
|
||||
model/workBiblio.ts
|
||||
model/workCitationNormalizedPercentile.ts
|
||||
model/workCitedByPercentileYear.ts
|
||||
model/workClassification.ts
|
||||
model/workClassificationAuthor.ts
|
||||
model/workClassificationDetails.ts
|
||||
model/workClassificationInstitution.ts
|
||||
model/workClassificationMeta.ts
|
||||
model/workClassificationPage.ts
|
||||
model/workClassificationTopic.ts
|
||||
model/workClassificationTopicGroup.ts
|
||||
model/workClassificationValidation.ts
|
||||
model/workCountsByYearInner.ts
|
||||
model/workHasContent.ts
|
||||
model/workIds.ts
|
||||
model/workKeyword.ts
|
||||
model/workMeshInner.ts
|
||||
model/workNetworkNode.ts
|
||||
model/workPurpose.ts
|
||||
model/workPrimaryCategory.ts
|
||||
model/workSortBy.ts
|
||||
model/workSustainableDevelopmentGoalsInner.ts
|
||||
model/workTopic.ts
|
||||
|
||||
@@ -22,15 +22,11 @@ import {
|
||||
import { CustomHttpParameterCodec } from '../encoder';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
// @ts-ignore
|
||||
import { AuthorWorkPurposes } from '../model/authorWorkPurposes';
|
||||
// @ts-ignore
|
||||
import { HTTPValidationError } from '../model/hTTPValidationError';
|
||||
// @ts-ignore
|
||||
import { InseModelsOpenalexWorkPageWorkPage } from '../model/inseModelsOpenalexWorkPageWorkPage';
|
||||
// @ts-ignore
|
||||
import { SpecificWorkPurpose } from '../model/specificWorkPurpose';
|
||||
// @ts-ignore
|
||||
import { TopicCount } from '../model/topicCount';
|
||||
// @ts-ignore
|
||||
import { TopicsByTime } from '../model/topicsByTime';
|
||||
@@ -158,108 +154,6 @@ export class WorksService extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the purposes of an author based on their ID.
|
||||
* @endpoint get /api/purpose/{raw_oa_author_id}/purposes
|
||||
* @param rawOaAuthorId The raw OpenAlex author id.
|
||||
* @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 getAuthorWorkPurposes(
|
||||
rawOaAuthorId: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<AuthorWorkPurposes>;
|
||||
public getAuthorWorkPurposes(
|
||||
rawOaAuthorId: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<AuthorWorkPurposes>>;
|
||||
public getAuthorWorkPurposes(
|
||||
rawOaAuthorId: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<AuthorWorkPurposes>>;
|
||||
public getAuthorWorkPurposes(
|
||||
rawOaAuthorId: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (rawOaAuthorId === null || rawOaAuthorId === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter rawOaAuthorId was null or undefined when calling getAuthorWorkPurposes.',
|
||||
);
|
||||
}
|
||||
|
||||
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/purpose/${this.configuration.encodeParam({ name: 'rawOaAuthorId', value: rawOaAuthorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/purposes`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<AuthorWorkPurposes>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a page of works for an author.
|
||||
* @endpoint get /api/works/{author_id}
|
||||
@@ -812,106 +706,4 @@ export class WorksService extends BaseService {
|
||||
reportProgress: reportProgress,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the purpose of a work based on its ID.
|
||||
* @endpoint get /api/purpose/{raw_oa_work_id}/purpose
|
||||
* @param rawOaWorkId The raw OpenAlex work id.
|
||||
* @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 getWorkPurpose(
|
||||
rawOaWorkId: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<SpecificWorkPurpose>;
|
||||
public getWorkPurpose(
|
||||
rawOaWorkId: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<SpecificWorkPurpose>>;
|
||||
public getWorkPurpose(
|
||||
rawOaWorkId: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<SpecificWorkPurpose>>;
|
||||
public getWorkPurpose(
|
||||
rawOaWorkId: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (rawOaWorkId === null || rawOaWorkId === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter rawOaWorkId was null or undefined when calling getWorkPurpose.',
|
||||
);
|
||||
}
|
||||
|
||||
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/purpose/${this.configuration.encodeParam({ name: 'rawOaWorkId', value: rawOaWorkId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}/purpose`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<SpecificWorkPurpose>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,12 @@ import { Institution } from '../model/institution';
|
||||
// @ts-ignore
|
||||
import { SortDirection } from '../model/sortDirection';
|
||||
// @ts-ignore
|
||||
import { Topic } from '../model/topic';
|
||||
// @ts-ignore
|
||||
import { WorkClassification } from '../model/workClassification';
|
||||
// @ts-ignore
|
||||
import { WorkClassificationPage } from '../model/workClassificationPage';
|
||||
// @ts-ignore
|
||||
import { WorkSortBy } from '../model/workSortBy';
|
||||
// @ts-ignore
|
||||
import { WorkTopic } from '../model/workTopic';
|
||||
@@ -54,6 +60,212 @@ export class WorksV2Service extends BaseService {
|
||||
super(basePath, configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of authors based on a search term for autocomplete functionality.
|
||||
* @endpoint get /api/v2/works/authors/autocomplete
|
||||
* @param query A search term to filter authors by (partial matches allowed).
|
||||
* @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 getAuthorAutocomplete(
|
||||
query?: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Array<Author>>;
|
||||
public getAuthorAutocomplete(
|
||||
query?: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Array<Author>>>;
|
||||
public getAuthorAutocomplete(
|
||||
query?: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Array<Author>>>;
|
||||
public getAuthorAutocomplete(
|
||||
query?: 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>query,
|
||||
'query',
|
||||
);
|
||||
|
||||
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/v2/works/authors/autocomplete`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<Author>>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the classifications of an author\'s works based on their ID.
|
||||
* @endpoint get /api/v2/works/classification/author/{raw_oa_author_id}
|
||||
* @param rawOaAuthorId The raw OpenAlex author id.
|
||||
* @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 getAuthorWorkClassifications(
|
||||
rawOaAuthorId: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<WorkClassificationPage>;
|
||||
public getAuthorWorkClassifications(
|
||||
rawOaAuthorId: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<WorkClassificationPage>>;
|
||||
public getAuthorWorkClassifications(
|
||||
rawOaAuthorId: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<WorkClassificationPage>>;
|
||||
public getAuthorWorkClassifications(
|
||||
rawOaAuthorId: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (rawOaAuthorId === null || rawOaAuthorId === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter rawOaAuthorId was null or undefined when calling getAuthorWorkClassifications.',
|
||||
);
|
||||
}
|
||||
|
||||
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/v2/works/classification/author/${this.configuration.encodeParam({ name: 'rawOaAuthorId', value: rawOaAuthorId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<WorkClassificationPage>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a paginated list of works for a given author based on their ID.
|
||||
* @endpoint get /api/v2/works/author/{raw_oa_author_id}
|
||||
@@ -387,6 +599,110 @@ export class WorksV2Service extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of institutions based on a search term for autocomplete functionality.
|
||||
* @endpoint get /api/v2/works/institutions/autocomplete
|
||||
* @param query A search term to filter institutions by (partial matches allowed).
|
||||
* @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 getInstitutionAutocomplete(
|
||||
query?: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Array<Institution>>;
|
||||
public getInstitutionAutocomplete(
|
||||
query?: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Array<Institution>>>;
|
||||
public getInstitutionAutocomplete(
|
||||
query?: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Array<Institution>>>;
|
||||
public getInstitutionAutocomplete(
|
||||
query?: 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>query,
|
||||
'query',
|
||||
);
|
||||
|
||||
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/v2/works/institutions/autocomplete`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<Institution>>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a paginated list of works for a given institution based on their ID.
|
||||
* @endpoint get /api/v2/works/institution/{raw_oa_institution_id}
|
||||
@@ -720,6 +1036,340 @@ export class WorksV2Service extends BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of work topics based on a search term for autocomplete functionality.
|
||||
* @endpoint get /api/v2/works/topics/autocomplete
|
||||
* @param query A search term to filter topics by (partial matches allowed).
|
||||
* @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 getTopicAutocomplete(
|
||||
query?: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<Array<Topic>>;
|
||||
public getTopicAutocomplete(
|
||||
query?: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<Array<Topic>>>;
|
||||
public getTopicAutocomplete(
|
||||
query?: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<Array<Topic>>>;
|
||||
public getTopicAutocomplete(
|
||||
query?: 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>query,
|
||||
'query',
|
||||
);
|
||||
|
||||
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/v2/works/topics/autocomplete`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<Array<Topic>>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the classifications of a work based on its ID.
|
||||
* @endpoint get /api/v2/works/classification/work/{work_id}
|
||||
* @param workId The OpenAlex work id.
|
||||
* @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 getWorkClassificationByWorkId(
|
||||
workId: string,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<WorkClassification>;
|
||||
public getWorkClassificationByWorkId(
|
||||
workId: string,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<WorkClassification>>;
|
||||
public getWorkClassificationByWorkId(
|
||||
workId: string,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<WorkClassification>>;
|
||||
public getWorkClassificationByWorkId(
|
||||
workId: string,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
if (workId === null || workId === undefined) {
|
||||
throw new Error(
|
||||
'Required parameter workId was null or undefined when calling getWorkClassificationByWorkId.',
|
||||
);
|
||||
}
|
||||
|
||||
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/v2/works/classification/work/${this.configuration.encodeParam({ name: 'workId', value: workId, in: 'path', style: 'simple', explode: false, dataType: 'string', dataFormat: undefined })}`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<WorkClassification>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the classifications of works based on their IDs.
|
||||
* @endpoint get /api/v2/works/classification/works/search
|
||||
* @param workIds A list of OpenAlex work IDs to retrieve classifications for.
|
||||
* @param page The page number to retrieve. (0-based)
|
||||
* @param size The number of classifications to retrieve per page.
|
||||
* @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 getWorkClassificationsByWorkIds(
|
||||
workIds?: Array<string>,
|
||||
page?: number,
|
||||
size?: number,
|
||||
observe?: 'body',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<WorkClassificationPage>;
|
||||
public getWorkClassificationsByWorkIds(
|
||||
workIds?: Array<string>,
|
||||
page?: number,
|
||||
size?: number,
|
||||
observe?: 'response',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpResponse<WorkClassificationPage>>;
|
||||
public getWorkClassificationsByWorkIds(
|
||||
workIds?: Array<string>,
|
||||
page?: number,
|
||||
size?: number,
|
||||
observe?: 'events',
|
||||
reportProgress?: boolean,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<HttpEvent<WorkClassificationPage>>;
|
||||
public getWorkClassificationsByWorkIds(
|
||||
workIds?: Array<string>,
|
||||
page?: number,
|
||||
size?: number,
|
||||
observe: any = 'body',
|
||||
reportProgress: boolean = false,
|
||||
options?: {
|
||||
httpHeaderAccept?: 'application/json';
|
||||
context?: HttpContext;
|
||||
transferCache?: boolean;
|
||||
},
|
||||
): Observable<any> {
|
||||
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
|
||||
if (workIds) {
|
||||
workIds.forEach((element) => {
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>element,
|
||||
'work_ids',
|
||||
);
|
||||
});
|
||||
}
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>page,
|
||||
'page',
|
||||
);
|
||||
localVarQueryParameters = this.addToHttpParams(
|
||||
localVarQueryParameters,
|
||||
<any>size,
|
||||
'size',
|
||||
);
|
||||
|
||||
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/v2/works/classification/works/search`;
|
||||
const { basePath, withCredentials } = this.configuration;
|
||||
return this.httpClient.request<WorkClassificationPage>(
|
||||
'get',
|
||||
`${basePath}${localVarPath}`,
|
||||
{
|
||||
context: localVarHttpContext,
|
||||
params: localVarQueryParameters,
|
||||
responseType: <any>responseType_,
|
||||
...(withCredentials ? { withCredentials } : {}),
|
||||
headers: localVarHeaders,
|
||||
observe: observe,
|
||||
...(localVarTransferCache !== undefined
|
||||
? { transferCache: localVarTransferCache }
|
||||
: {}),
|
||||
reportProgress: reportProgress,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of work topics based on their IDs.
|
||||
* @endpoint get /api/v2/works/topics/search
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
import { SpecificWorkPurpose } from './specificWorkPurpose';
|
||||
|
||||
|
||||
/**
|
||||
* Represents the purposes of an author, including their ID and a list of specific work purposes.
|
||||
*/
|
||||
export interface AuthorWorkPurposes {
|
||||
/**
|
||||
* The raw OpenAlex author id.
|
||||
*/
|
||||
raw_oa_author_id: string;
|
||||
/**
|
||||
* The total number of works for the author.
|
||||
*/
|
||||
total?: number;
|
||||
/**
|
||||
* The list of specific work purposes.
|
||||
*/
|
||||
purposes?: Array<SpecificWorkPurpose>;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Innovation Search Engine API
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
@@ -9,14 +9,24 @@
|
||||
*/
|
||||
import { PatentEntry } from './patentEntry';
|
||||
|
||||
|
||||
export interface KeywordPatentMatch {
|
||||
patent: PatentEntry;
|
||||
/**
|
||||
* Combined match quality score.
|
||||
*/
|
||||
match_score: number;
|
||||
matched_keywords?: Array<string>;
|
||||
matched_ipc_symbols?: Array<string>;
|
||||
export interface KeywordPatentMatch {
|
||||
patent: PatentEntry;
|
||||
/**
|
||||
* Combined match quality score.
|
||||
*/
|
||||
match_score: number;
|
||||
/**
|
||||
* IPC/CPC classification match score.
|
||||
*/
|
||||
ipc_score: number;
|
||||
/**
|
||||
* OpenAlex topic overlap score (0 or 1).
|
||||
*/
|
||||
topic_score: number;
|
||||
/**
|
||||
* Title/abstract keyword overlap score.
|
||||
*/
|
||||
text_score: number;
|
||||
matched_keywords?: Array<string>;
|
||||
matched_ipc_symbols?: Array<string>;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ export * from './authorNetworkNode';
|
||||
export * from './authorParsedLongestName';
|
||||
export * from './authorPositionCount';
|
||||
export * from './authorSummaryStats';
|
||||
export * from './authorWorkPurposes';
|
||||
export * from './authorsFilterProperties';
|
||||
export * from './authorsListResponse';
|
||||
export * from './authorship';
|
||||
@@ -156,7 +155,6 @@ export * from './rankingResponse';
|
||||
export * from './rebuildResponse';
|
||||
export * from './score';
|
||||
export * from './sortDirection';
|
||||
export * from './specificWorkPurpose';
|
||||
export * from './tokenType';
|
||||
export * from './topAuthor';
|
||||
export * from './topAuthorStatistics';
|
||||
@@ -192,13 +190,22 @@ export * from './work';
|
||||
export * from './workBiblio';
|
||||
export * from './workCitationNormalizedPercentile';
|
||||
export * from './workCitedByPercentileYear';
|
||||
export * from './workClassification';
|
||||
export * from './workClassificationAuthor';
|
||||
export * from './workClassificationDetails';
|
||||
export * from './workClassificationInstitution';
|
||||
export * from './workClassificationMeta';
|
||||
export * from './workClassificationPage';
|
||||
export * from './workClassificationTopic';
|
||||
export * from './workClassificationTopicGroup';
|
||||
export * from './workClassificationValidation';
|
||||
export * from './workCountsByYearInner';
|
||||
export * from './workHasContent';
|
||||
export * from './workIds';
|
||||
export * from './workKeyword';
|
||||
export * from './workMeshInner';
|
||||
export * from './workNetworkNode';
|
||||
export * from './workPurpose';
|
||||
export * from './workPrimaryCategory';
|
||||
export * from './workSortBy';
|
||||
export * from './workSustainableDevelopmentGoalsInner';
|
||||
export * from './workTopic';
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
import { WorkPurpose } from './workPurpose';
|
||||
|
||||
|
||||
/**
|
||||
* Represents the purpose of a specific work, including its ID, purpose, and optional reasoning.
|
||||
*/
|
||||
export interface SpecificWorkPurpose {
|
||||
/**
|
||||
* The raw OpenAlex work id.
|
||||
*/
|
||||
raw_oa_work_id: string;
|
||||
publication_year?: number | null;
|
||||
/**
|
||||
* The purpose of the work.
|
||||
*/
|
||||
purpose: WorkPurpose;
|
||||
reasoning?: string | null;
|
||||
}
|
||||
export namespace SpecificWorkPurpose {
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
import { WorkClassificationTopic } from './workClassificationTopic';
|
||||
import { WorkClassificationDetails } from './workClassificationDetails';
|
||||
import { WorkClassificationInstitution } from './workClassificationInstitution';
|
||||
import { WorkClassificationMeta } from './workClassificationMeta';
|
||||
import { WorkClassificationValidation } from './workClassificationValidation';
|
||||
import { WorkClassificationAuthor } from './workClassificationAuthor';
|
||||
|
||||
/**
|
||||
* Represents a full work-classification document.
|
||||
*/
|
||||
export interface WorkClassification {
|
||||
/**
|
||||
* The full OpenAlex work id/URL.
|
||||
*/
|
||||
work_id: string;
|
||||
doi?: string | null;
|
||||
title?: string | null;
|
||||
publication_year?: number | null;
|
||||
/**
|
||||
* The authors of the work.
|
||||
*/
|
||||
authors?: Array<WorkClassificationAuthor>;
|
||||
/**
|
||||
* The institutions associated with the work.
|
||||
*/
|
||||
institutions?: Array<WorkClassificationInstitution>;
|
||||
/**
|
||||
* The topics associated with the work.
|
||||
*/
|
||||
topics?: Array<WorkClassificationTopic>;
|
||||
classification?: WorkClassificationDetails | null;
|
||||
classification_meta?: WorkClassificationMeta | null;
|
||||
validation?: WorkClassificationValidation | null;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An author entry within a work classification document.
|
||||
*/
|
||||
export interface WorkClassificationAuthor {
|
||||
id?: string | null;
|
||||
display_name?: string | null;
|
||||
orcid?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
import { WorkPrimaryCategory } from './workPrimaryCategory';
|
||||
|
||||
/**
|
||||
* The core classification result for a work.
|
||||
*/
|
||||
export interface WorkClassificationDetails {
|
||||
primary_category?: WorkPrimaryCategory | null;
|
||||
confidence?: string | null;
|
||||
pasteur_quadrant?: string | null;
|
||||
applied_orientation_score?: number | null;
|
||||
insufficient_context?: boolean | null;
|
||||
signals_used?: Array<string> | null;
|
||||
classification_reason?: string | null;
|
||||
}
|
||||
export namespace WorkClassificationDetails {}
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* An institution entry within a work classification document.
|
||||
*/
|
||||
export interface WorkClassificationInstitution {
|
||||
id?: string | null;
|
||||
display_name?: string | null;
|
||||
ror?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Metadata about how and when a classification was produced.
|
||||
*/
|
||||
export interface WorkClassificationMeta {
|
||||
model?: string | null;
|
||||
prompt_version?: string | null;
|
||||
classified_at?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
import { WorkClassification } from './workClassification';
|
||||
|
||||
export interface WorkClassificationPage {
|
||||
/**
|
||||
* The elements of the page.
|
||||
*/
|
||||
elements?: Array<WorkClassification>;
|
||||
/**
|
||||
* The page number. (0-based)
|
||||
*/
|
||||
page?: number;
|
||||
/**
|
||||
* The page size in elements.
|
||||
*/
|
||||
size?: number;
|
||||
/**
|
||||
* The total number of elements.
|
||||
*/
|
||||
total?: number;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
import { WorkClassificationTopicGroup } from './workClassificationTopicGroup';
|
||||
|
||||
/**
|
||||
* A topic entry within a work classification document.
|
||||
*/
|
||||
export interface WorkClassificationTopic {
|
||||
id?: string | null;
|
||||
display_name?: string | null;
|
||||
score?: number | null;
|
||||
domain?: WorkClassificationTopicGroup | null;
|
||||
field?: WorkClassificationTopicGroup | null;
|
||||
subfield?: WorkClassificationTopicGroup | null;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* A domain/field/subfield group referenced within a classification topic.
|
||||
*/
|
||||
export interface WorkClassificationTopicGroup {
|
||||
id?: string | null;
|
||||
display_name?: string | null;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Validation results for a classification.
|
||||
*/
|
||||
export interface WorkClassificationValidation {
|
||||
valid?: boolean | null;
|
||||
errors?: Array<string> | null;
|
||||
corrections?: Array<string> | null;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the primary category of a work.
|
||||
*/
|
||||
export const WorkPrimaryCategory = {
|
||||
BasicResearch: 'basic_research',
|
||||
AppliedResearch: 'applied_research',
|
||||
NonResearch: 'non_research',
|
||||
ExperimentalDevelopment: 'experimental_development',
|
||||
NotClassified: 'not_classified',
|
||||
} as const;
|
||||
export type WorkPrimaryCategory =
|
||||
(typeof WorkPrimaryCategory)[keyof typeof WorkPrimaryCategory];
|
||||
@@ -1,21 +0,0 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the purpose of a work.
|
||||
*/
|
||||
export const WorkPurpose = {
|
||||
BasicResearch: 'Basic Research',
|
||||
AppliedResearch: 'Applied Research',
|
||||
NonResearch: 'Non-Research',
|
||||
ExperimentalDevelopment: 'Experimental Development',
|
||||
NotClassified: 'Not Classified',
|
||||
} as const;
|
||||
export type WorkPurpose = (typeof WorkPurpose)[keyof typeof WorkPurpose];
|
||||
@@ -28,7 +28,6 @@ import { KeywordsToPatentsResultsComponent } from './modules/keywords-search/sea
|
||||
import { KeywordsToNewsResultsComponent } from './modules/keywords-search/search-results/news-results/news-results.component';
|
||||
import { KeywordsToWorksResultsComponent } from './modules/keywords-search/search-results/works-results/works-results.component';
|
||||
import { UniTrendParentComponent } from './modules/university-ranking/uni-trend-parent/uni-trend-parent.component';
|
||||
import { authorWorkPurposesResolver } from './resolvers/author-work-purposes.resolver';
|
||||
import {
|
||||
RESOLVING_WORK_PAGE_FOR,
|
||||
workPageResolver,
|
||||
@@ -39,6 +38,7 @@ import { roleGuard } from './shared/guards/role.guard';
|
||||
import { UserRole } from './api';
|
||||
import { personCordisEuProjectPageResolver } from './resolvers/person-cordis-eu-project-page.resolver';
|
||||
import { selectedAuthorsResolver } from './resolvers/selected-authors.resolver';
|
||||
import { authorWorkClassificationPageResolver } from './resolvers/author-work-classification-page.resolver';
|
||||
export const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
@@ -401,7 +401,7 @@ export const routes: Routes = [
|
||||
selectedTopics: selectedTopicsResolver,
|
||||
selectedInstitutions: selectedInstitutionsResolver,
|
||||
authorWorkPage: workPageResolver,
|
||||
authorWorkPurposes: authorWorkPurposesResolver,
|
||||
authorWorkClassificationPage: authorWorkClassificationPageResolver,
|
||||
},
|
||||
data: {
|
||||
resolvingFor: RESOLVING_WORK_PAGE_FOR.PERSON,
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
@if (loading) {
|
||||
<p class="message">Lade Patente...</p>
|
||||
<app-loading
|
||||
text="Patentdaten werden geladen..."
|
||||
icon="workspace_premium"
|
||||
[size]="150"
|
||||
[diameter]="150" />
|
||||
} @else if (error) {
|
||||
<p class="message">Fehler beim Laden der Patente.</p>
|
||||
} @else if (patents.length === 0) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
formatPatentDate,
|
||||
getPublicationStageLabel,
|
||||
} from '../patent-detail/patent-detail.utils';
|
||||
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||
|
||||
type SortMode = 'date' | 'title';
|
||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
@@ -14,7 +15,7 @@ type OrgPatentMatchTypeFilter = 'all' | 'institution' | 'name' | 'both';
|
||||
|
||||
@Component({
|
||||
selector: 'app-institution-patents',
|
||||
imports: [CommonModule, RouterLink],
|
||||
imports: [CommonModule, RouterLink, LoadingComponent],
|
||||
templateUrl: './institution-patents.component.html',
|
||||
styleUrl: './institution-patents.component.scss',
|
||||
})
|
||||
|
||||
+7
-7
@@ -1,13 +1,13 @@
|
||||
<div style="display: flex; flex-direction: column; gap: 1rem; padding: 1rem">
|
||||
<app-query-param-input
|
||||
queryParamKey="title"
|
||||
label="Suchen nach Titel"
|
||||
placeholder="Suche"
|
||||
[debounceTime]="300" />
|
||||
<app-selected-filters [observers]="observers" />
|
||||
<div class="content">
|
||||
<app-publication-filter
|
||||
[selectedAuthors]="selectedAuthors()"
|
||||
[selectedTopics]="selectedTopics()"
|
||||
[showInstitutionFilter]="false" />
|
||||
|
||||
<app-publication-table
|
||||
[page]="institutionWorkPage()"
|
||||
[authorFilterEnabled]="true" />
|
||||
|
||||
<app-query-param-paginator
|
||||
[total]="total()"
|
||||
queryParamPageKey="page"
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
+2
-57
@@ -2,22 +2,14 @@ import { Component, computed, input } from '@angular/core';
|
||||
import { PublicationTableComponent } from '../../shared/ui/publication-table/publication-table.component';
|
||||
import { Author, InseWorksV2ModelWorkPage, WorkTopic } from '../../api';
|
||||
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
import {
|
||||
FilterObserver,
|
||||
SelectedFiltersComponent,
|
||||
} from '../../shared/ui/selected-filters/selected-filters.component';
|
||||
import { workQueryParamKeys } from '../../resolvers/work-page.resolver';
|
||||
import { translateWorkType } from '../../shared/pipes/work-type.pipe';
|
||||
import { translateLanguageCode } from '../../shared/pipes/language-code.pipe';
|
||||
import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component';
|
||||
import { PublicationFilterComponent } from '../../shared/ui/publication-filters/publication-filters.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-institution-publications',
|
||||
imports: [
|
||||
PublicationTableComponent,
|
||||
QueryParamPaginatorComponent,
|
||||
SelectedFiltersComponent,
|
||||
QueryParamInputComponent,
|
||||
PublicationFilterComponent,
|
||||
],
|
||||
templateUrl: './institution-publications.component.html',
|
||||
styleUrl: './institution-publications.component.scss',
|
||||
@@ -28,51 +20,4 @@ export class InstitutionPublicationsComponent {
|
||||
selectedTopics = input.required<Array<WorkTopic>>();
|
||||
|
||||
total = computed(() => this.institutionWorkPage().total ?? 0);
|
||||
|
||||
observers: FilterObserver[] = [
|
||||
{
|
||||
id: 'search',
|
||||
queryParamKey: workQueryParamKeys.title,
|
||||
icon: 'search',
|
||||
},
|
||||
{
|
||||
id: 'types',
|
||||
queryParamKey: workQueryParamKeys.types,
|
||||
icon: 'category',
|
||||
valueFormatter: (value: string) => {
|
||||
return translateWorkType(value) || value;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'years',
|
||||
queryParamKey: workQueryParamKeys.years,
|
||||
icon: 'calendar_today',
|
||||
},
|
||||
{
|
||||
id: 'languages',
|
||||
queryParamKey: workQueryParamKeys.language,
|
||||
icon: 'translate',
|
||||
valueFormatter: (value: string) => {
|
||||
return translateLanguageCode(value) || value;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'authors',
|
||||
queryParamKey: workQueryParamKeys.authorId,
|
||||
icon: 'person',
|
||||
valueFormatter: (value: string) => {
|
||||
const author = this.selectedAuthors().find((a) => a.id === value);
|
||||
return author ? author.display_name : value;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'topics',
|
||||
queryParamKey: workQueryParamKeys.topicId,
|
||||
icon: 'label',
|
||||
valueFormatter: (value: string) => {
|
||||
const topic = this.selectedTopics().find((t) => t.id === value);
|
||||
return topic ? topic.display_name : value;
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -11,11 +11,7 @@ import {
|
||||
Page,
|
||||
CardSearchComponent,
|
||||
} from '../../shared/ui/card-search/card-search.component';
|
||||
import {
|
||||
FilterObserver,
|
||||
SelectedFiltersComponent,
|
||||
} from '../../shared/ui/selected-filters/selected-filters.component';
|
||||
import { CdkNoDataRow } from '@angular/cdk/table';
|
||||
import { FilterObserver } from '../../shared/ui/selected-filters/selected-filters.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-institutions',
|
||||
|
||||
+45
-44
@@ -1,44 +1,33 @@
|
||||
@if (loading()) {
|
||||
<p class="message">Lade passende Patente...</p>
|
||||
<div class="patents-container">
|
||||
<ng-container *ngTemplateOutlet="patentsHeader" />
|
||||
<p class="message">Lade passende Patente...</p>
|
||||
</div>
|
||||
} @else if (error()) {
|
||||
<p class="message">Fehler beim Laden der Patente.</p>
|
||||
<div class="patents-container">
|
||||
<ng-container *ngTemplateOutlet="patentsHeader" />
|
||||
<p class="message">Fehler beim Laden der Patente.</p>
|
||||
</div>
|
||||
} @else if (matches().length === 0) {
|
||||
<p class="message">Keine passenden Patente gefunden.</p>
|
||||
<div class="patents-container">
|
||||
<ng-container *ngTemplateOutlet="patentsHeader" />
|
||||
<p class="message">Keine passenden Patente gefunden.</p>
|
||||
</div>
|
||||
} @else {
|
||||
<div class="patents-container">
|
||||
<h2 class="section-title">Passende Patente</h2>
|
||||
<ng-container *ngTemplateOutlet="patentsHeader" />
|
||||
|
||||
<div class="patents-content">
|
||||
<div class="patents-list">
|
||||
<div class="patents-list-toolbar">
|
||||
<label class="sort-control">
|
||||
<span>Filter nach Quelle:</span>
|
||||
|
||||
<select
|
||||
[value]="activeFilter()"
|
||||
(change)="setFilter($any($event.target).value)">
|
||||
<option value="all">Alle</option>
|
||||
|
||||
<option value="EPO">EPO</option>
|
||||
|
||||
<option value="USPTO">USPTO</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Patent</th>
|
||||
|
||||
<th>Score</th>
|
||||
|
||||
<th>Quelle</th>
|
||||
|
||||
<th>Jahr</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@for (item of pagedMatches(); track trackMatch($index, item)) {
|
||||
<tr
|
||||
@@ -47,9 +36,7 @@
|
||||
<td class="patent-title">
|
||||
{{ item.patent.title ?? item.patent.patent_id }}
|
||||
</td>
|
||||
|
||||
<td class="match-score">{{ formatScore(item.match_score) }}</td>
|
||||
|
||||
<td>
|
||||
<span
|
||||
class="source-badge source-badge--{{
|
||||
@@ -58,7 +45,6 @@
|
||||
{{ item.patent.source }}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td>{{ item.patent.publication_year ?? '-' }}</td>
|
||||
</tr>
|
||||
}
|
||||
@@ -72,9 +58,7 @@
|
||||
(click)="setPage(selectedPage() - 1)">
|
||||
Zurück
|
||||
</button>
|
||||
|
||||
<span>Seite {{ selectedPage() }} von {{ pageCount() }}</span>
|
||||
|
||||
<button
|
||||
[disabled]="selectedPage() === pageCount()"
|
||||
(click)="setPage(selectedPage() + 1)">
|
||||
@@ -87,35 +71,27 @@
|
||||
@if (selectedMatch(); as match) {
|
||||
<div class="patent-detail">
|
||||
<h3>{{ match.patent.title ?? match.patent.patent_id }}</h3>
|
||||
|
||||
<div class="detail-stats">
|
||||
<div class="stat">
|
||||
<span class="stat-label">Match-Score</span>
|
||||
|
||||
<span class="stat-value">{{
|
||||
formatScore(match.match_score)
|
||||
}}</span>
|
||||
</div>
|
||||
|
||||
<div class="stat">
|
||||
<span class="stat-label">Gematchte Keywords</span>
|
||||
|
||||
<span class="stat-value">{{
|
||||
formatMatchList(match.matched_keywords)
|
||||
}}</span>
|
||||
</div>
|
||||
|
||||
<div class="stat">
|
||||
<span class="stat-label">Gematchte IPC/CPC</span>
|
||||
|
||||
<span class="stat-value">{{
|
||||
formatMatchList(match.matched_ipc_symbols)
|
||||
}}</span>
|
||||
</div>
|
||||
|
||||
<div class="stat">
|
||||
<span class="stat-label">Quelle</span>
|
||||
|
||||
<span class="stat-value">
|
||||
<span
|
||||
class="source-badge source-badge--{{
|
||||
@@ -125,25 +101,19 @@
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="stat">
|
||||
<span class="stat-label">Patent-Nr.</span>
|
||||
|
||||
<span class="stat-value">{{ match.patent.patent_id }}</span>
|
||||
</div>
|
||||
|
||||
<div class="stat">
|
||||
<span class="stat-label">Datum</span>
|
||||
|
||||
<span class="stat-value">{{
|
||||
formatDate(match.patent.publication_date)
|
||||
}}</span>
|
||||
</div>
|
||||
|
||||
@if (getPublicationStageLabel(match.patent); as stageLabel) {
|
||||
<div class="stat">
|
||||
<span class="stat-label">Publikationsstufe</span>
|
||||
|
||||
<span class="stat-value">{{ stageLabel }}</span>
|
||||
</div>
|
||||
}
|
||||
@@ -156,7 +126,6 @@
|
||||
<span class="patent-detail-action__label"
|
||||
>Patentdetails anzeigen</span
|
||||
>
|
||||
|
||||
<span class="material-icons" aria-hidden="true">chevron_right</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -164,3 +133,35 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<ng-template #patentsHeader>
|
||||
<div class="patents-header">
|
||||
<h2 class="section-title">Passende Patente</h2>
|
||||
<div class="patents-header-actions">
|
||||
@if (matches().length > 0) {
|
||||
<label class="sort-control">
|
||||
<span>Filter nach Quelle:</span>
|
||||
<select
|
||||
[value]="activeFilter()"
|
||||
(change)="setFilter($any($event.target).value)">
|
||||
<option value="all">Alle</option>
|
||||
<option value="EPO">EPO</option>
|
||||
<option value="USPTO">USPTO</option>
|
||||
</select>
|
||||
</label>
|
||||
}
|
||||
|
||||
@if (showReload()) {
|
||||
<button
|
||||
mat-stroked-button
|
||||
type="button"
|
||||
class="reload-btn"
|
||||
[disabled]="reloadDisabled()"
|
||||
(click)="onReload()">
|
||||
<mat-icon>refresh</mat-icon>
|
||||
Neu laden
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</ng-template>
|
||||
|
||||
+35
-2
@@ -4,18 +4,41 @@
|
||||
}
|
||||
|
||||
.section-title {
|
||||
margin: 0 0 16px;
|
||||
margin: 0;
|
||||
font-size: 1.25rem;
|
||||
}
|
||||
|
||||
.patents-container {
|
||||
margin-top: 1.5rem;
|
||||
margin-top: 0;
|
||||
padding: 16px;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
|
||||
}
|
||||
|
||||
.patents-header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.patents-header-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 10px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.reload-btn {
|
||||
min-height: 40px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.sort-control {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
@@ -145,6 +168,16 @@
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.patents-header {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.patents-header-actions {
|
||||
margin-left: 0;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.patents-content {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
+13
-27
@@ -1,56 +1,49 @@
|
||||
import { Component, input, signal } from '@angular/core';
|
||||
|
||||
import { NgTemplateOutlet } from '@angular/common';
|
||||
import { Component, input, output, signal } from '@angular/core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
import { PatentEntry } from '../../../api/model/patentEntry';
|
||||
|
||||
import { KeywordPatentMatch } from '../../../api/model/keywordPatentMatch';
|
||||
import {
|
||||
formatPatentDate,
|
||||
getPublicationStageLabel,
|
||||
} from '../../patent-detail/patent-detail.utils';
|
||||
import { KeywordPatentMatch } from '../../../api';
|
||||
|
||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
|
||||
@Component({
|
||||
selector: 'app-keywords-patents',
|
||||
|
||||
imports: [NgTemplateOutlet, MatButtonModule, MatIconModule],
|
||||
templateUrl: './keywords-patents.component.html',
|
||||
|
||||
styleUrl: './keywords-patents.component.scss',
|
||||
})
|
||||
export class KeywordsPatentsComponent {
|
||||
readonly matches = input<KeywordPatentMatch[]>([]);
|
||||
|
||||
readonly loading = input(false);
|
||||
|
||||
readonly error = input(false);
|
||||
readonly showReload = input(false);
|
||||
readonly reloadDisabled = input(false);
|
||||
readonly reload = output<void>();
|
||||
|
||||
activeFilter = signal<SourceFilter>('all');
|
||||
|
||||
selectedMatch = signal<KeywordPatentMatch | null>(null);
|
||||
|
||||
selectedPage = signal(1);
|
||||
|
||||
readonly pageSize = 10;
|
||||
|
||||
constructor(private readonly router: Router) {}
|
||||
|
||||
filteredMatches(): KeywordPatentMatch[] {
|
||||
const filter = this.activeFilter();
|
||||
|
||||
const items = this.matches();
|
||||
|
||||
if (filter === 'all') {
|
||||
return items;
|
||||
}
|
||||
|
||||
return items.filter((item) => item.patent.source === filter);
|
||||
}
|
||||
|
||||
pagedMatches(): KeywordPatentMatch[] {
|
||||
const start = (this.selectedPage() - 1) * this.pageSize;
|
||||
|
||||
return this.filteredMatches().slice(start, start + this.pageSize);
|
||||
}
|
||||
|
||||
@@ -67,9 +60,7 @@ export class KeywordsPatentsComponent {
|
||||
|
||||
setFilter(filter: SourceFilter): void {
|
||||
this.activeFilter.set(filter);
|
||||
|
||||
this.selectedPage.set(1);
|
||||
|
||||
this.selectedMatch.set(null);
|
||||
}
|
||||
|
||||
@@ -83,12 +74,14 @@ export class KeywordsPatentsComponent {
|
||||
|
||||
openDetail(): void {
|
||||
const match = this.selectedMatch();
|
||||
|
||||
if (!match) return;
|
||||
|
||||
void this.router.navigate(['/patent', match.patent.patent_id]);
|
||||
}
|
||||
|
||||
onReload(): void {
|
||||
this.reload.emit();
|
||||
}
|
||||
|
||||
formatDate(date: string | null | undefined): string {
|
||||
return formatPatentDate(date);
|
||||
}
|
||||
@@ -101,7 +94,6 @@ export class KeywordsPatentsComponent {
|
||||
if (score == null || Number.isNaN(score)) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return score.toFixed(2);
|
||||
}
|
||||
|
||||
@@ -109,22 +101,16 @@ export class KeywordsPatentsComponent {
|
||||
if (!values || values.length === 0) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
return values.join(', ');
|
||||
}
|
||||
|
||||
trackMatch(_index: number, item: KeywordPatentMatch): string {
|
||||
const patent = item.patent;
|
||||
|
||||
return [
|
||||
patent.source,
|
||||
|
||||
patent.patent_id,
|
||||
|
||||
patent.publication_date ?? '',
|
||||
|
||||
patent.kind ?? patent.application_type ?? '',
|
||||
|
||||
item.match_score,
|
||||
].join('|');
|
||||
}
|
||||
|
||||
@@ -435,23 +435,6 @@
|
||||
<mat-icon>show_chart</mat-icon>
|
||||
Visualisierung
|
||||
</button>
|
||||
|
||||
<button
|
||||
mat-flat-button
|
||||
class="patents-btn"
|
||||
[disabled]="isSearchDisabled()"
|
||||
(click)="loadPatentsForSelection()">
|
||||
<mat-icon>description</mat-icon>
|
||||
Patente
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (showPatents()) {
|
||||
<app-keywords-patents
|
||||
[matches]="patentMatches()"
|
||||
[loading]="loadingPatents()"
|
||||
[error]="patentsError()">
|
||||
</app-keywords-patents>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -461,19 +461,13 @@ mat-button-toggle-group {
|
||||
}
|
||||
|
||||
.search-btn,
|
||||
.visualize-btn,
|
||||
.patents-btn {
|
||||
.visualize-btn {
|
||||
min-width: 220px;
|
||||
min-height: $touch-target;
|
||||
align-self: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.patents-btn {
|
||||
background: #0f766e !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
/* Tablet */
|
||||
@media (max-width: $tablet) {
|
||||
.search-container {
|
||||
@@ -485,8 +479,7 @@ mat-button-toggle-group {
|
||||
}
|
||||
|
||||
.search-btn,
|
||||
.visualize-btn,
|
||||
.patents-btn {
|
||||
.visualize-btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
@@ -509,8 +502,7 @@ mat-button-toggle-group {
|
||||
}
|
||||
|
||||
.search-btn,
|
||||
.visualize-btn,
|
||||
.patents-btn {
|
||||
.visualize-btn {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,15 +52,9 @@ import {
|
||||
} from '../../resolvers/utils/topic-legend';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { A11yModule } from '@angular/cdk/a11y';
|
||||
import { PatentsService } from '../../api/api/patents.service';
|
||||
import { KeywordsPatentsComponent } from './keywords-patents/keywords-patents.component';
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { SearchResultsPayload } from './search-results/search-results-state.service';
|
||||
import {
|
||||
KeywordPatentMatch,
|
||||
KeywordPatentSearchItem,
|
||||
KeywordsService,
|
||||
} from '../../api';
|
||||
import { clearPatentsCache } from './patent-search.utils';
|
||||
type InputMode = 'url' | 'text' | 'file';
|
||||
type KeywordCategory = 'broad' | 'coarse' | 'fine' | 'manual';
|
||||
type KeywordView = 'llm' | 'topic';
|
||||
@@ -86,7 +80,6 @@ type KeywordPatentLevel = 'broad' | 'coarse' | 'fine' | 'custom';
|
||||
MatTooltipModule,
|
||||
A11yModule,
|
||||
NgTemplateOutlet,
|
||||
KeywordsPatentsComponent,
|
||||
LoadingComponent,
|
||||
MatSlideToggleModule,
|
||||
MatSliderModule,
|
||||
@@ -105,7 +98,6 @@ export class KeywordsSearchComponent {
|
||||
private readonly websocketService = inject(KeywordWebSocketService);
|
||||
private readonly topicsService = inject(TopicsService);
|
||||
private readonly breakpointObserver = inject(BreakpointObserver);
|
||||
private readonly keywordsService = inject(KeywordsService);
|
||||
|
||||
readonly form = this.formBuilder.nonNullable.group({
|
||||
selectedInputType: 'url' as InputMode,
|
||||
@@ -141,11 +133,6 @@ export class KeywordsSearchComponent {
|
||||
readonly extractionSource = signal<InputMode | null>(null);
|
||||
readonly topicMappingSearch = signal<boolean>(false);
|
||||
readonly showVisualization = signal<boolean>(false);
|
||||
readonly showPatents = signal(false);
|
||||
readonly patentMatches = signal<KeywordPatentMatch[]>([]);
|
||||
readonly loadingPatents = signal(false);
|
||||
readonly patentsError = signal(false);
|
||||
readonly patentsLoaded = signal(false);
|
||||
|
||||
readonly uploadedFiles = signal<FileUploadItem[]>([]);
|
||||
readonly keywordsExist = computed(
|
||||
@@ -338,10 +325,7 @@ export class KeywordsSearchComponent {
|
||||
this.broadKeywordEntries.set([]);
|
||||
this.coarseKeywordEntries.set([]);
|
||||
this.fineKeywordEntries.set([]);
|
||||
this.patentMatches.set([]);
|
||||
this.patentsLoaded.set(false);
|
||||
this.patentsError.set(false);
|
||||
this.showPatents.set(false);
|
||||
clearPatentsCache();
|
||||
this.websocketService.close();
|
||||
this.isExtracting.set(false);
|
||||
this.loadingNewKeyword.set(false);
|
||||
@@ -592,12 +576,7 @@ export class KeywordsSearchComponent {
|
||||
this.manualKeywordEntries.set([]);
|
||||
this.sourceContent.set('');
|
||||
this.sourceUrl.set(null);
|
||||
this.patentMatches.set([]);
|
||||
this.patentsLoaded.set(false);
|
||||
this.patentsError.set(false);
|
||||
this.showPatents.set(false);
|
||||
|
||||
// Keep only selected keywords that are in the manual list
|
||||
clearPatentsCache();
|
||||
const manualSet = new Set(this.getKeywordLabels(this.manualKeywords()));
|
||||
this.selectedKeywords.set(
|
||||
this.selectedKeywords().filter((k) => manualSet.has(k)),
|
||||
@@ -762,12 +741,11 @@ export class KeywordsSearchComponent {
|
||||
|
||||
search(): void {
|
||||
this.showVisualization.set(false);
|
||||
this.showPatents.set(false);
|
||||
const fuzzySearch =
|
||||
this.route.snapshot.queryParamMap.get('fuzzy') === 'true';
|
||||
const fuzzySearch = this.topicMappingSearch();
|
||||
const payload: SearchResultsPayload = {
|
||||
extractedKeywords: this.getSelectedExtractedKeywordEntries(),
|
||||
manualKeywords: this.getSelectedManualKeywordEntries(),
|
||||
patentKeywordEntries: this.getSelectedPatentKeywordEntries(),
|
||||
keywords: this.selectedKeywords(),
|
||||
options: {
|
||||
fuzzy: fuzzySearch,
|
||||
@@ -795,16 +773,9 @@ export class KeywordsSearchComponent {
|
||||
}
|
||||
|
||||
visualize(): void {
|
||||
this.showPatents.set(false);
|
||||
this.showVisualization.set(true);
|
||||
}
|
||||
|
||||
loadPatentsForSelection(): void {
|
||||
this.showVisualization.set(false);
|
||||
this.showPatents.set(true);
|
||||
this.loadMatchingPatents();
|
||||
}
|
||||
|
||||
// --- Helpers --------------------------------------------------------------
|
||||
|
||||
private applyExtractedKeywords(keywords: ExtractedKeywords): void {
|
||||
@@ -1229,35 +1200,6 @@ export class KeywordsSearchComponent {
|
||||
}
|
||||
}
|
||||
|
||||
private loadMatchingPatents(): void {
|
||||
const keywords = this.buildPatentSearchItems(
|
||||
this.getSelectedPatentKeywordEntries(),
|
||||
);
|
||||
if (keywords.length === 0) {
|
||||
this.patentMatches.set([]);
|
||||
this.patentsLoaded.set(true);
|
||||
return;
|
||||
}
|
||||
|
||||
this.loadingPatents.set(true);
|
||||
this.patentsError.set(false);
|
||||
|
||||
this.keywordsService.getPatentsByKeywords({ keywords }).subscribe({
|
||||
next: (response) => {
|
||||
this.patentMatches.set(response.patents ?? []);
|
||||
this.patentsLoaded.set(true);
|
||||
this.loadingPatents.set(false);
|
||||
},
|
||||
error: (error) => {
|
||||
console.error('Patent search failed:', error);
|
||||
this.patentMatches.set([]);
|
||||
this.patentsLoaded.set(true);
|
||||
this.patentsError.set(true);
|
||||
this.loadingPatents.set(false);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private getSelectedPatentKeywordEntries(): Array<{
|
||||
entry: KeywordEntryWithTopic;
|
||||
level: KeywordPatentLevel;
|
||||
@@ -1283,21 +1225,4 @@ export class KeywordsSearchComponent {
|
||||
.map((entry) => ({ entry, level: 'custom' as const })),
|
||||
];
|
||||
}
|
||||
|
||||
private buildPatentSearchItems(
|
||||
items: Array<{ entry: KeywordEntryWithTopic; level: KeywordPatentLevel }>,
|
||||
): KeywordPatentSearchItem[] {
|
||||
return items
|
||||
.map(({ entry, level }) => ({
|
||||
keyword: entry.llm_keyword.keyword,
|
||||
keyword_level: level,
|
||||
topic_id: entry.topic_mapping?.topic?.id ?? null,
|
||||
topic_display_name: entry.topic_mapping?.topic?.display_name ?? null,
|
||||
subfield_name:
|
||||
entry.topic_mapping?.topic?.subfield?.display_name ?? null,
|
||||
field_name: entry.topic_mapping?.topic?.field?.display_name ?? null,
|
||||
relevance_score: entry.llm_keyword.relevance_score ?? 1,
|
||||
}))
|
||||
.filter((item) => item.keyword.trim().length > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,177 @@
|
||||
import { KeywordEntryWithTopic } from '../../api/model/keywordEntryWithTopic';
|
||||
import { KeywordPatentMatch } from '../../api/model/keywordPatentMatch';
|
||||
import { KeywordPatentSearchItem } from '../../api/model/keywordPatentSearchItem';
|
||||
import {
|
||||
PatentKeywordEntry,
|
||||
SearchResultsPayload,
|
||||
} from './search-results/search-results-state.service';
|
||||
|
||||
export const PATENTS_CACHE_KEY = 'keywords-patents-cache';
|
||||
|
||||
export interface PatentsCache {
|
||||
keywords: string[];
|
||||
matches: KeywordPatentMatch[];
|
||||
}
|
||||
|
||||
export function buildPatentSearchItems(
|
||||
items: PatentKeywordEntry[],
|
||||
): KeywordPatentSearchItem[] {
|
||||
return items
|
||||
.map(({ entry, level }) => ({
|
||||
keyword: entry.llm_keyword.keyword,
|
||||
keyword_level: level,
|
||||
topic_id: entry.topic_mapping?.topic?.id ?? null,
|
||||
topic_display_name: entry.topic_mapping?.topic?.display_name ?? null,
|
||||
subfield_name: entry.topic_mapping?.topic?.subfield?.display_name ?? null,
|
||||
field_name: entry.topic_mapping?.topic?.field?.display_name ?? null,
|
||||
relevance_score: entry.llm_keyword.relevance_score ?? 1,
|
||||
}))
|
||||
.filter((item) => item.keyword.trim().length > 0);
|
||||
}
|
||||
|
||||
export function buildPatentSearchItemsFromPayload(
|
||||
payload: SearchResultsPayload | null,
|
||||
): KeywordPatentSearchItem[] {
|
||||
if (!payload) return [];
|
||||
|
||||
if (payload.patentKeywordEntries?.length) {
|
||||
return buildPatentSearchItems(payload.patentKeywordEntries);
|
||||
}
|
||||
|
||||
const selected = new Set(
|
||||
payload.keywords.map((keyword) => normalizeKeyword(keyword)),
|
||||
);
|
||||
const isSelected = (entry: KeywordEntryWithTopic) =>
|
||||
selected.has(normalizeKeyword(entry.llm_keyword.keyword));
|
||||
|
||||
const fallbackEntries: PatentKeywordEntry[] = [
|
||||
...payload.extractedKeywords
|
||||
.filter(isSelected)
|
||||
.map((entry) => ({ entry, level: 'coarse' as const })),
|
||||
...payload.manualKeywords
|
||||
.filter(isSelected)
|
||||
.map((entry) => ({ entry, level: 'custom' as const })),
|
||||
];
|
||||
|
||||
return buildPatentSearchItems(fallbackEntries);
|
||||
}
|
||||
|
||||
export function readPatentsCache(
|
||||
keywords: string[],
|
||||
): KeywordPatentMatch[] | null {
|
||||
const raw = sessionStorage.getItem(PATENTS_CACHE_KEY);
|
||||
if (!raw) return null;
|
||||
|
||||
try {
|
||||
const cache = JSON.parse(raw) as PatentsCache;
|
||||
if (!sameKeywordSet(cache.keywords, keywords)) return null;
|
||||
return cache.matches ?? [];
|
||||
} catch {
|
||||
sessionStorage.removeItem(PATENTS_CACHE_KEY);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
export function writePatentsCache(
|
||||
keywords: string[],
|
||||
matches: KeywordPatentMatch[],
|
||||
): void {
|
||||
try {
|
||||
const cache: PatentsCache = { keywords, matches };
|
||||
sessionStorage.setItem(PATENTS_CACHE_KEY, JSON.stringify(cache));
|
||||
} catch (error) {
|
||||
console.error('Failed to cache patent results:', error);
|
||||
}
|
||||
}
|
||||
|
||||
export function clearPatentsCache(): void {
|
||||
sessionStorage.removeItem(PATENTS_CACHE_KEY);
|
||||
}
|
||||
|
||||
function normalizeKeyword(value: string): string {
|
||||
return value.trim().toLowerCase();
|
||||
}
|
||||
|
||||
function sameKeywordSet(a: string[], b: string[]): boolean {
|
||||
if (a.length !== b.length) return false;
|
||||
const setA = new Set(a.map((keyword) => normalizeKeyword(keyword)));
|
||||
return b.every((keyword) => setA.has(normalizeKeyword(keyword)));
|
||||
}
|
||||
|
||||
export interface PatentScoreWeights {
|
||||
ipc: number;
|
||||
topic: number;
|
||||
text: number;
|
||||
}
|
||||
|
||||
export const DEFAULT_PATENT_SCORE_WEIGHTS: PatentScoreWeights = {
|
||||
ipc: 0.6,
|
||||
topic: 0.25,
|
||||
text: 0.15,
|
||||
};
|
||||
|
||||
export function normalizePatentScoreWeights(
|
||||
raw: Record<string, number>,
|
||||
): PatentScoreWeights {
|
||||
const ipc = raw['ipc'] ?? DEFAULT_PATENT_SCORE_WEIGHTS.ipc;
|
||||
const topic = raw['topic'] ?? DEFAULT_PATENT_SCORE_WEIGHTS.topic;
|
||||
const text = raw['text'] ?? DEFAULT_PATENT_SCORE_WEIGHTS.text;
|
||||
const sum = ipc + topic + text;
|
||||
if (sum <= 0) {
|
||||
return { ...DEFAULT_PATENT_SCORE_WEIGHTS };
|
||||
}
|
||||
return { ipc: ipc / sum, topic: topic / sum, text: text / sum };
|
||||
}
|
||||
|
||||
export function computePatentMatchScore(
|
||||
match: Pick<KeywordPatentMatch, 'ipc_score' | 'topic_score' | 'text_score'>,
|
||||
weights: PatentScoreWeights,
|
||||
): number {
|
||||
return (
|
||||
Math.round(
|
||||
(weights.ipc * match.ipc_score +
|
||||
weights.topic * match.topic_score +
|
||||
weights.text * match.text_score) *
|
||||
10000,
|
||||
) / 10000
|
||||
);
|
||||
}
|
||||
|
||||
export function applyPatentScoreWeights(
|
||||
matches: KeywordPatentMatch[],
|
||||
weights: PatentScoreWeights,
|
||||
): KeywordPatentMatch[] {
|
||||
return [...matches]
|
||||
.map((match) => ({
|
||||
...match,
|
||||
match_score: computePatentMatchScore(match, weights),
|
||||
}))
|
||||
.sort((a, b) => {
|
||||
const scoreDiff = b.match_score - a.match_score;
|
||||
if (scoreDiff !== 0) {
|
||||
return scoreDiff;
|
||||
}
|
||||
|
||||
const dateA = a.patent.publication_date ?? '';
|
||||
const dateB = b.patent.publication_date ?? '';
|
||||
if (dateA !== dateB) {
|
||||
return dateB.localeCompare(dateA);
|
||||
}
|
||||
|
||||
return a.patent.patent_id.localeCompare(b.patent.patent_id);
|
||||
});
|
||||
}
|
||||
|
||||
function hasPatentComponentScores(match: KeywordPatentMatch): boolean {
|
||||
return (
|
||||
typeof match.ipc_score === 'number' &&
|
||||
typeof match.topic_score === 'number' &&
|
||||
typeof match.text_score === 'number'
|
||||
);
|
||||
}
|
||||
|
||||
export function canReweightPatentMatches(
|
||||
matches: KeywordPatentMatch[],
|
||||
): boolean {
|
||||
return matches.length > 0 && matches.every(hasPatentComponentScores);
|
||||
}
|
||||
+12
-12
@@ -1,22 +1,12 @@
|
||||
<div class="result-layout">
|
||||
<mat-card class="results-card">
|
||||
<mat-card-content class="results-placeholder">
|
||||
<mat-icon>groups</mat-icon>
|
||||
<h2>Patentenliste</h2>
|
||||
<p>
|
||||
Die aktuelle Gewichtung ist unter <code>normalized</code> verfügbar.
|
||||
</p>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
<mat-card class="weights-card">
|
||||
<mat-card-content>
|
||||
<app-weights-sliders
|
||||
[options]="weightOptions"
|
||||
[initialWeights]="defaultWeights"
|
||||
title="Patenten-Gewichtung"
|
||||
description="Werte zwischen 0 und 1. Summe wird normalisiert zu 1."
|
||||
resetLabel="Ausgewogen"
|
||||
description="Steuert die Gewichtung von IPC/CPC-Match, OpenAlex-Topic und Text-Match für den Gesamt-Score."
|
||||
resetLabel="Standard"
|
||||
applyLabel="Neu gewichten"
|
||||
normalizedTitle="Normalisiert"
|
||||
queryParamPrefix="patentW_"
|
||||
@@ -28,4 +18,14 @@
|
||||
(applyWeights)="onApplyWeights($event)" />
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
||||
<div class="results-card">
|
||||
<app-keywords-patents
|
||||
[matches]="patentMatches()"
|
||||
[loading]="loadingPatents()"
|
||||
[error]="patentsError()"
|
||||
[showReload]="state.hasValidSearch()"
|
||||
[reloadDisabled]="loadingPatents() || !state.hasValidSearch()"
|
||||
(reload)="reloadPatents()" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+13
-4
@@ -3,22 +3,22 @@
|
||||
============================================================ */
|
||||
.result-layout {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(300px, 420px) 1fr;
|
||||
grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
|
||||
grid-template-areas: 'summary results';
|
||||
gap: 0.75rem;
|
||||
align-items: start;
|
||||
}
|
||||
|
||||
.search-summary-card {
|
||||
.weights-card {
|
||||
grid-area: summary;
|
||||
}
|
||||
|
||||
.results-card {
|
||||
grid-area: results;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.search-summary-card,
|
||||
.results-card {
|
||||
.weights-card {
|
||||
background: var(--sg-surface, #ffffff);
|
||||
border: 1px solid var(--sg-divider, rgba(0, 0, 0, 0.12));
|
||||
box-shadow: none;
|
||||
@@ -27,3 +27,12 @@
|
||||
padding: 0.75rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.result-layout {
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-areas:
|
||||
'summary'
|
||||
'results';
|
||||
}
|
||||
}
|
||||
|
||||
+111
-62
@@ -1,112 +1,161 @@
|
||||
import { Component, inject, signal } from '@angular/core';
|
||||
import { Component, inject, OnInit, signal } from '@angular/core';
|
||||
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
import { KeywordsService } from '../../../../api/api/keywords.service';
|
||||
import { KeywordPatentMatch } from '../../../../api/model/keywordPatentMatch';
|
||||
import { PatentsByKeywordsResponse } from '../../../../api/model/patentsByKeywordsResponse';
|
||||
import {
|
||||
WeightMap,
|
||||
WeightSliderOption,
|
||||
WeightsSlidersComponent,
|
||||
WeightsSlidersValue,
|
||||
} from '../../../../shared/ui/weights-sliders/weights-sliders.component';
|
||||
import { KeywordsPatentsComponent } from '../../keywords-patents/keywords-patents.component';
|
||||
import {
|
||||
applyPatentScoreWeights,
|
||||
buildPatentSearchItemsFromPayload,
|
||||
canReweightPatentMatches,
|
||||
clearPatentsCache,
|
||||
DEFAULT_PATENT_SCORE_WEIGHTS,
|
||||
normalizePatentScoreWeights,
|
||||
readPatentsCache,
|
||||
writePatentsCache,
|
||||
} from '../../patent-search.utils';
|
||||
import { SearchResultsStateService } from '../search-results-state.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-patents-results',
|
||||
imports: [MatCardModule, MatIconModule, WeightsSlidersComponent],
|
||||
imports: [
|
||||
MatCardModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
WeightsSlidersComponent,
|
||||
KeywordsPatentsComponent,
|
||||
],
|
||||
templateUrl: './patents-results.component.html',
|
||||
styleUrl: './patents-results.component.scss',
|
||||
})
|
||||
export class KeywordsToPatentsResultsComponent {
|
||||
// injects the state set by the parent route — no duplicate parsing here
|
||||
private readonly state = inject(SearchResultsStateService);
|
||||
export class KeywordsToPatentsResultsComponent implements OnInit {
|
||||
protected readonly state = inject(SearchResultsStateService);
|
||||
private readonly keywordsService = inject(KeywordsService);
|
||||
|
||||
readonly defaultWeights: WeightMap = {
|
||||
param1: 0.33,
|
||||
param2: 0.33,
|
||||
param3: 0.34,
|
||||
};
|
||||
readonly defaultWeights: WeightMap = { ...DEFAULT_PATENT_SCORE_WEIGHTS };
|
||||
|
||||
readonly weightOptions: WeightSliderOption[] = [
|
||||
{
|
||||
key: 'param1',
|
||||
label: 'Parameter 1',
|
||||
icon: 'workspace_premium',
|
||||
description: 'Gewichtet Parameter 1.',
|
||||
defaultValue: 0.5,
|
||||
queryParamName: 'wParam1',
|
||||
key: 'ipc',
|
||||
label: 'IPC/CPC-Match',
|
||||
icon: 'category',
|
||||
description:
|
||||
'Gewichtet die Übereinstimmung der Patent-Klassifikation (IPC/CPC) mit den Keywords.',
|
||||
defaultValue: DEFAULT_PATENT_SCORE_WEIGHTS.ipc,
|
||||
queryParamName: 'wIpc',
|
||||
},
|
||||
{
|
||||
key: 'param2',
|
||||
label: 'Parameter 2',
|
||||
icon: 'workspace_premium',
|
||||
description: 'Gewichtet Parameter 2.',
|
||||
defaultValue: 0.5,
|
||||
queryParamName: 'wParam2',
|
||||
key: 'topic',
|
||||
label: 'OpenAlex-Topic',
|
||||
icon: 'hub',
|
||||
description:
|
||||
'Gewichtet die thematische Übereinstimmung über OpenAlex-Topics und Fachgebiete.',
|
||||
defaultValue: DEFAULT_PATENT_SCORE_WEIGHTS.topic,
|
||||
queryParamName: 'wTopic',
|
||||
},
|
||||
{
|
||||
key: 'param3',
|
||||
label: 'Parameter 3',
|
||||
icon: 'workspace_premium',
|
||||
description: 'Gewichtet Parameter 3.',
|
||||
defaultValue: 0.5,
|
||||
queryParamName: 'wParam3',
|
||||
key: 'text',
|
||||
label: 'Text-Match',
|
||||
icon: 'article',
|
||||
description:
|
||||
'Gewichtet Treffer der Keywords im Patenttitel und in der Zusammenfassung.',
|
||||
defaultValue: DEFAULT_PATENT_SCORE_WEIGHTS.text,
|
||||
queryParamName: 'wText',
|
||||
},
|
||||
];
|
||||
|
||||
readonly currentWeights = signal<WeightsSlidersValue>({
|
||||
raw: this.defaultWeights,
|
||||
normalized: {
|
||||
param1: 0.33,
|
||||
param2: 0.33,
|
||||
param3: 0.34,
|
||||
},
|
||||
rawSum: 2.5,
|
||||
normalized: { ...DEFAULT_PATENT_SCORE_WEIGHTS },
|
||||
rawSum: 1,
|
||||
normalizedSum: 1,
|
||||
valid: true,
|
||||
});
|
||||
|
||||
readonly projects = signal<unknown[]>([]); // placeholder until the results service lands
|
||||
readonly patentMatches = signal<KeywordPatentMatch[]>([]);
|
||||
readonly loadingPatents = signal(false);
|
||||
readonly patentsError = signal(false);
|
||||
|
||||
private hasLoadedInitial = false;
|
||||
private readonly patentMatchesBase = signal<KeywordPatentMatch[]>([]);
|
||||
|
||||
ngOnInit(): void {
|
||||
const cached = readPatentsCache(this.state.keywords());
|
||||
if (cached) {
|
||||
this.setPatentMatches(cached);
|
||||
return;
|
||||
}
|
||||
|
||||
this.loadMatchingPatents();
|
||||
}
|
||||
|
||||
onWeightsChange(value: WeightsSlidersValue): void {
|
||||
this.currentWeights.set(value);
|
||||
|
||||
// fires once with the query-param-aware initial state — use it to load
|
||||
if (!this.hasLoadedInitial) {
|
||||
this.hasLoadedInitial = true;
|
||||
this.loadprojects();
|
||||
}
|
||||
}
|
||||
|
||||
onApplyWeights(value: WeightsSlidersValue): void {
|
||||
this.currentWeights.set(value);
|
||||
this.loadprojects();
|
||||
if (!canReweightPatentMatches(this.patentMatchesBase())) {
|
||||
this.reloadPatents();
|
||||
return;
|
||||
}
|
||||
this.updateDisplayedMatches();
|
||||
}
|
||||
|
||||
private loadprojects(): void {
|
||||
const weights = this.currentWeights();
|
||||
reloadPatents(): void {
|
||||
clearPatentsCache();
|
||||
this.loadMatchingPatents();
|
||||
}
|
||||
|
||||
const requestPayload = {
|
||||
manualKeywords: this.state.manualKeywords(),
|
||||
extractedKeywords: this.state.extractedKeywords(),
|
||||
keywords: this.state.keywords(),
|
||||
fuzzy: this.state.fuzzySearch(),
|
||||
weights: {
|
||||
raw: weights.raw,
|
||||
normalized: weights.normalized,
|
||||
private loadMatchingPatents(): void {
|
||||
const keywords = buildPatentSearchItemsFromPayload(this.state.payload());
|
||||
if (keywords.length === 0) {
|
||||
this.setPatentMatches([]);
|
||||
return;
|
||||
}
|
||||
|
||||
this.loadingPatents.set(true);
|
||||
this.patentsError.set(false);
|
||||
|
||||
this.keywordsService.getPatentsByKeywords({ keywords }).subscribe({
|
||||
next: (response: PatentsByKeywordsResponse) => {
|
||||
this.setPatentMatches(response.patents ?? []);
|
||||
this.loadingPatents.set(false);
|
||||
},
|
||||
};
|
||||
error: (error: unknown) => {
|
||||
console.error('Patent search failed:', error);
|
||||
this.setPatentMatches([]);
|
||||
this.patentsError.set(true);
|
||||
this.loadingPatents.set(false);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
console.log(requestPayload);
|
||||
private setPatentMatches(matches: KeywordPatentMatch[]): void {
|
||||
this.patentMatchesBase.set(matches);
|
||||
this.updateDisplayedMatches();
|
||||
writePatentsCache(this.state.keywords(), this.patentMatchesBase());
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO:
|
||||
* this.projectsService.searchprojects(requestPayload).subscribe({
|
||||
* next: results => this.projects.set(results),
|
||||
* error: error => console.error(error),
|
||||
* });
|
||||
*/
|
||||
private updateDisplayedMatches(): void {
|
||||
const base = this.patentMatchesBase();
|
||||
if (!canReweightPatentMatches(base)) {
|
||||
this.patentMatches.set(base);
|
||||
return;
|
||||
}
|
||||
|
||||
const weights = normalizePatentScoreWeights(
|
||||
this.currentWeights().normalized,
|
||||
);
|
||||
this.patentMatches.set(applyPatentScoreWeights(base, weights));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
import { Injectable, computed, signal } from '@angular/core';
|
||||
import { KeywordEntryWithTopic } from '../../../api/model/keywordEntryWithTopic';
|
||||
|
||||
export type KeywordPatentLevel = 'broad' | 'coarse' | 'fine' | 'custom';
|
||||
|
||||
export interface PatentKeywordEntry {
|
||||
entry: KeywordEntryWithTopic;
|
||||
level: KeywordPatentLevel;
|
||||
}
|
||||
|
||||
export interface SearchResultsPayload {
|
||||
extractedKeywords: KeywordEntryWithTopic[];
|
||||
manualKeywords: KeywordEntryWithTopic[];
|
||||
keywords: string[];
|
||||
patentKeywordEntries?: PatentKeywordEntry[];
|
||||
options: {
|
||||
fuzzy: boolean;
|
||||
};
|
||||
|
||||
@@ -132,6 +132,9 @@ export class KeywordsSearchResultsComponent {
|
||||
options: { fuzzy: fuzzySearch },
|
||||
extractedKeywords: cacheMatches ? cached!.extractedKeywords : [],
|
||||
manualKeywords: cacheMatches ? cached!.manualKeywords : [],
|
||||
patentKeywordEntries: cacheMatches
|
||||
? cached!.patentKeywordEntries
|
||||
: undefined,
|
||||
});
|
||||
|
||||
this.fuzzySearch.set(fuzzySearch);
|
||||
@@ -215,6 +218,7 @@ export class KeywordsSearchResultsComponent {
|
||||
extractedKeywords: maybePayload.extractedKeywords ?? [],
|
||||
manualKeywords: maybePayload.manualKeywords ?? [],
|
||||
keywords: maybePayload.keywords ?? [],
|
||||
patentKeywordEntries: maybePayload.patentKeywordEntries,
|
||||
options: {
|
||||
fuzzy: maybePayload.options?.fuzzy ?? false,
|
||||
},
|
||||
|
||||
@@ -81,10 +81,11 @@
|
||||
<mat-divider />
|
||||
|
||||
@if (loading) {
|
||||
<div class="state-message">
|
||||
<mat-progress-spinner diameter="36" mode="indeterminate" />
|
||||
<span>Lade Patente...</span>
|
||||
</div>
|
||||
<app-loading
|
||||
text="Patentdaten werden geladen..."
|
||||
icon="workspace_premium"
|
||||
[size]="150"
|
||||
[diameter]="150" />
|
||||
} @else if (error) {
|
||||
<p class="state-message error">Fehler beim Laden der Patente.</p>
|
||||
} @else if (showDetail && selectedPatent) {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { MatCardModule } from '@angular/material/card';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatPaginatorModule, PageEvent } from '@angular/material/paginator';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatChipsModule } from '@angular/material/chips';
|
||||
import { MatDividerModule } from '@angular/material/divider';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
@@ -17,6 +16,7 @@ import { PatentEntry } from '../../api/model/patentEntry';
|
||||
import { IpcClassification } from '../../api';
|
||||
import { OpenAlexTopicTag } from '../../api/model/openAlexTopicTag';
|
||||
import { TopicChipComponent } from '../../shared/ui/topic-chip/topic-chip.component';
|
||||
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
|
||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
@@ -47,10 +47,10 @@ const MIN_YEAR = 1978;
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
MatPaginatorModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatChipsModule,
|
||||
MatDividerModule,
|
||||
TopicChipComponent,
|
||||
LoadingComponent,
|
||||
],
|
||||
templateUrl: './patents.component.html',
|
||||
styleUrl: './patents.component.scss',
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
@if (loading) {
|
||||
<p class="message">Lade Patente...</p>
|
||||
<app-loading
|
||||
text="Patentdaten werden geladen..."
|
||||
icon="workspace_premium"
|
||||
[size]="150"
|
||||
[diameter]="150" />
|
||||
} @else if (error) {
|
||||
<p class="message">Fehler beim Laden der Patente.</p>
|
||||
} @else if (patents.length === 0) {
|
||||
|
||||
@@ -9,13 +9,14 @@ import {
|
||||
formatPatentDate,
|
||||
getPublicationStageLabel,
|
||||
} from '../patent-detail/patent-detail.utils';
|
||||
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||
|
||||
type SortMode = 'date' | 'title';
|
||||
type SourceFilter = 'all' | 'EPO' | 'USPTO';
|
||||
|
||||
@Component({
|
||||
selector: 'app-person-patents',
|
||||
imports: [CommonModule],
|
||||
imports: [CommonModule, LoadingComponent],
|
||||
templateUrl: './person-patents.component.html',
|
||||
styleUrl: './person-patents.component.scss',
|
||||
})
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>Forschungszwecke</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
@if (this.authorWorkPurposes().purposes?.length === 0) {
|
||||
@if (this.authorWorkClassifications().length === 0) {
|
||||
<div class="no-results">
|
||||
Keine klassifizierten Publikationen gefunden.
|
||||
</div>
|
||||
@@ -18,223 +18,60 @@
|
||||
[options]="chartOption"
|
||||
style="height: 300px; width: 100%"></div>
|
||||
}
|
||||
<div
|
||||
style="
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 1rem;
|
||||
">
|
||||
<div class="purpose-info-cards">
|
||||
<app-info-card
|
||||
[value]="this.basicResearchAmount() + ''"
|
||||
description="Grundlagenforschung" />
|
||||
[description]="this.basicResearchLabel" />
|
||||
<app-info-card
|
||||
[value]="this.appliedResearchAmount() + ''"
|
||||
description="Anwendungsbasierte Forschung" />
|
||||
[description]="this.appliedResearchLabel" />
|
||||
<app-info-card
|
||||
[value]="this.nonResearchAmount() + ''"
|
||||
description="Nicht-forschende Tätigkeit" />
|
||||
[description]="this.nonResearchLabel" />
|
||||
<app-info-card
|
||||
[value]="this.experimentalDevelopmentAmount() + ''"
|
||||
description="Experimentelle Entwicklung" />
|
||||
[description]="this.experimentalDevelopmentLabel" />
|
||||
<app-info-card
|
||||
[value]="this.notClassifiedAmmount() + ''"
|
||||
description="Nicht klassifiziert" />
|
||||
[description]="this.notClassifiedLabel" />
|
||||
<div>
|
||||
<div class="classification-disclaimer">
|
||||
<button
|
||||
mat-icon-button
|
||||
matTooltip="Die Klassifizierung der Publikationen erfolgt nur für eine ausgewählte Anzahl von Institutionen. Wenn eine Publikation nicht zu einer dieser Institutionen gehört, wird sie nicht klassifiziert.">
|
||||
<mat-icon>info_outline</mat-icon>
|
||||
</button>
|
||||
<span
|
||||
>Im Diagramm sind ausschließlich klassifizierte Publikationen
|
||||
enthalten.</span
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</mat-expansion-panel>
|
||||
<mat-expansion-panel class="mat-elevation-z1" [expanded]="true">
|
||||
<mat-expansion-panel-header>
|
||||
<mat-panel-title>Publikationsliste</mat-panel-title>
|
||||
<mat-panel-description
|
||||
>{{ totalElements() }} Publikationen</mat-panel-description
|
||||
>{{ total() }} Publikationen</mat-panel-description
|
||||
>
|
||||
</mat-expansion-panel-header>
|
||||
<div class="publication-filter-stack">
|
||||
<form class="publication-filters">
|
||||
<mat-form-field>
|
||||
<mat-icon matPrefix class="filter-prefix-icon"
|
||||
>calendar_today</mat-icon
|
||||
>
|
||||
<mat-select
|
||||
placeholder="Jahr"
|
||||
multiple
|
||||
[panelWidth]="null"
|
||||
(selectionChange)="handleYearSelectionChange($event)"
|
||||
(opened)="focusSelectSearch(yearSearchInput)"
|
||||
[value]="this.selectedYearsQueryParams()">
|
||||
<mat-select-trigger>{{
|
||||
yearSelectionSummary()
|
||||
}}</mat-select-trigger>
|
||||
<div class="select-search" (click)="$event.stopPropagation()">
|
||||
<mat-icon class="select-search__icon">search</mat-icon>
|
||||
<input
|
||||
#yearSearchInput
|
||||
type="text"
|
||||
class="select-search__input"
|
||||
placeholder="Jahr suchen…"
|
||||
(keydown)="$event.stopPropagation()" />
|
||||
</div>
|
||||
@for (year of filteredYearOptions(); track year) {
|
||||
<mat-option [value]="year">{{ year }}</mat-option>
|
||||
} @empty {
|
||||
<div class="select-search__empty">Keine Treffer</div>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field>
|
||||
<mat-icon matPrefix class="filter-prefix-icon">category</mat-icon>
|
||||
<mat-select
|
||||
placeholder="Typ"
|
||||
multiple
|
||||
[panelWidth]="null"
|
||||
(selectionChange)="handleTypeSelectionChange($event)"
|
||||
(opened)="focusSelectSearch(typeSearchInput)"
|
||||
[value]="this.selectedTypesQueryParams()">
|
||||
<mat-select-trigger>{{
|
||||
typeSelectionSummary()
|
||||
}}</mat-select-trigger>
|
||||
<div class="select-search" (click)="$event.stopPropagation()">
|
||||
<mat-icon class="select-search__icon">search</mat-icon>
|
||||
<input
|
||||
#typeSearchInput
|
||||
type="text"
|
||||
class="select-search__input"
|
||||
[formControl]="typeSearchControl"
|
||||
placeholder="Typ suchen…"
|
||||
(keydown)="$event.stopPropagation()" />
|
||||
</div>
|
||||
@for (type of filteredTypeOptions(); track type.value) {
|
||||
<mat-option [value]="type.value">{{ type.label }}</mat-option>
|
||||
} @empty {
|
||||
<div class="select-search__empty">Keine Treffer</div>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
<div class="publication-list">
|
||||
<app-publication-filter
|
||||
[selectedTopics]="selectedTopics()"
|
||||
[selectedInstitutions]="selectedInstitutions()"
|
||||
[showAuthorFilter]="false" />
|
||||
|
||||
<mat-form-field>
|
||||
<mat-icon matPrefix class="filter-prefix-icon">translate</mat-icon>
|
||||
<mat-select
|
||||
placeholder="Sprache"
|
||||
multiple
|
||||
[panelWidth]="null"
|
||||
(selectionChange)="handleLanguageSelectionChange($event)"
|
||||
(opened)="focusSelectSearch(languageSearchInput)"
|
||||
[value]="this.selectedLanguagesQueryParams()">
|
||||
<mat-select-trigger>{{
|
||||
languageSelectionSummary()
|
||||
}}</mat-select-trigger>
|
||||
<div class="select-search" (click)="$event.stopPropagation()">
|
||||
<mat-icon class="select-search__icon">search</mat-icon>
|
||||
<input
|
||||
#languageSearchInput
|
||||
type="text"
|
||||
class="select-search__input"
|
||||
[formControl]="languageSearchControl"
|
||||
placeholder="Sprache suchen…"
|
||||
(keydown)="$event.stopPropagation()" />
|
||||
</div>
|
||||
@for (
|
||||
language of filteredLanguageOptions();
|
||||
track language.value
|
||||
) {
|
||||
<mat-option [value]="language.value">{{
|
||||
language.label
|
||||
}}</mat-option>
|
||||
} @empty {
|
||||
<div class="select-search__empty">Keine Treffer</div>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="institution-filter">
|
||||
<mat-icon matPrefix class="filter-prefix-icon">apartment</mat-icon>
|
||||
<input
|
||||
type="text"
|
||||
matInput
|
||||
[formControl]="institutionSearchControl"
|
||||
[matAutocomplete]="institutionAutocomplete"
|
||||
placeholder="Institution suchen" />
|
||||
<mat-autocomplete
|
||||
#institutionAutocomplete="matAutocomplete"
|
||||
[displayWith]="displayInstitution"
|
||||
(optionSelected)="selectInstitution($event)">
|
||||
@for (institution of institutionOptions; track institution.id) {
|
||||
<mat-option [value]="institution">
|
||||
<span>{{ institution.display_name }}</span>
|
||||
@if (institution.hint) {
|
||||
<small>{{ institution.hint }}</small>
|
||||
}
|
||||
</mat-option>
|
||||
}
|
||||
@if (
|
||||
!institutionLookupLoading &&
|
||||
institutionOptions.length === 0 &&
|
||||
institutionSearchControl.value
|
||||
) {
|
||||
<mat-option disabled>Keine Institution gefunden</mat-option>
|
||||
}
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
|
||||
<mat-form-field class="topic-filter">
|
||||
<mat-icon matPrefix class="filter-prefix-icon">label</mat-icon>
|
||||
<input
|
||||
type="text"
|
||||
matInput
|
||||
[formControl]="topicSearchControl"
|
||||
[matAutocomplete]="topicAutocomplete"
|
||||
placeholder="Thema suchen" />
|
||||
<mat-autocomplete
|
||||
#topicAutocomplete="matAutocomplete"
|
||||
[displayWith]="displayTopic"
|
||||
(optionSelected)="selectTopic($event)">
|
||||
@for (topic of topicOptions; track topic.id) {
|
||||
<mat-option [value]="topic">
|
||||
<span>{{ topic.display_name }}</span>
|
||||
@if (topic.hint) {
|
||||
<small>{{ topic.hint }}</small>
|
||||
}
|
||||
</mat-option>
|
||||
}
|
||||
@if (
|
||||
!topicLookupLoading &&
|
||||
topicOptions.length === 0 &&
|
||||
topicSearchControl.value
|
||||
) {
|
||||
<mat-option disabled>Kein Thema gefunden</mat-option>
|
||||
}
|
||||
</mat-autocomplete>
|
||||
</mat-form-field>
|
||||
|
||||
<button
|
||||
class="reset-filter-btn"
|
||||
mat-stroked-button
|
||||
type="button"
|
||||
(click)="clearFilters()"
|
||||
aria-label="Filter zurücksetzen">
|
||||
<mat-icon>filter_alt_off</mat-icon>
|
||||
<span>Zurücksetzen</span>
|
||||
</button>
|
||||
</form>
|
||||
<app-publication-table
|
||||
[page]="authorWorkPage()"
|
||||
[institutionFilterEnabled]="true" />
|
||||
<app-query-param-paginator
|
||||
[total]="total()"
|
||||
queryParamPageKey="page"
|
||||
queryParamSizeKey="size"
|
||||
[pageSizeOptions]="[10, 25, 50]" />
|
||||
</div>
|
||||
|
||||
<app-query-param-input
|
||||
queryParamKey="title"
|
||||
placeholder="Suche"
|
||||
[debounceTime]="300" />
|
||||
|
||||
<app-selected-filters [observers]="observers" />
|
||||
|
||||
<app-publication-table
|
||||
[page]="authorWorkPage()"
|
||||
[institutionFilterEnabled]="true" />
|
||||
<app-query-param-paginator
|
||||
[total]="totalElements()"
|
||||
queryParamPageKey="page"
|
||||
queryParamSizeKey="size"
|
||||
[pageSizeOptions]="paginationService.options" />
|
||||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
</div>
|
||||
|
||||
@@ -1,567 +1,5 @@
|
||||
.page {
|
||||
padding: 28px 32px 42px;
|
||||
max-width: 100%;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.publication-filter-stack {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 25px;
|
||||
}
|
||||
|
||||
.publication-filters {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.publication-filters mat-form-field {
|
||||
width: 175px;
|
||||
}
|
||||
|
||||
.publication-filters .institution-filter,
|
||||
.publication-filters .topic-filter {
|
||||
flex: 1 1 200px;
|
||||
width: auto;
|
||||
min-width: 180px;
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
.publication-filters .sort-field {
|
||||
width: 235px;
|
||||
}
|
||||
|
||||
.publication-filters .reset-filter-btn {
|
||||
min-width: 132px;
|
||||
height: 42px;
|
||||
padding: 0 14px;
|
||||
border-color: #d9e2f0;
|
||||
border-radius: var(--sg-radius-sm);
|
||||
color: var(--sg-text);
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.publication-filters .reset-filter-btn mat-icon {
|
||||
margin-right: 6px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-subscript-wrapper {
|
||||
display: none;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-text-field-wrapper {
|
||||
height: 42px;
|
||||
background: var(--sg-surface-soft);
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
transition:
|
||||
border-color 0.15s,
|
||||
box-shadow 0.15s;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-focused .mat-mdc-text-field-wrapper {
|
||||
border-color: var(--sg-primary);
|
||||
box-shadow: 0 0 0 2px var(--sg-primary-soft);
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-flex {
|
||||
height: 100%;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-infix {
|
||||
min-height: 0;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mdc-notched-outline__leading,
|
||||
::ng-deep .publication-filters .mdc-notched-outline__notch,
|
||||
::ng-deep .publication-filters .mdc-notched-outline__trailing {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.filter-prefix-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
font-size: 18px;
|
||||
color: var(--sg-text-soft);
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-icon-prefix {
|
||||
padding: 0 4px 0 10px;
|
||||
color: var(--sg-text-soft);
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-select-value,
|
||||
::ng-deep .publication-filters input.mat-mdc-input-element {
|
||||
color: var(--sg-text);
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-select-placeholder,
|
||||
::ng-deep .publication-filters input.mat-mdc-input-element::placeholder {
|
||||
color: var(--sg-text-muted);
|
||||
opacity: 1;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
::ng-deep .publication-filters .mat-mdc-form-field-icon-suffix,
|
||||
::ng-deep .publication-filters .mat-mdc-select-arrow-wrapper {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.active-filters-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
padding: 8px 16px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: var(--sg-surface);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.active-filters-label {
|
||||
font-weight: 600;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
.chips-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.filter-meta-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 8px;
|
||||
border: 1px solid var(--sg-border-strong);
|
||||
border-radius: 4px;
|
||||
background: var(--sg-surface-soft);
|
||||
color: var(--sg-text);
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.filter-topic-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: min(320px, 46vw);
|
||||
padding: 3px 8px;
|
||||
border-radius: 7px;
|
||||
background: color-mix(in srgb, var(--topic-color) 22%, #ffffff);
|
||||
color: color-mix(in srgb, var(--topic-color) 45%, #07163d);
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
box-shadow: inset 0 0 0 1px
|
||||
color-mix(in srgb, var(--topic-color) 45%, transparent);
|
||||
}
|
||||
|
||||
.filter-topic-chip__icon {
|
||||
flex: 0 0 auto;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.active-institution-filter,
|
||||
.active-meta-filter {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.filter-institution-chip,
|
||||
.publication-institution-tag {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 2px 6px;
|
||||
border: 1px solid var(--sg-primary-border, var(--sg-border));
|
||||
border-radius: 4px;
|
||||
background: var(--sg-primary-soft);
|
||||
color: var(--sg-primary);
|
||||
font-size: 10px;
|
||||
font-weight: 600;
|
||||
line-height: normal;
|
||||
}
|
||||
|
||||
.filter-institution-chip {
|
||||
max-width: 340px;
|
||||
}
|
||||
|
||||
.publication-institution-tag {
|
||||
max-width: 100%;
|
||||
margin: 0;
|
||||
font-family: inherit;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
background: var(--sg-primary);
|
||||
color: #fff;
|
||||
border-color: var(--sg-primary);
|
||||
outline: none;
|
||||
box-shadow:
|
||||
0 0 0 2px var(--sg-background),
|
||||
0 0 0 4px var(--sg-primary);
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: var(--sg-primary);
|
||||
box-shadow:
|
||||
0 0 0 1px #ffffff,
|
||||
0 0 0 3px var(--sg-primary);
|
||||
}
|
||||
|
||||
&.active:hover,
|
||||
&.active:focus-visible {
|
||||
background: var(--sg-primary);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-icon,
|
||||
.publication-institution-tag .institution-icon,
|
||||
.filter-meta-chip__icon {
|
||||
flex-shrink: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-right: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.filter-meta-chip__icon {
|
||||
color: var(--sg-text-soft);
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-name,
|
||||
.publication-institution-tag .institution-name {
|
||||
display: -webkit-box;
|
||||
-webkit-line-clamp: 2;
|
||||
-webkit-box-orient: vertical;
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.filter-institution-chip .flag-img,
|
||||
.publication-institution-tag .flag-img {
|
||||
flex-shrink: 0;
|
||||
margin-left: 6px;
|
||||
border: 1px solid;
|
||||
}
|
||||
|
||||
.filter-institution-chip .country-code,
|
||||
.publication-institution-tag .country-code {
|
||||
flex-shrink: 0;
|
||||
margin-left: 2px;
|
||||
font-size: 9px;
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-open-icon,
|
||||
.publication-institution-tag .institution-open-icon {
|
||||
flex-shrink: 0;
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
margin-left: 5px;
|
||||
font-size: 12px;
|
||||
line-height: 1;
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transition: opacity 0.15s ease;
|
||||
}
|
||||
|
||||
.filter-institution-chip:hover .institution-open-icon,
|
||||
.publication-institution-tag:hover .institution-open-icon {
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.filter-institution-chip .institution-open-icon:hover,
|
||||
.publication-institution-tag .institution-open-icon:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.filter-meta-chip__label,
|
||||
.filter-topic-chip__label {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.active-institution-filter button,
|
||||
.active-meta-filter button {
|
||||
display: flex;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--sg-text-soft);
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: var(--sg-text);
|
||||
}
|
||||
}
|
||||
|
||||
.active-institution-filter button mat-icon,
|
||||
.active-meta-filter button mat-icon {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.table-wrap {
|
||||
position: relative;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
min-width: 1120px;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0 10px;
|
||||
box-shadow: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.title {
|
||||
display: inline-block;
|
||||
max-width: 520px;
|
||||
line-height: 1.35;
|
||||
color: var(--sg-text);
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a.title:hover {
|
||||
color: var(--sg-text);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
table.is-hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.table-status {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 12px;
|
||||
min-height: 240px;
|
||||
padding: 32px;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.empty-text {
|
||||
color: rgba(0, 0, 0, 0.54);
|
||||
}
|
||||
|
||||
.cell-filter-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
margin: 0;
|
||||
padding: 3px 10px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: 999px;
|
||||
background: #fff;
|
||||
color: var(--sg-text);
|
||||
font-family: inherit;
|
||||
font-size: 12px;
|
||||
line-height: 1.2;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
border-color: var(--sg-primary);
|
||||
background: var(--sg-surface-soft);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
&.active {
|
||||
border-color: var(--sg-primary);
|
||||
color: var(--sg-primary);
|
||||
font-weight: 600;
|
||||
box-shadow:
|
||||
0 0 0 1px #ffffff,
|
||||
0 0 0 3px var(--sg-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.type-filter-btn {
|
||||
display: inline-flex;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
border-radius: 7px;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
transition: box-shadow 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
outline: none;
|
||||
box-shadow: 0 0 0 1px var(--sg-primary);
|
||||
}
|
||||
|
||||
&.active {
|
||||
box-shadow:
|
||||
0 0 0 1px #ffffff,
|
||||
0 0 0 3px var(--sg-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.topic-chips,
|
||||
.institution-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.topic-chips {
|
||||
max-width: 320px;
|
||||
}
|
||||
|
||||
.institution-tags {
|
||||
align-items: flex-start;
|
||||
max-width: 280px;
|
||||
}
|
||||
|
||||
.publication-institution-more,
|
||||
.publication-topic-more {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 24px;
|
||||
padding: 3px 8px;
|
||||
border: 1px solid var(--sg-border);
|
||||
border-radius: var(--sg-radius-sm);
|
||||
background: #fff;
|
||||
color: var(--sg-text-muted);
|
||||
font-family: inherit;
|
||||
font-size: 11px;
|
||||
line-height: 1.2;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
border-color: var(--sg-primary);
|
||||
color: var(--sg-primary);
|
||||
background: var(--sg-surface-soft);
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.publication-topic-more {
|
||||
max-width: 180px;
|
||||
}
|
||||
|
||||
::ng-deep .mat-mdc-header-cell {
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
::ng-deep .mat-mdc-row {
|
||||
height: 86px;
|
||||
}
|
||||
|
||||
::ng-deep .mat-mdc-cell {
|
||||
color: var(--sg-text);
|
||||
border-bottom-color: var(--sg-border);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.table-wrap ::ng-deep {
|
||||
.mat-mdc-header-cell {
|
||||
text-align: center;
|
||||
}
|
||||
.mat-sort-header-container {
|
||||
justify-content: center;
|
||||
}
|
||||
.mat-mdc-cell:not(.mat-column-title) {
|
||||
text-align: center;
|
||||
}
|
||||
.mat-column-institutions .institution-tags,
|
||||
.mat-column-topics .topic-chips {
|
||||
justify-content: center;
|
||||
margin-inline: auto;
|
||||
}
|
||||
|
||||
.mat-mdc-cell:not(:last-child),
|
||||
.mat-mdc-header-cell:not(:last-child) {
|
||||
border-right: 1px solid var(--sg-border);
|
||||
}
|
||||
}
|
||||
|
||||
mat-paginator {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.table-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 66px;
|
||||
padding: 0 22px 0 28px;
|
||||
border: 0;
|
||||
color: var(--sg-text-muted);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.page {
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.table-footer {
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.publication-filter-stack {
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.publication-filters {
|
||||
justify-content: stretch;
|
||||
max-width: none;
|
||||
}
|
||||
|
||||
.publication-filters mat-form-field,
|
||||
.publication-filters button {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.publication-filters .institution-filter,
|
||||
.publication-filters .topic-filter {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.active-filters-row {
|
||||
align-self: stretch;
|
||||
}
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
mat-expansion-panel {
|
||||
@@ -585,3 +23,37 @@ mat-panel-description {
|
||||
font-size: 14px;
|
||||
color: var(--sg-text-muted);
|
||||
}
|
||||
|
||||
.purpose-info-cards {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.publication-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.classification-disclaimer {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.classification-disclaimer button {
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
line-height: 20px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.classification-disclaimer mat-icon {
|
||||
font-size: 18px;
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
@@ -1,53 +1,13 @@
|
||||
import {
|
||||
Component,
|
||||
DestroyRef,
|
||||
OnInit,
|
||||
computed,
|
||||
effect,
|
||||
inject,
|
||||
input,
|
||||
} from '@angular/core';
|
||||
import { HttpClient, HttpParams } from '@angular/common/http';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import {
|
||||
MatAutocompleteModule,
|
||||
MatAutocompleteSelectedEvent,
|
||||
} from '@angular/material/autocomplete';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { MatTableModule } from '@angular/material/table';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatSelectChange, MatSelectModule } from '@angular/material/select';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
||||
import {
|
||||
catchError,
|
||||
debounceTime,
|
||||
distinctUntilChanged,
|
||||
finalize,
|
||||
map,
|
||||
of,
|
||||
switchMap,
|
||||
} from 'rxjs';
|
||||
import { Component, computed, effect, input } from '@angular/core';
|
||||
|
||||
import {
|
||||
AuthorWorkPurposes,
|
||||
InseWorksV2ModelWorkPage,
|
||||
Institution,
|
||||
InstitutionsService,
|
||||
SpecificWorkPurpose,
|
||||
Work,
|
||||
WorkPurpose,
|
||||
WorksService,
|
||||
Author,
|
||||
WorkTopic,
|
||||
WorkClassificationPage,
|
||||
WorkClassification,
|
||||
WorkPrimaryCategory,
|
||||
} from '../../api';
|
||||
import { PaginationService } from '../../shared/services/pagination.service';
|
||||
import { topicHierarchyColor } from '../../resolvers/utils/topic-colors';
|
||||
import { buildTopicHierarchyTooltip } from '../../resolvers/utils/topic-tooltip';
|
||||
import { NgxEchartsDirective } from 'ngx-echarts';
|
||||
import * as echarts from 'echarts/core';
|
||||
import {
|
||||
@@ -57,19 +17,15 @@ import {
|
||||
} from 'echarts/components';
|
||||
import { CanvasRenderer } from 'echarts/renderers';
|
||||
import { GraphChart } from 'echarts/charts';
|
||||
import { MatCardModule } from '@angular/material/card';
|
||||
import { MatExpansionModule } from '@angular/material/expansion';
|
||||
import { translateWorkType } from '../../shared/pipes/work-type.pipe';
|
||||
import { translateLanguageCode } from '../../shared/pipes/language-code.pipe';
|
||||
import { QueryParamPaginatorComponent } from '../../shared/ui/query-param-paginator/query-param-paginator.component';
|
||||
import { AppInfoCardComponent } from '../../shared/ui/app-info-card/app-info-card.component';
|
||||
import { PublicationTableComponent } from '../../shared/ui/publication-table/publication-table.component';
|
||||
import { workQueryParamKeys } from '../../resolvers/work-page.resolver';
|
||||
import {
|
||||
FilterObserver,
|
||||
SelectedFiltersComponent,
|
||||
} from '../../shared/ui/selected-filters/selected-filters.component';
|
||||
import { QueryParamInputComponent } from '../../shared/ui/query-param-input/query-param-input.component';
|
||||
import { PublicationFilterComponent } from '../../shared/ui/publication-filters/publication-filters.component';
|
||||
import { transformWorkPrimaryCategory } from '../../shared/pipes/work-primary-category.pipe';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
echarts.use([
|
||||
GridComponent,
|
||||
CanvasRenderer,
|
||||
@@ -78,34 +34,6 @@ echarts.use([
|
||||
LegendComponent,
|
||||
]);
|
||||
|
||||
interface InstitutionAutocompleteOption {
|
||||
id?: string | null;
|
||||
display_name?: string | null;
|
||||
hint?: string | null;
|
||||
cited_by_count?: number | null;
|
||||
works_count?: number | null;
|
||||
entity_type?: string | null;
|
||||
external_id?: string | null;
|
||||
}
|
||||
|
||||
interface TopicAutocompleteOption {
|
||||
id?: string | null;
|
||||
display_name?: string | null;
|
||||
hint?: string | null;
|
||||
cited_by_count?: number | null;
|
||||
works_count?: number | null;
|
||||
entity_type?: string | null;
|
||||
external_id?: string | null;
|
||||
field_id?: string | null;
|
||||
field_name?: string | null;
|
||||
domain_id?: string | null;
|
||||
domain_name?: string | null;
|
||||
}
|
||||
|
||||
interface TopicAutocompleteResponse {
|
||||
results?: TopicAutocompleteOption[] | null;
|
||||
}
|
||||
|
||||
interface YearlyPurposeCounts {
|
||||
year: number;
|
||||
basicResearch: number;
|
||||
@@ -115,171 +43,98 @@ interface YearlyPurposeCounts {
|
||||
notClassified: number;
|
||||
}
|
||||
|
||||
const PURPOSE_LABELS: Record<
|
||||
| 'BASIC_RESEARCH'
|
||||
| 'APPLIED_RESEARCH'
|
||||
| 'NON_RESEARCH'
|
||||
| 'EXPERIMENTAL_DEVELOPMENT'
|
||||
| 'NOT_CLASSIFIED',
|
||||
string
|
||||
> = {
|
||||
BASIC_RESEARCH: 'Grundlagenforschung',
|
||||
APPLIED_RESEARCH: 'anwendungsbasierte Forschung',
|
||||
NON_RESEARCH: 'nicht-forschende Tätigkeit',
|
||||
EXPERIMENTAL_DEVELOPMENT: 'experimentelle Entwicklung',
|
||||
NOT_CLASSIFIED: 'nicht klassifiziert',
|
||||
};
|
||||
@Component({
|
||||
selector: 'app-person-publications',
|
||||
imports: [
|
||||
MatButtonModule,
|
||||
MatAutocompleteModule,
|
||||
MatIconModule,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatSelectModule,
|
||||
MatSnackBarModule,
|
||||
MatTableModule,
|
||||
MatTooltipModule,
|
||||
ReactiveFormsModule,
|
||||
NgxEchartsDirective,
|
||||
MatCardModule,
|
||||
MatButtonModule,
|
||||
MatExpansionModule,
|
||||
QueryParamPaginatorComponent,
|
||||
MatTooltipModule,
|
||||
NgxEchartsDirective,
|
||||
AppInfoCardComponent,
|
||||
PublicationTableComponent,
|
||||
SelectedFiltersComponent,
|
||||
QueryParamInputComponent,
|
||||
PublicationFilterComponent,
|
||||
QueryParamPaginatorComponent,
|
||||
],
|
||||
templateUrl: './person-publications.component.html',
|
||||
styleUrl: './person-publications.component.scss',
|
||||
})
|
||||
export class PersonPublicationsComponent implements OnInit {
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
private readonly worksService = inject(WorksService);
|
||||
|
||||
export class PersonPublicationsComponent {
|
||||
authorWorkPage = input.required<InseWorksV2ModelWorkPage>();
|
||||
totalElements = computed(() => this.authorWorkPage().total ?? 0);
|
||||
total = computed(() => this.authorWorkPage().total ?? 0);
|
||||
elements = computed(() => this.authorWorkPage().elements ?? []);
|
||||
|
||||
selectedInstitutions = input.required<Array<Institution>>();
|
||||
selectedInstitutions = input.required<Array<Author>>();
|
||||
selectedTopics = input.required<Array<WorkTopic>>();
|
||||
|
||||
authorWorkPurposes = input.required<AuthorWorkPurposes>();
|
||||
authorWorkClassificationPage = input.required<WorkClassificationPage>();
|
||||
authorWorkClassifications = computed(
|
||||
() => this.authorWorkClassificationPage().elements ?? [],
|
||||
);
|
||||
|
||||
specificWorkPurposesByYear = computed(() => {
|
||||
const authorWorkPurposes = this.authorWorkPurposes();
|
||||
return this.getAuthorSpecificWorkPurposesByYear(authorWorkPurposes);
|
||||
const authorWorkClassifications = this.authorWorkClassifications();
|
||||
return this.getAuthorWorkClassificationByYear(authorWorkClassifications);
|
||||
});
|
||||
basicResearchAmount = computed(() => {
|
||||
return this.countPurpose(
|
||||
this.authorWorkPurposes().purposes || [],
|
||||
WorkPurpose.BasicResearch,
|
||||
this.authorWorkClassifications(),
|
||||
WorkPrimaryCategory.BasicResearch,
|
||||
);
|
||||
});
|
||||
basicResearchLabel = transformWorkPrimaryCategory(
|
||||
WorkPrimaryCategory.BasicResearch,
|
||||
);
|
||||
|
||||
appliedResearchAmount = computed(() => {
|
||||
return this.countPurpose(
|
||||
this.authorWorkPurposes().purposes || [],
|
||||
WorkPurpose.AppliedResearch,
|
||||
this.authorWorkClassifications(),
|
||||
WorkPrimaryCategory.AppliedResearch,
|
||||
);
|
||||
});
|
||||
appliedResearchLabel = transformWorkPrimaryCategory(
|
||||
WorkPrimaryCategory.AppliedResearch,
|
||||
);
|
||||
|
||||
nonResearchAmount = computed(() => {
|
||||
return this.countPurpose(
|
||||
this.authorWorkPurposes().purposes || [],
|
||||
WorkPurpose.NonResearch,
|
||||
this.authorWorkClassifications(),
|
||||
WorkPrimaryCategory.NonResearch,
|
||||
);
|
||||
});
|
||||
nonResearchLabel = transformWorkPrimaryCategory(
|
||||
WorkPrimaryCategory.NonResearch,
|
||||
);
|
||||
|
||||
experimentalDevelopmentAmount = computed(() => {
|
||||
return this.countPurpose(
|
||||
this.authorWorkPurposes().purposes || [],
|
||||
WorkPurpose.ExperimentalDevelopment,
|
||||
this.authorWorkClassifications(),
|
||||
WorkPrimaryCategory.ExperimentalDevelopment,
|
||||
);
|
||||
});
|
||||
experimentalDevelopmentLabel = transformWorkPrimaryCategory(
|
||||
WorkPrimaryCategory.ExperimentalDevelopment,
|
||||
);
|
||||
|
||||
notClassifiedAmmount = computed(() => {
|
||||
return this.countPurpose(
|
||||
this.authorWorkPurposes().purposes || [],
|
||||
WorkPurpose.NotClassified,
|
||||
this.authorWorkClassifications(),
|
||||
WorkPrimaryCategory.NotClassified,
|
||||
);
|
||||
});
|
||||
|
||||
expandedWorkInstitutionsId: string[] = [];
|
||||
|
||||
observers: FilterObserver[] = [
|
||||
{
|
||||
id: 'search',
|
||||
queryParamKey: workQueryParamKeys.title,
|
||||
icon: 'search',
|
||||
},
|
||||
{
|
||||
id: 'types',
|
||||
queryParamKey: workQueryParamKeys.types,
|
||||
icon: 'category',
|
||||
valueFormatter: (value: string) => {
|
||||
return translateWorkType(value) || value;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'years',
|
||||
queryParamKey: workQueryParamKeys.years,
|
||||
icon: 'calendar_today',
|
||||
},
|
||||
|
||||
{
|
||||
id: 'languages',
|
||||
queryParamKey: workQueryParamKeys.language,
|
||||
icon: 'translate',
|
||||
valueFormatter: (value: string) => {
|
||||
return translateLanguageCode(value) || value;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'institutions',
|
||||
queryParamKey: workQueryParamKeys.institutionId,
|
||||
icon: 'apartment',
|
||||
valueFormatter: (value: string) => {
|
||||
const institution = this.selectedInstitutions().find(
|
||||
(inst) => inst.id === value,
|
||||
);
|
||||
return institution ? institution.display_name : value;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'topics',
|
||||
queryParamKey: workQueryParamKeys.topicId,
|
||||
icon: 'label',
|
||||
valueFormatter: (value: string) => {
|
||||
const topic = this.selectedTopics().find((t) => t.id === value);
|
||||
return topic ? topic.display_name : value;
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
isWorkInstitutionsExpanded(work: Work): boolean {
|
||||
if (!work.id) return false;
|
||||
|
||||
return this.expandedWorkInstitutionsId.includes(work.id);
|
||||
}
|
||||
|
||||
toggleWorkInstitutionsExpansion(work: Work): void {
|
||||
if (!work.id) return;
|
||||
|
||||
if (this.expandedWorkInstitutionsId.includes(work.id)) {
|
||||
this.expandedWorkInstitutionsId = this.expandedWorkInstitutionsId.filter(
|
||||
(id) => id !== work.id,
|
||||
);
|
||||
} else {
|
||||
this.expandedWorkInstitutionsId.push(work.id);
|
||||
}
|
||||
}
|
||||
notClassifiedLabel = transformWorkPrimaryCategory(
|
||||
WorkPrimaryCategory.NotClassified,
|
||||
);
|
||||
|
||||
countPurpose = (
|
||||
specificWorkPurposes: SpecificWorkPurpose[],
|
||||
purpose: WorkPurpose,
|
||||
workClassifications: WorkClassification[],
|
||||
primaryCategory: WorkPrimaryCategory,
|
||||
) => {
|
||||
let count = 0;
|
||||
for (const specificWorkPurpose of specificWorkPurposes) {
|
||||
if (specificWorkPurpose.purpose == purpose) {
|
||||
for (const workClassification of workClassifications) {
|
||||
if (
|
||||
workClassification.classification?.primary_category == primaryCategory
|
||||
) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@@ -288,58 +143,7 @@ export class PersonPublicationsComponent implements OnInit {
|
||||
|
||||
chartOption!: echarts.EChartsCoreOption;
|
||||
|
||||
institutionLookupLoading = false;
|
||||
topicLookupLoading = false;
|
||||
institutionOptions: InstitutionAutocompleteOption[] = [];
|
||||
topicOptions: TopicAutocompleteOption[] = [];
|
||||
readonly institutionSearchControl = new FormControl<
|
||||
string | InstitutionAutocompleteOption
|
||||
>('', { nonNullable: true });
|
||||
readonly topicSearchControl = new FormControl<
|
||||
string | TopicAutocompleteOption
|
||||
>('', {
|
||||
nonNullable: true,
|
||||
});
|
||||
readonly yearSearchControl = new FormControl('', { nonNullable: true });
|
||||
readonly typeSearchControl = new FormControl('', { nonNullable: true });
|
||||
readonly languageSearchControl = new FormControl('', { nonNullable: true });
|
||||
|
||||
readonly publicationYearOptions = this.createPublicationYearOptions();
|
||||
|
||||
readonly typeOptions = [
|
||||
{ value: 'article', label: 'article' },
|
||||
{ value: 'book', label: 'book' },
|
||||
{ value: 'book-chapter', label: 'book-chapter' },
|
||||
{ value: 'dataset', label: 'dataset' },
|
||||
{ value: 'dissertation', label: 'dissertation' },
|
||||
{ value: 'editorial', label: 'editorial' },
|
||||
{ value: 'erratum', label: 'erratum' },
|
||||
{ value: 'letter', label: 'letter' },
|
||||
{ value: 'libguides', label: 'libguides' },
|
||||
{ value: 'other', label: 'other' },
|
||||
{ value: 'paratext', label: 'paratext' },
|
||||
{ value: 'peer-review', label: 'peer-review' },
|
||||
{ value: 'preprint', label: 'preprint' },
|
||||
{ value: 'reference-entry', label: 'reference-entry' },
|
||||
{ value: 'report', label: 'report' },
|
||||
{ value: 'retraction', label: 'retraction' },
|
||||
{ value: 'review', label: 'review' },
|
||||
{ value: 'standard', label: 'standard' },
|
||||
{ value: 'supplementary-materials', label: 'supplementary-materials' },
|
||||
];
|
||||
|
||||
readonly languageOptions = [
|
||||
{ value: 'en', label: 'Englisch' },
|
||||
{ value: 'de', label: 'Deutsch' },
|
||||
];
|
||||
|
||||
constructor(
|
||||
private readonly activatedRoute: ActivatedRoute,
|
||||
private readonly router: Router,
|
||||
private readonly httpClient: HttpClient,
|
||||
public readonly paginationService: PaginationService,
|
||||
private readonly institutionsService: InstitutionsService,
|
||||
) {
|
||||
constructor() {
|
||||
effect(() => {
|
||||
const yearlyCounts = this.buildYearlyCounts(
|
||||
this.specificWorkPurposesByYear(),
|
||||
@@ -348,100 +152,31 @@ export class PersonPublicationsComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
queryParamMap = toSignal(this.activatedRoute.queryParamMap, {
|
||||
initialValue: this.activatedRoute.snapshot.queryParamMap,
|
||||
});
|
||||
|
||||
selectedYearsQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(workQueryParamKeys.years).map(Number);
|
||||
});
|
||||
|
||||
handleYearSelectionChange(event: MatSelectChange): void {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.years]: event.value,
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
|
||||
selectedTypesQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(workQueryParamKeys.types);
|
||||
});
|
||||
|
||||
handleTypeSelectionChange(event: MatSelectChange): void {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.types]: event.value,
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
console.log('Type selection changed:', event.value);
|
||||
}
|
||||
|
||||
selectedLanguagesQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(workQueryParamKeys.language);
|
||||
});
|
||||
|
||||
resolvedInstitutions = computed(() => {
|
||||
const institutionMap = new Map<string, Institution>();
|
||||
for (const work of this.elements()) {
|
||||
for (const authorship of work.authorships ?? []) {
|
||||
for (const institution of authorship.institutions ?? []) {
|
||||
if (!institution.id) continue;
|
||||
|
||||
if (!institutionMap.has(institution.id)) {
|
||||
institutionMap.set(institution.id, institution);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return institutionMap;
|
||||
});
|
||||
|
||||
handleLanguageSelectionChange(event: MatSelectChange): void {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.language]: event.value,
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
console.log('Language selection changed:', event.value);
|
||||
}
|
||||
|
||||
selectedInstitutionIdsQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(workQueryParamKeys.institutionId);
|
||||
});
|
||||
|
||||
selectedTopicIdsQueryParams = computed(() => {
|
||||
return this.queryParamMap().getAll(workQueryParamKeys.topicId);
|
||||
});
|
||||
|
||||
getAuthorSpecificWorkPurposesByYear(
|
||||
authorWorkPurposes: AuthorWorkPurposes,
|
||||
): Record<number, Array<SpecificWorkPurpose>> {
|
||||
const purposesByYear: Record<number, Array<SpecificWorkPurpose>> = {};
|
||||
for (const purpose of authorWorkPurposes.purposes ?? []) {
|
||||
const year = purpose.publication_year;
|
||||
getAuthorWorkClassificationByYear(
|
||||
authorWorkClassifications: WorkClassification[],
|
||||
): Record<number, Array<WorkClassification>> {
|
||||
const workClassificationsByYear: Record<
|
||||
number,
|
||||
Array<WorkClassification>
|
||||
> = {};
|
||||
for (const classification of authorWorkClassifications) {
|
||||
const year = classification.publication_year;
|
||||
if (!year) continue;
|
||||
|
||||
if (!purposesByYear[year]) {
|
||||
purposesByYear[year] = [];
|
||||
if (!workClassificationsByYear[year]) {
|
||||
workClassificationsByYear[year] = [];
|
||||
}
|
||||
|
||||
purposesByYear[year].push(purpose);
|
||||
workClassificationsByYear[year].push(classification);
|
||||
}
|
||||
return purposesByYear;
|
||||
return workClassificationsByYear;
|
||||
}
|
||||
|
||||
buildYearlyCounts(
|
||||
purposesByYear: Record<number, Array<SpecificWorkPurpose>>,
|
||||
workClassificationsByYear: Record<number, Array<WorkClassification>>,
|
||||
): YearlyPurposeCounts[] {
|
||||
return Object.entries(purposesByYear)
|
||||
.map(([year, purposes]) => {
|
||||
return Object.entries(workClassificationsByYear)
|
||||
.map(([year, classificiations]) => {
|
||||
const counts: YearlyPurposeCounts = {
|
||||
year: Number(year),
|
||||
basicResearch: 0,
|
||||
@@ -450,16 +185,22 @@ export class PersonPublicationsComponent implements OnInit {
|
||||
experimentalDevelopment: 0,
|
||||
notClassified: 0,
|
||||
};
|
||||
for (const purpose of purposes) {
|
||||
if (purpose.purpose == WorkPurpose.BasicResearch) {
|
||||
for (const classification of classificiations) {
|
||||
const primaryCategory =
|
||||
classification.classification?.primary_category;
|
||||
if (!primaryCategory) continue;
|
||||
|
||||
if (primaryCategory == WorkPrimaryCategory.BasicResearch) {
|
||||
counts.basicResearch++;
|
||||
} else if (purpose.purpose == WorkPurpose.AppliedResearch) {
|
||||
} else if (primaryCategory == WorkPrimaryCategory.AppliedResearch) {
|
||||
counts.appliedResearch++;
|
||||
} else if (purpose.purpose == WorkPurpose.NonResearch) {
|
||||
} else if (primaryCategory == WorkPrimaryCategory.NonResearch) {
|
||||
counts.nonResearch++;
|
||||
} else if (purpose.purpose == WorkPurpose.ExperimentalDevelopment) {
|
||||
} else if (
|
||||
primaryCategory == WorkPrimaryCategory.ExperimentalDevelopment
|
||||
) {
|
||||
counts.experimentalDevelopment++;
|
||||
} else if (purpose.purpose == WorkPurpose.NotClassified) {
|
||||
} else if (primaryCategory == WorkPrimaryCategory.NotClassified) {
|
||||
counts.notClassified++;
|
||||
}
|
||||
}
|
||||
@@ -473,11 +214,11 @@ export class PersonPublicationsComponent implements OnInit {
|
||||
tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' } },
|
||||
legend: {
|
||||
data: [
|
||||
PURPOSE_LABELS.BASIC_RESEARCH,
|
||||
PURPOSE_LABELS.APPLIED_RESEARCH,
|
||||
PURPOSE_LABELS.NON_RESEARCH,
|
||||
PURPOSE_LABELS.EXPERIMENTAL_DEVELOPMENT,
|
||||
PURPOSE_LABELS.NOT_CLASSIFIED,
|
||||
this.basicResearchLabel,
|
||||
this.appliedResearchLabel,
|
||||
this.nonResearchLabel,
|
||||
this.experimentalDevelopmentLabel,
|
||||
this.notClassifiedLabel,
|
||||
],
|
||||
bottom: 0,
|
||||
itemGap: 40,
|
||||
@@ -496,35 +237,35 @@ export class PersonPublicationsComponent implements OnInit {
|
||||
yAxis: { type: 'value' },
|
||||
series: [
|
||||
{
|
||||
name: PURPOSE_LABELS.BASIC_RESEARCH,
|
||||
name: this.basicResearchLabel,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map((d) => d.basicResearch),
|
||||
},
|
||||
{
|
||||
name: PURPOSE_LABELS.APPLIED_RESEARCH,
|
||||
name: this.appliedResearchLabel,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map((d) => d.appliedResearch),
|
||||
},
|
||||
{
|
||||
name: PURPOSE_LABELS.NON_RESEARCH,
|
||||
name: this.nonResearchLabel,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map((d) => d.nonResearch),
|
||||
},
|
||||
{
|
||||
name: PURPOSE_LABELS.EXPERIMENTAL_DEVELOPMENT,
|
||||
name: this.experimentalDevelopmentLabel,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
data: data.map((d) => d.experimentalDevelopment),
|
||||
},
|
||||
{
|
||||
name: PURPOSE_LABELS.NOT_CLASSIFIED,
|
||||
name: this.notClassifiedLabel,
|
||||
type: 'bar',
|
||||
stack: 'total',
|
||||
emphasis: { focus: 'series' },
|
||||
@@ -533,392 +274,4 @@ export class PersonPublicationsComponent implements OnInit {
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.setupInstitutionAutocomplete();
|
||||
this.setupTopicAutocomplete();
|
||||
}
|
||||
|
||||
clearFilters(): void {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
page: 0,
|
||||
size: 10,
|
||||
sort_by: 'publication_year',
|
||||
sort_direction: 'desc',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
displayInstitution(option: string | InstitutionAutocompleteOption): string {
|
||||
return typeof option === 'string' ? option : (option.display_name ?? '');
|
||||
}
|
||||
|
||||
selectInstitution(event: MatAutocompleteSelectedEvent): void {
|
||||
const institution = event.option.value as InstitutionAutocompleteOption;
|
||||
if (!institution.id) return;
|
||||
if (!this.selectedInstitutionIdsQueryParams().includes(institution.id)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.institutionId]: [
|
||||
...this.selectedInstitutionIdsQueryParams(),
|
||||
institution.id,
|
||||
],
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
removeInstitution(institution: InstitutionAutocompleteOption): void {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.institutionId]:
|
||||
this.selectedInstitutionIdsQueryParams().filter(
|
||||
(id) => id !== institution.id,
|
||||
),
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
|
||||
filterByInstitution(institution: { id: string; name: string }): void {
|
||||
if (!institution.id) return;
|
||||
const selectedInstitutionIds = this.selectedInstitutionIdsQueryParams();
|
||||
if (selectedInstitutionIds.includes(institution.id)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.institutionId]: selectedInstitutionIds.filter(
|
||||
(id) => id !== institution.id,
|
||||
),
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.institutionId]: [
|
||||
...selectedInstitutionIds,
|
||||
institution.id,
|
||||
],
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
isInstitutionActive(id: string): boolean {
|
||||
return !!id && this.selectedInstitutionIdsQueryParams().includes(id);
|
||||
}
|
||||
|
||||
selectedInstitutionCountry(
|
||||
institution: InstitutionAutocompleteOption,
|
||||
): string | null {
|
||||
if (!institution.id) return null;
|
||||
const authorWorkPage = this.authorWorkPage();
|
||||
if (!authorWorkPage?.elements) return null;
|
||||
for (const publication of authorWorkPage.elements) {
|
||||
for (const authorship of publication.authorships ?? []) {
|
||||
for (const inst of authorship.institutions ?? []) {
|
||||
if (institution.id === inst.id && inst.country_code) {
|
||||
return inst.country_code;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
toggleYearFilter(year: number): void {
|
||||
const selectedYears = this.selectedYearsQueryParams();
|
||||
if (selectedYears.includes(year)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.years]: selectedYears.filter((y) => y !== year),
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.years]: [...selectedYears, year],
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
toggleTypeFilter(type: string): void {
|
||||
const selectedTopics = this.selectedTypesQueryParams();
|
||||
if (selectedTopics.includes(type)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.types]: selectedTopics.filter((t) => t !== type),
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.types]: [...selectedTopics, type],
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
toggleLanguageFilter(language: string): void {
|
||||
const selectedLanguages = this.selectedLanguagesQueryParams();
|
||||
if (selectedLanguages.includes(language)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.language]: selectedLanguages.filter(
|
||||
(l) => l !== language,
|
||||
),
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.language]: [...selectedLanguages, language],
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
isYearActive(year: number): boolean {
|
||||
return this.selectedYearsQueryParams().includes(year);
|
||||
}
|
||||
|
||||
isTypeActive(type: string): boolean {
|
||||
return this.selectedTypesQueryParams().includes(type);
|
||||
}
|
||||
|
||||
isLanguageActive(language: string): boolean {
|
||||
return this.selectedLanguagesQueryParams().includes(language);
|
||||
}
|
||||
|
||||
displayTopic(option: string | TopicAutocompleteOption): string {
|
||||
return typeof option === 'string' ? option : (option.display_name ?? '');
|
||||
}
|
||||
|
||||
selectTopic(event: MatAutocompleteSelectedEvent): void {
|
||||
const topic = event.option.value as TopicAutocompleteOption;
|
||||
if (!topic.id) return;
|
||||
if (!this.selectedTopicIdsQueryParams().includes(topic.id)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.topicId]: [
|
||||
...this.selectedTopicIdsQueryParams(),
|
||||
topic.id,
|
||||
],
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
removeTopic(topic: TopicAutocompleteOption): void {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.topicId]: this.selectedTopicIdsQueryParams().filter(
|
||||
(id) => id !== topic.id,
|
||||
),
|
||||
[workQueryParamKeys.page]: 0,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
|
||||
extractRawId(id: string | null | undefined): string | null {
|
||||
if (!id) return null;
|
||||
return id.split('/').filter(Boolean).pop() ?? null;
|
||||
}
|
||||
|
||||
openInstitutionPage(
|
||||
institutionId: string | null | undefined,
|
||||
event: Event,
|
||||
): void {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
const id = this.extractRawId(institutionId);
|
||||
if (!id) return;
|
||||
|
||||
void this.router.navigate(['/institution', id]);
|
||||
}
|
||||
|
||||
getWorkTopicColor(topic: WorkTopic): string {
|
||||
return topicHierarchyColor({
|
||||
id: topic.id,
|
||||
name: topic.display_name,
|
||||
field_id: topic.field?.id,
|
||||
field_name: topic.field?.display_name,
|
||||
domain_id: topic.domain?.id,
|
||||
domain_name: topic.domain?.display_name,
|
||||
});
|
||||
}
|
||||
|
||||
getSelectedWorkTopicTooltip(topic: WorkTopic): string {
|
||||
return buildTopicHierarchyTooltip({
|
||||
topicName: topic.display_name,
|
||||
description: topic.description,
|
||||
subfieldName: topic.subfield?.display_name,
|
||||
fieldName: topic.field?.display_name,
|
||||
domainName: topic.domain?.display_name,
|
||||
});
|
||||
}
|
||||
|
||||
yearSelectionSummary(): string {
|
||||
return this.summarizeSelection(this.selectedYearsQueryParams().map(String));
|
||||
}
|
||||
|
||||
typeSelectionSummary(): string {
|
||||
return this.summarizeSelection(this.selectedTypesQueryParams());
|
||||
}
|
||||
|
||||
languageSelectionSummary(): string {
|
||||
return this.summarizeSelection(
|
||||
this.selectedLanguagesQueryParams().map(String),
|
||||
);
|
||||
}
|
||||
|
||||
private summarizeSelection(labels: string[]): string {
|
||||
if (labels.length === 0) return '';
|
||||
if (labels.length === 1) return labels[0];
|
||||
return `+${labels.length}`;
|
||||
}
|
||||
|
||||
languageLabel(value: string): string {
|
||||
return (
|
||||
this.languageOptions.find((option) => option.value === value)?.label ??
|
||||
value
|
||||
);
|
||||
}
|
||||
|
||||
filteredYearOptions(): number[] {
|
||||
const term = this.yearSearchControl.value.trim();
|
||||
if (!term) return this.publicationYearOptions;
|
||||
return this.publicationYearOptions.filter((year) =>
|
||||
String(year).includes(term),
|
||||
);
|
||||
}
|
||||
|
||||
filteredTypeOptions(): { value: string; label: string }[] {
|
||||
const term = this.typeSearchControl.value.trim().toLowerCase();
|
||||
if (!term) return this.typeOptions;
|
||||
return this.typeOptions.filter((type) =>
|
||||
type.label.toLowerCase().includes(term),
|
||||
);
|
||||
}
|
||||
|
||||
filteredLanguageOptions(): { value: string; label: string }[] {
|
||||
const term = this.languageSearchControl.value.trim().toLowerCase();
|
||||
if (!term) return this.languageOptions;
|
||||
return this.languageOptions.filter((language) =>
|
||||
language.label.toLowerCase().includes(term),
|
||||
);
|
||||
}
|
||||
|
||||
focusSelectSearch(input: HTMLInputElement): void {
|
||||
setTimeout(() => input.focus());
|
||||
}
|
||||
|
||||
private setupInstitutionAutocomplete(): void {
|
||||
this.institutionSearchControl.valueChanges
|
||||
.pipe(
|
||||
debounceTime(250),
|
||||
map((value) => (typeof value === 'string' ? value.trim() : '')),
|
||||
distinctUntilChanged(),
|
||||
switchMap((query) => {
|
||||
if (query.length < 2) {
|
||||
this.institutionOptions = [];
|
||||
return of([]);
|
||||
}
|
||||
this.institutionLookupLoading = true;
|
||||
return this.searchInstitutions(query).pipe(
|
||||
catchError(() => of([])),
|
||||
finalize(() => {
|
||||
this.institutionLookupLoading = false;
|
||||
}),
|
||||
);
|
||||
}),
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe((options) => {
|
||||
const selectedIds = new Set(this.selectedInstitutionIdsQueryParams());
|
||||
this.institutionOptions = options.filter(
|
||||
(option) => !!option.id && !selectedIds.has(option.id),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
private setupTopicAutocomplete(): void {
|
||||
this.topicSearchControl.valueChanges
|
||||
.pipe(
|
||||
debounceTime(250),
|
||||
map((value) => (typeof value === 'string' ? value.trim() : '')),
|
||||
distinctUntilChanged(),
|
||||
switchMap((query) => {
|
||||
if (query.length < 2) {
|
||||
this.topicOptions = [];
|
||||
return of([]);
|
||||
}
|
||||
this.topicLookupLoading = true;
|
||||
return this.searchTopics(query).pipe(
|
||||
catchError(() => of([])),
|
||||
finalize(() => {
|
||||
this.topicLookupLoading = false;
|
||||
}),
|
||||
);
|
||||
}),
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe((options) => {
|
||||
const selectedIds = new Set(this.selectedTopicIdsQueryParams());
|
||||
this.topicOptions = options.filter(
|
||||
(option) => !!option.id && !selectedIds.has(option.id),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
private searchInstitutions(query: string) {
|
||||
return this.institutionsService
|
||||
.autocompleteInstitutions(query, undefined, undefined, 10)
|
||||
.pipe(
|
||||
map(
|
||||
(response) =>
|
||||
(response?.results ?? []) as InstitutionAutocompleteOption[],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
private searchTopics(query: string) {
|
||||
const params = new HttpParams().set('query', query).set('limit', '10');
|
||||
|
||||
const basePath = this.worksService.configuration.basePath ?? '';
|
||||
return this.httpClient
|
||||
.get<TopicAutocompleteResponse>(`${basePath}/api/topics/autocomplete`, {
|
||||
params,
|
||||
})
|
||||
.pipe(map((response) => response.results ?? []));
|
||||
}
|
||||
|
||||
private createPublicationYearOptions(): number[] {
|
||||
const currentYear = new Date().getFullYear();
|
||||
return Array.from({ length: 90 }, (_, index) => currentYear - index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,13 @@ import {
|
||||
RouterModule,
|
||||
RouterOutlet,
|
||||
} from '@angular/router';
|
||||
import { of, switchMap, finalize, map, catchError } from 'rxjs';
|
||||
import { of, switchMap, finalize, map, catchError, combineLatest } from 'rxjs';
|
||||
|
||||
import { PersonInterestingComponent } from '../person-interesting/person-interesting.component';
|
||||
import { WorksService } from '../../api';
|
||||
import { LoadingComponent } from '../../shared/ui/loading/loading.component';
|
||||
import { PersonBioResolved } from '../../resolvers/person-bio.resolver';
|
||||
import { PersonDataResolved } from '../../resolvers/person.resolver';
|
||||
import { BookmarkService } from '../../shared/services/bookmark.service';
|
||||
|
||||
@Component({
|
||||
@@ -101,8 +102,17 @@ export class PersonComponent {
|
||||
|
||||
readonly person = toSignal(
|
||||
this.activatedRoute.data.pipe(
|
||||
map(({ personData }) => {
|
||||
return personData?.results[0] ?? null;
|
||||
switchMap((data) => {
|
||||
const resolved = data['personData'] as PersonDataResolved | undefined;
|
||||
if (!resolved) {
|
||||
this.isPersonLoading.set(false);
|
||||
return of(null);
|
||||
}
|
||||
this.isPersonLoading.set(true);
|
||||
return resolved.personData$.pipe(
|
||||
map((response) => response?.results?.[0] ?? null),
|
||||
finalize(() => this.isPersonLoading.set(false)),
|
||||
);
|
||||
}),
|
||||
),
|
||||
{ initialValue: null },
|
||||
@@ -118,8 +128,12 @@ export class PersonComponent {
|
||||
}
|
||||
|
||||
readonly personBio = toSignal(
|
||||
this.activatedRoute.data.pipe(
|
||||
switchMap((data) => {
|
||||
combineLatest([this.activatedRoute.data, toObservable(this.person)]).pipe(
|
||||
switchMap(([data, person]) => {
|
||||
if (!person) {
|
||||
this.isBioLoading.set(false);
|
||||
return of(null);
|
||||
}
|
||||
const resolved = data['personBio'] as PersonBioResolved | undefined;
|
||||
if (!resolved) {
|
||||
this.isBioLoading.set(false);
|
||||
@@ -216,9 +230,13 @@ export class PersonComponent {
|
||||
readonly isTopicsLoading = signal(false);
|
||||
|
||||
readonly primaryTopicCounts = toSignal(
|
||||
toObservable(this.authorId).pipe(
|
||||
switchMap((id) => {
|
||||
if (!id) return of([]);
|
||||
toObservable(this.person).pipe(
|
||||
switchMap((person) => {
|
||||
const id = this.authorId();
|
||||
if (!person || !id) {
|
||||
this.isTopicsLoading.set(false);
|
||||
return of([]);
|
||||
}
|
||||
this.isTopicsLoading.set(true);
|
||||
return this.worksApi.getPrimaryTopicCountsByAuthor(id).pipe(
|
||||
catchError((err) => {
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { WorkClassificationPage, WorksV2Service } from '../api';
|
||||
import { inject } from '@angular/core';
|
||||
|
||||
export const authorWorkClassificationPageResolver: ResolveFn<
|
||||
WorkClassificationPage
|
||||
> = (route, state) => {
|
||||
const id = route.parent?.paramMap.get('id') || route.paramMap.get('id');
|
||||
if (!id) {
|
||||
throw new Error(
|
||||
'Author ID is required to resolve author work classification page.',
|
||||
);
|
||||
}
|
||||
|
||||
return inject(WorksV2Service).getAuthorWorkClassifications(id);
|
||||
};
|
||||
@@ -1,15 +0,0 @@
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { AuthorWorkPurposes, WorksService } from '../api';
|
||||
import { inject } from '@angular/core';
|
||||
|
||||
export const authorWorkPurposesResolver: ResolveFn<AuthorWorkPurposes> = (
|
||||
route,
|
||||
state,
|
||||
) => {
|
||||
const id = route.parent?.paramMap.get('id') || route.paramMap.get('id');
|
||||
if (!id) {
|
||||
throw new Error('Author ID is required to resolve author work purposes.');
|
||||
}
|
||||
|
||||
return inject(WorksService).getAuthorWorkPurposes(id);
|
||||
};
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { inject } from '@angular/core';
|
||||
import { Observable, of, map, catchError } from 'rxjs';
|
||||
import { Observable, of, map, catchError, shareReplay } from 'rxjs';
|
||||
import { PersonsService } from '../api';
|
||||
|
||||
export interface PersonBioResolved {
|
||||
@@ -21,6 +21,7 @@ export const personBioResolver: ResolveFn<PersonBioResolved> = (route) => {
|
||||
console.error('Failed to load bio:', err);
|
||||
return of(null);
|
||||
}),
|
||||
shareReplay(1),
|
||||
);
|
||||
|
||||
return { bio$ };
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import { ResolveFn } from '@angular/router';
|
||||
import { inject } from '@angular/core';
|
||||
import { CustomAuthorsListResponse, PersonsService } from '../api';
|
||||
import { Observable, of, catchError, shareReplay } from 'rxjs';
|
||||
|
||||
export const personResolver: ResolveFn<CustomAuthorsListResponse> = (
|
||||
route,
|
||||
state,
|
||||
) => {
|
||||
export interface PersonDataResolved {
|
||||
personData$: Observable<CustomAuthorsListResponse | null>;
|
||||
}
|
||||
|
||||
export const personResolver: ResolveFn<PersonDataResolved> = (route, state) => {
|
||||
const PERSON_INCLUDE_TAGS =
|
||||
'display_name,works_count,cited_by_count,summary_stats,ids,' +
|
||||
'last_known_institutions,affiliations,topics,orcid,' +
|
||||
@@ -16,8 +18,18 @@ export const personResolver: ResolveFn<CustomAuthorsListResponse> = (
|
||||
const personsService = inject(PersonsService);
|
||||
|
||||
if (!authorId) {
|
||||
return { results: [] };
|
||||
return { personData$: of(null) };
|
||||
}
|
||||
|
||||
return personsService.getPersonByID(authorId, PERSON_INCLUDE_TAGS);
|
||||
const personData$ = personsService
|
||||
.getPersonByID(authorId, PERSON_INCLUDE_TAGS)
|
||||
.pipe(
|
||||
catchError((err) => {
|
||||
console.error('Failed to load person data:', err);
|
||||
return of(null);
|
||||
}),
|
||||
shareReplay(1),
|
||||
);
|
||||
|
||||
return { personData$ };
|
||||
};
|
||||
|
||||
@@ -68,7 +68,7 @@ export const workPageResolver: ResolveFn<InseWorksV2ModelWorkPage> = (
|
||||
const rawOaAuthorId =
|
||||
route.parent?.paramMap.get('id') || route.paramMap.get('id');
|
||||
if (!rawOaAuthorId) {
|
||||
throw new Error('Author ID is required to resolve author work purposes.');
|
||||
throw new Error('Author ID is required to resolve author works.');
|
||||
}
|
||||
return inject(WorksV2Service).getAuthorWorkPage(
|
||||
rawOaAuthorId,
|
||||
@@ -90,7 +90,7 @@ export const workPageResolver: ResolveFn<InseWorksV2ModelWorkPage> = (
|
||||
route.paramMap.get('institutionId');
|
||||
if (!rawOaInstitutionId) {
|
||||
throw new Error(
|
||||
'Institution ID is required to resolve institution work purposes.',
|
||||
'Institution ID is required to resolve institution works.',
|
||||
);
|
||||
}
|
||||
return inject(WorksV2Service).getInstitutionWorkPage(
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { WorkPrimaryCategory } from '../../api';
|
||||
|
||||
export const workPrimaryCategoryLabels: Record<WorkPrimaryCategory, string> = {
|
||||
[WorkPrimaryCategory.AppliedResearch]: 'Anwendungsbasierte Forschung',
|
||||
[WorkPrimaryCategory.BasicResearch]: 'Grundlagenforschung',
|
||||
[WorkPrimaryCategory.ExperimentalDevelopment]: 'Experimentelle Entwicklung',
|
||||
[WorkPrimaryCategory.NonResearch]: 'Nicht-forschende Tätigkeit',
|
||||
[WorkPrimaryCategory.NotClassified]: 'Nicht klassifiziert',
|
||||
};
|
||||
|
||||
export const transformWorkPrimaryCategory = (
|
||||
value: WorkPrimaryCategory | null | undefined,
|
||||
): string => {
|
||||
if (!value) {
|
||||
return '';
|
||||
}
|
||||
return workPrimaryCategoryLabels[value] || value;
|
||||
};
|
||||
|
||||
@Pipe({
|
||||
name: 'workPrimaryCategory',
|
||||
})
|
||||
export class WorkPrimaryCategoryPipe implements PipeTransform {
|
||||
transform(
|
||||
value: WorkPrimaryCategory | null | undefined,
|
||||
...args: unknown[]
|
||||
): unknown {
|
||||
return transformWorkPrimaryCategory(value);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,9 @@
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
import { findWorkTypeById } from '../ui/searchable-work-type-select/searchable-work-type-select.component';
|
||||
|
||||
export const translateWorkType = (value: string | null | undefined): string => {
|
||||
switch (value) {
|
||||
case 'article':
|
||||
return 'Artikel';
|
||||
case 'book':
|
||||
return 'Buch';
|
||||
case 'book-chapter':
|
||||
return 'Buchkapitel';
|
||||
case 'dataset':
|
||||
return 'Datensatz';
|
||||
case 'dissertation':
|
||||
return 'Dissertation';
|
||||
case 'report':
|
||||
return 'Bericht';
|
||||
case 'preprint':
|
||||
return 'Preprint';
|
||||
default:
|
||||
return value ?? 'Unbekannter Typ';
|
||||
}
|
||||
const workType = findWorkTypeById(value ?? '');
|
||||
return workType ? workType.name : '';
|
||||
};
|
||||
|
||||
@Pipe({
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<div class="content">
|
||||
@if (showTitleFilter()) {
|
||||
<app-query-param-input
|
||||
[queryParamKey]="titleQueryParamKey()"
|
||||
label="Suchen nach Titel"
|
||||
placeholder="Suche"
|
||||
[debounceTime]="300" />
|
||||
}
|
||||
<div class="select-area">
|
||||
@if (showYearFilter()) {
|
||||
<app-searchable-year-select
|
||||
[label]="yearLabel()"
|
||||
[selectedYears]="selectedYears()"
|
||||
(handleYearSelectChange)="handleYearSelectChange($event)" />
|
||||
}
|
||||
@if (showWorkTypeFilter()) {
|
||||
<app-searchable-work-type-select
|
||||
[label]="workTypeLabel()"
|
||||
[selectedWorkTypes]="selectedWorkTypes()"
|
||||
(handleWorkTypeSelectChange)="handleWorkTypeSelectChange($event)" />
|
||||
}
|
||||
@if (showLanguageFilter()) {
|
||||
<app-searchable-language-select
|
||||
[label]="languageLabel()"
|
||||
[selectedLanguages]="selectedLanguages()"
|
||||
(handleLanguageSelectChange)="handleLanguageSelectChange($event)" />
|
||||
}
|
||||
@if (showAuthorFilter()) {
|
||||
<app-searchable-author-select
|
||||
[label]="authorLabel()"
|
||||
[selectedAuthors]="selectedAuthors()"
|
||||
(handleAuthorSelectChange)="handleAuthorSelectChange($event)" />
|
||||
}
|
||||
@if (showInstitutionFilter()) {
|
||||
<app-searchable-institution-select
|
||||
[label]="institutionLabel()"
|
||||
[selectedInstitutions]="selectedInstitutions()"
|
||||
(handleInstitutionSelectChange)="
|
||||
handleInstitutionSelectChange($event)
|
||||
" />
|
||||
}
|
||||
@if (showTopicFilter()) {
|
||||
<app-searchable-topic-select
|
||||
[label]="topicLabel()"
|
||||
[selectedTopics]="selectedTopics()"
|
||||
(handleTopicSelectChange)="handleTopicSelectChange($event)" />
|
||||
}
|
||||
<button mat-stroked-button color="primary" (click)="resetFilters()">
|
||||
<mat-icon>filter_alt_off</mat-icon>
|
||||
Filter zurücksetzen
|
||||
</button>
|
||||
</div>
|
||||
<app-selected-filters [observers]="observers" />
|
||||
</div>
|
||||
@@ -0,0 +1,13 @@
|
||||
.content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.select-area {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
flex-wrap: wrap;
|
||||
width: 100%;
|
||||
align-items: center;
|
||||
}
|
||||
@@ -0,0 +1,354 @@
|
||||
import { Component, computed, input } from '@angular/core';
|
||||
import { SearchableTopicSelectComponent } from '../searchable-topic-select/searchable-topic-select.component';
|
||||
import { SearchableYearSelectComponent } from '../searchable-year-select/searchable-year-select.component';
|
||||
import { Author, Institution, Topic } from '../../../api';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { workQueryParamKeys } from '../../../resolvers/work-page.resolver';
|
||||
import { toSignal } from '@angular/core/rxjs-interop';
|
||||
import { SearchableInstitutionSelectComponent } from '../searchable-institution-select/searchable-institution-select.component';
|
||||
import {
|
||||
findWorkTypeById,
|
||||
SearchableWorkTypeSelectComponent,
|
||||
WorkType,
|
||||
} from '../searchable-work-type-select/searchable-work-type-select.component';
|
||||
import {
|
||||
findLanguageById,
|
||||
Language,
|
||||
SearchableLanguageSelectComponent,
|
||||
} from '../searchable-language-select/searchable-language-select.component';
|
||||
import { SearchableAuthorSelectComponent } from '../searchable-author-select/searchable-author-select.component';
|
||||
import { QueryParamInputComponent } from '../query-param-input/query-param-input.component';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import {
|
||||
FilterObserver,
|
||||
SelectedFiltersComponent,
|
||||
} from '../selected-filters/selected-filters.component';
|
||||
import { translateWorkType } from '../../pipes/work-type.pipe';
|
||||
import { translateLanguageCode } from '../../pipes/language-code.pipe';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
|
||||
@Component({
|
||||
selector: 'app-publication-filter',
|
||||
imports: [
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
SearchableTopicSelectComponent,
|
||||
SearchableYearSelectComponent,
|
||||
SearchableInstitutionSelectComponent,
|
||||
SearchableWorkTypeSelectComponent,
|
||||
SearchableLanguageSelectComponent,
|
||||
SearchableAuthorSelectComponent,
|
||||
QueryParamInputComponent,
|
||||
SelectedFiltersComponent,
|
||||
],
|
||||
templateUrl: './publication-filters.component.html',
|
||||
styleUrl: './publication-filters.component.scss',
|
||||
})
|
||||
export class PublicationFilterComponent {
|
||||
constructor(private readonly router: Router) {}
|
||||
|
||||
selectedAuthors = input<Author[]>([]);
|
||||
selectedTopics = input<Topic[]>([]);
|
||||
selectedInstitutions = input<Institution[]>([]);
|
||||
|
||||
showTitleFilter = input<boolean>(true);
|
||||
showYearFilter = input<boolean>(true);
|
||||
showWorkTypeFilter = input<boolean>(true);
|
||||
showLanguageFilter = input<boolean>(true);
|
||||
showAuthorFilter = input<boolean>(true);
|
||||
showInstitutionFilter = input<boolean>(true);
|
||||
showTopicFilter = input<boolean>(true);
|
||||
|
||||
observers: FilterObserver[] = [
|
||||
{
|
||||
id: 'search',
|
||||
queryParamKey: workQueryParamKeys.title,
|
||||
icon: 'search',
|
||||
},
|
||||
{
|
||||
id: 'types',
|
||||
queryParamKey: workQueryParamKeys.types,
|
||||
icon: 'category',
|
||||
valueFormatter: (value: string) => {
|
||||
return translateWorkType(value) || value;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'years',
|
||||
queryParamKey: workQueryParamKeys.years,
|
||||
icon: 'calendar_today',
|
||||
},
|
||||
{
|
||||
id: 'languages',
|
||||
queryParamKey: workQueryParamKeys.language,
|
||||
icon: 'translate',
|
||||
valueFormatter: (value: string) => {
|
||||
return translateLanguageCode(value) || value;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'authors',
|
||||
queryParamKey: workQueryParamKeys.authorId,
|
||||
icon: 'person',
|
||||
valueFormatter: (value: string) => {
|
||||
const author = this.selectedAuthors().find((a) => a.id === value);
|
||||
console.log('Authors', this.selectedAuthors());
|
||||
return author ? author.display_name : value;
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'topics',
|
||||
queryParamKey: workQueryParamKeys.topicId,
|
||||
icon: 'label',
|
||||
valueFormatter: (value: string) => {
|
||||
const topic = this.selectedTopics().find((t) => t.id === value);
|
||||
return topic ? topic.display_name : value;
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
queryParamMap = toSignal(this.router.routerState.root.queryParamMap, {
|
||||
initialValue: this.router.routerState.snapshot.root.queryParamMap,
|
||||
});
|
||||
|
||||
titleQueryParamKey = computed(() => workQueryParamKeys.title);
|
||||
|
||||
selectedYears = computed(() => {
|
||||
return this.queryParamMap().getAll(workQueryParamKeys.years).map(Number);
|
||||
});
|
||||
|
||||
yearLabel = computed(() => {
|
||||
const selectedYears = this.selectedYears();
|
||||
if (selectedYears.length === 0) {
|
||||
return 'Jahr';
|
||||
} else if (selectedYears.length === 1) {
|
||||
return selectedYears[0].toString();
|
||||
} else {
|
||||
return `${selectedYears.length} Jahre`;
|
||||
}
|
||||
});
|
||||
|
||||
handleYearSelectChange = (selectedYear: number): void => {
|
||||
if (this.selectedYears().includes(selectedYear)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.years]: this.selectedYears().filter(
|
||||
(year) => year !== selectedYear,
|
||||
),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.years]: [...this.selectedYears(), selectedYear],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
selectedWorkTypes = computed(() => {
|
||||
const workTypeIds = this.queryParamMap().getAll(workQueryParamKeys.types);
|
||||
return workTypeIds
|
||||
.map((id) => findWorkTypeById(id))
|
||||
.filter((type) => type !== undefined) as WorkType[];
|
||||
});
|
||||
|
||||
workTypeLabel = computed(() => {
|
||||
const selectedWorkTypes = this.selectedWorkTypes();
|
||||
if (selectedWorkTypes.length === 0) {
|
||||
return 'Typ';
|
||||
} else if (selectedWorkTypes.length === 1) {
|
||||
return selectedWorkTypes[0].name;
|
||||
} else {
|
||||
return `${selectedWorkTypes.length} Typen`;
|
||||
}
|
||||
});
|
||||
|
||||
handleWorkTypeSelectChange = (selectedWorkType: WorkType): void => {
|
||||
if (this.selectedWorkTypes().some((t) => t.id === selectedWorkType.id)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.types]: this.selectedWorkTypes()
|
||||
.filter((t) => t.id !== selectedWorkType.id)
|
||||
.map((t) => t.id),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.types]: [
|
||||
...this.selectedWorkTypes().map((t) => t.id),
|
||||
selectedWorkType.id,
|
||||
],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
selectedLanguages = computed(() => {
|
||||
const languageCodes = this.queryParamMap().getAll(
|
||||
workQueryParamKeys.language,
|
||||
);
|
||||
return languageCodes
|
||||
.map((code) => findLanguageById(code))
|
||||
.filter((lang) => lang !== undefined) as Language[];
|
||||
});
|
||||
|
||||
languageLabel = computed(() => {
|
||||
const selectedLanguages = this.selectedLanguages();
|
||||
if (selectedLanguages.length === 0) {
|
||||
return 'Sprache';
|
||||
} else if (selectedLanguages.length === 1) {
|
||||
return selectedLanguages[0].name;
|
||||
} else {
|
||||
return `${selectedLanguages.length} Sprachen`;
|
||||
}
|
||||
});
|
||||
|
||||
handleLanguageSelectChange = (selectedLanguage: Language): void => {
|
||||
if (
|
||||
this.selectedLanguages().some((l) => l.code === selectedLanguage.code)
|
||||
) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.language]: this.selectedLanguages()
|
||||
.filter((l) => l.code !== selectedLanguage.code)
|
||||
.map((l) => l.code),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.language]: [
|
||||
...this.selectedLanguages().map((l) => l.code),
|
||||
selectedLanguage.code,
|
||||
],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
authorLabel = computed(() => {
|
||||
const selectedAuthors = this.selectedAuthors();
|
||||
if (selectedAuthors.length === 0) {
|
||||
return 'Autor';
|
||||
} else if (selectedAuthors.length === 1) {
|
||||
return selectedAuthors[0].display_name ?? 'Autor';
|
||||
} else {
|
||||
return `${selectedAuthors.length} Autoren`;
|
||||
}
|
||||
});
|
||||
|
||||
handleAuthorSelectChange = (selectedAuthor: Author): void => {
|
||||
if (this.selectedAuthors().includes(selectedAuthor)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.authorId]: this.selectedAuthors()
|
||||
.filter((a) => a !== selectedAuthor)
|
||||
.map((a) => a.id),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.authorId]: [
|
||||
...this.selectedAuthors().map((a) => a.id),
|
||||
selectedAuthor.id,
|
||||
],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
institutionLabel = computed(() => {
|
||||
const selectedInstitutions = this.selectedInstitutions();
|
||||
if (selectedInstitutions.length === 0) {
|
||||
return 'Institution';
|
||||
} else if (selectedInstitutions.length === 1) {
|
||||
return selectedInstitutions[0].display_name ?? 'Institution';
|
||||
} else {
|
||||
return `${selectedInstitutions.length} Institutionen`;
|
||||
}
|
||||
});
|
||||
|
||||
handleInstitutionSelectChange = (selectedInstitution: Institution): void => {
|
||||
if (this.selectedInstitutions().includes(selectedInstitution)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.institutionId]: this.selectedInstitutions()
|
||||
.filter((inst) => inst !== selectedInstitution)
|
||||
.map((inst) => inst.id),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.institutionId]: [
|
||||
...this.selectedInstitutions().map((inst) => inst.id),
|
||||
selectedInstitution.id,
|
||||
],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
topicLabel = computed(() => {
|
||||
const selectedTopicIds = this.selectedTopics().map((t) => t.id);
|
||||
if (selectedTopicIds.length === 0) {
|
||||
return 'Thema';
|
||||
} else if (selectedTopicIds.length === 1) {
|
||||
const topic = this.selectedTopics()[0];
|
||||
return topic.display_name || 'Thema';
|
||||
} else {
|
||||
return `${selectedTopicIds.length} Themen`;
|
||||
}
|
||||
});
|
||||
|
||||
handleTopicSelectChange = (selectedTopic: Topic): void => {
|
||||
if (this.selectedTopics().some((t) => t.id === selectedTopic.id)) {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.topicId]: this.selectedTopics()
|
||||
.filter((t) => t.id !== selectedTopic.id)
|
||||
.map((t) => t.id),
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
} else {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.topicId]: [
|
||||
...this.selectedTopics().map((t) => t.id!),
|
||||
selectedTopic.id,
|
||||
],
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
resetFilters = (): void => {
|
||||
this.router.navigate([], {
|
||||
queryParams: {
|
||||
[workQueryParamKeys.title]: null,
|
||||
[workQueryParamKeys.years]: null,
|
||||
[workQueryParamKeys.types]: null,
|
||||
[workQueryParamKeys.language]: null,
|
||||
[workQueryParamKeys.authorId]: null,
|
||||
[workQueryParamKeys.institutionId]: null,
|
||||
[workQueryParamKeys.topicId]: null,
|
||||
},
|
||||
queryParamsHandling: 'merge',
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -58,6 +58,19 @@
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #classificationTmp let-work>
|
||||
@let classification = getWorkClassification(work.id);
|
||||
@if (classification) {
|
||||
<button type="button" class="cell-filter-pill" matTooltipPosition="above">
|
||||
{{
|
||||
classification.classification?.primary_category | workPrimaryCategory
|
||||
}}
|
||||
</button>
|
||||
} @else {
|
||||
<span class="empty-text">-</span>
|
||||
}
|
||||
</ng-template>
|
||||
|
||||
<ng-template #authorsTmp let-work>
|
||||
@let workAuthors = getWorkAuthors(work);
|
||||
@let workAuthorsExpanded = isWorkAuthorsExpanded(work);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
effect,
|
||||
inject,
|
||||
input,
|
||||
OnInit,
|
||||
signal,
|
||||
TemplateRef,
|
||||
viewChild,
|
||||
} from '@angular/core';
|
||||
@@ -16,6 +18,8 @@ import {
|
||||
InseWorksV2ModelWorkPage,
|
||||
Institution,
|
||||
Work,
|
||||
WorkClassification,
|
||||
WorksV2Service,
|
||||
WorkTopic,
|
||||
} from '../../../api';
|
||||
import { TopicChipComponent } from '../topic-chip/topic-chip.component';
|
||||
@@ -29,6 +33,7 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { topicHierarchyColor } from '../../../resolvers/utils/topic-colors';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { workQueryParamKeys } from '../../../resolvers/work-page.resolver';
|
||||
import { WorkPrimaryCategoryPipe } from '../../pipes/work-primary-category.pipe';
|
||||
|
||||
@Component({
|
||||
selector: 'app-publication-table',
|
||||
@@ -42,6 +47,7 @@ import { workQueryParamKeys } from '../../../resolvers/work-page.resolver';
|
||||
ChipComponent,
|
||||
WorkTypePipe,
|
||||
LanguageCodePipe,
|
||||
WorkPrimaryCategoryPipe,
|
||||
],
|
||||
templateUrl: './publication-table.component.html',
|
||||
styleUrl: './publication-table.component.scss',
|
||||
@@ -58,6 +64,7 @@ export class PublicationTableComponent implements OnInit {
|
||||
typeTmp = viewChild.required<TemplateRef<any>>('typeTmp');
|
||||
yearTmp = viewChild.required<TemplateRef<any>>('yearTmp');
|
||||
languageTmp = viewChild.required<TemplateRef<any>>('languageTmp');
|
||||
classificationTmp = viewChild.required<TemplateRef<any>>('classificationTmp');
|
||||
authorsTmp = viewChild.required<TemplateRef<any>>('authorsTmp');
|
||||
institutionsTmp = viewChild.required<TemplateRef<any>>('institutionsTmp');
|
||||
topicsTmp = viewChild.required<TemplateRef<any>>('topicsTmp');
|
||||
@@ -125,12 +132,19 @@ export class PublicationTableComponent implements OnInit {
|
||||
accessorKey: 'language',
|
||||
cellTemplate: this.languageTmp(),
|
||||
},
|
||||
{
|
||||
id: 'classification',
|
||||
header: 'Klassifikation',
|
||||
type: 'display',
|
||||
cellTemplate: this.classificationTmp(),
|
||||
},
|
||||
{
|
||||
id: 'authors',
|
||||
header: 'Autoren',
|
||||
type: 'display',
|
||||
cellTemplate: this.authorsTmp(),
|
||||
},
|
||||
|
||||
{
|
||||
id: 'institutions',
|
||||
header: 'Institutionen',
|
||||
@@ -160,6 +174,36 @@ export class PublicationTableComponent implements OnInit {
|
||||
];
|
||||
}
|
||||
|
||||
workIds = computed(
|
||||
() =>
|
||||
this.elements()
|
||||
.map((work) => work.id)
|
||||
.filter(Boolean) as string[],
|
||||
);
|
||||
|
||||
workClassifications = signal<WorkClassification[]>([]);
|
||||
|
||||
getWorkClassification(workId: string): WorkClassification | undefined {
|
||||
return this.workClassifications().find(
|
||||
(classification) => classification.work_id === workId,
|
||||
);
|
||||
}
|
||||
|
||||
constructor(private readonly worksV2Service: WorksV2Service) {
|
||||
effect(() => {
|
||||
const ids = this.workIds();
|
||||
if (ids.length > 0) {
|
||||
this.worksV2Service
|
||||
.getWorkClassificationsByWorkIds(ids)
|
||||
.subscribe((classificationPage) => {
|
||||
this.workClassifications.set(classificationPage.elements ?? []);
|
||||
});
|
||||
} else {
|
||||
this.workClassifications.set([]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
isTypeActive(type: string): boolean {
|
||||
return this.selectedTypesQueryParams().includes(type);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<mat-form-field style="width: 100%">
|
||||
<mat-form-field style="width: 100%" subscriptSizing="dynamic">
|
||||
<mat-label>{{ this.label() }}</mat-label>
|
||||
<input
|
||||
matInput
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Authoren suchen..."
|
||||
icon="person"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Authoren"
|
||||
fetchedLabel="Gefundene Authoren"
|
||||
[fetchElements]="fetchAuthors"
|
||||
[selectedElements]="selectedAuthors()"
|
||||
[getSelectLabel]="getAuthorLabel"
|
||||
[getSelectValue]="getAuthorValue"
|
||||
[getSelectDescription]="getAuthorDescription"
|
||||
(handleSelectChange)="handleAuthorSelectChange.emit($event)" />
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
import { Component, inject, input, output } from '@angular/core';
|
||||
import { Author, WorksV2Service } from '../../../api';
|
||||
import { Observable } from 'rxjs';
|
||||
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-author-select',
|
||||
imports: [SearchableSelectComponent],
|
||||
templateUrl: './searchable-author-select.component.html',
|
||||
styleUrl: './searchable-author-select.component.scss',
|
||||
})
|
||||
export class SearchableAuthorSelectComponent {
|
||||
private readonly worksV2Service = inject(WorksV2Service);
|
||||
|
||||
label = input<string>('Authoren');
|
||||
selectedAuthors = input.required<Author[]>();
|
||||
|
||||
handleAuthorSelectChange = output<Author>();
|
||||
|
||||
fetchAuthors = (searchTerm: string): Observable<Author[]> => {
|
||||
return this.worksV2Service.getAuthorAutocomplete(searchTerm);
|
||||
};
|
||||
|
||||
getAuthorLabel = (author: Author): string => {
|
||||
return author.display_name!;
|
||||
};
|
||||
|
||||
getAuthorValue = (author: Author): string => {
|
||||
return author.id!;
|
||||
};
|
||||
|
||||
getAuthorDescription = (author: Author): string => {
|
||||
const worksCount = author.works_count ?? 0;
|
||||
const worksCountText = worksCount === 1 ? 'Werk' : 'Werke';
|
||||
const lastKnownInstitution = author.last_known_institutions?.[0];
|
||||
const lastKnownInstitutionDisplayName =
|
||||
lastKnownInstitution?.display_name ?? 'Unbekannt';
|
||||
const lastKnownInstitutionCountryCode =
|
||||
lastKnownInstitution?.country_code ?? '??';
|
||||
return `${worksCount} ${worksCountText} - ${lastKnownInstitutionDisplayName} (${lastKnownInstitutionCountryCode})`;
|
||||
};
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Institution suchen..."
|
||||
icon="apartment"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Institutionen"
|
||||
fetchedLabel="Gefundene Institutionen"
|
||||
[fetchElements]="fetchInstitutions"
|
||||
[selectedElements]="selectedInstitutions()"
|
||||
[getSelectLabel]="getInstitutionLabel"
|
||||
[getSelectValue]="getInstitutionValue"
|
||||
[getSelectDescription]="getInstitutionDescription"
|
||||
(handleSelectChange)="handleInstitutionSelectChange.emit($event)" />
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
import { Component, inject, input, output } from '@angular/core';
|
||||
import { Institution, WorksV2Service } from '../../../api';
|
||||
import { Observable } from 'rxjs';
|
||||
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-institution-select',
|
||||
imports: [SearchableSelectComponent],
|
||||
templateUrl: './searchable-institution-select.component.html',
|
||||
styleUrl: './searchable-institution-select.component.scss',
|
||||
})
|
||||
export class SearchableInstitutionSelectComponent {
|
||||
private readonly worksV2Service = inject(WorksV2Service);
|
||||
|
||||
label = input<string>('Institutionen');
|
||||
selectedInstitutions = input.required<Institution[]>();
|
||||
|
||||
handleInstitutionSelectChange = output<Institution>();
|
||||
|
||||
fetchInstitutions = (searchTerm: string): Observable<Institution[]> => {
|
||||
return this.worksV2Service.getInstitutionAutocomplete(searchTerm);
|
||||
};
|
||||
|
||||
getInstitutionLabel = (institution: Institution): string => {
|
||||
return institution.display_name!;
|
||||
};
|
||||
|
||||
getInstitutionValue = (institution: Institution): string => {
|
||||
return institution.id!;
|
||||
};
|
||||
|
||||
getInstitutionDescription = (institution: Institution): string => {
|
||||
return institution.country_code + ' - ' + institution.type;
|
||||
};
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Sprache suchen..."
|
||||
icon="translate"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Sprachen"
|
||||
fetchedLabel="Weitere Sprachen"
|
||||
[fetchElements]="fetchLanguages"
|
||||
[selectedElements]="selectedLanguages()"
|
||||
[getSelectLabel]="getLanguageLabel"
|
||||
[getSelectValue]="getLanguageValue"
|
||||
(handleSelectChange)="handleLanguageSelectChange.emit($event)" />
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
import { Component, input, output } from '@angular/core';
|
||||
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export interface Language {
|
||||
code: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export const languages: Language[] = [
|
||||
{ code: 'en', name: 'Englisch' },
|
||||
{ code: 'de', name: 'Deutsch' },
|
||||
{ code: 'fr', name: 'Französisch' },
|
||||
{ code: 'es', name: 'Spanisch' },
|
||||
{ code: 'it', name: 'Italienisch' },
|
||||
{ code: 'pt', name: 'Portugiesisch' },
|
||||
{ code: 'ru', name: 'Russisch' },
|
||||
{ code: 'zh', name: 'Chinesisch' },
|
||||
{ code: 'ja', name: 'Japanisch' },
|
||||
{ code: 'ko', name: 'Koreanisch' },
|
||||
];
|
||||
|
||||
export const findLanguageById = (id: string): Language | undefined => {
|
||||
return languages.find((language) => language.code === id);
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-language-select',
|
||||
imports: [SearchableSelectComponent],
|
||||
templateUrl: './searchable-language-select.component.html',
|
||||
styleUrl: './searchable-language-select.component.scss',
|
||||
})
|
||||
export class SearchableLanguageSelectComponent {
|
||||
label = input<string>('Typen');
|
||||
selectedLanguages = input.required<Language[]>();
|
||||
|
||||
handleLanguageSelectChange = output<Language>();
|
||||
|
||||
fetchLanguages = (searchTerm: string): Observable<Language[]> => {
|
||||
return new Observable<Language[]>((observer) => {
|
||||
observer.next(
|
||||
languages.filter((language) =>
|
||||
language.name.toLowerCase().includes(searchTerm.toLowerCase()),
|
||||
),
|
||||
);
|
||||
observer.complete();
|
||||
});
|
||||
};
|
||||
|
||||
getLanguageLabel = (language: Language): string => {
|
||||
return language.name;
|
||||
};
|
||||
|
||||
getLanguageValue = (language: Language): string => {
|
||||
return language.code;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<mat-form-field style="width: 100%" subscriptSizing="dynamic">
|
||||
@if (icon()) {
|
||||
<mat-icon matPrefix [fontIcon]="icon()"></mat-icon>
|
||||
}
|
||||
<mat-select
|
||||
canSelectNullableOptions
|
||||
(selectionChange)="handleSelectChange.emit($event.value)"
|
||||
[placeholder]="label()">
|
||||
<mat-select-trigger>{{ label() }}</mat-select-trigger>
|
||||
<div
|
||||
class="search-panel-header"
|
||||
(click)="$event.stopPropagation()"
|
||||
(keydown)="$event.stopPropagation()">
|
||||
<mat-icon matPrefix>search</mat-icon>
|
||||
<input
|
||||
matInput
|
||||
[placeholder]="inputPlaceholder()"
|
||||
[(ngModel)]="searchValue"
|
||||
(ngModelChange)="_handleValueChange($event)"
|
||||
(click)="$event.stopPropagation()"
|
||||
(keydown)="$event.stopPropagation()" />
|
||||
|
||||
<button
|
||||
mat-icon-button
|
||||
aria-label="Clear"
|
||||
(click)="_clearSearchValue(); $event.stopPropagation()">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@if (isLoading()) {
|
||||
<mat-option disabled>Laden…</mat-option>
|
||||
} @else {
|
||||
@if (selectedElements().length > 0) {
|
||||
<mat-optgroup [label]="selectedLabel()">
|
||||
@for (
|
||||
element of selectedElements();
|
||||
track getSelectValue()(element)
|
||||
) {
|
||||
<mat-option [value]="element" selected>
|
||||
<mat-icon>check</mat-icon>
|
||||
{{ getSelectLabel()(element) }}
|
||||
@if (getSelectDescription()) {
|
||||
<span class="option-description">{{
|
||||
getSelectDescription()!(element)
|
||||
}}</span>
|
||||
}
|
||||
</mat-option>
|
||||
} @empty {
|
||||
<mat-option disabled>Keine Ergebnisse</mat-option>
|
||||
}
|
||||
</mat-optgroup>
|
||||
}
|
||||
<mat-optgroup [label]="fetchedLabel()">
|
||||
@for (element of fetchedElements(); track getSelectValue()(element)) {
|
||||
<mat-option [value]="element">
|
||||
{{ getSelectLabel()(element) }}
|
||||
@if (getSelectDescription()) {
|
||||
<span class="option-description">{{
|
||||
getSelectDescription()!(element)
|
||||
}}</span>
|
||||
}
|
||||
</mat-option>
|
||||
} @empty {
|
||||
<mat-option disabled>Keine Ergebnisse</mat-option>
|
||||
}
|
||||
</mat-optgroup>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
@@ -0,0 +1,18 @@
|
||||
.search-panel-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 8px 12px;
|
||||
gap: 8px;
|
||||
|
||||
input {
|
||||
flex: 1;
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
}
|
||||
|
||||
.option-description {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
DestroyRef,
|
||||
inject,
|
||||
input,
|
||||
output,
|
||||
signal,
|
||||
} from '@angular/core';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import {
|
||||
BehaviorSubject,
|
||||
catchError,
|
||||
debounceTime,
|
||||
distinctUntilChanged,
|
||||
Observable,
|
||||
of,
|
||||
switchMap,
|
||||
tap,
|
||||
} from 'rxjs';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-select',
|
||||
imports: [
|
||||
MatSelectModule,
|
||||
MatInputModule,
|
||||
MatIconModule,
|
||||
MatButtonModule,
|
||||
FormsModule,
|
||||
],
|
||||
templateUrl: './searchable-select.component.html',
|
||||
styleUrl: './searchable-select.component.scss',
|
||||
})
|
||||
export class SearchableSelectComponent<T> {
|
||||
searchValue: string = '';
|
||||
handleSelectChange = output<T>();
|
||||
|
||||
_elements = computed<T[]>(() => {
|
||||
const predefined = this.selectedElements();
|
||||
const fetched = this.fetchedElements();
|
||||
return [...predefined, ...fetched];
|
||||
});
|
||||
isLoading = signal<boolean>(false);
|
||||
|
||||
icon = input<string>('');
|
||||
label = input.required<string>();
|
||||
selectedLabel = input<string>('Ausgewählt');
|
||||
fetchedLabel = input<string>('Verfügbar');
|
||||
fetchElements = input<(searchTerm: string) => Observable<T[]>>();
|
||||
fetchedElements = signal<T[]>([]);
|
||||
selectedElements = input<T[]>([]);
|
||||
getSelectLabel = input.required<(element: T) => string>();
|
||||
getSelectValue = input.required<(element: T) => string>();
|
||||
getSelectDescription = input<(element: T) => string>();
|
||||
|
||||
inputPlaceholder = input<string>('Suche');
|
||||
|
||||
private readonly searchTerms = new BehaviorSubject<string>('');
|
||||
private readonly destroyRef = inject(DestroyRef);
|
||||
|
||||
constructor() {
|
||||
this.searchTerms
|
||||
.pipe(
|
||||
debounceTime(300),
|
||||
distinctUntilChanged(),
|
||||
tap(() => this.isLoading.set(true)),
|
||||
switchMap((term) => {
|
||||
const fetchFn = this.fetchElements();
|
||||
if (!fetchFn) {
|
||||
return of([] as T[]);
|
||||
}
|
||||
return fetchFn(term).pipe(catchError(() => of([] as T[])));
|
||||
}),
|
||||
tap(() => this.isLoading.set(false)),
|
||||
takeUntilDestroyed(this.destroyRef),
|
||||
)
|
||||
.subscribe((results) => this.fetchedElements.set(results));
|
||||
}
|
||||
|
||||
_handleValueChange(newValue: string): void {
|
||||
this.searchValue = newValue;
|
||||
this.searchTerms.next(newValue);
|
||||
}
|
||||
|
||||
_clearSearchValue(): void {
|
||||
this.searchValue = '';
|
||||
this.fetchedElements.set([]);
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Thema suchen..."
|
||||
icon="label"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Themen"
|
||||
fetchedLabel="Gefundene Themen"
|
||||
[fetchElements]="fetchTopics"
|
||||
[selectedElements]="selectedTopics()"
|
||||
[getSelectLabel]="getTopicLabel"
|
||||
[getSelectValue]="getTopicValue"
|
||||
[getSelectDescription]="getTopicDescription"
|
||||
(handleSelectChange)="handleTopicSelectChange.emit($event)" />
|
||||
@@ -0,0 +1,41 @@
|
||||
import { Component, inject, input, output } from '@angular/core';
|
||||
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
|
||||
import { Topic, WorksV2Service } from '../../../api';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-topic-select',
|
||||
imports: [SearchableSelectComponent],
|
||||
templateUrl: './searchable-topic-select.component.html',
|
||||
styleUrl: './searchable-topic-select.component.scss',
|
||||
})
|
||||
export class SearchableTopicSelectComponent {
|
||||
private readonly worksV2Service = inject(WorksV2Service);
|
||||
|
||||
label = input<string>('Themen');
|
||||
selectedTopics = input.required<Topic[]>();
|
||||
|
||||
handleTopicSelectChange = output<Topic>();
|
||||
|
||||
fetchTopics = (searchTerm: string): Observable<Topic[]> => {
|
||||
return this.worksV2Service.getTopicAutocomplete(searchTerm);
|
||||
};
|
||||
|
||||
getTopicLabel = (topic: Topic): string => {
|
||||
return topic.display_name!;
|
||||
};
|
||||
|
||||
getTopicValue = (topic: Topic): string => {
|
||||
return topic.id!;
|
||||
};
|
||||
|
||||
getTopicDescription = (topic: Topic): string => {
|
||||
return (
|
||||
topic.subfield?.display_name +
|
||||
' - ' +
|
||||
topic.field?.display_name +
|
||||
' - ' +
|
||||
topic.domain?.display_name || ''
|
||||
);
|
||||
};
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Typ suchen..."
|
||||
icon="category"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Typen"
|
||||
fetchedLabel="Weitere Typen"
|
||||
[fetchElements]="fetchWorkTypes"
|
||||
[selectedElements]="selectedWorkTypes()"
|
||||
[getSelectLabel]="getWorkTypeLabel"
|
||||
[getSelectValue]="getWorkTypeValue"
|
||||
(handleSelectChange)="handleWorkTypeSelectChange.emit($event)" />
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
import { Component, input, output } from '@angular/core';
|
||||
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
export interface WorkType {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export const workTypes: WorkType[] = [
|
||||
{ id: 'article', name: 'Artikel' },
|
||||
{ id: 'book', name: 'Buch' },
|
||||
{ id: 'book-chapter', name: 'Buchkapitel' },
|
||||
{ id: 'dataset', name: 'Datensatz' },
|
||||
{ id: 'dissertation', name: 'Dissertation' },
|
||||
{ id: 'editorial', name: 'Editorial' },
|
||||
{ id: 'erratum', name: 'Erratum' },
|
||||
{ id: 'letter', name: 'Brief' },
|
||||
{ id: 'libguides', name: 'LibGuides' },
|
||||
{ id: 'other', name: 'Andere' },
|
||||
{ id: 'paratext', name: 'Paratext' },
|
||||
{ id: 'peer-review', name: 'Peer Review' },
|
||||
{ id: 'preprint', name: 'Preprint' },
|
||||
{ id: 'reference-entry', name: 'Referenzeintrag' },
|
||||
{ id: 'report', name: 'Bericht' },
|
||||
{ id: 'retraction', name: 'Retraktion' },
|
||||
{ id: 'review', name: 'Review' },
|
||||
{ id: 'standard', name: 'Standard' },
|
||||
{ id: 'supplementary-materials', name: 'Ergänzende Materialien' },
|
||||
];
|
||||
|
||||
export const findWorkTypeById = (id: string): WorkType | undefined => {
|
||||
return workTypes.find((workType) => workType.id === id);
|
||||
};
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-work-type-select',
|
||||
imports: [SearchableSelectComponent],
|
||||
templateUrl: './searchable-work-type-select.component.html',
|
||||
styleUrl: './searchable-work-type-select.component.scss',
|
||||
})
|
||||
export class SearchableWorkTypeSelectComponent {
|
||||
label = input<string>('Typen');
|
||||
selectedWorkTypes = input.required<WorkType[]>();
|
||||
|
||||
handleWorkTypeSelectChange = output<WorkType>();
|
||||
|
||||
fetchWorkTypes = (searchTerm: string): Observable<WorkType[]> => {
|
||||
return new Observable<WorkType[]>((observer) => {
|
||||
observer.next(
|
||||
workTypes.filter((workType) =>
|
||||
workType.name.toLowerCase().includes(searchTerm.toLowerCase()),
|
||||
),
|
||||
);
|
||||
observer.complete();
|
||||
});
|
||||
};
|
||||
|
||||
getWorkTypeLabel = (workType: WorkType): string => {
|
||||
return workType.name;
|
||||
};
|
||||
|
||||
getWorkTypeValue = (workType: WorkType): string => {
|
||||
return workType.id;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<app-searchable-select
|
||||
inputPlaceholder="Jahr suchen..."
|
||||
icon="calendar_today"
|
||||
[label]="label()"
|
||||
selectedLabel="Ausgewählte Jahre"
|
||||
fetchedLabel="Weitere Jahre"
|
||||
[fetchElements]="fetchYears"
|
||||
[selectedElements]="selectedYears()"
|
||||
[getSelectLabel]="getYearLabel"
|
||||
[getSelectValue]="getYearValue"
|
||||
(handleSelectChange)="handleYearSelectChange.emit($event)" />
|
||||
@@ -0,0 +1,40 @@
|
||||
import { Component, input, output } from '@angular/core';
|
||||
import { SearchableSelectComponent } from '../searchable-select/searchable-select.component';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-searchable-year-select',
|
||||
imports: [SearchableSelectComponent],
|
||||
templateUrl: './searchable-year-select.component.html',
|
||||
styleUrl: './searchable-year-select.component.scss',
|
||||
})
|
||||
export class SearchableYearSelectComponent {
|
||||
label = input<string>('Jahr');
|
||||
selectedYears = input.required<number[]>();
|
||||
startYear = input<number>(1900);
|
||||
endYear = input<number>(new Date().getFullYear());
|
||||
|
||||
handleYearSelectChange = output<number>();
|
||||
|
||||
fetchYears = (searchTerm: string): Observable<number[]> => {
|
||||
const years: number[] = [];
|
||||
for (let year = this.endYear(); year >= this.startYear(); year--) {
|
||||
years.push(year);
|
||||
}
|
||||
|
||||
return new Observable<number[]>((observer) => {
|
||||
observer.next(
|
||||
years.filter((year) => year.toString().includes(searchTerm)),
|
||||
);
|
||||
observer.complete();
|
||||
});
|
||||
};
|
||||
|
||||
getYearLabel = (year: number): string => {
|
||||
return year.toString();
|
||||
};
|
||||
|
||||
getYearValue = (year: number): string => {
|
||||
return year.toString();
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user