feature/person-list #110

Merged
kuzko merged 8 commits from feature/person-list into dev 2026-06-04 21:20:18 +02:00
88 changed files with 2491 additions and 447 deletions
+2
View File
@@ -12,6 +12,7 @@ from fastapi.responses import RedirectResponse
from fastapi.middleware.cors import CORSMiddleware
from inse.collaboration_network.router import router as collaboration_network_router
from inse.works.service import router as works_service_router
from inse.search.service import router as search_router
from . import config
from .service import router as service_router
@@ -32,6 +33,7 @@ app = FastAPI(
)
app.include_router(collaboration_network_router)
app.include_router(works_service_router)
app.include_router(search_router)
app.include_router(service_router)
app.include_router(account_router)
+1
View File
@@ -0,0 +1 @@
# -*- coding: utf-8 -*-
+153
View File
@@ -0,0 +1,153 @@
# -*- coding: utf-8 -*-
import logging
import hashlib
from typing import List, Optional
from fastapi import HTTPException
from inse import util
from inse.logic import es_client
from inse.models.author import Author
from inse.models.meta import Meta
from inse.search.model import CustomAuthor, CustomAuthorsListResponse
logger = logging.getLogger(__name__)
def _enrich_author_data(author_data) -> Optional[CustomAuthor]:
if not author_data:
return None
if not isinstance(author_data, dict):
if hasattr(author_data, 'model_dump'):
author_data = author_data.model_dump()
elif hasattr(author_data, 'to_dict'):
author_data = author_data.to_dict()
else:
return None
author_id = author_data.get("id", "") or ""
h = int(hashlib.md5(author_id.encode('utf-8')).hexdigest(), 16)
# Experimental suitability rating
suitability_score = h % 100
if suitability_score < 15:
relevance_rating = "Sehr geeignet"
elif suitability_score < 50:
relevance_rating = "Geeignet"
else:
relevance_rating = "Möglich"
# Resilient sanitization of IDs to protect against model type conflicts (Generated)
ids = author_data.get("ids")
if isinstance(ids, dict):
ids_copy = dict(ids)
for str_field in ["openalex", "orcid", "scopus"]:
val = ids_copy.get(str_field)
if val is not None and not isinstance(val, str):
ids_copy[str_field] = str(val)
author_data["ids"] = ids_copy
base_author = Author.from_dict(author_data)
if not base_author:
return None
author = CustomAuthor(
**base_author.model_dump(),
relevance_rating=relevance_rating,
)
return author
def advanced_search_persons(
query: Optional[str] = None,
institution_name: Optional[str] = None,
topics: Optional[List[str]] = None,
page: int = 1,
page_size: int = 10,
include: Optional[set[str]] = None,
) -> CustomAuthorsListResponse:
must_clauses = []
filter_clauses = []
if query:
must_clauses.append({
"bool": {
"should": [
{"match_phrase": {"display_name": {"query": query, "boost": 5}}},
{"match_phrase_prefix": {"display_name": {"query": query, "boost": 3}}},
{"match": {"display_name": {"query": query, "fuzziness": 1}}},
],
"minimum_should_match": 1
}
})
if institution_name:
filter_clauses.append({
"nested": {
"path": "affiliations",
"query": {
"match_phrase": {
"affiliations.institution.display_name": institution_name
}
}
}
})
if topics:
for t in topics:
if t:
filter_clauses.append({
"nested": {
"path": "topics",
"query": {
"match_phrase": {
"topics.display_name": t
}
}
}
})
query_body = {"bool": {}}
if must_clauses:
query_body["bool"]["must"] = must_clauses
if filter_clauses:
query_body["bool"]["filter"] = filter_clauses
if not must_clauses and not filter_clauses:
query_body["bool"]["must"] = [{"match_all": {}}]
es_size = page_size
es_from = (page - 1) * page_size
sort_option = [{"cited_by_count": {"order": "desc"}}, {"works_count": {"order": "desc"}}]
try:
response = es_client.search(
index="openalex-authors",
query=query_body,
source=list(include) if include else True,
from_=es_from,
size=es_size,
sort=sort_option if not query else None,
)
except Exception as e:
logger.error(f"Elasticsearch search failed: {str(e)}")
raise HTTPException(
status_code=500, detail=f"Elasticsearch search failed: {str(e)}"
)
hits = response.get("hits", {}).get("hits", [])
total_count = response.get("hits", {}).get("total", {}).get("value", 0)
results = []
for hit in hits:
raw_data = util.get_persons_data(hit)
custom_author = _enrich_author_data(raw_data)
if custom_author:
results.append(custom_author)
return CustomAuthorsListResponse(
results=results,
meta=Meta(
count=total_count,
page=page,
per_page=page_size
)
)
+14
View File
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
from pydantic import BaseModel, Field
from typing import List, Optional
from inse.models.author import Author
from inse.models.meta import Meta
from inse.models.group_by_result import GroupByResult
class CustomAuthor(Author):
relevance_rating: Optional[str] = Field(default=None, description="The relevance suitability rating.")
class CustomAuthorsListResponse(BaseModel):
meta: Optional[Meta] = None
results: Optional[List[CustomAuthor]] = None
group_by: Optional[List[GroupByResult]] = None
+62
View File
@@ -0,0 +1,62 @@
# -*- coding: utf-8 -*-
import logging
from typing import Annotated, List, Optional
from fastapi import APIRouter, Query, Depends
from inse import database
from inse.search import model as search_model
from inse.search import logic
logger = logging.getLogger(__name__)
router = APIRouter(
prefix="/api/inse-service",
tags=["Persons Search"],
responses={404: {"description": "Not found"}},
)
@router.get(
"/persons/search-list",
operation_id="searchPersonsList",
response_model=search_model.CustomAuthorsListResponse,
summary="Searches for persons with advanced filters (Topic & Institution) and pagination.",
response_model_exclude_none=True,
tags=["Persons"],
)
def search_persons_list(
query: Annotated[
Optional[str], Query(description="Search query (e.g., Arman AND Arzani)")
] = None,
institution_name: Annotated[
Optional[str], Query(alias="institutionName", description="Filter by institution name")
] = None,
topic: Annotated[
Optional[List[str]], Query(description="Filter by topic display names")
] = None,
page: Annotated[
int, Query(description="Page number (1-indexed)", ge=1)
] = 1,
page_size: Annotated[
int, Query(alias="pageSize", description="Results per page", ge=1, le=100)
] = 10,
include: Annotated[
Optional[str],
Query(
description="Comma-separated include tags",
example="topics_full,topic_share",
),
] = None,
):
include_set = (
{tag.strip().lower() for tag in include.split(",") if tag.strip()}
if include
else None
)
return logic.advanced_search_persons(
query=query,
institution_name=institution_name,
topics=topic,
page=page,
page_size=page_size,
include=include_set,
)
+2 -2
View File
@@ -226,10 +226,10 @@ def count_topic_hierarchy(
)
def search_persons(
author_id: Annotated[
str, Query(description="OpenAlex author ID (e.g., A5093075883)")
Optional[str], Query(description="OpenAlex author ID (e.g., A5093075883)")
] = None,
query: Annotated[
str, Query(description="Search query (e.g., Arman AND Arzani)")
Optional[str], Query(description="Search query (e.g., Arman AND Arzani)")
] = None,
include: Annotated[
Optional[str],
+1 -1
View File
@@ -11,7 +11,7 @@
"additionalProperties": {
"ngVersion": "21.2.14",
"providedInRoot": true,
"serviceSuffix": "OpenApiService",
"serviceSuffix": "Service",
"withInterfaces": true,
"enumPropertyNaming": "original",
"fileNaming": "kebab-case"
+61 -48
View File
@@ -4,78 +4,91 @@ README.md
api.base.service.ts
api.module.ts
api/api.ts
api/iNSEAccountService.service.ts
api/iNSEService.service.ts
api/inse-account-service.service.ts
api/inse-account-service.serviceInterface.ts
api/inse-service.service.ts
api/inse-service.serviceInterface.ts
api/items.service.ts
api/personNetwork.service.ts
api/items.serviceInterface.ts
api/person-network.service.ts
api/person-network.serviceInterface.ts
api/persons-search.service.ts
api/persons-search.serviceInterface.ts
api/persons.service.ts
api/persons.serviceInterface.ts
api/topics.service.ts
api/topics.serviceInterface.ts
api/works.service.ts
api/works.serviceInterface.ts
configuration.ts
encoder.ts
git_push.sh
index.ts
model/accessGrant.ts
model/authAccount.ts
model/authScope.ts
model/access-grant.ts
model/auth-account.ts
model/auth-scope.ts
model/author-affiliations-inner.ts
model/author-counts-by-year-inner.ts
model/author-ids.ts
model/author-parsed-longest-name.ts
model/author-summary-stats.ts
model/author.ts
model/authorAffiliationsInner.ts
model/authorCountsByYearInner.ts
model/authorIds.ts
model/authorParsedLongestName.ts
model/authorSummaryStats.ts
model/authorsListResponse.ts
model/authors-list-response.ts
model/authorship.ts
model/award.ts
model/collaborationNetwork.ts
model/collaborationNetworkEdge.ts
model/collaborationNetworkNode.ts
model/collaborationNetworkNodeType.ts
model/costUsd.ts
model/dehydratedAuthor.ts
model/dehydratedFunder.ts
model/dehydratedInstitution.ts
model/dehydratedSource.ts
model/filterInformation.ts
model/filterProperties.ts
model/collaboration-network-edge.ts
model/collaboration-network-node-type.ts
model/collaboration-network-node.ts
model/collaboration-network.ts
model/cost-usd.ts
model/custom-author.ts
model/custom-authors-list-response.ts
model/dehydrated-author.ts
model/dehydrated-funder.ts
model/dehydrated-institution.ts
model/dehydrated-source.ts
model/filter-information.ts
model/filter-properties.ts
model/fwci.ts
model/groupByResult.ts
model/hTTPValidationError.ts
model/identityGrant.ts
model/institutionInformation.ts
model/group-by-result.ts
model/http-validation-error.ts
model/identity-grant.ts
model/institution-information.ts
model/item-create.ts
model/item-page.ts
model/item.ts
model/itemCreate.ts
model/itemPage.ts
model/location.ts
model/meta.ts
model/model2YrMeanCitedness.ts
model/model2-yr-mean-citedness.ts
model/models.ts
model/openAccess.ts
model/personBio.ts
model/open-access.ts
model/person-bio.ts
model/score.ts
model/validation-error-loc-inner.ts
model/validation-error.ts
model/topicCount.ts
model/topicsByTime.ts
model/topicsByYear.ts
model/validationError.ts
model/validationErrorLocInner.ts
model/value.ts
model/work-biblio.ts
model/work-citation-normalized-percentile.ts
model/work-cited-by-percentile-year.ts
model/work-counts-by-year-inner.ts
model/work-has-content.ts
model/work-ids.ts
model/work-keyword.ts
model/work-mesh-inner.ts
model/work-page.ts
model/work-sustainable-development-goals-inner.ts
model/work-topic-domain.ts
model/work-topic-field.ts
model/work-topic-information.ts
model/work-topic-subfield.ts
model/work-topic.ts
model/work.ts
model/workBiblio.ts
model/workCitationNormalizedPercentile.ts
model/workCitedByPercentileYear.ts
model/workCountsByYearInner.ts
model/workHasContent.ts
model/workIds.ts
model/workKeyword.ts
model/workMeshInner.ts
model/workPage.ts
model/workSustainableDevelopmentGoalsInner.ts
model/workTopic.ts
model/workTopicDomain.ts
model/workTopicField.ts
model/workTopicInformation.ts
model/workTopicSubfield.ts
model/worksListResponse.ts
model/works-list-response.ts
param.ts
provide-api.ts
variables.ts
+17 -7
View File
@@ -1,15 +1,25 @@
export * from './iNSEAccountService.service';
import { INSEAccountServiceService } from './iNSEAccountService.service';
export * from './iNSEService.service';
import { INSEServiceService } from './iNSEService.service';
export * from './inse-account-service.service';
import { INSEAccountServiceService } from './inse-account-service.service';
export * from './inse-account-service.serviceInterface';
export * from './inse-service.service';
import { INSEServiceService } from './inse-service.service';
export * from './inse-service.serviceInterface';
export * from './items.service';
import { ItemsService } from './items.service';
export * from './personNetwork.service';
import { PersonNetworkService } from './personNetwork.service';
export * from './items.serviceInterface';
export * from './person-network.service';
import { PersonNetworkService } from './person-network.service';
export * from './person-network.serviceInterface';
export * from './persons.service';
import { PersonsService } from './persons.service';
export * from './persons.serviceInterface';
export * from './persons-search.service';
import { PersonsSearchService } from './persons-search.service';
export * from './persons-search.serviceInterface';
export * from './topics.service';
import { TopicsService } from './topics.service';
export * from './topics.serviceInterface';
export * from './works.service';
import { WorksService } from './works.service';
export const APIS = [INSEAccountServiceService, INSEServiceService, ItemsService, PersonNetworkService, PersonsService, TopicsService, WorksService];
export * from './works.serviceInterface';
export const APIS = [INSEAccountServiceService, INSEServiceService, ItemsService, PersonNetworkService, PersonsService, PersonsSearchService, TopicsService, WorksService];
@@ -17,23 +17,26 @@ import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { AccessGrant } from '../model/accessGrant';
import { AccessGrant } from '../model/access-grant';
// @ts-ignore
import { HTTPValidationError } from '../model/hTTPValidationError';
import { HTTPValidationError } from '../model/http-validation-error';
// @ts-ignore
import { IdentityGrant } from '../model/identityGrant';
import { IdentityGrant } from '../model/identity-grant';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
import {
INSEAccountServiceServiceInterface
} from './inse-account-service.serviceInterface';
@Injectable({
providedIn: 'root'
})
export class INSEAccountServiceService extends BaseService {
export class INSEAccountServiceService extends BaseService implements INSEAccountServiceServiceInterface {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
super(basePath, configuration);
@@ -0,0 +1,46 @@
/**
* 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 { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { AccessGrant } from '../model/models';
import { HTTPValidationError } from '../model/models';
import { IdentityGrant } from '../model/models';
import { Configuration } from '../configuration';
export interface INSEAccountServiceServiceInterface {
defaultHeaders: HttpHeaders;
configuration: Configuration;
/**
* Get Access Grant
*
* @endpoint post /inse-account/auth/access
* @param secret
* @param account
* @param organization
*/
getAccessGrantInseAccountAuthAccessPost(secret: string, account: number, organization: number, extraHttpRequestParams?: any): Observable<AccessGrant>;
/**
* Get Identity Grant
*
* @endpoint post /inse-account/auth/id
* @param username
* @param password
*/
getIdentityGrantInseAccountAuthIdPost(username: string, password: string, extraHttpRequestParams?: any): Observable<IdentityGrant>;
}
@@ -17,29 +17,32 @@ import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { AuthorsListResponse } from '../model/authorsListResponse';
import { AuthorsListResponse } from '../model/authors-list-response';
// @ts-ignore
import { HTTPValidationError } from '../model/hTTPValidationError';
import { HTTPValidationError } from '../model/http-validation-error';
// @ts-ignore
import { Item } from '../model/item';
// @ts-ignore
import { ItemCreate } from '../model/itemCreate';
import { ItemCreate } from '../model/item-create';
// @ts-ignore
import { ItemPage } from '../model/itemPage';
import { ItemPage } from '../model/item-page';
// @ts-ignore
import { PersonBio } from '../model/personBio';
import { PersonBio } from '../model/person-bio';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
import {
INSEServiceServiceInterface
} from './inse-service.serviceInterface';
@Injectable({
providedIn: 'root'
})
export class INSEServiceService extends BaseService {
export class INSEServiceService extends BaseService implements INSEServiceServiceInterface {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
super(basePath, configuration);
@@ -0,0 +1,135 @@
/**
* 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 { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { AuthorsListResponse } from '../model/models';
import { HTTPValidationError } from '../model/models';
import { Item } from '../model/models';
import { ItemCreate } from '../model/models';
import { ItemPage } from '../model/models';
import { PersonBio } from '../model/models';
import { Configuration } from '../configuration';
export interface INSEServiceServiceInterface {
defaultHeaders: HttpHeaders;
configuration: Configuration;
/**
* Adds a new item.
*
* @endpoint post /api/inse-service/items
* @param itemCreate
*/
addItem(itemCreate: ItemCreate, extraHttpRequestParams?: any): Observable<Item>;
/**
* Builds the topic hierarchy cache.
*
* @endpoint get /api/inse-service/topics/cache
* @param pageSize Page size for each search page.
* @param saveJson Persist cache JSON to data folder.
*/
buildTopicCache(pageSize?: number, saveJson?: boolean, extraHttpRequestParams?: any): Observable<object>;
/**
* Counts topic hierarchy occurrences from cache.
*
* @endpoint get /api/inse-service/topics/count
* @param topic Topic names (repeat parameter).
*/
countTopicHierarchy(topic: Array<string>, extraHttpRequestParams?: any): Observable<object>;
/**
* Deletes the item with the id.
*
* @endpoint delete /api/inse-service/items/{id}
* @param id The item id.
*/
deleteItem(id: number, extraHttpRequestParams?: any): Observable<any>;
/**
* Generates a bio for a person by author ID.
*
* @endpoint get /api/inse-service/persons/bio
* @param authorId OpenAlex author ID (e.g., A5093075883)
* @param include Comma-separated list to include tags
*/
generatePersonBio(authorId: string, include?: string, extraHttpRequestParams?: any): Observable<PersonBio>;
/**
* Returns the item with the id.
*
* @endpoint get /api/inse-service/items/{id}
* @param id The item id.
*/
getItem(id: number, extraHttpRequestParams?: any): Observable<Item>;
/**
* Returns a page of items.
*
* @endpoint get /api/inse-service/items
* @param pageOffset The page offset.
* @param pageSize The page size.
*/
getItems(pageOffset?: number, pageSize?: number, extraHttpRequestParams?: any): Observable<ItemPage>;
/**
* Searches for person by ID.
*
* @endpoint get /api/inse-service/person/{id}
* @param id OpenAlex author ID
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
*/
getPersonByID(id: string, include: string, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
/**
* Searches for persons by ID or name.
*
* @endpoint get /api/inse-service/persons/search
* @param authorId OpenAlex author ID (e.g., A5093075883)
* @param query Search query (e.g., Arman AND Arzani)
* @param include Comma-separated include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, sources, counts_by_year, works_api_url, dates, cited_by_count_boost
*/
searchPersons(authorId?: string, query?: string, include?: string, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
/**
* Searches for persons by institution name.
*
* @endpoint get /api/inse-service/persons/searchByInstitution
* @param institutionName Institution name (e.g., MIT, Oxford University)
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
*/
searchPersonsByInstitution(institutionName: string, include: string, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
/**
* Searches for person by name.
*
* @endpoint get /api/inse-service/persons/searchByName
* @param authorName Authors name (e.g., Arman Arzani)
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
*/
searchPersonsByName(authorName: string, include: string, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
/**
* Updates the item with the id.
*
* @endpoint put /api/inse-service/items/{id}
* @param id The item id.
* @param itemCreate
*/
updateItem(id: number, itemCreate: ItemCreate, extraHttpRequestParams?: any): Observable<Item>;
}
+7 -4
View File
@@ -17,25 +17,28 @@ import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { HTTPValidationError } from '../model/hTTPValidationError';
import { HTTPValidationError } from '../model/http-validation-error';
// @ts-ignore
import { Item } from '../model/item';
// @ts-ignore
import { ItemCreate } from '../model/itemCreate';
import { ItemCreate } from '../model/item-create';
// @ts-ignore
import { ItemPage } from '../model/itemPage';
import { ItemPage } from '../model/item-page';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
import {
ItemsServiceInterface
} from './items.serviceInterface';
@Injectable({
providedIn: 'root'
})
export class ItemsService extends BaseService {
export class ItemsService extends BaseService implements ItemsServiceInterface {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
super(basePath, configuration);
@@ -0,0 +1,70 @@
/**
* 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 { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { HTTPValidationError } from '../model/models';
import { Item } from '../model/models';
import { ItemCreate } from '../model/models';
import { ItemPage } from '../model/models';
import { Configuration } from '../configuration';
export interface ItemsServiceInterface {
defaultHeaders: HttpHeaders;
configuration: Configuration;
/**
* Adds a new item.
*
* @endpoint post /api/inse-service/items
* @param itemCreate
*/
addItem(itemCreate: ItemCreate, extraHttpRequestParams?: any): Observable<Item>;
/**
* Deletes the item with the id.
*
* @endpoint delete /api/inse-service/items/{id}
* @param id The item id.
*/
deleteItem(id: number, extraHttpRequestParams?: any): Observable<any>;
/**
* Returns the item with the id.
*
* @endpoint get /api/inse-service/items/{id}
* @param id The item id.
*/
getItem(id: number, extraHttpRequestParams?: any): Observable<Item>;
/**
* Returns a page of items.
*
* @endpoint get /api/inse-service/items
* @param pageOffset The page offset.
* @param pageSize The page size.
*/
getItems(pageOffset?: number, pageSize?: number, extraHttpRequestParams?: any): Observable<ItemPage>;
/**
* Updates the item with the id.
*
* @endpoint put /api/inse-service/items/{id}
* @param id The item id.
* @param itemCreate
*/
updateItem(id: number, itemCreate: ItemCreate, extraHttpRequestParams?: any): Observable<Item>;
}
@@ -17,23 +17,26 @@ import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { CollaborationNetwork } from '../model/collaborationNetwork';
import { CollaborationNetwork } from '../model/collaboration-network';
// @ts-ignore
import { FilterProperties } from '../model/filterProperties';
import { FilterProperties } from '../model/filter-properties';
// @ts-ignore
import { HTTPValidationError } from '../model/hTTPValidationError';
import { HTTPValidationError } from '../model/http-validation-error';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
import {
PersonNetworkServiceInterface
} from './person-network.serviceInterface';
@Injectable({
providedIn: 'root'
})
export class PersonNetworkService extends BaseService {
export class PersonNetworkService extends BaseService implements PersonNetworkServiceInterface {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
super(basePath, configuration);
@@ -0,0 +1,36 @@
/**
* 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 { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { CollaborationNetwork } from '../model/models';
import { FilterProperties } from '../model/models';
import { HTTPValidationError } from '../model/models';
import { Configuration } from '../configuration';
export interface PersonNetworkServiceInterface {
defaultHeaders: HttpHeaders;
configuration: Configuration;
/**
* Get a person\&#39;s collaboration network.
* Returns a person\&#39;s collaboration network based on their works and co-authors.
* @endpoint post /api/person/network/{raw_user_id}
* @param rawUserId The raw user ID of the person.
* @param filterProperties
*/
getCollaborationNetwork(rawUserId: string, filterProperties?: FilterProperties, extraHttpRequestParams?: any): Observable<CollaborationNetwork>;
}
@@ -0,0 +1,119 @@
/**
* Innovation Search Engine API
*
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
} from '@angular/common/http';
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { CustomAuthorsListResponse } from '../model/custom-authors-list-response';
// @ts-ignore
import { HTTPValidationError } from '../model/http-validation-error';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
import {
PersonsSearchServiceInterface
} from './persons-search.serviceInterface';
@Injectable({
providedIn: 'root'
})
export class PersonsSearchService extends BaseService implements PersonsSearchServiceInterface {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
super(basePath, configuration);
}
/**
* Searches for persons with advanced filters (Topic &amp; Institution) and pagination.
* @endpoint get /api/inse-service/persons/search-list
* @param query Search query (e.g., Arman AND Arzani)
* @param institutionName Filter by institution name
* @param topic Filter by topic display names
* @param page Page number (1-indexed)
* @param pageSize Results per page
* @param include Comma-separated include tags
* @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 searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CustomAuthorsListResponse>;
public searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CustomAuthorsListResponse>>;
public searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CustomAuthorsListResponse>>;
public searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: 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');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>institutionName, 'institutionName');
if (topic) {
topic.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'topic');
})
}
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>page, 'page');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>pageSize, 'pageSize');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>include, 'include');
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/inse-service/persons/search-list`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<CustomAuthorsListResponse>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
}
@@ -0,0 +1,39 @@
/**
* 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 { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { CustomAuthorsListResponse } from '../model/models';
import { HTTPValidationError } from '../model/models';
import { Configuration } from '../configuration';
export interface PersonsSearchServiceInterface {
defaultHeaders: HttpHeaders;
configuration: Configuration;
/**
* Searches for persons with advanced filters (Topic &amp; Institution) and pagination.
*
* @endpoint get /api/inse-service/persons/search-list
* @param query Search query (e.g., Arman AND Arzani)
* @param institutionName Filter by institution name
* @param topic Filter by topic display names
* @param page Page number (1-indexed)
* @param pageSize Results per page
* @param include Comma-separated include tags
*/
searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, extraHttpRequestParams?: any): Observable<CustomAuthorsListResponse>;
}
+85 -4
View File
@@ -17,23 +17,28 @@ import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { AuthorsListResponse } from '../model/authorsListResponse';
import { AuthorsListResponse } from '../model/authors-list-response';
// @ts-ignore
import { HTTPValidationError } from '../model/hTTPValidationError';
import { CustomAuthorsListResponse } from '../model/custom-authors-list-response';
// @ts-ignore
import { PersonBio } from '../model/personBio';
import { HTTPValidationError } from '../model/http-validation-error';
// @ts-ignore
import { PersonBio } from '../model/person-bio';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
import {
PersonsServiceInterface
} from './persons.serviceInterface';
@Injectable({
providedIn: 'root'
})
export class PersonsService extends BaseService {
export class PersonsService extends BaseService implements PersonsServiceInterface {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
super(basePath, configuration);
@@ -361,4 +366,80 @@ export class PersonsService extends BaseService {
);
}
/**
* Searches for persons with advanced filters (Topic &amp; Institution) and pagination.
* @endpoint get /api/inse-service/persons/search-list
* @param query Search query (e.g., Arman AND Arzani)
* @param institutionName Filter by institution name
* @param topic Filter by topic display names
* @param page Page number (1-indexed)
* @param pageSize Results per page
* @param include Comma-separated include tags
* @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 searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<CustomAuthorsListResponse>;
public searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<CustomAuthorsListResponse>>;
public searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<CustomAuthorsListResponse>>;
public searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: 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');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>institutionName, 'institutionName');
if (topic) {
topic.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'topic');
})
}
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>page, 'page');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>pageSize, 'pageSize');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>include, 'include');
let localVarHeaders = this.defaultHeaders;
const localVarHttpHeaderAcceptSelected: string | undefined = options?.httpHeaderAccept ?? this.configuration.selectHeaderAccept([
'application/json'
]);
if (localVarHttpHeaderAcceptSelected !== undefined) {
localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected);
}
const localVarHttpContext: HttpContext = options?.context ?? new HttpContext();
const localVarTransferCache: boolean = options?.transferCache ?? true;
let responseType_: 'text' | 'json' | 'blob' = 'json';
if (localVarHttpHeaderAcceptSelected) {
if (localVarHttpHeaderAcceptSelected.startsWith('text')) {
responseType_ = 'text';
} else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) {
responseType_ = 'json';
} else {
responseType_ = 'blob';
}
}
let localVarPath = `/api/inse-service/persons/search-list`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<CustomAuthorsListResponse>('get', `${basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>responseType_,
...(withCredentials ? { withCredentials } : {}),
headers: localVarHeaders,
observe: observe,
...(localVarTransferCache !== undefined ? { transferCache: localVarTransferCache } : {}),
reportProgress: reportProgress
}
);
}
}
@@ -0,0 +1,87 @@
/**
* 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 { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { AuthorsListResponse } from '../model/models';
import { CustomAuthorsListResponse } from '../model/models';
import { HTTPValidationError } from '../model/models';
import { PersonBio } from '../model/models';
import { Configuration } from '../configuration';
export interface PersonsServiceInterface {
defaultHeaders: HttpHeaders;
configuration: Configuration;
/**
* Generates a bio for a person by author ID.
*
* @endpoint get /api/inse-service/persons/bio
* @param authorId OpenAlex author ID (e.g., A5093075883)
* @param include Comma-separated list to include tags
*/
generatePersonBio(authorId: string, include?: string, extraHttpRequestParams?: any): Observable<PersonBio>;
/**
* Searches for person by ID.
*
* @endpoint get /api/inse-service/person/{id}
* @param id OpenAlex author ID
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
*/
getPersonByID(id: string, include: string, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
/**
* Searches for persons by ID or name.
*
* @endpoint get /api/inse-service/persons/search
* @param authorId OpenAlex author ID (e.g., A5093075883)
* @param query Search query (e.g., Arman AND Arzani)
* @param include Comma-separated include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, sources, counts_by_year, works_api_url, dates, cited_by_count_boost
*/
searchPersons(authorId?: string, query?: string, include?: string, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
/**
* Searches for persons by institution name.
*
* @endpoint get /api/inse-service/persons/searchByInstitution
* @param institutionName Institution name (e.g., MIT, Oxford University)
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
*/
searchPersonsByInstitution(institutionName: string, include: string, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
/**
* Searches for person by name.
*
* @endpoint get /api/inse-service/persons/searchByName
* @param authorName Authors name (e.g., Arman Arzani)
* @param include Which data do we require? include tags: topics_full, topic_share, summary_stats, ids, last_known_institutions, ...
*/
searchPersonsByName(authorName: string, include: string, extraHttpRequestParams?: any): Observable<AuthorsListResponse>;
/**
* Searches for persons with advanced filters (Topic &amp; Institution) and pagination.
*
* @endpoint get /api/inse-service/persons/search-list
* @param query Search query (e.g., Arman AND Arzani)
* @param institutionName Filter by institution name
* @param topic Filter by topic display names
* @param page Page number (1-indexed)
* @param pageSize Results per page
* @param include Comma-separated include tags
*/
searchPersonsList(query?: string, institutionName?: string, topic?: Array<string>, page?: number, pageSize?: number, include?: string, extraHttpRequestParams?: any): Observable<CustomAuthorsListResponse>;
}
+5 -2
View File
@@ -17,19 +17,22 @@ import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { HTTPValidationError } from '../model/hTTPValidationError';
import { HTTPValidationError } from '../model/http-validation-error';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
import {
TopicsServiceInterface
} from './topics.serviceInterface';
@Injectable({
providedIn: 'root'
})
export class TopicsService extends BaseService {
export class TopicsService extends BaseService implements TopicsServiceInterface {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
super(basePath, configuration);
@@ -0,0 +1,42 @@
/**
* 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 { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { HTTPValidationError } from '../model/models';
import { Configuration } from '../configuration';
export interface TopicsServiceInterface {
defaultHeaders: HttpHeaders;
configuration: Configuration;
/**
* Builds the topic hierarchy cache.
*
* @endpoint get /api/inse-service/topics/cache
* @param pageSize Page size for each search page.
* @param saveJson Persist cache JSON to data folder.
*/
buildTopicCache(pageSize?: number, saveJson?: boolean, extraHttpRequestParams?: any): Observable<object>;
/**
* Counts topic hierarchy occurrences from cache.
*
* @endpoint get /api/inse-service/topics/count
* @param topic Topic names (repeat parameter).
*/
countTopicHierarchy(topic: Array<string>, extraHttpRequestParams?: any): Observable<object>;
}
+40 -36
View File
@@ -9,35 +9,39 @@
*/
/* tslint:disable:no-unused-variable member-ordering */
import { Inject, Injectable, Optional } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
} from '@angular/common/http';
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
import { Inject, Injectable, Optional } from '@angular/core';
import {
HttpClient, HttpHeaders, HttpParams,
HttpResponse, HttpEvent, HttpParameterCodec, HttpContext
} from '@angular/common/http';
import { CustomHttpParameterCodec } from '../encoder';
import { Observable } from 'rxjs';
// @ts-ignore
import { HTTPValidationError } from '../model/hTTPValidationError';
import { HTTPValidationError } from '../model/http-validation-error';
// @ts-ignore
import { TopicsByTime } from '../model/topicsByTime';
// @ts-ignore
import { WorkPage } from '../model/workPage';
// @ts-ignore
import { WorksListResponse } from '../model/worksListResponse';
import { WorksListResponse } from '../model/works-list-response';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BASE_PATH, COLLECTION_FORMATS } from '../variables';
import { Configuration } from '../configuration';
import { BaseService } from '../api.base.service';
import {
WorksServiceInterface
} from './works.serviceInterface';
@Injectable({
providedIn: 'root'
providedIn: 'root'
})
export class WorksService extends BaseService {
export class WorksService extends BaseService implements WorksServiceInterface {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string|string[], @Optional() configuration?: Configuration) {
constructor(protected httpClient: HttpClient, @Optional() @Inject(BASE_PATH) basePath: string | string[], @Optional() configuration?: Configuration) {
super(basePath, configuration);
}
@@ -48,10 +52,10 @@ export class WorksService extends BaseService {
* @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 getAllAuthorWorks(authorId: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<WorksListResponse>;
public getAllAuthorWorks(authorId: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<WorksListResponse>>;
public getAllAuthorWorks(authorId: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<WorksListResponse>>;
public getAllAuthorWorks(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
public getAllAuthorWorks(authorId: string, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable<WorksListResponse>;
public getAllAuthorWorks(authorId: string, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable<HttpResponse<WorksListResponse>>;
public getAllAuthorWorks(authorId: string, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable<HttpEvent<WorksListResponse>>;
public getAllAuthorWorks(authorId: string, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable<any> {
if (authorId === null || authorId === undefined) {
throw new Error('Required parameter authorId was null or undefined when calling getAllAuthorWorks.');
}
@@ -84,7 +88,7 @@ export class WorksService extends BaseService {
}
}
let localVarPath = `/api/works/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/all`;
let localVarPath = `/api/works/${this.configuration.encodeParam({ name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined })}/all`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<WorksListResponse>('get', `${basePath}${localVarPath}`,
{
@@ -111,35 +115,35 @@ export class WorksService extends BaseService {
* @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 getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<WorkPage>;
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<WorkPage>>;
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<WorkPage>>;
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable<WorkPage>;
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable<HttpResponse<WorkPage>>;
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable<HttpEvent<WorkPage>>;
public getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable<any> {
if (authorId === null || authorId === undefined) {
throw new Error('Required parameter authorId was null or undefined when calling getAuthorWorks.');
}
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>page, 'page');
<any>page, 'page');
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>size, 'size');
<any>size, 'size');
if (publicationYear) {
publicationYear.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'publication_year');
<any>element, 'publication_year');
})
}
if (type) {
type.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'type');
<any>element, 'type');
})
}
if (language) {
language.forEach((element) => {
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>element, 'language');
<any>element, 'language');
})
}
@@ -171,7 +175,7 @@ export class WorksService extends BaseService {
}
}
let localVarPath = `/api/works/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}`;
let localVarPath = `/api/works/${this.configuration.encodeParam({ name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined })}`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<WorkPage>('get', `${basePath}${localVarPath}`,
{
@@ -195,17 +199,17 @@ export class WorksService extends BaseService {
* @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 getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<TopicsByTime>;
public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<TopicsByTime>>;
public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<TopicsByTime>>;
public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe?: 'body', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable<TopicsByTime>;
public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe?: 'response', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable<HttpResponse<TopicsByTime>>;
public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe?: 'events', reportProgress?: boolean, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable<HttpEvent<TopicsByTime>>;
public getTopicsByTimeByAuthor(authorId: string, maxTopicsPerYear?: number, observe: any = 'body', reportProgress: boolean = false, options?: { httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean }): Observable<any> {
if (authorId === null || authorId === undefined) {
throw new Error('Required parameter authorId was null or undefined when calling getTopicsByTimeByAuthor.');
}
let localVarQueryParameters = new HttpParams({encoder: this.encoder});
let localVarQueryParameters = new HttpParams({ encoder: this.encoder });
localVarQueryParameters = this.addToHttpParams(localVarQueryParameters,
<any>maxTopicsPerYear, 'max_topics_per_year');
<any>maxTopicsPerYear, 'max_topics_per_year');
let localVarHeaders = this.defaultHeaders;
@@ -235,7 +239,7 @@ export class WorksService extends BaseService {
}
}
let localVarPath = `/api/works/${this.configuration.encodeParam({name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined})}/topics-by-time`;
let localVarPath = `/api/works/${this.configuration.encodeParam({ name: "authorId", value: authorId, in: "path", style: "simple", explode: false, dataType: "string", dataFormat: undefined })}/topics-by-time`;
const { basePath, withCredentials } = this.configuration;
return this.httpClient.request<TopicsByTime>('get', `${basePath}${localVarPath}`,
{
@@ -0,0 +1,48 @@
/**
* 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 { HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs';
import { HTTPValidationError } from '../model/models';
import { WorkPage } from '../model/models';
import { WorksListResponse } from '../model/models';
import { Configuration } from '../configuration';
export interface WorksServiceInterface {
defaultHeaders: HttpHeaders;
configuration: Configuration;
/**
* Returns all works for an author.
*
* @endpoint get /api/works/{author_id}/all
* @param authorId The author id, for example A5023888391.
*/
getAllAuthorWorks(authorId: string, extraHttpRequestParams?: any): Observable<WorksListResponse>;
/**
* Returns a page of works for an author.
*
* @endpoint get /api/works/{author_id}
* @param authorId The author id, for example A5023888391.
* @param page The page number.
* @param size The page size.
* @param publicationYear Filter by publication year. Can be repeated.
* @param type Filter by publication type. Can be repeated.
* @param language Filter by language code. Can be repeated.
*/
getAuthorWorks(authorId: string, page?: number, size?: number, publicationYear?: Array<number>, type?: Array<string>, language?: Array<string>, extraHttpRequestParams?: any): Observable<WorkPage>;
}
@@ -7,7 +7,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { AuthScope } from './authScope';
import { AuthScope } from './auth-scope';
export interface AccessGrant {
@@ -7,7 +7,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { AuthAccount } from './authAccount';
import { AuthAccount } from './auth-account';
export interface AuthScope {
@@ -7,7 +7,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { DehydratedInstitution } from './dehydratedInstitution';
import { DehydratedInstitution } from './dehydrated-institution';
/**
@@ -7,7 +7,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { Model2YrMeanCitedness } from './model2YrMeanCitedness';
import { Model2YrMeanCitedness } from './model2-yr-mean-citedness';
/**
+7 -7
View File
@@ -7,13 +7,13 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { AuthorAffiliationsInner } from './authorAffiliationsInner';
import { AuthorParsedLongestName } from './authorParsedLongestName';
import { DehydratedInstitution } from './dehydratedInstitution';
import { AuthorCountsByYearInner } from './authorCountsByYearInner';
import { AuthorIds } from './authorIds';
import { AuthorSummaryStats } from './authorSummaryStats';
import { WorkTopic } from './workTopic';
import { AuthorAffiliationsInner } from './author-affiliations-inner';
import { AuthorParsedLongestName } from './author-parsed-longest-name';
import { DehydratedInstitution } from './dehydrated-institution';
import { AuthorCountsByYearInner } from './author-counts-by-year-inner';
import { AuthorIds } from './author-ids';
import { AuthorSummaryStats } from './author-summary-stats';
import { WorkTopic } from './work-topic';
/**
@@ -9,7 +9,7 @@
*/
import { Meta } from './meta';
import { Author } from './author';
import { GroupByResult } from './groupByResult';
import { GroupByResult } from './group-by-result';
/**
+2 -2
View File
@@ -7,8 +7,8 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { DehydratedInstitution } from './dehydratedInstitution';
import { DehydratedAuthor } from './dehydratedAuthor';
import { DehydratedInstitution } from './dehydrated-institution';
import { DehydratedAuthor } from './dehydrated-author';
/**
@@ -10,9 +10,9 @@
export const CollaborationNetworkNodeType = {
Author: 'author',
Institution: 'institution',
Work: 'work'
author: 'author',
institution: 'institution',
work: 'work'
} as const;
export type CollaborationNetworkNodeType = typeof CollaborationNetworkNodeType[keyof typeof CollaborationNetworkNodeType];
@@ -7,7 +7,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { CollaborationNetworkNodeType } from './collaborationNetworkNodeType';
import { CollaborationNetworkNodeType } from './collaboration-network-node-type';
export interface CollaborationNetworkNode {
@@ -7,9 +7,9 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { FilterInformation } from './filterInformation';
import { CollaborationNetworkEdge } from './collaborationNetworkEdge';
import { CollaborationNetworkNode } from './collaborationNetworkNode';
import { FilterInformation } from './filter-information';
import { CollaborationNetworkEdge } from './collaboration-network-edge';
import { CollaborationNetworkNode } from './collaboration-network-node';
export interface CollaborationNetwork {
+39
View File
@@ -0,0 +1,39 @@
/**
* 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 { AuthorAffiliationsInner } from './author-affiliations-inner';
import { AuthorParsedLongestName } from './author-parsed-longest-name';
import { DehydratedInstitution } from './dehydrated-institution';
import { AuthorCountsByYearInner } from './author-counts-by-year-inner';
import { AuthorIds } from './author-ids';
import { AuthorSummaryStats } from './author-summary-stats';
import { WorkTopic } from './work-topic';
export interface CustomAuthor {
id?: string | null;
orcid?: string | null;
display_name?: string | null;
display_name_alternatives?: Array<string> | null;
longest_name?: string | null;
parsed_longest_name?: AuthorParsedLongestName | null;
works_count?: number | null;
cited_by_count?: number | null;
summary_stats?: AuthorSummaryStats | null;
affiliations?: Array<AuthorAffiliationsInner> | null;
last_known_institutions?: Array<DehydratedInstitution> | null;
topics?: Array<WorkTopic> | null;
counts_by_year?: Array<AuthorCountsByYearInner> | null;
ids?: AuthorIds | null;
works_api_url?: string | null;
created_date?: string | null;
updated_date?: string | null;
relevance_rating?: string | null;
}
@@ -0,0 +1,20 @@
/**
* 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 { Meta } from './meta';
import { CustomAuthor } from './custom-author';
import { GroupByResult } from './group-by-result';
export interface CustomAuthorsListResponse {
meta?: Meta | null;
results?: Array<CustomAuthor> | null;
group_by?: Array<GroupByResult> | null;
}
@@ -7,8 +7,8 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { InstitutionInformation } from './institutionInformation';
import { WorkTopicInformation } from './workTopicInformation';
import { InstitutionInformation } from './institution-information';
import { WorkTopicInformation } from './work-topic-information';
export interface FilterInformation {
@@ -7,7 +7,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ValidationError } from './validationError';
import { ValidationError } from './validation-error';
export interface HTTPValidationError {
@@ -7,7 +7,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { AuthScope } from './authScope';
import { AuthScope } from './auth-scope';
export interface IdentityGrant {
+1 -1
View File
@@ -7,7 +7,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { DehydratedSource } from './dehydratedSource';
import { DehydratedSource } from './dehydrated-source';
/**
+1 -1
View File
@@ -7,7 +7,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { CostUsd } from './costUsd';
import { CostUsd } from './cost-usd';
/**
+49 -47
View File
@@ -1,60 +1,62 @@
export * from './accessGrant';
export * from './authAccount';
export * from './authScope';
export * from './access-grant';
export * from './auth-account';
export * from './auth-scope';
export * from './author';
export * from './authorAffiliationsInner';
export * from './authorCountsByYearInner';
export * from './authorIds';
export * from './authorParsedLongestName';
export * from './authorSummaryStats';
export * from './authorsListResponse';
export * from './author-affiliations-inner';
export * from './author-counts-by-year-inner';
export * from './author-ids';
export * from './author-parsed-longest-name';
export * from './author-summary-stats';
export * from './authors-list-response';
export * from './authorship';
export * from './award';
export * from './collaborationNetwork';
export * from './collaborationNetworkEdge';
export * from './collaborationNetworkNode';
export * from './collaborationNetworkNodeType';
export * from './costUsd';
export * from './dehydratedAuthor';
export * from './dehydratedFunder';
export * from './dehydratedInstitution';
export * from './dehydratedSource';
export * from './filterInformation';
export * from './filterProperties';
export * from './collaboration-network';
export * from './collaboration-network-edge';
export * from './collaboration-network-node';
export * from './collaboration-network-node-type';
export * from './cost-usd';
export * from './custom-author';
export * from './custom-authors-list-response';
export * from './dehydrated-author';
export * from './dehydrated-funder';
export * from './dehydrated-institution';
export * from './dehydrated-source';
export * from './filter-information';
export * from './filter-properties';
export * from './fwci';
export * from './groupByResult';
export * from './hTTPValidationError';
export * from './identityGrant';
export * from './institutionInformation';
export * from './group-by-result';
export * from './http-validation-error';
export * from './identity-grant';
export * from './institution-information';
export * from './item';
export * from './itemCreate';
export * from './itemPage';
export * from './item-create';
export * from './item-page';
export * from './location';
export * from './meta';
export * from './model2YrMeanCitedness';
export * from './openAccess';
export * from './personBio';
export * from './model2-yr-mean-citedness';
export * from './open-access';
export * from './person-bio';
export * from './score';
export * from './validation-error';
export * from './validation-error-loc-inner';
export * from './topicCount';
export * from './topicsByTime';
export * from './topicsByYear';
export * from './validationError';
export * from './validationErrorLocInner';
export * from './value';
export * from './work';
export * from './workBiblio';
export * from './workCitationNormalizedPercentile';
export * from './workCitedByPercentileYear';
export * from './workCountsByYearInner';
export * from './workHasContent';
export * from './workIds';
export * from './workKeyword';
export * from './workMeshInner';
export * from './workPage';
export * from './workSustainableDevelopmentGoalsInner';
export * from './workTopic';
export * from './workTopicDomain';
export * from './workTopicField';
export * from './workTopicInformation';
export * from './workTopicSubfield';
export * from './worksListResponse';
export * from './work-biblio';
export * from './work-citation-normalized-percentile';
export * from './work-cited-by-percentile-year';
export * from './work-counts-by-year-inner';
export * from './work-has-content';
export * from './work-ids';
export * from './work-keyword';
export * from './work-mesh-inner';
export * from './work-page';
export * from './work-sustainable-development-goals-inner';
export * from './work-topic';
export * from './work-topic-domain';
export * from './work-topic-field';
export * from './work-topic-information';
export * from './work-topic-subfield';
export * from './works-list-response';
@@ -7,7 +7,7 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { ValidationErrorLocInner } from './validationErrorLocInner';
import { ValidationErrorLocInner } from './validation-error-loc-inner';
export interface ValidationError {
@@ -8,9 +8,9 @@
* Do not edit the class manually.
*/
import { Score } from './score';
import { WorkTopicDomain } from './workTopicDomain';
import { WorkTopicSubfield } from './workTopicSubfield';
import { WorkTopicField } from './workTopicField';
import { WorkTopicDomain } from './work-topic-domain';
import { WorkTopicSubfield } from './work-topic-subfield';
import { WorkTopicField } from './work-topic-field';
/**
+12 -12
View File
@@ -7,22 +7,22 @@
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { DehydratedFunder } from './dehydratedFunder';
import { DehydratedFunder } from './dehydrated-funder';
import { Authorship } from './authorship';
import { OpenAccess } from './openAccess';
import { WorkIds } from './workIds';
import { WorkSustainableDevelopmentGoalsInner } from './workSustainableDevelopmentGoalsInner';
import { WorkTopic } from './workTopic';
import { WorkCountsByYearInner } from './workCountsByYearInner';
import { WorkKeyword } from './workKeyword';
import { WorkCitationNormalizedPercentile } from './workCitationNormalizedPercentile';
import { OpenAccess } from './open-access';
import { WorkIds } from './work-ids';
import { WorkSustainableDevelopmentGoalsInner } from './work-sustainable-development-goals-inner';
import { WorkTopic } from './work-topic';
import { WorkCountsByYearInner } from './work-counts-by-year-inner';
import { WorkKeyword } from './work-keyword';
import { WorkCitationNormalizedPercentile } from './work-citation-normalized-percentile';
import { Award } from './award';
import { Fwci } from './fwci';
import { WorkMeshInner } from './workMeshInner';
import { WorkCitedByPercentileYear } from './workCitedByPercentileYear';
import { WorkHasContent } from './workHasContent';
import { WorkMeshInner } from './work-mesh-inner';
import { WorkCitedByPercentileYear } from './work-cited-by-percentile-year';
import { WorkHasContent } from './work-has-content';
import { Location } from './location';
import { WorkBiblio } from './workBiblio';
import { WorkBiblio } from './work-biblio';
/**
@@ -9,7 +9,7 @@
*/
import { Meta } from './meta';
import { Work } from './work';
import { GroupByResult } from './groupByResult';
import { GroupByResult } from './group-by-result';
/**
@@ -1,65 +1,226 @@
@let persons = state.persons();
@let results = persons.results ?? [];
@if (!isPersonsLoading()) {
<mat-grid-list cols="1" rowHeight="65px" gutterSize="16px">
<mat-grid-tile>
<p class="result-count">{{ results.length }} Ergebnisse</p>
</mat-grid-tile>
</mat-grid-list>
<mat-grid-list cols="1" rowHeight="220px" gutterSize="16px">
<section class="person-list-page">
<div class="layout-container">
<!-- Left Column: Results Panel -->
<main class="results-column">
<header class="page-header">
<div>
<h1>Passende Personen finden</h1>
<p>
Durchsuchen Sie OpenAlex-Autorinnen und -Autoren nach Namen, Themen oder Kennungen.
</p>
</div>
@if (state.searchValue()) {
<div class="selection-summary">
<div>
<strong>Aktive Suche</strong>
<span>„{{ state.searchValue() }}“</span>
</div>
<button mat-icon-button (click)="clearSearch()" matTooltip="Suche zurücksetzen">
<mat-icon>close</mat-icon>
</button>
</div>
}
</header>
@for (person of results; track person.id) {
<!-- Active Filter Chips Row -->
@if (activeFilters.length) {
<div class="active-filters-row">
<span class="active-filters-label">Aktive Filter:</span>
<div class="chips-container">
@for (filter of activeFilters; track filter.value) {
<span class="filter-chip">
{{ filter.label }}
<button class="remove-chip-btn" (click)="removeFilter(filter)" aria-label="Filter entfernen">
<mat-icon>close</mat-icon>
</button>
</span>
}
<button class="clear-all-btn" (click)="clearAllFilters()">
Filter zurücksetzen
</button>
</div>
</div>
}
<mat-grid-tile>
@if (person.id){
<mat-card (click)="navigateID(person.id)" class="person-card">
<div class="toolbar">
<span class="result-count">{{ resultRange() }}</span>
<div class="card-content">
<div class="toolbar-actions">
<div class="sort-selector">
<span class="sort-label">Sortierung:</span>
<div class="select-wrapper">
<select [formControl]="sortControl">
<option value="relevance">Beste Treffer (Relevanz)</option>
<option value="works">Publikationen (absteigend)</option>
<option value="citations">Zitierungen (absteigend)</option>
</select>
</div>
</div>
</div>
</div>
<div class="avatar">
<mat-icon class="avatar-icon">person</mat-icon>
<section class="results-panel">
<div class="results-head">
<strong>{{ total | number: "1.0-0" }} Personen gefunden</strong>
<span>Sortiert nach Publikationen und Zitierungen</span>
</div>
@if (loading) {
<div class="loading-state">
<mat-spinner diameter="40"></mat-spinner>
</div>
} @else if (sortedPersons.length) {
<div class="person-grid">
@for (person of sortedPersons; track person.id) {
<article class="person-card">
<div class="card-header">
<!-- Initials Avatar or Profile Image fallback -->
<div class="avatar">
{{ getInitials(person.display_name) }}
</div>
<div class="header-main">
<div class="rating-and-bookmark">
@if (person.relevance_rating) {
<span class="suitability-badge" [ngClass]="getRatingClass(person.relevance_rating)">
{{ person.relevance_rating }}
</span>
}
<button class="bookmark-btn" (click)="toggleBookmark(person)"
[class.bookmarked]="isBookmarked(person)" aria-label="Bookmark person">
<mat-icon>{{ isBookmarked(person) ? 'bookmark' : 'bookmark_border' }}</mat-icon>
</button>
</div>
<div class="info">
<h3 class="name">{{ person.display_name }}</h3>
<p class="person-id">{{ getDistinguishingId(person) }}</p>
@if (person.affiliations!=undefined){
<p class="affiliation">
{{ person.affiliations[0]?.institution?.display_name }}
</p>
}
<p class="stats">
Works: {{ person.works_count }} ·
Citations: {{ person.cited_by_count }}
</p>
<div class="topics">
@for (t of person.topics; track t) {
<mat-chip class="topic-chip">{{ t.display_name }}</mat-chip>
}
</div>
</div>
<h2 class="person-name">{{ person.display_name }}</h2>
<p class="institution">{{ institution(person) }}</p>
<p class="person-id">{{ getDistinguishingId(person) }}</p>
<p class="stats">
Works: {{ person.works_count }} ·
Citations: {{ person.cited_by_count }}
</p>
</div>
</div>
<div class="card-body">
<div class="topic-row">
@for (topic of topics(person); track topic) {
<span class="topic-tag">{{ topic }}</span>
}
</div>
</div>
</mat-card>
}
</mat-grid-tile>
}
</mat-grid-list>
} @else {
<mat-grid-list cols="1" rowHeight="220px" gutterSize="16px">
<mat-grid-tile>
<div class="loading">
<mat-spinner diameter="40"></mat-spinner>
<div class="card-footer">
<div class="action-buttons">
<a [routerLink]="['/person', person.id, 'overview']" class="action-btn">
<mat-icon>visibility</mat-icon>
<span>Übersicht</span>
</a>
<a [routerLink]="['/person', person.id, 'publications']" class="action-btn">
<mat-icon>menu_book</mat-icon>
<span>Publikationen</span>
</a>
<a [routerLink]="['/person', person.id, 'network']" class="action-btn">
<mat-icon>share</mat-icon>
<span>Netzwerk</span>
</a>
</div>
</div>
</article>
}
</div>
</mat-grid-tile>
</mat-grid-list>
}
} @else {
<div class="empty-state">
<mat-icon>person_search</mat-icon>
<h2>Keine Personen gefunden</h2>
<p>Versuchen Sie einen anderen Suchbegriff oder passen Sie die Filter an.</p>
</div>
}
<!-- Custom Pagination Controls -->
@if (totalPages > 1) {
<div class="custom-pagination">
<button class="paginator-btn" [disabled]="isFirstPage()" (click)="prevPage()" aria-label="Vorherige Seite">
<mat-icon>chevron_left</mat-icon>
<span>Vorherige</span>
</button>
<div class="page-numbers">
@for (p of pageList; track p) {
<button class="page-number-btn" [class.active]="p === currentPage" (click)="goToPage(p)">
{{ p }}
</button>
}
</div>
<button class="paginator-btn" [disabled]="isLastPage()" (click)="nextPage()" aria-label="Nächste Seite">
<span>Nächste</span>
<mat-icon>chevron_right</mat-icon>
</button>
</div>
}
</section>
</main>
<!-- Right Column: Sidebar Filters -->
<aside class="filters-sidebar">
<div class="sidebar-header">
<mat-icon>filter_alt</mat-icon>
<h2>Filter &amp; Suche</h2>
</div>
<!-- Section 1: Topics Search and Selection -->
<div class="filter-section">
<h3 class="filter-section-title">Themen &amp; Expertise</h3>
<div class="topic-search-wrapper">
<mat-icon>search</mat-icon>
<input type="text" [formControl]="topicSearchControl" placeholder="Thema suchen..." />
@if (topicSearchControl.value) {
<button class="clear-topic-search" (click)="topicSearchControl.setValue('')">
<mat-icon>close</mat-icon>
</button>
}
</div>
<div class="checkbox-list">
@for (topic of filteredTopicsList; track topic) {
<label class="checkbox-label">
<input type="checkbox" [checked]="isTopicSelected(topic)" (change)="toggleTopic(topic)" />
<span class="checkbox-text">{{ topic }}</span>
</label>
}
@if (topicsList.length > 5 && !topicSearchControl.value) {
<button class="show-more-btn" (click)="toggleShowAllTopics()">
<span>{{ showAllTopics ? 'Weniger anzeigen' : 'Mehr anzeigen' }}</span>
<mat-icon>{{ showAllTopics ? 'expand_less' : 'expand_more' }}</mat-icon>
</button>
}
</div>
</div>
<!-- Section 2: Institution Filter -->
<div class="filter-section">
<h3 class="filter-section-title">Institution</h3>
<div class="topic-search-wrapper">
<mat-icon>business</mat-icon>
<input type="text" [formControl]="institutionControl" placeholder="Institution suchen..."
(keyup.enter)="applySidebarFilters()" />
@if (institutionControl.value) {
<button class="clear-topic-search" (click)="institutionControl.setValue(''); applySidebarFilters()">
<mat-icon>close</mat-icon>
</button>
}
</div>
</div>
<!-- Sidebar Footer Action showing matches count -->
<div class="sidebar-footer">
<button class="submit-btn" (click)="applySidebarFilters()" [disabled]="loading">
<span>{{ total | number: "1.0-0" }} Personen anzeigen</span>
</button>
</div>
</aside>
</div>
</section>
@@ -1,78 +1,657 @@
.result-count {
margin: 0 0 12px;
font-size: 14px;
color: #666;
.person-list-page {
padding: 24px;
background: var(--sg-background);
min-height: 100vh;
}
.person-card {
width: 100%;
height: 100%;
padding: 12px;
border-radius: 16px;
.layout-container {
display: grid;
grid-template-columns: 1fr 280px;
gap: 24px;
align-items: start;
max-width: 1200px;
margin: 0 auto;
}
.card-content {
display: flex;
align-items: center;
gap: 16px;
height: 100%;
}
.avatar {
display: flex;
justify-content: center;
align-items: center;
}
.avatar-icon {
font-size: 48px;
width: 48px;
height: 48px;
color: #9e9e9e;
}
.info {
.results-column {
display: flex;
flex-direction: column;
gap: 4px;
gap: 20px;
min-width: 0;
}
.name {
margin: 0;
}
.person-id {
font-size: 11px;
color: #aaa;
margin: 0;
}
.affiliation {
color: #666;
margin: 0;
}
.stats {
font-size: 12px;
color: #888;
}
.topics {
.page-header {
display: flex;
justify-content: space-between;
align-items: center;
gap: 16px;
h1 {
margin: 0;
font-size: 26px;
font-weight: 700;
color: var(--sg-text);
}
p {
margin: 4px 0 0;
color: var(--sg-text-muted);
font-size: 14px;
}
}
.selection-summary {
display: flex;
align-items: center;
gap: 12px;
padding: 8px 12px;
background: var(--sg-surface);
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
strong {
display: block;
font-size: 11px;
color: var(--sg-text-muted);
text-transform: uppercase;
}
span {
font-size: 13px;
font-weight: 600;
color: var(--sg-primary);
}
}
.active-filters-row {
display: flex;
align-items: center;
gap: 10px;
background: var(--sg-surface);
padding: 8px 16px;
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
flex-wrap: wrap;
font-size: 13px;
}
.active-filters-label {
font-weight: 600;
color: var(--sg-text-muted);
}
.chips-container {
display: flex;
align-items: center;
gap: 6px;
flex-wrap: wrap;
}
.topic-chip {
font-size: 12px;
}
.loading {
display: flex;
justify-content: center;
.filter-chip {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 2px 8px;
background: var(--sg-surface-soft);
border: 1px solid var(--sg-border-strong);
border-radius: 12px;
font-size: 11px;
font-weight: 600;
color: var(--sg-text);
button {
border: none;
background: transparent;
cursor: pointer;
padding: 0;
display: flex;
color: var(--sg-text-soft);
&:hover {
color: var(--sg-text);
}
mat-icon {
font-size: 12px;
width: 12px;
height: 12px;
}
}
}
.clear-all-btn {
border: none;
background: transparent;
cursor: pointer;
font-size: 11px;
font-weight: 600;
color: var(--sg-warning);
text-decoration: underline;
}
.toolbar {
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid var(--sg-border);
padding-bottom: 12px;
}
.result-count {
font-size: 13px;
color: var(--sg-text-muted);
}
.sort-selector {
display: flex;
align-items: center;
gap: 8px;
font-size: 13px;
color: var(--sg-text-muted);
select {
background: var(--sg-surface);
border: 1px solid var(--sg-border-strong);
border-radius: var(--sg-radius-sm);
padding: 6px 12px;
font-size: 13px;
color: var(--sg-text);
outline: none;
cursor: pointer;
}
}
.person-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 20px;
}
.person-card {
background: var(--sg-surface);
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
box-shadow: var(--sg-shadow-sm);
display: flex;
flex-direction: column;
transition: transform 0.15s ease, box-shadow 0.15s ease;
&:hover {
transform: translateY(-2px);
box-shadow: var(--sg-shadow-md);
}
}
.card-header {
padding: 16px;
display: flex;
gap: 12px;
border-bottom: 1px solid var(--sg-surface-soft);
.avatar {
width: 40px;
height: 40px;
border-radius: 50%;
background: var(--sg-primary-soft);
color: var(--sg-primary);
font-size: 14px;
font-weight: 700;
display: flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
border: 1px solid var(--sg-border);
}
.header-main {
flex-grow: 1;
min-width: 0;
}
}
.rating-and-bookmark {
display: flex;
justify-content: space-between;
align-items: center;
}
.suitability-badge {
font-size: 10px;
font-weight: 700;
padding: 2px 6px;
border-radius: 8px;
text-transform: uppercase;
&.very-suitable {
background: var(--sg-success-soft);
color: var(--sg-success);
}
&.suitable {
background: var(--sg-warning-soft);
color: var(--sg-warning);
}
&.possible {
background: var(--sg-primary-soft);
color: var(--sg-text-muted);
}
}
.bookmark-btn {
border: none;
background: transparent;
cursor: pointer;
padding: 2px;
color: var(--sg-text-soft);
&:hover {
color: var(--sg-primary);
}
&.bookmarked {
color: #e53935;
}
mat-icon {
font-size: 18px;
width: 18px;
height: 18px;
}
}
.person-name {
margin: 6px 0 2px;
font-size: 16px;
font-weight: 600;
color: var(--sg-text);
}
.institution {
margin: 0;
font-size: 12px;
color: var(--sg-text-muted);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.person-id {
margin: 2px 0 0;
font-size: 10px;
color: var(--sg-text-soft);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.stats {
margin: 4px 0 0;
font-size: 12px;
color: var(--sg-text-muted);
}
.card-body {
padding: 16px;
flex-grow: 1;
display: flex;
flex-direction: column;
gap: 12px;
justify-content: space-between;
}
.experience-list {
list-style: none;
padding: 0;
margin: 0;
li {
font-size: 12px;
color: var(--sg-text-muted);
position: relative;
padding-left: 12px;
margin-bottom: 4px;
&::before {
content: "•";
position: absolute;
left: 0;
color: var(--sg-text-soft);
}
}
}
.topic-row {
display: flex;
flex-wrap: wrap;
gap: 4px;
}
.topic-tag {
background: var(--sg-surface-soft);
border: 1px solid var(--sg-border);
color: var(--sg-text-muted);
font-size: 10px;
font-weight: 600;
padding: 2px 6px;
border-radius: 4px;
}
.card-footer {
padding: 10px 12px;
border-top: 1px solid var(--sg-border);
background: var(--sg-surface-muted);
}
.action-buttons {
display: flex;
gap: 6px;
}
.action-btn {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
gap: 4px;
padding: 6px;
background: var(--sg-surface);
border: 1px solid var(--sg-border-strong);
border-radius: var(--sg-radius-sm);
color: var(--sg-text-muted);
font-size: 10px;
font-weight: 600;
text-decoration: none;
mat-icon {
font-size: 12px;
width: 12px;
height: 12px;
}
&:hover {
background: var(--sg-primary-soft);
color: var(--sg-primary);
}
}
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
padding: 48px 16px;
background: var(--sg-surface);
border: 1px dashed var(--sg-border);
border-radius: var(--sg-radius-sm);
color: var(--sg-text-muted);
mat-icon {
font-size: 36px;
width: 36px;
height: 36px;
margin-bottom: 12px;
}
h2 {
margin: 0 0 4px;
font-size: 16px;
}
p {
margin: 0;
font-size: 13px;
}
}
.custom-pagination {
display: flex;
align-items: center;
justify-content: center;
gap: 12px;
padding-top: 16px;
}
.paginator-btn {
display: flex;
align-items: center;
gap: 4px;
padding: 6px 12px;
background: var(--sg-surface);
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
color: var(--sg-text);
font-size: 12px;
font-weight: 600;
cursor: pointer;
mat-icon {
font-size: 16px;
width: 16px;
height: 16px;
}
&:hover:not(:disabled) {
background: var(--sg-surface-soft);
}
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
}
.page-numbers {
display: flex;
gap: 4px;
}
.page-number-btn {
width: 32px;
height: 32px;
border-radius: 50%;
border: none;
background: transparent;
color: var(--sg-text-muted);
font-size: 12px;
font-weight: 600;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
&:hover {
background: var(--sg-surface-soft);
}
&.active {
background: var(--sg-primary);
color: #fff;
}
}
.filters-sidebar {
background: var(--sg-surface);
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
padding: 16px;
box-shadow: var(--sg-shadow-sm);
display: flex;
flex-direction: column;
gap: 16px;
position: sticky;
top: 16px;
}
.sidebar-header {
display: flex;
align-items: center;
gap: 8px;
padding-bottom: 12px;
border-bottom: 1px solid var(--sg-border);
mat-icon {
color: var(--sg-primary);
font-size: 20px;
width: 20px;
height: 20px;
}
h2 {
margin: 0;
font-size: 16px;
font-weight: 700;
}
}
.filter-section {
display: flex;
flex-direction: column;
gap: 8px;
}
.filter-section-title {
margin: 0;
font-size: 11px;
font-weight: 700;
color: var(--sg-text-muted);
text-transform: uppercase;
}
.topic-search-wrapper {
position: relative;
display: flex;
align-items: center;
background: var(--sg-surface-soft);
border: 1px solid var(--sg-border);
border-radius: var(--sg-radius-sm);
padding: 4px 8px;
mat-icon {
font-size: 16px;
width: 16px;
height: 16px;
color: var(--sg-text-soft);
}
input {
border: none;
background: transparent;
outline: none;
font-size: 12px;
color: var(--sg-text);
flex-grow: 1;
margin-left: 6px;
}
.clear-topic-search {
border: none;
background: transparent;
cursor: pointer;
display: flex;
color: var(--sg-text-soft);
mat-icon {
font-size: 14px;
width: 14px;
height: 14px;
}
}
}
.checkbox-list {
display: flex;
flex-direction: column;
gap: 8px;
}
.checkbox-label {
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
input[type="checkbox"] {
accent-color: var(--sg-primary);
width: 15px;
height: 15px;
cursor: pointer;
}
.checkbox-text {
font-size: 12px;
color: var(--sg-text);
}
}
.show-more-btn {
display: flex;
align-items: center;
gap: 2px;
background: transparent;
border: none;
cursor: pointer;
color: var(--sg-text-muted);
font-size: 11px;
font-weight: 700;
padding: 2px 0;
mat-icon {
font-size: 14px;
width: 14px;
height: 14px;
}
}
.sidebar-footer {
padding-top: 12px;
border-top: 1px solid var(--sg-border);
}
.submit-btn {
width: 100%;
min-height: 300px;
background: var(--sg-primary);
color: #fff;
border: none;
border-radius: var(--sg-radius-sm);
padding: 10px;
font-size: 13px;
font-weight: 700;
cursor: pointer;
transition: background 0.15s;
padding: 2rem;
&:hover:not(:disabled) {
background: var(--sg-primary-strong);
}
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
}
@media (max-width: 1024px) {
.layout-container {
grid-template-columns: 1fr;
}
.filters-sidebar {
position: static;
}
}
@media (max-width: 640px) {
.person-list-page {
padding: 12px;
}
.page-header {
flex-direction: column;
align-items: flex-start;
}
.toolbar {
flex-direction: column;
align-items: flex-start;
gap: 8px;
}
}
@@ -1,135 +1,358 @@
import { Component, computed, inject, signal, DestroyRef } from '@angular/core';
import { Router } from '@angular/router';
import { toObservable } from '@angular/core/rxjs-interop';
import { Component, inject, signal, DestroyRef } from '@angular/core';
import { Router, RouterLink, ActivatedRoute } from '@angular/router';
import { CommonModule } from '@angular/common';
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
import { MatGridListModule } from '@angular/material/grid-list';
import { MatCardModule } from '@angular/material/card';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
import { MatIconModule } from '@angular/material/icon';
import { MatChipsModule } from '@angular/material/chips';
import { MatProgressSpinner } from '@angular/material/progress-spinner';
import { Author, AuthorsListResponse, PersonsService } from '../../api';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { MatButtonModule } from '@angular/material/button';
import { CustomAuthor, PersonsSearchService } from '../../api';
import { SharedStateService } from '../../shared/services/shared-state.service';
import { distinctUntilChanged, switchMap, tap, finalize } from 'rxjs';
import { PaginationService } from '../../shared/services/pagination.service';
import { finalize } from 'rxjs';
@Component({
selector: 'app-person-list',
imports: [
MatCardModule,
MatChipsModule,
MatGridListModule,
CommonModule,
RouterLink,
ReactiveFormsModule,
MatIconModule,
MatProgressSpinner,
MatPaginatorModule,
MatProgressSpinnerModule,
MatFormFieldModule,
MatInputModule,
MatButtonModule,
],
templateUrl: './person-list.component.html',
styleUrl: './person-list.component.scss',
})
export class PersonListComponent {
private readonly router = inject(Router);
private readonly personsService = inject(PersonsService);
private readonly route = inject(ActivatedRoute);
private readonly personsSearchService = inject(PersonsSearchService);
private readonly destroyRef = inject(DestroyRef);
public readonly state = inject(SharedStateService);
public readonly paginationService = inject(PaginationService);
private readonly defaultIncludes =
'display_name,works_count,cited_by_count,topics,orcid';
private readonly defaultInstitutionName = 'University of Duisburg-Essen';
'display_name,works_count,cited_by_count,topics,orcid,relevance_rating,affiliations';
readonly loadingState = signal<boolean>(false);
persons: CustomAuthor[] = [];
total = 0;
currentPage = 1;
// Selected filter states
selectedTopics = new Set<string>();
// Filter checklists
readonly defaultTopics = [
'Artificial Intelligence',
'Big Data and Business Intelligence',
'Topic Modeling',
'Entrepreneurship Studies and Influences',
'Complex Network Analysis Techniques',
'Semantic Web and Ontologies',
'Machine Learning',
'Data Science',
'Nachhaltigkeit',
'Entrepreneurship'
];
// Forms
sortControl = new FormControl('relevance', { nonNullable: true });
topicSearchControl = new FormControl('', { nonNullable: true });
institutionControl = new FormControl('', { nonNullable: true });
showAllTopics = false;
// Bookmarking
bookmarkedIds = new Set<string>();
readonly isPersonsLoading = signal<boolean>(false);
constructor() {
toObservable(this.state.searchValue)
.pipe(
distinctUntilChanged(),
tap(() => {
this.state.hasSearched.set(false);
this.isPersonsLoading.set(true);
}),
switchMap((value) =>
value
? this.personsService
.searchPersonsByName(value, this.defaultIncludes)
.pipe(
tap((result) => {
this.state.persons.set(this.sortByRanking(result));
this.state.hasSearched.set(true);
}),
)
: this.personsService
.searchPersonsByInstitution(
this.defaultInstitutionName,
this.defaultIncludes,
)
.pipe(
tap((result) => {
this.state.persons.set(this.sortByRanking(result));
}),
),
),
finalize(() => this.isPersonsLoading.set(false)),
takeUntilDestroyed(this.destroyRef),
)
.subscribe({
next: () => this.isPersonsLoading.set(false),
error: (err) => {
console.error('Error loading persons:', err);
this.isPersonsLoading.set(false);
},
// Subscribe to route query parameters to trigger searches
this.route.queryParams
.pipe(takeUntilDestroyed(this.destroyRef))
.subscribe((params) => {
const query = params['query'] || '';
const page = params['page'] ? Number.parseInt(params['page'], 10) : 1;
const pageSize = params['pageSize'] ? Number.parseInt(params['pageSize'], 10) : 10;
const institutionName = params['institutionName'] || '';
const topics = this.parseQueryParamArray(params['topic']);
this.selectedTopics = new Set(topics);
this.currentPage = page;
this.paginationService.selection = pageSize;
// Sync search box & institution input
if (this.state.searchValue() !== query) {
this.state.searchValue.set(query || null);
}
if (this.institutionControl.value !== institutionName) {
this.institutionControl.setValue(institutionName);
}
this.load(query, page, pageSize, topics, institutionName);
});
}
// navigation
navigateID(id: string): void {
this.router.navigate(['/person', id]);
}
load(
query?: string,
page: number = 1,
pageSize: number = 10,
topics?: string[],
institutionName?: string
): void {
this.loadingState.set(true);
// sorting logic
sortByRanking(response: AuthorsListResponse): AuthorsListResponse {
if (!response.results) return response;
return {
...response,
results: [...response.results].sort((personA, personB) => {
const rankDiff = this.getSortRank(personA) - this.getSortRank(personB);
if (rankDiff !== 0) {
return rankDiff;
this.personsSearchService.searchPersonsList(
query || undefined,
institutionName || undefined,
topics?.length ? topics : undefined,
page,
pageSize,
this.defaultIncludes
)
.pipe(
finalize(() => this.loadingState.set(false)),
takeUntilDestroyed(this.destroyRef)
)
.subscribe({
next: (response) => {
this.persons = (response.results ?? []) as CustomAuthor[];
this.total = response.meta?.count ?? 0;
},
error: (err) => {
console.error('Error loading persons:', err);
}
return this.getWorksCount(personB) - this.getWorksCount(personA);
}),
};
});
}
getWorksCount(person: Author): number {
return person.works_count ?? 0;
}
getSortRank(person: Author): number {
if (this.hasInstitution(person) && this.hasOrcid(person)) return 0;
if (this.hasInstitution(person)) return 1;
if (this.hasOrcid(person)) return 2;
return 3;
}
hasInstitution(person: Author): boolean {
if (!person.affiliations) {
return false;
// Getters for filtered results
get sortedPersons(): CustomAuthor[] {
const sorted = [...this.persons];
const val = this.sortControl.value;
if (val === 'works') {
return sorted.sort((a, b) => (b.works_count ?? 0) - (a.works_count ?? 0));
} else if (val === 'citations') {
return sorted.sort((a, b) => (b.cited_by_count ?? 0) - (a.cited_by_count ?? 0));
}
for (const affiliation of person.affiliations) {
if (affiliation.institution) {
return true;
}
return sorted; // relevance (Elasticsearch default order)
}
get loading(): boolean {
return this.loadingState();
}
// Topics checklist processing
get topicsList(): string[] {
const set = new Set<string>(this.defaultTopics);
this.persons.forEach(p => {
p.topics?.forEach(t => {
if (t.display_name) set.add(t.display_name);
});
});
return Array.from(set);
}
get filteredTopicsList(): string[] {
const filter = this.topicSearchControl.value.toLowerCase().trim();
let list = this.topicsList;
if (filter) {
list = list.filter(t => t.toLowerCase().includes(filter));
}
return false;
return this.showAllTopics ? list : list.slice(0, 5);
}
hasOrcid(person: Author): boolean {
const ids = person.ids as { orcid?: string } | null | undefined;
return !!ids?.orcid;
toggleShowAllTopics(): void {
this.showAllTopics = !this.showAllTopics;
}
getDistinguishingId(person: Author): string {
const ids = person.ids as { orcid?: string } | null | undefined;
const orcid = ids?.orcid;
// Filter selection checks
isTopicSelected(topic: string): boolean {
return this.selectedTopics.has(topic);
}
return orcid
? 'ORCID: ' + orcid.replace('https://orcid.org/', '')
: 'OpenAlexID: ' + person.id;
toggleTopic(topic: string): void {
if (this.selectedTopics.has(topic)) {
this.selectedTopics.delete(topic);
} else {
this.selectedTopics.add(topic);
}
this.applySidebarFilters();
}
// Active filters tags row
get activeFilters(): Array<{ category: string, value: string, label: string }> {
const list: Array<{ category: string, value: string, label: string }> = [];
this.selectedTopics.forEach(t => {
list.push({ category: 'topic', value: t, label: t });
});
if (this.institutionControl.value) {
list.push({
category: 'institutionName',
value: this.institutionControl.value,
label: `Institution: ${this.institutionControl.value}`
});
}
return list;
}
removeFilter(filter: { category: string, value: string }): void {
if (filter.category === 'topic') {
this.selectedTopics.delete(filter.value);
} else if (filter.category === 'institutionName') {
this.institutionControl.setValue('');
}
this.applySidebarFilters();
}
clearAllFilters(): void {
this.selectedTopics.clear();
this.institutionControl.setValue('');
this.applySidebarFilters();
}
applySidebarFilters(): void {
this.router.navigate([], {
queryParams: {
topic: this.selectedTopics.size ? Array.from(this.selectedTopics) : null,
institutionName: this.institutionControl.value || null,
page: 1,
},
queryParamsHandling: 'merge',
});
}
// Pagination custom calculation
get totalPages(): number {
return Math.max(1, Math.ceil(this.total / this.paginationService.selection));
}
get pageList(): number[] {
const list: number[] = [];
const maxPagesToShow = 5;
let start = Math.max(1, this.currentPage - 2);
let end = Math.min(this.totalPages, start + maxPagesToShow - 1);
if (end - start + 1 < maxPagesToShow) {
start = Math.max(1, end - maxPagesToShow + 1);
}
for (let i = start; i <= end; i++) {
list.push(i);
}
return list;
}
isFirstPage(): boolean {
return this.currentPage === 1;
}
isLastPage(): boolean {
return this.currentPage >= this.totalPages;
}
prevPage(): void {
if (!this.isFirstPage()) {
this.goToPage(this.currentPage - 1);
}
}
nextPage(): void {
if (!this.isLastPage()) {
this.goToPage(this.currentPage + 1);
}
}
goToPage(p: number): void {
this.router.navigate([], {
queryParams: { page: p },
queryParamsHandling: 'merge'
});
}
resultRange(): string {
if (!this.total || !this.persons.length) return '0-0 von 0 Personen';
const start = (this.currentPage - 1) * this.paginationService.selection + 1;
const end = start + this.persons.length - 1;
return `${start}-${end} von ${this.total} Personen`;
}
// Model parsing / UI Helpers
institution(person: CustomAuthor): string {
return (
person.affiliations?.[0]?.institution?.display_name ||
person.last_known_institutions?.[0]?.display_name ||
'Unbekannte Institution'
);
}
topics(person: CustomAuthor): string[] {
return (person.topics ?? [])
.map((t) => t.display_name)
.filter((name): name is string => !!name)
.slice(0, 3);
}
getInitials(name: string | null | undefined): string {
if (!name) return 'U';
const cleanName = name.replace(/Prof\.|Dr\.|M\.Sc\./g, '').trim();
const parts = cleanName.split(' ');
const first = parts[0]?.[0] || '';
const last = parts[parts.length - 1]?.[0] || '';
return (first + last).toUpperCase();
}
getRatingClass(rating: string | null | undefined): string {
const r = (rating || '').toLowerCase();
if (r === 'sehr geeignet') return 'very-suitable';
if (r === 'geeignet') return 'suitable';
return 'possible';
}
// Bookmarks
toggleBookmark(person: CustomAuthor): void {
if (!person.id) return;
if (this.bookmarkedIds.has(person.id)) {
this.bookmarkedIds.delete(person.id);
} else {
this.bookmarkedIds.add(person.id);
}
}
isBookmarked(person: CustomAuthor): boolean {
return !!person.id && this.bookmarkedIds.has(person.id);
}
clearSearch(): void {
this.state.searchValue.set(null);
this.router.navigate([], {
queryParams: { query: null, page: 1 },
queryParamsHandling: 'merge',
});
}
getDistinguishingId(person: CustomAuthor): string {
if (!person) return '';
if (person.orcid) {
return person.orcid.replace('https://orcid.org/', '');
}
if (person.id) {
return person.id.replace('https://openalex.org/', '');
}
return '';
}
private parseQueryParamArray(val: any): string[] {
if (!val) return [];
if (Array.isArray(val)) return val;
return [val];
}
}
@@ -1,4 +1,4 @@
@if (isPersonLoading()){
@if (!isPersonLoading()){
<section class="person-hero">
@@ -1,6 +1,9 @@
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { BehaviorSubject, Observable, takeWhile } from 'rxjs';
//import { BehaviorSubject, Observable, takeWhile } from 'rxjs';
import { filter, take, map } from 'rxjs/operators'; //TODO: review by arman
import { Observable, of } from 'rxjs'; // review
import { BehaviorSubject } from 'rxjs'; //review
export interface AuthAccount {
i: number;
@@ -161,22 +164,55 @@ export class CredentialService {
this.validating.next(false);
}
//review: arman (generated fix)
public getBearerToken(): Observable<string | undefined> {
return new Observable<string | undefined>((observer) => {
if (this.validating.value) {
this.validating.pipe(takeWhile((validating) => validating)).subscribe({
complete: () => observer.next(this.accessToken.value ? this.accessToken.value.grant.access_token : undefined)
});
} else if (!this.accessToken.value) {
observer.next(undefined);
} else if (Date.now() < this.accessToken.value.expiration) {
observer.next(this.accessToken.value.grant.access_token);
} else {
this.refreshAccessToken(this.identityToken.value!);
this.validating.pipe(takeWhile((validating) => validating)).subscribe({
complete: () => observer.next(this.accessToken.value ? this.accessToken.value.grant.access_token : undefined)
});
// 1. If we have a valid access token, return it immediately and complete.
if (this.accessToken.value && Date.now() < this.accessToken.value.expiration) {
return of(this.accessToken.value.grant.access_token);
}
// 2. If we don't have a token, and we ARE NOT currently validating, trigger a refresh.
if (!this.validating.value) {
if (!this.identityToken.value) {
return of(undefined); // No identity token to refresh with.
}
});
this.refreshAccessToken(this.identityToken.value);
}
// 3. Wait for the validation to finish, then return the resulting token.
return this.validating.pipe(
filter(isValidating => !isValidating), // Wait until validating becomes false
take(1), // Take exactly 1 emission and then automatically complete()
map(() => this.accessToken.value ? this.accessToken.value.grant.access_token : undefined)
);
}
/* Old version with added complete statements to resolve loading spinner issue
public getBearerToken(): Observable<string | undefined> {
return new Observable<string | undefined>((observer) => {
if (this.validating.value) {
this.validating.pipe(takeWhile((validating) => validating)).subscribe({
complete: () => {
observer.next(this.accessToken.value ? this.accessToken.value.grant.access_token : undefined);
observer.complete(); // added complete
}
});
} else if (!this.accessToken.value) {
observer.next(undefined);
observer.complete(); // added complete
} else if (Date.now() < this.accessToken.value.expiration) {
observer.next(this.accessToken.value.grant.access_token);
observer.complete(); // added complete
} else {
this.refreshAccessToken(this.identityToken.value!);
this.validating.pipe(takeWhile((validating) => validating)).subscribe({
complete: () => {
observer.next(this.accessToken.value ? this.accessToken.value.grant.access_token : undefined);
observer.complete(); // added complete
}
});
}
});
}
*/
}
@@ -67,12 +67,12 @@ export class AppLayoutComponent implements OnInit, OnDestroy {
this.router.navigate(['/']);
}
startSearch(){
console.log("updated to", this.searchValue.value,this.router.url)
if (this.router.url.startsWith('/persons')) {
this.router.navigate(['/persons']);
}
this.state.searchValue.set(this.searchValue.value);
const query = this.searchValue.value || null;
this.state.searchValue.set(query);
this.router.navigate(['/persons'], {
queryParams: { query, page: 1 },
queryParamsHandling: 'merge',
});
}
navigateBack(){
this.location.back()
@@ -19,6 +19,7 @@
<a
mat-list-item
[routerLink]="item.disabled ? null : item.route"
[queryParams]="item.queryParams || null"
routerLinkActive="active"
[class.disabled]="item.disabled"
>
@@ -21,7 +21,13 @@ import { CredentialService } from '../../services/credential.service';
export class AppMenuComponent {
navItems = [
{ label: 'Dashboard', icon: 'dashboard', route: '/items', disabled: false },
{ label: 'Personen', icon: 'groups', route: '/persons', disabled: false },
{
label: 'Personen',
icon: 'groups',
route: '/persons',
queryParams: { institutionName: 'University of Duisburg-Essen' },
disabled: false,
},
];
constructor(public credentialService: CredentialService) {}